Skip to content

Commit

Permalink
[修复]1. 修复UI组件设置错误的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
AlianBlank committed Feb 24, 2025
1 parent 958cf42 commit 6689cb0
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions Runtime/UIComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ public partial class UIComponent : GameFrameworkComponent

[SerializeField] private Transform m_InstanceRoot = null;

[SerializeField] private string m_UIFormHelperTypeName = "GameFrameX.UI.Runtime.DefaultUIFormHelper";
[SerializeField] private string m_UIFormHelperTypeName = "GameFrameX.UI.FairyGUI.Runtime.FairyGUIFormHelper";

[SerializeField] private UIFormHelperBase m_CustomUIFormHelper = null;

[SerializeField] private string m_UIGroupHelperTypeName = "GameFrameX.UI.Runtime.DefaultUIGroupHelper";
[SerializeField] private string m_UIGroupHelperTypeName = "GameFrameX.UI.FairyGUI.Runtime.FairyGUIUIGroupHelper";

[SerializeField] private UIGroupHelperBase m_CustomUIGroupHelper = null;

Expand Down Expand Up @@ -126,11 +126,37 @@ protected override void Awake()
ImplementationComponentType = Utility.Assembly.GetType(componentType);
InterfaceComponentType = typeof(IUIManager);
base.Awake();
var namespaceName = ImplementationComponentType.Namespace;

#if ENABLE_UI_FAIRYGUI
if (!namespaceName.StartsWithFast("GameFrameX.UI.FairyGUI.Runtime"))
{
Debug.LogError("UI组件的 ComponentType 设置错误。请设置和 UI 系统一致的组件.");
return;
}
#elif ENABLE_UI_UGUI
if (!namespaceName.StartsWithFast("GameFrameX.UI.UGUI.Runtime"))
{
Debug.LogError("UI组件的 ComponentType 设置错误。请设置和 UI 系统一致的组件.");
return;
}
#endif
if (!m_UIFormHelperTypeName.StartsWithFast(namespaceName))
{
Debug.LogError("UI组件的 UI Form Helper 设置错误。请设置和 ComponentType 类型 一致.");
return;
}

if (!m_UIGroupHelperTypeName.StartsWithFast(namespaceName))
{
Debug.LogError("UI组件的 UI Group Helper 设置错误。请设置和 ComponentType 类型 一致.");
return;
}

m_UIManager = GameFrameworkEntry.GetModule<IUIManager>();
if (m_UIManager == null)
{
Log.Fatal("UI manager is invalid.");
Debug.LogError("UI manager is invalid.");
return;
}

Expand Down

0 comments on commit 6689cb0

Please sign in to comment.