public void OnSkyboxSelected(string skyboxPath) { // Update text this.skyBoxButton.GetComponentInChildren <TextMeshProUGUI>().text = SkyboxHandler.GetSkyboxNameFromPath(skyboxPath); // Save config with new skybox selection if (!this.config.background.Equals(skyboxPath, StringComparison.OrdinalIgnoreCase)) { this.config.background = skyboxPath; ConfigPersistence.SaveConfig(this.config); } }
private void PersistConfig() { bool saveConfig = false; // Update grid size var cols = (int)gridCols.GetComponent <Slider>().value; var rows = (int)gridRows.GetComponent <Slider>().value; if (cols != this.config.gridSize.cols || rows != this.config.gridSize.rows) { this.config.gridSize.cols = cols; this.config.gridSize.rows = rows; saveConfig = true; } // Update 2D toggle var show2D = this.show2DToggle.GetComponent <Toggle>().isOn; if (show2D != this.config.show2D) { this.config.show2D = show2D; saveConfig = true; } // Update auto tab mode string tabAutoMode; if (this.tabsAutoTop.isOn) { tabAutoMode = Config.Category_Top; } else if (this.tabsAutoLeft.isOn) { tabAutoMode = Config.Category_Left; } else if (this.tabsAutoRight.isOn) { tabAutoMode = Config.Category_Right; } else { tabAutoMode = Config.Category_Off; } if (!this.config.autoCategory.Equals(tabAutoMode, StringComparison.OrdinalIgnoreCase)) { this.config.autoCategory = tabAutoMode; saveConfig = true; } // Update auto tab mode string tabCustomMode; if (this.tabsCustomTop.isOn) { tabCustomMode = Config.Category_Top; } else if (this.tabsCustomLeft.isOn) { tabCustomMode = Config.Category_Left; } else if (this.tabsCustomRight.isOn) { tabCustomMode = Config.Category_Right; } else { tabCustomMode = Config.Category_Off; } if (!this.config.customCategory.Equals(tabCustomMode, StringComparison.OrdinalIgnoreCase)) { this.config.customCategory = tabCustomMode; saveConfig = true; } // Persist configuration & re-populate if (saveConfig) { ConfigPersistence.SaveConfig(this.config); } // If we touched the config file or we deleted the hidden apps file, re-populate the grid if (saveConfig || deletedHiddenAppsFile) { Debug.Log("Re-populating panel"); SceneManager.LoadScene(SceneManager.GetActiveScene().name); } }