mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Merge branch 'master' into generic-download-model-manager
This commit is contained in:
@ -13,10 +13,6 @@ namespace osu.Game.Online.Chat
|
||||
[JsonProperty(@"message_id")]
|
||||
public readonly long? Id;
|
||||
|
||||
//todo: this should be inside sender.
|
||||
[JsonProperty(@"sender_id")]
|
||||
public long UserId;
|
||||
|
||||
[JsonProperty(@"channel_id")]
|
||||
public long ChannelId;
|
||||
|
||||
|
@ -130,6 +130,11 @@ namespace osu.Game.Online.Chat
|
||||
|
||||
public StandAloneDrawableChannel(Channel channel)
|
||||
: base(channel)
|
||||
{
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
{
|
||||
ChatLineFlow.Padding = new MarginPadding { Horizontal = 0 };
|
||||
}
|
||||
|
@ -3,72 +3,44 @@
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Scoring;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Online.Leaderboards
|
||||
{
|
||||
public class DrawableRank : Container
|
||||
public class DrawableRank : Sprite
|
||||
{
|
||||
private readonly Sprite rankSprite;
|
||||
private TextureStore textures;
|
||||
|
||||
public ScoreRank Rank { get; private set; }
|
||||
private readonly ScoreRank rank;
|
||||
|
||||
public DrawableRank(ScoreRank rank)
|
||||
{
|
||||
Rank = rank;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
rankSprite = new Sprite
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
FillMode = FillMode.Fit
|
||||
},
|
||||
};
|
||||
this.rank = rank;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(TextureStore textures)
|
||||
[BackgroundDependencyLoader(true)]
|
||||
private void load(TextureStore ts)
|
||||
{
|
||||
this.textures = textures;
|
||||
updateTexture();
|
||||
if (ts == null)
|
||||
throw new ArgumentNullException(nameof(ts));
|
||||
|
||||
Texture = ts.Get($@"Grades/{getTextureName()}");
|
||||
}
|
||||
|
||||
private void updateTexture()
|
||||
private string getTextureName()
|
||||
{
|
||||
string textureName;
|
||||
|
||||
switch (Rank)
|
||||
switch (rank)
|
||||
{
|
||||
default:
|
||||
textureName = Rank.GetDescription();
|
||||
break;
|
||||
return rank.GetDescription();
|
||||
|
||||
case ScoreRank.SH:
|
||||
textureName = "SPlus";
|
||||
break;
|
||||
return "SPlus";
|
||||
|
||||
case ScoreRank.XH:
|
||||
textureName = "SSPlus";
|
||||
break;
|
||||
return "SSPlus";
|
||||
}
|
||||
|
||||
rankSprite.Texture = textures.Get($@"Grades/{textureName}");
|
||||
}
|
||||
|
||||
public void UpdateRank(ScoreRank newRank)
|
||||
{
|
||||
Rank = newRank;
|
||||
|
||||
if (LoadState >= LoadState.Ready)
|
||||
updateTexture();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Users;
|
||||
using osu.Game.Users.Drawables;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
@ -65,7 +65,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
|
||||
statisticsLabels = GetStatistics(score).Select(s => new ScoreComponentLabel(s)).ToList();
|
||||
|
||||
Avatar innerAvatar;
|
||||
DrawableAvatar innerAvatar;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -112,7 +112,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
Children = new[]
|
||||
{
|
||||
avatar = new DelayedLoadWrapper(
|
||||
innerAvatar = new Avatar(user)
|
||||
innerAvatar = new DrawableAvatar(user)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
CornerRadius = corner_radius,
|
||||
@ -157,7 +157,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
Masking = true,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new DrawableFlag(user.Country)
|
||||
new UpdateableFlag(user.Country)
|
||||
{
|
||||
Width = 30,
|
||||
RelativeSizeAxes = Axes.Y,
|
||||
@ -193,7 +193,7 @@ namespace osu.Game.Online.Leaderboards
|
||||
Size = new Vector2(40f, 20f),
|
||||
Children = new[]
|
||||
{
|
||||
scoreRank = new DrawableRank(score.Rank)
|
||||
scoreRank = new UpdateableRank(score.Rank)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
31
osu.Game/Online/Leaderboards/UpdateableRank.cs
Normal file
31
osu.Game/Online/Leaderboards/UpdateableRank.cs
Normal file
@ -0,0 +1,31 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Online.Leaderboards
|
||||
{
|
||||
public class UpdateableRank : ModelBackedDrawable<ScoreRank>
|
||||
{
|
||||
public ScoreRank Rank
|
||||
{
|
||||
get => Model;
|
||||
set => Model = value;
|
||||
}
|
||||
|
||||
public UpdateableRank(ScoreRank rank)
|
||||
{
|
||||
Rank = rank;
|
||||
}
|
||||
|
||||
protected override Drawable CreateDrawable(ScoreRank rank) => new DrawableRank(rank)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
FillMode = FillMode.Fit,
|
||||
};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user