public void UpdateUI(int index, PlayerMenuState pms, string className) { UIActive.SetActive(true); background.enabled = true; playerName.text = "Player " + index; playerDevice.text = pms.device.displayName; readyImage.color = Lib.GetColorByMenuState(pms.status); classText.text = className; background.color = Lib.GetPlayerColorByIndex(index); }
/// <summary> /// Checks if the player is currently in a menu. The cases for this if the player does not exist or they /// are either just joined, or readied in the menu. /// </summary> /// <param name="i">The device of the player to check for</param> /// <returns>True if the player is in a menu (currently only the starting menu), false otherwise</returns> bool PlayerInMenu(InputDevice i) { if (!inMenu) { return(false); } int index = playerStatuses.FindIndex((t) => i == t.device); if (index != -1) { PlayerMenuState pms = playerStatuses[index]; if (pms.status == PlayerStatus.Joined || pms.status == PlayerStatus.Ready) { return(true); } else { return(false); } } return(true); }