diff --git a/Imports/RPG and MMO UI 9/Scripts/UI/Controls/UISwitchSelect.cs b/Imports/RPG and MMO UI 9/Scripts/UI/Controls/UISwitchSelect.cs index 1773050d..3f078e9d 100644 --- a/Imports/RPG and MMO UI 9/Scripts/UI/Controls/UISwitchSelect.cs +++ b/Imports/RPG and MMO UI 9/Scripts/UI/Controls/UISwitchSelect.cs @@ -137,6 +137,20 @@ namespace DuloGames.UI /// Option index. public void SelectOptionByIndex(int index) { + SelectOptionByIndex(index, true); + } + + /// + /// Selects the option by index. + /// + /// Option index. + public void SelectOptionByIndexWithoutNotifying(int index) + { + SelectOptionByIndex(index, false); + } + + void SelectOptionByIndex(int index, bool notify) + { // Check if the option index is valid if (index < 0 || index >= this.m_Options.Count) return; @@ -150,9 +164,9 @@ namespace DuloGames.UI this.m_SelectedItem = newOption; // Trigger change - this.TriggerChangeEvent(); + this.TriggerChangeEvent(notify); } - } + } /// /// Selects the option by value. @@ -258,14 +272,14 @@ namespace DuloGames.UI /// /// Tiggers the change event. /// - protected virtual void TriggerChangeEvent() + protected virtual void TriggerChangeEvent(bool invokeCallback = true) { // Apply the string to the label componenet if (this.m_Text != null) this.m_Text.text = this.m_SelectedItem; // Invoke the on change event - if (onChange != null) + if (onChange != null && invokeCallback) onChange.Invoke(this.selectedOptionIndex, this.m_SelectedItem); } }