public void CloseDialog() { if (dialogQueue.Count <= 0) { return; } GameObject go = dialogQueue.Pop(); var ds = go.GetComponent <DialogBase>(); DialogStyle goDialogStyle = ds == null ? DialogStyle.NormalDialog : ds.style; // AdjustPanelDepth(go, false); Debug.Log("close dialog " + go.name); PlayCloseDialogAnimation(go); if (dialogQueue.Count > 0) { DialogBase topDb = dialogQueue.Peek().GetComponent <DialogBase>(); if (topDb != null && goDialogStyle == DialogStyle.NormalDialog) { topDb.OnResume(); } } // check full screen dialog exist foreach (var item in dialogQueue) { if (item != null) { DialogBase dlg = item.GetComponent <DialogBase>(); if (dlg != null && dlg.IsFullScreen()) { return; } } } if (mainNode != null && dialogQueue.Count == 0) // no fullscreen dialog exist { mainNode.SetActive(true); if (middleNode != null) { middleNode.SetActive(true); } } if (dialogQueue.Count == 0) { currentMaxDepth = BASE_DEPTH; } // EventService.Instance.GetEvent<TutorialEvent>().Publish(SettingManager.Instance.TutorialSeq); }
//TODO: should delete it when refactor done! private void PushDialog(GameObject go, GameObject sender = null, bool instant = true) { try { AdjustPanelDepth(go); if (dialogQueue.Count > 0) { DialogBase curDb = dialogQueue.Peek().GetComponent <DialogBase>(); if (curDb != null && go.GetComponent <DialogBase>().style == DialogStyle.NormalDialog) { curDb.OnPause(); } } DialogBase newDb = go.GetComponent <DialogBase>(); if (newDb != null) { if (sender != null) { newDb.Init(sender, null); } // newDb.OnResume(); if (newDb.IsFullScreen() && mainNode != null) { // mainNode.SetActive(false); } } } catch (Exception e) { Debug.LogError(e); } dialogQueue.Push(go); // PlayOpenDialogAnimation(go, instant); // EventService.Instance.GetEvent<TutorialEvent>().Publish(SettingManager.Instance.TutorialSeq); }