From 64813c1c709ed386f584da65f31273dbbf1b754c Mon Sep 17 00:00:00 2001 From: Wojtek Figat Date: Mon, 9 Aug 2021 15:22:29 +0200 Subject: [PATCH] Add caching ShowGUI and ShowDebugDraw in Game window --- Source/Editor/Windows/GameWindow.cs | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Source/Editor/Windows/GameWindow.cs b/Source/Editor/Windows/GameWindow.cs index 26cef2621..101e845a4 100644 --- a/Source/Editor/Windows/GameWindow.cs +++ b/Source/Editor/Windows/GameWindow.cs @@ -1,6 +1,7 @@ // Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. using System; +using System.Xml; using FlaxEditor.GUI.ContextMenu; using FlaxEditor.GUI.Input; using FlaxEditor.Options; @@ -484,5 +485,31 @@ namespace FlaxEditor.Windows return result; } + + /// + public override bool UseLayoutData => true; + + /// + public override void OnLayoutSerialize(XmlWriter writer) + { + writer.WriteAttributeString("ShowGUI", ShowGUI.ToString()); + writer.WriteAttributeString("ShowDebugDraw", ShowDebugDraw.ToString()); + } + + /// + public override void OnLayoutDeserialize(XmlElement node) + { + if (bool.TryParse(node.GetAttribute("ShowGUI"), out bool value1)) + ShowGUI = value1; + if (bool.TryParse(node.GetAttribute("ShowDebugDraw"), out value1)) + ShowDebugDraw = value1; + } + + /// + public override void OnLayoutDeserialize() + { + ShowGUI = true; + ShowDebugDraw = false; + } } }