public override void MaskClickClose(UIInfo info) { for (int i = m_UIStack.Count - 1; i >= 0; i--) { if (m_UIStack[i].info.Equals(info)) { ManagerCloseCurUIEvent(m_UIStack[i].info); break; } } }
private LoadUIData GetLoadInfo(UIInfo uiInfo) { for (int i = 0; i < m_AllUIStack.Count; i++) { if (m_AllUIStack[i].info.Equals(uiInfo)) { return(m_AllUIStack[i]); } } return(null); }
protected int GetUIStackIndex(UIInfo info) { for (int i = m_UIStack.Count - 1; i >= 0; i--) { if (m_UIStack[i].info.Equals(info)) { return(i); } } return(0); }
/// <summary> /// 先把加载信息放入全局的堆栈里面 /// </summary> private LoadUIData PrePushToAllStack(UIInfo info, params object[] userDatas) { LoadUIData data = new LoadUIData(); data.info = info; data.isLoading = true; data.info.isClosed = false; data.layer = GetLayer(data.info.uiType); info.userDatas = userDatas; m_AllUIStack.Add(data); return(data); }
private UILayer GetUILayer(UIInfo info) { for (int i = m_UIStack.Count - 1; i >= 0; i--) { var ui = m_UIStack[i]; if (ui.info.Equals(info)) { return(ui.uiBase.Layer); } } return(UILayer.None); }
public override void CloseCurrentUI(UIInfo info) { for (int i = m_UIStack.Count - 1; i >= 0; i--) { var ui = m_UIStack[i]; if (ui.info.Equals(info)) { ui.uiBase.DeSpawnUI(); m_UIStack.RemoveAt(i); break; } } }
/// <summary> ///当某个ui关闭的时候,从m_AllUIStack中移除对应UI /// </summary> /// <param name="info"></param> private void RemoveCurUIFromAllUIStack(UIInfo info) { for (int i = m_AllUIStack.Count - 1; i >= 0; i--) { if (m_AllUIStack[i].info.Equals(info)) { LoadUIData loadData = m_AllUIStack[i]; m_AllUIStack.RemoveAt(i); CallAfterCloseUI(loadData); break; } } }
public void InitUI(UIInfo info) { SetCamera(); this.Info = info; UICanvas.planeDistance = 0; if (m_backBtn != null) { m_backBtn.onClick.AddListener(() => { OnClickCloseBtn(); }); } IsInit = true; }
public override void CloseAllUIButCurrent(UIInfo info) { for (int i = m_UIStack.Count - 1; i >= 0; i--) { var ui = m_UIStack[i]; if (!ui.info.Equals(info)) { ui.uiBase.DeSpawnUI(); m_UIStack.RemoveAt(i); } else { ui.uiBase.SetSortOrder(GetSortOrderByIndex(0, ui.uiBase.Layer)); } } }
/// <summary> /// 关闭此ui之外的所有ui /// </summary> public void CloseAllButCurUI(UIInfo info) { for (int i = m_AllUIStack.Count - 1; i >= 0; i--) { var data = m_AllUIStack[i]; if (!data.info.Equals(info)) { if (IsExitUIBase(data)) { data.uiBase.DeSpawnUI(); } m_AllUIStack.RemoveAt(i); } } m_commonLoad.CloseAllUIButCurrent(info); m_popupLoad.CloseAllUIButCurrent(info); }
/// <summary> /// 关闭当前ui同Layer层级下的UI /// </summary> /// <param name="info"></param> public void CloseAllButCurUIByLayer(UIInfo info) { for (int i = m_AllUIStack.Count - 1; i >= 0; i--) { var data = m_AllUIStack[i]; if (data.info.Equals(info)) { if (data.layer == UILayer.CommonLayer) { m_commonLoad.CloseAllUIButCurByLayer(info); } else { m_popupLoad.CloseAllUIButCurByLayer(info); } RemoveUIByLayerBurCurUI(data); break; } } }
/// <summary> /// 是否可以加载UI /// </summary> /// <param name="uiInfo"></param> /// <param name="showEvent"></param> /// <param name="userData"></param> /// <returns></returns> private bool CanStartLoadUI(ref UIInfo uiInfo, Action <UIBase> showEvent = null, params object[] userDatas) { for (int i = 0; i < m_AllUIStack.Count; i++) { if (m_AllUIStack[i].info.Equals(uiInfo)) { if (m_AllUIStack[i].isLoading) { Debug.Log(uiInfo.loadPath + " is Loading!!!!"); uiInfo.userDatas = userDatas; return(false); } else if (m_AllUIStack[i].uiBase != null) { //这种情况可能就是关闭的时候没有关掉,或者一直都是打开状态没有关闭过,直接手动关闭掉然后再加载一次。 CloseCurUI(uiInfo); } } } return(true); }
/// <summary> /// 关闭某个指定的UI /// </summary> /// <param name="info"></param> public void CloseCurUI(UIInfo info) { for (int i = m_AllUIStack.Count - 1; i >= 0; i--) { var data = m_AllUIStack[i]; if (data.info.Equals(info) && !data.info.isClosed) { data.info.isClosed = true; if (IsExitUIBase(data)) { m_AllUIStack[i].uiBase.OnClickCloseBtn(); } else { Debug.Log("加载中关闭:" + info.loadPath + " " + data.isLoading); RemoveCurUIFromAllUIStack(info); } CallAfterCloseUI(data); break; } } }
public override void MaskClickClose(UIInfo info) { int removeIndex = 0; for (int i = m_UIStack.Count - 1; i >= 0; i--) { var ui = m_UIStack[i]; if (ui.info.Equals(info)) { if (ui.uiBase != null) { ui.uiBase.DeSpawnUI(); } removeIndex = i; m_UIStack.RemoveAt(i); break; } } for (int j = removeIndex; j < m_UIStack.Count; j++) { //m_UIStack[j].uiBase.UICanvas.sortingOrder = GetSortOrderByIndex(j); } }
/// <summary> /// 关闭指定UI /// </summary> /// <param name="name"></param> public virtual void CloseCurrentUI(UIInfo info) { }
public virtual void CloseAllUIButCurByLayer(UIInfo info) { }
public override void CloseCurrentUI(UIInfo info) { ManagerCloseCurUIEvent(info); }
/// <summary> /// Mask点击关闭事件处理 /// </summary> /// <param name="ui"></param> public virtual void MaskClickClose(UIInfo info) { }
public override void CloseAllUIButCurByLayer(UIInfo info) { ManagerCloseAllButCurrentEvent(info); }
/// <summary> /// ui点击关闭按钮需要处理的 /// </summary> private void OnClickCloseEvent(UIInfo info) { RemoveCurUIFromAllUIStack(info); ManagerMask(); }
/// <summary> ///关闭普通界面事件 /// </summary> /// <param name="ui"></param> public void ClickCloseCommonUI(UIInfo info) { CloseCurrentUI(info); }
private void MaskClickEvent(UIInfo info) { CloseCurUI(m_mask.clickCloseUI); }
/// <summary> /// 关闭除当前UI的所有UI,如果path是空的则关闭所有的 /// </summary> public virtual void CloseAllUIButCurrent(UIInfo info) { }