[修改]1. 修改新的参数适配

This commit is contained in:
Blank 2024-11-08 15:16:28 +08:00
parent 807762d548
commit dd1ee6c913
3 changed files with 14 additions and 11 deletions

View File

@ -5,7 +5,7 @@ using GameFrameX.UI.Runtime;
namespace GameFrameX.UI.FairyGUI.Runtime
{
[UnityEngine.Scripting.Preserve]
public class FUI : UIFormLogic
public class FUI : UIForm
{
/// <summary>
/// UI 对象
@ -27,7 +27,7 @@ namespace GameFrameX.UI.FairyGUI.Runtime
GObject.visible = value;
OnVisibleChanged?.Invoke(value);
EventSubscriber.Fire(UIFormVisibleChangedEventArgs.EventId, UIFormVisibleChangedEventArgs.Create(UIForm, value, null));
EventSubscriber.Fire(UIFormVisibleChangedEventArgs.EventId, UIFormVisibleChangedEventArgs.Create(this, value, null));
}
public override bool Visible
@ -55,7 +55,7 @@ namespace GameFrameX.UI.FairyGUI.Runtime
GObject.visible = value;
OnVisibleChanged?.Invoke(value);
EventSubscriber.Fire(UIFormVisibleChangedEventArgs.EventId, UIFormVisibleChangedEventArgs.Create(UIForm, value, null));
EventSubscriber.Fire(UIFormVisibleChangedEventArgs.EventId, UIFormVisibleChangedEventArgs.Create(this, value, null));
}
}

View File

@ -5,6 +5,7 @@
// Feedback: mailto:ellan@gameframework.cn
//------------------------------------------------------------
using System;
using FairyGUI;
using GameFrameX.Asset.Runtime;
using GameFrameX.Runtime;
@ -39,9 +40,10 @@ namespace GameFrameX.UI.FairyGUI.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)
{
GComponent component = uiFormInstance as GComponent;
if (component == null)
@ -66,7 +68,8 @@ namespace GameFrameX.UI.FairyGUI.Runtime
uiGroupComponent.AddChild(component);
return component.displayObject.gameObject.GetOrAddComponent<UIForm>();
var componentType = component.displayObject.gameObject.GetOrAddComponent(uiFormType);
return componentType as IUIForm;
}
/// <summary>

View File

@ -582,7 +582,7 @@ namespace GameFrameX.UI.FairyGUI.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);
}
@ -596,7 +596,7 @@ namespace GameFrameX.UI.FairyGUI.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);
}
@ -609,7 +609,7 @@ namespace GameFrameX.UI.FairyGUI.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);
}
@ -1004,15 +1004,15 @@ namespace GameFrameX.UI.FairyGUI.Runtime
{
try
{
IUIForm uiForm = m_UIFormHelper.CreateUIForm(uiFormInstance, uiGroup, userData);
IUIForm uiForm = m_UIFormHelper.CreateUIForm(uiFormInstance, uiGroup, uiFormType, userData);
if (uiForm == null)
{
throw new GameFrameworkException("Can not create UI form in UI form helper.");
}
uiForm.OnInit(serialId, uiFormAssetName, uiGroup, uiFormType, OnInitAction, pauseCoveredUIForm, isNewInstance, userData, isFullScreen);
uiForm.OnInit(serialId, uiFormAssetName, uiGroup, OnInitAction, pauseCoveredUIForm, isNewInstance, userData, isFullScreen);
void OnInitAction(UIFormLogic obj)
void OnInitAction(IUIForm obj)
{
if (obj is FUI fui)
{