迁移剩下的 UI 到 Serialization 方式

This commit is contained in:
2026-09-14 17:19:31 +08:00
parent 091a29db63
commit b628a8537c
107 changed files with 4147 additions and 3680 deletions
@@ -0,0 +1,41 @@
using SepCore.Definition;
using TMPro;
using UnityEngine;
using UnityGameFramework.Runtime;
namespace SepCore.UI
{
/// <summary>
/// 使用 Luban 格式化文本表(TbFormatText)驱动 TextMeshProUGUI 的组件。
/// 在 Inspector 上填写 Key,调用 Set 传入格式化参数即可更新文本。
/// </summary>
[RequireComponent(typeof(TextMeshProUGUI))]
public class FormatTextUI : MonoBehaviour
{
[SerializeField] private string key;
private TextMeshProUGUI _text;
private void Awake()
{
_text = GetComponent<TextMeshProUGUI>();
}
public void Set(params object[] args)
{
FormatText format = GameEntry.Luban.Tables.TbFormatText.GetOrDefault(key);
if (format == null)
{
Log.Warning("Can not find format text '{0}'.", key);
return;
}
_text.SetText(string.Format(format.Format, args));
}
public void Clear()
{
_text.SetText(string.Empty);
}
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2efdcd06cdaa830448f76b22ea7c98fb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: