mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Merge https://github.com/ppy/osu into leaderboards
This commit is contained in:
@ -27,7 +27,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
public class ChatOverlay : FocusedOverlayContainer, IOnlineComponent
|
||||
{
|
||||
const float textbox_height = 40;
|
||||
private const float textbox_height = 40;
|
||||
|
||||
private ScheduledDelegate messageRequest;
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
|
@ -1,8 +1,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 osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Dialog;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
|
@ -34,7 +34,7 @@ namespace osu.Game.Overlays
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
fill = new Box()
|
||||
fill = new Box
|
||||
{
|
||||
Origin = Anchor.CentreLeft,
|
||||
Anchor = Anchor.CentreLeft,
|
||||
|
@ -13,11 +13,11 @@ using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
class LoginOverlay : FocusedOverlayContainer
|
||||
internal class LoginOverlay : FocusedOverlayContainer
|
||||
{
|
||||
private LoginOptions optionsSection;
|
||||
|
||||
const float transition_time = 400;
|
||||
private const float transition_time = 400;
|
||||
|
||||
public LoginOverlay()
|
||||
{
|
||||
|
@ -4,17 +4,19 @@
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class AssistedSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => new Key[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M };
|
||||
protected override Key[] ToggleKeys => new[] { Key.Z, Key.X, Key.C, Key.V, Key.B, Key.N, Key.M };
|
||||
public override ModType ModType => ModType.Special;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.Blue;
|
||||
ButtonColour = colours.Blue;
|
||||
SelectedColour = colours.BlueLight;
|
||||
}
|
||||
|
||||
|
@ -4,17 +4,19 @@
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class DifficultyIncreaseSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => new Key[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L };
|
||||
protected override Key[] ToggleKeys => new[] { Key.A, Key.S, Key.D, Key.F, Key.G, Key.H, Key.J, Key.K, Key.L };
|
||||
public override ModType ModType => ModType.DifficultyIncrease;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.Yellow;
|
||||
ButtonColour = colours.Yellow;
|
||||
SelectedColour = colours.YellowLight;
|
||||
}
|
||||
|
||||
|
@ -4,17 +4,19 @@
|
||||
using OpenTK.Input;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Modes;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class DifficultyReductionSection : ModSection
|
||||
{
|
||||
protected override Key[] ToggleKeys => new Key[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P };
|
||||
protected override Key[] ToggleKeys => new[] { Key.Q, Key.W, Key.E, Key.R, Key.T, Key.Y, Key.U, Key.I, Key.O, Key.P };
|
||||
public override ModType ModType => ModType.DifficultyReduction;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Colour = colours.Green;
|
||||
ButtonColour = colours.Green;
|
||||
SelectedColour = colours.GreenLight;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Copyright (c) 2007-2016 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
|
||||
|
||||
using System;
|
||||
@ -9,7 +9,6 @@ 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;
|
||||
@ -23,61 +22,57 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
public class ModButton : FillFlowContainer
|
||||
{
|
||||
private ModIcon[] icons;
|
||||
private ModIcon displayIcon => icons[icons.Length - 1];
|
||||
private ModIcon foregroundIcon { get; set; }
|
||||
private SpriteText text;
|
||||
private Container iconsContainer;
|
||||
private Container<ModIcon> iconsContainer;
|
||||
private SampleChannel sampleOn, sampleOff;
|
||||
|
||||
public Action<Mod> Action; // Passed the selected mod or null if none
|
||||
|
||||
private int _selectedMod = -1;
|
||||
private int selectedMod
|
||||
private int _selectedIndex = -1;
|
||||
private int selectedIndex
|
||||
{
|
||||
get
|
||||
{
|
||||
return _selectedMod;
|
||||
return _selectedIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == _selectedMod) return;
|
||||
_selectedMod = value;
|
||||
if (value == _selectedIndex) return;
|
||||
_selectedIndex = value;
|
||||
|
||||
if (value >= Mods.Length)
|
||||
{
|
||||
_selectedMod = -1;
|
||||
_selectedIndex = -1;
|
||||
}
|
||||
else if (value <= -2)
|
||||
{
|
||||
_selectedMod = Mods.Length - 1;
|
||||
_selectedIndex = Mods.Length - 1;
|
||||
}
|
||||
|
||||
iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic);
|
||||
iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic);
|
||||
for (int i = 0; i < icons.Length; i++)
|
||||
{
|
||||
if (Selected && i == icons.Length - 1) icons[i].Colour = SelectedColour;
|
||||
else icons[i].Colour = Colour;
|
||||
}
|
||||
foregroundIcon.Colour = Selected ? SelectedColour : ButtonColour;
|
||||
|
||||
displaySelectedMod();
|
||||
if (mod != null)
|
||||
displayMod(SelectedMod ?? Mods[0]);
|
||||
}
|
||||
}
|
||||
|
||||
public bool Selected => selectedMod != -1;
|
||||
public bool Selected => selectedIndex != -1;
|
||||
|
||||
private Color4 backgroundColour;
|
||||
public new Color4 Colour
|
||||
private Color4 buttonColour;
|
||||
public Color4 ButtonColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return backgroundColour;
|
||||
return buttonColour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == backgroundColour) return;
|
||||
backgroundColour = value;
|
||||
foreach (ModIcon icon in icons)
|
||||
if (value == buttonColour) return;
|
||||
buttonColour = value;
|
||||
foreach (ModIcon icon in iconsContainer.Children)
|
||||
{
|
||||
icon.Colour = value;
|
||||
}
|
||||
@ -95,7 +90,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
if (value == selectedColour) return;
|
||||
selectedColour = value;
|
||||
if (Selected) icons[0].Colour = value;
|
||||
if (Selected) foregroundIcon.Colour = value;
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,30 +103,32 @@ namespace osu.Game.Overlays.Mods
|
||||
}
|
||||
set
|
||||
{
|
||||
if (mod == value) return;
|
||||
mod = value;
|
||||
|
||||
if (mod is MultiMod)
|
||||
if (mod == null)
|
||||
{
|
||||
mods = ((MultiMod)mod).Mods;
|
||||
Mods = new Mod[0];
|
||||
Alpha = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
mods = new Mod[] { mod };
|
||||
Mods = (mod as MultiMod)?.Mods ?? new[] { mod };
|
||||
Alpha = 1;
|
||||
}
|
||||
|
||||
createIcons();
|
||||
if (mods.Length > 0)
|
||||
if (Mods.Length > 0)
|
||||
{
|
||||
displayMod(mods[0]);
|
||||
displayMod(Mods[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Mod[] mods;
|
||||
public Mod[] Mods => mods; // the mods from Mod, only multiple if Mod is a MultiMod
|
||||
public Mod[] Mods { get; private set; }
|
||||
|
||||
public Mod SelectedMod => Mods.ElementAtOrDefault(selectedMod);
|
||||
// the mods from Mod, only multiple if Mod is a MultiMod
|
||||
|
||||
public Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex);
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(AudioManager audio)
|
||||
@ -142,67 +139,47 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||
{
|
||||
(args.Button == MouseButton.Right ? (Action)SelectPrevious : SelectNext)();
|
||||
switch (args.Button)
|
||||
{
|
||||
case MouseButton.Left:
|
||||
SelectNext();
|
||||
break;
|
||||
case MouseButton.Right:
|
||||
SelectPrevious();
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SelectNext()
|
||||
{
|
||||
selectedMod++;
|
||||
if (selectedMod == -1)
|
||||
{
|
||||
sampleOff.Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
sampleOn.Play();
|
||||
}
|
||||
|
||||
(++selectedIndex == -1 ? sampleOff : sampleOn).Play();
|
||||
Action?.Invoke(SelectedMod);
|
||||
}
|
||||
|
||||
public void SelectPrevious()
|
||||
{
|
||||
selectedMod--;
|
||||
if (selectedMod == -1)
|
||||
{
|
||||
sampleOff.Play();
|
||||
}
|
||||
else
|
||||
{
|
||||
sampleOn.Play();
|
||||
}
|
||||
|
||||
(--selectedIndex == -1 ? sampleOff : sampleOn).Play();
|
||||
Action?.Invoke(SelectedMod);
|
||||
}
|
||||
|
||||
public void Deselect()
|
||||
{
|
||||
selectedMod = -1;
|
||||
selectedIndex = -1;
|
||||
}
|
||||
|
||||
private void displayMod(Mod mod)
|
||||
{
|
||||
displayIcon.Icon = mod.Icon;
|
||||
text.Text = mod.Name.GetDescription();
|
||||
}
|
||||
|
||||
private void displaySelectedMod()
|
||||
{
|
||||
var modIndex = selectedMod;
|
||||
if (modIndex <= -1)
|
||||
{
|
||||
modIndex = 0;
|
||||
}
|
||||
|
||||
displayMod(Mods[modIndex]);
|
||||
foregroundIcon.Icon = mod.Icon;
|
||||
text.Text = mod.Name;
|
||||
}
|
||||
|
||||
private void createIcons()
|
||||
{
|
||||
iconsContainer.Clear();
|
||||
if (Mods.Length > 1)
|
||||
{
|
||||
iconsContainer.Add(icons = new ModIcon[]
|
||||
iconsContainer.Add(new[]
|
||||
{
|
||||
new ModIcon
|
||||
{
|
||||
@ -210,35 +187,43 @@ namespace osu.Game.Overlays.Mods
|
||||
Anchor = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Position = new Vector2(1.5f),
|
||||
Colour = ButtonColour
|
||||
},
|
||||
new ModIcon
|
||||
foregroundIcon = new ModIcon
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Position = new Vector2(-1.5f),
|
||||
Colour = ButtonColour
|
||||
},
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
iconsContainer.Add(icons = new ModIcon[]
|
||||
iconsContainer.Add(foregroundIcon = new ModIcon
|
||||
{
|
||||
new ModIcon
|
||||
{
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
},
|
||||
Origin = Anchor.Centre,
|
||||
Anchor = Anchor.Centre,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Colour = ButtonColour
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
foreach (ModIcon icon in iconsContainer.Children)
|
||||
icon.Colour = ButtonColour;
|
||||
}
|
||||
|
||||
public ModButton(Mod m)
|
||||
{
|
||||
Direction = FillDirection.Vertical;
|
||||
Spacing = new Vector2(0f, -5f);
|
||||
Size = new Vector2(100f);
|
||||
AlwaysPresent = true;
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
@ -249,7 +234,7 @@ namespace osu.Game.Overlays.Mods
|
||||
Anchor = Anchor.TopCentre,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
iconsContainer = new Container
|
||||
iconsContainer = new Container<ModIcon>
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Origin = Anchor.Centre,
|
||||
|
@ -2,8 +2,6 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using OpenTK.Input;
|
||||
@ -16,53 +14,29 @@ using osu.Game.Modes;
|
||||
|
||||
namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
class AlwaysPresentFlowContainer : FillFlowContainer
|
||||
{
|
||||
public override bool IsPresent => true;
|
||||
}
|
||||
|
||||
public class ModSection : Container
|
||||
public abstract class ModSection : Container
|
||||
{
|
||||
private OsuSpriteText headerLabel;
|
||||
|
||||
private AlwaysPresentFlowContainer buttonsContainer;
|
||||
public FillFlowContainer ButtonsContainer => buttonsContainer;
|
||||
public FillFlowContainer<ModButton> ButtonsContainer { get; }
|
||||
|
||||
public Action<Mod> Action;
|
||||
protected virtual Key[] ToggleKeys => new Key[] { };
|
||||
protected abstract Key[] ToggleKeys { get; }
|
||||
public abstract ModType ModType { get; }
|
||||
|
||||
public Mod[] SelectedMods
|
||||
{
|
||||
get
|
||||
{
|
||||
List<Mod> selectedMods = new List<Mod>();
|
||||
|
||||
foreach (ModButton button in Buttons)
|
||||
{
|
||||
Mod selectedMod = button.SelectedMod;
|
||||
if (selectedMod != null)
|
||||
selectedMods.Add(selectedMod);
|
||||
}
|
||||
|
||||
return selectedMods.ToArray();
|
||||
}
|
||||
}
|
||||
|
||||
private string header;
|
||||
public string Header
|
||||
{
|
||||
get
|
||||
{
|
||||
return header;
|
||||
return headerLabel.Text;
|
||||
}
|
||||
set
|
||||
{
|
||||
header = value;
|
||||
headerLabel.Text = value;
|
||||
}
|
||||
}
|
||||
|
||||
private ModButton[] buttons = {};
|
||||
private ModButton[] buttons = { };
|
||||
public ModButton[] Buttons
|
||||
{
|
||||
get
|
||||
@ -76,30 +50,30 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
foreach (ModButton button in value)
|
||||
{
|
||||
button.Colour = Colour;
|
||||
button.ButtonColour = ButtonColour;
|
||||
button.SelectedColour = selectedColour;
|
||||
button.Action = buttonPressed;
|
||||
button.Action = Action;
|
||||
}
|
||||
|
||||
buttonsContainer.Add(value);
|
||||
ButtonsContainer.Children = value;
|
||||
}
|
||||
}
|
||||
|
||||
private Color4 colour = Color4.White;
|
||||
new public Color4 Colour
|
||||
private Color4 buttonsBolour = Color4.White;
|
||||
public Color4 ButtonColour
|
||||
{
|
||||
get
|
||||
{
|
||||
return colour;
|
||||
return buttonsBolour;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == colour) return;
|
||||
colour = value;
|
||||
if (value == buttonsBolour) return;
|
||||
buttonsBolour = value;
|
||||
|
||||
foreach (ModButton button in buttons)
|
||||
{
|
||||
button.Colour = value;
|
||||
button.ButtonColour = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -140,12 +114,7 @@ namespace osu.Game.Overlays.Mods
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonPressed(Mod mod)
|
||||
{
|
||||
Action?.Invoke(mod);
|
||||
}
|
||||
|
||||
public ModSection()
|
||||
protected ModSection()
|
||||
{
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
||||
@ -156,10 +125,9 @@ namespace osu.Game.Overlays.Mods
|
||||
Origin = Anchor.TopLeft,
|
||||
Anchor = Anchor.TopLeft,
|
||||
Position = new Vector2(0f, 0f),
|
||||
Font = @"Exo2.0-Bold",
|
||||
Text = Header,
|
||||
Font = @"Exo2.0-Bold"
|
||||
},
|
||||
buttonsContainer = new AlwaysPresentFlowContainer
|
||||
ButtonsContainer = new FillFlowContainer<ModButton>
|
||||
{
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Origin = Anchor.BottomLeft,
|
||||
@ -169,6 +137,7 @@ namespace osu.Game.Overlays.Mods
|
||||
{
|
||||
Top = 6,
|
||||
},
|
||||
AlwaysPresent = true
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@ -2,11 +2,12 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
@ -33,44 +34,19 @@ namespace osu.Game.Overlays.Mods
|
||||
|
||||
private FillFlowContainer<ModSection> modSectionsContainer;
|
||||
|
||||
public readonly Bindable<Mod[]> SelectedMods = new Bindable<Mod[]>();
|
||||
public readonly Bindable<IEnumerable<Mod>> SelectedMods = new Bindable<IEnumerable<Mod>>();
|
||||
|
||||
public readonly Bindable<PlayMode> PlayMode = new Bindable<PlayMode>();
|
||||
|
||||
private void modeChanged(object sender, EventArgs eventArgs)
|
||||
{
|
||||
var ruleset = Ruleset.GetRuleset(PlayMode);
|
||||
|
||||
modSectionsContainer.Children = new ModSection[]
|
||||
{
|
||||
new DifficultyReductionSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.DifficultyReduction).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
new DifficultyIncreaseSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.DifficultyIncrease).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
new AssistedSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
Buttons = ruleset.GetModsFor(ModType.Special).Select(m => new ModButton(m)).ToArray(),
|
||||
},
|
||||
};
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
section.Buttons = ruleset.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray();
|
||||
refreshSelectedMods();
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader(permitNulls:true)]
|
||||
[BackgroundDependencyLoader(permitNulls: true)]
|
||||
private void load(OsuColour colours, OsuGame osu)
|
||||
{
|
||||
lowMultiplierColour = colours.Red;
|
||||
@ -79,7 +55,7 @@ namespace osu.Game.Overlays.Mods
|
||||
if (osu != null)
|
||||
PlayMode.BindTo(osu.PlayMode);
|
||||
PlayMode.ValueChanged += modeChanged;
|
||||
PlayMode.TriggerChange();
|
||||
modeChanged(null, null);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
@ -115,43 +91,33 @@ namespace osu.Game.Overlays.Mods
|
||||
public void DeselectAll()
|
||||
{
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
{
|
||||
foreach (ModButton button in section.Buttons)
|
||||
{
|
||||
button.Deselect();
|
||||
}
|
||||
}
|
||||
section.DeselectAll();
|
||||
}
|
||||
|
||||
public void DeselectMod(Modes.Mods modName)
|
||||
public void DeselectTypes(Type[] modTypes)
|
||||
{
|
||||
if (modTypes.Length == 0) return;
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
{
|
||||
foreach (ModButton button in section.Buttons)
|
||||
{
|
||||
foreach (Mod mod in button.Mods)
|
||||
{
|
||||
if (mod.Name == modName)
|
||||
{
|
||||
Mod selected = button.SelectedMod;
|
||||
if (selected == null) continue;
|
||||
foreach (Type type in modTypes)
|
||||
if (type.IsInstanceOfType(selected))
|
||||
button.Deselect();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void modButtonPressed(Mod selectedMod)
|
||||
{
|
||||
if (selectedMod != null)
|
||||
{
|
||||
foreach (Modes.Mods disableMod in selectedMod.DisablesMods)
|
||||
{
|
||||
DeselectMod(disableMod);
|
||||
}
|
||||
}
|
||||
|
||||
DeselectTypes(selectedMod.IncompatibleMods);
|
||||
refreshSelectedMods();
|
||||
}
|
||||
|
||||
private void refreshSelectedMods()
|
||||
{
|
||||
SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.Buttons.Select(x => x.SelectedMod).Where(x => x != null)).ToArray();
|
||||
|
||||
double multiplier = 1.0;
|
||||
bool ranked = true;
|
||||
@ -159,46 +125,23 @@ namespace osu.Game.Overlays.Mods
|
||||
foreach (Mod mod in SelectedMods.Value)
|
||||
{
|
||||
multiplier *= mod.ScoreMultiplier;
|
||||
|
||||
if (ranked)
|
||||
ranked = mod.Ranked;
|
||||
ranked &= mod.Ranked;
|
||||
}
|
||||
|
||||
// 1.00x
|
||||
// 1.05x
|
||||
// 1.20x
|
||||
|
||||
multiplierLabel.Text = string.Format("{0:N2}x", multiplier);
|
||||
multiplierLabel.Text = $"{multiplier:N2}x";
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshSelectedMods()
|
||||
{
|
||||
List<Mod> selectedMods = new List<Mod>();
|
||||
|
||||
foreach (ModSection section in modSectionsContainer.Children)
|
||||
{
|
||||
foreach (Mod mod in section.SelectedMods)
|
||||
{
|
||||
selectedMods.Add(mod);
|
||||
}
|
||||
}
|
||||
|
||||
SelectedMods.Value = selectedMods.ToArray();
|
||||
}
|
||||
|
||||
public ModSelectOverlay()
|
||||
@ -309,6 +252,30 @@ namespace osu.Game.Overlays.Mods
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Spacing = new Vector2(0f, 10f),
|
||||
Width = content_width,
|
||||
Children = new ModSection[]
|
||||
{
|
||||
new DifficultyReductionSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
},
|
||||
new DifficultyIncreaseSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
},
|
||||
new AssistedSection
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Origin = Anchor.TopCentre,
|
||||
Anchor = Anchor.TopCentre,
|
||||
Action = modButtonPressed,
|
||||
},
|
||||
}
|
||||
},
|
||||
// Footer
|
||||
new Container
|
||||
|
@ -3,11 +3,11 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
@ -23,6 +23,7 @@ using osu.Game.Database;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
@ -30,7 +31,7 @@ namespace osu.Game.Overlays
|
||||
{
|
||||
private MusicControllerBackground backgroundSprite;
|
||||
private DragBar progress;
|
||||
private TextAwesome playButton, listButton;
|
||||
private TextAwesome playButton;
|
||||
private SpriteText title, artist;
|
||||
|
||||
private List<BeatmapSetInfo> playList;
|
||||
@ -59,7 +60,9 @@ namespace osu.Game.Overlays
|
||||
|
||||
protected override bool OnDrag(InputState state)
|
||||
{
|
||||
Vector2 change = (state.Mouse.Position - state.Mouse.PositionMouseDown.Value);
|
||||
Trace.Assert(state.Mouse.PositionMouseDown != null, "state.Mouse.PositionMouseDown != null");
|
||||
|
||||
Vector2 change = state.Mouse.Position - state.Mouse.PositionMouseDown.Value;
|
||||
|
||||
// Diminish the drag distance as we go further to simulate "rubber band" feeling.
|
||||
change *= (float)Math.Pow(change.Length, 0.7f) / change.Length;
|
||||
@ -187,7 +190,7 @@ namespace osu.Game.Overlays
|
||||
Position = new Vector2(20, -30),
|
||||
Children = new Drawable[]
|
||||
{
|
||||
listButton = new TextAwesome
|
||||
new TextAwesome
|
||||
{
|
||||
TextSize = 15,
|
||||
Icon = FontAwesome.fa_bars,
|
||||
@ -246,14 +249,14 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
}
|
||||
|
||||
void preferUnicode_changed(object sender, EventArgs e)
|
||||
private void preferUnicode_changed(object sender, EventArgs e)
|
||||
{
|
||||
updateDisplay(current, TransformDirection.None);
|
||||
}
|
||||
|
||||
private void workingChanged(object sender = null, EventArgs e = null)
|
||||
{
|
||||
progress.IsEnabled = (beatmapSource.Value != null);
|
||||
progress.IsEnabled = beatmapSource.Value != null;
|
||||
if (beatmapSource.Value == current) return;
|
||||
bool audioEquals = current?.BeatmapInfo?.AudioEquals(beatmapSource?.Value?.BeatmapInfo) ?? false;
|
||||
current = beatmapSource.Value;
|
||||
@ -323,7 +326,7 @@ namespace osu.Game.Overlays
|
||||
updateDisplay(current, isNext ? TransformDirection.Next : TransformDirection.Prev);
|
||||
}
|
||||
|
||||
Action pendingBeatmapSwitch;
|
||||
private Action pendingBeatmapSwitch;
|
||||
|
||||
private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction)
|
||||
{
|
||||
@ -384,7 +387,7 @@ namespace osu.Game.Overlays
|
||||
base.Dispose(isDisposing);
|
||||
}
|
||||
|
||||
const float transition_length = 800;
|
||||
private const float transition_length = 800;
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
|
@ -9,7 +9,6 @@ using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Overlays.Notifications;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
@ -70,7 +69,7 @@ namespace osu.Game.Overlays
|
||||
};
|
||||
}
|
||||
|
||||
int runningDepth = 0;
|
||||
private int runningDepth;
|
||||
|
||||
public void Post(Notification notification)
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -42,18 +43,9 @@ namespace osu.Game.Overlays.Notifications
|
||||
|
||||
protected Container NotificationContent;
|
||||
|
||||
private bool read;
|
||||
public virtual bool Read { get; set; }
|
||||
|
||||
public virtual bool Read
|
||||
{
|
||||
get { return read; }
|
||||
set
|
||||
{
|
||||
read = value;
|
||||
}
|
||||
}
|
||||
|
||||
public Notification()
|
||||
protected Notification()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
@ -161,7 +153,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
Expire();
|
||||
}
|
||||
|
||||
class CloseButton : ClickableContainer
|
||||
private class CloseButton : ClickableContainer
|
||||
{
|
||||
private Color4 hoverColour;
|
||||
|
||||
@ -175,6 +167,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
new TextAwesome
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = FontAwesome.fa_times_circle,
|
||||
}
|
||||
};
|
||||
|
@ -133,7 +133,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
countText.Text = notifications.Children.Count(c => c.Alpha > 0.99f).ToString();
|
||||
}
|
||||
|
||||
class ClearAllButton : ClickableContainer
|
||||
private class ClearAllButton : ClickableContainer
|
||||
{
|
||||
private OsuSpriteText text;
|
||||
|
||||
|
@ -10,11 +10,8 @@ namespace osu.Game.Overlays.Notifications
|
||||
{
|
||||
public class ProgressCompletionNotification : SimpleNotification
|
||||
{
|
||||
private ProgressNotification progressNotification;
|
||||
|
||||
public ProgressCompletionNotification(ProgressNotification progressNotification)
|
||||
public ProgressCompletionNotification()
|
||||
{
|
||||
this.progressNotification = progressNotification;
|
||||
Icon = FontAwesome.fa_check;
|
||||
}
|
||||
|
||||
|
@ -90,7 +90,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
|
||||
private ProgressNotificationState state;
|
||||
|
||||
protected virtual Notification CreateCompletionNotification() => new ProgressCompletionNotification(this)
|
||||
protected virtual Notification CreateCompletionNotification() => new ProgressCompletionNotification()
|
||||
{
|
||||
Activated = CompletionClickAction,
|
||||
Text = $"Task \"{Text}\" has completed!"
|
||||
@ -168,7 +168,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
/// </summary>
|
||||
public Func<bool> CompletionClickAction;
|
||||
|
||||
class ProgressBar : Container
|
||||
private class ProgressBar : Container
|
||||
{
|
||||
private Box box;
|
||||
|
||||
|
@ -51,6 +51,7 @@ namespace osu.Game.Overlays.Notifications
|
||||
iconDrawable = new TextAwesome
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
Icon = icon,
|
||||
}
|
||||
});
|
||||
@ -80,10 +81,8 @@ namespace osu.Game.Overlays.Notifications
|
||||
|
||||
set
|
||||
{
|
||||
if (base.Read = value)
|
||||
Light.FadeOut(100);
|
||||
else
|
||||
Light.FadeIn(100);
|
||||
base.Read = value;
|
||||
Light.FadeTo(value ? 1 : 0, 100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -39,19 +39,19 @@ namespace osu.Game.Overlays.Options
|
||||
bindable.ValueChanged += bindable_ValueChanged;
|
||||
bindable_ValueChanged(null, null);
|
||||
|
||||
if (bindable?.Disabled ?? true)
|
||||
if (bindable.Disabled)
|
||||
Alpha = 0.3f;
|
||||
}
|
||||
}
|
||||
|
||||
private Bindable<T> bindable;
|
||||
|
||||
void bindable_ValueChanged(object sender, EventArgs e)
|
||||
private void bindable_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
dropdown.SelectedValue = bindable.Value;
|
||||
}
|
||||
|
||||
void dropdown_ValueChanged(object sender, EventArgs e)
|
||||
private void dropdown_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
bindable.Value = dropdown.SelectedValue;
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ using osu.Game.Graphics.Sprites;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
{
|
||||
class OptionLabel : OsuSpriteText
|
||||
internal class OptionLabel : OsuSpriteText
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colour)
|
||||
|
68
osu.Game/Overlays/Options/OptionsFooter.cs
Normal file
68
osu.Game/Overlays/Options/OptionsFooter.cs
Normal file
@ -0,0 +1,68 @@
|
||||
// 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 osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Modes;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public class OptionsFooter : FillFlowContainer
|
||||
{
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuGameBase game, OsuColour colours)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
Direction = FillDirection.Vertical;
|
||||
Padding = new MarginPadding { Top = 20, Bottom = 30 };
|
||||
|
||||
var modes = new List<Drawable>();
|
||||
|
||||
foreach (PlayMode m in Enum.GetValues(typeof(PlayMode)))
|
||||
modes.Add(new TextAwesome
|
||||
{
|
||||
Icon = Ruleset.GetRuleset(m).Icon,
|
||||
Colour = Color4.Gray,
|
||||
});
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new FillFlowContainer
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Direction = FillDirection.Full,
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = modes,
|
||||
Spacing = new Vector2(5),
|
||||
Padding = new MarginPadding { Bottom = 10 },
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
Text = game.Name,
|
||||
TextSize = 18,
|
||||
Font = @"Exo2.0-Bold",
|
||||
},
|
||||
new OsuSpriteText
|
||||
{
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
TextSize = 14,
|
||||
Text = game.Version,
|
||||
Colour = game.IsDebug ? colours.Red : Color4.White,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -23,7 +23,7 @@ namespace osu.Game.Overlays.Options
|
||||
|
||||
private SpriteText headerLabel;
|
||||
|
||||
public OptionsSection()
|
||||
protected OptionsSection()
|
||||
{
|
||||
Margin = new MarginPadding { Top = 20 };
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
@ -11,12 +11,13 @@ namespace osu.Game.Overlays.Options
|
||||
{
|
||||
public abstract class OptionsSubsection : FillFlowContainer
|
||||
{
|
||||
private Container<Drawable> content;
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
private Container<Drawable> content;
|
||||
|
||||
protected abstract string Header { get; }
|
||||
|
||||
public OptionsSubsection()
|
||||
protected OptionsSubsection()
|
||||
{
|
||||
RelativeSizeAxes = Axes.X;
|
||||
AutoSizeAxes = Axes.Y;
|
||||
|
@ -32,12 +32,11 @@ namespace osu.Game.Overlays.Options.Sections.Audio
|
||||
|
||||
private void updateItems()
|
||||
{
|
||||
var deviceItems = new List<KeyValuePair<string, string>>();
|
||||
deviceItems.Add(new KeyValuePair<string, string>("Default", string.Empty));
|
||||
var deviceItems = new List<KeyValuePair<string, string>> { new KeyValuePair<string, string>("Default", string.Empty) };
|
||||
deviceItems.AddRange(audio.AudioDeviceNames.Select(d => new KeyValuePair<string, string>(d, d)));
|
||||
|
||||
var preferredDeviceName = audio.AudioDevice.Value;
|
||||
if (!deviceItems.Any(kv => kv.Value == preferredDeviceName))
|
||||
if (deviceItems.All(kv => kv.Value != preferredDeviceName))
|
||||
deviceItems.Add(new KeyValuePair<string, string>(preferredDeviceName, preferredDeviceName));
|
||||
|
||||
dropdown.Items = deviceItems;
|
||||
@ -51,7 +50,7 @@ namespace osu.Game.Overlays.Options.Sections.Audio
|
||||
|
||||
Children = new Drawable[]
|
||||
{
|
||||
dropdown = new OptionDropDown<string>()
|
||||
dropdown = new OptionDropDown<string>
|
||||
{
|
||||
Bindable = audio.AudioDevice
|
||||
},
|
||||
|
@ -6,7 +6,6 @@ using System.Runtime;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections.Debug
|
||||
|
28
osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs
Normal file
28
osu.Game/Overlays/Options/Sections/Debug/GeneralOptions.cs
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections.Debug
|
||||
{
|
||||
public class GeneralOptions : OptionsSubsection
|
||||
{
|
||||
protected override string Header => "General";
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(FrameworkDebugConfigManager config)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new OsuCheckbox
|
||||
{
|
||||
LabelText = "Bypass caching",
|
||||
Bindable = config.GetBindable<bool>(FrameworkDebugConfig.BypassCaching)
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@ -16,6 +16,7 @@ namespace osu.Game.Overlays.Options.Sections
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new GeneralOptions(),
|
||||
new GCOptions(),
|
||||
};
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Options.Sections.General
|
||||
}
|
||||
}
|
||||
|
||||
class LoginForm : FillFlowContainer
|
||||
private class LoginForm : FillFlowContainer
|
||||
{
|
||||
private TextBox username;
|
||||
private TextBox password;
|
||||
@ -118,7 +118,7 @@ namespace osu.Game.Overlays.Options.Sections.General
|
||||
PlaceholderText = "Password",
|
||||
RelativeSizeAxes = Axes.X,
|
||||
TabbableContentContainer = this,
|
||||
OnCommit = (TextBox sender, bool newText) => performLogin()
|
||||
OnCommit = (sender, newText) => performLogin()
|
||||
},
|
||||
new OsuCheckbox
|
||||
{
|
||||
|
@ -5,7 +5,6 @@ using osu.Framework.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections
|
||||
{
|
||||
@ -39,20 +38,6 @@ namespace osu.Game.Overlays.Options.Sections
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Text = "Run osu! updater",
|
||||
},
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Children = new[]
|
||||
{
|
||||
new OptionLabel
|
||||
{
|
||||
Text = "osu!lazer",
|
||||
Anchor = Anchor.TopCentre,
|
||||
Origin = Anchor.TopCentre,
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
|
||||
namespace osu.Game.Overlays.Options.Sections
|
||||
{
|
||||
|
@ -100,7 +100,8 @@ namespace osu.Game.Overlays
|
||||
RelativeSizeAxes = Axes.X,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = sections,
|
||||
}
|
||||
},
|
||||
new OptionsFooter()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -146,11 +147,8 @@ namespace osu.Game.Overlays
|
||||
|
||||
var previous = sidebarButtons.SingleOrDefault(sb => sb.Selected);
|
||||
var next = sidebarButtons.SingleOrDefault(sb => sb.Section == bestCandidate);
|
||||
if (next != null)
|
||||
{
|
||||
previous.Selected = false;
|
||||
next.Selected = true;
|
||||
}
|
||||
if (previous != null) previous.Selected = false;
|
||||
if (next != null) next.Selected = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -29,7 +30,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
protected override bool BlockPassThroughInput => false;
|
||||
|
||||
private const int transition_time = 500;
|
||||
private const double transition_time = 500;
|
||||
|
||||
private const float alpha_hovering = 0.8f;
|
||||
private const float alpha_normal = 0.6f;
|
||||
@ -49,13 +50,13 @@ namespace osu.Game.Overlays.Toolbar
|
||||
Children = new Drawable[]
|
||||
{
|
||||
new ToolbarSettingsButton(),
|
||||
new ToolbarHomeButton()
|
||||
new ToolbarHomeButton
|
||||
{
|
||||
Action = () => OnHome?.Invoke()
|
||||
},
|
||||
modeSelector = new ToolbarModeSelector
|
||||
{
|
||||
OnPlayModeChange = (PlayMode mode) =>
|
||||
OnPlayModeChange = mode =>
|
||||
{
|
||||
OnPlayModeChange?.Invoke(mode);
|
||||
}
|
||||
@ -144,7 +145,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
FadeOut(transition_time);
|
||||
}
|
||||
|
||||
class PassThroughFlowContainer : FillFlowContainer
|
||||
private class PassThroughFlowContainer : FillFlowContainer
|
||||
{
|
||||
//needed to get input to the login overlay.
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
|
@ -5,6 +5,7 @@ using System;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
|
@ -5,7 +5,7 @@ using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
class ToolbarHomeButton : ToolbarButton
|
||||
internal class ToolbarHomeButton : ToolbarButton
|
||||
{
|
||||
public ToolbarHomeButton()
|
||||
{
|
||||
|
@ -1,7 +1,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 osu.Framework.Extensions;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Modes;
|
||||
using OpenTK.Graphics;
|
||||
@ -17,8 +16,8 @@ namespace osu.Game.Overlays.Toolbar
|
||||
set
|
||||
{
|
||||
mode = value;
|
||||
TooltipMain = mode.GetDescription();
|
||||
TooltipSub = $"Play some {mode.GetDescription()}";
|
||||
TooltipMain = Ruleset.GetRuleset(mode).Description;
|
||||
TooltipSub = $"Play some {Ruleset.GetRuleset(mode).Description}";
|
||||
Icon = Ruleset.GetRuleset(mode).Icon;
|
||||
}
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
class ToolbarModeSelector : Container
|
||||
internal class ToolbarModeSelector : Container
|
||||
{
|
||||
const float padding = 10;
|
||||
private const float padding = 10;
|
||||
|
||||
private FillFlowContainer modeButtons;
|
||||
private Drawable modeButtonLine;
|
||||
@ -29,7 +29,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
RelativeSizeAxes = Axes.Y;
|
||||
|
||||
Children = new Drawable[]
|
||||
Children = new[]
|
||||
{
|
||||
new OpaqueBackground(),
|
||||
modeButtons = new FillFlowContainer
|
||||
@ -64,11 +64,8 @@ namespace osu.Game.Overlays.Toolbar
|
||||
}
|
||||
};
|
||||
|
||||
int amountButtons = 0;
|
||||
foreach (PlayMode m in Enum.GetValues(typeof(PlayMode)))
|
||||
foreach (PlayMode m in Ruleset.PlayModes)
|
||||
{
|
||||
++amountButtons;
|
||||
|
||||
var localMode = m;
|
||||
modeButtons.Add(new ToolbarModeButton
|
||||
{
|
||||
|
@ -6,7 +6,7 @@ using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
class ToolbarMusicButton : ToolbarOverlayToggleButton
|
||||
internal class ToolbarMusicButton : ToolbarOverlayToggleButton
|
||||
{
|
||||
public ToolbarMusicButton()
|
||||
{
|
||||
|
@ -7,7 +7,7 @@ using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
class ToolbarNotificationButton : ToolbarOverlayToggleButton
|
||||
internal class ToolbarNotificationButton : ToolbarOverlayToggleButton
|
||||
{
|
||||
protected override Anchor TooltipAnchor => Anchor.TopRight;
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -8,7 +9,7 @@ using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
class ToolbarOverlayToggleButton : ToolbarButton
|
||||
internal class ToolbarOverlayToggleButton : ToolbarButton
|
||||
{
|
||||
private Box stateBackground;
|
||||
|
||||
|
@ -6,7 +6,7 @@ using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
class ToolbarSettingsButton : ToolbarOverlayToggleButton
|
||||
internal class ToolbarSettingsButton : ToolbarOverlayToggleButton
|
||||
{
|
||||
public ToolbarSettingsButton()
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
class ToolbarUserArea : Container
|
||||
internal class ToolbarUserArea : Container
|
||||
{
|
||||
public LoginOverlay LoginOverlay;
|
||||
private ToolbarUserButton button;
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
using System.Diagnostics;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
@ -10,11 +11,10 @@ using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Online.API;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Game.Graphics;
|
||||
|
||||
namespace osu.Game.Overlays.Toolbar
|
||||
{
|
||||
class ToolbarUserButton : ToolbarButton, IOnlineComponent
|
||||
internal class ToolbarUserButton : ToolbarButton, IOnlineComponent
|
||||
{
|
||||
private Avatar avatar;
|
||||
|
||||
@ -94,11 +94,7 @@ namespace osu.Game.Overlays.Toolbar
|
||||
|
||||
userId = value;
|
||||
|
||||
Sprite newSprite;
|
||||
if (userId > 1)
|
||||
newSprite = new OnlineSprite($@"https://a.ppy.sh/{userId}");
|
||||
else
|
||||
newSprite = new Sprite { Texture = guestTexture };
|
||||
var newSprite = userId > 1 ? new OnlineSprite($@"https://a.ppy.sh/{userId}") : new Sprite { Texture = guestTexture };
|
||||
|
||||
newSprite.FillMode = FillMode.Fit;
|
||||
|
||||
|
@ -3,13 +3,11 @@
|
||||
|
||||
using osu.Framework;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using OpenTK;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using osu.Framework.Graphics.Primitives;
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
@ -136,19 +134,23 @@ namespace osu.Game.Overlays
|
||||
foreach (var w in wavesContainer.Children)
|
||||
w.State = Visibility.Visible;
|
||||
|
||||
contentContainer.FadeIn(APPEAR_DURATION, EasingTypes.OutQuint);
|
||||
FadeIn(100, EasingTypes.OutQuint);
|
||||
contentContainer.MoveToY(0, APPEAR_DURATION, EasingTypes.OutQuint);
|
||||
|
||||
FadeIn(100, EasingTypes.OutQuint);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
base.PopOut();
|
||||
|
||||
contentContainer.FadeOut(DISAPPEAR_DURATION, EasingTypes.In);
|
||||
FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint);
|
||||
contentContainer.MoveToY(DrawHeight * 2f, DISAPPEAR_DURATION, EasingTypes.In);
|
||||
|
||||
foreach (var w in wavesContainer.Children)
|
||||
w.State = Visibility.Hidden;
|
||||
|
||||
FadeOut(DISAPPEAR_DURATION, EasingTypes.InQuint);
|
||||
}
|
||||
|
||||
protected override void UpdateAfterChildren()
|
||||
|
Reference in New Issue
Block a user