private static IEnumerator ExcutePopPanelShowTask() { while (true) { if (CurrentPopPanel is object) { yield return(null); continue; } PopTask nextTask = null; int popOrderCount = allPopTaskOrderList.Count; for (int i = 0; i < popOrderCount; i++) { if (allPopTaskOrderList[i].taskQueue.Count > 0) { nextTask = allPopTaskOrderList[i]; break; } } if (nextTask is null) { if (CurrentBasePanel != null) { CurrentBasePanel.Resume(); } if (MenuPanel != null) { MenuPanel.Resume(); } yield return(null); continue; } int panelIndex = (int)nextTask.panelType; int[] args = nextTask.taskQueue.Dequeue(); if (allPanelDic.TryGetValue(panelIndex, out IUIBase tempUI)) { if (tempUI is null) { Debug.LogError("保存的接口为空,面板类型ID:" + panelIndex); allPanelDic.Remove(panelIndex); continue; } CurrentPopPanel = tempUI; CurrentBasePanel.Pause(); MenuPanel.Pause(); yield return(CurrentPopPanel.Show(args)); } else { if (loadedpanelPrefabDic.TryGetValue(panelIndex, out GameObject tempPrefab)) { if (tempPrefab is null) { Debug.LogError("加载预制体的资源为空,面板类型ID:" + panelIndex); loadedpanelPrefabDic.Remove(panelIndex); continue; } GameObject tempUIGo = GameObject.Instantiate(tempPrefab, PopRoot); tempUI = tempUIGo.GetComponent <IUIBase>(); allPanelDic.Add(panelIndex, tempUI); allPanelGoDic.Add(panelIndex, tempUIGo); CurrentPopPanel = tempUI; CurrentBasePanel.Pause(); MenuPanel.Pause(); yield return(CurrentPopPanel.Show(args)); } else { if (panelPathDic.TryGetValue(panelIndex, out string tempUIPath)) { tempPrefab = Resources.Load <GameObject>(tempUIPath); if (tempPrefab is null) { Debug.LogError("加载预制体的资源为空,面板类型ID:" + panelIndex); loadedpanelPrefabDic.Remove(panelIndex); continue; } loadedpanelPrefabDic.Add(panelIndex, tempPrefab); GameObject tempUIGo = GameObject.Instantiate(tempPrefab, PopRoot); tempUI = tempUIGo.GetComponent <IUIBase>(); allPanelDic.Add(panelIndex, tempUI); allPanelGoDic.Add(panelIndex, tempUIGo); CurrentPopPanel = tempUI; if (CurrentBasePanel is object) { CurrentBasePanel.Pause(); } if (MenuPanel is object) { MenuPanel.Pause(); } yield return(CurrentPopPanel.Show(args)); } else { Debug.LogError("没有配置面板预制体资源路径,面板类型ID:" + panelIndex); } } } } }