/// <summary> /// 判断按钮的动画类型 /// </summary> /// <param name="buttonAnimationType">动画类型</param> private void JudgeButtonAnimState(ButtonAnimationType buttonAnimationType) { switch (buttonAnimationType) { case ButtonAnimationType.All: startCarousel = true; break; case ButtonAnimationType.Normal: buttonAnimator.SetTrigger(button.animationTriggers.normalTrigger); break; case ButtonAnimationType.Highlighted: buttonAnimator.SetTrigger(button.animationTriggers.highlightedTrigger); break; case ButtonAnimationType.Pressed: buttonAnimator.SetTrigger(button.animationTriggers.pressedTrigger); break; case ButtonAnimationType.Disabled: buttonAnimator.SetTrigger(button.animationTriggers.disabledTrigger); break; default: break; } }
/// <summary> Converts an AnimationType to a ButtonAnimationType. This is used to convert Punch and State animations from one enum type to the other </summary> /// <param name="type"> Target ButtonAnimationType </param> public static AnimationType GetAnimationType(ButtonAnimationType type) { // ReSharper disable once SwitchStatementMissingSomeCases switch (type) { case ButtonAnimationType.Punch: return(AnimationType.Punch); case ButtonAnimationType.State: return(AnimationType.State); default: return(AnimationType.Undefined); } }
/// <summary> Resets this instance to the default values </summary> /// <param name="behaviorType"> Behavior type </param> public void Reset(UIButtonBehaviorType behaviorType) { m_behaviorType = behaviorType; Enabled = DEFAULT_ENABLED; Ready = DEFAULT_READY; DisableInterval = GetDefaultDisableInterval(behaviorType); SelectButton = DEFAULT_SELECT_BUTTON; DeselectButton = DEFAULT_DESELECT_BUTTON; ButtonAnimationType = DEFAULT_BUTTON_ANIMATION_TYPE; LoadSelectedPresetAtRuntime = DEFAULT_LOAD_SELECTED_PRESET_AT_RUNTIME; PresetCategory = DefaultPresetCategory; PresetName = DefaultPresetName; PunchAnimation = new UIAnimation(AnimationType.Punch); StateAnimation = new UIAnimation(AnimationType.State); Animators = new List <AnimatorEvent>(); TriggerEventsAfterAnimation = DEFAULT_TRIGGER_EVENTS_AFTER_ANIMATION; OnTrigger = new UIAction(); }