From 766cdff5ffa72b65d7f106658d1603f47739b2ba Mon Sep 17 00:00:00 2001 From: chai <215380520@qq.com> Date: Fri, 27 Oct 2023 11:05:14 +0800 Subject: + init --- GameCode/CharacterSelectionInstance.cs | 157 +++++++++++++++++++++++++++++++++ 1 file changed, 157 insertions(+) create mode 100644 GameCode/CharacterSelectionInstance.cs (limited to 'GameCode/CharacterSelectionInstance.cs') diff --git a/GameCode/CharacterSelectionInstance.cs b/GameCode/CharacterSelectionInstance.cs new file mode 100644 index 0000000..dd11ab4 --- /dev/null +++ b/GameCode/CharacterSelectionInstance.cs @@ -0,0 +1,157 @@ +using TMPro; +using UnityEngine; +using UnityEngine.UI; + +public class CharacterSelectionInstance : MonoBehaviour +{ + public int currentlySelectedFace; + + public Player currentPlayer; + + public GameObject getReadyObj; + + private HoverEvent currentButton; + + private CharacterSelectionInstance[] selectors; + + private HoverEvent[] buttons; + + public bool isReady; + + private float counter; + + private void Start() + { + selectors = base.transform.parent.GetComponentsInChildren(); + } + + public void ResetMenu() + { + base.transform.GetChild(0).gameObject.SetActive(value: false); + currentPlayer = null; + getReadyObj.gameObject.SetActive(value: false); + PlayerManager.instance.RemovePlayers(); + } + + private void OnEnable() + { + if (!base.transform.GetChild(0).gameObject.activeSelf) + { + GetComponentInChildren(includeInactive: true).gameObject.SetActive(value: true); + GetComponentInChildren(includeInactive: true).Play(); + } + } + + public void StartPicking(Player pickingPlayer) + { + currentPlayer = pickingPlayer; + currentlySelectedFace = 0; + GetComponentInChildren(includeInactive: true).gameObject.SetActive(value: false); + GetComponentInChildren(includeInactive: true).Stop(); + base.transform.GetChild(0).gameObject.SetActive(value: true); + getReadyObj.gameObject.SetActive(value: true); + if (currentPlayer.data.input.inputType == GeneralInput.InputType.Keyboard) + { + getReadyObj.GetComponent().text = "PRESS [SPACE] WHEN READY"; + } + else + { + getReadyObj.GetComponent().text = "PRESS [START] WHEN READY"; + } + buttons = base.transform.GetComponentsInChildren(); + for (int i = 0; i < buttons.Length; i++) + { + if (pickingPlayer.data.input.inputType == GeneralInput.InputType.Controller) + { + buttons[i].enabled = false; + buttons[i].GetComponent