diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs index 7b4d69c..e294583 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs @@ -628,6 +628,20 @@ } /// + /// 添加组件时调用 + /// + public virtual void OnAddComponent(Component component) + { + } + + /// + /// 移除组件时调用 + /// + public virtual void OnRemoveComponent(Component component) + { + } + + /// /// 返回当物体 CollisionLayer 是否能与 mask 层碰撞 /// public bool CollisionWithMask(uint mask) @@ -773,6 +787,7 @@ component.Master = this; component.Ready(); component.OnEnable(); + OnAddComponent(component); return component; } @@ -794,6 +809,7 @@ component.Master = this; component.Ready(); component.OnEnable(); + OnAddComponent(component); return component; } @@ -811,6 +827,7 @@ if (_updatingComp) { _changeComponents.Add(new KeyValuePair(component, false)); + OnRemoveComponent(component); component.Destroy(); } else @@ -820,6 +837,7 @@ if (_components[i].Value == component) { _components.RemoveAt(i); + OnRemoveComponent(component); component.Destroy(); return; } diff --git a/DungeonShooting_Godot/src/framework/ui/UiBase.cs b/DungeonShooting_Godot/src/framework/ui/UiBase.cs index 2827ffe..0e11d89 100644 --- a/DungeonShooting_Godot/src/framework/ui/UiBase.cs +++ b/DungeonShooting_Godot/src/framework/ui/UiBase.cs @@ -81,23 +81,6 @@ UiManager.RecordUi(this, UiManager.RecordType.Open); } - public sealed override void _Ready() - { - if (Math.Abs(Scale.X - 1f) > 0.001f) - { - Resized += OnResizeUi; - } - } - - private void OnResizeUi() - { - if (ParentUi == null) - { - var viewportSize = GameApplication.Instance.ViewportSize; - Size = viewportSize; - } - } - /// /// 创建当前ui时调用 /// diff --git a/DungeonShooting_Godot/src/game/buff/BuffBase.cs b/DungeonShooting_Godot/src/game/buff/BuffBase.cs new file mode 100644 index 0000000..45a4e6e --- /dev/null +++ b/DungeonShooting_Godot/src/game/buff/BuffBase.cs @@ -0,0 +1,4 @@ + +public abstract partial class BuffBase : Component +{ +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/buff/Buff_MoveSpeed.cs b/DungeonShooting_Godot/src/game/buff/Buff_MoveSpeed.cs new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/DungeonShooting_Godot/src/game/buff/Buff_MoveSpeed.cs