From d6fa77d75b8cbac53c10aba7d0366b90ef0a78e0 Mon Sep 17 00:00:00 2001 From: shenjianxing <”315615051@qq.com“> Date: Fri, 10 Jan 2025 13:42:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BD=93=E5=89=8D=E7=B1=BB=E5=9E=8B=E4=BB=85?= =?UTF-8?q?=E4=B8=80=E4=B8=AA=E6=A8=A1=E5=9D=97=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=BF=9B=E5=85=A5=20=E4=B8=8D=E9=9C=80?= =?UTF-8?q?=E8=A6=81=E6=A8=A1=E5=9D=97=E9=80=89=E6=8B=A9=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/UI/UIModuleSelect.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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; + }); } + + }