1 using System.Collections.Generic;
3 using Microsoft.Xna.Framework;
17 public string Name {
get;
private set; }
20 public string Folder {
get;
private set; }
25 protected XDocument
doc;
33 DebugConsole.ThrowError(
"[Params] Not loaded!");
34 return new XDocument();
61 protected virtual string GetName() => System.IO.Path.GetFileNameWithoutExtension(
Path.
Value).FormatCamelCaseWithSpaces();
70 protected virtual bool Serialize(XElement element =
null)
75 DebugConsole.ThrowError(
"[EditableParams] The XML element is null! Failed to save the parameters.");
85 doc = XMLExtensions.TryLoadXml(
Path);
88 DebugConsole.ThrowError(
"[EditableParams] The document is null! Failed to load the parameters.",
94 DebugConsole.ThrowError(
"[EditableParams] The main element is null! Failed to load the parameters.",
112 public virtual bool Save(
string fileNameWithoutExtension =
null, System.Xml.XmlWriterSettings settings =
null)
114 if (!Directory.Exists(
Folder))
116 Directory.CreateDirectory(
Folder);
120 if (settings ==
null)
122 settings =
new System.Xml.XmlWriterSettings
125 OmitXmlDeclaration =
true,
126 NewLineOnAttributes =
true
129 if (fileNameWithoutExtension !=
null)
141 public virtual bool Reset(
bool forceReload =
false)
156 DebugConsole.ThrowError(
"[Params] Not loaded!");
readonly? ContentPackage ContentPackage
static ContentPath FromRaw(string? rawValue)
static readonly ContentPath Empty
ContentPackage? ContentPackage
string FileNameWithoutExtension
SerializableEntityEditor SerializableEntityEditor
virtual void UpdatePath(ContentPath fullPath)
virtual bool Serialize(XElement element=null)
virtual bool Save(string fileNameWithoutExtension=null, System.Xml.XmlWriterSettings settings=null)
virtual bool Reset(bool forceReload=false)
ContentXElement CreateElement(string name, params object[] attrs)
Dictionary< Identifier, SerializableProperty > SerializableProperties
ContentXElement OriginalElement
ContentXElement rootElement
virtual ContentXElement? MainElement
virtual bool Load(ContentPath file)
virtual bool Deserialize(XElement element=null)
virtual void AddToEditor(ParamsEditor editor, int space=0)
RectTransform RectTransform
GUIFrame Content
A frame that contains the contents of the listbox. The frame itself is not rendered.
static XmlWriter Create(string path, System.Xml.XmlWriterSettings settings)
static Dictionary< Identifier, SerializableProperty > DeserializeProperties(object obj, XElement element=null)
static void SerializeProperties(ISerializableEntity obj, XElement element, bool saveIfDefault=false, bool ignoreEditable=false)