From 407215732f61c692a837b3cf4bc9832b7668f424 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=93=AE?= <834207172@qq.com> Date: Mon, 21 Apr 2025 18:23:53 +0800 Subject: [PATCH] =?UTF-8?q?06=20=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/06.UIFarme/RunTime/Base/BasePanel.cs | 19 ++++++++----------- .../06.UIFarme/RunTime/Manager/PanelSystem.cs | 4 ++-- Assets/06.UIFarme/package.json | 2 +- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Assets/06.UIFarme/RunTime/Base/BasePanel.cs b/Assets/06.UIFarme/RunTime/Base/BasePanel.cs index 0484544..3e6eeab 100644 --- a/Assets/06.UIFarme/RunTime/Base/BasePanel.cs +++ b/Assets/06.UIFarme/RunTime/Base/BasePanel.cs @@ -9,10 +9,7 @@ namespace Stary.Evo.UIFarme { public interface IBasePanel : IController { - /// - /// UI信息 - /// - string UIPath { get; set; } + /// /// 绑定这个面板的实例 @@ -53,7 +50,7 @@ namespace Stary.Evo.UIFarme /// /// ui信息 /// - Task CreatePanel(); + Task CreatePanel(string panelName); /// /// 销毁一个Ui对象 @@ -94,9 +91,9 @@ namespace Stary.Evo.UIFarme protected GameObject activePanel{get;private set;} - protected BasePanel(string uiPath) + protected BasePanel() { - UIPath = uiPath; + selectableDict = new Dictionary(); } @@ -151,17 +148,17 @@ namespace Stary.Evo.UIFarme } - public async Task CreatePanel() + public async Task CreatePanel(string panelName) { if (panelParent == null) { - Debug.LogError($"UnityEvo:parent为空,{this.UIPath}无法创建,进程已中断,请检查!!!!!"); + Debug.LogError($"UnityEvo:parent为空,{panelName}无法创建,进程已中断,请检查!!!!!"); return null; } if (!panelParent.GetComponent()) { - Debug.LogError($"UnityEvo:panelParent上不存在Canvas组件,{this.UIPath}无法创建,进程已中断,请检查!!!!!"); + Debug.LogError($"UnityEvo:panelParent上不存在Canvas组件,{panelName}无法创建,进程已中断,请检查!!!!!"); return null; } @@ -170,7 +167,7 @@ namespace Stary.Evo.UIFarme return activePanel.gameObject; } - var handle= YooAssets.LoadAssetAsync(UIPath); + var handle= YooAssets.LoadAssetAsync(panelName); await handle.Task; activePanel = GameObject.Instantiate(handle.AssetObject as GameObject,panelParent); diff --git a/Assets/06.UIFarme/RunTime/Manager/PanelSystem.cs b/Assets/06.UIFarme/RunTime/Manager/PanelSystem.cs index a636517..0cde348 100644 --- a/Assets/06.UIFarme/RunTime/Manager/PanelSystem.cs +++ b/Assets/06.UIFarme/RunTime/Manager/PanelSystem.cs @@ -104,7 +104,7 @@ namespace Stary.Evo.UIFarme nextPanel = new T(); nextPanel.Initialize(this); nextPanel.SetPanelParent(parent); - GameObject panelGo = await nextPanel.CreatePanel(); + GameObject panelGo = await nextPanel.CreatePanel(panelName); ///生成面板后,进行初始化操作 nextPanel.Initialize(panelGo); dicUI.Add(panelName, nextPanel); @@ -137,7 +137,7 @@ namespace Stary.Evo.UIFarme nextPanel = new T(); nextPanel.Initialize(this); nextPanel.SetPanelParent(parent); - GameObject panelGo = await nextPanel.CreatePanel(); + GameObject panelGo = await nextPanel.CreatePanel(panelName); ///生成面板后,进行初始化操作 nextPanel.Initialize(panelGo); diff --git a/Assets/06.UIFarme/package.json b/Assets/06.UIFarme/package.json index f2da219..880f283 100644 --- a/Assets/06.UIFarme/package.json +++ b/Assets/06.UIFarme/package.json @@ -1,7 +1,7 @@ { "name": "com.staryevo.uifarme", "displayName": "06.UIFarme", - "version": "1.0.2", + "version": "1.0.3", "description": "UI模板框架工具", "unity": "2021.3", "unityRelease": "30f1",