internal static void SetTexture(this UIStateToggleButton toggle, Texture newTex, UIStateToggleButton stockToggle = null)
 {
     if (toggle != null)
     {
         BState[] states      = { toggle.stateTrue, toggle.stateFalse };
         BState[] stockStates = { stockToggle?.stateTrue, stockToggle?.stateFalse };
         for (int i = 0; i < states?.Length; i++)
         {
             BState stock = stockStates[i];
             states[i].disabled  = states[i].disabled.SetTexture(newTex ?? stock?.disabled?.texture);
             states[i].normal    = states[i].normal.SetTexture(newTex ?? stock?.normal?.texture);
             states[i].highlight = states[i].highlight.SetTexture(newTex ?? stock?.highlight?.texture);
             states[i].pressed   = states[i].pressed.SetTexture(newTex ?? stock?.pressed?.texture);
         }
     }
 }
Beispiel #2
0
 /// <summary>
 /// Exchanges UIStateToggleButton Button States
 /// </summary>
 /// <param name="button"></param>
 /// <param name="buttonState"></param>
 public static void changeState(this UIStateToggleButton button, ButtonState buttonState)
 {
     button.stateTrue = buttonState;
     button.SetState(UIStateToggleButton.BtnState.True);
 }
Beispiel #3
0
 /// <summary>
 /// Outputs both UIStateToggleButton Button States (stateTrue = buttonActive, stateFalse = buttonDisabled)
 /// </summary>
 /// <param name="button"></param>
 /// <param name="buttonActive"></param>
 /// <param name="buttonDisabled"></param>
 public static void getSpriteStates(this UIStateToggleButton button, out ButtonState buttonActive, out ButtonState buttonDisabled)
 {
     buttonActive   = button.stateTrue;
     buttonDisabled = button.stateFalse;
 }