mirror of
https://github.com/ppy/osu.git
synced 2025-02-20 18:43:04 +08:00
Add statefulness to MenuCursor.
This commit is contained in:
parent
7110ab8e17
commit
f9f31ca092
@ -55,6 +55,20 @@ namespace osu.Game.Graphics.Cursor
|
||||
return base.OnDragStart(state);
|
||||
}
|
||||
|
||||
protected override void PopIn()
|
||||
{
|
||||
ActiveCursor.FadeTo(1, 250, EasingTypes.OutQuint);
|
||||
ActiveCursor.ScaleTo(1, 1000, EasingTypes.OutElastic);
|
||||
}
|
||||
|
||||
protected override void PopOut()
|
||||
{
|
||||
ActiveCursor.FadeTo(0, 1400, EasingTypes.OutQuint);
|
||||
ActiveCursor.ScaleTo(1.1f, 100, EasingTypes.Out);
|
||||
ActiveCursor.Delay(100);
|
||||
ActiveCursor.ScaleTo(0, 500, EasingTypes.In);
|
||||
}
|
||||
|
||||
public class Cursor : Container
|
||||
{
|
||||
private Container cursorContainer;
|
||||
|
@ -220,7 +220,7 @@ namespace osu.Game
|
||||
}
|
||||
};
|
||||
|
||||
Cursor.Alpha = 0;
|
||||
Cursor.State = Visibility.Hidden;
|
||||
}
|
||||
|
||||
private bool globalHotkeyPressed(InputState state, KeyDownEventArgs args)
|
||||
@ -264,10 +264,20 @@ namespace osu.Game
|
||||
|
||||
private Container overlayContent;
|
||||
|
||||
private OsuScreen currentScreen;
|
||||
|
||||
private void screenChanged(Screen newScreen)
|
||||
{
|
||||
currentScreen = newScreen as OsuScreen;
|
||||
|
||||
if (currentScreen == null)
|
||||
{
|
||||
Exit();
|
||||
return;
|
||||
}
|
||||
|
||||
//central game mode change logic.
|
||||
if ((newScreen as OsuScreen)?.ShowOverlays != true)
|
||||
if (currentScreen.ShowOverlays != true)
|
||||
{
|
||||
Toolbar.State = Visibility.Hidden;
|
||||
musicController.State = Visibility.Hidden;
|
||||
@ -278,13 +288,7 @@ namespace osu.Game
|
||||
Toolbar.State = Visibility.Visible;
|
||||
}
|
||||
|
||||
if (newScreen is MainMenu)
|
||||
Cursor.FadeIn(100);
|
||||
|
||||
ScreenChanged?.Invoke(newScreen);
|
||||
|
||||
if (newScreen == null)
|
||||
Exit();
|
||||
}
|
||||
|
||||
protected override bool OnExiting()
|
||||
@ -308,6 +312,8 @@ namespace osu.Game
|
||||
|
||||
if (intro?.ChildScreen != null)
|
||||
intro.ChildScreen.Padding = new MarginPadding { Top = Toolbar.Position.Y + Toolbar.DrawHeight };
|
||||
|
||||
Cursor.State = currentScreen == null || currentScreen.HasLocalCursorDisplayed ? Visibility.Hidden : Visibility.Visible;
|
||||
}
|
||||
|
||||
private void screenAdded(Screen newScreen)
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game
|
||||
|
||||
private RatioAdjust ratioContainer;
|
||||
|
||||
protected CursorContainer Cursor;
|
||||
protected MenuCursor Cursor;
|
||||
|
||||
public readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
|
@ -21,6 +21,8 @@ namespace osu.Game.Screens.Menu
|
||||
|
||||
internal override bool ShowOverlays => false;
|
||||
|
||||
internal override bool HasLocalCursorDisplayed => false;
|
||||
|
||||
public Disclaimer()
|
||||
{
|
||||
ValidForResume = false;
|
||||
|
@ -28,6 +28,8 @@ namespace osu.Game.Screens.Menu
|
||||
private SampleChannel seeya;
|
||||
private Track bgm;
|
||||
|
||||
internal override bool HasLocalCursorDisplayed => true;
|
||||
|
||||
internal override bool ShowOverlays => false;
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenEmpty();
|
||||
|
@ -24,6 +24,8 @@ namespace osu.Game.Screens
|
||||
|
||||
protected new OsuGameBase Game => base.Game as OsuGameBase;
|
||||
|
||||
internal virtual bool HasLocalCursorDisplayed => false;
|
||||
|
||||
private readonly Bindable<WorkingBeatmap> beatmap = new Bindable<WorkingBeatmap>();
|
||||
|
||||
public WorkingBeatmap Beatmap
|
||||
|
@ -32,6 +32,10 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
internal override bool ShowOverlays => false;
|
||||
|
||||
internal override bool HasLocalCursorDisplayed => !hasReplayLoaded && !IsPaused;
|
||||
|
||||
private bool hasReplayLoaded => hitRenderer.InputManager.ReplayInputHandler != null;
|
||||
|
||||
public BeatmapInfo BeatmapInfo;
|
||||
|
||||
public bool IsPaused { get; private set; }
|
||||
@ -304,7 +308,7 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
if (pauseOverlay == null) return false;
|
||||
|
||||
if (hitRenderer.InputManager.ReplayInputHandler != null)
|
||||
if (hasReplayLoaded)
|
||||
return false;
|
||||
|
||||
if (pauseOverlay.State != Visibility.Visible && !canPause) return true;
|
||||
|
Loading…
Reference in New Issue
Block a user