/// <summary> /// Switches tab /// </summary> /// <param name="settingsTab"></param> public void ProcessTab(SettingsTabBase settingsTab) { activeSettingsTab?.gameObject.SetActive(false); activeSettingsTab = settingsTab; activeTabText.text = settingsTab.tabName; settingsTab.gameObject.SetActive(true); }
/// <summary> /// Switches to the given if the values are not dirty /// </summary> /// <param name="settingsTab"></param> public void SetActive(SettingsTabBase settingsTab) { if (activeSettingsTab == settingsTab) { return; } if (activeSettingsTab != null && !activeSettingsTab.IsDirty) { ProcessTab(settingsTab); } else { QueryUserConfirmation(yes => { if (yes) { activeSettingsTab.ApplyChanges(); } ProcessTab(settingsTab); }); } }