public void Load(byte[] bytes) { m_stateUIDic = new Dictionary <string, List <UILoadInfo> >(); m_UILoadDic = new Dictionary <int, UILoadInfo>(); BinaryHelper helper = new BinaryHelper(bytes); int length = helper.ReadInt(); for (int index = 0; index < length; ++index) { UILoadInfo info = new UILoadInfo(); info.Load(helper); m_UILoadDic.Add(info.UIID, info); if (m_stateUIDic.ContainsKey(info.UIStateStr)) { m_stateUIDic[info.UIStateStr].Add(info); } else { List <UILoadInfo> tmpUILoadInfoList = new List <UILoadInfo>(); tmpUILoadInfoList.Add(info); m_stateUIDic.Add(info.UIStateStr, tmpUILoadInfoList); } } }
// // public void Notify(string name) // { // UIWindow ; // MainUIManager.Singleton.ChangeUI(UIWindow) // UIWindow.showwindow() // if (IsLoaded<UITeam>()) // { // tmpCurUI = UITeam.GetInstance(); // tmpCurUI.HideWindow(); // } // else // { // tmpCurUI = UITeam.GetInstance(); // } // } //----------------------------------------UI界面的转换-------------------------------------- public bool ChangeUI(UIWindow wnd) { //判断是否是连续按同一个界面 if (mCurUIName == wnd.ToString()) { return(false); } UILoadInfo tmpWndInfo = GameTable.UILoadInfoTableAsset.Lookup_UI(mCurStateStr, wnd.ToString()); if ((ENUIWindowLevel)tmpWndInfo.UIWndType == ENUIWindowLevel.enTrough) { return(true); } if (((ENUIWindowLevel)tmpWndInfo.UIWndType == ENUIWindowLevel.enRoot && mCurRootUIName != wnd.ToString()) || wnd.m_castRootAble) { if (ChangeUIByRoot(wnd)) { return(true); } } else { if (ChangeUIByLevel(wnd)) { return(true); } } return(false); }
public bool ChangeUIByLevel(UIWindow wnd) { if (mCurUIName == wnd.ToString()) { return(false); } bool tmpContain = mWndList.Contains(wnd.ToString()); UILoadInfo WndInfo = GameTable.UILoadInfoTableAsset.Lookup_UI(mCurStateStr, wnd.ToString()); if (WndInfo.IsHideOther) { if (!HideCurWndList(false)) { return(false); } } else { for (int i = 0; i < mWndList.Count; i++) { UIWindow tmpWnd = GetCurUIWindow(mWndList[i]); if (tmpWnd == null) { continue; } UILoadInfo tmpWndInfo = GameTable.UILoadInfoTableAsset.Lookup_UI(mCurStateStr, tmpWnd.ToString()); if (tmpWndInfo.UIWndLvl >= WndInfo.UIWndLvl) { HideUIWnd(mWndList[i], false); } } } if (tmpContain) { // int tmpCurWndIndex = mWndList.FindIndex(s => s == wnd.ToString()); // for (int i = tmpCurWndIndex; i < mWndList.Count; i++) // { // HideUIWnd(mWndList[i]); // } // mWndList.Add(wnd.ToString()); mCurUIName = wnd.ToString(); return(true); } else { mWndList.Add(wnd.ToString()); mCurUIName = wnd.ToString(); return(true); } // return false; }
public bool HideUIWnd(string uiStr, bool rootSwitch = false) { UIWindow tmpWnd = GetCurUIWindow(uiStr); if (tmpWnd == null) { Debug.Log("The UIWindow is NULL" + uiStr); return(false); } if (tmpWnd.IsVisiable()) { bool hideSuccess = true; UILoadInfo tmpWndInfo = GameTable.UILoadInfoTableAsset.Lookup_UI(mCurStateStr, uiStr); switch ((ENOnLeaveType)tmpWndInfo.OnLeaveType) { case ENOnLeaveType.enNone: tmpWnd.OnLeave(); break; case ENOnLeaveType.enAll: if (!tmpWnd.OnLeave()) { hideSuccess = false; } break; case ENOnLeaveType.enRoot: if (rootSwitch) { if (!tmpWnd.OnLeave()) { hideSuccess = false; } } break; } if (hideSuccess) { tmpWnd.HideWindow(); } else { tmpWnd.ShowWindow(); mCurUIName = tmpWnd.ToString(); return(false); } } return(true); }
public UILoadInfo Lookup_UI(string uiStateStr, string uiStr) { List <UILoadInfo> uiInfoList = new List <UILoadInfo>(); UILoadInfo info = null; if (m_stateUIDic.TryGetValue(uiStateStr, out uiInfoList)) { foreach (var item in uiInfoList) { if (item.UINameStr == uiStr) { info = item; } } } return(info); }