mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Merge branch 'master' into change-mod-scroll-behaviour
This commit is contained in:
@ -62,7 +62,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
AddStep("click select all button", () =>
|
AddStep("click select all button", () =>
|
||||||
{
|
{
|
||||||
InputManager.MoveMouseTo(this.ChildrenOfType<ShearedButton>().First());
|
InputManager.MoveMouseTo(this.ChildrenOfType<ShearedButton>().ElementAt(1));
|
||||||
InputManager.Click(MouseButton.Left);
|
InputManager.Click(MouseButton.Left);
|
||||||
});
|
});
|
||||||
AddUntilStep("all mods selected", assertAllAvailableModsSelected);
|
AddUntilStep("all mods selected", assertAllAvailableModsSelected);
|
||||||
|
@ -432,6 +432,25 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddUntilStep("all mods deselected", () => !SelectedMods.Value.Any());
|
AddUntilStep("all mods deselected", () => !SelectedMods.Value.Any());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestCloseViaBackButton()
|
||||||
|
{
|
||||||
|
createScreen();
|
||||||
|
changeRuleset(0);
|
||||||
|
|
||||||
|
AddStep("select difficulty adjust", () => SelectedMods.Value = new Mod[] { new OsuModDifficultyAdjust() });
|
||||||
|
assertCustomisationToggleState(disabled: false, active: true);
|
||||||
|
AddAssert("back button disabled", () => !this.ChildrenOfType<ShearedButton>().First().Enabled.Value);
|
||||||
|
|
||||||
|
AddStep("dismiss customisation area", () => InputManager.Key(Key.Escape));
|
||||||
|
AddStep("click back button", () =>
|
||||||
|
{
|
||||||
|
InputManager.MoveMouseTo(this.ChildrenOfType<ShearedButton>().First());
|
||||||
|
InputManager.Click(MouseButton.Left);
|
||||||
|
});
|
||||||
|
AddAssert("mod select hidden", () => modSelectScreen.State.Value == Visibility.Hidden);
|
||||||
|
}
|
||||||
|
|
||||||
private void waitForColumnLoad() => AddUntilStep("all column content loaded",
|
private void waitForColumnLoad() => AddUntilStep("all column content loaded",
|
||||||
() => modSelectScreen.ChildrenOfType<ModColumn>().Any() && modSelectScreen.ChildrenOfType<ModColumn>().All(column => column.IsLoaded && column.ItemsLoaded));
|
() => modSelectScreen.ChildrenOfType<ModColumn>().Any() && modSelectScreen.ChildrenOfType<ModColumn>().All(column => column.IsLoaded && column.ItemsLoaded));
|
||||||
|
|
||||||
|
@ -59,6 +59,16 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString Importing => new TranslatableString(getKey(@"importing"), @"Importing...");
|
public static LocalisableString Importing => new TranslatableString(getKey(@"importing"), @"Importing...");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Deselect All"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString DeselectAll => new TranslatableString(getKey(@"deselect_all"), @"Deselect All");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Select All"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString SelectAll => new TranslatableString(getKey(@"select_all"), @"Select All");
|
||||||
|
|
||||||
private static string getKey(string key) => $@"{prefix}:{key}";
|
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
19
osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs
Normal file
19
osu.Game/Localisation/DifficultyMultiplierDisplayStrings.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
|
||||||
|
namespace osu.Game.Localisation
|
||||||
|
{
|
||||||
|
public static class DifficultyMultiplierDisplayStrings
|
||||||
|
{
|
||||||
|
private const string prefix = @"osu.Game.Resources.Localisation.DifficultyMultiplierDisplay";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Difficulty Multiplier"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString DifficultyMultiplier => new TranslatableString(getKey(@"difficulty_multiplier"), @"Difficulty Multiplier");
|
||||||
|
|
||||||
|
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||||
|
}
|
||||||
|
}
|
29
osu.Game/Localisation/ModSelectScreenStrings.cs
Normal file
29
osu.Game/Localisation/ModSelectScreenStrings.cs
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using osu.Framework.Localisation;
|
||||||
|
|
||||||
|
namespace osu.Game.Localisation
|
||||||
|
{
|
||||||
|
public static class ModSelectScreenStrings
|
||||||
|
{
|
||||||
|
private const string prefix = @"osu.Game.Resources.Localisation.ModSelectScreen";
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Mod Select"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString ModSelectTitle => new TranslatableString(getKey(@"mod_select_title"), @"Mod Select");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play. Others are just for fun."
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString ModSelectDescription => new TranslatableString(getKey(@"mod_select_description"), @"Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play. Others are just for fun.");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Mod Customisation"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString ModCustomisation => new TranslatableString(getKey(@"mod_customisation"), @"Mod Customisation");
|
||||||
|
|
||||||
|
private static string getKey(string key) => $@"{prefix}:{key}";
|
||||||
|
}
|
||||||
|
}
|
@ -15,6 +15,7 @@ using osu.Game.Graphics.Sprites;
|
|||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
@ -99,7 +100,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Margin = new MarginPadding { Horizontal = 18 },
|
Margin = new MarginPadding { Horizontal = 18 },
|
||||||
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
|
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0),
|
||||||
Text = "Difficulty Multiplier",
|
Text = DifficultyMultiplierDisplayStrings.DifficultyMultiplier,
|
||||||
Font = OsuFont.Default.With(size: 17, weight: FontWeight.SemiBold)
|
Font = OsuFont.Default.With(size: 17, weight: FontWeight.SemiBold)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -22,6 +23,7 @@ using osu.Framework.Input.Events;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Utils;
|
using osu.Game.Utils;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
@ -220,7 +222,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
Scale = new Vector2(0.8f),
|
Scale = new Vector2(0.8f),
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
LabelText = "Enable All",
|
|
||||||
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0)
|
Shear = new Vector2(-ShearedOverlayContainer.SHEAR, 0)
|
||||||
});
|
});
|
||||||
panelFlow.Padding = new MarginPadding
|
panelFlow.Padding = new MarginPadding
|
||||||
@ -265,6 +266,19 @@ namespace osu.Game.Overlays.Mods
|
|||||||
contentBackground.Colour = colourProvider.Background4;
|
contentBackground.Colour = colourProvider.Background4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
|
||||||
|
toggleAllCheckbox?.Current.BindValueChanged(_ => updateToggleAllText(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateToggleAllText()
|
||||||
|
{
|
||||||
|
Debug.Assert(toggleAllCheckbox != null);
|
||||||
|
toggleAllCheckbox.LabelText = toggleAllCheckbox.Current.Value ? CommonStrings.DeselectAll : CommonStrings.SelectAll;
|
||||||
|
}
|
||||||
|
|
||||||
private void updateLocalAvailableMods()
|
private void updateLocalAvailableMods()
|
||||||
{
|
{
|
||||||
var newMods = ModUtils.FlattenMods(availableMods.Value.GetValueOrDefault(ModType) ?? Array.Empty<Mod>())
|
var newMods = ModUtils.FlattenMods(availableMods.Value.GetValueOrDefault(ModType) ?? Array.Empty<Mod>())
|
||||||
|
@ -23,11 +23,14 @@ using osu.Game.Input.Bindings;
|
|||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
public abstract class ModSelectScreen : ShearedOverlayContainer
|
public abstract class ModSelectScreen : ShearedOverlayContainer
|
||||||
{
|
{
|
||||||
|
protected const int BUTTON_WIDTH = 200;
|
||||||
|
|
||||||
protected override OverlayColourScheme ColourScheme => OverlayColourScheme.Green;
|
protected override OverlayColourScheme ColourScheme => OverlayColourScheme.Green;
|
||||||
|
|
||||||
[Cached]
|
[Cached]
|
||||||
@ -56,14 +59,14 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
protected virtual IEnumerable<ShearedButton> CreateFooterButtons() => new[]
|
protected virtual IEnumerable<ShearedButton> CreateFooterButtons() => new[]
|
||||||
{
|
{
|
||||||
customisationButton = new ShearedToggleButton(200)
|
customisationButton = new ShearedToggleButton(BUTTON_WIDTH)
|
||||||
{
|
{
|
||||||
Text = "Mod Customisation",
|
Text = ModSelectScreenStrings.ModCustomisation,
|
||||||
Active = { BindTarget = customisationVisible }
|
Active = { BindTarget = customisationVisible }
|
||||||
},
|
},
|
||||||
new ShearedButton(200)
|
new ShearedButton(BUTTON_WIDTH)
|
||||||
{
|
{
|
||||||
Text = "Deselect All",
|
Text = CommonStrings.DeselectAll,
|
||||||
Action = DeselectAll
|
Action = DeselectAll
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -74,14 +77,16 @@ namespace osu.Game.Overlays.Mods
|
|||||||
private ModSettingsArea modSettingsArea = null!;
|
private ModSettingsArea modSettingsArea = null!;
|
||||||
private ColumnScrollContainer columnScroll = null!;
|
private ColumnScrollContainer columnScroll = null!;
|
||||||
private ColumnFlowContainer columnFlow = null!;
|
private ColumnFlowContainer columnFlow = null!;
|
||||||
private ShearedToggleButton? customisationButton;
|
|
||||||
private FillFlowContainer<ShearedButton> footerButtonFlow = null!;
|
private FillFlowContainer<ShearedButton> footerButtonFlow = null!;
|
||||||
|
private ShearedButton backButton = null!;
|
||||||
|
private ShearedToggleButton? customisationButton;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Header.Title = "Mod Select";
|
Header.Title = ModSelectScreenStrings.ModSelectTitle;
|
||||||
Header.Description = "Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play. Others are just for fun.";
|
Header.Description = ModSelectScreenStrings.ModSelectDescription;
|
||||||
|
|
||||||
AddRange(new Drawable[]
|
AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
@ -170,7 +175,13 @@ namespace osu.Game.Overlays.Mods
|
|||||||
Horizontal = 70
|
Horizontal = 70
|
||||||
},
|
},
|
||||||
Spacing = new Vector2(10),
|
Spacing = new Vector2(10),
|
||||||
ChildrenEnumerable = CreateFooterButtons()
|
ChildrenEnumerable = CreateFooterButtons().Prepend(backButton = new ShearedButton(BUTTON_WIDTH)
|
||||||
|
{
|
||||||
|
Text = CommonStrings.Back,
|
||||||
|
Action = Hide,
|
||||||
|
DarkerColour = colours.Pink2,
|
||||||
|
LighterColour = colours.Pink1
|
||||||
|
})
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,9 +366,12 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
public override bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
|
||||||
{
|
{
|
||||||
if (e.Action == GlobalAction.Back && customisationVisible.Value)
|
if (e.Action == GlobalAction.Back)
|
||||||
{
|
{
|
||||||
|
if (customisationVisible.Value)
|
||||||
customisationVisible.Value = false;
|
customisationVisible.Value = false;
|
||||||
|
else
|
||||||
|
backButton.TriggerClick();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osuTK.Input;
|
using osuTK.Input;
|
||||||
|
using osu.Game.Localisation;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay
|
namespace osu.Game.Screens.OnlinePlay
|
||||||
{
|
{
|
||||||
@ -30,18 +31,18 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
|
|
||||||
protected override IEnumerable<ShearedButton> CreateFooterButtons() => new[]
|
protected override IEnumerable<ShearedButton> CreateFooterButtons() => new[]
|
||||||
{
|
{
|
||||||
new ShearedButton(200)
|
new ShearedButton(BUTTON_WIDTH)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Text = "Select All",
|
Text = CommonStrings.SelectAll,
|
||||||
Action = SelectAll
|
Action = SelectAll
|
||||||
},
|
},
|
||||||
new ShearedButton(200)
|
new ShearedButton(BUTTON_WIDTH)
|
||||||
{
|
{
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Text = "Deselect All",
|
Text = CommonStrings.DeselectAll,
|
||||||
Action = DeselectAll
|
Action = DeselectAll
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user