[增加]1. 增加新的接口适配
This commit is contained in:
parent
7ef642e6d0
commit
841be32e9e
|
@ -5,7 +5,7 @@ using UnityEngine.Scripting;
|
|||
namespace GameFrameX.UI.UGUI.Runtime
|
||||
{
|
||||
[Preserve]
|
||||
public class UGUI : UIFormLogic
|
||||
public class UGUI : UIForm
|
||||
{
|
||||
/// <summary>
|
||||
/// 设置UI的显示状态,不发出事件
|
||||
|
|
|
@ -5,11 +5,13 @@
|
|||
// Feedback: mailto:ellan@gameframework.cn
|
||||
//------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using GameFrameX.Asset.Runtime;
|
||||
using GameFrameX.Runtime;
|
||||
using GameFrameX.UI.Runtime;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Scripting;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace GameFrameX.UI.UGUI.Runtime
|
||||
{
|
||||
|
@ -36,9 +38,10 @@ namespace GameFrameX.UI.UGUI.Runtime
|
|||
/// </summary>
|
||||
/// <param name="uiFormInstance">界面实例。</param>
|
||||
/// <param name="uiGroup">界面所属的界面组。</param>
|
||||
/// <param name="uiFormType">界面逻辑类</param>
|
||||
/// <param name="userData">用户自定义数据。</param>
|
||||
/// <returns>界面。</returns>
|
||||
public override IUIForm CreateUIForm(object uiFormInstance, IUIGroup uiGroup, object userData)
|
||||
public override IUIForm CreateUIForm(object uiFormInstance, IUIGroup uiGroup, Type uiFormType, object userData)
|
||||
{
|
||||
GameObject gameObject = uiFormInstance as GameObject;
|
||||
if (gameObject == null)
|
||||
|
@ -51,7 +54,8 @@ namespace GameFrameX.UI.UGUI.Runtime
|
|||
transform.SetParent(((MonoBehaviour)uiGroup.Helper).transform);
|
||||
transform.localScale = Vector3.one;
|
||||
|
||||
return gameObject.GetOrAddComponent<UIForm>();
|
||||
var componentType = gameObject.GetOrAddComponent(uiFormType);
|
||||
return componentType as IUIForm;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -564,7 +564,7 @@ namespace GameFrameX.UI.UGUI.Runtime
|
|||
/// <param name="uiFormAssetName">界面资源名称。</param>
|
||||
/// <param name="uiGroupName">界面组名称。</param>
|
||||
/// <returns>界面的序列编号。</returns>
|
||||
public Task<IUIForm> OpenUIFormAsync<T>(string uiFormAssetPath, string uiFormAssetName, string uiGroupName) where T : IUIFormLogic
|
||||
public Task<IUIForm> OpenUIFormAsync<T>(string uiFormAssetPath, string uiFormAssetName, string uiGroupName) where T : IUIForm
|
||||
{
|
||||
return OpenUIFormAsync(uiFormAssetPath, uiFormAssetName, uiGroupName, typeof(T), false, null);
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ namespace GameFrameX.UI.UGUI.Runtime
|
|||
/// <param name="uiGroupName">界面组名称。</param>
|
||||
/// <param name="pauseCoveredUIForm">是否暂停被覆盖的界面。</param>
|
||||
/// <returns>界面的序列编号。</returns>
|
||||
public Task<IUIForm> OpenUIFormAsync<T>(string uiFormAssetPath, string uiFormAssetName, string uiGroupName, bool pauseCoveredUIForm) where T : IUIFormLogic
|
||||
public Task<IUIForm> OpenUIFormAsync<T>(string uiFormAssetPath, string uiFormAssetName, string uiGroupName, bool pauseCoveredUIForm) where T : IUIForm
|
||||
{
|
||||
return OpenUIFormAsync(uiFormAssetPath, uiFormAssetName, uiGroupName, typeof(T), pauseCoveredUIForm, null);
|
||||
}
|
||||
|
@ -591,7 +591,7 @@ namespace GameFrameX.UI.UGUI.Runtime
|
|||
/// <param name="uiGroupName">界面组名称。</param>
|
||||
/// <param name="userData">用户自定义数据。</param>
|
||||
/// <returns>界面的序列编号。</returns>
|
||||
public async Task<IUIForm> OpenUIFormAsync<T>(string uiFormAssetPath, string uiFormAssetName, string uiGroupName, object userData) where T : IUIFormLogic
|
||||
public async Task<IUIForm> OpenUIFormAsync<T>(string uiFormAssetPath, string uiFormAssetName, string uiGroupName, object userData) where T : IUIForm
|
||||
{
|
||||
return await OpenUIFormAsync(uiFormAssetPath, uiFormAssetName, uiGroupName, typeof(T), false, userData);
|
||||
}
|
||||
|
@ -932,13 +932,13 @@ namespace GameFrameX.UI.UGUI.Runtime
|
|||
{
|
||||
try
|
||||
{
|
||||
IUIForm uiForm = m_UIFormHelper.CreateUIForm(uiFormInstance, uiGroup, userData);
|
||||
IUIForm uiForm = m_UIFormHelper.CreateUIForm(uiFormInstance, uiGroup, typeof(UGUI), userData);
|
||||
if (uiForm == null)
|
||||
{
|
||||
throw new GameFrameworkException("Can not create UI form in UI form helper.");
|
||||
}
|
||||
|
||||
uiForm.OnInit(serialId, uiFormAssetName, uiGroup, typeof(UGUI), null, pauseCoveredUIForm, isNewInstance, userData);
|
||||
uiForm.OnInit(serialId, uiFormAssetName, uiGroup, null, pauseCoveredUIForm, isNewInstance, userData);
|
||||
uiGroup.AddUIForm(uiForm);
|
||||
uiForm.OnOpen(userData);
|
||||
uiGroup.Refresh();
|
||||
|
|
Loading…
Reference in New Issue