mirror of
https://github.com/osukey/osukey.git
synced 2025-08-06 16:13:57 +09:00
Make it works and some layout adjustments
This commit is contained in:
@ -43,10 +43,10 @@ namespace osu.Game.Tests.Visual.SongSelect
|
|||||||
});
|
});
|
||||||
|
|
||||||
AddStep(@"Trigger visibility", topScoreContainer.ToggleVisibility);
|
AddStep(@"Trigger visibility", topScoreContainer.ToggleVisibility);
|
||||||
AddStep(@"Add score(rank 999)", () => topScoreContainer.TopScore.Value = scores[0]);
|
AddStep(@"Add score(rank 999)", () => topScoreContainer.Score.Value = scores[0]);
|
||||||
AddStep(@"Add score(rank 110000)", () => topScoreContainer.TopScore.Value = scores[1]);
|
AddStep(@"Add score(rank 110000)", () => topScoreContainer.Score.Value = scores[1]);
|
||||||
AddStep(@"Add score(rank 22333)", () => topScoreContainer.TopScore.Value = scores[2]);
|
AddStep(@"Add score(rank 22333)", () => topScoreContainer.Score.Value = scores[2]);
|
||||||
AddStep(@"Add null score", () => topScoreContainer.TopScore.Value = null);
|
AddStep(@"Add null score", () => topScoreContainer.Score.Value = null);
|
||||||
|
|
||||||
scores = new APILegacyUserTopScoreInfo[]
|
scores = new APILegacyUserTopScoreInfo[]
|
||||||
{
|
{
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
// 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 System;
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Screens.Select.Details;
|
using osu.Game.Screens.Select.Details;
|
||||||
using osu.Game.Screens.Select.Leaderboards;
|
using osu.Game.Screens.Select.Leaderboards;
|
||||||
|
|
||||||
@ -28,6 +28,7 @@ namespace osu.Game.Screens.Select
|
|||||||
beatmap = value;
|
beatmap = value;
|
||||||
Leaderboard.Beatmap = beatmap?.BeatmapInfo;
|
Leaderboard.Beatmap = beatmap?.BeatmapInfo;
|
||||||
Details.Beatmap = beatmap?.BeatmapInfo;
|
Details.Beatmap = beatmap?.BeatmapInfo;
|
||||||
|
TopScore.Hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,43 +58,50 @@ namespace osu.Game.Screens.Select
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new GridContainer
|
new Container
|
||||||
{
|
{
|
||||||
|
Padding = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT, Bottom = padding },
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Margin = new MarginPadding { Top = BeatmapDetailAreaTabControl.HEIGHT },
|
Child = new GridContainer
|
||||||
RowDimensions = new Dimension[]
|
|
||||||
{
|
{
|
||||||
new Dimension(GridSizeMode.Distributed),
|
RelativeSizeAxes = Axes.Both,
|
||||||
new Dimension(GridSizeMode.AutoSize),
|
RowDimensions = new Dimension[]
|
||||||
},
|
|
||||||
Content = new[]
|
|
||||||
{
|
|
||||||
new Drawable[]
|
|
||||||
{
|
{
|
||||||
new Container
|
new Dimension(GridSizeMode.Distributed),
|
||||||
|
new Dimension(GridSizeMode.AutoSize),
|
||||||
|
},
|
||||||
|
Content = new[]
|
||||||
|
{
|
||||||
|
new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
new Container
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
Details = new BeatmapDetails
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
Details = new BeatmapDetails
|
||||||
Alpha = 0,
|
{
|
||||||
Padding = new MarginPadding { Vertical = padding },
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
Alpha = 0,
|
||||||
Leaderboard = new BeatmapLeaderboard
|
Padding = new MarginPadding { Top = padding },
|
||||||
{
|
},
|
||||||
RelativeSizeAxes = Axes.Both,
|
Leaderboard = new BeatmapLeaderboard
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
new Drawable[]
|
||||||
|
{
|
||||||
|
TopScore = new UserTopScoreContainer
|
||||||
|
{
|
||||||
|
Score = { BindTarget = Leaderboard.TopScore }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new Drawable[]
|
|
||||||
{
|
|
||||||
TopScore = new UserTopScoreContainer(),
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,13 +13,13 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
{
|
{
|
||||||
public class UserTopScoreContainer : VisibilityContainer
|
public class UserTopScoreContainer : VisibilityContainer
|
||||||
{
|
{
|
||||||
private const int height = 110;
|
private const int height = 90;
|
||||||
private const int duration = 300;
|
private const int duration = 300;
|
||||||
|
|
||||||
private readonly Container contentContainer;
|
private readonly Container contentContainer;
|
||||||
private readonly Container scoreContainer;
|
private readonly Container scoreContainer;
|
||||||
|
|
||||||
public Bindable<APILegacyUserTopScoreInfo> TopScore = new Bindable<APILegacyUserTopScoreInfo>();
|
public Bindable<APILegacyUserTopScoreInfo> Score = new Bindable<APILegacyUserTopScoreInfo>();
|
||||||
|
|
||||||
protected override bool StartHidden => true;
|
protected override bool StartHidden => true;
|
||||||
|
|
||||||
@ -37,13 +37,13 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Height = height,
|
Height = height,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Padding = new MarginPadding { Vertical = 10 },
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
|
Margin = new MarginPadding { Top = 5 },
|
||||||
Text = @"your personal best".ToUpper(),
|
Text = @"your personal best".ToUpper(),
|
||||||
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold),
|
Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold),
|
||||||
},
|
},
|
||||||
@ -58,7 +58,7 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
TopScore.BindValueChanged((score) => onScoreChanged(score.NewValue));
|
Score.BindValueChanged((score) => onScoreChanged(score.NewValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onScoreChanged(APILegacyUserTopScoreInfo score)
|
private void onScoreChanged(APILegacyUserTopScoreInfo score)
|
||||||
@ -66,7 +66,10 @@ namespace osu.Game.Screens.Select.Details
|
|||||||
scoreContainer.Clear();
|
scoreContainer.Clear();
|
||||||
|
|
||||||
if (score != null)
|
if (score != null)
|
||||||
|
{
|
||||||
scoreContainer.Add(new LeaderboardScore(score.Score, score.Position));
|
scoreContainer.Add(new LeaderboardScore(score.Score, score.Position));
|
||||||
|
Show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Bindables;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
|
using osu.Game.Online.API.Requests.Responses;
|
||||||
using osu.Game.Online.Leaderboards;
|
using osu.Game.Online.Leaderboards;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
@ -18,6 +19,8 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
{
|
{
|
||||||
public class BeatmapLeaderboard : Leaderboard<BeatmapLeaderboardScope, ScoreInfo>
|
public class BeatmapLeaderboard : Leaderboard<BeatmapLeaderboardScope, ScoreInfo>
|
||||||
{
|
{
|
||||||
|
public Bindable<APILegacyUserTopScoreInfo> TopScore = new Bindable<APILegacyUserTopScoreInfo>();
|
||||||
|
|
||||||
public Action<ScoreInfo> ScoreSelected;
|
public Action<ScoreInfo> ScoreSelected;
|
||||||
|
|
||||||
private BeatmapInfo beatmap;
|
private BeatmapInfo beatmap;
|
||||||
@ -133,7 +136,11 @@ namespace osu.Game.Screens.Select.Leaderboards
|
|||||||
|
|
||||||
var req = new GetScoresRequest(Beatmap, ruleset.Value ?? Beatmap.Ruleset, Scope, requestMods);
|
var req = new GetScoresRequest(Beatmap, ruleset.Value ?? Beatmap.Ruleset, Scope, requestMods);
|
||||||
|
|
||||||
req.Success += r => scoresCallback?.Invoke(r.Scores);
|
req.Success += r =>
|
||||||
|
{
|
||||||
|
scoresCallback?.Invoke(r.Scores);
|
||||||
|
TopScore.Value = r.UserScore;
|
||||||
|
};
|
||||||
|
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user