예제 #1
0
 private static void OnButtonEvent( UnityAction action, UIEventGroup conflictGroup )
 {
     if ( GetCanContinue( conflictGroup ) )
     {
         action();
     }
 }
예제 #2
0
        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 );
            } );

        }
예제 #3
0
 private static void OnToggleEvent( UnityAction<bool> action, bool isOn, UIEventGroup conflictGroup )
 {
     if ( isOn )
     {
         if ( GetCanContinue( conflictGroup ) )
         {
             action( isOn );
         }
     }
     else
     {
         action( isOn );
     }
 }
예제 #4
0
        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;
        }
예제 #5
0
        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 );
            } );

        }
예제 #6
0
 public static void ResetGroupState( UIEventGroup group )
 {
     groupStateDict[group] = UIEventState.Normal;
 }
예제 #7
0
 public static void SetGroupState( UIEventGroup group, UIEventState state )
 {
     groupStateDict[group] = state;
 }
예제 #8
0
 public static UIEventState GetGroupState( UIEventGroup group )
 {
     return groupStateDict[group];
 }