diff --git a/Assets/Scripts/UI/UIModuleSelect.cs b/Assets/Scripts/UI/UIModuleSelect.cs index fa26becb..35c5ca0a 100644 --- a/Assets/Scripts/UI/UIModuleSelect.cs +++ b/Assets/Scripts/UI/UIModuleSelect.cs @@ -34,6 +34,8 @@ namespace QFramework.Example protected override void OnOpen(IUIData uiData = null) { Content.RemoveAllChildren(); + int moduleCount = 0; + int lastIndex = 0; for (int i = 0; i < Global.Instance.appData.Modules.Count; i++) { var item = Global.Instance.appData.Modules[i]; @@ -42,6 +44,7 @@ namespace QFramework.Example if (curType == Global.appTpe || curType == Global.AppType.All) { + moduleCount++; int index = i; GameObject obj = GameObject.Instantiate(BtnItem.gameObject, Content); obj.transform.Find("Label").GetComponent().text = item.ModuleName; @@ -54,12 +57,25 @@ namespace QFramework.Example SceneManager.sceneLoaded += OnLoadFinished; }); }); + lastIndex = index; } + } + Debug.LogError(Global.Instance.appData.Modules.Count); + if (moduleCount == 1) + { + Global.Instance.curModule = Global.Instance.appData.Modules[lastIndex]; + UIKit.OpenPanelAsync(canvasLevel: UILevel.PopUI).ToAction().StartGlobal(() => + { + SceneManager.LoadSceneAsync(Global.Instance.curModule.Scene, LoadSceneMode.Single); + SceneManager.sceneLoaded += OnLoadFinished; + }); } + + }