public void OpenPanel() { if (m_NextMaster == m_CurrentMaster) { return; } if (m_NextMaster < 0) { m_CurrentMaster = m_NextMaster; return; } if (m_Panel == null)//这个条件的检测反而比较少 { return; } m_CurrentMaster = m_NextMaster; OpenParam info = GetOpenInfo(m_CurrentMaster); if (info == null) { m_CurrentMaster = m_NextMaster = -1; return; } ERunner.Run(m_Panel.OnPanelOpen, true, info.Args); ERunner.Run(CallOpenCallbck); }
private static T OpenUi <T>(OpenParam param) where T : PanelUi { var panel = _HideStableUI.FirstOrDefault(x => x.EntityName == param.UiName); if (panel != null) { _HideStableUI.Remove(panel); } panel = panel ?? GameObjectPool.Get <PanelUi>(new AssetId(DefaultUIBundle, param.UiName)); panel.transform.SetParent(_UIContainer); panel.transform.SetSiblingIndex(param.SiblingIndex); _ActiveUI.Insert(param.SiblingIndex, panel); panel.gameObject.SetActive(true); if (param.Dialog != null) { param.Dialog.Dialog = panel; } panel.InitRect(param.InitType); panel.AfterOpen(); return(panel as T); }
private void SelectNextMaster() { m_CurrentMaster = -1; m_NextMaster = -1; if (m_OpenInfoList == null) { m_SortIndex = -1; return; } if (m_OpenInfoList.Count == 0) { m_SortIndex = -1; return; } int maxIndex = -1; OpenParam op = null; for (int i = m_OpenInfoList.Count - 1; i >= 0; --i) { PanelInfo info = UIMgr.S.FindPanelInfoByPanelID(m_OpenInfoList[i].MasterID); if (info == null) { ObjectPool <OpenParam> .S.Recycle(m_OpenInfoList[i]); m_OpenInfoList.RemoveAt(i); continue; } if (info.sortIndex > maxIndex) { maxIndex = info.sortIndex; m_NextMaster = info.panelID; op = m_OpenInfoList[i]; } } if (m_NextMaster == m_PanelID) { m_SortIndex = maxIndex; } else { m_SortIndex = maxIndex + op.SortIndexOffset; } }
public void LoadPanelResAsync() { if (m_PanelState != ePanelState.UnInit) { return; } m_PanelState = ePanelState.Loading; UIData data = UIDataTable.Get(m_UIID); if (data == null) { return; } OpenParam info = GetOpenInfo(m_CurrentMaster); object[] args = null; if (info != null) { args = info.Args; } if (m_ResLoader == null) { m_ResLoader = ResLoader.Allocate("PanelInfo"); } CollectDynamicResource(data, m_ResLoader, args); m_ResLoader.Add2Load(data.fullPath, (state, res) => { if (!state) { return; } OnPanelResLoadSuccess((GameObject)res.asset); }); m_ResLoader.LoadSync(); }
public static OpenParam CreateBuilder() { OpenParam param = new OpenParam(); return(param); }