1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 01:27:29 +08:00

Fix line endings.

This commit is contained in:
Dean Herbert 2017-02-23 11:16:23 +09:00
parent 9746877903
commit 9f367bcc0e
No known key found for this signature in database
GPG Key ID: 46D71BF4958ABB49
7 changed files with 1388 additions and 1388 deletions

View File

@ -1,223 +1,223 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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;
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
namespace osu.Game
{
public class AssistedSection : ModSection
{
private ModButton relaxButton;
public ModButton RelaxButton
{
get
{
return relaxButton;
}
}
private ModButton autopilotButton;
public ModButton AutopilotButton
{
get
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
{
public class AssistedSection : ModSection
{
private ModButton relaxButton;
public ModButton RelaxButton
{
get
{
return autopilotButton;
}
}
private ModButton targetPracticeButton;
public ModButton TargetPracticeButton
{
get
return relaxButton;
}
}
private ModButton autopilotButton;
public ModButton AutopilotButton
{
get
{
return targetPracticeButton;
}
}
private ModButton spunOutButton;
public ModButton SpunOutButton
{
get
{
return spunOutButton;
}
}
private ModButton autoplayCinemaButton;
public ModButton AutoplayCinemaButton
{
get
{
return autoplayCinemaButton;
}
}
private ModButton keyButton;
public ModButton KeyButton
{
get
return autopilotButton;
}
}
private ModButton targetPracticeButton;
public ModButton TargetPracticeButton
{
get
{
return keyButton;
}
}
private ModButton coopButton;
public ModButton CoopButton
{
get
{
return coopButton;
}
}
private ModButton randomButton;
public ModButton RandomButton
{
get
{
return randomButton;
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Colour = colours.Blue;
SelectedColour = colours.BlueLight;
}
public AssistedSection(PlayMode mode)
{
Header = @"Assisted";
switch (mode)
{
case PlayMode.Osu:
Buttons = new ModButton[]
{
relaxButton = new ModButton
{
ToggleKey = Key.Z,
Mods = new Mod[]
{
new ModRelax(),
},
},
autopilotButton = new ModButton
{
ToggleKey = Key.X,
Mods = new Mod[]
{
new ModAutopilot(),
},
},
targetPracticeButton = new ModButton
{
ToggleKey = Key.C,
Mods = new Mod[]
{
new ModTarget(),
},
},
spunOutButton = new ModButton
{
ToggleKey = Key.V,
Mods = new Mod[]
{
new ModSpunOut(),
},
},
autoplayCinemaButton = new ModButton
{
ToggleKey = Key.B,
Mods = new Mod[]
{
new ModAutoplay(),
new ModCinema(),
},
},
};
break;
case PlayMode.Taiko:
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(),
},
},
};
return targetPracticeButton;
}
}
private ModButton spunOutButton;
public ModButton SpunOutButton
{
get
{
return spunOutButton;
}
}
private ModButton autoplayCinemaButton;
public ModButton AutoplayCinemaButton
{
get
{
return autoplayCinemaButton;
}
}
private ModButton keyButton;
public ModButton KeyButton
{
get
{
return keyButton;
}
}
private ModButton coopButton;
public ModButton CoopButton
{
get
{
return coopButton;
}
}
private ModButton randomButton;
public ModButton RandomButton
{
get
{
return randomButton;
}
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Colour = colours.Blue;
SelectedColour = colours.BlueLight;
}
public AssistedSection(PlayMode mode)
{
Header = @"Assisted";
switch (mode)
{
case PlayMode.Osu:
Buttons = new ModButton[]
{
relaxButton = new ModButton
{
ToggleKey = Key.Z,
Mods = new Mod[]
{
new ModRelax(),
},
},
autopilotButton = new ModButton
{
ToggleKey = Key.X,
Mods = new Mod[]
{
new ModAutopilot(),
},
},
targetPracticeButton = new ModButton
{
ToggleKey = Key.C,
Mods = new Mod[]
{
new ModTarget(),
},
},
spunOutButton = new ModButton
{
ToggleKey = Key.V,
Mods = new Mod[]
{
new ModSpunOut(),
},
},
autoplayCinemaButton = new ModButton
{
ToggleKey = Key.B,
Mods = new Mod[]
{
new ModAutoplay(),
new ModCinema(),
},
},
};
break;
default:
throw new NotSupportedException();
}
}
}
}
case PlayMode.Taiko:
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();
}
}
}
}

View File

@ -1,77 +1,77 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Input;
using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Modes;
using osu.Game.Overlays.Mods;
namespace osu.Game
{
public class DifficultyIncreaseSection : ModSection
{
public ModButton HardRockButton => Buttons[0];
public ModButton SuddenDeathButton => Buttons[1];
public ModButton DoubleTimeNightcoreButton => Buttons[2];
public ModButton HiddenButton => Buttons[3];
public ModButton FlashlightButton => Buttons[4];
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Colour = colours.Yellow;
SelectedColour = colours.YellowLight;
}
public DifficultyIncreaseSection()
{
Header = @"Gameplay Difficulty Increase";
Buttons = new ModButton[]
{
new ModButton
{
ToggleKey = Key.A,
Mods = new Mod[]
{
new ModHardRock(),
},
},
new ModButton
{
ToggleKey = Key.S,
Mods = new Mod[]
{
new ModSuddenDeath(),
new ModPerfect(),
},
},
new ModButton
{
ToggleKey = Key.D,
Mods = new Mod[]
{
new ModDoubleTime(),
new ModNightcore(),
},
},
new ModButton
{
ToggleKey = Key.F,
Mods = new Mod[]
{
new ModHidden(),
},
},
new ModButton
{
ToggleKey = Key.G,
Mods = new Mod[]
{
new ModFlashlight(),
},
},
};
}
}
}
using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Modes;
using osu.Game.Overlays.Mods;
namespace osu.Game
{
public class DifficultyIncreaseSection : ModSection
{
public ModButton HardRockButton => Buttons[0];
public ModButton SuddenDeathButton => Buttons[1];
public ModButton DoubleTimeNightcoreButton => Buttons[2];
public ModButton HiddenButton => Buttons[3];
public ModButton FlashlightButton => Buttons[4];
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
Colour = colours.Yellow;
SelectedColour = colours.YellowLight;
}
public DifficultyIncreaseSection()
{
Header = @"Gameplay Difficulty Increase";
Buttons = new ModButton[]
{
new ModButton
{
ToggleKey = Key.A,
Mods = new Mod[]
{
new ModHardRock(),
},
},
new ModButton
{
ToggleKey = Key.S,
Mods = new Mod[]
{
new ModSuddenDeath(),
new ModPerfect(),
},
},
new ModButton
{
ToggleKey = Key.D,
Mods = new Mod[]
{
new ModDoubleTime(),
new ModNightcore(),
},
},
new ModButton
{
ToggleKey = Key.F,
Mods = new Mod[]
{
new ModHidden(),
},
},
new ModButton
{
ToggleKey = Key.G,
Mods = new Mod[]
{
new ModFlashlight(),
},
},
};
}
}
}

View File

@ -7,9 +7,9 @@ using osu.Game.Graphics;
using osu.Game.Modes;
using osu.Game.Overlays.Mods;
namespace osu.Game
{
public class DifficultyReductionSection : ModSection
namespace osu.Game
{
public class DifficultyReductionSection : ModSection
{
public ModButton EasyButton => Buttons[0];
public ModButton NoFailButton => Buttons[1];
@ -21,8 +21,8 @@ namespace osu.Game
Colour = colours.Green;
SelectedColour = colours.GreenLight;
}
public DifficultyReductionSection()
public DifficultyReductionSection()
{
Header = @"Gameplay Difficulty Reduction";
Buttons = new ModButton[]
@ -51,7 +51,7 @@ namespace osu.Game
new ModHalfTime(),
},
},
};
}
}
}
};
}
}
}

View File

@ -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
using System;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using osu.Game.Graphics.Sprites;
using osu.Game.Modes;
using osu.Game.Modes.UI;
using System;
using OpenTK;
using OpenTK.Graphics;
using OpenTK.Input;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
using osu.Game.Graphics.Sprites;
using osu.Game.Modes;
using osu.Game.Modes.UI;
namespace osu.Game.Overlays.Mods
{
public class ModButton : FlowContainer
{
private ModIcon[] icons;
private ModIcon displayIcon
{
get
{
return icons[icons.Length - 1];
}
}
private SpriteText text;
private Container iconsContainer;
private SampleChannel sampleOn, sampleOff;
public Action<Mod> Action; // Passed the selected mod or null if none
public Key ToggleKey;
private int _selectedMod = -1;
private int selectedMod
{
get
{
return _selectedMod;
}
set
{
if (value == _selectedMod) return;
_selectedMod = value;
namespace osu.Game.Overlays.Mods
{
public class ModButton : FlowContainer
{
private ModIcon[] icons;
private ModIcon displayIcon
{
get
{
return icons[icons.Length - 1];
}
}
private SpriteText text;
private Container iconsContainer;
private SampleChannel sampleOn, sampleOff;
public Action<Mod> Action; // Passed the selected mod or null if none
public Key ToggleKey;
private int _selectedMod = -1;
private int selectedMod
{
get
{
return _selectedMod;
}
set
{
if (value == _selectedMod) return;
_selectedMod = value;
if (value >= Mods.Length)
{
@ -55,237 +55,237 @@ namespace osu.Game.Overlays.Mods
else if (value <= -2)
{
_selectedMod = 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;
}
}
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;
}
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)
{
(args.Button == MouseButton.Right ? (Action)SelectPrevious : SelectNext)();
{
(args.Button == MouseButton.Right ? (Action)SelectPrevious : SelectNext)();
return true;
}
public void SelectNext()
{
selectedMod++;
if (selectedMod == -1)
{
sampleOff.Play();
}
else
{
sampleOn.Play();
}
Action?.Invoke(SelectedMod);
}
public void SelectPrevious()
{
selectedMod--;
if (selectedMod == -1)
{
sampleOff.Play();
}
else
{
sampleOn.Play();
}
Action?.Invoke(SelectedMod);
}
public void Deselect()
{
selectedMod = -1;
}
private void displayMod(Mod mod)
{
}
public void SelectNext()
{
selectedMod++;
if (selectedMod == -1)
{
sampleOff.Play();
}
else
{
sampleOn.Play();
}
Action?.Invoke(SelectedMod);
}
public void SelectPrevious()
{
selectedMod--;
if (selectedMod == -1)
{
sampleOff.Play();
}
else
{
sampleOn.Play();
}
Action?.Invoke(SelectedMod);
}
public void Deselect()
{
selectedMod = -1;
}
private void displayMod(Mod mod)
{
displayIcon.Icon = mod.Icon;
text.Text = mod.Name.GetDescription();
}
private void displaySelectedMod()
{
var modIndex = selectedMod;
if (modIndex <= -1)
{
modIndex = 0;
}
displayMod(Mods[modIndex]);
}
private void createIcons()
{
if (Mods.Length > 1)
{
iconsContainer.Add(icons = new ModIcon[]
{
new ModIcon
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Position = new Vector2(1.5f),
},
new ModIcon
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Position = new Vector2(-1.5f),
},
});
}
else
{
iconsContainer.Add(icons = new ModIcon[]
{
new ModIcon
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Both,
},
});
}
}
text.Text = mod.Name.GetDescription();
}
private void displaySelectedMod()
{
var modIndex = selectedMod;
if (modIndex <= -1)
{
modIndex = 0;
}
displayMod(Mods[modIndex]);
}
private void createIcons()
{
if (Mods.Length > 1)
{
iconsContainer.Add(icons = new ModIcon[]
{
new ModIcon
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Position = new Vector2(1.5f),
},
new ModIcon
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Both,
Position = new Vector2(-1.5f),
},
});
}
else
{
iconsContainer.Add(icons = new ModIcon[]
{
new ModIcon
{
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
AutoSizeAxes = Axes.Both,
},
});
}
}
protected override bool OnKeyDown(Framework.Input.InputState state, KeyDownEventArgs args)
{
{
if (args.Key == ToggleKey)
{
SelectNext();
return true;
}
}
return base.OnKeyDown(state, args);
}
public ModButton()
{
Direction = FlowDirections.Vertical;
Spacing = new Vector2(0f, -5f);
Size = new Vector2(100f);
Children = new Drawable[]
{
new Container
{
Size = new Vector2(77f, 80f),
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Children = new Drawable[]
{
iconsContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
}
}
},
text = new OsuSpriteText
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
TextSize = 18,
},
};
}
}
}
}
public ModButton()
{
Direction = FlowDirections.Vertical;
Spacing = new Vector2(0f, -5f);
Size = new Vector2(100f);
Children = new Drawable[]
{
new Container
{
Size = new Vector2(77f, 80f),
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Children = new Drawable[]
{
iconsContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.Centre,
Anchor = Anchor.Centre,
}
}
},
text = new OsuSpriteText
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
TextSize = 18,
},
};
}
}
}

View File

@ -1,170 +1,170 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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 osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics.Sprites;
using osu.Game.Modes;
namespace osu.Game.Overlays.Mods
{
class AlwaysPresentFlowContainer : FlowContainer
{
public override bool IsPresent => true;
}
public class ModSection : Container
{
private OsuSpriteText headerLabel;
private AlwaysPresentFlowContainer buttonsContainer;
public FlowContainer ButtonsContainer
{
get
{
return buttonsContainer;
}
}
public Action<Mod> Action;
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;
}
set
{
header = value;
headerLabel.Text = value;
}
}
private ModButton[] buttons = {};
public ModButton[] Buttons
{
get
{
return buttons;
}
set
{
if (value == buttons) return;
buttons = value;
foreach (ModButton button in value)
{
button.Colour = Colour;
button.Action = buttonPressed;
}
buttonsContainer.Add(value);
}
}
private Color4 colour = Color4.White;
new public Color4 Colour
{
get
{
return colour;
}
set
{
if (value == colour) return;
colour = value;
foreach (ModButton button in buttons)
{
button.Colour = value;
}
}
}
private Color4 selectedColour = Color4.White;
public Color4 SelectedColour
{
get
{
return selectedColour;
}
set
{
if (value == selectedColour) return;
selectedColour = value;
foreach (ModButton button in buttons)
{
button.SelectedColour = value;
}
}
}
public void DeselectAll()
{
foreach (ModButton button in buttons)
{
button.Deselect();
}
}
private void buttonPressed(Mod mod)
{
Action?.Invoke(mod);
}
public ModSection()
{
AutoSizeAxes = Axes.Y;
Children = new Drawable[]
{
headerLabel = new OsuSpriteText
{
Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft,
Position = new Vector2(0f, 0f),
Font = @"Exo2.0-Bold",
Text = Header,
},
buttonsContainer = new AlwaysPresentFlowContainer
{
AutoSizeAxes = Axes.Both,
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Spacing = new Vector2(50f, 0f),
Margin = new MarginPadding
{
Top = 6,
},
},
};
}
}
}
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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 osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Game.Graphics.Sprites;
using osu.Game.Modes;
namespace osu.Game.Overlays.Mods
{
class AlwaysPresentFlowContainer : FlowContainer
{
public override bool IsPresent => true;
}
public class ModSection : Container
{
private OsuSpriteText headerLabel;
private AlwaysPresentFlowContainer buttonsContainer;
public FlowContainer ButtonsContainer
{
get
{
return buttonsContainer;
}
}
public Action<Mod> Action;
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;
}
set
{
header = value;
headerLabel.Text = value;
}
}
private ModButton[] buttons = {};
public ModButton[] Buttons
{
get
{
return buttons;
}
set
{
if (value == buttons) return;
buttons = value;
foreach (ModButton button in value)
{
button.Colour = Colour;
button.Action = buttonPressed;
}
buttonsContainer.Add(value);
}
}
private Color4 colour = Color4.White;
new public Color4 Colour
{
get
{
return colour;
}
set
{
if (value == colour) return;
colour = value;
foreach (ModButton button in buttons)
{
button.Colour = value;
}
}
}
private Color4 selectedColour = Color4.White;
public Color4 SelectedColour
{
get
{
return selectedColour;
}
set
{
if (value == selectedColour) return;
selectedColour = value;
foreach (ModButton button in buttons)
{
button.SelectedColour = value;
}
}
}
public void DeselectAll()
{
foreach (ModButton button in buttons)
{
button.Deselect();
}
}
private void buttonPressed(Mod mod)
{
Action?.Invoke(mod);
}
public ModSection()
{
AutoSizeAxes = Axes.Y;
Children = new Drawable[]
{
headerLabel = new OsuSpriteText
{
Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft,
Position = new Vector2(0f, 0f),
Font = @"Exo2.0-Bold",
Text = Header,
},
buttonsContainer = new AlwaysPresentFlowContainer
{
AutoSizeAxes = Axes.Both,
Origin = Anchor.BottomLeft,
Anchor = Anchor.BottomLeft,
Spacing = new Vector2(50f, 0f),
Margin = new MarginPadding
{
Top = 6,
},
},
};
}
}
}

View File

@ -1,12 +1,12 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// 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.Graphics;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Transformations;
@ -19,399 +19,399 @@ using osu.Framework.Input;
using OpenTK.Input;
using System.Linq;
namespace osu.Game.Overlays.Mods
{
public class ModSelectOverlay : WaveOverlayContainer
{
private const int button_duration = 700;
private const int ranked_multiplier_duration = 700;
private const float content_width = 0.8f;
private Color4 lowMultiplierColour, highMultiplierColour;
private OsuSpriteText rankedLabel, multiplierLabel;
private FlowContainer rankedMultiplerContainer;
private FlowContainer modSectionsContainer;
private DifficultyReductionSection difficultyReductionSection;
private DifficultyIncreaseSection difficultyIncreaseSection;
private AssistedSection assistedSection;
private ModSection[] sections
{
get
{
return new ModSection[] { difficultyReductionSection, difficultyIncreaseSection, assistedSection };
}
}
public Bindable<Mod[]> SelectedMods = new Bindable<Mod[]>();
private PlayMode modMode;
public PlayMode ModMode
{
get
{
return modMode;
}
set
{
if (value == modMode) return;
modMode = value;
modSectionsContainer.Children = new Drawable[]
{
difficultyReductionSection = new DifficultyReductionSection
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
difficultyIncreaseSection = new DifficultyIncreaseSection
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
assistedSection = new AssistedSection(value)
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
};
}
}
public override bool RequestingFocus => State == Visibility.Visible;
protected override bool OnFocus(InputState state) => true;
protected override void OnFocusLost(InputState state)
{
if (state.Keyboard.Keys.Contains(Key.Escape))
Hide();
base.OnFocusLost(state);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
lowMultiplierColour = colours.Red;
highMultiplierColour = colours.Green;
}
namespace osu.Game.Overlays.Mods
{
public class ModSelectOverlay : WaveOverlayContainer
{
private const int button_duration = 700;
private const int ranked_multiplier_duration = 700;
private const float content_width = 0.8f;
private Color4 lowMultiplierColour, highMultiplierColour;
private OsuSpriteText rankedLabel, multiplierLabel;
private FlowContainer rankedMultiplerContainer;
private FlowContainer modSectionsContainer;
private DifficultyReductionSection difficultyReductionSection;
private DifficultyIncreaseSection difficultyIncreaseSection;
private AssistedSection assistedSection;
private ModSection[] sections
{
get
{
return new ModSection[] { difficultyReductionSection, difficultyIncreaseSection, assistedSection };
}
}
public Bindable<Mod[]> SelectedMods = new Bindable<Mod[]>();
private PlayMode modMode;
public PlayMode ModMode
{
get
{
return modMode;
}
set
{
if (value == modMode) return;
modMode = value;
modSectionsContainer.Children = new Drawable[]
{
difficultyReductionSection = new DifficultyReductionSection
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
difficultyIncreaseSection = new DifficultyIncreaseSection
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
assistedSection = new AssistedSection(value)
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
};
}
}
public override bool RequestingFocus => State == Visibility.Visible;
protected override bool OnFocus(InputState state) => true;
protected override void OnFocusLost(InputState state)
{
if (state.Keyboard.Keys.Contains(Key.Escape))
Hide();
base.OnFocusLost(state);
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
lowMultiplierColour = colours.Red;
highMultiplierColour = colours.Green;
}
protected override void PopIn()
{
base.PopIn();
base.PopIn();
Schedule(TriggerFocusContention);
}
}
protected override void PopOut()
{
base.PopOut();
base.PopOut();
TriggerFocusLost();
}
protected override void TransitionIn()
{
rankedMultiplerContainer.MoveToX(0, ranked_multiplier_duration, EasingTypes.OutQuint);
rankedMultiplerContainer.FadeIn(ranked_multiplier_duration, EasingTypes.OutQuint);
foreach (ModSection section in sections)
{
section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), button_duration, EasingTypes.OutQuint);
section.ButtonsContainer.MoveToX(0, button_duration, EasingTypes.OutQuint);
section.ButtonsContainer.FadeIn(button_duration, EasingTypes.OutQuint);
}
}
protected override void TransitionOut()
{
rankedMultiplerContainer.MoveToX(rankedMultiplerContainer.DrawSize.X, CONTENT_EXIT_DURATION, EasingTypes.InSine);
rankedMultiplerContainer.FadeOut(CONTENT_EXIT_DURATION, EasingTypes.InSine);
}
protected override void TransitionIn()
{
rankedMultiplerContainer.MoveToX(0, ranked_multiplier_duration, EasingTypes.OutQuint);
rankedMultiplerContainer.FadeIn(ranked_multiplier_duration, EasingTypes.OutQuint);
foreach (ModSection section in sections)
{
section.ButtonsContainer.TransformSpacingTo(new Vector2(50f, 0f), button_duration, EasingTypes.OutQuint);
section.ButtonsContainer.MoveToX(0, button_duration, EasingTypes.OutQuint);
section.ButtonsContainer.FadeIn(button_duration, EasingTypes.OutQuint);
}
}
protected override void TransitionOut()
{
rankedMultiplerContainer.MoveToX(rankedMultiplerContainer.DrawSize.X, CONTENT_EXIT_DURATION, EasingTypes.InSine);
rankedMultiplerContainer.FadeOut(CONTENT_EXIT_DURATION, EasingTypes.InSine);
foreach (ModSection section in sections)
{
section.ButtonsContainer.TransformSpacingTo(new Vector2(100f, 0f), CONTENT_EXIT_DURATION, EasingTypes.InSine);
section.ButtonsContainer.MoveToX(100f, CONTENT_EXIT_DURATION, EasingTypes.InSine);
section.ButtonsContainer.FadeOut(CONTENT_EXIT_DURATION, EasingTypes.InSine);
}
}
public void DeselectAll()
{
foreach (ModSection section in sections)
{
foreach (ModButton button in section.Buttons)
{
button.Deselect();
}
}
}
private void modButtonPressed(Mod selectedMod)
{
if (selectedMod != null)
}
}
public void DeselectAll()
{
foreach (ModSection section in sections)
{
foreach (ModButton button in section.Buttons)
{
button.Deselect();
}
}
}
private void modButtonPressed(Mod selectedMod)
{
if (selectedMod != null)
{
foreach (Modes.Mods disableMod in selectedMod.DisablesMods(ModMode))
{
DeselectMod(disableMod);
}
refreshSelectedMods();
}
double multiplier = 1;
bool ranked = true;
refreshSelectedMods();
}
double multiplier = 1;
bool ranked = true;
foreach (Mod mod in SelectedMods.Value)
{
multiplier *= mod.ScoreMultiplier(ModMode);
if (ranked)
{
ranked = mod.Ranked(ModMode);
multiplier *= mod.ScoreMultiplier(ModMode);
if (ranked)
{
ranked = mod.Ranked(ModMode);
}
}
// 1.00x
// 1.05x
// 1.20x
multiplierLabel.Text = string.Format("{0:N2}x", multiplier);
string rankedString = ranked ? "Ranked" : "Unranked";
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);
}
}
public void DeselectMod(Modes.Mods modName)
{
foreach (ModSection section in sections)
{
foreach (ModButton button in section.Buttons)
{
foreach (Mod mod in button.Mods)
{
if (mod.Name == modName)
{
button.Deselect();
return;
}
}
}
}
}
private void refreshSelectedMods()
{
}
// 1.00x
// 1.05x
// 1.20x
multiplierLabel.Text = string.Format("{0:N2}x", multiplier);
string rankedString = ranked ? "Ranked" : "Unranked";
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);
}
}
public void DeselectMod(Modes.Mods modName)
{
foreach (ModSection section in sections)
{
foreach (ModButton button in section.Buttons)
{
foreach (Mod mod in button.Mods)
{
if (mod.Name == modName)
{
button.Deselect();
return;
}
}
}
}
}
private void refreshSelectedMods()
{
List<Mod> selectedMods = new List<Mod>();
foreach (ModSection section in sections)
{
foreach (Mod mod in section.SelectedMods)
{
selectedMods.Add(mod);
}
}
SelectedMods.Value = selectedMods.ToArray();
}
public ModSelectOverlay()
{
FirstWaveColour = OsuColour.FromHex(@"19b0e2");
SecondWaveColour = OsuColour.FromHex(@"2280a2");
ThirdWaveColour = OsuColour.FromHex(@"005774");
FourthWaveColour = OsuColour.FromHex(@"003a4e");
Height = 510;
Content.RelativeSizeAxes = Axes.X;
Content.AutoSizeAxes = Axes.Y;
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = new Color4(36, 50, 68, 255)
},
new Triangles
{
TriangleScale = 5,
RelativeSizeAxes = Axes.Both,
ColourLight = new Color4(53, 66, 82, 255),
ColourDark = new Color4(41, 54, 70, 255),
},
},
},
new FlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Direction = FlowDirections.Vertical,
Spacing = new Vector2(0f, 10f),
Children = new Drawable[]
{
// Header
new Container
{
RelativeSizeAxes = Axes.X,
Height = 82,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(10).Opacity(100),
},
new FlowContainer
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FlowDirections.Vertical,
Width = content_width,
Padding = new MarginPadding
{
Top = 10,
Bottom = 10,
},
Children = new Drawable[]
{
new OsuSpriteText
{
Font = @"Exo2.0-Bold",
Text = @"Gameplay Mods",
TextSize = 22,
Shadow = true,
Margin = new MarginPadding
{
Bottom = 4,
},
},
new OsuSpriteText
{
Text = @"Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.",
TextSize = 18,
Shadow = true,
},
new OsuSpriteText
{
Text = @"Others are just for fun",
TextSize = 18,
Shadow = true,
},
},
},
},
},
// Body
modSectionsContainer = new FlowContainer
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0f, 10f),
Width = content_width,
Children = new Drawable[]
{
difficultyReductionSection = new DifficultyReductionSection
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
difficultyIncreaseSection = new DifficultyIncreaseSection
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
assistedSection = new AssistedSection(PlayMode.Osu)
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
},
},
// Footer
new Container
{
RelativeSizeAxes = Axes.X,
Height = 70,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = new Color4(172, 20, 116, 255),
Alpha = 0.5f,
},
rankedMultiplerContainer = new FlowContainer
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Width = content_width,
Direction = FlowDirections.Horizontal,
Padding = new MarginPadding
{
Top = 20,
Bottom = 20,
},
Children = new Drawable[]
{
rankedLabel = new OsuSpriteText
{
Text = @"Ranked, Score Multiplier: ",
TextSize = 30,
Shadow = true,
},
multiplierLabel = new OsuSpriteText
{
Font = @"Exo2.0-Bold",
Text = @"1.00x",
TextSize = 30,
Shadow = true,
},
},
},
},
},
},
},
};
}
}
}
foreach (ModSection section in sections)
{
foreach (Mod mod in section.SelectedMods)
{
selectedMods.Add(mod);
}
}
SelectedMods.Value = selectedMods.ToArray();
}
public ModSelectOverlay()
{
FirstWaveColour = OsuColour.FromHex(@"19b0e2");
SecondWaveColour = OsuColour.FromHex(@"2280a2");
ThirdWaveColour = OsuColour.FromHex(@"005774");
FourthWaveColour = OsuColour.FromHex(@"003a4e");
Height = 510;
Content.RelativeSizeAxes = Axes.X;
Content.AutoSizeAxes = Axes.Y;
Children = new Drawable[]
{
new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = new Color4(36, 50, 68, 255)
},
new Triangles
{
TriangleScale = 5,
RelativeSizeAxes = Axes.Both,
ColourLight = new Color4(53, 66, 82, 255),
ColourDark = new Color4(41, 54, 70, 255),
},
},
},
new FlowContainer
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Direction = FlowDirections.Vertical,
Spacing = new Vector2(0f, 10f),
Children = new Drawable[]
{
// Header
new Container
{
RelativeSizeAxes = Axes.X,
Height = 82,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = OsuColour.Gray(10).Opacity(100),
},
new FlowContainer
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Direction = FlowDirections.Vertical,
Width = content_width,
Padding = new MarginPadding
{
Top = 10,
Bottom = 10,
},
Children = new Drawable[]
{
new OsuSpriteText
{
Font = @"Exo2.0-Bold",
Text = @"Gameplay Mods",
TextSize = 22,
Shadow = true,
Margin = new MarginPadding
{
Bottom = 4,
},
},
new OsuSpriteText
{
Text = @"Mods provide different ways to enjoy gameplay. Some have an effect on the score you can achieve during ranked play.",
TextSize = 18,
Shadow = true,
},
new OsuSpriteText
{
Text = @"Others are just for fun",
TextSize = 18,
Shadow = true,
},
},
},
},
},
// Body
modSectionsContainer = new FlowContainer
{
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Spacing = new Vector2(0f, 10f),
Width = content_width,
Children = new Drawable[]
{
difficultyReductionSection = new DifficultyReductionSection
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
difficultyIncreaseSection = new DifficultyIncreaseSection
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
assistedSection = new AssistedSection(PlayMode.Osu)
{
RelativeSizeAxes = Axes.X,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Action = modButtonPressed,
},
},
},
// Footer
new Container
{
RelativeSizeAxes = Axes.X,
Height = 70,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = new Color4(172, 20, 116, 255),
Alpha = 0.5f,
},
rankedMultiplerContainer = new FlowContainer
{
Origin = Anchor.BottomCentre,
Anchor = Anchor.BottomCentre,
AutoSizeAxes = Axes.Y,
RelativeSizeAxes = Axes.X,
Width = content_width,
Direction = FlowDirections.Horizontal,
Padding = new MarginPadding
{
Top = 20,
Bottom = 20,
},
Children = new Drawable[]
{
rankedLabel = new OsuSpriteText
{
Text = @"Ranked, Score Multiplier: ",
TextSize = 30,
Shadow = true,
},
multiplierLabel = new OsuSpriteText
{
Font = @"Exo2.0-Bold",
Text = @"1.00x",
TextSize = 30,
Shadow = true,
},
},
},
},
},
},
},
};
}
}
}

View File

@ -1,281 +1,281 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using OpenTK.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Containers;
using osu.Game.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Sprites;
using OpenTK;
using osu.Framework.Graphics.Transformations;
namespace osu.Game.Overlays
{
public abstract class WaveOverlayContainer : OverlayContainer
{
private const float first_wave_position = -130;
private const float second_wave_position = 0;
private const float third_wave_position = 70;
private const float fourth_wave_position = 100;
private const float waves_container_position = -150;
private float[] wavePositions
{
get
{
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 second_wave_duration = 700;
private const float third_wave_duration = 800;
private const float fourth_wave_duration = 900;
private const float container_wait = 200;
private const float waves_container_duration = 400;
private const float content_duration = 700;
private const float content_transition_wait = 100;
internal const float CONTENT_EXIT_DURATION = 600;
private float [] waveDurations
{
get
{
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 second_wave_rotation = -7;
private const float third_wave_rotation = 4;
private const float fourth_wave_rotation = -2;
private Container firstWave, secondWave, thirdWave, fourthWave, wavesContainer;
private readonly Container[] waves;
private readonly Container contentContainer;
protected override Container<Drawable> Content => contentContainer;
private EdgeEffect waveShadow = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(50),
Radius = 20f,
};
private Color4 firstWaveColour;
public Color4 FirstWaveColour
{
get
{
return firstWaveColour;
}
set
{
if (firstWaveColour == value) return;
firstWaveColour = value;
firstWave.Colour = value;
}
}
private Color4 secondWaveColour;
public Color4 SecondWaveColour
{
get
{
return secondWaveColour;
}
set
{
if (secondWaveColour == value) return;
secondWaveColour = value;
secondWave.Colour = value;
}
}
private Color4 thirdWaveColour;
public Color4 ThirdWaveColour
{
get
{
return thirdWaveColour;
}
set
{
if (thirdWaveColour == value) return;
thirdWaveColour = value;
thirdWave.Colour = value;
}
}
private Color4 fourthWaveColour;
public Color4 FourthWaveColour
{
get
{
return fourthWaveColour;
}
set
{
if (fourthWaveColour == value) return;
fourthWaveColour = value;
fourthWave.Colour = value;
}
}
namespace osu.Game.Overlays
{
public abstract class WaveOverlayContainer : OverlayContainer
{
private const float first_wave_position = -130;
private const float second_wave_position = 0;
private const float third_wave_position = 70;
private const float fourth_wave_position = 100;
private const float waves_container_position = -150;
private float[] wavePositions
{
get
{
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 second_wave_duration = 700;
private const float third_wave_duration = 800;
private const float fourth_wave_duration = 900;
private const float container_wait = 200;
private const float waves_container_duration = 400;
private const float content_duration = 700;
private const float content_transition_wait = 100;
internal const float CONTENT_EXIT_DURATION = 600;
private float [] waveDurations
{
get
{
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 second_wave_rotation = -7;
private const float third_wave_rotation = 4;
private const float fourth_wave_rotation = -2;
private Container firstWave, secondWave, thirdWave, fourthWave, wavesContainer;
private readonly Container[] waves;
private readonly Container contentContainer;
protected override Container<Drawable> Content => contentContainer;
private EdgeEffect waveShadow = new EdgeEffect
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(50),
Radius = 20f,
};
private Color4 firstWaveColour;
public Color4 FirstWaveColour
{
get
{
return firstWaveColour;
}
set
{
if (firstWaveColour == value) return;
firstWaveColour = value;
firstWave.Colour = value;
}
}
private Color4 secondWaveColour;
public Color4 SecondWaveColour
{
get
{
return secondWaveColour;
}
set
{
if (secondWaveColour == value) return;
secondWaveColour = value;
secondWave.Colour = value;
}
}
private Color4 thirdWaveColour;
public Color4 ThirdWaveColour
{
get
{
return thirdWaveColour;
}
set
{
if (thirdWaveColour == value) return;
thirdWaveColour = value;
thirdWave.Colour = value;
}
}
private Color4 fourthWaveColour;
public Color4 FourthWaveColour
{
get
{
return fourthWaveColour;
}
set
{
if (fourthWaveColour == value) return;
fourthWaveColour = value;
fourthWave.Colour = value;
}
}
protected override void PopIn()
{
base.Show();
for (int i = 0; i < waves.Length; i++)
{
waves[i].MoveToY(wavePositions[i], waveDurations[i], EasingTypes.OutQuint);
}
DelayReset();
base.Show();
for (int i = 0; i < waves.Length; i++)
{
waves[i].MoveToY(wavePositions[i], waveDurations[i], EasingTypes.OutQuint);
}
DelayReset();
Delay(container_wait);
Schedule(() =>
{
if (State == Visibility.Visible)
{
wavesContainer.MoveToY(waves_container_position, waves_container_duration, EasingTypes.None);
contentContainer.FadeIn(content_duration, EasingTypes.OutQuint);
contentContainer.MoveToY(0, content_duration, EasingTypes.OutQuint);
Delay(content_transition_wait);
Schedule(() => { if (State == Visibility.Visible) TransitionIn(); });
}
Schedule(() =>
{
if (State == Visibility.Visible)
{
wavesContainer.MoveToY(waves_container_position, waves_container_duration, EasingTypes.None);
contentContainer.FadeIn(content_duration, EasingTypes.OutQuint);
contentContainer.MoveToY(0, content_duration, EasingTypes.OutQuint);
Delay(content_transition_wait);
Schedule(() => { if (State == Visibility.Visible) TransitionIn(); });
}
});
}
protected abstract void TransitionIn();
}
protected abstract void TransitionIn();
protected override void PopOut()
{
base.Hide();
{
base.Hide();
contentContainer.FadeOut(CONTENT_EXIT_DURATION, EasingTypes.InSine);
contentContainer.MoveToY(DrawHeight, CONTENT_EXIT_DURATION, EasingTypes.InSine);
TransitionOut();
for (int i = 0; i < waves.Length; i++)
{
waves[i].MoveToY(DrawHeight, second_wave_duration, EasingTypes.InSine);
}
DelayReset();
Delay(container_wait);
Schedule(() =>
{
if (State == Visibility.Hidden)
{
wavesContainer.MoveToY(0, waves_container_duration, EasingTypes.None);
}
});
}
protected abstract void TransitionOut();
public WaveOverlayContainer()
{
Masking = true;
AddInternal(wavesContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Children = new Drawable[]
{
firstWave = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft,
Size = new Vector2(1.5f),
Rotation = first_wave_rotation,
Colour = FirstWaveColour,
Masking = true,
EdgeEffect = waveShadow,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
},
},
},
secondWave = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
Size = new Vector2(1.5f),
Rotation = second_wave_rotation,
Colour = SecondWaveColour,
Masking = true,
EdgeEffect = waveShadow,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
},
},
},
thirdWave = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft,
Size = new Vector2(1.5f),
Rotation = third_wave_rotation,
Colour = ThirdWaveColour,
Masking = true,
EdgeEffect = waveShadow,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
},
},
},
fourthWave = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
Size = new Vector2(1.5f),
Rotation = fourth_wave_rotation,
Colour = FourthWaveColour,
Masking = true,
EdgeEffect = waveShadow,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
},
},
},
},
});
AddInternal(contentContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White.Opacity(50),
},
},
});
waves = new Container[] { firstWave, secondWave, thirdWave, fourthWave };
}
}
}
contentContainer.MoveToY(DrawHeight, CONTENT_EXIT_DURATION, EasingTypes.InSine);
TransitionOut();
for (int i = 0; i < waves.Length; i++)
{
waves[i].MoveToY(DrawHeight, second_wave_duration, EasingTypes.InSine);
}
DelayReset();
Delay(container_wait);
Schedule(() =>
{
if (State == Visibility.Hidden)
{
wavesContainer.MoveToY(0, waves_container_duration, EasingTypes.None);
}
});
}
protected abstract void TransitionOut();
public WaveOverlayContainer()
{
Masking = true;
AddInternal(wavesContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopCentre,
Anchor = Anchor.TopCentre,
Children = new Drawable[]
{
firstWave = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft,
Size = new Vector2(1.5f),
Rotation = first_wave_rotation,
Colour = FirstWaveColour,
Masking = true,
EdgeEffect = waveShadow,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
},
},
},
secondWave = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
Size = new Vector2(1.5f),
Rotation = second_wave_rotation,
Colour = SecondWaveColour,
Masking = true,
EdgeEffect = waveShadow,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
},
},
},
thirdWave = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopLeft,
Anchor = Anchor.TopLeft,
Size = new Vector2(1.5f),
Rotation = third_wave_rotation,
Colour = ThirdWaveColour,
Masking = true,
EdgeEffect = waveShadow,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
},
},
},
fourthWave = new Container
{
RelativeSizeAxes = Axes.Both,
Origin = Anchor.TopRight,
Anchor = Anchor.TopRight,
Size = new Vector2(1.5f),
Rotation = fourth_wave_rotation,
Colour = FourthWaveColour,
Masking = true,
EdgeEffect = waveShadow,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
},
},
},
},
});
AddInternal(contentContainer = new Container
{
RelativeSizeAxes = Axes.Both,
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4.White.Opacity(50),
},
},
});
waves = new Container[] { firstWave, secondWave, thirdWave, fourthWave };
}
}
}