/// <summary> /// 关闭UI(不包含指定预制体) /// </summary> /// <param name="uiPrefabName">UI预制体名.</param> public void CloseUITo(string uiPrefabName) { if (string.IsNullOrEmpty(uiPrefabName)) { this.Warning("CloseUI():The prefab name is invalid!!"); return; } if (0 >= this._uiShowStack.Count) { this.Warning("CloseUI():There is no ui left in ui show stack!!"); return; } UIComponentBase currUI = null; while (true) { // 推出UI显示栈 currUI = this._uiShowStack.Peek(); if (null == currUI) { break; } if (true == uiPrefabName.Equals(currUI.name)) { currUI.Open(); break; } currUI = this._uiShowStack.Pop(); currUI.Close(); } }
/// <summary> /// 返回. /// </summary> /// <returns><c>true</c>, 返回成功, <c>false</c> 无上一步可返回/无需返回.</returns> private bool InnerBackUI() { if (0 < this._uiShowStack.Count) { UIComponentBase currUI = this._uiShowStack.Peek(); if (null == currUI) { return(false); } if (false == currUI.IsBackAble) { return(false); } currUI = this._uiShowStack.Pop(); if (null == currUI) { return(false); } currUI.Close(); // 替换的场合,回复上一个UI if (true == currUI.IsSwap) { currUI = this._uiShowStack.Peek(); currUI.Open(); } return(true); } return(false); }
/// <summary> /// 关闭UI /// </summary> public void CloseUI() { if (0 >= this._uiShowStack.Count) { this.Warning("CloseUI():There is no ui left in ui show stack!!"); return; } // 推出UI显示栈 UIComponentBase currUI = this._uiShowStack.Pop(); // 推出UI显示栈 if (null != currUI) { currUI.Close(); // 替换的场合,重新打开上一个UI if (true == currUI.IsSwap) { UIComponentBase _lastInfo = this._uiShowStack.Peek(); if (null != _lastInfo) { _lastInfo.Open(); } } } }