您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
46 行
1.1 KiB
46 行
1.1 KiB
using System;
|
|
|
|
namespace LobbyRelaySample
|
|
{
|
|
/// <summary>
|
|
/// Current state of the local game.
|
|
/// Set as a flag to allow for the Inspector to select multiple valid states for various UI features.
|
|
/// </summary>
|
|
[Flags]
|
|
public enum GameState
|
|
{
|
|
Menu = 1,
|
|
Lobby = 2,
|
|
JoinMenu = 4,
|
|
}
|
|
|
|
/// <summary>
|
|
/// Awaits player input to change the local game data.
|
|
/// </summary>
|
|
[System.Serializable]
|
|
public class LocalGameState : Observed<LocalGameState>
|
|
{
|
|
GameState m_State = GameState.Menu;
|
|
|
|
public GameState State
|
|
{
|
|
get => m_State;
|
|
set
|
|
{
|
|
if (m_State != value)
|
|
{
|
|
m_State = value;
|
|
OnChanged(this);
|
|
}
|
|
}
|
|
}
|
|
|
|
public override void CopyObserved(LocalGameState oldObserved)
|
|
{
|
|
if (m_State == oldObserved.State)
|
|
return;
|
|
m_State = oldObserved.State;
|
|
OnChanged(this);
|
|
}
|
|
}
|
|
}
|