mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 19:12:57 +08:00
Merge branch 'master' into diffcalc-double-hr
This commit is contained in:
commit
67447ef560
@ -1 +1 @@
|
|||||||
Subproject commit 80e78fd45bb79ca4bc46ecc05deb6058f3879faa
|
Subproject commit eb076a3301231eb73917073499051e49a9b12978
|
@ -6,6 +6,7 @@ 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.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Screens.Multi.Components;
|
using osu.Game.Screens.Multi.Components;
|
||||||
@ -111,6 +112,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddStep(@"select", () => first.State = SelectionState.Selected);
|
||||||
AddStep(@"change title", () => first.Room.Name.Value = @"I Changed Name");
|
AddStep(@"change title", () => first.Room.Name.Value = @"I Changed Name");
|
||||||
AddStep(@"change host", () => first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } });
|
AddStep(@"change host", () => first.Room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } });
|
||||||
AddStep(@"change status", () => first.Room.Status.Value = new RoomStatusPlaying());
|
AddStep(@"change status", () => first.Room.Status.Value = new RoomStatusPlaying());
|
||||||
@ -121,6 +123,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 1254 } } },
|
new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 1254 } } },
|
||||||
new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 123189 } } },
|
new User { Statistics = new UserStatistics { Ranks = new UserStatistics.UserRanks { Global = 123189 } } },
|
||||||
});
|
});
|
||||||
|
AddStep(@"deselect", () => first.State = SelectionState.NotSelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
|
57
osu.Game.Tests/Visual/TestCaseQuitButton.cs
Normal file
57
osu.Game.Tests/Visual/TestCaseQuitButton.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System.Linq;
|
||||||
|
using NUnit.Framework;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Screens.Play.HUD;
|
||||||
|
using OpenTK;
|
||||||
|
using OpenTK.Input;
|
||||||
|
|
||||||
|
namespace osu.Game.Tests.Visual
|
||||||
|
{
|
||||||
|
[Description("'Hold to Quit' UI element")]
|
||||||
|
public class TestCaseQuitButton : ManualInputManagerTestCase
|
||||||
|
{
|
||||||
|
private bool exitAction;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
QuitButton quitButton;
|
||||||
|
|
||||||
|
Add(quitButton = new QuitButton
|
||||||
|
{
|
||||||
|
Origin = Anchor.BottomRight,
|
||||||
|
Anchor = Anchor.BottomRight,
|
||||||
|
Action = () => exitAction = true
|
||||||
|
});
|
||||||
|
|
||||||
|
var text = quitButton.Children.OfType<SpriteText>().First();
|
||||||
|
|
||||||
|
// initial display
|
||||||
|
AddUntilStep(() => text.IsPresent && !exitAction, "Text visible");
|
||||||
|
AddUntilStep(() => !text.IsPresent && !exitAction, "Text is not visible");
|
||||||
|
|
||||||
|
AddStep("Trigger text fade in", () => InputManager.MoveMouseTo(quitButton));
|
||||||
|
AddUntilStep(() => text.IsPresent && !exitAction, "Text visible");
|
||||||
|
AddStep("Trigger text fade out", () => InputManager.MoveMouseTo(Vector2.One));
|
||||||
|
AddUntilStep(() => !text.IsPresent && !exitAction, "Text is not visible");
|
||||||
|
|
||||||
|
AddStep("Trigger exit action", () =>
|
||||||
|
{
|
||||||
|
exitAction = false;
|
||||||
|
InputManager.MoveMouseTo(quitButton);
|
||||||
|
InputManager.ButtonDown(MouseButton.Left);
|
||||||
|
});
|
||||||
|
|
||||||
|
AddStep("Early release", () => InputManager.ButtonUp(MouseButton.Left));
|
||||||
|
AddAssert("action not triggered", () => !exitAction);
|
||||||
|
|
||||||
|
AddStep("Trigger exit action", () => InputManager.ButtonDown(MouseButton.Left));
|
||||||
|
AddUntilStep(() => exitAction, $"{nameof(quitButton.Action)} was triggered");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
var room = new Room
|
Room room = new Room
|
||||||
{
|
{
|
||||||
Name = { Value = @"My Awesome Room" },
|
Name = { Value = @"My Awesome Room" },
|
||||||
Host = { Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" } } },
|
Host = { Value = new User { Username = @"flyte", Id = 3103765, Country = new Country { FlagName = @"JP" } } },
|
||||||
@ -71,9 +71,13 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
Room = room,
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Width = 0.5f,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
AddStep(@"set room", () => inspector.Room = room);
|
||||||
|
AddStep(@"null room", () => inspector.Room = null);
|
||||||
|
AddStep(@"set room", () => inspector.Room = room);
|
||||||
AddStep(@"change title", () => room.Name.Value = @"A Better Room Than The Above");
|
AddStep(@"change title", () => room.Name.Value = @"A Better Room Than The Above");
|
||||||
AddStep(@"change host", () => room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } });
|
AddStep(@"change host", () => room.Host.Value = new User { Username = @"DrabWeb", Id = 6946022, Country = new Country { FlagName = @"CA" } });
|
||||||
AddStep(@"change status", () => room.Status.Value = new RoomStatusPlaying());
|
AddStep(@"change status", () => room.Status.Value = new RoomStatusPlaying());
|
||||||
@ -88,7 +92,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
AddStep(@"change room", () =>
|
AddStep(@"change room", () =>
|
||||||
{
|
{
|
||||||
var newRoom = new Room
|
Room newRoom = new Room
|
||||||
{
|
{
|
||||||
Name = { Value = @"My New, Better Than Ever Room" },
|
Name = { Value = @"My New, Better Than Ever Room" },
|
||||||
Host = { Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" } } },
|
Host = { Value = new User { Username = @"Angelsim", Id = 1777162, Country = new Country { FlagName = @"KR" } } },
|
||||||
|
52
osu.Game/Graphics/Containers/HoldToConfirmContainer.cs
Normal file
52
osu.Game/Graphics/Containers/HoldToConfirmContainer.cs
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.Containers
|
||||||
|
{
|
||||||
|
public abstract class HoldToConfirmContainer : Container
|
||||||
|
{
|
||||||
|
public Action Action;
|
||||||
|
|
||||||
|
private const int activate_delay = 400;
|
||||||
|
private const int fadeout_delay = 200;
|
||||||
|
|
||||||
|
private bool fired;
|
||||||
|
private bool confirming;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether the overlay should be allowed to return from a fired state.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual bool AllowMultipleFires => false;
|
||||||
|
|
||||||
|
public Bindable<double> Progress = new BindableDouble();
|
||||||
|
|
||||||
|
protected void BeginConfirm()
|
||||||
|
{
|
||||||
|
if (confirming || !AllowMultipleFires && fired) return;
|
||||||
|
|
||||||
|
confirming = true;
|
||||||
|
|
||||||
|
this.TransformBindableTo(Progress, 1, activate_delay * (1 - Progress.Value), Easing.Out).OnComplete(_ => Confirm());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected virtual void Confirm()
|
||||||
|
{
|
||||||
|
Action?.Invoke();
|
||||||
|
fired = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void AbortConfirm()
|
||||||
|
{
|
||||||
|
if (!AllowMultipleFires && fired) return;
|
||||||
|
|
||||||
|
confirming = false;
|
||||||
|
|
||||||
|
this.TransformBindableTo(Progress, 0, fadeout_delay, Easing.Out);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,6 +7,7 @@ using osu.Framework.Audio.Sample;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using osu.Framework.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Containers
|
namespace osu.Game.Graphics.Containers
|
||||||
{
|
{
|
||||||
@ -15,9 +16,14 @@ namespace osu.Game.Graphics.Containers
|
|||||||
private SampleChannel samplePopIn;
|
private SampleChannel samplePopIn;
|
||||||
private SampleChannel samplePopOut;
|
private SampleChannel samplePopOut;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
private readonly BindableBool allowOpeningOverlays = new BindableBool(true);
|
||||||
private void load(AudioManager audio)
|
|
||||||
|
[BackgroundDependencyLoader(true)]
|
||||||
|
private void load(OsuGame osuGame, AudioManager audio)
|
||||||
{
|
{
|
||||||
|
if (osuGame != null)
|
||||||
|
allowOpeningOverlays.BindTo(osuGame.AllowOpeningOverlays);
|
||||||
|
|
||||||
samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in");
|
samplePopIn = audio.Sample.Get(@"UI/overlay-pop-in");
|
||||||
samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out");
|
samplePopOut = audio.Sample.Get(@"UI/overlay-pop-out");
|
||||||
|
|
||||||
@ -46,15 +52,20 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
private void onStateChanged(Visibility visibility)
|
private void onStateChanged(Visibility visibility)
|
||||||
{
|
{
|
||||||
switch (visibility)
|
if (allowOpeningOverlays)
|
||||||
{
|
{
|
||||||
case Visibility.Visible:
|
switch (visibility)
|
||||||
samplePopIn?.Play();
|
{
|
||||||
break;
|
case Visibility.Visible:
|
||||||
case Visibility.Hidden:
|
samplePopIn?.Play();
|
||||||
samplePopOut?.Play();
|
break;
|
||||||
break;
|
case Visibility.Hidden:
|
||||||
|
samplePopOut?.Play();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
State = Visibility.Hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
11
osu.Game/Graphics/UserInterface/SelectionState.cs
Normal file
11
osu.Game/Graphics/UserInterface/SelectionState.cs
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
namespace osu.Game.Graphics.UserInterface
|
||||||
|
{
|
||||||
|
public enum SelectionState
|
||||||
|
{
|
||||||
|
NotSelected,
|
||||||
|
Selected
|
||||||
|
}
|
||||||
|
}
|
@ -77,7 +77,8 @@ namespace osu.Game
|
|||||||
|
|
||||||
public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight;
|
public float ToolbarOffset => Toolbar.Position.Y + Toolbar.DrawHeight;
|
||||||
|
|
||||||
public readonly BindableBool ShowOverlays = new BindableBool();
|
public readonly BindableBool HideOverlaysOnEnter = new BindableBool();
|
||||||
|
public readonly BindableBool AllowOpeningOverlays = new BindableBool(true);
|
||||||
|
|
||||||
private OsuScreen screenStack;
|
private OsuScreen screenStack;
|
||||||
|
|
||||||
@ -367,12 +368,12 @@ namespace osu.Game
|
|||||||
settings.StateChanged += _ => updateScreenOffset();
|
settings.StateChanged += _ => updateScreenOffset();
|
||||||
notifications.StateChanged += _ => updateScreenOffset();
|
notifications.StateChanged += _ => updateScreenOffset();
|
||||||
|
|
||||||
notifications.Enabled.BindTo(ShowOverlays);
|
notifications.Enabled.BindTo(AllowOpeningOverlays);
|
||||||
|
|
||||||
ShowOverlays.ValueChanged += show =>
|
HideOverlaysOnEnter.ValueChanged += hide =>
|
||||||
{
|
{
|
||||||
//central game screen change logic.
|
//central game screen change logic.
|
||||||
if (!show)
|
if (hide)
|
||||||
{
|
{
|
||||||
hideAllOverlays();
|
hideAllOverlays();
|
||||||
musicController.State = Visibility.Hidden;
|
musicController.State = Visibility.Hidden;
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 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.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Overlays
|
namespace osu.Game.Overlays
|
||||||
@ -14,22 +13,10 @@ namespace osu.Game.Overlays
|
|||||||
/// An overlay which will display a black screen that dims over a period before confirming an exit action.
|
/// An overlay which will display a black screen that dims over a period before confirming an exit action.
|
||||||
/// Action is BYO (derived class will need to call <see cref="BeginConfirm"/> and <see cref="AbortConfirm"/> from a user event).
|
/// Action is BYO (derived class will need to call <see cref="BeginConfirm"/> and <see cref="AbortConfirm"/> from a user event).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract class HoldToConfirmOverlay : Container
|
public abstract class HoldToConfirmOverlay : HoldToConfirmContainer
|
||||||
{
|
{
|
||||||
public Action Action;
|
|
||||||
|
|
||||||
private Box overlay;
|
private Box overlay;
|
||||||
|
|
||||||
private const int activate_delay = 400;
|
|
||||||
private const int fadeout_delay = 200;
|
|
||||||
|
|
||||||
private bool fired;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Whether the overlay should be allowed to return from a fired state.
|
|
||||||
/// </summary>
|
|
||||||
protected virtual bool AllowMultipleFires => false;
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -45,22 +32,8 @@ namespace osu.Game.Overlays
|
|||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
|
||||||
|
|
||||||
protected void BeginConfirm()
|
Progress.ValueChanged += v => overlay.Alpha = (float)v;
|
||||||
{
|
|
||||||
if (!AllowMultipleFires && fired) return;
|
|
||||||
overlay.FadeIn(activate_delay * (1 - overlay.Alpha), Easing.Out).OnComplete(_ =>
|
|
||||||
{
|
|
||||||
Action?.Invoke();
|
|
||||||
fired = true;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void AbortConfirm()
|
|
||||||
{
|
|
||||||
if (!AllowMultipleFires && fired) return;
|
|
||||||
overlay.FadeOut(fadeout_delay, Easing.Out);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -101,7 +101,7 @@ namespace osu.Game.Overlays.Music
|
|||||||
private void updateSelectedSet()
|
private void updateSelectedSet()
|
||||||
{
|
{
|
||||||
foreach (PlaylistItem s in items.Children)
|
foreach (PlaylistItem s in items.Children)
|
||||||
s.Selected = s.BeatmapSetInfo.ID == beatmapBacking.Value.BeatmapSetInfo.ID;
|
s.Selected = s.BeatmapSetInfo.ID == beatmapBacking.Value.BeatmapSetInfo?.ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string SearchTerm
|
public string SearchTerm
|
||||||
|
@ -6,7 +6,9 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Caching;
|
using osu.Framework.Caching;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Input;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
using OpenTK.Input;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
@ -22,6 +24,7 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
private readonly Drawable modeButtonLine;
|
private readonly Drawable modeButtonLine;
|
||||||
private ToolbarModeButton activeButton;
|
private ToolbarModeButton activeButton;
|
||||||
|
|
||||||
|
private RulesetStore rulesets;
|
||||||
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
private readonly Bindable<RulesetInfo> ruleset = new Bindable<RulesetInfo>();
|
||||||
|
|
||||||
public ToolbarModeSelector()
|
public ToolbarModeSelector()
|
||||||
@ -67,26 +70,42 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(RulesetStore rulesets, OsuGame game)
|
private void load(RulesetStore rulesets, OsuGame game)
|
||||||
{
|
{
|
||||||
|
this.rulesets = rulesets;
|
||||||
foreach (var r in rulesets.AvailableRulesets)
|
foreach (var r in rulesets.AvailableRulesets)
|
||||||
{
|
{
|
||||||
modeButtons.Add(new ToolbarModeButton
|
modeButtons.Add(new ToolbarModeButton
|
||||||
{
|
{
|
||||||
Ruleset = r,
|
Ruleset = r,
|
||||||
Action = delegate
|
Action = delegate { ruleset.Value = r; }
|
||||||
{
|
|
||||||
ruleset.Value = r;
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ruleset.ValueChanged += rulesetChanged;
|
ruleset.ValueChanged += rulesetChanged;
|
||||||
ruleset.DisabledChanged += disabledChanged;
|
ruleset.DisabledChanged += disabledChanged;
|
||||||
|
|
||||||
if (game != null)
|
if (game != null)
|
||||||
ruleset.BindTo(game.Ruleset);
|
ruleset.BindTo(game.Ruleset);
|
||||||
else
|
else
|
||||||
ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault();
|
ruleset.Value = rulesets.AvailableRulesets.FirstOrDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args)
|
||||||
|
{
|
||||||
|
base.OnKeyDown(state, args);
|
||||||
|
|
||||||
|
if (state.Keyboard.ControlPressed && !args.Repeat && args.Key >= Key.Number1 && args.Key <= Key.Number9)
|
||||||
|
{
|
||||||
|
int requested = args.Key - Key.Number1;
|
||||||
|
|
||||||
|
RulesetInfo found = rulesets.AvailableRulesets.Skip(requested).FirstOrDefault();
|
||||||
|
if (found != null)
|
||||||
|
ruleset.Value = found;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public override bool HandleKeyboardInput => !ruleset.Disabled && base.HandleKeyboardInput;
|
public override bool HandleKeyboardInput => !ruleset.Disabled && base.HandleKeyboardInput;
|
||||||
public override bool HandleMouseInput => !ruleset.Disabled && base.HandleMouseInput;
|
public override bool HandleMouseInput => !ruleset.Disabled && base.HandleMouseInput;
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ using osu.Framework;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
@ -137,10 +138,4 @@ namespace osu.Game.Rulesets.Edit
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual Quad SelectionQuad => ScreenSpaceDrawQuad;
|
public virtual Quad SelectionQuad => ScreenSpaceDrawQuad;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum SelectionState
|
|
||||||
{
|
|
||||||
NotSelected,
|
|
||||||
Selected
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
{
|
{
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenCustom(@"Backgrounds/bg4");
|
||||||
|
|
||||||
public override bool ShowOverlaysOnEnter => false;
|
protected override bool HideOverlaysOnEnter => true;
|
||||||
public override bool AllowBeatmapRulesetChange => false;
|
public override bool AllowBeatmapRulesetChange => false;
|
||||||
|
|
||||||
private Box bottomBackground;
|
private Box bottomBackground;
|
||||||
|
@ -17,7 +17,7 @@ namespace osu.Game.Screens
|
|||||||
{
|
{
|
||||||
private bool showDisclaimer;
|
private bool showDisclaimer;
|
||||||
|
|
||||||
public override bool ShowOverlaysOnEnter => false;
|
protected override bool HideOverlaysOnEnter => true;
|
||||||
|
|
||||||
protected override bool AllowBackButton => false;
|
protected override bool AllowBackButton => false;
|
||||||
|
|
||||||
|
@ -27,7 +27,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
public event Action<MenuState> StateChanged;
|
public event Action<MenuState> StateChanged;
|
||||||
|
|
||||||
private readonly BindableBool showOverlays = new BindableBool();
|
private readonly BindableBool hideOverlaysOnEnter = new BindableBool();
|
||||||
|
private readonly BindableBool allowOpeningOverlays = new BindableBool();
|
||||||
|
|
||||||
public Action OnEdit;
|
public Action OnEdit;
|
||||||
public Action OnExit;
|
public Action OnExit;
|
||||||
@ -135,7 +136,12 @@ namespace osu.Game.Screens.Menu
|
|||||||
[BackgroundDependencyLoader(true)]
|
[BackgroundDependencyLoader(true)]
|
||||||
private void load(AudioManager audio, OsuGame game)
|
private void load(AudioManager audio, OsuGame game)
|
||||||
{
|
{
|
||||||
if (game != null) showOverlays.BindTo(game.ShowOverlays);
|
if (game != null)
|
||||||
|
{
|
||||||
|
hideOverlaysOnEnter.BindTo(game.HideOverlaysOnEnter);
|
||||||
|
allowOpeningOverlays.BindTo(game.AllowOpeningOverlays);
|
||||||
|
}
|
||||||
|
|
||||||
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
|
sampleBack = audio.Sample.Get(@"Menu/button-back-select");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,6 +154,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
case Key.Space:
|
case Key.Space:
|
||||||
logo?.TriggerOnClick(state);
|
logo?.TriggerOnClick(state);
|
||||||
return true;
|
return true;
|
||||||
|
case Key.Escape:
|
||||||
|
return goBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -158,17 +166,22 @@ namespace osu.Game.Screens.Menu
|
|||||||
switch (action)
|
switch (action)
|
||||||
{
|
{
|
||||||
case GlobalAction.Back:
|
case GlobalAction.Back:
|
||||||
switch (State)
|
return goBack();
|
||||||
{
|
default:
|
||||||
case MenuState.TopLevel:
|
return false;
|
||||||
State = MenuState.Initial;
|
}
|
||||||
return true;
|
}
|
||||||
case MenuState.Play:
|
|
||||||
backButton.TriggerOnClick();
|
private bool goBack()
|
||||||
return true;
|
{
|
||||||
default:
|
switch (State)
|
||||||
return false;
|
{
|
||||||
}
|
case MenuState.TopLevel:
|
||||||
|
State = MenuState.Initial;
|
||||||
|
return true;
|
||||||
|
case MenuState.Play:
|
||||||
|
backButton.TriggerOnClick();
|
||||||
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -322,7 +335,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
logoDelayedAction = Scheduler.AddDelayed(() =>
|
logoDelayedAction = Scheduler.AddDelayed(() =>
|
||||||
{
|
{
|
||||||
showOverlays.Value = false;
|
hideOverlaysOnEnter.Value = true;
|
||||||
|
allowOpeningOverlays.Value = false;
|
||||||
|
|
||||||
logo.ClearTransforms(targetMember: nameof(Position));
|
logo.ClearTransforms(targetMember: nameof(Position));
|
||||||
logo.RelativePositionAxes = Axes.Both;
|
logo.RelativePositionAxes = Axes.Both;
|
||||||
@ -351,7 +365,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
logoTracking = true;
|
logoTracking = true;
|
||||||
|
|
||||||
logo.Impact();
|
logo.Impact();
|
||||||
showOverlays.Value = true;
|
|
||||||
|
hideOverlaysOnEnter.Value = false;
|
||||||
|
allowOpeningOverlays.Value = true;
|
||||||
}, 200);
|
}, 200);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -18,7 +18,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
private readonly SpriteIcon icon;
|
private readonly SpriteIcon icon;
|
||||||
private Color4 iconColour;
|
private Color4 iconColour;
|
||||||
|
|
||||||
public override bool ShowOverlaysOnEnter => false;
|
protected override bool HideOverlaysOnEnter => true;
|
||||||
|
protected override bool AllowOpeningOverlays => false;
|
||||||
|
|
||||||
public override bool CursorVisible => false;
|
public override bool CursorVisible => false;
|
||||||
|
|
||||||
public Disclaimer()
|
public Disclaimer()
|
||||||
|
@ -31,7 +31,9 @@ namespace osu.Game.Screens.Menu
|
|||||||
private SampleChannel welcome;
|
private SampleChannel welcome;
|
||||||
private SampleChannel seeya;
|
private SampleChannel seeya;
|
||||||
|
|
||||||
public override bool ShowOverlaysOnEnter => false;
|
protected override bool HideOverlaysOnEnter => true;
|
||||||
|
protected override bool AllowOpeningOverlays => false;
|
||||||
|
|
||||||
public override bool CursorVisible => false;
|
public override bool CursorVisible => false;
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty();
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty();
|
||||||
|
@ -24,7 +24,8 @@ namespace osu.Game.Screens.Menu
|
|||||||
{
|
{
|
||||||
private readonly ButtonSystem buttons;
|
private readonly ButtonSystem buttons;
|
||||||
|
|
||||||
public override bool ShowOverlaysOnEnter => buttons.State != MenuState.Initial;
|
protected override bool HideOverlaysOnEnter => buttons.State == MenuState.Initial;
|
||||||
|
protected override bool AllowOpeningOverlays => buttons.State != MenuState.Initial;
|
||||||
|
|
||||||
protected override bool AllowBackButton => buttons.State != MenuState.Initial;
|
protected override bool AllowBackButton => buttons.State != MenuState.Initial;
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2018 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;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Configuration;
|
using osu.Framework.Configuration;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
@ -13,6 +15,7 @@ using osu.Game.Beatmaps.Drawables;
|
|||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.Multiplayer;
|
using osu.Game.Online.Multiplayer;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
@ -20,20 +23,17 @@ using OpenTK.Graphics;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Multi.Components
|
namespace osu.Game.Screens.Multi.Components
|
||||||
{
|
{
|
||||||
public class DrawableRoom : OsuClickableContainer
|
public class DrawableRoom : OsuClickableContainer, IStateful<SelectionState>
|
||||||
{
|
{
|
||||||
|
private const float corner_radius = 5;
|
||||||
|
private const float selection_border_width = 4;
|
||||||
private const float transition_duration = 100;
|
private const float transition_duration = 100;
|
||||||
private const float content_padding = 10;
|
private const float content_padding = 10;
|
||||||
private const float height = 100;
|
private const float height = 100;
|
||||||
private const float side_strip_width = 5;
|
private const float side_strip_width = 5;
|
||||||
private const float cover_width = 145;
|
private const float cover_width = 145;
|
||||||
|
|
||||||
private readonly Box sideStrip;
|
private readonly Box selectionBox;
|
||||||
private readonly Container coverContainer;
|
|
||||||
private readonly OsuSpriteText name, status, beatmapTitle, beatmapDash, beatmapArtist;
|
|
||||||
private readonly FillFlowContainer<OsuSpriteText> beatmapInfoFlow;
|
|
||||||
private readonly ParticipantInfo participantInfo;
|
|
||||||
private readonly ModeTypeInfo modeTypeInfo;
|
|
||||||
|
|
||||||
private readonly Bindable<string> nameBind = new Bindable<string>();
|
private readonly Bindable<string> nameBind = new Bindable<string>();
|
||||||
private readonly Bindable<User> hostBind = new Bindable<User>();
|
private readonly Bindable<User> hostBind = new Bindable<User>();
|
||||||
@ -42,136 +42,228 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
private readonly Bindable<BeatmapInfo> beatmapBind = new Bindable<BeatmapInfo>();
|
private readonly Bindable<BeatmapInfo> beatmapBind = new Bindable<BeatmapInfo>();
|
||||||
private readonly Bindable<User[]> participantsBind = new Bindable<User[]>();
|
private readonly Bindable<User[]> participantsBind = new Bindable<User[]>();
|
||||||
|
|
||||||
private OsuColour colours;
|
|
||||||
private LocalisationEngine localisation;
|
|
||||||
|
|
||||||
public readonly Room Room;
|
public readonly Room Room;
|
||||||
|
|
||||||
|
private SelectionState state;
|
||||||
|
public SelectionState State
|
||||||
|
{
|
||||||
|
get { return state; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == state) return;
|
||||||
|
state = value;
|
||||||
|
|
||||||
|
if (state == SelectionState.Selected)
|
||||||
|
selectionBox.FadeIn(transition_duration);
|
||||||
|
else
|
||||||
|
selectionBox.FadeOut(transition_duration);
|
||||||
|
|
||||||
|
StateChanged?.Invoke(State);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public event Action<SelectionState> StateChanged;
|
||||||
|
|
||||||
public DrawableRoom(Room room)
|
public DrawableRoom(Room room)
|
||||||
{
|
{
|
||||||
Room = room;
|
Room = room;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
Height = height;
|
Height = height + selection_border_width * 2;
|
||||||
CornerRadius = 5;
|
CornerRadius = corner_radius + selection_border_width / 2;
|
||||||
Masking = true;
|
Masking = true;
|
||||||
EdgeEffect = new EdgeEffectParameters
|
|
||||||
|
// create selectionBox here so State can be set before being loaded
|
||||||
|
selectionBox = new Box
|
||||||
{
|
{
|
||||||
Type = EdgeEffectType.Shadow,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Colour = Color4.Black.Opacity(40),
|
Alpha = 0f,
|
||||||
Radius = 5,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Action += () => State = SelectionState.Selected;
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours, LocalisationEngine localisation)
|
||||||
|
{
|
||||||
|
Box sideStrip;
|
||||||
|
Container coverContainer;
|
||||||
|
OsuSpriteText name, status, beatmapTitle, beatmapDash, beatmapArtist;
|
||||||
|
ParticipantInfo participantInfo;
|
||||||
|
ModeTypeInfo modeTypeInfo;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new Box
|
selectionBox,
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = OsuColour.FromHex(@"212121"),
|
|
||||||
},
|
|
||||||
sideStrip = new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Width = side_strip_width,
|
|
||||||
},
|
|
||||||
new Container
|
|
||||||
{
|
|
||||||
Width = cover_width,
|
|
||||||
RelativeSizeAxes = Axes.Y,
|
|
||||||
Masking = true,
|
|
||||||
Margin = new MarginPadding { Left = side_strip_width },
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new Box
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Colour = Color4.Black,
|
|
||||||
},
|
|
||||||
coverContainer = new Container
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Padding = new MarginPadding
|
Padding = new MarginPadding(selection_border_width),
|
||||||
|
Child = new Container
|
||||||
{
|
{
|
||||||
Vertical = content_padding,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Left = side_strip_width + cover_width + content_padding,
|
Masking = true,
|
||||||
Right = content_padding,
|
CornerRadius = corner_radius,
|
||||||
},
|
EdgeEffect = new EdgeEffectParameters
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
|
||||||
new FillFlowContainer
|
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.X,
|
Type = EdgeEffectType.Shadow,
|
||||||
AutoSizeAxes = Axes.Y,
|
Colour = Color4.Black.Opacity(40),
|
||||||
Direction = FillDirection.Vertical,
|
Radius = 5,
|
||||||
Spacing = new Vector2(5f),
|
},
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
{
|
{
|
||||||
name = new OsuSpriteText
|
RelativeSizeAxes = Axes.Both,
|
||||||
{
|
Colour = OsuColour.FromHex(@"212121"),
|
||||||
TextSize = 18,
|
|
||||||
},
|
|
||||||
participantInfo = new ParticipantInfo(),
|
|
||||||
},
|
},
|
||||||
},
|
sideStrip = new Box
|
||||||
new FillFlowContainer
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomLeft,
|
|
||||||
Origin = Anchor.BottomLeft,
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Children = new Drawable[]
|
|
||||||
{
|
{
|
||||||
status = new OsuSpriteText
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Width = side_strip_width,
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
Width = cover_width,
|
||||||
|
RelativeSizeAxes = Axes.Y,
|
||||||
|
Masking = true,
|
||||||
|
Margin = new MarginPadding { Left = side_strip_width },
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
TextSize = 14,
|
new Box
|
||||||
Font = @"Exo2.0-Bold",
|
|
||||||
},
|
|
||||||
beatmapInfoFlow = new FillFlowContainer<OsuSpriteText>
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.X,
|
|
||||||
AutoSizeAxes = Axes.Y,
|
|
||||||
Direction = FillDirection.Horizontal,
|
|
||||||
Children = new[]
|
|
||||||
{
|
{
|
||||||
beatmapTitle = new OsuSpriteText
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = Color4.Black,
|
||||||
|
},
|
||||||
|
coverContainer = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Padding = new MarginPadding
|
||||||
|
{
|
||||||
|
Vertical = content_padding,
|
||||||
|
Left = side_strip_width + cover_width + content_padding,
|
||||||
|
Right = content_padding,
|
||||||
|
},
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(5f),
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
TextSize = 14,
|
name = new OsuSpriteText
|
||||||
Font = @"Exo2.0-BoldItalic",
|
{
|
||||||
|
TextSize = 18,
|
||||||
|
},
|
||||||
|
participantInfo = new ParticipantInfo(),
|
||||||
},
|
},
|
||||||
beatmapDash = new OsuSpriteText
|
},
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
TextSize = 14,
|
status = new OsuSpriteText
|
||||||
Font = @"Exo2.0-BoldItalic",
|
{
|
||||||
},
|
TextSize = 14,
|
||||||
beatmapArtist = new OsuSpriteText
|
Font = @"Exo2.0-Bold",
|
||||||
{
|
},
|
||||||
TextSize = 14,
|
new FillFlowContainer<OsuSpriteText>
|
||||||
Font = @"Exo2.0-RegularItalic",
|
{
|
||||||
|
RelativeSizeAxes = Axes.X,
|
||||||
|
AutoSizeAxes = Axes.Y,
|
||||||
|
Colour = colours.Gray9,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Children = new[]
|
||||||
|
{
|
||||||
|
beatmapTitle = new OsuSpriteText
|
||||||
|
{
|
||||||
|
TextSize = 14,
|
||||||
|
Font = @"Exo2.0-BoldItalic",
|
||||||
|
},
|
||||||
|
beatmapDash = new OsuSpriteText
|
||||||
|
{
|
||||||
|
TextSize = 14,
|
||||||
|
Font = @"Exo2.0-BoldItalic",
|
||||||
|
},
|
||||||
|
beatmapArtist = new OsuSpriteText
|
||||||
|
{
|
||||||
|
TextSize = 14,
|
||||||
|
Font = @"Exo2.0-RegularItalic",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
modeTypeInfo = new ModeTypeInfo
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomRight,
|
||||||
|
Origin = Anchor.BottomRight,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
modeTypeInfo = new ModeTypeInfo
|
|
||||||
{
|
|
||||||
Anchor = Anchor.BottomRight,
|
|
||||||
Origin = Anchor.BottomRight,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
nameBind.ValueChanged += displayName;
|
nameBind.ValueChanged += n => name.Text = n;
|
||||||
hostBind.ValueChanged += displayUser;
|
hostBind.ValueChanged += h => participantInfo.Host = h;
|
||||||
typeBind.ValueChanged += displayGameType;
|
typeBind.ValueChanged += m => modeTypeInfo.Type = m;
|
||||||
participantsBind.ValueChanged += displayParticipants;
|
participantsBind.ValueChanged += p => participantInfo.Participants = p;
|
||||||
|
|
||||||
|
statusBind.ValueChanged += s =>
|
||||||
|
{
|
||||||
|
status.Text = s.Message;
|
||||||
|
|
||||||
|
foreach (Drawable d in new Drawable[] { selectionBox, sideStrip, status })
|
||||||
|
d.FadeColour(s.GetAppropriateColour(colours), 100);
|
||||||
|
};
|
||||||
|
|
||||||
|
beatmapBind.ValueChanged += b =>
|
||||||
|
{
|
||||||
|
modeTypeInfo.Beatmap = b;
|
||||||
|
|
||||||
|
if (b != null)
|
||||||
|
{
|
||||||
|
coverContainer.FadeIn(transition_duration);
|
||||||
|
|
||||||
|
LoadComponentAsync(new BeatmapSetCover(b.BeatmapSet)
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
FillMode = FillMode.Fill,
|
||||||
|
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
|
||||||
|
}, coverContainer.Add);
|
||||||
|
|
||||||
|
beatmapTitle.Current = localisation.GetUnicodePreference(b.Metadata.TitleUnicode, b.Metadata.Title);
|
||||||
|
beatmapDash.Text = @" - ";
|
||||||
|
beatmapArtist.Current = localisation.GetUnicodePreference(b.Metadata.ArtistUnicode, b.Metadata.Artist);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
coverContainer.FadeOut(transition_duration);
|
||||||
|
|
||||||
|
beatmapTitle.Current = null;
|
||||||
|
beatmapArtist.Current = null;
|
||||||
|
|
||||||
|
beatmapTitle.Text = "Changing map";
|
||||||
|
beatmapDash.Text = beatmapArtist.Text = string.Empty;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
nameBind.BindTo(Room.Name);
|
nameBind.BindTo(Room.Name);
|
||||||
hostBind.BindTo(Room.Host);
|
hostBind.BindTo(Room.Host);
|
||||||
@ -180,83 +272,5 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
beatmapBind.BindTo(Room.Beatmap);
|
beatmapBind.BindTo(Room.Beatmap);
|
||||||
participantsBind.BindTo(Room.Participants);
|
participantsBind.BindTo(Room.Participants);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours, LocalisationEngine localisation)
|
|
||||||
{
|
|
||||||
this.localisation = localisation;
|
|
||||||
this.colours = colours;
|
|
||||||
|
|
||||||
beatmapInfoFlow.Colour = colours.Gray9;
|
|
||||||
|
|
||||||
//binded here instead of ctor because dependencies are needed
|
|
||||||
statusBind.ValueChanged += displayStatus;
|
|
||||||
beatmapBind.ValueChanged += displayBeatmap;
|
|
||||||
|
|
||||||
statusBind.TriggerChange();
|
|
||||||
beatmapBind.TriggerChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayName(string value)
|
|
||||||
{
|
|
||||||
name.Text = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayUser(User value)
|
|
||||||
{
|
|
||||||
participantInfo.Host = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayStatus(RoomStatus value)
|
|
||||||
{
|
|
||||||
if (value == null) return;
|
|
||||||
status.Text = value.Message;
|
|
||||||
|
|
||||||
foreach (Drawable d in new Drawable[] { sideStrip, status })
|
|
||||||
d.FadeColour(value.GetAppropriateColour(colours), 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayGameType(GameType value)
|
|
||||||
{
|
|
||||||
modeTypeInfo.Type = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayBeatmap(BeatmapInfo value)
|
|
||||||
{
|
|
||||||
modeTypeInfo.Beatmap = value;
|
|
||||||
|
|
||||||
if (value != null)
|
|
||||||
{
|
|
||||||
coverContainer.FadeIn(transition_duration);
|
|
||||||
|
|
||||||
LoadComponentAsync(new BeatmapSetCover(value.BeatmapSet)
|
|
||||||
{
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
FillMode = FillMode.Fill,
|
|
||||||
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
|
|
||||||
},
|
|
||||||
coverContainer.Add);
|
|
||||||
|
|
||||||
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
|
|
||||||
beatmapDash.Text = @" - ";
|
|
||||||
beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
coverContainer.FadeOut(transition_duration);
|
|
||||||
|
|
||||||
beatmapTitle.Current = null;
|
|
||||||
beatmapArtist.Current = null;
|
|
||||||
|
|
||||||
beatmapTitle.Text = "Changing map";
|
|
||||||
beatmapDash.Text = beatmapArtist.Text = string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayParticipants(User[] value)
|
|
||||||
{
|
|
||||||
participantInfo.Participants = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,17 +25,9 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
{
|
{
|
||||||
public class RoomInspector : Container
|
public class RoomInspector : Container
|
||||||
{
|
{
|
||||||
private readonly MarginPadding contentPadding = new MarginPadding { Horizontal = 20, Vertical = 10 };
|
|
||||||
private const float transition_duration = 100;
|
private const float transition_duration = 100;
|
||||||
|
|
||||||
private readonly Box statusStrip;
|
private readonly MarginPadding contentPadding = new MarginPadding { Horizontal = 20, Vertical = 10 };
|
||||||
private readonly Container coverContainer;
|
|
||||||
private readonly FillFlowContainer topFlow, participantsFlow;
|
|
||||||
private readonly ModeTypeInfo modeTypeInfo;
|
|
||||||
private readonly OsuSpriteText participants, participantsSlash, maxParticipants, name, status, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor;
|
|
||||||
private readonly ParticipantInfo participantInfo;
|
|
||||||
private readonly ScrollContainer participantsScroll;
|
|
||||||
|
|
||||||
private readonly Bindable<string> nameBind = new Bindable<string>();
|
private readonly Bindable<string> nameBind = new Bindable<string>();
|
||||||
private readonly Bindable<User> hostBind = new Bindable<User>();
|
private readonly Bindable<User> hostBind = new Bindable<User>();
|
||||||
private readonly Bindable<RoomStatus> statusBind = new Bindable<RoomStatus>();
|
private readonly Bindable<RoomStatus> statusBind = new Bindable<RoomStatus>();
|
||||||
@ -45,10 +37,14 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
private readonly Bindable<User[]> participantsBind = new Bindable<User[]>();
|
private readonly Bindable<User[]> participantsBind = new Bindable<User[]>();
|
||||||
|
|
||||||
private OsuColour colours;
|
private OsuColour colours;
|
||||||
private LocalisationEngine localisation;
|
private Box statusStrip;
|
||||||
|
private Container coverContainer;
|
||||||
|
private FillFlowContainer topFlow, participantsFlow, participantNumbersFlow, infoPanelFlow;
|
||||||
|
private OsuSpriteText name, status;
|
||||||
|
private ScrollContainer participantsScroll;
|
||||||
|
private ParticipantInfo participantInfo;
|
||||||
|
|
||||||
private Room room;
|
private Room room;
|
||||||
|
|
||||||
public Room Room
|
public Room Room
|
||||||
{
|
{
|
||||||
get { return room; }
|
get { return room; }
|
||||||
@ -57,20 +53,36 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
if (value == room) return;
|
if (value == room) return;
|
||||||
room = value;
|
room = value;
|
||||||
|
|
||||||
nameBind.BindTo(Room.Name);
|
nameBind.UnbindBindings();
|
||||||
hostBind.BindTo(Room.Host);
|
hostBind.UnbindBindings();
|
||||||
statusBind.BindTo(Room.Status);
|
statusBind.UnbindBindings();
|
||||||
typeBind.BindTo(Room.Type);
|
typeBind.UnbindBindings();
|
||||||
beatmapBind.BindTo(Room.Beatmap);
|
beatmapBind.UnbindBindings();
|
||||||
maxParticipantsBind.BindTo(Room.MaxParticipants);
|
maxParticipantsBind.UnbindBindings();
|
||||||
participantsBind.BindTo(Room.Participants);
|
participantsBind.UnbindBindings();
|
||||||
|
|
||||||
|
if (room != null)
|
||||||
|
{
|
||||||
|
nameBind.BindTo(room.Name);
|
||||||
|
hostBind.BindTo(room.Host);
|
||||||
|
statusBind.BindTo(room.Status);
|
||||||
|
typeBind.BindTo(room.Type);
|
||||||
|
beatmapBind.BindTo(room.Beatmap);
|
||||||
|
maxParticipantsBind.BindTo(room.MaxParticipants);
|
||||||
|
participantsBind.BindTo(room.Participants);
|
||||||
|
}
|
||||||
|
|
||||||
|
updateState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public RoomInspector()
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours, LocalisationEngine localisation)
|
||||||
{
|
{
|
||||||
Width = 520;
|
this.colours = colours;
|
||||||
RelativeSizeAxes = Axes.Y;
|
|
||||||
|
ModeTypeInfo modeTypeInfo;
|
||||||
|
OsuSpriteText participants, participantsSlash, maxParticipants, beatmapTitle, beatmapDash, beatmapArtist, beatmapAuthor;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -120,7 +132,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
Padding = new MarginPadding(20),
|
Padding = new MarginPadding(20),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new FillFlowContainer
|
participantNumbersFlow = new FillFlowContainer
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
@ -178,6 +190,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
Direction = FillDirection.Vertical,
|
Direction = FillDirection.Vertical,
|
||||||
|
LayoutDuration = transition_duration,
|
||||||
Padding = contentPadding,
|
Padding = contentPadding,
|
||||||
Spacing = new Vector2(0f, 5f),
|
Spacing = new Vector2(0f, 5f),
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
@ -187,7 +200,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
Font = @"Exo2.0-Bold",
|
Font = @"Exo2.0-Bold",
|
||||||
},
|
},
|
||||||
new FillFlowContainer
|
infoPanelFlow = new FillFlowContainer
|
||||||
{
|
{
|
||||||
AutoSizeAxes = Axes.X,
|
AutoSizeAxes = Axes.X,
|
||||||
Height = 30,
|
Height = 30,
|
||||||
@ -229,6 +242,7 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
TextSize = 14,
|
TextSize = 14,
|
||||||
|
Colour = colours.Gray9,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -269,27 +283,68 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
nameBind.ValueChanged += displayName;
|
nameBind.ValueChanged += n => name.Text = n;
|
||||||
hostBind.ValueChanged += displayUser;
|
hostBind.ValueChanged += h => participantInfo.Host = h;
|
||||||
typeBind.ValueChanged += displayGameType;
|
typeBind.ValueChanged += t => modeTypeInfo.Type = t;
|
||||||
maxParticipantsBind.ValueChanged += displayMaxParticipants;
|
|
||||||
participantsBind.ValueChanged += displayParticipants;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load(OsuColour colours, LocalisationEngine localisation)
|
|
||||||
{
|
|
||||||
this.localisation = localisation;
|
|
||||||
this.colours = colours;
|
|
||||||
|
|
||||||
beatmapAuthor.Colour = colours.Gray9;
|
|
||||||
|
|
||||||
//binded here instead of ctor because dependencies are needed
|
|
||||||
statusBind.ValueChanged += displayStatus;
|
statusBind.ValueChanged += displayStatus;
|
||||||
beatmapBind.ValueChanged += displayBeatmap;
|
|
||||||
|
|
||||||
statusBind.TriggerChange();
|
beatmapBind.ValueChanged += b =>
|
||||||
beatmapBind.TriggerChange();
|
{
|
||||||
|
modeTypeInfo.Beatmap = b;
|
||||||
|
|
||||||
|
if (b != null)
|
||||||
|
{
|
||||||
|
coverContainer.FadeIn(transition_duration);
|
||||||
|
|
||||||
|
LoadComponentAsync(new BeatmapSetCover(b.BeatmapSet)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
FillMode = FillMode.Fill,
|
||||||
|
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
|
||||||
|
}, coverContainer.Add);
|
||||||
|
|
||||||
|
beatmapTitle.Current = localisation.GetUnicodePreference(b.Metadata.TitleUnicode, b.Metadata.Title);
|
||||||
|
beatmapDash.Text = @" - ";
|
||||||
|
beatmapArtist.Current = localisation.GetUnicodePreference(b.Metadata.ArtistUnicode, b.Metadata.Artist);
|
||||||
|
beatmapAuthor.Text = $"mapped by {b.Metadata.Author}";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
coverContainer.FadeOut(transition_duration);
|
||||||
|
|
||||||
|
beatmapTitle.Current = null;
|
||||||
|
beatmapArtist.Current = null;
|
||||||
|
|
||||||
|
beatmapTitle.Text = "Changing map";
|
||||||
|
beatmapDash.Text = beatmapArtist.Text = beatmapAuthor.Text = string.Empty;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
maxParticipantsBind.ValueChanged += m =>
|
||||||
|
{
|
||||||
|
if (m == null)
|
||||||
|
{
|
||||||
|
participantsSlash.FadeOut(transition_duration);
|
||||||
|
maxParticipants.FadeOut(transition_duration);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
participantsSlash.FadeIn(transition_duration);
|
||||||
|
maxParticipants.FadeIn(transition_duration);
|
||||||
|
maxParticipants.Text = m.ToString();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
participantsBind.ValueChanged += p =>
|
||||||
|
{
|
||||||
|
participants.Text = p.Length.ToString();
|
||||||
|
participantInfo.Participants = p;
|
||||||
|
participantsFlow.ChildrenEnumerable = p.Select(u => new UserTile(u));
|
||||||
|
};
|
||||||
|
|
||||||
|
updateState();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void UpdateAfterChildren()
|
protected override void UpdateAfterChildren()
|
||||||
@ -299,84 +354,39 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
participantsScroll.Height = DrawHeight - topFlow.DrawHeight;
|
participantsScroll.Height = DrawHeight - topFlow.DrawHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayName(string value)
|
private void displayStatus(RoomStatus s)
|
||||||
{
|
{
|
||||||
name.Text = value;
|
status.Text = s.Message;
|
||||||
|
|
||||||
|
Color4 c = s.GetAppropriateColour(colours);
|
||||||
|
statusStrip.FadeColour(c, transition_duration);
|
||||||
|
status.FadeColour(c, transition_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void displayUser(User value)
|
private void updateState()
|
||||||
{
|
{
|
||||||
participantInfo.Host = value;
|
if (Room == null)
|
||||||
}
|
|
||||||
|
|
||||||
private void displayStatus(RoomStatus value)
|
|
||||||
{
|
|
||||||
status.Text = value.Message;
|
|
||||||
|
|
||||||
foreach (Drawable d in new Drawable[] { statusStrip, status })
|
|
||||||
d.FadeColour(value.GetAppropriateColour(colours), transition_duration);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayGameType(GameType value)
|
|
||||||
{
|
|
||||||
modeTypeInfo.Type = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayBeatmap(BeatmapInfo value)
|
|
||||||
{
|
|
||||||
modeTypeInfo.Beatmap = value;
|
|
||||||
|
|
||||||
if (value != null)
|
|
||||||
{
|
|
||||||
coverContainer.FadeIn(transition_duration);
|
|
||||||
|
|
||||||
LoadComponentAsync(new BeatmapSetCover(value.BeatmapSet)
|
|
||||||
{
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
Anchor = Anchor.Centre,
|
|
||||||
Origin = Anchor.Centre,
|
|
||||||
FillMode = FillMode.Fill,
|
|
||||||
OnLoadComplete = d => d.FadeInFromZero(400, Easing.Out),
|
|
||||||
},
|
|
||||||
coverContainer.Add);
|
|
||||||
|
|
||||||
beatmapTitle.Current = localisation.GetUnicodePreference(value.Metadata.TitleUnicode, value.Metadata.Title);
|
|
||||||
beatmapDash.Text = @" - ";
|
|
||||||
beatmapArtist.Current = localisation.GetUnicodePreference(value.Metadata.ArtistUnicode, value.Metadata.Artist);
|
|
||||||
beatmapAuthor.Text = $"mapped by {value.Metadata.Author}";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
coverContainer.FadeOut(transition_duration);
|
coverContainer.FadeOut(transition_duration);
|
||||||
|
participantsFlow.FadeOut(transition_duration);
|
||||||
|
participantNumbersFlow.FadeOut(transition_duration);
|
||||||
|
infoPanelFlow.FadeOut(transition_duration);
|
||||||
|
name.FadeOut(transition_duration);
|
||||||
|
participantInfo.FadeOut(transition_duration);
|
||||||
|
|
||||||
beatmapTitle.Current = null;
|
displayStatus(new RoomStatusNoneSelected());
|
||||||
beatmapArtist.Current = null;
|
|
||||||
|
|
||||||
beatmapTitle.Text = "Changing map";
|
|
||||||
beatmapDash.Text = beatmapArtist.Text = beatmapAuthor.Text = string.Empty;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void displayMaxParticipants(int? value)
|
|
||||||
{
|
|
||||||
if (value == null)
|
|
||||||
{
|
|
||||||
participantsSlash.FadeOut(transition_duration);
|
|
||||||
maxParticipants.FadeOut(transition_duration);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
participantsSlash.FadeIn(transition_duration);
|
participantsFlow.FadeIn(transition_duration);
|
||||||
maxParticipants.FadeIn(transition_duration);
|
participantNumbersFlow.FadeIn(transition_duration);
|
||||||
maxParticipants.Text = value.ToString();
|
infoPanelFlow.FadeIn(transition_duration);
|
||||||
}
|
name.FadeIn(transition_duration);
|
||||||
}
|
participantInfo.FadeIn(transition_duration);
|
||||||
|
|
||||||
private void displayParticipants(User[] value)
|
statusBind.TriggerChange();
|
||||||
{
|
beatmapBind.TriggerChange();
|
||||||
participants.Text = value.Length.ToString();
|
}
|
||||||
participantInfo.Participants = value;
|
|
||||||
participantsFlow.ChildrenEnumerable = value.Select(u => new UserTile(u));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private class UserTile : Container, IHasTooltip
|
private class UserTile : Container, IHasTooltip
|
||||||
@ -407,5 +417,11 @@ namespace osu.Game.Screens.Multi.Components
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class RoomStatusNoneSelected : RoomStatus
|
||||||
|
{
|
||||||
|
public override string Message => @"No Room Selected";
|
||||||
|
public override Color4 GetAppropriateColour(OsuColour colours) => colours.Gray8;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -32,12 +32,19 @@ namespace osu.Game.Screens
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual BackgroundScreen CreateBackground() => null;
|
protected virtual BackgroundScreen CreateBackground() => null;
|
||||||
|
|
||||||
protected BindableBool ShowOverlays = new BindableBool();
|
private readonly BindableBool hideOverlaysOnEnter = new BindableBool();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether overlays should be shown when this screen is entered or resumed.
|
/// Whether overlays should be hidden when this screen is entered or resumed.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual bool ShowOverlaysOnEnter => true;
|
protected virtual bool HideOverlaysOnEnter => false;
|
||||||
|
|
||||||
|
private readonly BindableBool allowOpeningOverlays = new BindableBool();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether overlays should be able to be opened while this screen is active.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual bool AllowOpeningOverlays => true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed.
|
/// Whether this <see cref="OsuScreen"/> allows the cursor to be displayed.
|
||||||
@ -88,7 +95,8 @@ namespace osu.Game.Screens
|
|||||||
if (osuGame != null)
|
if (osuGame != null)
|
||||||
{
|
{
|
||||||
Ruleset.BindTo(osuGame.Ruleset);
|
Ruleset.BindTo(osuGame.Ruleset);
|
||||||
ShowOverlays.BindTo(osuGame.ShowOverlays);
|
hideOverlaysOnEnter.BindTo(osuGame.HideOverlaysOnEnter);
|
||||||
|
allowOpeningOverlays.BindTo(osuGame.AllowOpeningOverlays);
|
||||||
}
|
}
|
||||||
|
|
||||||
sampleExit = audio.Sample.Get(@"UI/screen-back");
|
sampleExit = audio.Sample.Get(@"UI/screen-back");
|
||||||
@ -220,7 +228,8 @@ namespace osu.Game.Screens
|
|||||||
if (backgroundParallaxContainer != null)
|
if (backgroundParallaxContainer != null)
|
||||||
backgroundParallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * BackgroundParallaxAmount;
|
backgroundParallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * BackgroundParallaxAmount;
|
||||||
|
|
||||||
ShowOverlays.Value = ShowOverlaysOnEnter;
|
hideOverlaysOnEnter.Value = HideOverlaysOnEnter;
|
||||||
|
allowOpeningOverlays.Value = AllowOpeningOverlays;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onExitingLogo()
|
private void onExitingLogo()
|
||||||
|
198
osu.Game/Screens/Play/HUD/QuitButton.cs
Normal file
198
osu.Game/Screens/Play/HUD/QuitButton.cs
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
using osu.Framework.Input;
|
||||||
|
using osu.Framework.MathUtils;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using OpenTK;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Play.HUD
|
||||||
|
{
|
||||||
|
public class QuitButton : FillFlowContainer
|
||||||
|
{
|
||||||
|
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => true;
|
||||||
|
|
||||||
|
private readonly Button button;
|
||||||
|
|
||||||
|
public Action Action
|
||||||
|
{
|
||||||
|
set => button.Action = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
private readonly OsuSpriteText text;
|
||||||
|
|
||||||
|
public QuitButton()
|
||||||
|
{
|
||||||
|
Direction = FillDirection.Horizontal;
|
||||||
|
Spacing = new Vector2(20, 0);
|
||||||
|
Margin = new MarginPadding(10);
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
text = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = "hold for menu",
|
||||||
|
Font = @"Exo2.0-Bold",
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft
|
||||||
|
},
|
||||||
|
button = new Button
|
||||||
|
{
|
||||||
|
HoverGained = () => text.FadeIn(500, Easing.OutQuint),
|
||||||
|
HoverLost = () => text.FadeOut(500, Easing.OutQuint)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
AutoSizeAxes = Axes.Both;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
text.FadeInFromZero(500, Easing.OutQuint).Delay(1500).FadeOut(500, Easing.OutQuint);
|
||||||
|
base.LoadComplete();
|
||||||
|
}
|
||||||
|
|
||||||
|
private float positionalAdjust;
|
||||||
|
|
||||||
|
protected override bool OnMouseMove(InputState state)
|
||||||
|
{
|
||||||
|
positionalAdjust = Vector2.Distance(state.Mouse.NativeState.Position, button.ScreenSpaceDrawQuad.Centre) / 200;
|
||||||
|
return base.OnMouseMove(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
if (text.Alpha > 0 || button.Progress.Value > 0 || button.IsHovered)
|
||||||
|
Alpha = 1;
|
||||||
|
else
|
||||||
|
Alpha = Interpolation.ValueAt(
|
||||||
|
MathHelper.Clamp(Clock.ElapsedFrameTime, 0, 1000),
|
||||||
|
Alpha, MathHelper.Clamp(1 - positionalAdjust, 0.04f, 1), 0, 200, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
|
||||||
|
private class Button : HoldToConfirmContainer
|
||||||
|
{
|
||||||
|
private SpriteIcon icon;
|
||||||
|
private CircularProgress circularProgress;
|
||||||
|
private Circle overlayCircle;
|
||||||
|
|
||||||
|
protected override bool AllowMultipleFires => true;
|
||||||
|
|
||||||
|
public Action HoverGained;
|
||||||
|
public Action HoverLost;
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OsuColour colours)
|
||||||
|
{
|
||||||
|
Size = new Vector2(60);
|
||||||
|
|
||||||
|
Child = new CircularContainer
|
||||||
|
{
|
||||||
|
Masking = true,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Box
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colours.Gray1,
|
||||||
|
Alpha = 0.5f,
|
||||||
|
},
|
||||||
|
circularProgress = new CircularProgress
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
InnerRadius = 1
|
||||||
|
},
|
||||||
|
overlayCircle = new Circle
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Colour = colours.Gray1,
|
||||||
|
Size = new Vector2(0.9f),
|
||||||
|
},
|
||||||
|
icon = new SpriteIcon
|
||||||
|
{
|
||||||
|
Shadow = false,
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(15),
|
||||||
|
Icon = FontAwesome.fa_close
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
bind();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void bind()
|
||||||
|
{
|
||||||
|
circularProgress.Current.BindTo(Progress);
|
||||||
|
Progress.ValueChanged += v => icon.Scale = new Vector2(1 + (float)v * 0.2f);
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool pendingAnimation;
|
||||||
|
|
||||||
|
protected override void Confirm()
|
||||||
|
{
|
||||||
|
base.Confirm();
|
||||||
|
|
||||||
|
// temporarily unbind as to not look weird if releasing during confirm animation (can see the unwind of progress).
|
||||||
|
Progress.UnbindAll();
|
||||||
|
|
||||||
|
// avoid starting a new confirm call until we finish animating.
|
||||||
|
pendingAnimation = true;
|
||||||
|
|
||||||
|
Progress.Value = 0;
|
||||||
|
|
||||||
|
overlayCircle.ScaleTo(0, 100)
|
||||||
|
.Then().FadeOut().ScaleTo(1).FadeIn(500)
|
||||||
|
.OnComplete(a =>
|
||||||
|
{
|
||||||
|
icon.ScaleTo(1, 100);
|
||||||
|
circularProgress.FadeOut(100).OnComplete(_ =>
|
||||||
|
{
|
||||||
|
bind();
|
||||||
|
|
||||||
|
circularProgress.FadeIn();
|
||||||
|
pendingAnimation = false;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnHover(InputState state)
|
||||||
|
{
|
||||||
|
HoverGained?.Invoke();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnHoverLost(InputState state)
|
||||||
|
{
|
||||||
|
HoverLost?.Invoke();
|
||||||
|
base.OnHoverLost(state);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
|
{
|
||||||
|
if (!pendingAnimation && state.Mouse.Buttons.Count == 1)
|
||||||
|
BeginConfirm();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override bool OnMouseUp(InputState state, MouseUpEventArgs args)
|
||||||
|
{
|
||||||
|
if (state.Mouse.Buttons.Count == 0)
|
||||||
|
AbortConfirm();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -34,6 +34,7 @@ namespace osu.Game.Screens.Play
|
|||||||
public readonly HealthDisplay HealthDisplay;
|
public readonly HealthDisplay HealthDisplay;
|
||||||
public readonly SongProgress Progress;
|
public readonly SongProgress Progress;
|
||||||
public readonly ModDisplay ModDisplay;
|
public readonly ModDisplay ModDisplay;
|
||||||
|
public readonly QuitButton HoldToQuit;
|
||||||
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
|
public readonly PlayerSettingsOverlay PlayerSettingsOverlay;
|
||||||
|
|
||||||
private Bindable<bool> showHud;
|
private Bindable<bool> showHud;
|
||||||
@ -51,14 +52,26 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
KeyCounter = CreateKeyCounter(),
|
|
||||||
ComboCounter = CreateComboCounter(),
|
ComboCounter = CreateComboCounter(),
|
||||||
ScoreCounter = CreateScoreCounter(),
|
ScoreCounter = CreateScoreCounter(),
|
||||||
AccuracyCounter = CreateAccuracyCounter(),
|
AccuracyCounter = CreateAccuracyCounter(),
|
||||||
HealthDisplay = CreateHealthDisplay(),
|
HealthDisplay = CreateHealthDisplay(),
|
||||||
Progress = CreateProgress(),
|
Progress = CreateProgress(),
|
||||||
ModDisplay = CreateModsContainer(),
|
ModDisplay = CreateModsContainer(),
|
||||||
PlayerSettingsOverlay = CreatePlayerSettingsOverlay()
|
PlayerSettingsOverlay = CreatePlayerSettingsOverlay(),
|
||||||
|
new FillFlowContainer
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomRight,
|
||||||
|
Origin = Anchor.BottomRight,
|
||||||
|
Position = -new Vector2(5, TwoLayerButton.SIZE_RETRACTED.Y),
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
KeyCounter = CreateKeyCounter(),
|
||||||
|
HoldToQuit = CreateQuitButton(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -187,7 +200,6 @@ namespace osu.Game.Screens.Play
|
|||||||
Anchor = Anchor.BottomRight,
|
Anchor = Anchor.BottomRight,
|
||||||
Origin = Anchor.BottomRight,
|
Origin = Anchor.BottomRight,
|
||||||
Margin = new MarginPadding(10),
|
Margin = new MarginPadding(10),
|
||||||
Y = -TwoLayerButton.SIZE_RETRACTED.Y,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
protected virtual ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
|
protected virtual ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
|
||||||
@ -205,6 +217,12 @@ namespace osu.Game.Screens.Play
|
|||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
protected virtual QuitButton CreateQuitButton() => new QuitButton
|
||||||
|
{
|
||||||
|
Anchor = Anchor.BottomRight,
|
||||||
|
Origin = Anchor.BottomRight,
|
||||||
|
};
|
||||||
|
|
||||||
protected virtual ModDisplay CreateModsContainer() => new ModDisplay
|
protected virtual ModDisplay CreateModsContainer() => new ModDisplay
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
protected override float BackgroundParallaxAmount => 0.1f;
|
protected override float BackgroundParallaxAmount => 0.1f;
|
||||||
|
|
||||||
public override bool ShowOverlaysOnEnter => false;
|
protected override bool HideOverlaysOnEnter => true;
|
||||||
|
|
||||||
public Action RestartRequested;
|
public Action RestartRequested;
|
||||||
|
|
||||||
@ -183,6 +183,7 @@ namespace osu.Game.Screens.Play
|
|||||||
ProcessCustomClock = false,
|
ProcessCustomClock = false,
|
||||||
Breaks = beatmap.Breaks
|
Breaks = beatmap.Breaks
|
||||||
},
|
},
|
||||||
|
RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
|
||||||
hudOverlay = new HUDOverlay(scoreProcessor, RulesetContainer, working, offsetClock, adjustableClock)
|
hudOverlay = new HUDOverlay(scoreProcessor, RulesetContainer, working, offsetClock, adjustableClock)
|
||||||
{
|
{
|
||||||
Clock = Clock, // hud overlay doesn't want to use the audio clock directly
|
Clock = Clock, // hud overlay doesn't want to use the audio clock directly
|
||||||
@ -190,7 +191,6 @@ namespace osu.Game.Screens.Play
|
|||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre
|
Origin = Anchor.Centre
|
||||||
},
|
},
|
||||||
RulesetContainer.Cursor?.CreateProxy() ?? new Container(),
|
|
||||||
new SkipOverlay(firstObjectTime)
|
new SkipOverlay(firstObjectTime)
|
||||||
{
|
{
|
||||||
Clock = Clock, // skip button doesn't want to use the audio clock directly
|
Clock = Clock, // skip button doesn't want to use the audio clock directly
|
||||||
@ -219,6 +219,8 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
hudOverlay.HoldToQuit.Action = Exit;
|
||||||
|
|
||||||
if (ShowStoryboard)
|
if (ShowStoryboard)
|
||||||
initializeStoryboard(false);
|
initializeStoryboard(false);
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private BeatmapMetadataDisplay info;
|
private BeatmapMetadataDisplay info;
|
||||||
|
|
||||||
private bool showOverlays = true;
|
private bool hideOverlays;
|
||||||
public override bool ShowOverlaysOnEnter => showOverlays;
|
protected override bool HideOverlaysOnEnter => hideOverlays;
|
||||||
|
|
||||||
private Task loadTask;
|
private Task loadTask;
|
||||||
|
|
||||||
@ -36,7 +36,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
player.RestartRequested = () =>
|
player.RestartRequested = () =>
|
||||||
{
|
{
|
||||||
showOverlays = false;
|
hideOverlays = true;
|
||||||
ValidForResume = true;
|
ValidForResume = true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,5 @@ namespace osu.Game.Screens.Select
|
|||||||
protected override bool OnMouseMove(InputState state) => true;
|
protected override bool OnMouseMove(InputState state) => true;
|
||||||
|
|
||||||
protected override bool OnClick(InputState state) => true;
|
protected override bool OnClick(InputState state) => true;
|
||||||
|
|
||||||
protected override bool OnDragStart(InputState state) => true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,5 @@ namespace osu.Game.Screens.Select
|
|||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args) => true;
|
||||||
|
|
||||||
protected override bool OnClick(InputState state) => true;
|
protected override bool OnClick(InputState state) => true;
|
||||||
|
|
||||||
protected override bool OnDragStart(InputState state) => true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace osu.Game.Screens.Tournament
|
|||||||
{
|
{
|
||||||
private const string results_filename = "drawings_results.txt";
|
private const string results_filename = "drawings_results.txt";
|
||||||
|
|
||||||
public override bool ShowOverlaysOnEnter => false;
|
protected override bool HideOverlaysOnEnter => true;
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user