mirror of
https://github.com/osukey/osukey.git
synced 2025-06-25 13:18:03 +09:00
Merge pull request #13942 from peppy/fix-autoplay-results-timestamp
Avoid showing time of play on results screen when autoplay
This commit is contained in:
commit
3121836741
@ -12,6 +12,7 @@ using osu.Framework.Testing;
|
|||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu;
|
using osu.Game.Rulesets.Osu;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
using osu.Game.Screens.Ranking;
|
using osu.Game.Screens.Ranking;
|
||||||
@ -50,9 +51,33 @@ namespace osu.Game.Tests.Visual.Ranking
|
|||||||
|
|
||||||
AddAssert("mapped by text not present", () =>
|
AddAssert("mapped by text not present", () =>
|
||||||
this.ChildrenOfType<OsuSpriteText>().All(spriteText => !containsAny(spriteText.Text.ToString(), "mapped", "by")));
|
this.ChildrenOfType<OsuSpriteText>().All(spriteText => !containsAny(spriteText.Text.ToString(), "mapped", "by")));
|
||||||
|
|
||||||
|
AddAssert("play time displayed", () => this.ChildrenOfType<ExpandedPanelMiddleContent.PlayedOnText>().Any());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showPanel(ScoreInfo score) => Child = new ExpandedPanelMiddleContentContainer(score);
|
[Test]
|
||||||
|
public void TestWithDefaultDate()
|
||||||
|
{
|
||||||
|
AddStep("show autoplay score", () =>
|
||||||
|
{
|
||||||
|
var ruleset = new OsuRuleset();
|
||||||
|
|
||||||
|
var mods = new Mod[] { ruleset.GetAutoplayMod() };
|
||||||
|
var beatmap = createTestBeatmap(null);
|
||||||
|
|
||||||
|
showPanel(new TestScoreInfo(ruleset.RulesetInfo)
|
||||||
|
{
|
||||||
|
Mods = mods,
|
||||||
|
Beatmap = beatmap,
|
||||||
|
Date = default,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
AddAssert("play time not displayed", () => !this.ChildrenOfType<ExpandedPanelMiddleContent.PlayedOnText>().Any());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void showPanel(ScoreInfo score) =>
|
||||||
|
Child = new ExpandedPanelMiddleContentContainer(score);
|
||||||
|
|
||||||
private BeatmapInfo createTestBeatmap(User author)
|
private BeatmapInfo createTestBeatmap(User author)
|
||||||
{
|
{
|
||||||
|
@ -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 System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
@ -79,9 +80,7 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
|
|
||||||
var starDifficulty = beatmapDifficultyCache.GetDifficultyAsync(beatmap, score.Ruleset, score.Mods).Result;
|
var starDifficulty = beatmapDifficultyCache.GetDifficultyAsync(beatmap, score.Ruleset, score.Mods).Result;
|
||||||
|
|
||||||
InternalChildren = new Drawable[]
|
AddInternal(new FillFlowContainer
|
||||||
{
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
@ -226,15 +225,10 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
});
|
||||||
new OsuSpriteText
|
|
||||||
{
|
if (score.Date != default)
|
||||||
Anchor = Anchor.BottomCentre,
|
AddInternal(new PlayedOnText(score.Date));
|
||||||
Origin = Anchor.BottomCentre,
|
|
||||||
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold),
|
|
||||||
Text = $"Played on {score.Date.ToLocalTime():d MMMM yyyy HH:mm}"
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
if (score.Mods.Any())
|
if (score.Mods.Any())
|
||||||
{
|
{
|
||||||
@ -276,5 +270,16 @@ namespace osu.Game.Screens.Ranking.Expanded
|
|||||||
FinishTransforms(true);
|
FinishTransforms(true);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class PlayedOnText : OsuSpriteText
|
||||||
|
{
|
||||||
|
public PlayedOnText(DateTimeOffset time)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre;
|
||||||
|
Origin = Anchor.BottomCentre;
|
||||||
|
Font = OsuFont.GetFont(size: 10, weight: FontWeight.SemiBold);
|
||||||
|
Text = $"Played on {time.ToLocalTime():d MMMM yyyy HH:mm}";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user