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.
 
 
 
 
 
 

48 lines
1.1 KiB

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Networking.Client;
public class LobbyWaitManager : MonoBehaviour
{
[SerializeField]
private ConnectedClients AllClients;
[SerializeField]
private ClientObject localClient;
[SerializeField]
private UnityEngine.UI.Button StartButton;
private void OnEnable()
{
AllClients.OnClientsChange += UpdateButton;
}
private void OnDisable()
{
AllClients.OnClientsChange -= UpdateButton;
}
private void Start()
{
UpdateButton(AllClients.AllClients);
}
public void OnClick_Start()
{
localClient.client.Send(LoginProtocols.StartGame, new Networking.LogicProtocols.EmptyMsg());
}
private void UpdateButton(List<ClientData> AllClients)
{
if (AllClients.Count > 0 && AllClients[0].characterAnimal == localClient.PlayerAnimal)
{
StartButton.gameObject.SetActive(true);
}
else
{
StartButton.gameObject.SetActive(false);
}
}
}