Example #1
0
        private static void AppendSerializedWindow([NotNull] JEMSerializedWindow window)
        {
            if (window == null)
            {
                throw new ArgumentNullException(nameof(window));
            }
            var existingWindow = GetSerializedWindow(window.WindowName);

            if (existingWindow != null)
            {
                SerializedWindows.Remove(existingWindow);
            }
            SerializedWindows.Add(window);

            var path = Environment.CurrentDirectory + "\\" + SerializedWindowsDirectory + "\\" + window.WindowName.ToLower() + ".json";

            File.WriteAllText(path, JsonConvert.SerializeObject(window, Formatting.Indented));
        }
Example #2
0
        /// <summary>
        ///     Saves the state of window.
        /// </summary>
        public void SaveState()
        {
            if (!AllowWindowSaving)
            {
                return;
            }

            // Create serialized window obj.
            var serializedWindow = new JEMSerializedWindow
            {
                WindowName     = UniqueWindowName,
                ActiveState    = gameObject.activeSelf,
                AdditionalData = AdditionalSerializedData
            };

            // Apply fixed rect.
            serializedWindow.SetFixedRect(WindowTransform.GetFixedRect());

            // Append serialized window.
            AppendSerializedWindow(serializedWindow);
        }