06 修改
This commit is contained in:
@@ -9,10 +9,7 @@ namespace Stary.Evo.UIFarme
|
|||||||
{
|
{
|
||||||
public interface IBasePanel : IController
|
public interface IBasePanel : IController
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// UI信息
|
|
||||||
/// </summary>
|
|
||||||
string UIPath { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 绑定这个面板的实例
|
/// 绑定这个面板的实例
|
||||||
@@ -53,7 +50,7 @@ namespace Stary.Evo.UIFarme
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type">ui信息</param>
|
/// <param name="type">ui信息</param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<GameObject> CreatePanel();
|
Task<GameObject> CreatePanel(string panelName);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 销毁一个Ui对象
|
/// 销毁一个Ui对象
|
||||||
@@ -94,9 +91,9 @@ namespace Stary.Evo.UIFarme
|
|||||||
|
|
||||||
protected GameObject activePanel{get;private set;}
|
protected GameObject activePanel{get;private set;}
|
||||||
|
|
||||||
protected BasePanel(string uiPath)
|
protected BasePanel()
|
||||||
{
|
{
|
||||||
UIPath = uiPath;
|
|
||||||
selectableDict = new Dictionary<string, Selectable>();
|
selectableDict = new Dictionary<string, Selectable>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,17 +148,17 @@ namespace Stary.Evo.UIFarme
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task<GameObject> CreatePanel()
|
public async Task<GameObject> CreatePanel(string panelName)
|
||||||
{
|
{
|
||||||
if (panelParent == null)
|
if (panelParent == null)
|
||||||
{
|
{
|
||||||
Debug.LogError($"UnityEvo:parent为空,{this.UIPath}无法创建,进程已中断,请检查!!!!!");
|
Debug.LogError($"UnityEvo:parent为空,{panelName}无法创建,进程已中断,请检查!!!!!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!panelParent.GetComponent<Canvas>())
|
if (!panelParent.GetComponent<Canvas>())
|
||||||
{
|
{
|
||||||
Debug.LogError($"UnityEvo:panelParent上不存在Canvas组件,{this.UIPath}无法创建,进程已中断,请检查!!!!!");
|
Debug.LogError($"UnityEvo:panelParent上不存在Canvas组件,{panelName}无法创建,进程已中断,请检查!!!!!");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +167,7 @@ namespace Stary.Evo.UIFarme
|
|||||||
return activePanel.gameObject;
|
return activePanel.gameObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
var handle= YooAssets.LoadAssetAsync<GameObject>(UIPath);
|
var handle= YooAssets.LoadAssetAsync<GameObject>(panelName);
|
||||||
await handle.Task;
|
await handle.Task;
|
||||||
|
|
||||||
activePanel = GameObject.Instantiate(handle.AssetObject as GameObject,panelParent);
|
activePanel = GameObject.Instantiate(handle.AssetObject as GameObject,panelParent);
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ namespace Stary.Evo.UIFarme
|
|||||||
nextPanel = new T();
|
nextPanel = new T();
|
||||||
nextPanel.Initialize(this);
|
nextPanel.Initialize(this);
|
||||||
nextPanel.SetPanelParent(parent);
|
nextPanel.SetPanelParent(parent);
|
||||||
GameObject panelGo = await nextPanel.CreatePanel();
|
GameObject panelGo = await nextPanel.CreatePanel(panelName);
|
||||||
///生成面板后,进行初始化操作
|
///生成面板后,进行初始化操作
|
||||||
nextPanel.Initialize(panelGo);
|
nextPanel.Initialize(panelGo);
|
||||||
dicUI.Add(panelName, nextPanel);
|
dicUI.Add(panelName, nextPanel);
|
||||||
@@ -137,7 +137,7 @@ namespace Stary.Evo.UIFarme
|
|||||||
nextPanel = new T();
|
nextPanel = new T();
|
||||||
nextPanel.Initialize(this);
|
nextPanel.Initialize(this);
|
||||||
nextPanel.SetPanelParent(parent);
|
nextPanel.SetPanelParent(parent);
|
||||||
GameObject panelGo = await nextPanel.CreatePanel();
|
GameObject panelGo = await nextPanel.CreatePanel(panelName);
|
||||||
///生成面板后,进行初始化操作
|
///生成面板后,进行初始化操作
|
||||||
nextPanel.Initialize(panelGo);
|
nextPanel.Initialize(panelGo);
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "com.staryevo.uifarme",
|
"name": "com.staryevo.uifarme",
|
||||||
"displayName": "06.UIFarme",
|
"displayName": "06.UIFarme",
|
||||||
"version": "1.0.2",
|
"version": "1.0.3",
|
||||||
"description": "UI模板框架工具",
|
"description": "UI模板框架工具",
|
||||||
"unity": "2021.3",
|
"unity": "2021.3",
|
||||||
"unityRelease": "30f1",
|
"unityRelease": "30f1",
|
||||||
|
|||||||
Reference in New Issue
Block a user