// This function sets values to the 'SoundMenu' public void DisplaySoundConfig() { //Store in temp so that it doesn't get overwritten while assigning C_ConfigSettings tempConfigData = new C_ConfigSettings(ConfigData); //Use TempData to do all setting, as it won't be changed during this process toggle_soundEnabled.isOn = tempConfigData.m_soundEnabled; //Reverse the current multiplier to a 0-1 range for the scroll bar float normalizedValue = scroll_vol_Master_value.normalizedCalcVal(tempConfigData.m_vol_Master); scrollBar_vol_Master.value = normalizedValue; //Reverse the current multiplier to a 0-1 range for the scroll bar normalizedValue = scroll_vol_Music_value.normalizedCalcVal(tempConfigData.m_vol_Music); scrollBar_vol_Music.value = normalizedValue; //Reverse the current multiplier to a 0-1 range for the scroll bar normalizedValue = scroll_vol_Effects_value.normalizedCalcVal(tempConfigData.m_vol_Effects); scrollBar_vol_Effects.value = normalizedValue; //Reverse the current multiplier to a 0-1 range for the scroll bar normalizedValue = scroll_vol_Interface_value.normalizedCalcVal(tempConfigData.m_vol_Interface); scrollBar_vol_Interface.value = normalizedValue; //Copy back to correct any overwrites that happened ConfigData = tempConfigData; }
public C_ConfigSettings(C_ConfigSettings clone) { this.m_playIntro = clone.m_playIntro; this.m_zoomSpeed = clone.m_zoomSpeed; this.m_panSpeed_LR = clone.m_panSpeed_LR; this.m_panSpeed_FB = clone.m_panSpeed_FB; this.m_soundEnabled = clone.m_soundEnabled; this.m_vol_Master = clone.m_vol_Master; this.m_vol_Music = clone.m_vol_Music; this.m_vol_Effects = clone.m_vol_Effects; this.m_vol_Interface = clone.m_vol_Interface; }
////////////////////////////////////////// //Load settings from config data into the UI // This function sets values to the 'ConfigMenu' public void DisplayConfig() { //Store in temp so that it doesn't get overwritten while assigning C_ConfigSettings tempConfigData = new C_ConfigSettings(ConfigData); //Use TempData to do all setting, as it won't be changed during this process toggle_playIntro.isOn = tempConfigData.m_playIntro; //Reverse the current multiplier to a 0-1 range for the scroll bar float normalizedValue = scroll_zoomValue.normalizedCalcVal(tempConfigData.m_zoomSpeed); scrollBar_zoomSpeed.value = normalizedValue; //Reverse the current multiplier to a 0-1 range for the scroll bar normalizedValue = scroll_panValue_LR.normalizedCalcVal(tempConfigData.m_panSpeed_LR); scrollBar_panSpeed_LR.value = normalizedValue; //Reverse the current multiplier to a 0-1 range for the scroll bar normalizedValue = scroll_panValue_FB.normalizedCalcVal(tempConfigData.m_panSpeed_FB); scrollBar_panSpeed_FB.value = normalizedValue; //Copy back to correct any overwrites that happened ConfigData = tempConfigData; }
void Start() { //Load from file ConfigData = XMLSerialization.Deserialize <C_ConfigSettings>(_configFileName); }