您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

36 行
896 B

using UnityEngine;
namespace LobbyRelaySample.UI
{
/// <summary>
/// Show or hide a UI element based on the current GameState (e.g. in a lobby).
/// </summary>
public class GameStateVisibilityUI : UIPanelBase
{
[SerializeField]
GameState ShowThisWhen;
void GameStateChanged(GameState state)
{
if (!ShowThisWhen.HasFlag(state))
Hide();
else
Show();
Debug.Log($"GameStateChanged for {gameObject.name} : {state}");
}
public override void Start()
{
base.Start();
Manager.onGameStateChanged += GameStateChanged;
}
void OnDestroy()
{
if (Manager == null)
return;
Manager.onGameStateChanged -= GameStateChanged;
}
}
}