private static void OnButtonEvent( UnityAction action, UIEventGroup conflictGroup ) { if ( GetCanContinue( conflictGroup ) ) { action(); } }
public static void AddListener( this Button button, UnityAction action, UIEventGroup thisGroup = UIEventGroup.None, UIEventGroup conflictGroup = UIEventGroup.None ) { button.onClick.AddListener( delegate () { SoundManager.Instance.PlaySound( 60120, true ); OnButtonEvent( action, conflictGroup ); } ); }
private static void OnToggleEvent( UnityAction<bool> action, bool isOn, UIEventGroup conflictGroup ) { if ( isOn ) { if ( GetCanContinue( conflictGroup ) ) { action( isOn ); } } else { action( isOn ); } }
private static bool GetCanContinue( UIEventGroup conflictGroup ) { bool canContinue = true; if ( conflictGroup != UIEventGroup.None ) { foreach ( UIEventGroup item in Enum.GetValues( typeof( UIEventGroup ) ) ) { // Does it include the conflict of group // Does it include the state may continue to the state if ( 0 != ( conflictGroup & item ) && 0 == ( canContinueState & groupStateDict[item] ) ) { canContinue = false; DebugUtils.Log( DebugUtils.Type.UI, "Page: The click is blocked,Because the" + item + "status is " + groupStateDict[item] ); break; } } } return canContinue; }
public static void AddListener( this Toggle toggle, UnityAction<bool> action, UIEventGroup thisGroup = UIEventGroup.None, UIEventGroup conflictGroup = UIEventGroup.None ) { toggle.onValueChanged.AddListener( delegate ( bool isOn ) { SoundManager.Instance.PlaySound( 60120, true ); OnToggleEvent( action, isOn, conflictGroup ); } ); }
public static void ResetGroupState( UIEventGroup group ) { groupStateDict[group] = UIEventState.Normal; }
public static void SetGroupState( UIEventGroup group, UIEventState state ) { groupStateDict[group] = state; }
public static UIEventState GetGroupState( UIEventGroup group ) { return groupStateDict[group]; }