diff --git a/Assets/GameMain/DataTables/tbformattext.bytes b/Assets/GameMain/DataTables/tbformattext.bytes
index a63b4d0..39e454a 100644
--- a/Assets/GameMain/DataTables/tbformattext.bytes
+++ b/Assets/GameMain/DataTables/tbformattext.bytes
@@ -1 +1 @@
-
ATKFormatText ATK {0}
MATFormatText MAT {0}
SPDFormatText SPD {0}HPFormatTextHP {0}MPFormatTextMP {0}
STAFormatText STA {0}WarehouseCapacity{0} ITEMS / {1} TOTAL UNITS
\ No newline at end of file
+
ATKFormatText ATK {0}
MATFormatText MAT {0}
SPDFormatText SPD {0}HPFormatTextHP {0}MPFormatTextMP {0}
STAFormatText STA {0}WarehouseCapacity{0} ITEMS / {1} TOTAL UNITS
BattleBarText {0} / {1}
\ No newline at end of file
diff --git a/Assets/GameMain/DataTables/tbformattext.json b/Assets/GameMain/DataTables/tbformattext.json
index 32ef809..9979391 100644
--- a/Assets/GameMain/DataTables/tbformattext.json
+++ b/Assets/GameMain/DataTables/tbformattext.json
@@ -26,5 +26,9 @@
{
"name": "WarehouseCapacity",
"format": "{0} ITEMS / {1} TOTAL UNITS"
+ },
+ {
+ "name": "BattleBarText",
+ "format": "{0} / {1}"
}
]
\ No newline at end of file
diff --git a/Assets/GameMain/DataTables/tbuiformconfig.bytes b/Assets/GameMain/DataTables/tbuiformconfig.bytes
index 628fef0..3cf769e 100644
Binary files a/Assets/GameMain/DataTables/tbuiformconfig.bytes and b/Assets/GameMain/DataTables/tbuiformconfig.bytes differ
diff --git a/Assets/GameMain/DataTables/tbuiformconfig.json b/Assets/GameMain/DataTables/tbuiformconfig.json
index 80a5bcd..3a04a1e 100644
--- a/Assets/GameMain/DataTables/tbuiformconfig.json
+++ b/Assets/GameMain/DataTables/tbuiformconfig.json
@@ -26,5 +26,12 @@
"UIGroupName": "Default",
"allowMultiInstance": false,
"pauseCoveredUIForm": true
+ },
+ {
+ "id": 103,
+ "assetName": "BattleForm",
+ "UIGroupName": "Default",
+ "allowMultiInstance": false,
+ "pauseCoveredUIForm": true
}
]
\ No newline at end of file
diff --git a/Assets/GameMain/Scripts/Base/Gen/UIFormType.cs b/Assets/GameMain/Scripts/Base/Gen/UIFormType.cs
index 9eead81..ba9408b 100644
--- a/Assets/GameMain/Scripts/Base/Gen/UIFormType.cs
+++ b/Assets/GameMain/Scripts/Base/Gen/UIFormType.cs
@@ -36,6 +36,10 @@ namespace SepCore.Definition
/// 关于
///
AboutForm = 102,
+ ///
+ /// 战斗界面
+ ///
+ BattleForm = 103,
}
}
diff --git a/Assets/GameMain/Scripts/Editor/BattleUIPrefabBuilder.cs b/Assets/GameMain/Scripts/Editor/BattleUIPrefabBuilder.cs
new file mode 100644
index 0000000..9fda1c8
--- /dev/null
+++ b/Assets/GameMain/Scripts/Editor/BattleUIPrefabBuilder.cs
@@ -0,0 +1,592 @@
+using System;
+using System.Linq;
+using SepCore.UI;
+using TMPro;
+using UnityEditor;
+using UnityEditor.SceneManagement;
+using UnityEngine;
+using UnityEngine.SceneManagement;
+using UnityEngine.UI;
+
+namespace SepCore.Editor
+{
+ public static class BattleUIPrefabBuilder
+ {
+ private const string PrefabPath = "Assets/GameMain/UI/UIForms/BattleForm.prefab";
+ private const string CharacterAtlasPath = "Assets/GameMain/Textures/Characters.png";
+ private const string EnemyAtlasPath = "Assets/GameMain/Textures/Monsters.png";
+ private const string ItemAtlasPath = "Assets/GameMain/Textures/Items.png";
+ private const string PreviewCameraName = "__BattlePreviewCamera";
+ private const string PreviewRootName = "__BattlePreview";
+ private const string PreviousScenePathKey = "BattleUI.PreviousScenePath";
+
+ private static readonly Color Overlay = new Color32(8, 7, 12, 184);
+ private static readonly Color Charcoal = new Color32(25, 24, 30, 255);
+ private static readonly Color CharcoalSoft = new Color32(42, 39, 47, 255);
+ private static readonly Color Ivory = new Color32(244, 237, 214, 255);
+ private static readonly Color Ink = new Color32(43, 37, 35, 255);
+ private static readonly Color White = new Color32(248, 248, 246, 255);
+ private static readonly Color MutedWhite = new Color32(192, 190, 184, 255);
+ private static readonly Color Green = new Color32(62, 164, 94, 255);
+ private static readonly Color Blue = new Color32(62, 119, 190, 255);
+ private static readonly Color Red = new Color32(191, 69, 65, 255);
+ private static readonly Color Gold = new Color32(218, 169, 64, 255);
+ private static readonly Color EnemyFrame = new Color32(91, 39, 54, 235);
+
+ private static TMP_FontAsset font;
+ private static Sprite panelBeige;
+ private static Sprite panelBrown;
+ private static Sprite panelBlue;
+ private static Sprite buttonBlue;
+ private static Sprite buttonBluePressed;
+ private static Sprite buttonBrown;
+ private static Sprite buttonBrownPressed;
+ private static Sprite buttonBeige;
+ private static Sprite buttonBeigePressed;
+ private static Sprite buttonGrey;
+ private static Sprite buttonGreyPressed;
+ private static Sprite escapeIcon;
+ private static Sprite[] playerIcons;
+ private static Sprite[] enemyIcons;
+ private static Sprite attackIcon;
+ private static Sprite skillIcon;
+ private static Sprite itemIcon;
+
+ [MenuItem("Utility/UI/Build Battle UI")]
+ public static void Build()
+ {
+ LoadAssets();
+
+ Scene previousScene = SceneManager.GetActiveScene();
+ Scene temporaryScene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Additive);
+ GameObject root = null;
+
+ try
+ {
+ SceneManager.SetActiveScene(temporaryScene);
+ root = BuildRoot();
+ UISerializationRoot serializationRoot = root.GetComponent();
+ serializationRoot.RefreshItems();
+ UIAssetsTools.ApplyGeneratedComponentsToRoot(serializationRoot);
+
+ bool success;
+ PrefabUtility.SaveAsPrefabAsset(root, PrefabPath, out success);
+ if (!success)
+ {
+ throw new InvalidOperationException("Failed to save BattleForm prefab.");
+ }
+ }
+ finally
+ {
+ if (root != null)
+ {
+ UnityEngine.Object.DestroyImmediate(root);
+ }
+
+ if (previousScene.IsValid())
+ {
+ SceneManager.SetActiveScene(previousScene);
+ }
+
+ EditorSceneManager.CloseScene(temporaryScene, true);
+ }
+
+ AssetDatabase.SaveAssets();
+ AssetDatabase.Refresh();
+ Selection.activeObject = AssetDatabase.LoadAssetAtPath(PrefabPath);
+ Debug.Log("Battle UI prefab rebuilt: " + PrefabPath);
+ }
+
+ [MenuItem("Utility/UI/Preview Battle UI")]
+ public static void OpenPreview()
+ {
+ ClosePreviewInternal();
+
+ Scene previousScene = SceneManager.GetActiveScene();
+ SessionState.SetString(PreviousScenePathKey, previousScene.path);
+ Scene previewScene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Additive);
+ SceneManager.SetActiveScene(previewScene);
+
+ GameObject cameraObject = new GameObject(PreviewCameraName, typeof(Camera));
+ Camera previewCamera = cameraObject.GetComponent();
+ previewCamera.clearFlags = CameraClearFlags.SolidColor;
+ previewCamera.backgroundColor = new Color(0.22f, 0.25f, 0.23f, 1f);
+ previewCamera.orthographic = true;
+ previewCamera.orthographicSize = 5f;
+ cameraObject.transform.position = new Vector3(0f, 0f, -10f);
+
+ GameObject prefab = AssetDatabase.LoadAssetAtPath(PrefabPath);
+ if (prefab == null)
+ {
+ throw new InvalidOperationException("Build BattleForm before opening its preview.");
+ }
+
+ GameObject previewRoot = (GameObject)PrefabUtility.InstantiatePrefab(prefab, previewScene);
+ previewRoot.name = PreviewRootName;
+ Canvas canvas = previewRoot.GetComponent