Add ActionPerformedEvent, ActionsSystem.SetIfBiggerCooldown, action id to action events and BackgroundOn field (#27682)

* Add ActionPerformedEvent and ActionsSystem.SetIfBiggerCooldown

* Add action id to action events and backgroundon field to action component
This commit is contained in:
DrSmugleaf
2024-05-10 17:04:01 -07:00
committed by GitHub
parent bc53a46a73
commit 9741fda672
8 changed files with 67 additions and 10 deletions

View File

@@ -285,10 +285,19 @@ public sealed class ActionButton : Control, IEntityControl
_controller ??= UserInterfaceManager.GetUIController<ActionUIController>();
_spriteSys ??= _entities.System<SpriteSystem>();
if ((_controller.SelectingTargetFor == ActionId || _action.Toggled) && _action.IconOn != null)
SetActionIcon(_spriteSys.Frame0(_action.IconOn));
if ((_controller.SelectingTargetFor == ActionId || _action.Toggled))
{
if (_action.IconOn != null)
SetActionIcon(_spriteSys.Frame0(_action.IconOn));
if (_action.BackgroundOn != null)
_buttonBackgroundTexture = _spriteSys.Frame0(_action.BackgroundOn);
}
else
{
SetActionIcon(_action.Icon != null ? _spriteSys.Frame0(_action.Icon) : null);
_buttonBackgroundTexture = Theme.ResolveTexture("SlotBackground");
}
}
public void UpdateBackground()