mirror of
https://github.com/osukey/osukey.git
synced 2025-05-07 06:37:18 +09:00
Use Bindable for setting score
This commit is contained in:
parent
0584ee9ce5
commit
d30ae24f58
@ -43,8 +43,9 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
});
|
});
|
||||||
|
|
||||||
AddStep(@"Trigger visibility", topScoreContainer.ToggleVisibility);
|
AddStep(@"Trigger visibility", topScoreContainer.ToggleVisibility);
|
||||||
AddStep(@"Add score", () => topScoreContainer.TopScore = scores[0]);
|
AddStep(@"Add score", () => topScoreContainer.TopScore.Value = scores[0]);
|
||||||
AddStep(@"Add another score", () => topScoreContainer.TopScore = scores[1]);
|
AddStep(@"Add another score", () => topScoreContainer.TopScore.Value = scores[1]);
|
||||||
|
AddStep(@"Add null score", () => topScoreContainer.TopScore.Value = null);
|
||||||
|
|
||||||
scores = new APILegacyUserTopScoreInfo[]
|
scores = new APILegacyUserTopScoreInfo[]
|
||||||
{
|
{
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
@ -18,14 +19,7 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
private readonly Container contentContainer;
|
private readonly Container contentContainer;
|
||||||
private readonly Container scoreContainer;
|
private readonly Container scoreContainer;
|
||||||
|
|
||||||
public APILegacyUserTopScoreInfo TopScore
|
public Bindable<APILegacyUserTopScoreInfo> TopScore = new Bindable<APILegacyUserTopScoreInfo>();
|
||||||
{
|
|
||||||
set
|
|
||||||
{
|
|
||||||
scoreContainer.Clear();
|
|
||||||
scoreContainer.Add(new LeaderboardScore(value.Score, value.Position));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool StartHidden => true;
|
protected override bool StartHidden => true;
|
||||||
|
|
||||||
@ -62,6 +56,16 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
TopScore.BindValueChanged((score) => onScoreChanged(score.NewValue));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void onScoreChanged(APILegacyUserTopScoreInfo score)
|
||||||
|
{
|
||||||
|
scoreContainer.Clear();
|
||||||
|
|
||||||
|
if (score != null)
|
||||||
|
scoreContainer.Add(new LeaderboardScore(score.Score, score.Position));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user