|
11 | 11 | using static QudUX.Utilities.Logger;
|
12 | 12 | using QudUX.Concepts;
|
13 | 13 | using Newtonsoft.Json;
|
| 14 | +using System.Xml; |
14 | 15 |
|
15 | 16 | namespace QudUX.ScreenExtenders
|
16 | 17 | {
|
@@ -136,6 +137,10 @@ public void InitBlueprintTiles(string query)
|
136 | 137 | .Where(bp => !bp.Tags.ContainsKey("BaseObject") && bp.Name.EndsWith(" Cherub"));
|
137 | 138 | Tiles = LoadBlueprintTiles(matches).OrderBy(tm => tm.Tile).ThenBy(tm => tm.ForegroundColorIndex).ToList();
|
138 | 139 | }
|
| 140 | + else if (query == "character presets") |
| 141 | + { |
| 142 | + Tiles = LoadPresetTiles().OrderBy(tm => tm.Tile).ThenBy(tm => tm.ForegroundColorIndex).ToList(); |
| 143 | + } |
139 | 144 | else if (query.Length > 0)
|
140 | 145 | {
|
141 | 146 | var matches = GameObjectFactory.Factory.BlueprintList
|
@@ -264,6 +269,33 @@ public IEnumerable<TileMetadata> LoadBlueprintTiles(IEnumerable<GameObjectBluepr
|
264 | 269 | }
|
265 | 270 | }
|
266 | 271 |
|
| 272 | + public IEnumerable<TileMetadata> LoadPresetTiles() |
| 273 | + { |
| 274 | + List<string> embarkModuleFiles = new List<string>(); |
| 275 | + embarkModuleFiles.Add(DataManager.FilePath("EmbarkModules.xml")); |
| 276 | + ModManager.ForEachFile("EmbarkModules.xml", delegate (string path) { embarkModuleFiles.Add(path); }); |
| 277 | + foreach (string embarkModuleXmlPath in embarkModuleFiles) |
| 278 | + { |
| 279 | + if (File.Exists(embarkModuleXmlPath)) |
| 280 | + { |
| 281 | + XmlDocument embarkModulesXml = new XmlDocument(); |
| 282 | + embarkModulesXml.Load(DataManager.FilePath("EmbarkModules.xml")); |
| 283 | + XmlNodeList pregenNodes = embarkModulesXml.GetElementsByTagName("pregen"); |
| 284 | + foreach (XmlNode pregenNode in pregenNodes) |
| 285 | + { |
| 286 | + string tilePath = pregenNode.Attributes["Tile"]?.Value; |
| 287 | + string detailColor = pregenNode.Attributes["Detail"]?.Value; |
| 288 | + string foregroundColor = IsPhotosynthetic ? "g" : pregenNode.Attributes["Foreground"]?.Value; |
| 289 | + string displayName = pregenNode.Attributes["Name"]?.Value; |
| 290 | + string blueprintPath = $"Character Presets > {displayName}"; |
| 291 | + yield return new TileMetadata(tilePath, detailColor, foregroundColor, displayName, blueprintPath); |
| 292 | + } |
| 293 | + pregenNodes = null; |
| 294 | + embarkModulesXml = null; |
| 295 | + } |
| 296 | + } |
| 297 | + } |
| 298 | + |
267 | 299 | public string BlueprintPath(GameObjectBlueprint blueprint)
|
268 | 300 | {
|
269 | 301 | string path = string.Empty;
|
|
0 commit comments