mirror of
https://github.com/ppy/osu
synced 2025-02-04 12:21:58 +00:00
Single Visibility enum type.
This commit is contained in:
parent
b7976dce46
commit
acd54d1ebc
osu.Game
@ -31,7 +31,7 @@ namespace osu.Game
|
||||
{
|
||||
public string Path;
|
||||
}
|
||||
|
||||
|
||||
public Toolbar Toolbar;
|
||||
public ChatConsole Chat;
|
||||
public MainMenu MainMenu => intro?.ChildGameMode as MainMenu;
|
||||
@ -40,7 +40,7 @@ namespace osu.Game
|
||||
private IpcChannel<ImportBeatmap> BeatmapIPC;
|
||||
|
||||
public Bindable<PlayMode> PlayMode;
|
||||
|
||||
|
||||
public OsuGame(string[] args)
|
||||
{
|
||||
this.args = args;
|
||||
@ -56,7 +56,7 @@ namespace osu.Game
|
||||
public override void Load(BaseGame game)
|
||||
{
|
||||
BeatmapIPC = new IpcChannel<ImportBeatmap>(Host);
|
||||
|
||||
|
||||
if (!Host.IsPrimaryInstance)
|
||||
{
|
||||
if (args.Length == 1 && File.Exists(args[0]))
|
||||
@ -83,7 +83,7 @@ namespace osu.Game
|
||||
Console.WriteLine($@"Failed to import beatmap: {ex}");
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
base.Load(game);
|
||||
|
||||
//attach our bindables to the audio subsystem.
|
||||
@ -113,10 +113,10 @@ namespace osu.Game
|
||||
}
|
||||
});
|
||||
|
||||
Toolbar.State = ToolbarState.Hidden;
|
||||
Toolbar.State = Visibility.Hidden;
|
||||
Toolbar.Flush();
|
||||
|
||||
Chat.State = ChatConsoleState.Hidden;
|
||||
Chat.State = Visibility.Hidden;
|
||||
Chat.Flush();
|
||||
|
||||
intro.ModePushed += modeAdded;
|
||||
@ -134,10 +134,10 @@ namespace osu.Game
|
||||
switch (args.Key)
|
||||
{
|
||||
case Key.F8:
|
||||
Chat.State = Chat.State == ChatConsoleState.Hidden ? ChatConsoleState.Visible : ChatConsoleState.Hidden;
|
||||
Chat.State = Chat.State.Reverse();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return base.OnKeyDown(state, args);
|
||||
}
|
||||
|
||||
@ -152,12 +152,12 @@ namespace osu.Game
|
||||
//central game mode change logic.
|
||||
if (newMode is Player || newMode is Intro)
|
||||
{
|
||||
Toolbar.State = ToolbarState.Hidden;
|
||||
Chat.State = ChatConsoleState.Hidden;
|
||||
Toolbar.State = Visibility.Hidden;
|
||||
Chat.State = Visibility.Hidden;
|
||||
}
|
||||
else
|
||||
{
|
||||
Toolbar.State = ToolbarState.Visible;
|
||||
Toolbar.State = Visibility.Visible;
|
||||
}
|
||||
|
||||
Cursor.FadeIn(100);
|
||||
@ -178,7 +178,7 @@ namespace osu.Game
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return base.OnExiting();
|
||||
}
|
||||
|
||||
|
@ -25,7 +25,7 @@ using osu.Framework;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class ChatConsole : Container, IStateful<ChatConsoleState>
|
||||
public class ChatConsole : Container, IStateful<Visibility>
|
||||
{
|
||||
private ChannelDisplay channelDisplay;
|
||||
|
||||
@ -140,9 +140,9 @@ namespace osu.Game.Overlays
|
||||
api.Queue(fetchReq);
|
||||
}
|
||||
|
||||
private ChatConsoleState state;
|
||||
private Visibility state;
|
||||
|
||||
public ChatConsoleState State
|
||||
public Visibility State
|
||||
{
|
||||
get { return state; }
|
||||
|
||||
@ -154,11 +154,11 @@ namespace osu.Game.Overlays
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case ChatConsoleState.Hidden:
|
||||
case Visibility.Hidden:
|
||||
MoveToY(-Size.Y, transition_length, EasingTypes.InQuint);
|
||||
FadeOut(transition_length, EasingTypes.InQuint);
|
||||
break;
|
||||
case ChatConsoleState.Visible:
|
||||
case Visibility.Visible:
|
||||
MoveToY(0, transition_length, EasingTypes.OutQuint);
|
||||
FadeIn(transition_length, EasingTypes.OutQuint);
|
||||
break;
|
||||
@ -166,10 +166,4 @@ namespace osu.Game.Overlays
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum ChatConsoleState
|
||||
{
|
||||
Visible,
|
||||
Hidden,
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ using osu.Framework;
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public class Toolbar : Container, IStateful<ToolbarState>
|
||||
public class Toolbar : Container, IStateful<Visibility>
|
||||
{
|
||||
const float height = 50;
|
||||
|
||||
@ -26,9 +26,9 @@ namespace osu.Game.Overlays
|
||||
|
||||
private ToolbarModeSelector modeSelector;
|
||||
|
||||
private ToolbarState state;
|
||||
private Visibility state;
|
||||
|
||||
public ToolbarState State
|
||||
public Visibility State
|
||||
{
|
||||
get { return state; }
|
||||
set
|
||||
@ -39,11 +39,11 @@ namespace osu.Game.Overlays
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case ToolbarState.Hidden:
|
||||
case Visibility.Hidden:
|
||||
MoveToY(-Size.Y, transition_time, EasingTypes.InQuint);
|
||||
FadeOut(transition_time, EasingTypes.InQuint);
|
||||
break;
|
||||
case ToolbarState.Visible:
|
||||
case Visibility.Visible:
|
||||
MoveToY(0, transition_time, EasingTypes.OutQuint);
|
||||
FadeIn(transition_time, EasingTypes.OutQuint);
|
||||
break;
|
||||
@ -119,10 +119,4 @@ namespace osu.Game.Overlays
|
||||
|
||||
public void SetGameMode(PlayMode mode) => modeSelector.SetGameMode(mode);
|
||||
}
|
||||
|
||||
public enum ToolbarState
|
||||
{
|
||||
Visible,
|
||||
Hidden,
|
||||
}
|
||||
}
|
||||
|
17
osu.Game/Overlays/Visibility.cs
Normal file
17
osu.Game/Overlays/Visibility.cs
Normal file
@ -0,0 +1,17 @@
|
||||
//Copyright (c) 2007-2016 ppy Pty Ltd <contact@ppy.sh>.
|
||||
//Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
namespace osu.Game.Overlays
|
||||
{
|
||||
public enum Visibility
|
||||
{
|
||||
Hidden,
|
||||
Visible
|
||||
}
|
||||
|
||||
public static class OverlayVisibilityHelper
|
||||
{
|
||||
public static Visibility Reverse(this Visibility input)
|
||||
=> input == Visibility.Visible ? Visibility.Hidden : Visibility.Visible;
|
||||
}
|
||||
}
|
@ -160,6 +160,7 @@
|
||||
<Compile Include="Overlays\ToolbarButton.cs" />
|
||||
<Compile Include="Overlays\ToolbarModeButton.cs" />
|
||||
<Compile Include="Overlays\ToolbarModeSelector.cs" />
|
||||
<Compile Include="Overlays\Visibility.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Users\User.cs" />
|
||||
<Compile Include="VolumeControl.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user