public static void RecordOpenHistory(UIBaseWnd openWnd) { if (null == Instance) { return; } RemoveOpenHistory(openWnd); Instance.m_OpenHistoryList.Add(openWnd); }
public static void RemoveOpenHistory(UIBaseWnd openWnd) { if (null == Instance) { return; } if (Instance.m_OpenHistoryList.Contains(openWnd)) { Instance.m_OpenHistoryList.RemoveAll(a => a == openWnd); } }
void InitBaseWndList() { mBaseWndList.AddRange(gameObject.GetComponentsInChildren <UIBaseWnd>(true)); // set depth for wnd float depth = BaseWndTopDepth; for (int i = 0; i < mBaseWndList.Count; ++i) { UIBaseWnd wnd = mBaseWndList[i]; depth += BaseWndDepth; wnd.mDepth = depth; wnd.transform.localPosition = new Vector3(wnd.transform.localPosition.x, wnd.transform.localPosition.y, wnd.mDepth); } }
List <Rect> GetTopRects(UIBaseWnd wnd) { rectList.Clear(); for (int i = 0; i < mBaseWndList.Count; ++i) { UIBaseWnd topWnd = mBaseWndList[i]; if (null != topWnd && topWnd.isShow) { if (topWnd.transform.localPosition.z < wnd.transform.localPosition.z) { rectList.Add(topWnd.rect); } } } return(rectList); }
public virtual void TopMostWnd() // TopMost { if (null != GameUI.Instance) { UIBaseWnd topWnd = UIStateMgr.Instance.GetTopWnd(); if (topWnd == this) { return; } if (null != topWnd) { topWnd.RepostionDepth(); } } transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, UIStateMgr.BaseWndTopDepth); }
bool GameUIIsShow() { if (GameConfig.IsInVCE) { return(true); } //log:lz-2016.09.13 如果没有进入持枪状态,并且是NPCTalkWnd打开了,并且是不是自动播放的对话,就返回真,代表UI存在,需要解锁鼠标,如果是持枪状态,并且 if (null != UISightingTelescope.Instance && UISightingTelescope.Instance.CurType == UISightingTelescope.SightingType.Null && null != GameUI.Instance && GameUI.Instance.mNPCTalk.isShow && GameUI.Instance.mNPCTalk.type == UINPCTalk.NormalOrSp.Normal) { return(true); } if (GameUI.Instance.mSystemMenu.IsOpen() || GameUI.Instance.mOption.isShow || GameUI.Instance.mSaveLoad.isShow || MessageBox_N.Instance.isShow) { return(true); } if (GameUI.Instance.mUIWorldMap.isShow) { return(true); } for (int i = 0; i < mBaseWndList.Count; ++i) { UIBaseWnd wnd = mBaseWndList[i]; if (wnd is UIMissionTrackCtrl || wnd is UIItemsTrackCtrl) { continue; } //lz-2016.06.24 因为吴怡秋把wnd.IsOpen检测改为gameObject.activeSelf了,这里要检测窗口是否可见,所检测activeInHierarchy if (null != wnd && wnd.gameObject.activeInHierarchy) { return(true); } } return(false); }
GameObject AddUIPrefab(GameObject prefab, Transform parentTs) { GameObject o = GameObject.Instantiate(prefab) as GameObject; o.transform.parent = parentTs; o.layer = parentTs.gameObject.layer; o.transform.localPosition = Vector3.zero; o.transform.localScale = Vector3.one; UIBaseWnd wnd = o.GetComponent <UIBaseWnd>(); if (wnd != null) { wnd.mAnchor = parentTs.gameObject.GetComponent <UIAnchor>(); } UIAnchor[] achors = o.transform.GetComponentsInChildren <UIAnchor>(true); foreach (UIAnchor anchor in achors) { anchor.uiCamera = mUICamera; } return(o); }
void UpdateWndActive() { for (int i = 0; i < mBaseWndList.Count; ++i) { UIBaseWnd wnd = mBaseWndList[i]; if (null != wnd && wnd.isShow) { if (wnd.IsCoverForTopsWnd(GetTopRects(wnd))) { if (wnd.Active) { wnd.DeActiveWnd(); } } else { if (!wnd.Active) { wnd.ActiveWnd(); } } } } }
bool CloseFrontWnd() { if (UIStateMgr.Instance == null) { return(false); } if (GameUI.Instance == null) { return(false); } if (GameUI.Instance.mUIWorldMap.isShow) { GameUI.Instance.mUIWorldMap.Hide(); return(true); } else if (GameUI.Instance.mOption.isShow) { GameUI.Instance.mOption.Hide(); return(true); } else if (GameUI.Instance.mSaveLoad.isShow) { GameUI.Instance.mSaveLoad.Hide(); return(true); } else if (MessageBox_N.IsShowing) { if (MessageBox_N.Instance) { MsgInfoType _inftype = MessageBox_N.Instance.GetCurrentInfoTypeP(); if (!(_inftype == MsgInfoType.LobbyLoginMask || _inftype == MsgInfoType.ServerDeleteMask || _inftype == MsgInfoType.ServerLoginMask)) { MessageBox_N.CancelMask(_inftype); } return(true); } } List <UIBaseWnd> wnds = UIStateMgr.Instance.mBaseWndList; UIBaseWnd frontmost = null; foreach (UIBaseWnd wnd in wnds) { if (wnd == GameUI.Instance.mMissionTrackWnd || wnd == GameUI.Instance.mItemsTrackWnd || wnd == GameUI.Instance.mCustomMissionTrack.missionInterpreter.missionTrackWnd || wnd == GameUI.Instance.mRevive) //lz-2017.01.04 按esc退出的时候复活界面不关闭错误 #7975 { continue; } if (wnd.isShow && wnd.Active) { frontmost = wnd; frontmost.Hide(); return(true); } } // if (GameUIMode.Instance.curUIMode == GameUIMode.UIMode.um_building) // { // GameUI.Instance.mBuildBlock.QuitBuildMode(); // return true; // } return(false); }