mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:42:55 +08:00
commit
a266add670
@ -60,6 +60,8 @@ namespace osu.Game.Modes.Catch
|
||||
return new Mod[]
|
||||
{
|
||||
new CatchModRelax(),
|
||||
null,
|
||||
null,
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
|
@ -52,7 +52,14 @@ namespace osu.Game.Modes.Mania
|
||||
new ManiaModNightcore(),
|
||||
},
|
||||
},
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
{
|
||||
new ManiaModFadeIn(),
|
||||
new ManiaModHidden(),
|
||||
}
|
||||
},
|
||||
new ManiaModFlashlight(),
|
||||
};
|
||||
|
||||
@ -74,8 +81,8 @@ namespace osu.Game.Modes.Mania
|
||||
new ManiaModKey3(),
|
||||
},
|
||||
},
|
||||
new ManiaModKeyCoop(),
|
||||
new ManiaModRandom(),
|
||||
new ManiaModKeyCoop(),
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
|
@ -72,7 +72,7 @@ namespace osu.Game.Modes.Osu
|
||||
public override string Description => @"Spinners will be automatically completed";
|
||||
public override double ScoreMultiplier => 0.9;
|
||||
public override bool Ranked => true;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModCinema), typeof(OsuModAutopilot) };
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(OsuModAutopilot) };
|
||||
}
|
||||
|
||||
public class OsuModAutopilot : Mod
|
||||
@ -82,7 +82,7 @@ namespace osu.Game.Modes.Osu
|
||||
public override string Description => @"Automatic cursor movement - just follow the rhythm.";
|
||||
public override double ScoreMultiplier => 0;
|
||||
public override bool Ranked => false;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModPerfect), typeof(ModNoFail), typeof(ModAutoplay), typeof(ModCinema) };
|
||||
public override Type[] IncompatibleMods => new[] { typeof(OsuModSpunOut), typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail), typeof(ModAutoplay) };
|
||||
}
|
||||
|
||||
public class OsuModAutoplay : ModAutoplay
|
||||
|
@ -78,7 +78,6 @@ namespace osu.Game.Modes.Osu
|
||||
{
|
||||
new OsuModRelax(),
|
||||
new OsuModAutopilot(),
|
||||
new OsuModTarget(),
|
||||
new OsuModSpunOut(),
|
||||
new MultiMod
|
||||
{
|
||||
@ -88,6 +87,7 @@ namespace osu.Game.Modes.Osu
|
||||
new ModCinema(),
|
||||
},
|
||||
},
|
||||
new OsuModTarget(),
|
||||
};
|
||||
|
||||
default:
|
||||
|
@ -60,6 +60,8 @@ namespace osu.Game.Modes.Taiko
|
||||
return new Mod[]
|
||||
{
|
||||
new TaikoModRelax(),
|
||||
null,
|
||||
null,
|
||||
new MultiMod
|
||||
{
|
||||
Mods = new Mod[]
|
||||
|
@ -65,7 +65,7 @@ namespace osu.Game.Modes
|
||||
public override string Description => "You can't fail, no matter what.";
|
||||
public override double ScoreMultiplier => 0.5;
|
||||
public override bool Ranked => true;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModPerfect) };
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModAutoplay) };
|
||||
}
|
||||
|
||||
public abstract class ModEasy : Mod
|
||||
@ -100,7 +100,7 @@ namespace osu.Game.Modes
|
||||
public override string Description => "Miss a note and fail.";
|
||||
public override double ScoreMultiplier => 1;
|
||||
public override bool Ranked => true;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay), typeof(ModCinema) };
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModNoFail), typeof(ModRelax), typeof(ModAutoplay) };
|
||||
}
|
||||
|
||||
public abstract class ModDoubleTime : Mod
|
||||
@ -117,7 +117,7 @@ namespace osu.Game.Modes
|
||||
public override string Name => "Relax";
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_relax;
|
||||
public override double ScoreMultiplier => 0;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModCinema), typeof(ModNoFail), typeof(ModSuddenDeath), typeof(ModPerfect) };
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModAutoplay), typeof(ModNoFail), typeof(ModSuddenDeath) };
|
||||
}
|
||||
|
||||
public abstract class ModHalfTime : Mod
|
||||
@ -126,7 +126,7 @@ namespace osu.Game.Modes
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime;
|
||||
public override string Description => "Less zoom";
|
||||
public override bool Ranked => true;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime), typeof(ModNightcore) };
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime) };
|
||||
}
|
||||
|
||||
public abstract class ModNightcore : ModDoubleTime
|
||||
@ -150,7 +150,7 @@ namespace osu.Game.Modes
|
||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_auto;
|
||||
public override string Description => "Watch a perfect automated play through the song";
|
||||
public override double ScoreMultiplier => 0;
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModPerfect) };
|
||||
public override Type[] IncompatibleMods => new[] { typeof(ModRelax), typeof(ModSuddenDeath), typeof(ModNoFail) };
|
||||
|
||||
public override void PlayerLoading(Player player)
|
||||
{
|
||||
|
@ -26,30 +26,26 @@ namespace osu.Game.Modes.UI
|
||||
}
|
||||
}
|
||||
|
||||
private Color4 backgroundColour;
|
||||
public new Color4 Colour
|
||||
{
|
||||
get
|
||||
{
|
||||
return backgroundColour;
|
||||
return background.Colour;
|
||||
}
|
||||
set
|
||||
{
|
||||
backgroundColour = value;
|
||||
background.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
private FontAwesome icon;
|
||||
public FontAwesome Icon
|
||||
{
|
||||
get
|
||||
{
|
||||
return icon;
|
||||
return modIcon.Icon;
|
||||
}
|
||||
set
|
||||
{
|
||||
icon = value;
|
||||
modIcon.Icon = value;
|
||||
}
|
||||
}
|
||||
|
@ -4,17 +4,19 @@
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class AssistedSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M };
|
||||
public override ModType ModType => ModType.Special;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.Blue;
|
||||
ButtonColour = colours.Blue;
|
||||
SelectedColour = colours.BlueLight;
|
||||
}
|
||||
|
||||
|
@ -4,17 +4,19 @@
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class DifficultyIncreaseSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L };
|
||||
public override ModType ModType => ModType.DifficultyIncrease;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.Yellow;
|
||||
ButtonColour = colours.Yellow;
|
||||
SelectedColour = colours.YellowLight;
|
||||
}
|
||||
|
||||
|
@ -4,17 +4,19 @@
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class DifficultyReductionSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P };
|
||||
public override ModType ModType => ModType.DifficultyReduction;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.Green;
|
||||
ButtonColour = colours.Green;
|
||||
SelectedColour = colours.GreenLight;
|
||||
}
|
||||
|
||||
|
@ -22,61 +22,57 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class ModButton : FillFlowContainer
|
||||
{
|
||||
private ModIcon[] icons;
|
||||
private ModIcon displayIcon => icons[icons.Length - 1];
|
||||
private ModIcon foregroundIcon { get; set; }
|
||||
private SpriteText text;
|
||||
private Container iconsContainer;
|
||||
private Container<ModIcon> iconsContainer;
|
||||
private SampleChannel sampleOn, sampleOff;
|
||||
|
||||
public Action<Mod> Action; // Passed the selected mod or null if none
|
||||
|
||||
private int _selectedMod = -1;
|
||||
private int selectedMod
|
||||
private int _selectedIndex = -1;
|
||||
private int selectedIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectedMod;
|
||||
return _selectedIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == _selectedMod) return;
|
||||
_selectedMod = value;
|
||||
if (value == _selectedIndex) return;
|
||||
_selectedIndex = value;
|
||||
|
||||
if (value >= Mods.Length)
|
||||
{
|
||||
_selectedMod = -1;
|
||||
_selectedIndex = -1;
|
||||
}
|
||||
else if (value <= -2)
|
||||
{
|
||||
_selectedMod = Mods.Length - 1;
|
||||
_selectedIndex = Mods.Length - 1;
|
||||
}
|
||||
|
||||
iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic);
|
||||
iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic);
|
||||
for (int i = 0; i < icons.Length; i++)
|
||||
{
|
||||
if (Selected && i == icons.Length - 1) icons[i].Colour = SelectedColour;
|
||||
else icons[i].Colour = Colour;
|
||||
}
|
||||
foregroundIcon.Colour = Selected ? SelectedColour : ButtonColour;
|
||||
|
||||
displaySelectedMod();
|
||||
if (mod != null)
|
||||
displayMod(SelectedMod ?? Mods[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Selected => selectedMod != -1;
|
||||
public bool Selected => selectedIndex != -1;
|
||||
|
||||
private Color4 backgroundColour;
|
||||
public new Color4 Colour
|
||||
private Color4 buttonColour;
|
||||
public Color4 ButtonColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return backgroundColour;
|
||||
return buttonColour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == backgroundColour) return;
|
||||
backgroundColour = value;
|
||||
foreach (ModIcon icon in icons)
|
||||
if (value == buttonColour) return;
|
||||
buttonColour = value;
|
||||
foreach (ModIcon icon in iconsContainer.Children)
|
||||
{
|
||||
icon.Colour = value;
|
||||
}
|
||||
@ -94,7 +90,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
if (value == selectedColour) return;
|
||||
selectedColour = value;
|
||||
if (Selected) icons[0].Colour = value;
|
||||
if (Selected) foregroundIcon.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,10 +103,18 @@ namespace osu.Game.Overlays.Mods
|
||||
}
|
||||
set
|
||||
{
|
||||
if (mod == value) return;
|
||||
mod = value;
|
||||
|
||||
if (mod == null)
|
||||
{
|
||||
Mods = new Mod[0];
|
||||
Alpha = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
Mods = (mod as MultiMod)?.Mods ?? new[] { mod };
|
||||
Alpha = 1;
|
||||
}
|
||||
|
||||
createIcons();
|
||||
if (Mods.Length > 0)
|
||||
@ -124,7 +128,7 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
// the mods from Mod, only multiple if Mod is a MultiMod
|
||||
|
||||
public Mod SelectedMod => Mods.ElementAtOrDefault(selectedMod);
|
||||
public Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex);
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
@ -135,67 +139,47 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
(args.Button == MouseButton.Right ? (Action)SelectPrevious : SelectNext)();
|
||||
switch (args.Button)
|
||||
{
|
||||
case MouseButton.Left:
|
||||
SelectNext();
|
||||
break;
|
||||
case MouseButton.Right:
|
||||
SelectPrevious();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SelectNext()
|
||||
{
|
||||
selectedMod++;
|
||||
if (selectedMod == -1)
|
||||
{
|
||||
sampleOff.Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
sampleOn.Play();
|
||||
}
|
||||
|
||||
(++selectedIndex == -1 ? sampleOff : sampleOn).Play();
|
||||
Action?.Invoke(SelectedMod);
|
||||
}
|
||||
|
||||
public void SelectPrevious()
|
||||
{
|
||||
selectedMod--;
|
||||
if (selectedMod == -1)
|
||||
{
|
||||
sampleOff.Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
sampleOn.Play();
|
||||
}
|
||||
|
||||
(--selectedIndex == -1 ? sampleOff : sampleOn).Play();
|
||||
Action?.Invoke(SelectedMod);
|
||||
}
|
||||
|
||||
public void Deselect()
|
||||
{
|
||||
selectedMod = -1;
|
||||
selectedIndex = -1;
|
||||
}
|
||||
|
||||
private void displayMod(Mod mod)
|
||||
{
|
||||
displayIcon.Icon = mod.Icon;
|
||||
foregroundIcon.Icon = mod.Icon;
|
||||
text.Text = mod.Name;
|
||||
}
|
||||
|
||||
private void displaySelectedMod()
|
||||
{
|
||||
var modIndex = selectedMod;
|
||||
if (modIndex <= -1)
|
||||
{
|
||||
modIndex = 0;
|
||||
}
|
||||
|
||||
displayMod(Mods[modIndex]);
|
||||
}
|
||||
|
||||
private void createIcons()
|
||||
{
|
||||
iconsContainer.Clear();
|
||||
if (Mods.Length > 1)
|
||||
{
|
||||
iconsContainer.Add(icons = new[]
|
||||
iconsContainer.Add(new[]
|
||||
{
|
||||
new ModIcon
|
||||
{
|
||||
@ -203,35 +187,43 @@ namespace osu.Game.Overlays.Mods
|
||||
Anchor = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Position = new Vector2(1.5f),
|
||||
Colour = ButtonColour
|
||||
},
|
||||
new ModIcon
|
||||
foregroundIcon = new ModIcon
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Position = new Vector2(-1.5f),
|
||||
Colour = ButtonColour
|
||||
},
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
iconsContainer.Add(icons = new[]
|
||||
{
|
||||
new ModIcon
|
||||
iconsContainer.Add(foregroundIcon = new ModIcon
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
},
|
||||
Colour = ButtonColour
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
foreach (ModIcon icon in iconsContainer.Children)
|
||||
icon.Colour = ButtonColour;
|
||||
}
|
||||
|
||||
public ModButton(Mod m)
|
||||
{
|
||||
Direction = FillDirection.Vertical;
|
||||
Spacing = new Vector2(0f, -5f);
|
||||
Size = new Vector2(100f);
|
||||
AlwaysPresent = true;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -242,7 +234,7 @@ namespace osu.Game.Overlays.Mods
|
||||
Anchor = Anchor.TopCentre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
iconsContainer = new Container
|
||||
iconsContainer = new Container<ModIcon>
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
@ -15,48 +14,24 @@ using osu.Game.Modes;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
internal class AlwaysPresentFlowContainer : FillFlowContainer
|
||||
{
|
||||
public override bool IsPresent => true;
|
||||
}
|
||||
|
||||
public class ModSection : Container
|
||||
public abstract class ModSection : Container
|
||||
{
|
||||
private OsuSpriteText headerLabel;
|
||||
|
||||
private AlwaysPresentFlowContainer buttonsContainer;
|
||||
public FillFlowContainer ButtonsContainer => buttonsContainer;
|
||||
public FillFlowContainer<ModButton> ButtonsContainer { get; }
|
||||
|
||||
public Action<Mod> Action;
|
||||
protected virtual Key[] ToggleKeys => new Key[] { };
|
||||
protected abstract Key[] ToggleKeys { get; }
|
||||
public abstract ModType ModType { get; }
|
||||
|
||||
public Mod[] SelectedMods
|
||||
{
|
||||
get
|
||||
{
|
||||
List<Mod> selectedMods = new List<Mod>();
|
||||
|
||||
foreach (ModButton button in Buttons)
|
||||
{
|
||||
Mod selectedMod = button.SelectedMod;
|
||||
if (selectedMod != null)
|
||||
selectedMods.Add(selectedMod);
|
||||
}
|
||||
|
||||
return selectedMods.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
private string header;
|
||||
public string Header
|
||||
{
|
||||
get
|
||||
{
|
||||
return header;
|
||||
return headerLabel.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
header = value;
|
||||
headerLabel.Text = value;
|
||||
}
|
||||
}
|
||||
@ -75,30 +50,30 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
foreach (ModButton button in value)
|
||||
{
|
||||
button.Colour = Colour;
|
||||
button.ButtonColour = ButtonColour;
|
||||
button.SelectedColour = selectedColour;
|
||||
button.Action = buttonPressed;
|
||||
button.Action = Action;
|
||||
}
|
||||
|
||||
buttonsContainer.Add(value);
|
||||
ButtonsContainer.Children = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Color4 colour = Color4.White;
|
||||
public new Color4 Colour
|
||||
private Color4 buttonsBolour = Color4.White;
|
||||
public Color4 ButtonColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return colour;
|
||||
return buttonsBolour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == colour) return;
|
||||
colour = value;
|
||||
if (value == buttonsBolour) return;
|
||||
buttonsBolour = value;
|
||||
|
||||
foreach (ModButton button in buttons)
|
||||
{
|
||||
button.Colour = value;
|
||||
button.ButtonColour = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -139,12 +114,7 @@ namespace osu.Game.Overlays.Mods
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonPressed(Mod mod)
|
||||
{
|
||||
Action?.Invoke(mod);
|
||||
}
|
||||
|
||||
public ModSection()
|
||||
protected ModSection()
|
||||
{
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
@ -155,10 +125,9 @@ namespace osu.Game.Overlays.Mods
|
||||
Origin = Anchor.TopLeft,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Position = new Vector2(0f, 0f),
|
||||
Font = @"Exo2.0-Bold",
|
||||
Text = Header,
|
||||
Font = @"Exo2.0-Bold"
|
||||
},
|
||||
buttonsContainer = new AlwaysPresentFlowContainer
|
||||
ButtonsContainer = new FillFlowContainer<ModButton>
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.BottomLeft,
|
||||
@ -168,6 +137,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
Top = 6,
|
||||
},
|
||||
AlwaysPresent = true
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -2,8 +2,8 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Configuration;
|
||||
@ -41,34 +41,9 @@ namespace osu.Game.Overlays.Mods
|
||||
private void modeChanged(object sender, EventArgs eventArgs)
|
||||
{
|
||||
var ruleset = Ruleset.GetRuleset(PlayMode);
|
||||
|
||||
modSectionsContainer.Children = new ModSection[]
|
||||
{
|
||||
new DifficultyReductionSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.DifficultyReduction).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
new DifficultyIncreaseSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.DifficultyIncrease).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
new AssistedSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.Special).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
};
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
section.Buttons = ruleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray();
|
||||
refreshSelectedMods();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
@ -80,7 +55,7 @@ namespace osu.Game.Overlays.Mods
|
||||
if (osu != null)
|
||||
PlayMode.BindTo(osu.PlayMode);
|
||||
PlayMode.ValueChanged += modeChanged;
|
||||
PlayMode.TriggerChange();
|
||||
modeChanged(null, null);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
@ -116,41 +91,33 @@ namespace osu.Game.Overlays.Mods
|
||||
public void DeselectAll()
|
||||
{
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
{
|
||||
foreach (ModButton button in section.Buttons)
|
||||
{
|
||||
button.Deselect();
|
||||
}
|
||||
}
|
||||
section.DeselectAll();
|
||||
}
|
||||
|
||||
public void DeselectType(Type modType)
|
||||
public void DeselectTypes(Type[] modTypes)
|
||||
{
|
||||
if (modTypes.Length == 0) return;
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
{
|
||||
foreach (ModButton button in section.Buttons)
|
||||
{
|
||||
foreach (Mod mod in button.Mods)
|
||||
{
|
||||
if (modType.IsInstanceOfType(mod))
|
||||
{
|
||||
Mod selected = button.SelectedMod;
|
||||
if (selected == null) continue;
|
||||
foreach (Type type in modTypes)
|
||||
if (type.IsInstanceOfType(selected))
|
||||
button.Deselect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void modButtonPressed(Mod selectedMod)
|
||||
{
|
||||
if (selectedMod != null)
|
||||
{
|
||||
foreach (Type t in selectedMod.IncompatibleMods)
|
||||
DeselectType(t);
|
||||
DeselectTypes(selectedMod.IncompatibleMods);
|
||||
refreshSelectedMods();
|
||||
}
|
||||
|
||||
refreshSelectedMods();
|
||||
private void refreshSelectedMods()
|
||||
{
|
||||
SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.Buttons.Select(x => x.SelectedMod).Where(x => x != null)).ToArray();
|
||||
|
||||
double multiplier = 1.0;
|
||||
bool ranked = true;
|
||||
@ -158,9 +125,7 @@ namespace osu.Game.Overlays.Mods
|
||||
foreach (Mod mod in SelectedMods.Value)
|
||||
{
|
||||
multiplier *= mod.ScoreMultiplier;
|
||||
|
||||
if (ranked)
|
||||
ranked = mod.Ranked;
|
||||
ranked &= mod.Ranked;
|
||||
}
|
||||
|
||||
// 1.00x
|
||||
@ -172,33 +137,12 @@ namespace osu.Game.Overlays.Mods
|
||||
rankedLabel.Text = $@"{rankedString}, Score Multiplier: ";
|
||||
|
||||
if (multiplier > 1.0)
|
||||
{
|
||||
multiplierLabel.FadeColour(highMultiplierColour, 200);
|
||||
}
|
||||
else if (multiplier < 1.0)
|
||||
{
|
||||
multiplierLabel.FadeColour(lowMultiplierColour, 200);
|
||||
}
|
||||
else
|
||||
{
|
||||
multiplierLabel.FadeColour(Color4.White, 200);
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshSelectedMods()
|
||||
{
|
||||
List<Mod> selectedMods = new List<Mod>();
|
||||
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
{
|
||||
foreach (Mod mod in section.SelectedMods)
|
||||
{
|
||||
selectedMods.Add(mod);
|
||||
}
|
||||
}
|
||||
|
||||
SelectedMods.Value = selectedMods.ToArray();
|
||||
}
|
||||
|
||||
public ModSelectOverlay()
|
||||
{
|
||||
@ -308,6 +252,30 @@ namespace osu.Game.Overlays.Mods
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Spacing = new Vector2(0f, 10f),
|
||||
Width = content_width,
|
||||
Children = new ModSection[]
|
||||
{
|
||||
new DifficultyReductionSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
},
|
||||
new DifficultyIncreaseSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
},
|
||||
new AssistedSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
},
|
||||
}
|
||||
},
|
||||
// Footer
|
||||
new Container
|
||||
|
Loading…
Reference in New Issue
Block a user