You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
1.2 KiB
46 lines
1.2 KiB
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 - Do Not Modify")]
|
|
public NetworkIdentity playerIdentity;
|
|
|
|
|
|
public void Awake()
|
|
{
|
|
matchController.MatchCells.Add(cellValue, this);
|
|
}
|
|
|
|
public void MakePlay()
|
|
{
|
|
if (matchController.currentPlayer.isLocalPlayer)
|
|
matchController.CmdMakePlay(cellValue);
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
} |