mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Remove unsused variable + IStateful Implementation
This commit is contained in:
@ -1,8 +1,9 @@
|
|||||||
// 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 OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
|
using osu.Framework;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Primitives;
|
using osu.Framework.Graphics.Primitives;
|
||||||
@ -14,8 +15,35 @@ using osu.Game.Graphics.Sprites;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Multiplayer
|
namespace osu.Game.Screens.Multiplayer
|
||||||
{
|
{
|
||||||
public class MultiRoomPanel : ClickableContainer
|
public class MultiRoomPanel : ClickableContainer, IStateful<MultiRoomPanel.PanelState>
|
||||||
{
|
{
|
||||||
|
private PanelState state;
|
||||||
|
public PanelState State
|
||||||
|
{
|
||||||
|
get { return state; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (state == value)
|
||||||
|
return;
|
||||||
|
|
||||||
|
state = value;
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case PanelState.Free:
|
||||||
|
statusColour = ColourFree;
|
||||||
|
statusString = "Welcoming Players";
|
||||||
|
UpdatePanel(this);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PanelState.Busy:
|
||||||
|
statusColour = ColourBusy;
|
||||||
|
statusString = "Now Playing";
|
||||||
|
UpdatePanel(this);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool didClick;
|
private bool didClick;
|
||||||
private string roomName;
|
private string roomName;
|
||||||
private string hostName;
|
private string hostName;
|
||||||
@ -29,15 +57,12 @@ namespace osu.Game.Screens.Multiplayer
|
|||||||
private OsuSpriteText statusSprite;
|
private OsuSpriteText statusSprite;
|
||||||
private OsuSpriteText roomSprite;
|
private OsuSpriteText roomSprite;
|
||||||
|
|
||||||
public const int BORDER_SIZE = 3;
|
|
||||||
public const int PANEL_HEIGHT = 90;
|
public const int PANEL_HEIGHT = 90;
|
||||||
|
public const int CONTENT_PADDING = 5;
|
||||||
|
|
||||||
public Color4 ColourFree = new Color4(166, 204, 0, 255);
|
public Color4 ColourFree = new Color4(166, 204, 0, 255);
|
||||||
public Color4 ColourBusy = new Color4(135, 102, 237, 255);
|
public Color4 ColourBusy = new Color4(135, 102, 237, 255);
|
||||||
|
|
||||||
public int CONTENT_PADDING = 5;
|
|
||||||
|
|
||||||
public bool Clicked
|
public bool Clicked
|
||||||
{
|
{
|
||||||
get { return didClick; }
|
get { return didClick; }
|
||||||
@ -47,29 +72,6 @@ namespace osu.Game.Screens.Multiplayer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Status
|
|
||||||
{
|
|
||||||
get { return roomStatus; }
|
|
||||||
set
|
|
||||||
{
|
|
||||||
roomStatus = value;
|
|
||||||
if (roomStatus == 0)
|
|
||||||
{
|
|
||||||
statusColour = ColourFree;
|
|
||||||
statusString = "Welcoming Players";
|
|
||||||
|
|
||||||
UpdatePanel(this);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
statusColour = ColourBusy;
|
|
||||||
statusString = "Now Playing";
|
|
||||||
|
|
||||||
UpdatePanel(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdatePanel(MultiRoomPanel panel)
|
public void UpdatePanel(MultiRoomPanel panel)
|
||||||
{
|
{
|
||||||
panel.BorderColour = statusColour;
|
panel.BorderColour = statusColour;
|
||||||
@ -257,5 +259,11 @@ namespace osu.Game.Screens.Multiplayer
|
|||||||
didClick = true;
|
didClick = true;
|
||||||
return base.OnMouseUp(state, args);
|
return base.OnMouseUp(state, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum PanelState
|
||||||
|
{
|
||||||
|
Free,
|
||||||
|
Busy
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user