void Start() { uiKey = GameManager.instance.uiKey; cameraM = GameManager.instance.cameraM; altOS = GameManager.instance.altOS; dialoguePrompt = transform.GetChild(0).GetChild(1).gameObject; }
void OnEnable() { PlayerControllerGM gmPlayer = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>().gmPlayer; if (gmPlayer != null) { key = GetComponentInChildren <UIKey>(); key.SetLetter(gmPlayer.playerKeys[playerIndex].ToString()); } }
public static void Destroy(UIKey InUIKey) { if (_uiBasePools.TryGetValue(InUIKey, out var uiBase)) { _uiBasePools.Remove(InUIKey); if (null != uiBase) { Object.DestroyImmediate(uiBase.GameObj); } } }
public void CloseUI(UIKey InUIKey) { if (uiHistoryTail == null) { Debug.LogError("No UI currently open."); return; } UINode pointer; if (uiHistoryTail.CurBase.Key == InUIKey) { pointer = uiHistoryTail; uiHistoryTail = uiHistoryTail.Prev; } else { pointer = uiHistoryTail.Prev; while (pointer != null) { if (pointer.CurBase.Key == InUIKey) { break; } pointer = pointer.Prev; } if (null == pointer) { Debug.LogError($"No open ui named {InUIKey} was found."); return; } } if (null != pointer.Prev) { pointer.Prev.Next = pointer.Next; } if (null != pointer.Next) { pointer.Next.Prev = pointer.Prev; } pointer.Prev = pointer.Next = null; uiQueue.Enqueue(new UIParam(pointer.CurBase)); if (!isUIHandling) { StartCoroutine(UIQueueUpdate()); } }
public static UIBase Produce(UIKey InUIKey, Transform InParent, bool InIsStayInMemory = true) { if (_uiBasePools.TryGetValue(InUIKey, out var bindBase)) { if (null != bindBase) { bindBase.Trans.SetAsLastSibling(); return(bindBase); } } UIConfigTable configTable = GetConfigTable((int)InUIKey); if (null == configTable) { Debug.LogError($"Can not find UI Config table named '{InUIKey}'."); return(null); } GameObject prefab = Object.Instantiate(LoadUIPrefab(configTable.Path)); if (null == prefab) { Debug.LogError($"No resource named '{InUIKey}' was found under path {configTable.Path}."); return(null); } Transform trans = prefab.transform; trans.SetParent(InParent); trans.localPosition = Vector3.zero; trans.rotation = Quaternion.identity; trans.localScale = Vector3.one; trans.SetAsLastSibling(); bindBase = prefab.GetComponent <UIBase>(); if (null == bindBase) { Debug.LogError($"Unbound 'UIBase' script on this resource could not be loaded."); return(null); } if (InIsStayInMemory) { _uiBasePools.Add(InUIKey, bindBase); } bindBase.Handle.SelfLoaded(InUIKey); return(bindBase); }
public UIBase OpenUI(UIKey InUIKey, bool InIsStayInMemory = true, params object[] InParams) { UIBase uiBase = UIFactory.Produce(InUIKey, uiRoot, InIsStayInMemory); if (null != uiBase) { uiQueue.Enqueue(new UIOpenParam(uiBase, InParams)); if (!isUIHandling) { StartCoroutine(UIQueueUpdate()); } } return(uiBase); }
void Start() { uiKey = GameManager.instance.uiKey; }
public void SelfLoaded(UIKey InUIKey) { bindUIBase.Key = InUIKey; bindUIBase.OnSelfLoaded(); }
void Start() { tpc = GameManager.instance.tpc; sManager = GameManager.instance.sManager; uiKey = GameManager.instance.uiKey; }