public void Destroy() { OnDestroy?.Invoke(); OnToggle = null; OnDestroy = null; OnFontSizeChange = null; OnTextChange = null; _created = false; }
/// <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); } }
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); } }
public void SetCallback(OptionsToggle cb) { callback = cb; }