Esempio n. 1
0
 /// <summary>
 /// Use this method to draw a toggle button
 /// </summary>
 /// <remarks>
 /// Use this method to draw a toggle button. to check if the state of the button has changed check the return value of this method.
 /// </remarks>
 /// <param name="theValue">the current state of the toggle button</param>
 /// <param name="theImage">the image of the toggle button</param>
 /// <param name="theToggleStyle">the style of the toggle button</param>
 /// <param name="theLayout">GUILayout options</param>
 /// <returns>returns true if the close toggle button was clicked</returns>
 public static bool Toggle(bool theValue, Texture2D theImage, eStyleToggl theToggleStyle, params GUILayoutOption[] theLayout)
 {
     Init();
     bool aNewValue = false;
     if(itsSkinIndex == -1)
     {
         aNewValue = GUILayout.Toggle(theValue, theImage, theLayout);
     }
     else
     {
         aNewValue = GUILayout.Toggle(theValue, theImage, GetStyleToggl(theToggleStyle), theLayout);
     }
     if (aNewValue != theValue)
     {
         PlaySound(theToggleStyle.ToString());
     }
     return aNewValue;
 }
Esempio n. 2
0
    public static bool Toggle(bool theValue, string theText, Texture2D theImage, eStyleToggl theToggleStyle, params GUILayoutOption[] theLayout)
    {
        Init();
        GUIContent aGuiContent = null;

        if(theImage != null)
        {
            aGuiContent = new GUIContent(theText, theImage);
        }
        else
        {
            aGuiContent = new GUIContent(theText);
        }
        bool aNewValue = false;
        if(itsSkinIndex == -1)
        {
            aNewValue = GUILayout.Toggle(theValue, aGuiContent, theLayout);
        }
        else
        {
            aNewValue = GUILayout.Toggle(theValue, aGuiContent, GetStyleToggl(theToggleStyle), theLayout);
        }
        if (aNewValue != theValue)
        {
            PlaySound(theToggleStyle.ToString());
        }
        return aNewValue;
    }
Esempio n. 3
0
 /// <summary>
 /// Set click sound for toggles
 /// </summary>
 /// <param name="theTogglStyle"></param>
 /// <param name="theAudioClip"></param>
 public static void SetSoundForToggle(eStyleToggl theTogglStyle, AudioClip theAudioClip)
 {
     SetSound(theTogglStyle.ToString(),theAudioClip);
 }