mirror of
https://github.com/osukey/osukey.git
synced 2025-06-08 21:07:59 +09:00
Fix line endings.
This commit is contained in:
parent
9746877903
commit
9f367bcc0e
@ -1,223 +1,223 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 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
|
||||||
|
|
||||||
using System;
|
|
||||||
using OpenTK.Input;
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Game.Graphics;
|
|
||||||
using osu.Game.Modes;
|
|
||||||
using osu.Game.Overlays.Mods;
|
|
||||||
|
|
||||||
namespace osu.Game
|
using System;
|
||||||
{
|
using OpenTK.Input;
|
||||||
public class AssistedSection : ModSection
|
using osu.Framework.Allocation;
|
||||||
{
|
using osu.Game.Graphics;
|
||||||
private ModButton relaxButton;
|
using osu.Game.Modes;
|
||||||
public ModButton RelaxButton
|
using osu.Game.Overlays.Mods;
|
||||||
{
|
|
||||||
get
|
namespace osu.Game
|
||||||
{
|
{
|
||||||
return relaxButton;
|
public class AssistedSection : ModSection
|
||||||
}
|
{
|
||||||
}
|
private ModButton relaxButton;
|
||||||
|
public ModButton RelaxButton
|
||||||
private ModButton autopilotButton;
|
{
|
||||||
public ModButton AutopilotButton
|
get
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
{
|
||||||
return autopilotButton;
|
return relaxButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModButton targetPracticeButton;
|
private ModButton autopilotButton;
|
||||||
public ModButton TargetPracticeButton
|
public ModButton AutopilotButton
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return targetPracticeButton;
|
return autopilotButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModButton spunOutButton;
|
private ModButton targetPracticeButton;
|
||||||
public ModButton SpunOutButton
|
public ModButton TargetPracticeButton
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
|
||||||
return spunOutButton;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ModButton autoplayCinemaButton;
|
|
||||||
public ModButton AutoplayCinemaButton
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return autoplayCinemaButton;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ModButton keyButton;
|
|
||||||
public ModButton KeyButton
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
{
|
||||||
return keyButton;
|
return targetPracticeButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModButton coopButton;
|
private ModButton spunOutButton;
|
||||||
public ModButton CoopButton
|
public ModButton SpunOutButton
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return coopButton;
|
return spunOutButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModButton randomButton;
|
private ModButton autoplayCinemaButton;
|
||||||
public ModButton RandomButton
|
public ModButton AutoplayCinemaButton
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return randomButton;
|
return autoplayCinemaButton;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
private ModButton keyButton;
|
||||||
private void load(OsuColour colours)
|
public ModButton KeyButton
|
||||||
{
|
{
|
||||||
Colour = colours.Blue;
|
get
|
||||||
SelectedColour = colours.BlueLight;
|
{
|
||||||
}
|
return keyButton;
|
||||||
|
}
|
||||||
public AssistedSection(PlayMode mode)
|
}
|
||||||
{
|
|
||||||
Header = @"Assisted";
|
private ModButton coopButton;
|
||||||
|
public ModButton CoopButton
|
||||||
switch (mode)
|
{
|
||||||
{
|
get
|
||||||
case PlayMode.Osu:
|
{
|
||||||
Buttons = new ModButton[]
|
return coopButton;
|
||||||
{
|
}
|
||||||
relaxButton = new ModButton
|
}
|
||||||
{
|
|
||||||
ToggleKey = Key.Z,
|
private ModButton randomButton;
|
||||||
Mods = new Mod[]
|
public ModButton RandomButton
|
||||||
{
|
{
|
||||||
new ModRelax(),
|
get
|
||||||
},
|
{
|
||||||
},
|
return randomButton;
|
||||||
autopilotButton = new ModButton
|
}
|
||||||
{
|
}
|
||||||
ToggleKey = Key.X,
|
|
||||||
Mods = new Mod[]
|
[BackgroundDependencyLoader]
|
||||||
{
|
private void load(OsuColour colours)
|
||||||
new ModAutopilot(),
|
{
|
||||||
},
|
Colour = colours.Blue;
|
||||||
},
|
SelectedColour = colours.BlueLight;
|
||||||
targetPracticeButton = new ModButton
|
}
|
||||||
{
|
|
||||||
ToggleKey = Key.C,
|
public AssistedSection(PlayMode mode)
|
||||||
Mods = new Mod[]
|
{
|
||||||
{
|
Header = @"Assisted";
|
||||||
new ModTarget(),
|
|
||||||
},
|
switch (mode)
|
||||||
},
|
{
|
||||||
spunOutButton = new ModButton
|
case PlayMode.Osu:
|
||||||
{
|
Buttons = new ModButton[]
|
||||||
ToggleKey = Key.V,
|
{
|
||||||
Mods = new Mod[]
|
relaxButton = new ModButton
|
||||||
{
|
{
|
||||||
new ModSpunOut(),
|
ToggleKey = Key.Z,
|
||||||
},
|
Mods = new Mod[]
|
||||||
},
|
{
|
||||||
autoplayCinemaButton = new ModButton
|
new ModRelax(),
|
||||||
{
|
},
|
||||||
ToggleKey = Key.B,
|
},
|
||||||
Mods = new Mod[]
|
autopilotButton = new ModButton
|
||||||
{
|
{
|
||||||
new ModAutoplay(),
|
ToggleKey = Key.X,
|
||||||
new ModCinema(),
|
Mods = new Mod[]
|
||||||
},
|
{
|
||||||
},
|
new ModAutopilot(),
|
||||||
};
|
},
|
||||||
break;
|
},
|
||||||
|
targetPracticeButton = new ModButton
|
||||||
case PlayMode.Taiko:
|
{
|
||||||
case PlayMode.Catch:
|
ToggleKey = Key.C,
|
||||||
Buttons = new ModButton[]
|
Mods = new Mod[]
|
||||||
{
|
{
|
||||||
relaxButton = new ModButton
|
new ModTarget(),
|
||||||
{
|
},
|
||||||
ToggleKey = Key.Z,
|
},
|
||||||
Mods = new Mod[]
|
spunOutButton = new ModButton
|
||||||
{
|
{
|
||||||
new ModRelax(),
|
ToggleKey = Key.V,
|
||||||
},
|
Mods = new Mod[]
|
||||||
},
|
{
|
||||||
autoplayCinemaButton = new ModButton
|
new ModSpunOut(),
|
||||||
{
|
},
|
||||||
ToggleKey = Key.X,
|
},
|
||||||
Mods = new Mod[]
|
autoplayCinemaButton = new ModButton
|
||||||
{
|
{
|
||||||
new ModAutoplay(),
|
ToggleKey = Key.B,
|
||||||
new ModCinema(),
|
Mods = new Mod[]
|
||||||
},
|
{
|
||||||
},
|
new ModAutoplay(),
|
||||||
};
|
new ModCinema(),
|
||||||
break;
|
},
|
||||||
|
},
|
||||||
case PlayMode.Mania:
|
};
|
||||||
Buttons = new ModButton[]
|
|
||||||
{
|
|
||||||
keyButton = new ModButton
|
|
||||||
{
|
|
||||||
ToggleKey = Key.Z,
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new ModKey4(),
|
|
||||||
new ModKey5(),
|
|
||||||
new ModKey6(),
|
|
||||||
new ModKey7(),
|
|
||||||
new ModKey8(),
|
|
||||||
new ModKey9(),
|
|
||||||
new ModKey1(),
|
|
||||||
new ModKey2(),
|
|
||||||
new ModKey3(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
coopButton = new ModButton
|
|
||||||
{
|
|
||||||
ToggleKey = Key.X,
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new ModKeyCoop(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
randomButton = new ModButton
|
|
||||||
{
|
|
||||||
ToggleKey = Key.C,
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new ModRandom(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
autoplayCinemaButton = new ModButton
|
|
||||||
{
|
|
||||||
ToggleKey = Key.V,
|
|
||||||
Mods = new Mod[]
|
|
||||||
{
|
|
||||||
new ModAutoplay(),
|
|
||||||
new ModCinema(),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
case PlayMode.Taiko:
|
||||||
throw new NotSupportedException();
|
case PlayMode.Catch:
|
||||||
}
|
Buttons = new ModButton[]
|
||||||
}
|
{
|
||||||
}
|
relaxButton = new ModButton
|
||||||
}
|
{
|
||||||
|
ToggleKey = Key.Z,
|
||||||
|
Mods = new Mod[]
|
||||||
|
{
|
||||||
|
new ModRelax(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
autoplayCinemaButton = new ModButton
|
||||||
|
{
|
||||||
|
ToggleKey = Key.X,
|
||||||
|
Mods = new Mod[]
|
||||||
|
{
|
||||||
|
new ModAutoplay(),
|
||||||
|
new ModCinema(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PlayMode.Mania:
|
||||||
|
Buttons = new ModButton[]
|
||||||
|
{
|
||||||
|
keyButton = new ModButton
|
||||||
|
{
|
||||||
|
ToggleKey = Key.Z,
|
||||||
|
Mods = new Mod[]
|
||||||
|
{
|
||||||
|
new ModKey4(),
|
||||||
|
new ModKey5(),
|
||||||
|
new ModKey6(),
|
||||||
|
new ModKey7(),
|
||||||
|
new ModKey8(),
|
||||||
|
new ModKey9(),
|
||||||
|
new ModKey1(),
|
||||||
|
new ModKey2(),
|
||||||
|
new ModKey3(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
coopButton = new ModButton
|
||||||
|
{
|
||||||
|
ToggleKey = Key.X,
|
||||||
|
Mods = new Mod[]
|
||||||
|
{
|
||||||
|
new ModKeyCoop(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
randomButton = new ModButton
|
||||||
|
{
|
||||||
|
ToggleKey = Key.C,
|
||||||
|
Mods = new Mod[]
|
||||||
|
{
|
||||||
|
new ModRandom(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
autoplayCinemaButton = new ModButton
|
||||||
|
{
|
||||||
|
ToggleKey = Key.V,
|
||||||
|
Mods = new Mod[]
|
||||||
|
{
|
||||||
|
new ModAutoplay(),
|
||||||
|
new ModCinema(),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
throw new NotSupportedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,77 +1,77 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 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
|
||||||
|
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game
|
||||||
{
|
{
|
||||||
public class DifficultyIncreaseSection : ModSection
|
public class DifficultyIncreaseSection : ModSection
|
||||||
{
|
{
|
||||||
public ModButton HardRockButton => Buttons[0];
|
public ModButton HardRockButton => Buttons[0];
|
||||||
public ModButton SuddenDeathButton => Buttons[1];
|
public ModButton SuddenDeathButton => Buttons[1];
|
||||||
public ModButton DoubleTimeNightcoreButton => Buttons[2];
|
public ModButton DoubleTimeNightcoreButton => Buttons[2];
|
||||||
public ModButton HiddenButton => Buttons[3];
|
public ModButton HiddenButton => Buttons[3];
|
||||||
public ModButton FlashlightButton => Buttons[4];
|
public ModButton FlashlightButton => Buttons[4];
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
Colour = colours.Yellow;
|
Colour = colours.Yellow;
|
||||||
SelectedColour = colours.YellowLight;
|
SelectedColour = colours.YellowLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DifficultyIncreaseSection()
|
public DifficultyIncreaseSection()
|
||||||
{
|
{
|
||||||
Header = @"Gameplay Difficulty Increase";
|
Header = @"Gameplay Difficulty Increase";
|
||||||
Buttons = new ModButton[]
|
Buttons = new ModButton[]
|
||||||
{
|
{
|
||||||
new ModButton
|
new ModButton
|
||||||
{
|
{
|
||||||
ToggleKey = Key.A,
|
ToggleKey = Key.A,
|
||||||
Mods = new Mod[]
|
Mods = new Mod[]
|
||||||
{
|
{
|
||||||
new ModHardRock(),
|
new ModHardRock(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new ModButton
|
new ModButton
|
||||||
{
|
{
|
||||||
ToggleKey = Key.S,
|
ToggleKey = Key.S,
|
||||||
Mods = new Mod[]
|
Mods = new Mod[]
|
||||||
{
|
{
|
||||||
new ModSuddenDeath(),
|
new ModSuddenDeath(),
|
||||||
new ModPerfect(),
|
new ModPerfect(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new ModButton
|
new ModButton
|
||||||
{
|
{
|
||||||
ToggleKey = Key.D,
|
ToggleKey = Key.D,
|
||||||
Mods = new Mod[]
|
Mods = new Mod[]
|
||||||
{
|
{
|
||||||
new ModDoubleTime(),
|
new ModDoubleTime(),
|
||||||
new ModNightcore(),
|
new ModNightcore(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new ModButton
|
new ModButton
|
||||||
{
|
{
|
||||||
ToggleKey = Key.F,
|
ToggleKey = Key.F,
|
||||||
Mods = new Mod[]
|
Mods = new Mod[]
|
||||||
{
|
{
|
||||||
new ModHidden(),
|
new ModHidden(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new ModButton
|
new ModButton
|
||||||
{
|
{
|
||||||
ToggleKey = Key.G,
|
ToggleKey = Key.G,
|
||||||
Mods = new Mod[]
|
Mods = new Mod[]
|
||||||
{
|
{
|
||||||
new ModFlashlight(),
|
new ModFlashlight(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,9 +7,9 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
|
|
||||||
namespace osu.Game
|
namespace osu.Game
|
||||||
{
|
{
|
||||||
public class DifficultyReductionSection : ModSection
|
public class DifficultyReductionSection : ModSection
|
||||||
{
|
{
|
||||||
public ModButton EasyButton => Buttons[0];
|
public ModButton EasyButton => Buttons[0];
|
||||||
public ModButton NoFailButton => Buttons[1];
|
public ModButton NoFailButton => Buttons[1];
|
||||||
@ -21,8 +21,8 @@ namespace osu.Game
|
|||||||
Colour = colours.Green;
|
Colour = colours.Green;
|
||||||
SelectedColour = colours.GreenLight;
|
SelectedColour = colours.GreenLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DifficultyReductionSection()
|
public DifficultyReductionSection()
|
||||||
{
|
{
|
||||||
Header = @"Gameplay Difficulty Reduction";
|
Header = @"Gameplay Difficulty Reduction";
|
||||||
Buttons = new ModButton[]
|
Buttons = new ModButton[]
|
||||||
@ -51,7 +51,7 @@ namespace osu.Game
|
|||||||
new ModHalfTime(),
|
new ModHalfTime(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,52 +1,52 @@
|
|||||||
// Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2016 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
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio.Sample;
|
||||||
using osu.Framework.Extensions;
|
using osu.Framework.Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
using osu.Game.Modes.UI;
|
using osu.Game.Modes.UI;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
public class ModButton : FlowContainer
|
public class ModButton : FlowContainer
|
||||||
{
|
{
|
||||||
private ModIcon[] icons;
|
private ModIcon[] icons;
|
||||||
private ModIcon displayIcon
|
private ModIcon displayIcon
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return icons[icons.Length - 1];
|
return icons[icons.Length - 1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private SpriteText text;
|
private SpriteText text;
|
||||||
private Container iconsContainer;
|
private Container iconsContainer;
|
||||||
private SampleChannel sampleOn, sampleOff;
|
private SampleChannel sampleOn, sampleOff;
|
||||||
|
|
||||||
public Action<Mod> Action; // Passed the selected mod or null if none
|
public Action<Mod> Action; // Passed the selected mod or null if none
|
||||||
public Key ToggleKey;
|
public Key ToggleKey;
|
||||||
|
|
||||||
private int _selectedMod = -1;
|
private int _selectedMod = -1;
|
||||||
private int selectedMod
|
private int selectedMod
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return _selectedMod;
|
return _selectedMod;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == _selectedMod) return;
|
if (value == _selectedMod) return;
|
||||||
_selectedMod = value;
|
_selectedMod = value;
|
||||||
|
|
||||||
if (value >= Mods.Length)
|
if (value >= Mods.Length)
|
||||||
{
|
{
|
||||||
@ -55,237 +55,237 @@ namespace osu.Game.Overlays.Mods
|
|||||||
else if (value <= -2)
|
else if (value <= -2)
|
||||||
{
|
{
|
||||||
_selectedMod = Mods.Length - 1;
|
_selectedMod = Mods.Length - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic);
|
iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic);
|
||||||
iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic);
|
iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic);
|
||||||
for (int i = 0; i < icons.Length; i++)
|
for (int i = 0; i < icons.Length; i++)
|
||||||
{
|
{
|
||||||
if (Selected && i == icons.Length - 1) icons[i].Colour = SelectedColour;
|
if (Selected && i == icons.Length - 1) icons[i].Colour = SelectedColour;
|
||||||
else icons[i].Colour = Colour;
|
else icons[i].Colour = Colour;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
displaySelectedMod();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool Selected
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return selectedMod != -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color4 backgroundColour;
|
||||||
|
public new Color4 Colour
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return backgroundColour;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == backgroundColour) return;
|
||||||
|
backgroundColour = value;
|
||||||
|
foreach (ModIcon icon in icons)
|
||||||
|
{
|
||||||
|
icon.Colour = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Color4 selectedColour;
|
||||||
|
public Color4 SelectedColour
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return selectedColour;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == selectedColour) return;
|
||||||
|
selectedColour = value;
|
||||||
|
if (Selected) icons[0].Colour = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Mod[] mods;
|
||||||
|
public Mod[] Mods
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return mods;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (mods == value) return;
|
||||||
|
mods = value;
|
||||||
|
createIcons();
|
||||||
|
if (value.Length > 0)
|
||||||
|
{
|
||||||
|
displayMod(value[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Mod SelectedMod
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (selectedMod >= 0)
|
||||||
|
{
|
||||||
|
return Mods[selectedMod];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(AudioManager audio)
|
||||||
|
{
|
||||||
|
sampleOn = audio.Sample.Get(@"Checkbox/check-on");
|
||||||
|
sampleOff = audio.Sample.Get(@"Checkbox/check-off");
|
||||||
|
}
|
||||||
|
|
||||||
displaySelectedMod();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Selected
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return selectedMod != -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color4 backgroundColour;
|
|
||||||
public new Color4 Colour
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return backgroundColour;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == backgroundColour) return;
|
|
||||||
backgroundColour = value;
|
|
||||||
foreach (ModIcon icon in icons)
|
|
||||||
{
|
|
||||||
icon.Colour = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color4 selectedColour;
|
|
||||||
public Color4 SelectedColour
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return selectedColour;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == selectedColour) return;
|
|
||||||
selectedColour = value;
|
|
||||||
if (Selected) icons[0].Colour = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Mod[] mods;
|
|
||||||
public Mod[] Mods
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return mods;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (mods == value) return;
|
|
||||||
mods = value;
|
|
||||||
createIcons();
|
|
||||||
if (value.Length > 0)
|
|
||||||
{
|
|
||||||
displayMod(value[0]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Mod SelectedMod
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
if (selectedMod >= 0)
|
|
||||||
{
|
|
||||||
return Mods[selectedMod];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(AudioManager audio)
|
|
||||||
{
|
|
||||||
sampleOn = audio.Sample.Get(@"Checkbox/check-on");
|
|
||||||
sampleOff = audio.Sample.Get(@"Checkbox/check-off");
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnMouseDown(Framework.Input.InputState state, MouseDownEventArgs args)
|
protected override bool OnMouseDown(Framework.Input.InputState state, MouseDownEventArgs args)
|
||||||
{
|
{
|
||||||
(args.Button == MouseButton.Right ? (Action)SelectPrevious : SelectNext)();
|
(args.Button == MouseButton.Right ? (Action)SelectPrevious : SelectNext)();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectNext()
|
public void SelectNext()
|
||||||
{
|
{
|
||||||
selectedMod++;
|
selectedMod++;
|
||||||
if (selectedMod == -1)
|
if (selectedMod == -1)
|
||||||
{
|
{
|
||||||
sampleOff.Play();
|
sampleOff.Play();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sampleOn.Play();
|
sampleOn.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
Action?.Invoke(SelectedMod);
|
Action?.Invoke(SelectedMod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SelectPrevious()
|
public void SelectPrevious()
|
||||||
{
|
{
|
||||||
selectedMod--;
|
selectedMod--;
|
||||||
if (selectedMod == -1)
|
if (selectedMod == -1)
|
||||||
{
|
{
|
||||||
sampleOff.Play();
|
sampleOff.Play();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sampleOn.Play();
|
sampleOn.Play();
|
||||||
}
|
}
|
||||||
|
|
||||||
Action?.Invoke(SelectedMod);
|
Action?.Invoke(SelectedMod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Deselect()
|
public void Deselect()
|
||||||
{
|
{
|
||||||
selectedMod = -1;
|
selectedMod = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayMod(Mod mod)
|
private void displayMod(Mod mod)
|
||||||
{
|
{
|
||||||
displayIcon.Icon = mod.Icon;
|
displayIcon.Icon = mod.Icon;
|
||||||
text.Text = mod.Name.GetDescription();
|
text.Text = mod.Name.GetDescription();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displaySelectedMod()
|
private void displaySelectedMod()
|
||||||
{
|
{
|
||||||
var modIndex = selectedMod;
|
var modIndex = selectedMod;
|
||||||
if (modIndex <= -1)
|
if (modIndex <= -1)
|
||||||
{
|
{
|
||||||
modIndex = 0;
|
modIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
displayMod(Mods[modIndex]);
|
displayMod(Mods[modIndex]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createIcons()
|
private void createIcons()
|
||||||
{
|
{
|
||||||
if (Mods.Length > 1)
|
if (Mods.Length > 1)
|
||||||
{
|
{
|
||||||
iconsContainer.Add(icons = new ModIcon[]
|
iconsContainer.Add(icons = new ModIcon[]
|
||||||
{
|
{
|
||||||
new ModIcon
|
new ModIcon
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Position = new Vector2(1.5f),
|
Position = new Vector2(1.5f),
|
||||||
},
|
},
|
||||||
new ModIcon
|
new ModIcon
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Position = new Vector2(-1.5f),
|
Position = new Vector2(-1.5f),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iconsContainer.Add(icons = new ModIcon[]
|
iconsContainer.Add(icons = new ModIcon[]
|
||||||
{
|
{
|
||||||
new ModIcon
|
new ModIcon
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(Framework.Input.InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(Framework.Input.InputState state, KeyDownEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Key == ToggleKey)
|
if (args.Key == ToggleKey)
|
||||||
{
|
{
|
||||||
SelectNext();
|
SelectNext();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnKeyDown(state, args);
|
return base.OnKeyDown(state, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModButton()
|
public ModButton()
|
||||||
{
|
{
|
||||||
Direction = FlowDirections.Vertical;
|
Direction = FlowDirections.Vertical;
|
||||||
Spacing = new Vector2(0f, -5f);
|
Spacing = new Vector2(0f, -5f);
|
||||||
Size = new Vector2(100f);
|
Size = new Vector2(100f);
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Size = new Vector2(77f, 80f),
|
Size = new Vector2(77f, 80f),
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
iconsContainer = new Container
|
iconsContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
text = new OsuSpriteText
|
text = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
TextSize = 18,
|
TextSize = 18,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,170 +1,170 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 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
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Modes;
|
using osu.Game.Modes;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
class AlwaysPresentFlowContainer : FlowContainer
|
class AlwaysPresentFlowContainer : FlowContainer
|
||||||
{
|
{
|
||||||
public override bool IsPresent => true;
|
public override bool IsPresent => true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ModSection : Container
|
public class ModSection : Container
|
||||||
{
|
{
|
||||||
private OsuSpriteText headerLabel;
|
private OsuSpriteText headerLabel;
|
||||||
|
|
||||||
private AlwaysPresentFlowContainer buttonsContainer;
|
private AlwaysPresentFlowContainer buttonsContainer;
|
||||||
public FlowContainer ButtonsContainer
|
public FlowContainer ButtonsContainer
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return buttonsContainer;
|
return buttonsContainer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Action<Mod> Action;
|
public Action<Mod> Action;
|
||||||
|
|
||||||
public Mod[] SelectedMods
|
public Mod[] SelectedMods
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
List<Mod> selectedMods = new List<Mod>();
|
List<Mod> selectedMods = new List<Mod>();
|
||||||
|
|
||||||
foreach (ModButton button in Buttons)
|
foreach (ModButton button in Buttons)
|
||||||
{
|
{
|
||||||
Mod selectedMod = button.SelectedMod;
|
Mod selectedMod = button.SelectedMod;
|
||||||
if (selectedMod != null)
|
if (selectedMod != null)
|
||||||
{
|
{
|
||||||
selectedMods.Add(selectedMod);
|
selectedMods.Add(selectedMod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return selectedMods.ToArray();
|
return selectedMods.ToArray();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string header;
|
private string header;
|
||||||
public string Header
|
public string Header
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
header = value;
|
header = value;
|
||||||
headerLabel.Text = value;
|
headerLabel.Text = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private ModButton[] buttons = {};
|
private ModButton[] buttons = {};
|
||||||
public ModButton[] Buttons
|
public ModButton[] Buttons
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return buttons;
|
return buttons;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == buttons) return;
|
if (value == buttons) return;
|
||||||
buttons = value;
|
buttons = value;
|
||||||
|
|
||||||
foreach (ModButton button in value)
|
foreach (ModButton button in value)
|
||||||
{
|
{
|
||||||
button.Colour = Colour;
|
button.Colour = Colour;
|
||||||
button.Action = buttonPressed;
|
button.Action = buttonPressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
buttonsContainer.Add(value);
|
buttonsContainer.Add(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 colour = Color4.White;
|
private Color4 colour = Color4.White;
|
||||||
new public Color4 Colour
|
new public Color4 Colour
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return colour;
|
return colour;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == colour) return;
|
if (value == colour) return;
|
||||||
colour = value;
|
colour = value;
|
||||||
|
|
||||||
foreach (ModButton button in buttons)
|
foreach (ModButton button in buttons)
|
||||||
{
|
{
|
||||||
button.Colour = value;
|
button.Colour = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 selectedColour = Color4.White;
|
private Color4 selectedColour = Color4.White;
|
||||||
public Color4 SelectedColour
|
public Color4 SelectedColour
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return selectedColour;
|
return selectedColour;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == selectedColour) return;
|
if (value == selectedColour) return;
|
||||||
selectedColour = value;
|
selectedColour = value;
|
||||||
|
|
||||||
foreach (ModButton button in buttons)
|
foreach (ModButton button in buttons)
|
||||||
{
|
{
|
||||||
button.SelectedColour = value;
|
button.SelectedColour = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeselectAll()
|
public void DeselectAll()
|
||||||
{
|
{
|
||||||
foreach (ModButton button in buttons)
|
foreach (ModButton button in buttons)
|
||||||
{
|
{
|
||||||
button.Deselect();
|
button.Deselect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buttonPressed(Mod mod)
|
private void buttonPressed(Mod mod)
|
||||||
{
|
{
|
||||||
Action?.Invoke(mod);
|
Action?.Invoke(mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModSection()
|
public ModSection()
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Y;
|
AutoSizeAxes = Axes.Y;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
headerLabel = new OsuSpriteText
|
headerLabel = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
Anchor = Anchor.TopLeft,
|
Anchor = Anchor.TopLeft,
|
||||||
Position = new Vector2(0f, 0f),
|
Position = new Vector2(0f, 0f),
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
Text = Header,
|
Text = Header,
|
||||||
},
|
},
|
||||||
buttonsContainer = new AlwaysPresentFlowContainer
|
buttonsContainer = new AlwaysPresentFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Spacing = new Vector2(50f, 0f),
|
Spacing = new Vector2(50f, 0f),
|
||||||
Margin = new MarginPadding
|
Margin = new MarginPadding
|
||||||
{
|
{
|
||||||
Top = 6,
|
Top = 6,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 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
|
||||||
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
@ -19,399 +19,399 @@ using osu.Framework.Input;
|
|||||||
using OpenTK.Input;
|
using OpenTK.Input;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
public class ModSelectOverlay : WaveOverlayContainer
|
public class ModSelectOverlay : WaveOverlayContainer
|
||||||
{
|
{
|
||||||
private const int button_duration = 700;
|
private const int button_duration = 700;
|
||||||
private const int ranked_multiplier_duration = 700;
|
private const int ranked_multiplier_duration = 700;
|
||||||
private const float content_width = 0.8f;
|
private const float content_width = 0.8f;
|
||||||
|
|
||||||
private Color4 lowMultiplierColour, highMultiplierColour;
|
private Color4 lowMultiplierColour, highMultiplierColour;
|
||||||
|
|
||||||
private OsuSpriteText rankedLabel, multiplierLabel;
|
private OsuSpriteText rankedLabel, multiplierLabel;
|
||||||
private FlowContainer rankedMultiplerContainer;
|
private FlowContainer rankedMultiplerContainer;
|
||||||
|
|
||||||
private FlowContainer modSectionsContainer;
|
private FlowContainer modSectionsContainer;
|
||||||
|
|
||||||
private DifficultyReductionSection difficultyReductionSection;
|
private DifficultyReductionSection difficultyReductionSection;
|
||||||
private DifficultyIncreaseSection difficultyIncreaseSection;
|
private DifficultyIncreaseSection difficultyIncreaseSection;
|
||||||
private AssistedSection assistedSection;
|
private AssistedSection assistedSection;
|
||||||
private ModSection[] sections
|
private ModSection[] sections
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return new ModSection[] { difficultyReductionSection, difficultyIncreaseSection, assistedSection };
|
return new ModSection[] { difficultyReductionSection, difficultyIncreaseSection, assistedSection };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bindable<Mod[]> SelectedMods = new Bindable<Mod[]>();
|
public Bindable<Mod[]> SelectedMods = new Bindable<Mod[]>();
|
||||||
|
|
||||||
private PlayMode modMode;
|
private PlayMode modMode;
|
||||||
public PlayMode ModMode
|
public PlayMode ModMode
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return modMode;
|
return modMode;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == modMode) return;
|
if (value == modMode) return;
|
||||||
modMode = value;
|
modMode = value;
|
||||||
|
|
||||||
modSectionsContainer.Children = new Drawable[]
|
modSectionsContainer.Children = new Drawable[]
|
||||||
{
|
{
|
||||||
difficultyReductionSection = new DifficultyReductionSection
|
difficultyReductionSection = new DifficultyReductionSection
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Action = modButtonPressed,
|
Action = modButtonPressed,
|
||||||
},
|
},
|
||||||
difficultyIncreaseSection = new DifficultyIncreaseSection
|
difficultyIncreaseSection = new DifficultyIncreaseSection
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Action = modButtonPressed,
|
Action = modButtonPressed,
|
||||||
},
|
},
|
||||||
assistedSection = new AssistedSection(value)
|
assistedSection = new AssistedSection(value)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Action = modButtonPressed,
|
Action = modButtonPressed,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool RequestingFocus => State == Visibility.Visible;
|
public override bool RequestingFocus => State == Visibility.Visible;
|
||||||
|
|
||||||
protected override bool OnFocus(InputState state) => true;
|
protected override bool OnFocus(InputState state) => true;
|
||||||
protected override void OnFocusLost(InputState state)
|
protected override void OnFocusLost(InputState state)
|
||||||
{
|
{
|
||||||
if (state.Keyboard.Keys.Contains(Key.Escape))
|
if (state.Keyboard.Keys.Contains(Key.Escape))
|
||||||
Hide();
|
Hide();
|
||||||
base.OnFocusLost(state);
|
base.OnFocusLost(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
lowMultiplierColour = colours.Red;
|
lowMultiplierColour = colours.Red;
|
||||||
highMultiplierColour = colours.Green;
|
highMultiplierColour = colours.Green;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
base.PopIn();
|
base.PopIn();
|
||||||
Schedule(TriggerFocusContention);
|
Schedule(TriggerFocusContention);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
{
|
{
|
||||||
base.PopOut();
|
base.PopOut();
|
||||||
TriggerFocusLost();
|
TriggerFocusLost();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void TransitionIn()
|
protected override void TransitionIn()
|
||||||
{
|
{
|
||||||
rankedMultiplerContainer.MoveToX(0, ranked_multiplier_duration, EasingTypes.OutQuint);
|
rankedMultiplerContainer.MoveToX(0, ranked_multiplier_duration, EasingTypes.OutQuint);
|
||||||
rankedMultiplerContainer.FadeIn(ranked_multiplier_duration, EasingTypes.OutQuint);
|
rankedMultiplerContainer.FadeIn(ranked_multiplier_duration, EasingTypes.OutQuint);
|
||||||
|
|
||||||
foreach (ModSection section in sections)
|
foreach (ModSection section in sections)
|
||||||
{
|
{
|
||||||
section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), button_duration, EasingTypes.OutQuint);
|
section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), button_duration, EasingTypes.OutQuint);
|
||||||
section.ButtonsContainer.MoveToX(0, button_duration, EasingTypes.OutQuint);
|
section.ButtonsContainer.MoveToX(0, button_duration, EasingTypes.OutQuint);
|
||||||
section.ButtonsContainer.FadeIn(button_duration, EasingTypes.OutQuint);
|
section.ButtonsContainer.FadeIn(button_duration, EasingTypes.OutQuint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void TransitionOut()
|
protected override void TransitionOut()
|
||||||
{
|
{
|
||||||
rankedMultiplerContainer.MoveToX(rankedMultiplerContainer.DrawSize.X, CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
rankedMultiplerContainer.MoveToX(rankedMultiplerContainer.DrawSize.X, CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
||||||
rankedMultiplerContainer.FadeOut(CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
rankedMultiplerContainer.FadeOut(CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
||||||
|
|
||||||
foreach (ModSection section in sections)
|
foreach (ModSection section in sections)
|
||||||
{
|
{
|
||||||
section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
||||||
section.ButtonsContainer.MoveToX(100f, CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
section.ButtonsContainer.MoveToX(100f, CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
||||||
section.ButtonsContainer.FadeOut(CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
section.ButtonsContainer.FadeOut(CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeselectAll()
|
public void DeselectAll()
|
||||||
{
|
{
|
||||||
foreach (ModSection section in sections)
|
foreach (ModSection section in sections)
|
||||||
{
|
{
|
||||||
foreach (ModButton button in section.Buttons)
|
foreach (ModButton button in section.Buttons)
|
||||||
{
|
{
|
||||||
button.Deselect();
|
button.Deselect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void modButtonPressed(Mod selectedMod)
|
private void modButtonPressed(Mod selectedMod)
|
||||||
{
|
{
|
||||||
if (selectedMod != null)
|
if (selectedMod != null)
|
||||||
{
|
{
|
||||||
foreach (Modes.Mods disableMod in selectedMod.DisablesMods(ModMode))
|
foreach (Modes.Mods disableMod in selectedMod.DisablesMods(ModMode))
|
||||||
{
|
{
|
||||||
DeselectMod(disableMod);
|
DeselectMod(disableMod);
|
||||||
}
|
}
|
||||||
refreshSelectedMods();
|
refreshSelectedMods();
|
||||||
}
|
}
|
||||||
|
|
||||||
double multiplier = 1;
|
double multiplier = 1;
|
||||||
bool ranked = true;
|
bool ranked = true;
|
||||||
|
|
||||||
foreach (Mod mod in SelectedMods.Value)
|
foreach (Mod mod in SelectedMods.Value)
|
||||||
{
|
{
|
||||||
multiplier *= mod.ScoreMultiplier(ModMode);
|
multiplier *= mod.ScoreMultiplier(ModMode);
|
||||||
|
|
||||||
if (ranked)
|
if (ranked)
|
||||||
{
|
{
|
||||||
ranked = mod.Ranked(ModMode);
|
ranked = mod.Ranked(ModMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1.00x
|
// 1.00x
|
||||||
// 1.05x
|
// 1.05x
|
||||||
// 1.20x
|
// 1.20x
|
||||||
|
|
||||||
multiplierLabel.Text = string.Format("{0:N2}x", multiplier);
|
multiplierLabel.Text = string.Format("{0:N2}x", multiplier);
|
||||||
string rankedString = ranked ? "Ranked" : "Unranked";
|
string rankedString = ranked ? "Ranked" : "Unranked";
|
||||||
rankedLabel.Text = $@"{rankedString}, Score Multiplier: ";
|
rankedLabel.Text = $@"{rankedString}, Score Multiplier: ";
|
||||||
if (multiplier > 1.0)
|
if (multiplier > 1.0)
|
||||||
{
|
{
|
||||||
multiplierLabel.FadeColour(highMultiplierColour, 200);
|
multiplierLabel.FadeColour(highMultiplierColour, 200);
|
||||||
}
|
}
|
||||||
else if (multiplier < 1.0)
|
else if (multiplier < 1.0)
|
||||||
{
|
{
|
||||||
multiplierLabel.FadeColour(lowMultiplierColour, 200);
|
multiplierLabel.FadeColour(lowMultiplierColour, 200);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
multiplierLabel.FadeColour(Color4.White, 200);
|
multiplierLabel.FadeColour(Color4.White, 200);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DeselectMod(Modes.Mods modName)
|
public void DeselectMod(Modes.Mods modName)
|
||||||
{
|
{
|
||||||
foreach (ModSection section in sections)
|
foreach (ModSection section in sections)
|
||||||
{
|
{
|
||||||
foreach (ModButton button in section.Buttons)
|
foreach (ModButton button in section.Buttons)
|
||||||
{
|
{
|
||||||
foreach (Mod mod in button.Mods)
|
foreach (Mod mod in button.Mods)
|
||||||
{
|
{
|
||||||
if (mod.Name == modName)
|
if (mod.Name == modName)
|
||||||
{
|
{
|
||||||
button.Deselect();
|
button.Deselect();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refreshSelectedMods()
|
private void refreshSelectedMods()
|
||||||
{
|
{
|
||||||
List<Mod> selectedMods = new List<Mod>();
|
List<Mod> selectedMods = new List<Mod>();
|
||||||
|
|
||||||
foreach (ModSection section in sections)
|
foreach (ModSection section in sections)
|
||||||
{
|
{
|
||||||
foreach (Mod mod in section.SelectedMods)
|
foreach (Mod mod in section.SelectedMods)
|
||||||
{
|
{
|
||||||
selectedMods.Add(mod);
|
selectedMods.Add(mod);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SelectedMods.Value = selectedMods.ToArray();
|
SelectedMods.Value = selectedMods.ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModSelectOverlay()
|
public ModSelectOverlay()
|
||||||
{
|
{
|
||||||
FirstWaveColour = OsuColour.FromHex(@"19b0e2");
|
FirstWaveColour = OsuColour.FromHex(@"19b0e2");
|
||||||
SecondWaveColour = OsuColour.FromHex(@"2280a2");
|
SecondWaveColour = OsuColour.FromHex(@"2280a2");
|
||||||
ThirdWaveColour = OsuColour.FromHex(@"005774");
|
ThirdWaveColour = OsuColour.FromHex(@"005774");
|
||||||
FourthWaveColour = OsuColour.FromHex(@"003a4e");
|
FourthWaveColour = OsuColour.FromHex(@"003a4e");
|
||||||
|
|
||||||
Height = 510;
|
Height = 510;
|
||||||
Content.RelativeSizeAxes = Axes.X;
|
Content.RelativeSizeAxes = Axes.X;
|
||||||
Content.AutoSizeAxes = Axes.Y;
|
Content.AutoSizeAxes = Axes.Y;
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = new Color4(36, 50, 68, 255)
|
Colour = new Color4(36, 50, 68, 255)
|
||||||
},
|
},
|
||||||
new Triangles
|
new Triangles
|
||||||
{
|
{
|
||||||
TriangleScale = 5,
|
TriangleScale = 5,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
ColourLight = new Color4(53, 66, 82, 255),
|
ColourLight = new Color4(53, 66, 82, 255),
|
||||||
ColourDark = new Color4(41, 54, 70, 255),
|
ColourDark = new Color4(41, 54, 70, 255),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Direction = FlowDirections.Vertical,
|
Direction = FlowDirections.Vertical,
|
||||||
Spacing = new Vector2(0f, 10f),
|
Spacing = new Vector2(0f, 10f),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
// Header
|
// Header
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = 82,
|
Height = 82,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = OsuColour.Gray(10).Opacity(100),
|
Colour = OsuColour.Gray(10).Opacity(100),
|
||||||
},
|
},
|
||||||
new FlowContainer
|
new FlowContainer
|
||||||
{
|
{
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Direction = FlowDirections.Vertical,
|
Direction = FlowDirections.Vertical,
|
||||||
Width = content_width,
|
Width = content_width,
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Top = 10,
|
Top = 10,
|
||||||
Bottom = 10,
|
Bottom = 10,
|
||||||
},
|
},
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
Text = @"Gameplay Mods",
|
Text = @"Gameplay Mods",
|
||||||
TextSize = 22,
|
TextSize = 22,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
Margin = new MarginPadding
|
Margin = new MarginPadding
|
||||||
{
|
{
|
||||||
Bottom = 4,
|
Bottom = 4,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = @"Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.",
|
Text = @"Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.",
|
||||||
TextSize = 18,
|
TextSize = 18,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
new OsuSpriteText
|
new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = @"Others are just for fun",
|
Text = @"Others are just for fun",
|
||||||
TextSize = 18,
|
TextSize = 18,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Body
|
// Body
|
||||||
modSectionsContainer = new FlowContainer
|
modSectionsContainer = new FlowContainer
|
||||||
{
|
{
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Spacing = new Vector2(0f, 10f),
|
Spacing = new Vector2(0f, 10f),
|
||||||
Width = content_width,
|
Width = content_width,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
difficultyReductionSection = new DifficultyReductionSection
|
difficultyReductionSection = new DifficultyReductionSection
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Action = modButtonPressed,
|
Action = modButtonPressed,
|
||||||
},
|
},
|
||||||
difficultyIncreaseSection = new DifficultyIncreaseSection
|
difficultyIncreaseSection = new DifficultyIncreaseSection
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Action = modButtonPressed,
|
Action = modButtonPressed,
|
||||||
},
|
},
|
||||||
assistedSection = new AssistedSection(PlayMode.Osu)
|
assistedSection = new AssistedSection(PlayMode.Osu)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Action = modButtonPressed,
|
Action = modButtonPressed,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
// Footer
|
// Footer
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Height = 70,
|
Height = 70,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = new Color4(172, 20, 116, 255),
|
Colour = new Color4(172, 20, 116, 255),
|
||||||
Alpha = 0.5f,
|
Alpha = 0.5f,
|
||||||
},
|
},
|
||||||
rankedMultiplerContainer = new FlowContainer
|
rankedMultiplerContainer = new FlowContainer
|
||||||
{
|
{
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
Width = content_width,
|
Width = content_width,
|
||||||
Direction = FlowDirections.Horizontal,
|
Direction = FlowDirections.Horizontal,
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding
|
||||||
{
|
{
|
||||||
Top = 20,
|
Top = 20,
|
||||||
Bottom = 20,
|
Bottom = 20,
|
||||||
},
|
},
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
rankedLabel = new OsuSpriteText
|
rankedLabel = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Text = @"Ranked, Score Multiplier: ",
|
Text = @"Ranked, Score Multiplier: ",
|
||||||
TextSize = 30,
|
TextSize = 30,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
multiplierLabel = new OsuSpriteText
|
multiplierLabel = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
Text = @"1.00x",
|
Text = @"1.00x",
|
||||||
TextSize = 30,
|
TextSize = 30,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,281 +1,281 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 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
|
||||||
|
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using osu.Framework.Graphics.Transformations;
|
using osu.Framework.Graphics.Transformations;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
{
|
{
|
||||||
public abstract class WaveOverlayContainer : OverlayContainer
|
public abstract class WaveOverlayContainer : OverlayContainer
|
||||||
{
|
{
|
||||||
private const float first_wave_position = -130;
|
private const float first_wave_position = -130;
|
||||||
private const float second_wave_position = 0;
|
private const float second_wave_position = 0;
|
||||||
private const float third_wave_position = 70;
|
private const float third_wave_position = 70;
|
||||||
private const float fourth_wave_position = 100;
|
private const float fourth_wave_position = 100;
|
||||||
private const float waves_container_position = -150;
|
private const float waves_container_position = -150;
|
||||||
private float[] wavePositions
|
private float[] wavePositions
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return new float[] { first_wave_position, second_wave_position, third_wave_position, fourth_wave_position };
|
return new float[] { first_wave_position, second_wave_position, third_wave_position, fourth_wave_position };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private const float first_wave_duration = 600;
|
private const float first_wave_duration = 600;
|
||||||
private const float second_wave_duration = 700;
|
private const float second_wave_duration = 700;
|
||||||
private const float third_wave_duration = 800;
|
private const float third_wave_duration = 800;
|
||||||
private const float fourth_wave_duration = 900;
|
private const float fourth_wave_duration = 900;
|
||||||
private const float container_wait = 200;
|
private const float container_wait = 200;
|
||||||
private const float waves_container_duration = 400;
|
private const float waves_container_duration = 400;
|
||||||
private const float content_duration = 700;
|
private const float content_duration = 700;
|
||||||
private const float content_transition_wait = 100;
|
private const float content_transition_wait = 100;
|
||||||
internal const float CONTENT_EXIT_DURATION = 600;
|
internal const float CONTENT_EXIT_DURATION = 600;
|
||||||
private float [] waveDurations
|
private float [] waveDurations
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return new float[] { first_wave_duration, second_wave_duration, third_wave_duration, fourth_wave_duration };
|
return new float[] { first_wave_duration, second_wave_duration, third_wave_duration, fourth_wave_duration };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private const float first_wave_rotation = 13;
|
private const float first_wave_rotation = 13;
|
||||||
private const float second_wave_rotation = -7;
|
private const float second_wave_rotation = -7;
|
||||||
private const float third_wave_rotation = 4;
|
private const float third_wave_rotation = 4;
|
||||||
private const float fourth_wave_rotation = -2;
|
private const float fourth_wave_rotation = -2;
|
||||||
|
|
||||||
private Container firstWave, secondWave, thirdWave, fourthWave, wavesContainer;
|
private Container firstWave, secondWave, thirdWave, fourthWave, wavesContainer;
|
||||||
private readonly Container[] waves;
|
private readonly Container[] waves;
|
||||||
|
|
||||||
private readonly Container contentContainer;
|
private readonly Container contentContainer;
|
||||||
protected override Container<Drawable> Content => contentContainer;
|
protected override Container<Drawable> Content => contentContainer;
|
||||||
|
|
||||||
private EdgeEffect waveShadow = new EdgeEffect
|
private EdgeEffect waveShadow = new EdgeEffect
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Shadow,
|
Type = EdgeEffectType.Shadow,
|
||||||
Colour = Color4.Black.Opacity(50),
|
Colour = Color4.Black.Opacity(50),
|
||||||
Radius = 20f,
|
Radius = 20f,
|
||||||
};
|
};
|
||||||
|
|
||||||
private Color4 firstWaveColour;
|
private Color4 firstWaveColour;
|
||||||
public Color4 FirstWaveColour
|
public Color4 FirstWaveColour
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return firstWaveColour;
|
return firstWaveColour;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (firstWaveColour == value) return;
|
if (firstWaveColour == value) return;
|
||||||
firstWaveColour = value;
|
firstWaveColour = value;
|
||||||
firstWave.Colour = value;
|
firstWave.Colour = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 secondWaveColour;
|
private Color4 secondWaveColour;
|
||||||
public Color4 SecondWaveColour
|
public Color4 SecondWaveColour
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return secondWaveColour;
|
return secondWaveColour;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (secondWaveColour == value) return;
|
if (secondWaveColour == value) return;
|
||||||
secondWaveColour = value;
|
secondWaveColour = value;
|
||||||
secondWave.Colour = value;
|
secondWave.Colour = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 thirdWaveColour;
|
private Color4 thirdWaveColour;
|
||||||
public Color4 ThirdWaveColour
|
public Color4 ThirdWaveColour
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return thirdWaveColour;
|
return thirdWaveColour;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (thirdWaveColour == value) return;
|
if (thirdWaveColour == value) return;
|
||||||
thirdWaveColour = value;
|
thirdWaveColour = value;
|
||||||
thirdWave.Colour = value;
|
thirdWave.Colour = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Color4 fourthWaveColour;
|
private Color4 fourthWaveColour;
|
||||||
public Color4 FourthWaveColour
|
public Color4 FourthWaveColour
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return fourthWaveColour;
|
return fourthWaveColour;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (fourthWaveColour == value) return;
|
if (fourthWaveColour == value) return;
|
||||||
fourthWaveColour = value;
|
fourthWaveColour = value;
|
||||||
fourthWave.Colour = value;
|
fourthWave.Colour = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void PopIn()
|
protected override void PopIn()
|
||||||
{
|
{
|
||||||
base.Show();
|
base.Show();
|
||||||
|
|
||||||
for (int i = 0; i < waves.Length; i++)
|
for (int i = 0; i < waves.Length; i++)
|
||||||
{
|
{
|
||||||
waves[i].MoveToY(wavePositions[i], waveDurations[i], EasingTypes.OutQuint);
|
waves[i].MoveToY(wavePositions[i], waveDurations[i], EasingTypes.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
DelayReset();
|
DelayReset();
|
||||||
Delay(container_wait);
|
Delay(container_wait);
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
if (State == Visibility.Visible)
|
if (State == Visibility.Visible)
|
||||||
{
|
{
|
||||||
wavesContainer.MoveToY(waves_container_position, waves_container_duration, EasingTypes.None);
|
wavesContainer.MoveToY(waves_container_position, waves_container_duration, EasingTypes.None);
|
||||||
contentContainer.FadeIn(content_duration, EasingTypes.OutQuint);
|
contentContainer.FadeIn(content_duration, EasingTypes.OutQuint);
|
||||||
contentContainer.MoveToY(0, content_duration, EasingTypes.OutQuint);
|
contentContainer.MoveToY(0, content_duration, EasingTypes.OutQuint);
|
||||||
|
|
||||||
Delay(content_transition_wait);
|
Delay(content_transition_wait);
|
||||||
Schedule(() => { if (State == Visibility.Visible) TransitionIn(); });
|
Schedule(() => { if (State == Visibility.Visible) TransitionIn(); });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void TransitionIn();
|
protected abstract void TransitionIn();
|
||||||
|
|
||||||
protected override void PopOut()
|
protected override void PopOut()
|
||||||
{
|
{
|
||||||
base.Hide();
|
base.Hide();
|
||||||
|
|
||||||
contentContainer.FadeOut(CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
contentContainer.FadeOut(CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
||||||
contentContainer.MoveToY(DrawHeight, CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
contentContainer.MoveToY(DrawHeight, CONTENT_EXIT_DURATION, EasingTypes.InSine);
|
||||||
TransitionOut();
|
TransitionOut();
|
||||||
|
|
||||||
for (int i = 0; i < waves.Length; i++)
|
for (int i = 0; i < waves.Length; i++)
|
||||||
{
|
{
|
||||||
waves[i].MoveToY(DrawHeight, second_wave_duration, EasingTypes.InSine);
|
waves[i].MoveToY(DrawHeight, second_wave_duration, EasingTypes.InSine);
|
||||||
}
|
}
|
||||||
|
|
||||||
DelayReset();
|
DelayReset();
|
||||||
Delay(container_wait);
|
Delay(container_wait);
|
||||||
Schedule(() =>
|
Schedule(() =>
|
||||||
{
|
{
|
||||||
if (State == Visibility.Hidden)
|
if (State == Visibility.Hidden)
|
||||||
{
|
{
|
||||||
wavesContainer.MoveToY(0, waves_container_duration, EasingTypes.None);
|
wavesContainer.MoveToY(0, waves_container_duration, EasingTypes.None);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void TransitionOut();
|
protected abstract void TransitionOut();
|
||||||
|
|
||||||
public WaveOverlayContainer()
|
public WaveOverlayContainer()
|
||||||
{
|
{
|
||||||
Masking = true;
|
Masking = true;
|
||||||
|
|
||||||
AddInternal(wavesContainer = new Container
|
AddInternal(wavesContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
firstWave = new Container
|
firstWave = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
Anchor = Anchor.TopLeft,
|
Anchor = Anchor.TopLeft,
|
||||||
Size = new Vector2(1.5f),
|
Size = new Vector2(1.5f),
|
||||||
Rotation = first_wave_rotation,
|
Rotation = first_wave_rotation,
|
||||||
Colour = FirstWaveColour,
|
Colour = FirstWaveColour,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
EdgeEffect = waveShadow,
|
EdgeEffect = waveShadow,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
secondWave = new Container
|
secondWave = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Size = new Vector2(1.5f),
|
Size = new Vector2(1.5f),
|
||||||
Rotation = second_wave_rotation,
|
Rotation = second_wave_rotation,
|
||||||
Colour = SecondWaveColour,
|
Colour = SecondWaveColour,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
EdgeEffect = waveShadow,
|
EdgeEffect = waveShadow,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
thirdWave = new Container
|
thirdWave = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.TopLeft,
|
Origin = Anchor.TopLeft,
|
||||||
Anchor = Anchor.TopLeft,
|
Anchor = Anchor.TopLeft,
|
||||||
Size = new Vector2(1.5f),
|
Size = new Vector2(1.5f),
|
||||||
Rotation = third_wave_rotation,
|
Rotation = third_wave_rotation,
|
||||||
Colour = ThirdWaveColour,
|
Colour = ThirdWaveColour,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
EdgeEffect = waveShadow,
|
EdgeEffect = waveShadow,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fourthWave = new Container
|
fourthWave = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Size = new Vector2(1.5f),
|
Size = new Vector2(1.5f),
|
||||||
Rotation = fourth_wave_rotation,
|
Rotation = fourth_wave_rotation,
|
||||||
Colour = FourthWaveColour,
|
Colour = FourthWaveColour,
|
||||||
Masking = true,
|
Masking = true,
|
||||||
EdgeEffect = waveShadow,
|
EdgeEffect = waveShadow,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
AddInternal(contentContainer = new Container
|
AddInternal(contentContainer = new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
Origin = Anchor.BottomCentre,
|
Origin = Anchor.BottomCentre,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
new Box
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.White.Opacity(50),
|
Colour = Color4.White.Opacity(50),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
waves = new Container[] { firstWave, secondWave, thirdWave, fourthWave };
|
waves = new Container[] { firstWave, secondWave, thirdWave, fourthWave };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user