多轮审查和修复

This commit is contained in:
2026-05-12 15:34:08 +08:00
parent f55d2a57c3
commit ebbbb7332e
805 changed files with 838724 additions and 1905 deletions

View File

@@ -0,0 +1,64 @@
#if UNITY_EDITOR
using UnityEditor;
using UnityEngine;
using BaseGames.Combat;
namespace BaseGames.Editor
{
/// <summary>
/// HurtBox 运行时注入状态可视化面板。
/// 通过 HurtBox 上的 Editor* 属性读取注入状态,以颜色区分是否注入成功。
/// 绿色 = 注入完成;橙色 = 未注入(该能力静默不生效);灰色 = 非 PlayMode。
/// </summary>
[CustomEditor(typeof(HurtBox))]
public class HurtBoxEditor : UnityEditor.Editor
{
// (属性访问器, 标签, 缺席说明)
private static readonly (System.Func<HurtBox, object> getter, string label, string absentNote)[] _fields =
{
(hb => hb.EditorOwner, "Owner (IDamageable)", "— 注入失败ReceiveDamage 将无效"),
(hb => hb.EditorShieldable, "Shieldable", "— 未注入(玩家专属,敌人无需)"),
(hb => hb.EditorParrySystem, "ParrySystem", "— 未注入(弹反静默不生效)"),
(hb => hb.EditorPoiseSource, "PoiseSource", "— 未注入(霸体静默不生效)"),
(hb => hb.EditorStatusEffectable, "StatusEffectable", "— 未注入(状态效果静默不生效)"),
};
public override void OnInspectorGUI()
{
DrawDefaultInspector();
EditorGUILayout.Space(4);
EditorGUILayout.LabelField("── 运行时注入状态 ──", EditorStyles.boldLabel);
if (!Application.isPlaying)
{
EditorGUILayout.HelpBox("进入 PlayMode 后查看注入状态。", MessageType.Info);
return;
}
var hurtBox = (HurtBox)target;
foreach (var (getter, label, absentNote) in _fields)
{
var value = getter(hurtBox);
bool present = value != null;
var savedColor = GUI.contentColor;
GUI.contentColor = present
? new Color(0.3f, 0.9f, 0.4f) // 绿
: new Color(1.0f, 0.6f, 0.1f); // 橙
string displayValue = present
? $"✓ {value.GetType().Name}"
: $"✗ null {absentNote}";
EditorGUILayout.LabelField(label, displayValue);
GUI.contentColor = savedColor;
}
// 持续刷新(避免只显示初始状态)
if (Application.isPlaying) Repaint();
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8650ccc7960fe304a95be1c629ef7b1e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: