using System.Collections.Generic; namespace Wizard; public class WizardUIButton : UIButton { public List onPress = new List(); public List onRelease = new List(); public bool IsNewReplayForwardButton { get; set; } protected override void OnPress(bool isPressed) { base.OnPress(isPressed); if (UIButton.current == null && isEnabled && isPressed) { SetAsPressed(); } else if (UIButton.current == null && isEnabled && !isPressed) { SetAsReleased(); } } private void SetAsPressed() { UIButton.current = this; EventDelegate.Execute(onPress); UIButton.current = null; SetState(State.Pressed, immediate: true); } private void SetAsReleased() { UIButton.current = this; EventDelegate.Execute(onRelease); UIButton.current = null; SetState(State.Normal, immediate: true); } protected override void OnDragOut() { if ((IsNewReplayForwardButton && isEnabled) || !IsNewReplayForwardButton) { SetAsReleased(); } base.OnDragOut(); } }