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