mirror of https://github.com/ppy/osu
Merge pull request #1372 from smoogipoo/better-medal-loading
Only update positions when the medalContainer is loaded.
This commit is contained in:
commit
300cbd3026
|
@ -27,13 +27,13 @@ public class DrawableMedal : Container, IStateful<DisplayState>
|
||||||
private readonly Sprite medalSprite, medalGlow;
|
private readonly Sprite medalSprite, medalGlow;
|
||||||
private readonly OsuSpriteText unlocked, name;
|
private readonly OsuSpriteText unlocked, name;
|
||||||
private readonly TextFlowContainer description;
|
private readonly TextFlowContainer description;
|
||||||
private readonly FillFlowContainer infoFlow;
|
|
||||||
private DisplayState state;
|
private DisplayState state;
|
||||||
public DrawableMedal(Medal medal)
|
public DrawableMedal(Medal medal)
|
||||||
{
|
{
|
||||||
this.medal = medal;
|
this.medal = medal;
|
||||||
Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2);
|
Position = new Vector2(0f, MedalOverlay.DISC_SIZE / 2);
|
||||||
|
|
||||||
|
FillFlowContainer infoFlow;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
medalContainer = new Container
|
medalContainer = new Container
|
||||||
|
@ -108,6 +108,12 @@ public DrawableMedal(Medal medal)
|
||||||
s.Origin = Anchor.TopCentre;
|
s.Origin = Anchor.TopCentre;
|
||||||
s.TextSize = 16;
|
s.TextSize = 16;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
medalContainer.OnLoadComplete = d =>
|
||||||
|
{
|
||||||
|
unlocked.Position = new Vector2(0f, medalContainer.DrawSize.Y / 2 + 10);
|
||||||
|
infoFlow.Position = new Vector2(0f, unlocked.Position.Y + 90);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
@ -123,9 +129,6 @@ protected override void LoadComplete()
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
updateState();
|
updateState();
|
||||||
|
|
||||||
unlocked.Position = new Vector2(0f, medalContainer.DrawSize.Y / 2 + 10);
|
|
||||||
infoFlow.Position = new Vector2(0f, unlocked.Position.Y + 90);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DisplayState State
|
public DisplayState State
|
||||||
|
|
Loading…
Reference in New Issue