完善碰撞相关的内容,添加更适合rect的四叉树,碰撞计算相关功能提升到高级坞部分。

This commit is contained in:
2026-06-16 15:17:49 +08:00
parent 24cf6da3c7
commit 6b22c13921
10 changed files with 863 additions and 17 deletions
+12
View File
@@ -52,6 +52,11 @@ namespace XericUI.VisualForm
/// </summary>
public bool HasAnyEnabled { get; private set; }
/// <summary>
/// 是否存在至少一个参与碰撞的条目
/// </summary>
public bool HasAnyCollisionEntry { get; private set; }
/// <summary>
/// 坐标脏标记 - 当锚点世界坐标发生变化时标记
/// </summary>
@@ -124,6 +129,9 @@ namespace XericUI.VisualForm
// 通知条目实例已创建(无论是新实例化还是从池中复用的)
entry.OnInstanceCreated(this, entry.Instance);
// 将WindowState引用注入条目,使其能通过MarkDirty通知坞
entry.State = this;
Entries.Add(entry);
}
@@ -209,6 +217,7 @@ namespace XericUI.VisualForm
Overflow = OverflowState.InRange;
HasAnyClamp = false;
HasAnyEnabled = false;
HasAnyCollisionEntry = false;
CoordinateDirty = false;
_lastPosition = Vector3.zero;
}
@@ -221,15 +230,18 @@ namespace XericUI.VisualForm
{
bool anyClamp = false;
bool anyEnabled = false;
bool anyCollision = false;
foreach (var entry in Entries)
{
if (entry.ClampToSafeZone) anyClamp = true;
if (entry.Enabled) anyEnabled = true;
if (entry.EnableCollision) anyCollision = true;
}
HasAnyClamp = anyClamp;
HasAnyEnabled = anyEnabled;
HasAnyCollisionEntry = anyCollision;
}
/// <summary>