(client) feat:添加消息定义,添加故事定义及其运算,武器动画可用,装备UI可用以及切换武器 fix:修复快速攻击导致协程释放出错卡死,重构为计时器,修复类型转换错误导致报错
This commit is contained in:
@ -23,7 +23,7 @@ public class Program : Singleton<Program>
|
||||
/// 当前聚焦的实体对象。
|
||||
/// 变更为属性,并私有化setter,确保通过 SetFocusedEntity 方法集中管理其更新和事件触发。
|
||||
/// </summary>
|
||||
public Entity.Entity FocusedEntity { get; private set; } = null;
|
||||
public Entity.Entity FocusedEntity => FocusedDimension?.focusEntity;
|
||||
|
||||
/// <summary>
|
||||
/// 当焦点实体发生变化时触发的事件。
|
||||
@ -175,7 +175,7 @@ public class Program : Singleton<Program>
|
||||
return;
|
||||
}
|
||||
|
||||
if (FocusedEntity != null)
|
||||
if (FocusedEntity)
|
||||
{
|
||||
FocusedEntity.PlayerControlled = false;
|
||||
}
|
||||
@ -200,17 +200,11 @@ public class Program : Singleton<Program>
|
||||
{
|
||||
// 优化:检查是否实际发生变化,避免不必要的更新和事件触发。
|
||||
// 如果新的实体与当前焦点实体相同(按引用比较),则不执行任何操作。
|
||||
if (FocusedEntity == entity)
|
||||
if (FocusedEntity == entity||!FocusedDimension)
|
||||
{
|
||||
// Debug.Log($"[Program] SetFocusedEntity: Entity '{entity?.name ?? "null"}' already current. No change needed.");
|
||||
return;
|
||||
}
|
||||
|
||||
// 更新内部状态
|
||||
FocusedEntity = entity;
|
||||
if(FocusedDimension)
|
||||
FocusedDimension.focusEntity=entity;
|
||||
|
||||
FocusedDimension.focusEntity=entity;
|
||||
// 触发事件,将新的焦点实体(或 null)作为参数传递。
|
||||
OnFocusedEntityChanged?.Invoke(FocusedEntity);
|
||||
}
|
||||
|
Reference in New Issue
Block a user