//Settings View 내용을 갱신 public void UpdateContent(SettingsOption option) { arToggle.isOn = curSettingsOption.arToggleValue; soundToggle.isOn = curSettingsOption.soundToggleValue; qualityDropdown.value = curSettingsOption.qualityValue; volumeSlider.value = curSettingsOption.volumeValue; }
private void Awake() { //저장된 SettingsOption이 있을 때 Game Setting if (LoadSettings()) { isOnAR = loadSettingsOption.arToggleValue; isOnSound = loadSettingsOption.soundToggleValue; QualitySettings.SetQualityLevel(loadSettingsOption.qualityValue); if (loadSettingsOption.soundToggleValue) { audioMixer.SetFloat("volume", loadSettingsOption.volumeValue); } else { audioMixer.SetFloat("volume", -80); } } //저장된 SettingsOption이 없을 때 Game Setting else { isOnAR = true; isOnSound = true; QualitySettings.SetQualityLevel(2); audioMixer.SetFloat("volume", 20); } float value; audioMixer.GetFloat("volume", out value); //현재 Game Setting을 담을 객체 생성 curSettingsOption = new SettingsOption(isOnAR, isOnSound, QualitySettings.GetQualityLevel(), value); }
private void Awake() { gm = FindObjectOfType <GameManager>(); isApplyButton = false; //저장된 SettingsOption이 있을 때 Game Setting if (LoadSettings()) { isOnSound = loadSettingsOption.soundToggleValue; QualitySettings.SetQualityLevel(loadSettingsOption.qualityValue); if (loadSettingsOption.soundToggleValue) { audioMixer.SetFloat("volume", loadSettingsOption.volumeValue); } else { audioMixer.SetFloat("volume", -80); } } //저장된 SettingsOption이 없을 때 Game Setting else { isOnSound = true; QualitySettings.SetQualityLevel(2); audioMixer.SetFloat("volume", -20); } float value; audioMixer.GetFloat("volume", out value); //현재 Game Setting을 담을 객체 생성 curSettingsOption = new SettingsOption(isOnSound, QualitySettings.GetQualityLevel(), value); }
/// <summary> /// Handles user cursor movement between the ui elements /// </summary> /// <param name="vert"></param> public void TraverseMenu(float vert) { // Find out the previously selected button. int selected = (int)selectedID; // Change style of previously selected button to regular. changeButtonToUnselected(selected); // Based on input vert, change the current selected button ID. if (vert > 0) { selected++; } else if (vert < 0) { selected--; } if (selected < 0) { selected = TOTAL_SETTINGS_OPTIONS - 1; } else if (selected == TOTAL_SETTINGS_OPTIONS) { selected = 0; } selectedID = (SettingsOption)selected; // Change style of newly selected button to selected. changeButtonToSelected(selected); }
private void OnEnable() { selectedID = 0; Tuple <int, int> newRes = resolutions[selectedRes]; FullScreenActiveValue.text = fullscreenActive ? "On" : "Off"; ResolutionValue.text = $"{newRes.Item1} X {newRes.Item2}"; changeButtonToSelected((int)selectedID); }
//UI 출력시 UI 내용 변경 private void OnEnable() { float value; audioMixer.GetFloat("volume", out value); //변경 사항을 담을 객체 생성 settingsOption = new SettingsOption(isOnAR, isOnSound, QualitySettings.GetQualityLevel(), value); UpdateContent(curSettingsOption); }
//저장된 데이터 유무 확인 private bool LoadSettings() { if (!PlayerPrefs.HasKey("SavedSettings")) { return(false); } else { //저장된 값을 파싱해 loadSettingsOption 객체에 담는다. string loadData = PlayerPrefs.GetString("SavedSettings"); loadSettingsOption = JsonUtility.FromJson <SettingsOption>(loadData); return(true); } }
public void DidSelectNewColor(SettingsOption selectedOption, Color?newColor) { Color color; if (newColor.HasValue) { color = newColor.Value; } else { return; } switch (selectedOption) { case SettingsOption.WindowBackgroundColor: foreach (var indicatorWindow in indicatorWindows) { indicatorWindow.Background = new SolidColorBrush(color); } settings.windowBackgroundColor = color; break; case SettingsOption.BarBackgroundColor: foreach (var indicatorWindow in indicatorWindows) { indicatorWindow.SetBarBackgroundColor(color); } settings.barBackgroundColor = color; break; case SettingsOption.BarForegroundColor: foreach (var indicatorWindow in indicatorWindows) { indicatorWindow.SetBarForegroundColor(color); } settings.barForegroundColor = color; break; case SettingsOption.BorderColor: foreach (var indicatorWindow in indicatorWindows) { indicatorWindow.SetBorderBrushColor(color); } settings.borderColor = color; break; default: break; } }
private void LoadAudioSettings() { if (!PlayerPrefs.HasKey("SavedSettings")) { QualitySettings.SetQualityLevel(2); audioMixer.SetFloat("volume", -20); } else { string loadData = PlayerPrefs.GetString("SavedSettings"); SettingsOption loadSettingsOption = JsonUtility.FromJson <SettingsOption>(loadData); QualitySettings.SetQualityLevel(loadSettingsOption.qualityValue); audioMixer.SetFloat("volume", loadSettingsOption.volumeValue); } }
private void CurrentSettingDidChange(int index) { currentSetting = (SettingsOption)index; switch (currentSetting) { case SettingsOption.Hardware: ShowCheckMenu(); break; case SettingsOption.WindowBackgroundColor: ShowColorPicker(); break; case SettingsOption.BarBackgroundColor: ShowColorPicker(); break; case SettingsOption.BarForegroundColor: ShowColorPicker(); break; case SettingsOption.BorderColor: ShowColorPicker(); break; case SettingsOption.Font: ShowFontMenu(); break; case SettingsOption.Position: ShowRadioButtonMenu(); break; case SettingsOption.Reset: ConfirmSettingReset(); break; } }