/// <summary> /// Заносим значения с элементов UI в нашу структуру данных /// </summary> private void Save() { foreach (var control in _elementsOfInterface) { if (control == null) { continue; } var videoSettings = VideoSettings; var videoSettingsItems = videoSettings.Items[_selectSettings]; if (control.Instance.name == VideoOptionsMenuItems.SoftParticles.ToString() && control is ToggleUI) { videoSettingsItems.SoftParticles = (control as ToggleUI).GetControl.isOn; } else if (control.Instance.name == VideoOptionsMenuItems.ShadowQuality.ToString() && control is DropdownUI) { videoSettingsItems.ShadowQuality = (ShadowQuality)(control as DropdownUI).GetControl.value; } else if (control.Instance.name == VideoOptionsMenuItems.CurrentName.ToString() && control is DropdownUI) { videoSettings.CurrentSettings = (control as DropdownUI).GetControl.value; } videoSettings.Items[_selectSettings] = videoSettingsItems; _videoSettings = videoSettings; } }
private static VideoSettings DefaultSettings() { var result = new VideoSettings(); var qualityNamesList = QualitySettings.names; var i = 0; result.Items = new List <VideoSettingsItems>(); foreach (var name in qualityNamesList) { QualitySettings.SetQualityLevel(i++); result.Items.Add( new VideoSettingsItems { Name = name, SoftParticles = QualitySettings.softParticles, ShadowQuality = QualitySettings.shadows }); } return(result); }
/// <summary> /// В конструкторе загружаем сохраненные настройки /// </summary> static VideoSettingsRepositoty() { _data = new DataXMLSerializer <VideoSettings>(); _data.SetOptions(Path.Combine(Application.dataPath, "VideoSettings.xml")); _videoSettings = _data.Load(); }