public void ReadSettingDataFromPlayerPrefs() { SettingDataToPlayerPrefs settingData = PlayerPrefsUtils.GetValueFromPlayerPrefs <SettingDataToPlayerPrefs>("SettingData" + GetPlayerId()); musicChoose = settingData.musicChoose == 0 ? 1 : settingData.musicChoose; soundChoose = settingData.soundChoose == 0 ? 1 : settingData.soundChoose; damageNumChoose = settingData.damageNumChoose == 0 ? 1 : settingData.damageNumChoose; displayBarChoose = settingData.displayBarChoose == 0 ? 1 : settingData.displayBarChoose; languageIndex = settingData.languageIndex == 0 ? 1 : settingData.languageIndex; camareViewChoose = settingData.camareViewChoose == 0 ? 2 : settingData.camareViewChoose; qualitySettingChoose = settingData.qualitySettingChoose == 0 ? 2 : settingData.qualitySettingChoose; recordScreenChoose = settingData.recordScreenChoose == 0 ? 1 : settingData.recordScreenChoose; unitOperationChoose = settingData.unitOperationChoose == 0 ? 1 : settingData.unitOperationChoose; MessageDispatcher.PostMessage(MessageType.SoundVolume, soundChoose == 2 ? 0f : 1f); MessageDispatcher.PostMessage(MessageType.MusicVolume, musicChoose == 2 ? 0f : 1f); switch ((UI.QualitySettingType)qualitySettingChoose) { case UI.QualitySettingType.High: UnityEngine.QualitySettings.SetQualityLevel(GameConstants.QUALITY_HIGH_VALUE); break; case UI.QualitySettingType.Middle: UnityEngine.QualitySettings.SetQualityLevel(GameConstants.QUALITY_MIDDLE_VALUE); break; case UI.QualitySettingType.Low: UnityEngine.QualitySettings.SetQualityLevel(GameConstants.QUALITY_LOW_VALUE); break; } }
public int unitOperationChoose = 0; //1 is modeOne , 2 is modeTwo , 3 is modeThree public void SaveSettingDataToPlayerPrefs() { SettingDataToPlayerPrefs settingData = new SettingDataToPlayerPrefs(); settingData.soundChoose = soundChoose; settingData.musicChoose = musicChoose; settingData.damageNumChoose = damageNumChoose; settingData.displayBarChoose = displayBarChoose; settingData.languageIndex = languageIndex; settingData.camareViewChoose = camareViewChoose; settingData.qualitySettingChoose = qualitySettingChoose; settingData.recordScreenChoose = recordScreenChoose; settingData.unitOperationChoose = unitOperationChoose; PlayerPrefsUtils.SaveToPlayerPrefs("SettingData" + GetPlayerId(), settingData); }