/// <summary> /// Gets the UI canvas GameObject if it is in the UI dictionary /// </summary> /// <param name="name">the name of the canvase GameObject</param> /// <returns>the canvas GameObject</returns> public GameObject GetUICanvas(UICanvases name) { if (uiDict.ContainsKey(name)) { return(uiDict[name]); } else { Debug.Log("Key " + name + " was not in the UI dictionary"); return(null); } }
/// <summary> /// Closes the UI and enables the one to change to /// </summary> /// <param name="newMenu">the new menu to go to</param> public void CloseAndChangeUI(UICanvases newMenu) { //check if enum is in dictionary if (!uiDict.ContainsKey(newMenu)) { Debug.Log(newMenu + " is not in the uiDict dictionary! Aborting menu change."); return; } //loop through the dictionary and disable all the ui foreach (KeyValuePair <UICanvases, GameObject> entry in uiDict) { entry.Value.SetActive(false); } //enable the menu to change to uiDict[newMenu].SetActive(true); }