diff --git a/Samples/BasicMenu/Components/MenuChangeVolume.cs b/Samples/BasicMenu/Components/MenuChangeVolume.cs index 17ce395a5..2207fb6cb 100644 --- a/Samples/BasicMenu/Components/MenuChangeVolume.cs +++ b/Samples/BasicMenu/Components/MenuChangeVolume.cs @@ -22,13 +22,13 @@ public override void DoAction() { base.DoAction(); - float volume = DualityApp.UserData.Value.SoundMasterVol; + float volume = DualityApp.UserData.Instance.SoundMasterVol; volume += (this.changeAmount / 10f); // make sure that the volume is between 0 and 1 volume = MathF.Min(MathF.Max(volume, 0), 1); - DualityApp.UserData.Value.SoundMasterVol = volume; + DualityApp.UserData.Instance.SoundMasterVol = volume; } } } diff --git a/Samples/BasicMenu/VolumeRenderer.cs b/Samples/BasicMenu/VolumeRenderer.cs index f6a89328f..f3e633b4e 100644 --- a/Samples/BasicMenu/VolumeRenderer.cs +++ b/Samples/BasicMenu/VolumeRenderer.cs @@ -22,7 +22,7 @@ void ICmpUpdatable.OnUpdate() } // update the volume value - volumeText.Text.SourceText = String.Format("Volume {0:0.0}", DualityApp.UserData.Value.SoundMasterVol); + volumeText.Text.SourceText = String.Format("Volume {0:0.0}", DualityApp.UserData.Instance.SoundMasterVol); } } } \ No newline at end of file diff --git a/Samples/Benchmarks/BenchmarkController.cs b/Samples/Benchmarks/BenchmarkController.cs index 6c1b4fdc7..64d7b51e6 100644 --- a/Samples/Benchmarks/BenchmarkController.cs +++ b/Samples/Benchmarks/BenchmarkController.cs @@ -199,12 +199,12 @@ public void EnterBenchmarkMode() this.renderSetup = ContentProvider.GetAvailableContent().FirstOrDefault(); // Make sure the benchmark setup is used globally - DualityApp.AppData.Value.RenderingSetup = this.renderSetup.As(); + DualityApp.AppData.Instance.RenderingSetup = this.renderSetup.As(); } public void LeaveBenchmarkMode() { // Uninstall the benchmark setup we set globally - DualityApp.AppData.Value.RenderingSetup = null; + DualityApp.AppData.Instance.RenderingSetup = null; // Discard local references to content, since we know the controller // itself won't be discarded due to being static diff --git a/Samples/Benchmarks/RenderSetupInfo.cs b/Samples/Benchmarks/RenderSetupInfo.cs index c56045431..4d34cc45f 100644 --- a/Samples/Benchmarks/RenderSetupInfo.cs +++ b/Samples/Benchmarks/RenderSetupInfo.cs @@ -64,7 +64,7 @@ void ICmpInitializable.OnActivate() { if (DualityApp.ExecContext == DualityApp.ExecutionContext.Game) { - this.renderSetup = DualityApp.AppData.Value.RenderingSetup.As(); + this.renderSetup = DualityApp.AppData.Instance.RenderingSetup.As(); this.text = new FormattedText(); this.text.LineAlign = Alignment.Right; this.text.MaxWidth = 200; diff --git a/Samples/Physics/PhysicsSampleController.cs b/Samples/Physics/PhysicsSampleController.cs index ee1222a3a..0e1678b6d 100644 --- a/Samples/Physics/PhysicsSampleController.cs +++ b/Samples/Physics/PhysicsSampleController.cs @@ -101,7 +101,7 @@ void ICmpRenderer.Draw(IDrawDevice device) // When the mouse is hovering over the game area and the system cursor // is disabled, draw a custom cursor as a replacement - if (!DualityApp.UserData.Value.SystemCursorVisible && DualityApp.Mouse.IsAvailable) + if (!DualityApp.UserData.Instance.SystemCursorVisible && DualityApp.Mouse.IsAvailable) { canvas.State.ColorTint = (this.dragObj != null) ? this.interactionColor : this.defaultColor; canvas.FillThickLine( diff --git a/Source/Core/Duality/Audio/SoundDevice.cs b/Source/Core/Duality/Audio/SoundDevice.cs index 242e6317d..01546bc38 100644 --- a/Source/Core/Duality/Audio/SoundDevice.cs +++ b/Source/Core/Duality/Audio/SoundDevice.cs @@ -225,8 +225,8 @@ private void UpdateListener() private void UpdateWorldSettings() { DualityApp.AudioBackend.UpdateWorldSettings( - this.appData.Value.SpeedOfSound, // Already in meters per second / audio units - this.appData.Value.SoundDopplerFactor); + this.appData.Instance.SpeedOfSound, // Already in meters per second / audio units + this.appData.Instance.SoundDopplerFactor); } /// diff --git a/Source/Core/Duality/Audio/SoundInstance.cs b/Source/Core/Duality/Audio/SoundInstance.cs index e8250a41e..5c51edd4c 100644 --- a/Source/Core/Duality/Audio/SoundInstance.cs +++ b/Source/Core/Duality/Audio/SoundInstance.cs @@ -388,22 +388,22 @@ private float GetTypeVolFactor() switch (this.sound.IsAvailable ? this.sound.Res.Type : SoundType.World) { case SoundType.UserInterface: - optVolFactor = this.userData.Value.SoundEffectVol; + optVolFactor = this.userData.Instance.SoundEffectVol; break; case SoundType.World: - optVolFactor = this.userData.Value.SoundEffectVol; + optVolFactor = this.userData.Instance.SoundEffectVol; break; case SoundType.Speech: - optVolFactor = this.userData.Value.SoundSpeechVol; + optVolFactor = this.userData.Instance.SoundSpeechVol; break; case SoundType.Music: - optVolFactor = this.userData.Value.SoundMusicVol; + optVolFactor = this.userData.Instance.SoundMusicVol; break; default: optVolFactor = 1.0f; break; } - return optVolFactor * this.userData.Value.SoundMasterVol * 0.5f; + return optVolFactor * this.userData.Instance.SoundMasterVol * 0.5f; } private void RegisterPlaying() { diff --git a/Source/Core/Duality/Backend/Dummy/DummyNativeWindow.cs b/Source/Core/Duality/Backend/Dummy/DummyNativeWindow.cs index fa0f6571e..54885fe5a 100644 --- a/Source/Core/Duality/Backend/Dummy/DummyNativeWindow.cs +++ b/Source/Core/Duality/Backend/Dummy/DummyNativeWindow.cs @@ -15,7 +15,7 @@ void INativeWindow.Run() while (DualityApp.ExecContext != DualityApp.ExecutionContext.Terminated) { DualityApp.Update(); - DualityApp.Render(null, new Rect(DualityApp.UserData.Value.WindowSize), DualityApp.UserData.Value.WindowSize); + DualityApp.Render(null, new Rect(DualityApp.UserData.Instance.WindowSize), DualityApp.UserData.Instance.WindowSize); } } diff --git a/Source/Core/Duality/Components/Camera.cs b/Source/Core/Duality/Components/Camera.cs index 2324c0f09..ed3f7b811 100644 --- a/Source/Core/Duality/Components/Camera.cs +++ b/Source/Core/Duality/Components/Camera.cs @@ -156,7 +156,7 @@ public RenderSetup ActiveRenderSetup { return this.renderSetup.Res ?? - DualityApp.AppData.Value.RenderingSetup.Res ?? + DualityApp.AppData.Instance.RenderingSetup.Res ?? RenderSetup.Default.Res; } } diff --git a/Source/Core/Duality/Components/Physics/PhysicsWorld.cs b/Source/Core/Duality/Components/Physics/PhysicsWorld.cs index c2db20077..63a81f76f 100644 --- a/Source/Core/Duality/Components/Physics/PhysicsWorld.cs +++ b/Source/Core/Duality/Components/Physics/PhysicsWorld.cs @@ -65,7 +65,7 @@ public float InterpolateAlpha /// public bool IsFixedTimestep { - get { return DualityApp.AppData.Value.PhysicsFixedTime && !this.lowFramerateMode; } + get { return DualityApp.AppData.Instance.PhysicsFixedTime && !this.lowFramerateMode; } } @@ -384,7 +384,7 @@ public bool QueryRect(Vector2 worldCoord, Vector2 size, List queriedB private void UpdateNativeSettings() { - Settings.VelocityThreshold = PhysicsUnit.VelocityToPhysical * DualityApp.AppData.Value.PhysicsVelocityThreshold; + Settings.VelocityThreshold = PhysicsUnit.VelocityToPhysical * DualityApp.AppData.Instance.PhysicsVelocityThreshold; } } } diff --git a/Source/Core/Duality/DualityApp.cs b/Source/Core/Duality/DualityApp.cs index 3fcdd0dec..f44cde7d6 100644 --- a/Source/Core/Duality/DualityApp.cs +++ b/Source/Core/Duality/DualityApp.cs @@ -171,7 +171,7 @@ public static Vector2 TargetViewSize { get { - Point2 forcedRenderSize = DualityApp.AppData.Value.ForcedRenderSize; + Point2 forcedRenderSize = DualityApp.AppData.Instance.ForcedRenderSize; if (forcedRenderSize.X > 0 && forcedRenderSize.Y > 0) return forcedRenderSize; else @@ -593,8 +593,8 @@ public static void Render(ContentRef target, Rect viewportRect, Ve /// public static void CalculateGameViewport(Point2 windowSize, out Rect windowViewport, out Vector2 renderTargetSize) { - Point2 forcedSize = DualityApp.AppData.Value.ForcedRenderSize; - TargetResize forcedResizeMode = DualityApp.AppData.Value.ForcedRenderResizeMode; + Point2 forcedSize = DualityApp.AppData.Instance.ForcedRenderSize; + TargetResize forcedResizeMode = DualityApp.AppData.Instance.ForcedRenderResizeMode; renderTargetSize = windowSize; windowViewport = new Rect(renderTargetSize); @@ -729,8 +729,8 @@ internal static void InitBackend(out T target, Func string.Equals(s, backend.Id, StringComparison.OrdinalIgnoreCase))) + if (DualityApp.AppData.Instance?.SkipBackends != null && + DualityApp.AppData.Instance.SkipBackends.Any(s => string.Equals(s, backend.Id, StringComparison.OrdinalIgnoreCase))) { Logs.Core.Write("Backend '{0}' skipped because of AppData settings.", backend.Name); continue; diff --git a/Source/Core/Duality/Launcher/DualityLauncher.cs b/Source/Core/Duality/Launcher/DualityLauncher.cs index bf19f1a3d..1c1047db0 100644 --- a/Source/Core/Duality/Launcher/DualityLauncher.cs +++ b/Source/Core/Duality/Launcher/DualityLauncher.cs @@ -64,11 +64,11 @@ public DualityLauncher(LauncherArgs launcherArgs = null) // Open up a new window WindowOptions options = new WindowOptions { - Size = DualityApp.UserData.Value.WindowSize, - ScreenMode = launcherArgs.IsDebugging ? ScreenMode.Window : DualityApp.UserData.Value.WindowMode, - RefreshMode = launcherArgs.IsProfiling ? RefreshMode.NoSync : DualityApp.UserData.Value.WindowRefreshMode, - Title = DualityApp.AppData.Value.AppName, - SystemCursorVisible = launcherArgs.IsDebugging || DualityApp.UserData.Value.SystemCursorVisible + Size = DualityApp.UserData.Instance.WindowSize, + ScreenMode = launcherArgs.IsDebugging ? ScreenMode.Window : DualityApp.UserData.Instance.WindowMode, + RefreshMode = launcherArgs.IsProfiling ? RefreshMode.NoSync : DualityApp.UserData.Instance.WindowRefreshMode, + Title = DualityApp.AppData.Instance.AppName, + SystemCursorVisible = launcherArgs.IsDebugging || DualityApp.UserData.Instance.SystemCursorVisible }; this.window = DualityApp.OpenWindow(options); } diff --git a/Source/Core/Duality/Resources/Scene.cs b/Source/Core/Duality/Resources/Scene.cs index ba91bf013..066039a6e 100644 --- a/Source/Core/Duality/Resources/Scene.cs +++ b/Source/Core/Duality/Resources/Scene.cs @@ -472,7 +472,7 @@ public void Render(ContentRef target, Rect viewportRect, Vector2 i { // Retrieve the rendering setup that will be used for rendering the scene RenderSetup setup = - DualityApp.AppData.Value.RenderingSetup.Res ?? + DualityApp.AppData.Instance.RenderingSetup.Res ?? RenderSetup.Default.Res; // Render the scene diff --git a/Source/Core/Duality/Utility/ISettingsContainer.cs b/Source/Core/Duality/Utility/ISettingsContainer.cs index b6fde2db0..076494c17 100644 --- a/Source/Core/Duality/Utility/ISettingsContainer.cs +++ b/Source/Core/Duality/Utility/ISettingsContainer.cs @@ -4,8 +4,19 @@ namespace Duality { public interface ISettingsContainer { + /// + /// Fired when settings have changed. + /// event EventHandler Changed; + + /// + /// Loads the data of the settings. + /// void Load(); + + /// + /// Saves the data of the settings. + /// void Save(); } } diff --git a/Source/Core/Duality/Utility/SettingsContainer.cs b/Source/Core/Duality/Utility/SettingsContainer.cs index 79d8aace3..020bd1f40 100644 --- a/Source/Core/Duality/Utility/SettingsContainer.cs +++ b/Source/Core/Duality/Utility/SettingsContainer.cs @@ -10,17 +10,17 @@ namespace Duality public class SettingsContainer : ISettingsContainer where TSettings : class, new() { + private readonly string path; + /// - /// Fired when has changed. + /// Fired when has changed. /// public event EventHandler Changed; /// /// The settings data. This is null till is called after which it can never be null again. /// - public TSettings Value { get; private set; } - - private readonly string path; + public TSettings Instance { get; private set; } /// /// Creates a new settings container where the data for the settings will be saved and loaded from . @@ -36,7 +36,7 @@ public SettingsContainer(string path) /// public void Load() { - this.Value = Serializer.TryReadObject(this.path, typeof(XmlSerializer)) ?? new TSettings(); + this.Instance = Serializer.TryReadObject(this.path, typeof(XmlSerializer)) ?? new TSettings(); this.Changed?.Invoke(this, EventArgs.Empty); } @@ -45,7 +45,7 @@ public void Load() /// public void Save() { - Serializer.WriteObject(this.Value, this.path, typeof(XmlSerializer)); + Serializer.WriteObject(this.Instance, this.path, typeof(XmlSerializer)); } } } diff --git a/Source/Editor/DualityEditor/DualityEditorApp.cs b/Source/Editor/DualityEditor/DualityEditorApp.cs index 0661a3278..aea48fb2e 100644 --- a/Source/Editor/DualityEditor/DualityEditorApp.cs +++ b/Source/Editor/DualityEditor/DualityEditorApp.cs @@ -561,8 +561,8 @@ private static void InitMainGraphicsContext() // Currently bound to game-specific settings. Should be decoupled // from them at some point, so the editor can use independent settings. mainGraphicsContext = graphicsBack.CreateContext( - DualityApp.AppData.Value.MultisampleBackBuffer ? - DualityApp.UserData.Value.AntialiasingQuality : + DualityApp.AppData.Instance.MultisampleBackBuffer ? + DualityApp.UserData.Instance.AntialiasingQuality : AAQuality.Off); } catch (Exception e) @@ -640,7 +640,7 @@ public static string SaveCurrentScene(bool skipYetUnsaved = true) if (IsResourceUnsaved(Scene.Current)) { Scene.Current.Save(); - DualityApp.AppData.Value.Version++; + DualityApp.AppData.Instance.Version++; } } else if (!skipYetUnsaved) @@ -648,12 +648,12 @@ public static string SaveCurrentScene(bool skipYetUnsaved = true) string basePath = Path.Combine(DualityApp.DataDirectory, "Scene"); string path = PathHelper.GetFreePath(basePath, Resource.GetFileExtByType()); Scene.Current.Save(path); - DualityApp.AppData.Value.Version++; + DualityApp.AppData.Instance.Version++; // If there is no start scene defined, use this one. - if (DualityApp.AppData.Value.StartScene == null) + if (DualityApp.AppData.Instance.StartScene == null) { - DualityApp.AppData.Value.StartScene = Scene.Current; + DualityApp.AppData.Instance.StartScene = Scene.Current; DualityApp.AppData.Save(); } } @@ -669,7 +669,7 @@ public static void SaveResources() anySaved = true; } unsavedResources.Clear(); - if (anySaved) DualityApp.AppData.Value.Version++; + if (anySaved) DualityApp.AppData.Instance.Version++; } public static void FlagResourceUnsaved(IEnumerable res) { @@ -1250,7 +1250,7 @@ private static void FileEventManager_PluginsChanged(object sender, FileSystemCha if (!corePluginReloader.ReloadSchedule.Contains(fileEvent.Path)) { corePluginReloader.ReloadSchedule.Add(fileEvent.Path); - DualityApp.AppData.Value.Version++; + DualityApp.AppData.Instance.Version++; } } corePluginReloader.State = ReloadCorePluginDialog.ReloaderState.WaitForPlugins; diff --git a/Source/Editor/DualityEditor/Forms/MainForm.cs b/Source/Editor/DualityEditor/Forms/MainForm.cs index 093f5b9e9..b1eefce62 100644 --- a/Source/Editor/DualityEditor/Forms/MainForm.cs +++ b/Source/Editor/DualityEditor/Forms/MainForm.cs @@ -493,7 +493,7 @@ private void actionRunApp_Click(object sender, EventArgs e) this.VerifyStartScene(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); - startInfo.FileName = Path.GetFullPath(DualityEditorApp.EditorAppData.Value.LauncherPath); + startInfo.FileName = Path.GetFullPath(DualityEditorApp.EditorAppData.Instance.LauncherPath); startInfo.Arguments = LauncherArgs.CmdArgEditor; startInfo.WorkingDirectory = Environment.CurrentDirectory; System.Diagnostics.Process appProc = System.Diagnostics.Process.Start(startInfo); @@ -507,7 +507,7 @@ private void actionDebugApp_Click(object sender, EventArgs e) this.VerifyStartScene(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); - startInfo.FileName = Path.GetFullPath(DualityEditorApp.EditorAppData.Value.LauncherPath); + startInfo.FileName = Path.GetFullPath(DualityEditorApp.EditorAppData.Instance.LauncherPath); startInfo.Arguments = LauncherArgs.CmdArgEditor + " " + LauncherArgs.CmdArgDebug; startInfo.WorkingDirectory = Environment.CurrentDirectory; System.Diagnostics.Process appProc = System.Diagnostics.Process.Start(startInfo); @@ -521,7 +521,7 @@ private void actionProfileApp_Click(object sender, EventArgs e) this.VerifyStartScene(); System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(); - startInfo.FileName = Path.GetFullPath(DualityEditorApp.EditorAppData.Value.LauncherPath); + startInfo.FileName = Path.GetFullPath(DualityEditorApp.EditorAppData.Instance.LauncherPath); startInfo.Arguments = LauncherArgs.CmdArgEditor + " " + LauncherArgs.CmdArgProfiling; startInfo.WorkingDirectory = Environment.CurrentDirectory; System.Diagnostics.Process appProc = System.Diagnostics.Process.Start(startInfo); @@ -532,10 +532,10 @@ private void actionProfileApp_Click(object sender, EventArgs e) private void actionConfigureLauncher_Click(object sender, EventArgs e) { OpenFileDialog fileDialog = new OpenFileDialog(); - fileDialog.InitialDirectory = Path.GetDirectoryName(DualityEditorApp.EditorAppData.Value.LauncherPath); + fileDialog.InitialDirectory = Path.GetDirectoryName(DualityEditorApp.EditorAppData.Instance.LauncherPath); if (string.IsNullOrWhiteSpace(fileDialog.InitialDirectory)) fileDialog.InitialDirectory = Environment.CurrentDirectory; - fileDialog.FileName = Path.GetFileName(DualityEditorApp.EditorAppData.Value.LauncherPath); + fileDialog.FileName = Path.GetFileName(DualityEditorApp.EditorAppData.Instance.LauncherPath); fileDialog.Filter = "Executable files (*.exe)|*.exe"; fileDialog.FilterIndex = 1; fileDialog.RestoreDirectory = true; @@ -546,7 +546,7 @@ private void actionConfigureLauncher_Click(object sender, EventArgs e) fileDialog.CustomPlaces.Add(Environment.CurrentDirectory); if (fileDialog.ShowDialog(this) == DialogResult.OK) { - DualityEditorApp.EditorAppData.Value.LauncherPath = PathHelper.MakeFilePathRelative(fileDialog.FileName); + DualityEditorApp.EditorAppData.Instance.LauncherPath = PathHelper.MakeFilePathRelative(fileDialog.FileName); DualityEditorApp.EditorAppData.Save(); this.UpdateLaunchAppActions(); } @@ -801,7 +801,7 @@ private void UpdateSplitButtonBackupSettings() } public void UpdateLaunchAppActions() { - bool launcherAvailable = File.Exists(DualityEditorApp.EditorAppData.Value.LauncherPath); + bool launcherAvailable = File.Exists(DualityEditorApp.EditorAppData.Instance.LauncherPath); this.actionRunApp.Enabled = launcherAvailable; this.actionDebugApp.Enabled = launcherAvailable; this.menuRunApp.Enabled = launcherAvailable; @@ -810,12 +810,12 @@ public void UpdateLaunchAppActions() } private void VerifyStartScene() { - if (DualityApp.AppData.Value.StartScene != null) return; + if (DualityApp.AppData.Instance.StartScene != null) return; // If there is no StartScene defined, attempt to find one automatically. if (!Scene.Current.IsRuntimeResource) { - DualityApp.AppData.Value.StartScene = Scene.Current; + DualityApp.AppData.Instance.StartScene = Scene.Current; DualityApp.AppData.Save(); } else @@ -823,13 +823,13 @@ private void VerifyStartScene() ContentRef existingScene = ContentProvider.GetAvailableContent().FirstOrDefault(); if (existingScene != null) { - DualityApp.AppData.Value.StartScene = existingScene; + DualityApp.AppData.Instance.StartScene = existingScene; DualityApp.AppData.Save(); } else if (!Scene.Current.IsEmpty) { DualityEditorApp.SaveCurrentScene(false); - DualityApp.AppData.Value.StartScene = Scene.Current; + DualityApp.AppData.Instance.StartScene = Scene.Current; DualityApp.AppData.Save(); } } diff --git a/Source/Editor/DualityEditor/Forms/PublishGameDialog.cs b/Source/Editor/DualityEditor/Forms/PublishGameDialog.cs index d099f385d..5e324ac87 100644 --- a/Source/Editor/DualityEditor/Forms/PublishGameDialog.cs +++ b/Source/Editor/DualityEditor/Forms/PublishGameDialog.cs @@ -129,7 +129,7 @@ private void buttonPublish_Click(object sender, EventArgs e) public static void PublishProject(string targetDir, bool includeSource, bool includeEditor, bool compress, bool createShortcuts, Func targetExistsCallback = null) { // Determine a valid directory name for the game - string gameDirName = PathOp.GetValidFileName(DualityApp.AppData.Value.AppName); + string gameDirName = PathOp.GetValidFileName(DualityApp.AppData.Instance.AppName); string targetGameDir = Path.Combine(targetDir, gameDirName); string archiveBaseDir = targetGameDir; @@ -204,7 +204,7 @@ public static void PublishProject(string targetDir, bool includeSource, bool inc string shortcutFilePath = Path.Combine(archiveBaseDir, gameDirName + ".bat"); File.WriteAllText( shortcutFilePath, - "cd GameData && start " + PathHelper.MakeFilePathRelative(DualityEditorApp.EditorAppData.Value.LauncherPath)); + "cd GameData && start " + PathHelper.MakeFilePathRelative(DualityEditorApp.EditorAppData.Instance.LauncherPath)); // Create a shortcut to the editor if (includeEditor) diff --git a/Source/Platform/DefaultOpenTK/Backend/Graphics/GraphicsBackend.cs b/Source/Platform/DefaultOpenTK/Backend/Graphics/GraphicsBackend.cs index 82d3b3d4b..e7a438ac6 100644 --- a/Source/Platform/DefaultOpenTK/Backend/Graphics/GraphicsBackend.cs +++ b/Source/Platform/DefaultOpenTK/Backend/Graphics/GraphicsBackend.cs @@ -410,9 +410,9 @@ private void QueryGraphicsModes() sortedModes.StableSort((a, b) => a.Samples - b.Samples); int highestAALevel = MathF.RoundToInt(MathF.Log(MathF.Max(sortedModes.Max(m => m.Samples), 1.0f), 2.0f)); int targetAALevel = highestAALevel; - if (DualityApp.AppData.Value.MultisampleBackBuffer) + if (DualityApp.AppData.Instance.MultisampleBackBuffer) { - switch (DualityApp.UserData.Value.AntialiasingQuality) + switch (DualityApp.UserData.Instance.AntialiasingQuality) { case AAQuality.High: targetAALevel = highestAALevel; break; case AAQuality.Medium: targetAALevel = highestAALevel / 2; break; diff --git a/Source/Platform/DefaultOpenTK/Backend/Graphics/NativeWindow.cs b/Source/Platform/DefaultOpenTK/Backend/Graphics/NativeWindow.cs index 336b1b706..50cd33527 100644 --- a/Source/Platform/DefaultOpenTK/Backend/Graphics/NativeWindow.cs +++ b/Source/Platform/DefaultOpenTK/Backend/Graphics/NativeWindow.cs @@ -193,22 +193,22 @@ private void OnUserDataChanged(object sender, EventArgs e) if (DisplayDevice.Default == null) return; // Determine the target state for our window - MouseCursor targetCursor = DualityApp.UserData.Value.SystemCursorVisible ? MouseCursor.Default : MouseCursor.Empty; + MouseCursor targetCursor = DualityApp.UserData.Instance.SystemCursorVisible ? MouseCursor.Default : MouseCursor.Empty; WindowState targetWindowState = this.internalWindow.WindowState; WindowBorder targetWindowBorder = this.internalWindow.WindowBorder; Size targetSize = this.internalWindow.ClientSize; - switch (DualityApp.UserData.Value.WindowMode) + switch (DualityApp.UserData.Instance.WindowMode) { case ScreenMode.Window: targetWindowState = WindowState.Normal; targetWindowBorder = WindowBorder.Resizable; - targetSize = new Size(DualityApp.UserData.Value.WindowSize.X, DualityApp.UserData.Value.WindowSize.Y); + targetSize = new Size(DualityApp.UserData.Instance.WindowSize.X, DualityApp.UserData.Instance.WindowSize.Y); break; case ScreenMode.FixedWindow: targetWindowState = WindowState.Normal; targetWindowBorder = WindowBorder.Fixed; - targetSize = new Size(DualityApp.UserData.Value.WindowSize.X, DualityApp.UserData.Value.WindowSize.Y); + targetSize = new Size(DualityApp.UserData.Instance.WindowSize.X, DualityApp.UserData.Instance.WindowSize.Y); break; case ScreenMode.FullWindow: diff --git a/Source/Plugins/EditorModules/CamView/CamViewStates/GameViewCamViewState.cs b/Source/Plugins/EditorModules/CamView/CamViewStates/GameViewCamViewState.cs index 277fd9640..677ab0b9f 100644 --- a/Source/Plugins/EditorModules/CamView/CamViewStates/GameViewCamViewState.cs +++ b/Source/Plugins/EditorModules/CamView/CamViewStates/GameViewCamViewState.cs @@ -85,8 +85,8 @@ private AAQuality GameAntialiasingQuality { get { - return DualityApp.AppData.Value.MultisampleBackBuffer ? - DualityApp.UserData.Value.AntialiasingQuality : + return DualityApp.AppData.Instance.MultisampleBackBuffer ? + DualityApp.UserData.Instance.AntialiasingQuality : AAQuality.Off; } } @@ -99,12 +99,12 @@ private Point2 GameTargetSize get { bool isUsingForcedSize = - DualityApp.AppData.Value.ForcedRenderResizeMode != TargetResize.None && - DualityApp.AppData.Value.ForcedRenderSize.X != 0 && - DualityApp.AppData.Value.ForcedRenderSize.Y != 0; + DualityApp.AppData.Instance.ForcedRenderResizeMode != TargetResize.None && + DualityApp.AppData.Instance.ForcedRenderSize.X != 0 && + DualityApp.AppData.Instance.ForcedRenderSize.Y != 0; return isUsingForcedSize ? - DualityApp.AppData.Value.ForcedRenderSize : - DualityApp.UserData.Value.WindowSize; + DualityApp.AppData.Instance.ForcedRenderSize : + DualityApp.UserData.Instance.WindowSize; } } ///