/// <summary> /// 打开界面,根据界面ID /// </summary> public void OpenView <T>(int viewId, int subIndex = 1, int arg1 = -1, int arg2 = -1, int arg3 = -1, string arg4 = null, string arg5 = null, string arg6 = null) where T : new() { UiExcel tempData = DataMgr.Instance.tableUI.GetInfoById(viewId); if (tempData != null) { _OpenViewByVo <T>(tempData, subIndex, arg1, arg2, arg3, arg4, arg5, arg6); } else { ZLogger.Error("ui表数据不存在 {0}", viewId); } }
private InterfaceView _CreateView <T>(UiExcel uiData) where T : new() { InterfaceView tempView = _NewViewByName <T>(uiData); if (tempView == null) { ZLogger.Error("UIManager:_CreateView 创建UI失败:{0}", uiData.name); return(null); } tempView.updateViewState = _ViewStateChange; WaitOpenViewList.Add(tempView); return(tempView); }
// 尝试从等待界面、已打开界面,缓存中永久持有界面,已关闭缓存界面中获取界面 private InterfaceView _TryToGetViewAndType(UiExcel uiData) { InterfaceView tempView = GetWaitByName(uiData.name); if (tempView == null) { tempView = GetOpeningView(uiData.id); if (tempView == null) { tempView = _GetCacheView(uiData.name, uiData.holdBoo); } } return(tempView); }
private void _CloseViewByVo(UiExcel uiDataCan) { if (uiDataCan == null) { ZLogger.Error("找不到界面信息,请检查UIExcel表是否配置正确!"); return; } InterfaceView tempView = _TryToGetOpenViewAndType(uiDataCan); if (tempView != null) { tempView.Close(false); } }
//委托,在每个界面发生状态变化时候需要做的操作 private void _ViewStateChange(InterfaceView viewCan, UIMgr.ViewStateType type) { List <UiExcel> tempUiExcelList = DataMgr.Instance.tableUI.GetInfoByNameAndValue("name", viewCan.ViewName()); if (tempUiExcelList.Count < 1) { ZLogger.Error("找不到界面的信息,请查看UIExcel表配置是否正确!"); return; } UiExcel uiData = tempUiExcelList[0]; switch (type) { case ViewStateType.CLOSE: UpdateErrorViewDic.Remove(viewCan.ViewName()); _UpdateCacheView(uiData.id, viewCan, false, uiData.holdBoo); _AdjustMaskAndActive(); break; case ViewStateType.LOAD_COMPLETE: break; case ViewStateType.UNLOAD: _UpdateDel(uiData.id, viewCan); break; case ViewStateType.LOAD_FAIL: _RemoveWaitOpenValue(viewCan); break; case ViewStateType.GIVE_UP_LOAD: ZLogger.Info("请注意:{0}放弃加载!!!,原因是:没加载完成之前,有人调用了closeview()", viewCan.ViewName()); _RemoveWaitOpenValue(viewCan); break; case ViewStateType.OPEN: _RemoveWaitOpenValue(viewCan); _UpdateCacheView(uiData.id, viewCan, true, uiData.holdBoo); _CheckExclusion(uiData, viewCan); _SortOpeningView(); _AdjustMaskAndActive(); break; case ViewStateType.LOAD_SUCESS: break; } }
private InterfaceView _NewViewByName <T>(UiExcel uiData) where T : new() { InterfaceView tempView; if (UIClassHelper.Instance.UIClassList.Contains(uiData.name)) { tempView = new T() as InterfaceView; tempView.Ctor(); tempView.uiPrefabPath = uiData.path; return(tempView); } else { ZLogger.Error("未在UIClass中定义页面类:{0}", name); } return(null); }
// 打开界面,供内部调用 private void _OpenViewByVo <T>(UiExcel uiData, int subIndex, int arg1 = -1, int arg2 = -1, int arg3 = -1, string arg4 = null, string arg5 = null, string arg6 = null) where T : new() { if (uiData != null) { InterfaceView tempView = _TryToGetViewAndType(uiData); if (tempView == null) { tempView = _CreateView <T>(uiData); } if (tempView == null) { ZLogger.Error("页面没有创建过,并且无法重新创建"); return; } tempView.SetCanvasDepth(GetOpenViewIndex(tempView.Layer())); tempView.Open(subIndex, arg1, arg2, arg3, arg4, arg5, arg6); } }
/// <summary> /// 通过界面ID关闭界面 /// </summary> public void CloseViewById(int viewIdCan) { UiExcel uiData = DataMgr.Instance.tableUI.GetInfoById(viewIdCan); _CloseViewByVo(uiData); }
// 检查当前这个面板互斥的所有面板关闭 no edit private void _CheckExclusion(UiExcel uiData, InterfaceView tgView) { }
//从等待打开界面,已经打开界面中获取界面 private InterfaceView _TryToGetOpenViewAndType(UiExcel uiDataCan) { return(GetWaitByName(uiDataCan.name) != null?GetWaitByName(uiDataCan.name) : GetOpeningView(uiDataCan.id)); }
public void AddInfo(UiExcel _info) { DataList.Add(_info); }