diff --git a/.gitignore b/.gitignore
index 46c0c15..7dcfacd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -104,3 +104,4 @@ AGENTS.md
/.dotnet-home
/[Aa]ssets/RawResources
/[Aa]ssets/RawResources.meta
+/docs/TODO.md
diff --git a/Assets/GameMain/DataTables/UIForm.txt b/Assets/GameMain/DataTables/UIForm.txt
index ec55e18..969d161 100644
--- a/Assets/GameMain/DataTables/UIForm.txt
+++ b/Assets/GameMain/DataTables/UIForm.txt
@@ -6,6 +6,7 @@
100 主菜单 MenuForm Default False True
101 设置 SettingForm Default False True
102 关于 AboutForm Default False True
- 150 测试UI TestMenuForm Default False True
- 200 事件UI EventForm Default False True
+ 103 主UI MainForm Default False True
+ 150 测试UI TestMenuForm Default False False
+ 200 事件UI EventForm Default False False
201 背包UI RepoForm Default False True
diff --git a/Assets/GameMain/Scripts/Base/GameEntry.Custom.cs b/Assets/GameMain/Scripts/Base/GameEntry.Custom.cs
index 1233e3c..c1bfed6 100644
--- a/Assets/GameMain/Scripts/Base/GameEntry.Custom.cs
+++ b/Assets/GameMain/Scripts/Base/GameEntry.Custom.cs
@@ -1,31 +1,25 @@
-//------------------------------------------------------------
-// Game Framework
-// Copyright © 2013-2021 Jiang Yin. All rights reserved.
-// Homepage: https://gameframework.cn/
-// Feedback: mailto:ellan@gameframework.cn
-//------------------------------------------------------------
-
-using CustomComponent;
+using CustomComponent;
using GeometryTD.CustomComponent;
-using UnityEngine;
///
/// 游戏入口。
///
-public partial class GameEntry : MonoBehaviour
+public partial class GameEntry
{
public static BuiltinDataComponent BuiltinData { get; private set; }
public static HPBarComponent HPBar { get; private set; }
public static UIRouterComponent UIRouter { get; private set; }
-
+
public static EventNodeComponent EventNode { get; private set; }
public static CombatNodeComponent CombatNode { get; private set; }
-
+
public static ShopNodeComponent ShopNode { get; private set; }
+ public static ResolutionAdapterComponent ResolutionAdapter { get; private set; }
+
private static void InitCustomComponents()
{
BuiltinData = UnityGameFramework.Runtime.GameEntry.GetComponent();
@@ -34,5 +28,11 @@ public partial class GameEntry : MonoBehaviour
EventNode = UnityGameFramework.Runtime.GameEntry.GetComponent();
CombatNode = UnityGameFramework.Runtime.GameEntry.GetComponent();
ShopNode = UnityGameFramework.Runtime.GameEntry.GetComponent();
+ ResolutionAdapter = UnityGameFramework.Runtime.GameEntry.GetComponent();
+ if (ResolutionAdapter == null)
+ {
+ UnityGameFramework.Runtime.Log.Warning(
+ "ResolutionAdapterComponent is missing. Please add it in Launcher scene and inject UI roots.");
+ }
}
}
diff --git a/Assets/GameMain/Scripts/CustomComponent/ResolutionAdapterComponent.cs b/Assets/GameMain/Scripts/CustomComponent/ResolutionAdapterComponent.cs
new file mode 100644
index 0000000..3a39863
--- /dev/null
+++ b/Assets/GameMain/Scripts/CustomComponent/ResolutionAdapterComponent.cs
@@ -0,0 +1,445 @@
+using System.Collections.Generic;
+using GameFramework.Event;
+using UnityEngine;
+using UnityEngine.UI;
+using UnityGameFramework.Runtime;
+
+namespace GeometryTD.CustomComponent
+{
+ ///
+ /// Keeps gameplay camera and UI in a fixed design aspect, then fills extra area with black masks.
+ ///
+ public class ResolutionAdapterComponent : GameFrameworkComponent
+ {
+ private const float DefaultCanvasPlaneDistance = 100f;
+
+ [SerializeField] private Vector2 _referenceResolution = new Vector2(2560f, 1600f);
+ [SerializeField] private bool _adaptUiCanvasToViewport = true;
+ [SerializeField] private bool _enableBlackMask = true;
+ [SerializeField] private List _uiRoots = new List();
+
+ private readonly List