using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using TMPro; using DG.Tweening; using Object = UnityEngine.Object; public enum GameInstanceType { Zombie, Fumarole, Waves, Duo, Squad, Base } public class UIManager : MonoBehaviour { //Singleton Instance public static UIManager Instance { get; private set; } [SerializeField] OptionsCanvas optionsCanvas; private GameObject exitGameCanvas; private GameObject loginScreenCanvas; private GameObject escapeMenu; private GameObject instanceFinderCanvas; public TMP_Text objectInteractMessage; public TMP_Text itemInteractMessage; public GameInstanceType GameInstanceType = GameInstanceType.Base; public Action OnGameInstancePress; [System.NonSerialized] public TMP_InputField ChatInputField; [System.NonSerialized] public GameObject Inventory; [System.NonSerialized] public GameObject OnScreenKeyboardGO; [System.NonSerialized] public TextMeshProUGUI ReloadIndicator; [System.NonSerialized] public GameObject[] GamePadInputBlockers = new GameObject[6]; [System.NonSerialized] public TMP_InputField UserNameInputField; [System.NonSerialized] public TMP_InputField PasswordInputField; [System.NonSerialized] public GameObject LoginButton; [System.NonSerialized] public GameObject SetIPParent; [System.NonSerialized] public TMP_InputField IP_InputField; [System.NonSerialized] public GameObject BankVaultCanvas; [System.NonSerialized] public GameObject CharacterSelectCanvas; [System.NonSerialized] public GameObject CryptoWalletMenu; [System.NonSerialized] public GameObject CreateAccountMenu; [System.NonSerialized] public Button CreateAccountRegisterButton; [System.NonSerialized] public Transform SoloInstanceParent; [System.NonSerialized] public Transform DuoInstanceParent; [System.NonSerialized] public Transform SquadInstanceParent; [System.NonSerialized] public UnderWaterTimer UnderWaterSystem; [System.NonSerialized] public TMP_Text LoginMessage; [System.NonSerialized] public TMP_Text clipCapacityText; [System.NonSerialized] public TMP_Text rocketCapacityText; [System.NonSerialized] public Image flameWeaponHud; [System.NonSerialized] public Image rocketWeaponHud; [System.NonSerialized] public Image ammoWeaponHud; [System.NonSerialized] public GameObject VoiceChatTabMenu; [System.NonSerialized] public Image SpeakingMicrophoneIcon; [SerializeField] private Sprite microphoneOn; [SerializeField] private Sprite microphoneOff; [System.NonSerialized] public bool IsInGameInstance = false; [System.NonSerialized] public TMP_Text CollectedDiviText; public WaveText waveTextController; [System.NonSerialized] public ForgeController ForgeController; [System.NonSerialized] public WeaponExchangeController WeaponExchangeController; [System.NonSerialized] public WeaponStatsManager WeaponStatsManager; [System.NonSerialized] public ChatBox ChatBox; [System.NonSerialized] public InGameStatsController InGameStatsController; private KillMessage fanfair_KillMessage; public Queue fanfairMessageQueue = new Queue(); public static string defaultIP = Config.SERVER_IP; [System.NonSerialized] public string ipInputData = ""; [System.NonSerialized] public string MostRecentCanvasOpenedName = "LoginScreen"; private readonly Color32 localMicOnColour = new Color32(35, 173, 93, 255); private readonly Color32 localMicOffColour = new Color32(183, 75, 68, 255); #region VictoryScreen [Header("Victory Canvas Attributes")] [SerializeField] private CanvasGroup backgroundCanvasGroup; public TextMeshProUGUI VictoryText; [SerializeField] private GameObject statsContainer; [SerializeField] private GameObject jackpotHeading; [SerializeField] private TextMeshProUGUI jackpotText; [SerializeField] private GameObject continueButton; [System.NonSerialized] public string victoryScreenAudioClip; [System.NonSerialized] public GameObject VictoryCanvas; #endregion public GameObject StatsCanvas { get; private set; } private GameObject tutorialCanvas; private CSVReader csvReader; private bool toggleMobileMenu = false; private void Awake() { Instance = this; //these need to be in awake, because they are used in OnEnable. We don't want any race conditions. GamePadInputBlockers[0] = getInterface("usernameButton_ForGamepad"); GamePadInputBlockers[1] = getInterface("passwordButton_ForGamepad"); GamePadInputBlockers[2] = getInterface("CA_usernameButton_ForGamepad"); GamePadInputBlockers[3] = getInterface("CA_emailButton_ForGamepad"); GamePadInputBlockers[4] = getInterface("CA_mobileButton_ForGamepad"); GamePadInputBlockers[5] = getInterface("CA_passwordButton_ForGamepad"); csvReader = GetComponent(); ipInputData = defaultIP; FindAllUIElements(); } // Start is called before the first frame update public void Start() { getInterface("Crosshair"); getInterface("ChatBox"); getInterface("ScreenFlash"); getInterface("WaveInfo"); getInterface("DebugData"); getInterface("QuickInventoryAccess"); getInterface("PlayerCanvas"); getInterface("RespawnWaitCanvas"); getInterface("PaymentConfirmationCanvas"); getInterface("OptionsCanvas"); getInterface("DiviGoCanvas"); getInterface("DiviFlipFountainCanvas"); getInterface("ChallengeModeCanvas"); BankVaultCanvas = getInterface("BankVaultCanvas"); SetIPParent = getInterface("Set_IP"); LoginButton = getInterface("loginButton_LoginScreen"); OnScreenKeyboardGO = getInterface("OnScreenKeyboard"); escapeMenu = getInterface("EscapeMenu"); ReloadIndicator = getInterface("ReloadTextIndicator").GetComponent(); Inventory = getInterface("Inventory"); loginScreenCanvas = getInterface("LoginScreen"); exitGameCanvas = getInterface("ExitGameCanvas"); ChatInputField = getInterface("ChatBoxInputField").GetComponent(); UserNameInputField = getInterface("usernameInputField").GetComponent(); PasswordInputField = getInterface("passwordInputField").GetComponent(); IP_InputField = getInterface("IP_InputField").GetComponent(); CryptoWalletMenu = getInterface("CryptoWallet"); CreateAccountMenu = getInterface("CreateAccountCanvas"); CreateAccountRegisterButton = getInterface("CA_RegisterButton").GetComponent