private void InitOther() { gGameData = new GameDatas(); gMsgDispatcher = new MsgDispatcher(); gSystemMgr = new SystemMgr(); gResMgr = new ResEditorMgr(); gUiMgr = new UiMgr(); gGameCtrl = new GameCtrl(); gTimerMgr = new TimerMgr(); gGameAdapter = new GameAdapterUtils(); }
private Transform CreateCanvas(string name, int order) { string path = EffectConfig.CanvasPath; GameObject canvasGo = Global.gApp.gResMgr.InstantiateObj(path); canvasGo.name = name; canvasGo.transform.SetParent(m_RootNodeTsf, false); Canvas cvs = canvasGo.GetComponent <Canvas>(); GameAdapterUtils.AdaptCanvas(cvs); cvs.worldCamera = Global.gApp.gUICameraCmpt; cvs.sortingOrder = order; return(canvasGo.transform); }
public void OpenPanelImp <T>(UIInfo uiInfo, string name, T arg) { string assetName = uiInfo.ResPath; BaseUi baseUi = GetPanel(uiInfo, name); if (uiInfo.AddRoot) { Canvas[] canvas = baseUi.gameObject.GetComponentsInChildren <Canvas>(); if (canvas.Length > 0) { baseUi.transform.SetParent(m_RootNodeTsf, false); foreach (Canvas mCanvas in canvas) { mCanvas.worldCamera = Global.gApp.gUICameraCmpt; //if (uiInfo.Order > 0) { mCanvas.sortingOrder = uiInfo.Order; } GameAdapterUtils.AdaptCanvas(mCanvas); } } else { Transform canvasTsf = CreateCanvas(name, uiInfo.Order); baseUi.transform.SetParent(canvasTsf, false); } } else { baseUi.transform.SetParent(m_UiCanvasTsf, false); } baseUi.Init(name, uiInfo, arg); //if (name != Wndid.RewardEffectUi) //{ m_Panels.Add(name, baseUi); //} //if (!m_LastingPanelNames.Contains(name) && !name.Equals(Wndid.HomeUI)) //{ // //Debug.Log(name + DateTimeUtil.GetMills(System.DateTime.Now)); // NewbieGuideButton ngb = baseUi.GetComponentInChildren<NewbieGuideButton>(); // //Debug.Log(name + (ngb == null)); // if (ngb == null) // { // //Debug.Log("open " + baseUi.name); // Global.gApp.gMsgDispatcher.Broadcast<bool>(MsgIds.HideGameGuideAD, false); // } // //Debug.Log(name + DateTimeUtil.GetMills(System.DateTime.Now)); //} if (uiInfo.Layer > 0) { List <BaseUi> uiList; if (!m_LayerDic.TryGetValue(uiInfo.Layer, out uiList)) { uiList = new List <BaseUi>(); m_LayerDic[uiInfo.Layer] = uiList; } if (!uiList.Contains(baseUi)) { uiList.Add(baseUi); m_NeedRefreshTopLayer = true; } } Global.gApp.gMsgDispatcher.Broadcast(MsgIds.UIPanelOpen, name); }