This commit is contained in:
2025-12-02 18:48:32 +08:00
parent 92ba80b399
commit bf1ca60b3b
2357 changed files with 262694 additions and 7 deletions

View File

@@ -0,0 +1,47 @@
using UnityEngine;
using UnityEngine.UI;
namespace Mirror.Examples.MultipleMatch
{
public class CellGUI : MonoBehaviour
{
public MatchController matchController;
public CellValue cellValue;
[Header("GUI References")]
public Image image;
public Button button;
[Header("Diagnostics")]
[ReadOnly, SerializeField] internal NetworkIdentity playerIdentity;
public void Awake()
{
matchController.MatchCells.Add(cellValue, this);
}
[ClientCallback]
public void MakePlay()
{
if (matchController.currentPlayer.isLocalPlayer)
matchController.CmdMakePlay(cellValue);
}
[ClientCallback]
public void SetPlayer(NetworkIdentity playerIdentity)
{
if (playerIdentity != null)
{
this.playerIdentity = playerIdentity;
image.color = this.playerIdentity.isLocalPlayer ? Color.blue : Color.red;
button.interactable = false;
}
else
{
this.playerIdentity = null;
image.color = Color.white;
button.interactable = true;
}
}
}
}