/// <summary> /// 创建面板 /// </summary> /// <param name="pid">面板ID</param> /// <param name="panelTs">依赖的Transform</param> /// <returns></returns> private UIPanelBase CreatePanel(PanelID pid, Transform panelTs) { UIPanelBase panelBase = GetPanel(pid); if (null == panelTs) { Engine.Utility.Log.Error("UIPanelManager->CreatePanel failed ,Panel Transform null,PID:{0}", pid); return(panelBase); } LocalPanelInfo localPanelInfo = null; if (TryGetLocalPanelInfo(pid, out localPanelInfo)) { if (null == panelBase) { string panelPath = localPanelInfo.PrefabPath; string panelClassName = localPanelInfo.PanelEnumName; GameObject go = panelTs.gameObject; if (!string.IsNullOrEmpty(panelClassName)) { go.name = panelClassName; panelBase = go.GetComponent <UIPanelBase>(); if (null == panelBase) { panelBase = Util.AddComponent(go, panelClassName) as UIPanelBase; if (null != panelBase) { panelBase.PanelInfo = localPanelInfo; if (null != go && !go.activeSelf) { go.SetActive(true); } //初始化 panelBase.Init(); panelBase.InitPanelDetph(); //go.SetActive(false); } } allPanels.Add((uint)pid, panelBase); } } else { Debug.LogError("DespawnExistpanel:" + pid.ToString()); if (IsShowPanel(pid)) { Debug.LogError("DespawnExistSSS##panel:" + pid.ToString()); } UIManager.ReleaseObjs(localPanelInfo.TableData.resID, panelTs); } } return(panelBase); }