修改优化layer
This commit is contained in:
@@ -89,7 +89,7 @@ namespace BaseGames.Editor
|
||||
_listView.style.flexGrow = 1;
|
||||
_listView.selectionType = SelectionType.Single;
|
||||
_listView.showAlternatingRowBackgrounds = AlternatingRowBackground.ContentOnly;
|
||||
_listView.onSelectionChange += objects =>
|
||||
_listView.selectionChanged += objects =>
|
||||
{
|
||||
var sel = objects.OfType<T>().FirstOrDefault();
|
||||
if (sel != null) _savedGuid = AssetOperations.GetGuid(sel);
|
||||
@@ -227,7 +227,7 @@ namespace BaseGames.Editor
|
||||
{
|
||||
_listView.SetSelection(i);
|
||||
_listView.ScrollToItem(i);
|
||||
// SetSelection 在 RefreshItems 同帧内不保证触发 onSelectionChange,
|
||||
// SetSelection 在 RefreshItems 同帧内不保证触发 selectionChanged,
|
||||
// 显式调用以确保详情区始终同步。
|
||||
SelectionChanged?.Invoke(_filtered[i]);
|
||||
return;
|
||||
|
||||
@@ -10,47 +10,51 @@ namespace BaseGames.Editor
|
||||
///
|
||||
/// 菜单:BaseGames → Tools → Physics2D Layer Matrix
|
||||
///
|
||||
/// 检查规则:
|
||||
/// · PlayerHitBox ↔ EnemyHurtBox → 应碰撞(玩家攻击伤害敌人)
|
||||
/// · EnemyHitBox ↔ PlayerHurtBox → 应碰撞(敌人攻击伤害玩家)
|
||||
/// · EnemyHitBox ↔ EnemyHurtBox → 应碰撞(敌人可互相伤害,HitBox 运行时排除自身根节点)
|
||||
/// · Player ↔ Platform → 应碰撞(玩家站在平台上)
|
||||
/// · Enemy ↔ Platform → 应碰撞(敌人站在平台上)
|
||||
/// · PlayerProjectile ↔ EnemyHurtBox → 应碰撞(玩家投射物伤害敌人)
|
||||
/// · PlayerProjectile ↔ PlayerHurtBox → 应忽略(玩家投射物不自伤)
|
||||
/// ⚠️ 此工具仅管理下方 ExpectedPairs 中显式定义的 Layer 对,
|
||||
/// 不会读取或修改任何其他 Layer 的碰撞设置。
|
||||
///
|
||||
/// 检查规则(Layer 名称以项目 Tags and Layers 为准):
|
||||
/// · PlayerHitBox ↔ EnemyHurtBox → 应碰撞(玩家攻击伤害敌人)
|
||||
/// · EnemyHitBox ↔ PlayerHurtBox → 应碰撞(敌人攻击伤害玩家)
|
||||
/// · EnemyHitBox ↔ EnemyHurtBox → 应碰撞(敌人可互相伤害,HitBox 运行时排除自身根节点)
|
||||
/// · Player ↔ Platform → 应碰撞(玩家站在平台上)
|
||||
/// · Enemy ↔ Platform → 应碰撞(敌人站在平台上)
|
||||
/// · PlayerProjectile ↔ EnemyHurtBox → 应碰撞(玩家投射物伤害敌人)
|
||||
/// · PlayerProjectile ↔ PlayerHurtBox → 应忽略(玩家投射物不自伤)
|
||||
/// · PlayerProjectile ↔ Platform → 应碰撞(玩家投射物命中地形)
|
||||
/// · EnemyProjectile ↔ PlayerHurtBox → 应碰撞(敌人投射物伤害玩家)
|
||||
/// · EnemyProjectile ↔ EnemyHurtBox → 应忽略(敌人投射物不自伤)
|
||||
/// · EnemyProjectile ↔ Platform → 应碰撞(敌人投射物命中地形)
|
||||
/// · PlayerHitBox ↔ PlayerHurtBox → 应忽略(玩家不自伤)
|
||||
/// · PlayerProjectile ↔ EnemyProjectile → 应忽略(子弹不互相碰撞,Clash 系统单独处理)
|
||||
/// · HazardHitBox ↔ PlayerHurtBox → 应碰撞(环境危险伤害玩家)
|
||||
/// · HazardHitBox ↔ EnemyHurtBox → 应碰撞(环境危险伤害敌人,阵营中立)
|
||||
/// · HazardHitBox ↔ PlayerHitBox → 应忽略(环境不触发拼刀)
|
||||
/// · HazardHitBox ↔ EnemyHitBox → 应忽略(环境不触发拼刀)
|
||||
/// · EnemyProjectile ↔ PlayerHurtBox → 应碰撞(敌人投射物伤害玩家)
|
||||
/// · EnemyProjectile ↔ EnemyHurtBox → 应忽略(敌人投射物不自伤)
|
||||
/// · EnemyProjectile ↔ Platform → 应碰撞(敌人投射物命中地形)
|
||||
/// · PlayerHitBox ↔ PlayerHurtBox → 应忽略(玩家不自伤)
|
||||
/// · PlayerProjectile ↔ EnemyProjectile → 应忽略(子弹不互相碰撞,Clash 系统单独处理)
|
||||
/// · HazardHitBox ↔ PlayerHurtBox → 应碰撞(环境危险伤害玩家)
|
||||
/// · HazardHitBox ↔ EnemyHurtBox → 应碰撞(环境危险伤害敌人,阵营中立)
|
||||
/// · HazardHitBox ↔ PlayerHitBox → 应忽略(环境不触发拼刀)
|
||||
/// · HazardHitBox ↔ EnemyHitBox → 应忽略(环境不触发拼刀)
|
||||
/// </summary>
|
||||
public static class Physics2DLayerReport
|
||||
{
|
||||
// ── 期望配置表 ────────────────────────────────────────────────────────
|
||||
// ── 期望配置表(仅含 LayerSpec.md 中定义的 Layer 对)─────────────────
|
||||
// Check / AutoFix 只操作此表中的配对,不影响其他任何 Layer 的碰撞设置。
|
||||
private static readonly ExpectedPair[] ExpectedPairs =
|
||||
{
|
||||
new("PlayerHitBox", "EnemyHurtBox", true, "玩家攻击伤害敌人"),
|
||||
new("EnemyHitBox", "PlayerHurtBox", true, "敌人攻击伤害玩家"),
|
||||
new("EnemyHitBox", "EnemyHurtBox", true, "敌人可互相伤害(HitBox 运行时排除自身根节点)"),
|
||||
new("Player", "Platform", true, "玩家站在平台上"),
|
||||
new("Enemy", "Platform", true, "敌人站在平台上"),
|
||||
new("PlayerHitBox", "EnemyHurtBox", true, "玩家攻击伤害敌人"),
|
||||
new("EnemyHitBox", "PlayerHurtBox", true, "敌人攻击伤害玩家"),
|
||||
new("EnemyHitBox", "EnemyHurtBox", true, "敌人可互相伤害(HitBox 运行时排除自身根节点)"),
|
||||
new("Player", "Platform", true, "玩家站在平台上"),
|
||||
new("Enemy", "Platform", true, "敌人站在平台上"),
|
||||
new("PlayerProjectile", "EnemyHurtBox", true, "玩家投射物伤害敌人"),
|
||||
new("PlayerProjectile", "PlayerHurtBox", false, "玩家投射物不自伤"),
|
||||
new("PlayerProjectile", "Platform", true, "玩家投射物命中地形"),
|
||||
new("EnemyProjectile", "PlayerHurtBox", true, "敌人投射物伤害玩家"),
|
||||
new("EnemyProjectile", "EnemyHurtBox", false, "敌人投射物不自伤"),
|
||||
new("EnemyProjectile", "Platform", true, "敌人投射物命中地形"),
|
||||
new("PlayerHitBox", "PlayerHurtBox", false, "玩家不自伤"),
|
||||
new("PlayerProjectile", "Platform", true, "玩家投射物命中地形"),
|
||||
new("EnemyProjectile", "PlayerHurtBox", true, "敌人投射物伤害玩家"),
|
||||
new("EnemyProjectile", "EnemyHurtBox", false, "敌人投射物不自伤"),
|
||||
new("EnemyProjectile", "Platform", true, "敌人投射物命中地形"),
|
||||
new("PlayerHitBox", "PlayerHurtBox", false, "玩家不自伤"),
|
||||
new("PlayerProjectile", "EnemyProjectile", false, "子弹不互相碰撞(Clash 系统单独处理)"),
|
||||
new("HazardHitBox", "PlayerHurtBox", true, "环境危险伤害玩家"),
|
||||
new("HazardHitBox", "EnemyHurtBox", true, "环境危险伤害敌人(阵营中立)"),
|
||||
new("HazardHitBox", "PlayerHitBox", false, "环境不触发拼刀"),
|
||||
new("HazardHitBox", "EnemyHitBox", false, "环境不触发拼刀"),
|
||||
new("HazardHitBox", "PlayerHurtBox", true, "环境危险伤害玩家"),
|
||||
new("HazardHitBox", "EnemyHurtBox", true, "环境危险伤害敌人(阵营中立)"),
|
||||
new("HazardHitBox", "PlayerHitBox", false, "环境不触发拼刀"),
|
||||
new("HazardHitBox", "EnemyHitBox", false, "环境不触发拼刀"),
|
||||
};
|
||||
|
||||
// ─────────────────────────────────────────────────────────────────────
|
||||
@@ -106,6 +110,7 @@ namespace BaseGames.Editor
|
||||
|
||||
/// <summary>
|
||||
/// 对检查结果中所有不正确项应用修复。
|
||||
/// 仅修改 ExpectedPairs 中定义的 Layer 对,其他 Layer 碰撞设置不受影响。
|
||||
/// 返回修复数量。
|
||||
/// </summary>
|
||||
public static int ApplyFixes(List<LayerPairResult> results)
|
||||
|
||||
Reference in New Issue
Block a user