mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
greatly expanded tests for ModSelectOverlay
This commit is contained in:
@ -25,12 +25,13 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
private const float content_width = 0.8f;
|
||||
|
||||
private Color4 lowMultiplierColour, highMultiplierColour;
|
||||
protected Color4 LowMultiplierColour, HighMultiplierColour;
|
||||
|
||||
private readonly OsuSpriteText multiplierLabel;
|
||||
protected readonly TriangleButton DeselectAllButton;
|
||||
protected readonly OsuSpriteText MultiplierLabel;
|
||||
private readonly FillFlowContainer footerContainer;
|
||||
|
||||
private readonly FillFlowContainer<ModSection> modSectionsContainer;
|
||||
protected readonly FillFlowContainer<ModSection> ModSectionsContainer;
|
||||
|
||||
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>();
|
||||
|
||||
@ -40,7 +41,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
var instance = newRuleset.CreateInstance();
|
||||
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
foreach (ModSection section in ModSectionsContainer.Children)
|
||||
section.Mods = instance.GetModsFor(section.ModType);
|
||||
refreshSelectedMods();
|
||||
}
|
||||
@ -48,8 +49,8 @@ namespace osu.Game.Overlays.Mods
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuColour colours, OsuGame osu, RulesetStore rulesets)
|
||||
{
|
||||
lowMultiplierColour = colours.Red;
|
||||
highMultiplierColour = colours.Green;
|
||||
LowMultiplierColour = colours.Red;
|
||||
HighMultiplierColour = colours.Green;
|
||||
|
||||
if (osu != null)
|
||||
Ruleset.BindTo(osu.Ruleset);
|
||||
@ -67,7 +68,7 @@ namespace osu.Game.Overlays.Mods
|
||||
footerContainer.MoveToX(footerContainer.DrawSize.X, DISAPPEAR_DURATION, Easing.InSine);
|
||||
footerContainer.FadeOut(DISAPPEAR_DURATION, Easing.InSine);
|
||||
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
foreach (ModSection section in ModSectionsContainer.Children)
|
||||
{
|
||||
section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), DISAPPEAR_DURATION, Easing.InSine);
|
||||
section.ButtonsContainer.MoveToX(100f, DISAPPEAR_DURATION, Easing.InSine);
|
||||
@ -82,7 +83,7 @@ namespace osu.Game.Overlays.Mods
|
||||
footerContainer.MoveToX(0, APPEAR_DURATION, Easing.OutQuint);
|
||||
footerContainer.FadeIn(APPEAR_DURATION, Easing.OutQuint);
|
||||
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
foreach (ModSection section in ModSectionsContainer.Children)
|
||||
{
|
||||
section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), APPEAR_DURATION, Easing.OutQuint);
|
||||
section.ButtonsContainer.MoveToX(0, APPEAR_DURATION, Easing.OutQuint);
|
||||
@ -92,16 +93,15 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
public void DeselectAll()
|
||||
{
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
foreach (ModSection section in ModSectionsContainer.Children)
|
||||
section.DeselectAll();
|
||||
|
||||
refreshSelectedMods();
|
||||
}
|
||||
|
||||
public void DeselectTypes(Type[] modTypes)
|
||||
{
|
||||
if (modTypes.Length == 0) return;
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
foreach (ModSection section in ModSectionsContainer.Children)
|
||||
section.DeselectTypes(modTypes);
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
private void refreshSelectedMods()
|
||||
{
|
||||
SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray();
|
||||
SelectedMods.Value = ModSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray();
|
||||
|
||||
double multiplier = 1.0;
|
||||
bool ranked = true;
|
||||
@ -129,16 +129,16 @@ namespace osu.Game.Overlays.Mods
|
||||
// 1.05x
|
||||
// 1.20x
|
||||
|
||||
multiplierLabel.Text = $"{multiplier:N2}x";
|
||||
MultiplierLabel.Text = $"{multiplier:N2}x";
|
||||
if (!ranked)
|
||||
multiplierLabel.Text += " (Unranked)";
|
||||
MultiplierLabel.Text += " (Unranked)";
|
||||
|
||||
if (multiplier > 1.0)
|
||||
multiplierLabel.FadeColour(highMultiplierColour, 200);
|
||||
MultiplierLabel.FadeColour(HighMultiplierColour, 200);
|
||||
else if (multiplier < 1.0)
|
||||
multiplierLabel.FadeColour(lowMultiplierColour, 200);
|
||||
MultiplierLabel.FadeColour(LowMultiplierColour, 200);
|
||||
else
|
||||
multiplierLabel.FadeColour(Color4.White, 200);
|
||||
MultiplierLabel.FadeColour(Color4.White, 200);
|
||||
}
|
||||
|
||||
public ModSelectOverlay()
|
||||
@ -241,7 +241,7 @@ namespace osu.Game.Overlays.Mods
|
||||
},
|
||||
},
|
||||
// Body
|
||||
modSectionsContainer = new FillFlowContainer<ModSection>
|
||||
ModSectionsContainer = new FillFlowContainer<ModSection>
|
||||
{
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
@ -303,7 +303,7 @@ namespace osu.Game.Overlays.Mods
|
||||
},
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new TriangleButton
|
||||
DeselectAllButton = new TriangleButton
|
||||
{
|
||||
Width = 180,
|
||||
Text = "Deselect All",
|
||||
@ -323,7 +323,7 @@ namespace osu.Game.Overlays.Mods
|
||||
Top = 5
|
||||
}
|
||||
},
|
||||
multiplierLabel = new OsuSpriteText
|
||||
MultiplierLabel = new OsuSpriteText
|
||||
{
|
||||
Font = @"Exo2.0-Bold",
|
||||
TextSize = 30,
|
||||
|
Reference in New Issue
Block a user