Skip to content

Commit c17d6f7

Browse files
authored
Merge branch 'GameFrameX:main' into main
2 parents 8e49094 + d295ad8 commit c17d6f7

5 files changed

Lines changed: 41 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## [2.1.0](https://github.com/GameFrameX/com.gameframex.unity.ui.fairygui/tree/2.1.0) (2025-09-17)
4+
5+
[Full Changelog](https://github.com/GameFrameX/com.gameframex.unity.ui.fairygui/compare/2.0.0...2.1.0)
6+
7+
**Merged pull requests:**
8+
9+
- \[修改\] RemovePackage 时如果只有描述文件,没有资源文件,报 can not be null [\#1](https://github.com/GameFrameX/com.gameframex.unity.ui.fairygui/pull/1) ([DreamChaseAndVera](https://github.com/DreamChaseAndVera))
10+
311
## [2.0.0](https://github.com/GameFrameX/com.gameframex.unity.ui.fairygui/tree/2.0.0) (2025-06-12)
412

513
[Full Changelog](https://github.com/GameFrameX/com.gameframex.unity.ui.fairygui/compare/1.2.6...2.0.0)

Runtime/FairyGUIFormHelper.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
//------------------------------------------------------------
77

88
using System;
9+
using System.Reflection;
910
using FairyGUI;
1011
using GameFrameX.Asset.Runtime;
1112
using GameFrameX.Runtime;
@@ -21,6 +22,7 @@ namespace GameFrameX.UI.FairyGUI.Runtime
2122
public class FairyGUIFormHelper : UIFormHelperBase
2223
{
2324
private AssetComponent m_AssetComponent = null;
25+
private UIComponent m_UIComponent = null;
2426

2527
/// <summary>
2628
/// 实例化界面。
@@ -39,7 +41,6 @@ public override object InstantiateUIForm(object uiFormAsset)
3941
/// 创建界面。
4042
/// </summary>
4143
/// <param name="uiFormInstance">界面实例。</param>
42-
/// <param name="uiGroup">界面所属的界面组。</param>
4344
/// <param name="uiFormType">界面逻辑类型</param>
4445
/// <param name="userData">用户自定义数据。</param>
4546
/// <returns>界面。</returns>
@@ -67,6 +68,15 @@ public override IUIForm CreateUIForm(object uiFormInstance, Type uiFormType, obj
6768

6869
var uiGroup = uiForm.UIGroup;
6970

71+
if (uiGroup == null)
72+
{
73+
var attribute = uiFormType.GetCustomAttribute(typeof(OptionUIGroup));
74+
if (attribute is OptionUIGroup optionUIGroup)
75+
{
76+
uiGroup = m_UIComponent.GetUIGroup(optionUIGroup.GroupName);
77+
}
78+
}
79+
7080
if (uiGroup == null)
7181
{
7282
Log.Error("UI group is invalid.");
@@ -110,14 +120,21 @@ public override void ReleaseUIForm(object uiFormAsset, object uiFormInstance)
110120
}
111121
}
112122

113-
private void Start()
123+
private void Awake()
114124
{
115125
m_AssetComponent = GameEntry.GetComponent<AssetComponent>();
116126
if (m_AssetComponent == null)
117127
{
118128
Log.Fatal("Asset component is invalid.");
119129
return;
120130
}
131+
132+
m_UIComponent = GameEntry.GetComponent<UIComponent>();
133+
if (m_UIComponent == null)
134+
{
135+
Log.Fatal("UI component is invalid.");
136+
return;
137+
}
121138
}
122139
}
123140
}

Runtime/FairyGUILoadAsyncResourceHelper.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ public void ReleasePackage(string uiPackageName)
2323
if (m_UIPackages.TryGetValue(uiPackageName, out var uiPackageData))
2424
{
2525
AssetComponent.UnloadAsset(uiPackageData.DefiledAssetPath);
26-
AssetComponent.UnloadAsset(uiPackageData.ResourceAssetPath);
26+
if (uiPackageData.ResourceAssetPath != null)
27+
{
28+
AssetComponent.UnloadAsset(uiPackageData.ResourceAssetPath);
29+
}
30+
2731
uiPackageData.Dispose();
2832
m_UIPackages.Remove(uiPackageName);
2933
}

Runtime/UIManager.Open.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@ private IUIForm InternalOpenUIForm(int serialId, string uiFormAssetName, Type ui
107107
}
108108

109109
var uiGroup = uiForm.UIGroup;
110+
if (serialId < 0)
111+
{
112+
if (m_UIFormsToReleaseOnLoad.Contains(uiForm.SerialId))
113+
{
114+
m_UIFormsToReleaseOnLoad.Remove(uiForm.SerialId);
115+
}
116+
}
117+
110118
uiForm.Init(serialId, uiFormAssetName, uiGroup, OnInitAction, pauseCoveredUIForm, isNewInstance, userData, isFullScreen);
111119

112120
void OnInitAction(IUIForm obj)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Game Frame X UI FairyGUI",
44
"category": "Game Framework X",
55
"description": "独立游戏前后端一体化解决方案,独立游戏开发者的圆梦大使。\n文档地址: https://gameframex.doc.alianblank.com \n Game Frame X UI FairyGUI组件 - Unity UI功能包,提供FairyGUI组件的封装,使FairyGUI组件的使用更加简单高效。",
6-
"version": "2.0.0",
6+
"version": "2.1.0",
77
"unity": "2019.4",
88
"keywords": [
99
"Game Framework X"

0 commit comments

Comments
 (0)