Merge remote-tracking branch 'gitee/develop' into develop

This commit is contained in:
小李xl 2024-03-13 00:34:09 +08:00
commit de63de69a0
4 changed files with 22 additions and 17 deletions

View File

@ -627,6 +627,20 @@ public partial class ActivityObject : CharacterBody2D, IDestroy, ICoroutine
{
}
/// <summary>
/// 添加组件时调用
/// </summary>
public virtual void OnAddComponent(Component component)
{
}
/// <summary>
/// 移除组件时调用
/// </summary>
public virtual void OnRemoveComponent(Component component)
{
}
/// <summary>
/// 返回当物体 CollisionLayer 是否能与 mask 层碰撞
/// </summary>
@ -773,6 +787,7 @@ public partial class ActivityObject : CharacterBody2D, IDestroy, ICoroutine
component.Master = this;
component.Ready();
component.OnEnable();
OnAddComponent(component);
return component;
}
@ -794,6 +809,7 @@ public partial class ActivityObject : CharacterBody2D, IDestroy, ICoroutine
component.Master = this;
component.Ready();
component.OnEnable();
OnAddComponent(component);
return component;
}
@ -811,6 +827,7 @@ public partial class ActivityObject : CharacterBody2D, IDestroy, ICoroutine
if (_updatingComp)
{
_changeComponents.Add(new KeyValuePair<Component, bool>(component, false));
OnRemoveComponent(component);
component.Destroy();
}
else
@ -820,6 +837,7 @@ public partial class ActivityObject : CharacterBody2D, IDestroy, ICoroutine
if (_components[i].Value == component)
{
_components.RemoveAt(i);
OnRemoveComponent(component);
component.Destroy();
return;
}

View File

@ -81,23 +81,6 @@ public abstract partial class UiBase : Control, IDestroy, ICoroutine
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;
}
}
/// <summary>
/// 创建当前ui时调用
/// </summary>

View File

@ -0,0 +1,4 @@
public abstract partial class BuffBase : Component<Role>
{
}