mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 14:02:55 +08:00
commit
82a8ce2468
@ -6,16 +6,21 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Game.Overlays.Mods;
|
using osu.Game.Overlays.Mods;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Database;
|
using osu.Game.Database;
|
||||||
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
internal class TestCaseModSelectOverlay : TestCase
|
internal class TestCaseMods : TestCase
|
||||||
{
|
{
|
||||||
public override string Description => @"Tests the mod select overlay";
|
public override string Description => @"Mod select overlay and in-game display";
|
||||||
|
|
||||||
private ModSelectOverlay modSelect;
|
private ModSelectOverlay modSelect;
|
||||||
|
private ModDisplay modDisplay;
|
||||||
|
|
||||||
private RulesetDatabase rulesets;
|
private RulesetDatabase rulesets;
|
||||||
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(RulesetDatabase rulesets)
|
private void load(RulesetDatabase rulesets)
|
||||||
{
|
{
|
||||||
@ -33,6 +38,16 @@ namespace osu.Desktop.VisualTests.Tests
|
|||||||
Anchor = Anchor.BottomCentre,
|
Anchor = Anchor.BottomCentre,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Add(modDisplay = new ModDisplay
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Position = new Vector2(0, 25),
|
||||||
|
});
|
||||||
|
|
||||||
|
modDisplay.Current.BindTo(modSelect.SelectedMods);
|
||||||
|
|
||||||
AddStep("Toggle", modSelect.ToggleVisibility);
|
AddStep("Toggle", modSelect.ToggleVisibility);
|
||||||
|
|
||||||
foreach (var ruleset in rulesets.AllRulesets)
|
foreach (var ruleset in rulesets.AllRulesets)
|
@ -8,7 +8,7 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.UI;
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
|
||||||
namespace osu.Desktop.VisualTests.Tests
|
namespace osu.Desktop.VisualTests.Tests
|
||||||
{
|
{
|
||||||
|
@ -212,7 +212,7 @@
|
|||||||
<Compile Include="Platform\TestStorage.cs" />
|
<Compile Include="Platform\TestStorage.cs" />
|
||||||
<Compile Include="Tests\TestCaseOptions.cs" />
|
<Compile Include="Tests\TestCaseOptions.cs" />
|
||||||
<Compile Include="Tests\TestCaseSongProgress.cs" />
|
<Compile Include="Tests\TestCaseSongProgress.cs" />
|
||||||
<Compile Include="Tests\TestCaseModSelectOverlay.cs" />
|
<Compile Include="Tests\TestCaseMods.cs" />
|
||||||
<Compile Include="Tests\TestCaseDialogOverlay.cs" />
|
<Compile Include="Tests\TestCaseDialogOverlay.cs" />
|
||||||
<Compile Include="Tests\TestCaseBeatmapOptionsOverlay.cs" />
|
<Compile Include="Tests\TestCaseBeatmapOptionsOverlay.cs" />
|
||||||
<Compile Include="Tests\TestCaseLeaderboard.cs" />
|
<Compile Include="Tests\TestCaseLeaderboard.cs" />
|
||||||
|
@ -64,6 +64,7 @@ namespace osu.Game.Rulesets.Mania.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "FadeIn";
|
public override string Name => "FadeIn";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModFlashlight) };
|
||||||
|
@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
ButtonColour = colours.Blue;
|
|
||||||
SelectedColour = colours.BlueLight;
|
SelectedColour = colours.BlueLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
ButtonColour = colours.Yellow;
|
|
||||||
SelectedColour = colours.YellowLight;
|
SelectedColour = colours.YellowLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
||||||
ButtonColour = colours.Green;
|
|
||||||
SelectedColour = colours.GreenLight;
|
SelectedColour = colours.GreenLight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,7 +19,11 @@ using System.Linq;
|
|||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
public class ModButton : FillFlowContainer
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a clickable button which can cycle through one of more mods.
|
||||||
|
/// </summary>
|
||||||
|
public class ModButton : ModButtonEmpty
|
||||||
{
|
{
|
||||||
private ModIcon foregroundIcon { get; set; }
|
private ModIcon foregroundIcon { get; set; }
|
||||||
private readonly SpriteText text;
|
private readonly SpriteText text;
|
||||||
@ -51,7 +55,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic);
|
iconsContainer.RotateTo(Selected ? 5f : 0f, 300, EasingTypes.OutElastic);
|
||||||
iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic);
|
iconsContainer.ScaleTo(Selected ? 1.1f : 1f, 300, EasingTypes.OutElastic);
|
||||||
foregroundIcon.Colour = Selected ? SelectedColour : ButtonColour;
|
foregroundIcon.Highlighted = Selected;
|
||||||
|
|
||||||
if (mod != null)
|
if (mod != null)
|
||||||
displayMod(SelectedMod ?? Mods[0]);
|
displayMod(SelectedMod ?? Mods[0]);
|
||||||
@ -60,23 +64,6 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
public bool Selected => selectedIndex != -1;
|
public bool Selected => selectedIndex != -1;
|
||||||
|
|
||||||
private Color4 buttonColour;
|
|
||||||
public Color4 ButtonColour
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return buttonColour;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == buttonColour) return;
|
|
||||||
buttonColour = value;
|
|
||||||
foreach (ModIcon icon in iconsContainer.Children)
|
|
||||||
{
|
|
||||||
icon.Colour = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color4 selectedColour;
|
private Color4 selectedColour;
|
||||||
public Color4 SelectedColour
|
public Color4 SelectedColour
|
||||||
@ -127,7 +114,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
// the mods from Mod, only multiple if Mod is a MultiMod
|
// the mods from Mod, only multiple if Mod is a MultiMod
|
||||||
|
|
||||||
public Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex);
|
public override Mod SelectedMod => Mods.ElementAtOrDefault(selectedIndex);
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio)
|
private void load(AudioManager audio)
|
||||||
@ -180,50 +167,35 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
iconsContainer.Add(new[]
|
iconsContainer.Add(new[]
|
||||||
{
|
{
|
||||||
new ModIcon
|
new ModIcon(Mods[0])
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Position = new Vector2(1.5f),
|
Position = new Vector2(1.5f),
|
||||||
Colour = ButtonColour
|
|
||||||
},
|
},
|
||||||
foregroundIcon = new ModIcon
|
foregroundIcon = new ModIcon(Mods[0])
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Position = new Vector2(-1.5f),
|
Position = new Vector2(-1.5f),
|
||||||
Colour = ButtonColour
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
iconsContainer.Add(foregroundIcon = new ModIcon
|
iconsContainer.Add(foregroundIcon = new ModIcon(Mod)
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Colour = ButtonColour
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
public ModButton(Mod mod)
|
||||||
{
|
{
|
||||||
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[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Container
|
new Container
|
||||||
@ -243,13 +215,14 @@ namespace osu.Game.Overlays.Mods
|
|||||||
},
|
},
|
||||||
text = new OsuSpriteText
|
text = new OsuSpriteText
|
||||||
{
|
{
|
||||||
|
Y = 75,
|
||||||
Origin = Anchor.TopCentre,
|
Origin = Anchor.TopCentre,
|
||||||
Anchor = Anchor.TopCentre,
|
Anchor = Anchor.TopCentre,
|
||||||
TextSize = 18,
|
TextSize = 18,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Mod = m;
|
Mod = mod;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
23
osu.Game/Overlays/Mods/ModButtonEmpty.cs
Normal file
23
osu.Game/Overlays/Mods/ModButtonEmpty.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
// 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;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
|
namespace osu.Game.Overlays.Mods
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// A mod button used exclusively for providing an empty space the size of a mod button.
|
||||||
|
/// </summary>
|
||||||
|
public class ModButtonEmpty : Container
|
||||||
|
{
|
||||||
|
public virtual Mod SelectedMod => null;
|
||||||
|
|
||||||
|
public ModButtonEmpty()
|
||||||
|
{
|
||||||
|
Size = new Vector2(100f);
|
||||||
|
AlwaysPresent = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,6 +11,8 @@ using osu.Framework.Input;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Mods
|
namespace osu.Game.Overlays.Mods
|
||||||
{
|
{
|
||||||
@ -18,7 +20,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
private readonly OsuSpriteText headerLabel;
|
private readonly OsuSpriteText headerLabel;
|
||||||
|
|
||||||
public FillFlowContainer<ModButton> ButtonsContainer { get; }
|
public FillFlowContainer<ModButtonEmpty> ButtonsContainer { get; }
|
||||||
|
|
||||||
public Action<Mod> Action;
|
public Action<Mod> Action;
|
||||||
protected abstract Key[] ToggleKeys { get; }
|
protected abstract Key[] ToggleKeys { get; }
|
||||||
@ -36,47 +38,30 @@ namespace osu.Game.Overlays.Mods
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<Mod> SelectedMods => buttons.Select(b => b.SelectedMod).Where(m => m != null);
|
||||||
|
|
||||||
|
public IEnumerable<Mod> Mods
|
||||||
|
{
|
||||||
|
set
|
||||||
|
{
|
||||||
|
var modContainers = value.Select(m =>
|
||||||
|
{
|
||||||
|
if (m == null)
|
||||||
|
return new ModButtonEmpty();
|
||||||
|
else
|
||||||
|
return new ModButton(m)
|
||||||
|
{
|
||||||
|
SelectedColour = selectedColour,
|
||||||
|
Action = Action,
|
||||||
|
};
|
||||||
|
}).ToArray();
|
||||||
|
|
||||||
|
ButtonsContainer.Children = modContainers;
|
||||||
|
buttons = modContainers.OfType<ModButton>().ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private ModButton[] buttons = { };
|
private ModButton[] buttons = { };
|
||||||
public ModButton[] Buttons
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return buttons;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == buttons) return;
|
|
||||||
buttons = value;
|
|
||||||
|
|
||||||
foreach (ModButton button in value)
|
|
||||||
{
|
|
||||||
button.ButtonColour = ButtonColour;
|
|
||||||
button.SelectedColour = selectedColour;
|
|
||||||
button.Action = Action;
|
|
||||||
}
|
|
||||||
|
|
||||||
ButtonsContainer.Children = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color4 buttonsBolour = Color4.White;
|
|
||||||
public Color4 ButtonColour
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return buttonsBolour;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
if (value == buttonsBolour) return;
|
|
||||||
buttonsBolour = value;
|
|
||||||
|
|
||||||
foreach (ModButton button in buttons)
|
|
||||||
{
|
|
||||||
button.ButtonColour = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Color4 selectedColour = Color4.White;
|
private Color4 selectedColour = Color4.White;
|
||||||
public Color4 SelectedColour
|
public Color4 SelectedColour
|
||||||
@ -91,17 +76,15 @@ namespace osu.Game.Overlays.Mods
|
|||||||
selectedColour = value;
|
selectedColour = value;
|
||||||
|
|
||||||
foreach (ModButton button in buttons)
|
foreach (ModButton button in buttons)
|
||||||
{
|
|
||||||
button.SelectedColour = value;
|
button.SelectedColour = value;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
{
|
{
|
||||||
var index = Array.IndexOf(ToggleKeys, args.Key);
|
var index = Array.IndexOf(ToggleKeys, args.Key);
|
||||||
if (index > -1 && index < Buttons.Length)
|
if (index > -1 && index < buttons.Length)
|
||||||
Buttons[index].SelectNext();
|
buttons[index].SelectNext();
|
||||||
|
|
||||||
return base.OnKeyDown(state, args);
|
return base.OnKeyDown(state, args);
|
||||||
}
|
}
|
||||||
@ -109,8 +92,18 @@ namespace osu.Game.Overlays.Mods
|
|||||||
public void DeselectAll()
|
public void DeselectAll()
|
||||||
{
|
{
|
||||||
foreach (ModButton button in buttons)
|
foreach (ModButton button in buttons)
|
||||||
{
|
|
||||||
button.Deselect();
|
button.Deselect();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DeselectTypes(Type[] modTypes)
|
||||||
|
{
|
||||||
|
foreach (var button in buttons)
|
||||||
|
{
|
||||||
|
Mod selected = button.SelectedMod;
|
||||||
|
if (selected == null) continue;
|
||||||
|
foreach (Type type in modTypes)
|
||||||
|
if (type.IsInstanceOfType(selected))
|
||||||
|
button.Deselect();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,7 +120,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
Position = new Vector2(0f, 0f),
|
Position = new Vector2(0f, 0f),
|
||||||
Font = @"Exo2.0-Bold"
|
Font = @"Exo2.0-Bold"
|
||||||
},
|
},
|
||||||
ButtonsContainer = new FillFlowContainer<ModButton>
|
ButtonsContainer = new FillFlowContainer<ModButtonEmpty>
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.Both,
|
AutoSizeAxes = Axes.Both,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
|
@ -44,7 +44,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
var instance = newRuleset.CreateInstance();
|
var instance = newRuleset.CreateInstance();
|
||||||
|
|
||||||
foreach (ModSection section in modSectionsContainer.Children)
|
foreach (ModSection section in modSectionsContainer.Children)
|
||||||
section.Buttons = instance.GetModsFor(section.ModType).Select(m => new ModButton(m)).ToArray();
|
section.Mods = instance.GetModsFor(section.ModType);
|
||||||
refreshSelectedMods();
|
refreshSelectedMods();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,14 +103,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
{
|
{
|
||||||
if (modTypes.Length == 0) return;
|
if (modTypes.Length == 0) return;
|
||||||
foreach (ModSection section in modSectionsContainer.Children)
|
foreach (ModSection section in modSectionsContainer.Children)
|
||||||
foreach (ModButton button in section.Buttons)
|
section.DeselectTypes(modTypes);
|
||||||
{
|
|
||||||
Mod selected = button.SelectedMod;
|
|
||||||
if (selected == null) continue;
|
|
||||||
foreach (Type type in modTypes)
|
|
||||||
if (type.IsInstanceOfType(selected))
|
|
||||||
button.Deselect();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void modButtonPressed(Mod selectedMod)
|
private void modButtonPressed(Mod selectedMod)
|
||||||
@ -122,7 +115,7 @@ namespace osu.Game.Overlays.Mods
|
|||||||
|
|
||||||
private void refreshSelectedMods()
|
private void refreshSelectedMods()
|
||||||
{
|
{
|
||||||
SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.Buttons.Select(x => x.SelectedMod).Where(x => x != null)).ToArray();
|
SelectedMods.Value = modSectionsContainer.Children.SelectMany(s => s.SelectedMods).ToArray();
|
||||||
|
|
||||||
double multiplier = 1.0;
|
double multiplier = 1.0;
|
||||||
bool ranked = true;
|
bool ranked = true;
|
||||||
|
@ -21,6 +21,11 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual FontAwesome Icon => FontAwesome.fa_question;
|
public virtual FontAwesome Icon => FontAwesome.fa_question;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The type of this mod.
|
||||||
|
/// </summary>
|
||||||
|
public virtual ModType Type => ModType.Special;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The user readable description of this mod.
|
/// The user readable description of this mod.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Double Time";
|
public override string Name => "Double Time";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_doubletime;
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override string Description => "Zoooooooooom";
|
public override string Description => "Zoooooooooom";
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModHalfTime) };
|
||||||
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Easy";
|
public override string Name => "Easy";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_easy;
|
||||||
|
public override ModType Type => ModType.DifficultyReduction;
|
||||||
public override string Description => "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required.";
|
public override string Description => "Reduces overall difficulty - larger circles, more forgiving HP drain, less accuracy required.";
|
||||||
public override double ScoreMultiplier => 0.5;
|
public override double ScoreMultiplier => 0.5;
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
|
@ -9,6 +9,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Flashlight";
|
public override string Name => "Flashlight";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_flashlight;
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override string Description => "Restricted view area.";
|
public override string Description => "Restricted view area.";
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Half Time";
|
public override string Name => "Half Time";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_halftime;
|
||||||
|
public override ModType Type => ModType.DifficultyReduction;
|
||||||
public override string Description => "Less zoom";
|
public override string Description => "Less zoom";
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModDoubleTime) };
|
||||||
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Hard Rock";
|
public override string Name => "Hard Rock";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hardrock;
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override string Description => "Everything just got a bit harder...";
|
public override string Description => "Everything just got a bit harder...";
|
||||||
public override Type[] IncompatibleMods => new[] { typeof(ModEasy) };
|
public override Type[] IncompatibleMods => new[] { typeof(ModEasy) };
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Hidden";
|
public override string Name => "Hidden";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_hidden;
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "NoFail";
|
public override string Name => "NoFail";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_nofail;
|
||||||
|
public override ModType Type => ModType.DifficultyReduction;
|
||||||
public override string Description => "You can't fail, no matter what.";
|
public override string Description => "You can't fail, no matter what.";
|
||||||
public override double ScoreMultiplier => 0.5;
|
public override double ScoreMultiplier => 0.5;
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
|
@ -10,6 +10,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
{
|
{
|
||||||
public override string Name => "Sudden Death";
|
public override string Name => "Sudden Death";
|
||||||
public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath;
|
public override FontAwesome Icon => FontAwesome.fa_osu_mod_suddendeath;
|
||||||
|
public override ModType Type => ModType.DifficultyIncrease;
|
||||||
public override string Description => "Miss a note and fail.";
|
public override string Description => "Miss a note and fail.";
|
||||||
public override double ScoreMultiplier => 1;
|
public override double ScoreMultiplier => 1;
|
||||||
public override bool Ranked => true;
|
public override bool Ranked => true;
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI
|
namespace osu.Game.Rulesets.UI
|
||||||
{
|
{
|
||||||
@ -13,72 +16,88 @@ namespace osu.Game.Rulesets.UI
|
|||||||
private readonly TextAwesome modIcon;
|
private readonly TextAwesome modIcon;
|
||||||
private readonly TextAwesome background;
|
private readonly TextAwesome background;
|
||||||
|
|
||||||
private float iconSize = 80;
|
private const float icon_size = 80;
|
||||||
public float IconSize
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return iconSize;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
iconSize = value;
|
|
||||||
reapplySize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public new Color4 Colour
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return background.Colour;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
background.Colour = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public FontAwesome Icon
|
public FontAwesome Icon
|
||||||
{
|
{
|
||||||
get
|
get { return modIcon.Icon; }
|
||||||
{
|
set { modIcon.Icon = value; }
|
||||||
return modIcon.Icon;
|
|
||||||
}
|
|
||||||
set
|
|
||||||
{
|
|
||||||
modIcon.Icon = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reapplySize()
|
private readonly ModType type;
|
||||||
{
|
|
||||||
background.TextSize = iconSize;
|
|
||||||
modIcon.TextSize = iconSize - 35;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ModIcon()
|
public ModIcon(Mod mod)
|
||||||
{
|
{
|
||||||
|
if (mod == null) throw new ArgumentNullException(nameof(mod));
|
||||||
|
|
||||||
|
type = mod.Type;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
background = new TextAwesome
|
background = new TextAwesome
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
|
TextSize = icon_size,
|
||||||
Icon = FontAwesome.fa_osu_mod_bg,
|
Icon = FontAwesome.fa_osu_mod_bg,
|
||||||
Shadow = true,
|
Shadow = true,
|
||||||
TextSize = 20
|
|
||||||
},
|
},
|
||||||
modIcon = new TextAwesome
|
modIcon = new TextAwesome
|
||||||
{
|
{
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Colour = OsuColour.Gray(84),
|
Colour = OsuColour.Gray(84),
|
||||||
TextSize = 20
|
TextSize = icon_size - 35,
|
||||||
|
Icon = mod.Icon
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
reapplySize();
|
private Color4 backgroundColour;
|
||||||
|
private Color4 highlightedColour;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
case ModType.DifficultyIncrease:
|
||||||
|
backgroundColour = colours.Yellow;
|
||||||
|
highlightedColour = colours.YellowLight;
|
||||||
|
break;
|
||||||
|
case ModType.DifficultyReduction:
|
||||||
|
backgroundColour = colours.Green;
|
||||||
|
highlightedColour = colours.GreenLight;
|
||||||
|
break;
|
||||||
|
case ModType.Special:
|
||||||
|
backgroundColour = colours.Blue;
|
||||||
|
highlightedColour = colours.BlueLight;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
applyStyle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool highlighted;
|
||||||
|
|
||||||
|
public bool Highlighted
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return highlighted;
|
||||||
|
}
|
||||||
|
|
||||||
|
set
|
||||||
|
{
|
||||||
|
highlighted = value;
|
||||||
|
applyStyle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void applyStyle()
|
||||||
|
{
|
||||||
|
background.Colour = highlighted ? highlightedColour : backgroundColour;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ using osu.Framework.Graphics.Transforms;
|
|||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
public abstract class ComboCounter : Container
|
public abstract class ComboCounter : Container
|
||||||
{
|
{
|
@ -1,13 +1,13 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Transforms;
|
using osu.Framework.Graphics.Transforms;
|
||||||
using osu.Framework.MathUtils;
|
using osu.Framework.MathUtils;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used to display combo with a roll-up animation in results screen.
|
/// Used to display combo with a roll-up animation in results screen.
|
@ -4,7 +4,7 @@
|
|||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
public abstract class HealthDisplay : Container
|
public abstract class HealthDisplay : Container
|
||||||
{
|
{
|
105
osu.Game/Screens/Play/HUD/ModDisplay.cs
Normal file
105
osu.Game/Screens/Play/HUD/ModDisplay.cs
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
// 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.Linq;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Primitives;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Rulesets.Mods;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using OpenTK;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Play.HUD
|
||||||
|
{
|
||||||
|
public class ModDisplay : Container, IHasCurrentValue<IEnumerable<Mod>>
|
||||||
|
{
|
||||||
|
private readonly Bindable<IEnumerable<Mod>> mods = new Bindable<IEnumerable<Mod>>();
|
||||||
|
|
||||||
|
public Bindable<IEnumerable<Mod>> Current => mods;
|
||||||
|
|
||||||
|
private readonly FillFlowContainer<ModIcon> iconsContainer;
|
||||||
|
|
||||||
|
public ModDisplay()
|
||||||
|
{
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
iconsContainer = new IconFlow
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Margin = new MarginPadding { Left = 10, Right = 10 },
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomCentre,
|
||||||
|
Origin = Anchor.TopCentre,
|
||||||
|
Text = @"/ UNRANKED /",
|
||||||
|
Font = @"Venera",
|
||||||
|
TextSize = 12,
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
mods.ValueChanged += mods =>
|
||||||
|
{
|
||||||
|
iconsContainer.Clear();
|
||||||
|
foreach (Mod mod in mods)
|
||||||
|
{
|
||||||
|
iconsContainer.Add(new ModIcon(mod)
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Scale = new Vector2(0.6f),
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (IsLoaded)
|
||||||
|
appearTransform();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
base.LoadComplete();
|
||||||
|
appearTransform();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void appearTransform()
|
||||||
|
{
|
||||||
|
iconsContainer.Flush();
|
||||||
|
iconsContainer.FadeInFromZero(1000, EasingTypes.OutQuint);
|
||||||
|
expand();
|
||||||
|
using (iconsContainer.BeginDelayedSequence(1200))
|
||||||
|
contract();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void expand() => iconsContainer.TransformSpacingTo(new Vector2(5, 0), 500, EasingTypes.OutQuint);
|
||||||
|
|
||||||
|
private void contract() => iconsContainer.TransformSpacingTo(new Vector2(-25, 0), 500, EasingTypes.OutQuint);
|
||||||
|
|
||||||
|
protected override bool OnHover(InputState state)
|
||||||
|
{
|
||||||
|
expand();
|
||||||
|
return base.OnHover(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(InputState state)
|
||||||
|
{
|
||||||
|
contract();
|
||||||
|
base.OnHoverLost(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class IconFlow : FillFlowContainer<ModIcon>
|
||||||
|
{
|
||||||
|
// just reverses the depth of flow contents.
|
||||||
|
protected override IComparer<Drawable> DepthComparer => new ReverseCreationOrderDepthComparer();
|
||||||
|
protected override IEnumerable<ModIcon> FlowingChildren => base.FlowingChildren.Reverse();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Uses the 'x' symbol and has a pop-out effect while rolling over.
|
/// Uses the 'x' symbol and has a pop-out effect while rolling over.
|
@ -1,8 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
using System;
|
||||||
using OpenTK.Graphics;
|
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -10,9 +9,10 @@ using osu.Framework.Graphics.Sprites;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Judgements;
|
using osu.Game.Rulesets.Judgements;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using System;
|
using OpenTK;
|
||||||
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI
|
namespace osu.Game.Screens.Play.HUD
|
||||||
{
|
{
|
||||||
public class StandardHealthDisplay : HealthDisplay, IHasAccentColour
|
public class StandardHealthDisplay : HealthDisplay, IHasAccentColour
|
||||||
{
|
{
|
@ -5,18 +5,19 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Screens.Play;
|
|
||||||
using osu.Game.Rulesets.Scoring;
|
|
||||||
using osu.Framework.Input;
|
|
||||||
using OpenTK.Input;
|
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
|
using osu.Game.Rulesets.Scoring;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
using OpenTK.Input;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public abstract class HudOverlay : Container
|
public abstract class HUDOverlay : Container
|
||||||
{
|
{
|
||||||
private const int duration = 100;
|
private const int duration = 100;
|
||||||
|
|
||||||
@ -27,6 +28,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
public readonly RollingCounter<double> AccuracyCounter;
|
public readonly RollingCounter<double> AccuracyCounter;
|
||||||
public readonly HealthDisplay HealthDisplay;
|
public readonly HealthDisplay HealthDisplay;
|
||||||
public readonly SongProgress Progress;
|
public readonly SongProgress Progress;
|
||||||
|
public readonly ModDisplay ModDisplay;
|
||||||
|
|
||||||
private Bindable<bool> showKeyCounter;
|
private Bindable<bool> showKeyCounter;
|
||||||
private Bindable<bool> showHud;
|
private Bindable<bool> showHud;
|
||||||
@ -39,8 +41,9 @@ namespace osu.Game.Rulesets.UI
|
|||||||
protected abstract ScoreCounter CreateScoreCounter();
|
protected abstract ScoreCounter CreateScoreCounter();
|
||||||
protected abstract HealthDisplay CreateHealthDisplay();
|
protected abstract HealthDisplay CreateHealthDisplay();
|
||||||
protected abstract SongProgress CreateProgress();
|
protected abstract SongProgress CreateProgress();
|
||||||
|
protected abstract ModDisplay CreateModsContainer();
|
||||||
|
|
||||||
protected HudOverlay()
|
protected HUDOverlay()
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
@ -56,6 +59,7 @@ namespace osu.Game.Rulesets.UI
|
|||||||
AccuracyCounter = CreateAccuracyCounter(),
|
AccuracyCounter = CreateAccuracyCounter(),
|
||||||
HealthDisplay = CreateHealthDisplay(),
|
HealthDisplay = CreateHealthDisplay(),
|
||||||
Progress = CreateProgress(),
|
Progress = CreateProgress(),
|
||||||
|
ModDisplay = CreateModsContainer(),
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -105,6 +109,11 @@ namespace osu.Game.Rulesets.UI
|
|||||||
public virtual void BindHitRenderer(HitRenderer hitRenderer)
|
public virtual void BindHitRenderer(HitRenderer hitRenderer)
|
||||||
{
|
{
|
||||||
hitRenderer.InputManager.Add(KeyCounter.GetReceptor());
|
hitRenderer.InputManager.Add(KeyCounter.GetReceptor());
|
||||||
|
|
||||||
|
// in the case a replay isn't loaded, we want some elements to only appear briefly.
|
||||||
|
if (!hitRenderer.HasReplayLoaded)
|
||||||
|
using (ModDisplay.BeginDelayedSequence(2000))
|
||||||
|
ModDisplay.FadeOut(200);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
@ -72,7 +72,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private Container hitRendererContainer;
|
private Container hitRendererContainer;
|
||||||
|
|
||||||
private HudOverlay hudOverlay;
|
private HUDOverlay hudOverlay;
|
||||||
private PauseOverlay pauseOverlay;
|
private PauseOverlay pauseOverlay;
|
||||||
private FailOverlay failOverlay;
|
private FailOverlay failOverlay;
|
||||||
|
|
||||||
@ -154,7 +154,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
scoreProcessor = HitRenderer.CreateScoreProcessor();
|
scoreProcessor = HitRenderer.CreateScoreProcessor();
|
||||||
|
|
||||||
hudOverlay = new StandardHudOverlay()
|
hudOverlay = new StandardHUDOverlay()
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
@ -169,6 +169,8 @@ namespace osu.Game.Screens.Play
|
|||||||
hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded;
|
hudOverlay.Progress.AllowSeeking = HitRenderer.HasReplayLoaded;
|
||||||
hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos);
|
hudOverlay.Progress.OnSeek = pos => decoupledClock.Seek(pos);
|
||||||
|
|
||||||
|
hudOverlay.ModDisplay.Current.BindTo(Beatmap.Mods);
|
||||||
|
|
||||||
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
|
//bind HitRenderer to ScoreProcessor and ourselves (for a pass situation)
|
||||||
HitRenderer.OnAllJudged += onCompletion;
|
HitRenderer.OnAllJudged += onCompletion;
|
||||||
|
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
using OpenTK;
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Rulesets.UI
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
public class StandardHudOverlay : HudOverlay
|
public class StandardHUDOverlay : HUDOverlay
|
||||||
{
|
{
|
||||||
protected override RollingCounter<double> CreateAccuracyCounter() => new PercentageCounter
|
protected override RollingCounter<double> CreateAccuracyCounter() => new PercentageCounter
|
||||||
{
|
{
|
||||||
@ -64,6 +64,14 @@ namespace osu.Game.Rulesets.UI
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected override ModDisplay CreateModsContainer() => new ModDisplay
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Margin = new MarginPadding { Top = 20, Right = 10 },
|
||||||
|
};
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours)
|
||||||
{
|
{
|
@ -178,10 +178,9 @@
|
|||||||
<Compile Include="Database\RulesetDatabase.cs" />
|
<Compile Include="Database\RulesetDatabase.cs" />
|
||||||
<Compile Include="Rulesets\Scoring\Score.cs" />
|
<Compile Include="Rulesets\Scoring\Score.cs" />
|
||||||
<Compile Include="Rulesets\Scoring\ScoreProcessor.cs" />
|
<Compile Include="Rulesets\Scoring\ScoreProcessor.cs" />
|
||||||
<Compile Include="Rulesets\UI\HealthDisplay.cs" />
|
<Compile Include="Screens\Play\HUD\HealthDisplay.cs" />
|
||||||
<Compile Include="Rulesets\UI\HudOverlay.cs" />
|
<Compile Include="Screens\Play\HUDOverlay.cs" />
|
||||||
<Compile Include="Rulesets\UI\StandardHealthDisplay.cs" />
|
<Compile Include="Screens\Play\HUD\StandardHealthDisplay.cs" />
|
||||||
<Compile Include="Rulesets\UI\StandardHudOverlay.cs" />
|
|
||||||
<Compile Include="Online\API\IOnlineComponent.cs" />
|
<Compile Include="Online\API\IOnlineComponent.cs" />
|
||||||
<Compile Include="Online\API\Requests\GetScoresRequest.cs" />
|
<Compile Include="Online\API\Requests\GetScoresRequest.cs" />
|
||||||
<Compile Include="Online\API\Requests\GetBeatmapDetailsRequest.cs" />
|
<Compile Include="Online\API\Requests\GetBeatmapDetailsRequest.cs" />
|
||||||
@ -228,7 +227,9 @@
|
|||||||
<Compile Include="Screens\Charts\ChartInfo.cs" />
|
<Compile Include="Screens\Charts\ChartInfo.cs" />
|
||||||
<Compile Include="Screens\Edit\Editor.cs" />
|
<Compile Include="Screens\Edit\Editor.cs" />
|
||||||
<Compile Include="Screens\Play\HotkeyRetryOverlay.cs" />
|
<Compile Include="Screens\Play\HotkeyRetryOverlay.cs" />
|
||||||
|
<Compile Include="Screens\Play\HUD\ModDisplay.cs" />
|
||||||
<Compile Include="Screens\Play\SquareGraph.cs" />
|
<Compile Include="Screens\Play\SquareGraph.cs" />
|
||||||
|
<Compile Include="Screens\Play\StandardHUDOverlay.cs" />
|
||||||
<Compile Include="Screens\Ranking\ResultsPage.cs" />
|
<Compile Include="Screens\Ranking\ResultsPage.cs" />
|
||||||
<Compile Include="Screens\Ranking\ResultsPageRanking.cs" />
|
<Compile Include="Screens\Ranking\ResultsPageRanking.cs" />
|
||||||
<Compile Include="Screens\Ranking\ResultsPageScore.cs" />
|
<Compile Include="Screens\Ranking\ResultsPageScore.cs" />
|
||||||
@ -254,7 +255,7 @@
|
|||||||
<Compile Include="Screens\Play\PlayerLoader.cs" />
|
<Compile Include="Screens\Play\PlayerLoader.cs" />
|
||||||
<Compile Include="Screens\Play\ReplayPlayer.cs" />
|
<Compile Include="Screens\Play\ReplayPlayer.cs" />
|
||||||
<Compile Include="Screens\Play\SkipButton.cs" />
|
<Compile Include="Screens\Play\SkipButton.cs" />
|
||||||
<Compile Include="Rulesets\UI\StandardComboCounter.cs" />
|
<Compile Include="Screens\Play\HUD\StandardComboCounter.cs" />
|
||||||
<Compile Include="Screens\Ranking\AspectContainer.cs" />
|
<Compile Include="Screens\Ranking\AspectContainer.cs" />
|
||||||
<Compile Include="Screens\Ranking\ResultMode.cs" />
|
<Compile Include="Screens\Ranking\ResultMode.cs" />
|
||||||
<Compile Include="Screens\Ranking\ResultModeButton.cs" />
|
<Compile Include="Screens\Ranking\ResultModeButton.cs" />
|
||||||
@ -279,8 +280,8 @@
|
|||||||
<Compile Include="Rulesets\UI\HitRenderer.cs" />
|
<Compile Include="Rulesets\UI\HitRenderer.cs" />
|
||||||
<Compile Include="Rulesets\UI\Playfield.cs" />
|
<Compile Include="Rulesets\UI\Playfield.cs" />
|
||||||
<Compile Include="Screens\Select\EditSongSelect.cs" />
|
<Compile Include="Screens\Select\EditSongSelect.cs" />
|
||||||
<Compile Include="Rulesets\UI\ComboCounter.cs" />
|
<Compile Include="Screens\Play\HUD\ComboCounter.cs" />
|
||||||
<Compile Include="Rulesets\UI\ComboResultCounter.cs" />
|
<Compile Include="Screens\Play\HUD\ComboResultCounter.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\RollingCounter.cs" />
|
<Compile Include="Graphics\UserInterface\RollingCounter.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\Volume\VolumeControlReceptor.cs" />
|
<Compile Include="Graphics\UserInterface\Volume\VolumeControlReceptor.cs" />
|
||||||
<Compile Include="Input\GlobalHotkeys.cs" />
|
<Compile Include="Input\GlobalHotkeys.cs" />
|
||||||
@ -392,6 +393,7 @@
|
|||||||
<Compile Include="Screens\Play\Pause\PauseProgressGraph.cs" />
|
<Compile Include="Screens\Play\Pause\PauseProgressGraph.cs" />
|
||||||
<Compile Include="Overlays\Mods\ModSelectOverlay.cs" />
|
<Compile Include="Overlays\Mods\ModSelectOverlay.cs" />
|
||||||
<Compile Include="Rulesets\Mods\Mod.cs" />
|
<Compile Include="Rulesets\Mods\Mod.cs" />
|
||||||
|
<Compile Include="Overlays\Mods\ModButtonEmpty.cs" />
|
||||||
<Compile Include="Overlays\Mods\ModButton.cs" />
|
<Compile Include="Overlays\Mods\ModButton.cs" />
|
||||||
<Compile Include="Rulesets\UI\ModIcon.cs" />
|
<Compile Include="Rulesets\UI\ModIcon.cs" />
|
||||||
<Compile Include="Overlays\Mods\ModSection.cs" />
|
<Compile Include="Overlays\Mods\ModSection.cs" />
|
||||||
|
@ -182,6 +182,7 @@
|
|||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GL/@EntryIndexedValue">GL</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GL/@EntryIndexedValue">GL</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GLSL/@EntryIndexedValue">GLSL</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=GLSL/@EntryIndexedValue">GLSL</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HID/@EntryIndexedValue">HID</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HID/@EntryIndexedValue">HID</s:String>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=HUD/@EntryIndexedValue">HUD</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=ID/@EntryIndexedValue">ID</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IP/@EntryIndexedValue">IP</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IPC/@EntryIndexedValue">IPC</s:String>
|
<s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/Abbreviations/=IPC/@EntryIndexedValue">IPC</s:String>
|
||||||
|
Loading…
Reference in New Issue
Block a user