3 using System.Collections.Immutable;
5 using System.Reflection;
18 Identifier elemNameWithFontSuffix = elemName.AppendIfMissing(
"Font");
21 foreach (var element
in parentElement.
Elements())
26 else if (GUIStyle.Fonts.ContainsKey(elemNameWithFontSuffix))
29 GUIStyle.Fonts[elemNameWithFontSuffix].Prefabs.Add(prefab, overriding);
31 else if (GUIStyle.Sprites.ContainsKey(elemName))
34 GUIStyle.Sprites[elemName].Prefabs.Add(prefab, overriding);
36 else if (GUIStyle.SpriteSheets.ContainsKey(elemName))
39 GUIStyle.SpriteSheets[elemName].Prefabs.Add(prefab, overriding);
41 else if (GUIStyle.Colors.ContainsKey(elemName))
44 GUIStyle.Colors[elemName].Prefabs.Add(prefab, overriding);
46 else if (elemName ==
"cursor")
49 GUIStyle.CursorSprite.Prefabs.Add(prefab, overriding);
51 else if (elemName ==
"style")
53 foreach (var element
in parentElement.
Elements())
61 GUIStyle.ComponentStyles.Add(prefab, overriding);
67 XDocument doc = XMLExtensions.TryLoadXml(Path);
68 if (doc ==
null) {
return; }
76 GUIStyle.ComponentStyles.RemoveByFile(
this);
77 GUIStyle.CursorSprite.Prefabs.RemoveByFile(
this);
78 GUIStyle.Fonts.Values.ForEach(p => p.Prefabs.RemoveByFile(
this));
79 GUIStyle.Sprites.Values.ForEach(p => p.Prefabs.RemoveByFile(
this));
80 GUIStyle.SpriteSheets.Values.ForEach(p => p.Prefabs.RemoveByFile(
this));
81 GUIStyle.Colors.Values.ForEach(p => p.Prefabs.RemoveByFile(
this));
84 public override sealed
void Sort()
86 GUIStyle.ComponentStyles.SortAll();
87 GUIStyle.CursorSprite.Prefabs.Sort();
88 GUIStyle.Fonts.Values.ForEach(p => p.Prefabs.Sort());
89 GUIStyle.Sprites.Values.ForEach(p => p.Prefabs.Sort());
90 GUIStyle.SpriteSheets.Values.ForEach(p => p.Prefabs.Sort());
91 GUIStyle.Colors.Values.ForEach(p => p.Prefabs.Sort());
95 public sealed
class UIStyleFile : OtherFile
readonly ContentPackage ContentPackage
Identifier NameAsIdentifier()
IEnumerable< ContentXElement > Elements()
override sealed void LoadFile()
override sealed void Sort()
void LoadFromXElement(ContentXElement parentElement, bool overriding)
UIStyleFile(ContentPackage contentPackage, ContentPath path)
override sealed void UnloadFile()