| | |
| | | |
| | | private UIBase GetLastSupportParentChildRelationUI() |
| | | { |
| | | List<UIBase> tempList = new List<UIBase>(); |
| | | |
| | | UIBase target = null; |
| | | |
| | | while (target == null && uiStack.Count > 0) |
| | | foreach (var uiBase in uiStack) |
| | | { |
| | | UIBase uiBase = uiStack.Pop(); |
| | | |
| | | if (uiBase != null && uiBase.supportParentChildRelation && !uiBase.isMainUI) |
| | | if (uiBase != null && uiBase.supportParentChildRelation) |
| | | { |
| | | target = uiBase; |
| | | return uiBase; |
| | | } |
| | | |
| | | tempList.Add(uiBase); |
| | | } |
| | | |
| | | for (int i = tempList.Count - 1; i >= 0; i--) |
| | | { |
| | | uiStack.Push(tempList[i]); |
| | | } |
| | | |
| | | return target; |
| | | return null; |
| | | } |
| | | |
| | | public UIBase OpenWindow(string uiName, int functionOrder = 0) |
| | |
| | | |
| | | returnValue.gameObject.SetActive(true); |
| | | |
| | | // 自动设置父级UI(如果未指定且支持父子关系) |
| | | if (returnValue.supportParentChildRelation && uiStack.Count > 0) |
| | | // 自动设置父级UI, 如果勾选了ismainui 则不需要找父级UI |
| | | if (returnValue.supportParentChildRelation && uiStack.Count > 0 && !returnValue.isMainUI) |
| | | { |
| | | // 获取栈顶UI |
| | | parentUI = GetLastSupportParentChildRelationUI(); |