コード例 #1
0
 public void Destroy()
 {
     OnDestroy?.Invoke();
     OnToggle         = null;
     OnDestroy        = null;
     OnFontSizeChange = null;
     OnTextChange     = null;
     _created         = false;
 }
コード例 #2
0
        /// <summary>
        /// Registers a new toggle button. It will be placed below all others that
        /// are currently registered.
        /// </summary>
        /// <param name="text">The text to display on the button</param>
        /// <param name="cb">Callback to call when the button is clicked</param>
        /// <param name="defaultValue">Starting state of the toggle</param>
        /// <param name="fontSize">Font size of the text on the button</param>
        public static void RegisterOptionsToggle(string text, OptionsToggle cb,
                                                 bool defaultValue = false, int fontSize = 0)
        {
            var button = new OptionsButton()
            {
                text         = text,
                cb           = cb,
                defaultValue = defaultValue,
                fontSize     = fontSize
            };

            toAdd.Add(button);

            if (Application.loadedLevel == 2)
            {
                RegisterOptionsToggleInternal(button);
            }
        }
コード例 #3
0
        public static void RegisterOptionsToggle(string text, OptionsToggle cb,
                                                 bool defaultValue = false, int fontSize = 0)
        {
            var button = new OptionsButton
            {
                Text     = text,
                OnToggle = cb,
                Value    = defaultValue,
                FontSize = fontSize
            };

            ToAdd.Add(button);

            if (SceneManager.GetActiveScene().buildIndex == 1) // Main Menu
            {
                RegisterOptionsToggleInternal(button);
            }
        }
コード例 #4
0
 public void SetCallback(OptionsToggle cb)
 {
     callback = cb;
 }
コード例 #5
0
 public void SetCallback(OptionsToggle cb)
 {
     callback = cb;
 }