mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 20:22:56 +08:00
Move and tweak avatar class
This commit is contained in:
parent
68f3a1b71d
commit
c31796c957
41
osu.Game/Graphics/Avatar.cs
Normal file
41
osu.Game/Graphics/Avatar.cs
Normal file
@ -0,0 +1,41 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.IO.Stores;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Graphics
|
||||
{
|
||||
public class Avatar : Sprite
|
||||
{
|
||||
private int userId;
|
||||
private int rounding;
|
||||
private int avatarSize = 50;
|
||||
|
||||
|
||||
public Avatar(int userid, int avatarsize, int round)
|
||||
{
|
||||
this.userId = uId;
|
||||
this.avatarSize = aSize;
|
||||
this.rounding = round;
|
||||
Anchor = Anchor.Centre;
|
||||
Origin = Anchor.Centre;
|
||||
}
|
||||
|
||||
public override async void Load(BaseGame game)
|
||||
{
|
||||
base.Load(game);
|
||||
|
||||
Texture = await game.Textures.GetAsync($@"https://a.ppy.sh/{userId}");
|
||||
Size = new Vector2(avatarSize);
|
||||
CornerRadius = rounding;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user