1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:52:53 +08:00

Merge branch 'master' into url-parsing-support

This commit is contained in:
Dean Herbert 2018-01-30 17:47:55 +09:00 committed by GitHub
commit 28b67e3d77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
25 changed files with 131 additions and 59 deletions

@ -1 +1 @@
Subproject commit 209021fb491e21625127be5dbf5efb4c409e6f06 Subproject commit 2610a3133721b0bc4af852342aa2a179d0e66497

View File

@ -32,6 +32,10 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="JetBrains.Annotations, Version=11.1.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\JetBrains.Annotations.11.1.0\lib\net20\JetBrains.Annotations.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath> <HintPath>$(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private> <Private>True</Private>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="JetBrains.Annotations" version="11.1.0" targetFramework="net461" />
<package id="NUnit" version="3.8.1" targetFramework="net461" /> <package id="NUnit" version="3.8.1" targetFramework="net461" />
<package id="ppy.OpenTK" version="3.0.11" targetFramework="net461" /> <package id="ppy.OpenTK" version="3.0.11" targetFramework="net461" />
</packages> </packages>

View File

@ -32,6 +32,10 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="JetBrains.Annotations, Version=11.1.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\JetBrains.Annotations.11.1.0\lib\net20\JetBrains.Annotations.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath> <HintPath>$(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private> <Private>True</Private>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="JetBrains.Annotations" version="11.1.0" targetFramework="net461" />
<package id="NUnit" version="3.8.1" targetFramework="net461" /> <package id="NUnit" version="3.8.1" targetFramework="net461" />
<package id="ppy.OpenTK" version="3.0.11" targetFramework="net461" /> <package id="ppy.OpenTK" version="3.0.11" targetFramework="net461" />
</packages> </packages>

View File

@ -33,6 +33,10 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="JetBrains.Annotations, Version=11.1.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\JetBrains.Annotations.11.1.0\lib\net20\JetBrains.Annotations.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath> <HintPath>$(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private> <Private>True</Private>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="JetBrains.Annotations" version="11.1.0" targetFramework="net461" />
<package id="NUnit" version="3.8.1" targetFramework="net461" /> <package id="NUnit" version="3.8.1" targetFramework="net461" />
<package id="ppy.OpenTK" version="3.0.11" targetFramework="net461" /> <package id="ppy.OpenTK" version="3.0.11" targetFramework="net461" />
</packages> </packages>

View File

@ -32,6 +32,10 @@
<TreatWarningsAsErrors>false</TreatWarningsAsErrors> <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Reference Include="JetBrains.Annotations, Version=11.1.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\JetBrains.Annotations.11.1.0\lib\net20\JetBrains.Annotations.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath> <HintPath>$(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private> <Private>True</Private>

View File

@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="JetBrains.Annotations" version="11.1.0" targetFramework="net461" />
<package id="NUnit" version="3.8.1" targetFramework="net461" /> <package id="NUnit" version="3.8.1" targetFramework="net461" />
<package id="ppy.OpenTK" version="3.0.11" targetFramework="net461" /> <package id="ppy.OpenTK" version="3.0.11" targetFramework="net461" />
</packages> </packages>

View File

@ -33,6 +33,10 @@
<Reference Include="DeepEqual, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null"> <Reference Include="DeepEqual, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>$(SolutionDir)\packages\DeepEqual.1.6.0.0\lib\net40\DeepEqual.dll</HintPath> <HintPath>$(SolutionDir)\packages\DeepEqual.1.6.0.0\lib\net40\DeepEqual.dll</HintPath>
</Reference> </Reference>
<Reference Include="JetBrains.Annotations, Version=11.1.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\JetBrains.Annotations.11.1.0\lib\net20\JetBrains.Annotations.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL"> <Reference Include="nunit.framework, Version=3.8.1.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath> <HintPath>$(SolutionDir)\packages\NUnit.3.8.1\lib\net45\nunit.framework.dll</HintPath>
<Private>True</Private> <Private>True</Private>

View File

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!-- <!--
Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>. Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
--> -->
<packages> <packages>
<package id="DeepEqual" version="1.6.0.0" targetFramework="net461" /> <package id="DeepEqual" version="1.6.0.0" targetFramework="net461" />
<package id="NUnit" version="3.8.1" targetFramework="net461" /> <package id="JetBrains.Annotations" version="11.1.0" targetFramework="net461" />
<package id="ppy.OpenTK" version="3.0.11" targetFramework="net461" /> <package id="NUnit" version="3.8.1" targetFramework="net461" />
<package id="System.ValueTuple" version="4.4.0" targetFramework="net461" /> <package id="ppy.OpenTK" version="3.0.11" targetFramework="net461" />
<package id="System.ValueTuple" version="4.4.0" targetFramework="net461" />
</packages> </packages>

View File

@ -14,7 +14,7 @@ namespace osu.Game.Input.Bindings
/// A KeyBindingInputManager with a database backing for custom overrides. /// A KeyBindingInputManager with a database backing for custom overrides.
/// </summary> /// </summary>
/// <typeparam name="T">The type of the custom action.</typeparam> /// <typeparam name="T">The type of the custom action.</typeparam>
public class DatabasedKeyBindingInputManager<T> : KeyBindingContainer<T> public class DatabasedKeyBindingContainer<T> : KeyBindingContainer<T>
where T : struct where T : struct
{ {
private readonly RulesetInfo ruleset; private readonly RulesetInfo ruleset;
@ -31,7 +31,7 @@ namespace osu.Game.Input.Bindings
/// <param name="ruleset">A reference to identify the current <see cref="Ruleset"/>. Used to lookup mappings. Null for global mappings.</param> /// <param name="ruleset">A reference to identify the current <see cref="Ruleset"/>. Used to lookup mappings. Null for global mappings.</param>
/// <param name="variant">An optional variant for the specified <see cref="Ruleset"/>. Used when a ruleset has more than one possible keyboard layouts.</param> /// <param name="variant">An optional variant for the specified <see cref="Ruleset"/>. Used when a ruleset has more than one possible keyboard layouts.</param>
/// <param name="simultaneousMode">Specify how to deal with multiple matches of <see cref="KeyCombination"/>s and <see cref="T"/>s.</param> /// <param name="simultaneousMode">Specify how to deal with multiple matches of <see cref="KeyCombination"/>s and <see cref="T"/>s.</param>
public DatabasedKeyBindingInputManager(RulesetInfo ruleset = null, int? variant = null, SimultaneousBindingMode simultaneousMode = SimultaneousBindingMode.None) public DatabasedKeyBindingContainer(RulesetInfo ruleset = null, int? variant = null, SimultaneousBindingMode simultaneousMode = SimultaneousBindingMode.None)
: base(simultaneousMode) : base(simultaneousMode)
{ {
this.ruleset = ruleset; this.ruleset = ruleset;

View File

@ -10,11 +10,11 @@ using osu.Framework.Input.Bindings;
namespace osu.Game.Input.Bindings namespace osu.Game.Input.Bindings
{ {
public class GlobalKeyBindingInputManager : DatabasedKeyBindingInputManager<GlobalAction>, IHandleGlobalInput public class GlobalActionContainer : DatabasedKeyBindingContainer<GlobalAction>, IHandleGlobalInput
{ {
private readonly Drawable handler; private readonly Drawable handler;
public GlobalKeyBindingInputManager(OsuGameBase game) public GlobalActionContainer(OsuGameBase game)
{ {
if (game is IKeyBindingHandler<GlobalAction>) if (game is IKeyBindingHandler<GlobalAction>)
handler = game; handler = game;

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using System.Collections.Generic;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Configuration; using osu.Game.Configuration;
@ -27,6 +28,7 @@ using osu.Game.Overlays.Notifications;
using osu.Game.Rulesets; using osu.Game.Rulesets;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Rulesets.Mods;
using OpenTK.Graphics; using OpenTK.Graphics;
namespace osu.Game namespace osu.Game
@ -80,6 +82,9 @@ namespace osu.Game
private SettingsOverlay settings; private SettingsOverlay settings;
// todo: move this to SongSelect once Screen has the ability to unsuspend.
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>(new List<Mod>());
public OsuGame(string[] args = null) public OsuGame(string[] args = null)
{ {
this.args = args; this.args = args;
@ -111,7 +116,7 @@ namespace osu.Game
Task.Run(() => BeatmapManager.Import(paths.ToArray())); Task.Run(() => BeatmapManager.Import(paths.ToArray()));
} }
dependencies.CacheAs<OsuGame>(this); dependencies.CacheAs(this);
configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset); configRuleset = LocalConfig.GetBindable<int>(OsuSetting.Ruleset);
Ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First(); Ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First();

View File

@ -95,7 +95,7 @@ namespace osu.Game
dependencies.Cache(new LargeTextureStore(new RawTextureLoaderStore(new NamespacedResourceStore<byte[]>(Resources, @"Textures")))); dependencies.Cache(new LargeTextureStore(new RawTextureLoaderStore(new NamespacedResourceStore<byte[]>(Resources, @"Textures"))));
dependencies.CacheAs<OsuGameBase>(this); dependencies.CacheAs(this);
dependencies.Cache(LocalConfig); dependencies.Cache(LocalConfig);
runMigrations(); runMigrations();
@ -212,10 +212,10 @@ namespace osu.Game
{ {
base.LoadComplete(); base.LoadComplete();
GlobalKeyBindingInputManager globalBinding; GlobalActionContainer globalBinding;
CursorOverrideContainer = new CursorOverrideContainer { RelativeSizeAxes = Axes.Both }; CursorOverrideContainer = new CursorOverrideContainer { RelativeSizeAxes = Axes.Both };
CursorOverrideContainer.Child = globalBinding = new GlobalKeyBindingInputManager(this) CursorOverrideContainer.Child = globalBinding = new GlobalActionContainer(this)
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Child = content = new OsuTooltipContainer(CursorOverrideContainer.Cursor) { RelativeSizeAxes = Axes.Both } Child = content = new OsuTooltipContainer(CursorOverrideContainer.Cursor) { RelativeSizeAxes = Axes.Both }

View File

@ -12,7 +12,7 @@ namespace osu.Game.Overlays.KeyBinding
public override FontAwesome Icon => FontAwesome.fa_osu_hot; public override FontAwesome Icon => FontAwesome.fa_osu_hot;
public override string Header => "Global"; public override string Header => "Global";
public GlobalKeyBindingsSection(GlobalKeyBindingInputManager manager) public GlobalKeyBindingsSection(GlobalActionContainer manager)
{ {
Add(new DefaultBindingsSubsection(manager)); Add(new DefaultBindingsSubsection(manager));
Add(new InGameKeyBindingsSubsection(manager)); Add(new InGameKeyBindingsSubsection(manager));
@ -23,7 +23,7 @@ namespace osu.Game.Overlays.KeyBinding
{ {
protected override string Header => string.Empty; protected override string Header => string.Empty;
public DefaultBindingsSubsection(GlobalKeyBindingInputManager manager) public DefaultBindingsSubsection(GlobalActionContainer manager)
: base(null) : base(null)
{ {
Defaults = manager.GlobalKeyBindings; Defaults = manager.GlobalKeyBindings;
@ -34,7 +34,7 @@ namespace osu.Game.Overlays.KeyBinding
{ {
protected override string Header => "In Game"; protected override string Header => "In Game";
public InGameKeyBindingsSubsection(GlobalKeyBindingInputManager manager) : base(null) public InGameKeyBindingsSubsection(GlobalActionContainer manager) : base(null)
{ {
Defaults = manager.InGameKeyBindings; Defaults = manager.InGameKeyBindings;
} }

View File

@ -15,7 +15,7 @@ namespace osu.Game.Overlays
protected override Drawable CreateHeader() => new SettingsHeader("key configuration", "Customise your keys!"); protected override Drawable CreateHeader() => new SettingsHeader("key configuration", "Customise your keys!");
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(RulesetStore rulesets, GlobalKeyBindingInputManager global) private void load(RulesetStore rulesets, GlobalActionContainer global)
{ {
AddSection(new GlobalKeyBindingsSection(global)); AddSection(new GlobalKeyBindingsSection(global));

View File

@ -188,17 +188,19 @@ namespace osu.Game.Overlays.Mods
start = Mods.Length - 1; start = Mods.Length - 1;
for (int i = start; i < Mods.Length && i >= 0; i += direction) for (int i = start; i < Mods.Length && i >= 0; i += direction)
{ if (SelectAt(i)) return;
if (Mods[i].HasImplementation)
{
changeSelectedIndex(i);
return;
}
}
Deselect(); Deselect();
} }
public bool SelectAt(int index)
{
if (!Mods[index].HasImplementation) return false;
changeSelectedIndex(index);
return true;
}
public void Deselect() => changeSelectedIndex(-1); public void Deselect() => changeSelectedIndex(-1);
private void displayMod(Mod mod) private void displayMod(Mod mod)

View File

@ -113,6 +113,23 @@ namespace osu.Game.Overlays.Mods
} }
} }
/// <summary>
/// Select one or more mods in this section.
/// </summary>
/// <param name="mods">The types of <see cref="Mod"/>s which should be deselected.</param>
public void SelectTypes(IEnumerable<Mod> mods)
{
foreach (var button in buttons)
{
for (int i = 0; i < button.Mods.Length; i++)
{
foreach (var mod in mods)
if (mod.GetType().IsInstanceOfType(button.Mods[i]))
button.SelectAt(i);
}
}
}
protected ModSection() protected ModSection()
{ {
AutoSizeAxes = Axes.Y; AutoSizeAxes = Axes.Y;

View File

@ -51,6 +51,8 @@ namespace osu.Game.Overlays.Mods
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(OsuColour colours, OsuGame osu, RulesetStore rulesets) private void load(OsuColour colours, OsuGame osu, RulesetStore rulesets)
{ {
SelectedMods.ValueChanged += selectedModsChanged;
LowMultiplierColour = colours.Red; LowMultiplierColour = colours.Red;
HighMultiplierColour = colours.Green; HighMultiplierColour = colours.Green;
@ -63,6 +65,37 @@ namespace osu.Game.Overlays.Mods
Ruleset.TriggerChange(); Ruleset.TriggerChange();
} }
private void selectedModsChanged(IEnumerable<Mod> obj)
{
foreach (ModSection section in ModSectionsContainer.Children)
section.SelectTypes(obj);
updateMods();
}
private void updateMods()
{
double multiplier = 1.0;
bool ranked = true;
foreach (Mod mod in SelectedMods.Value)
{
multiplier *= mod.ScoreMultiplier;
ranked &= mod.Ranked;
}
MultiplierLabel.Text = $"{multiplier:N2}x";
if (!ranked)
MultiplierLabel.Text += " (Unranked)";
if (multiplier > 1.0)
MultiplierLabel.FadeColour(HighMultiplierColour, 200);
else if (multiplier < 1.0)
MultiplierLabel.FadeColour(LowMultiplierColour, 200);
else
MultiplierLabel.FadeColour(Color4.White, 200);
}
protected override void PopOut() protected override void PopOut()
{ {
base.PopOut(); base.PopOut();
@ -97,6 +130,7 @@ namespace osu.Game.Overlays.Mods
{ {
foreach (ModSection section in ModSectionsContainer.Children) foreach (ModSection section in ModSectionsContainer.Children)
section.DeselectAll(); section.DeselectAll();
refreshSelectedMods(); refreshSelectedMods();
} }
@ -119,30 +153,7 @@ namespace osu.Game.Overlays.Mods
refreshSelectedMods(); refreshSelectedMods();
} }
private void refreshSelectedMods() 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;
foreach (Mod mod in SelectedMods.Value)
{
multiplier *= mod.ScoreMultiplier;
ranked &= mod.Ranked;
}
MultiplierLabel.Text = $"{multiplier:N2}x";
if (!ranked)
MultiplierLabel.Text += " (Unranked)";
if (multiplier > 1.0)
MultiplierLabel.FadeColour(HighMultiplierColour, 200);
else if (multiplier < 1.0)
MultiplierLabel.FadeColour(LowMultiplierColour, 200);
else
MultiplierLabel.FadeColour(Color4.White, 200);
}
public ModSelectOverlay() public ModSelectOverlay()
{ {

View File

@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.UI
public abstract class RulesetInputManager<T> : PassThroughInputManager, ICanAttachKeyCounter, IHasReplayHandler public abstract class RulesetInputManager<T> : PassThroughInputManager, ICanAttachKeyCounter, IHasReplayHandler
where T : struct where T : struct
{ {
public class RulesetKeyBindingContainer : DatabasedKeyBindingInputManager<T> public class RulesetKeyBindingContainer : DatabasedKeyBindingContainer<T>
{ {
public RulesetKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique) public RulesetKeyBindingContainer(RulesetInfo ruleset, int variant, SimultaneousBindingMode unique)
: base(ruleset, variant, unique) : base(ruleset, variant, unique)

View File

@ -13,6 +13,7 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Overlays.Mods; using osu.Game.Overlays.Mods;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Edit; using osu.Game.Screens.Edit;
using osu.Game.Screens.Play; using osu.Game.Screens.Play;
using osu.Game.Screens.Ranking; using osu.Game.Screens.Ranking;
@ -47,10 +48,13 @@ namespace osu.Game.Screens.Select
private SampleChannel sampleConfirm; private SampleChannel sampleConfirm;
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay) private void load(OsuColour colours, AudioManager audio, BeatmapManager beatmaps, DialogOverlay dialogOverlay, OsuGame game)
{ {
sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection"); sampleConfirm = audio.Sample.Get(@"SongSelect/confirm-selection");
if (game != null)
modSelect.SelectedMods.BindTo(game.SelectedMods);
Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue); Footer.AddButton(@"mods", colours.Yellow, modSelect, Key.F1, float.MaxValue);
BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1);
@ -121,6 +125,9 @@ namespace osu.Game.Screens.Select
if (Beatmap.Value.Track != null) if (Beatmap.Value.Track != null)
Beatmap.Value.Track.Looping = false; Beatmap.Value.Track.Looping = false;
Beatmap.Value.Mods.UnbindBindings();
Beatmap.Value.Mods.Value = new Mod[] { };
return false; return false;
} }

View File

@ -181,7 +181,7 @@ namespace osu.Game.Screens.Select
[BackgroundDependencyLoader(permitNulls: true)] [BackgroundDependencyLoader(permitNulls: true)]
private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours) private void load(BeatmapManager beatmaps, AudioManager audio, DialogOverlay dialog, OsuGame osu, OsuColour colours)
{ {
dependencies.CacheAs<SongSelect>(this); dependencies.CacheAs(this);
if (Footer != null) if (Footer != null)
{ {

View File

@ -91,6 +91,10 @@
<Reference Include="Humanizer, Version=2.2.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e, processorArchitecture=MSIL"> <Reference Include="Humanizer, Version=2.2.0.0, Culture=neutral, PublicKeyToken=979442b78dfc278e, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\Humanizer.Core.2.2.0\lib\netstandard1.0\Humanizer.dll</HintPath> <HintPath>$(SolutionDir)\packages\Humanizer.Core.2.2.0\lib\netstandard1.0\Humanizer.dll</HintPath>
</Reference> </Reference>
<Reference Include="JetBrains.Annotations, Version=11.1.0.0, Culture=neutral, PublicKeyToken=1010a0d8d6380325, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\JetBrains.Annotations.11.1.0\lib\net20\JetBrains.Annotations.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Data.Sqlite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL"> <Reference Include="Microsoft.Data.Sqlite, Version=2.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
<HintPath>$(SolutionDir)\packages\Microsoft.Data.Sqlite.Core.2.0.0\lib\netstandard2.0\Microsoft.Data.Sqlite.dll</HintPath> <HintPath>$(SolutionDir)\packages\Microsoft.Data.Sqlite.Core.2.0.0\lib\netstandard2.0\Microsoft.Data.Sqlite.dll</HintPath>
</Reference> </Reference>
@ -446,8 +450,8 @@
<Compile Include="Graphics\UserInterface\Volume\VolumeControlReceptor.cs" /> <Compile Include="Graphics\UserInterface\Volume\VolumeControlReceptor.cs" />
<Compile Include="Graphics\UserInterface\Volume\VolumeMeter.cs" /> <Compile Include="Graphics\UserInterface\Volume\VolumeMeter.cs" />
<Compile Include="Input\Bindings\DatabasedKeyBinding.cs" /> <Compile Include="Input\Bindings\DatabasedKeyBinding.cs" />
<Compile Include="Input\Bindings\DatabasedKeyBindingInputManager.cs" /> <Compile Include="Input\Bindings\DatabasedKeyBindingContainer.cs" />
<Compile Include="Input\Bindings\GlobalKeyBindingInputManager.cs" /> <Compile Include="Input\Bindings\GlobalActionContainer.cs" />
<Compile Include="Input\Handlers\ReplayInputHandler.cs" /> <Compile Include="Input\Handlers\ReplayInputHandler.cs" />
<Compile Include="Input\KeyBindingStore.cs" /> <Compile Include="Input\KeyBindingStore.cs" />
<Compile Include="IO\FileInfo.cs" /> <Compile Include="IO\FileInfo.cs" />

View File

@ -47,6 +47,7 @@ Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/maste
<package id="Humanizer.Core.zh-CN" version="2.2.0" targetFramework="net461" /> <package id="Humanizer.Core.zh-CN" version="2.2.0" targetFramework="net461" />
<package id="Humanizer.Core.zh-Hans" version="2.2.0" targetFramework="net461" /> <package id="Humanizer.Core.zh-Hans" version="2.2.0" targetFramework="net461" />
<package id="Humanizer.Core.zh-Hant" version="2.2.0" targetFramework="net461" /> <package id="Humanizer.Core.zh-Hant" version="2.2.0" targetFramework="net461" />
<package id="JetBrains.Annotations" version="11.1.0" targetFramework="net461" />
<package id="Microsoft.CSharp" version="4.4.0" targetFramework="net461" /> <package id="Microsoft.CSharp" version="4.4.0" targetFramework="net461" />
<package id="Microsoft.Data.Sqlite.Core" version="2.0.0" targetFramework="net461" /> <package id="Microsoft.Data.Sqlite.Core" version="2.0.0" targetFramework="net461" />
<package id="Microsoft.EntityFrameworkCore" version="2.0.0" targetFramework="net461" /> <package id="Microsoft.EntityFrameworkCore" version="2.0.0" targetFramework="net461" />