diff options
Diffstat (limited to 'GameData.cs')
| -rw-r--r-- | GameData.cs | 33 | 
1 files changed, 33 insertions, 0 deletions
| diff --git a/GameData.cs b/GameData.cs index a111b6a..107b408 100644 --- a/GameData.cs +++ b/GameData.cs | |||
| @@ -15,12 +15,29 @@ namespace ManifoldGardenArchipelago | |||
| 15 | } | 15 | } | 
| 16 | } | 16 | } | 
| 17 | 17 | ||
| 18 | public readonly struct EntranceIdentifier(string region, string name) | ||
| 19 | { | ||
| 20 | public readonly string region = region; | ||
| 21 | public readonly string name = name; | ||
| 22 | |||
| 23 | public override string ToString() | ||
| 24 | { | ||
| 25 | return $"Entrance({region},{name})"; | ||
| 26 | } | ||
| 27 | } | ||
| 28 | |||
| 18 | public readonly struct LocationDescription(string name_arg, Requirement requirement_arg) | 29 | public readonly struct LocationDescription(string name_arg, Requirement requirement_arg) | 
| 19 | { | 30 | { | 
| 20 | public readonly string name = name_arg; | 31 | public readonly string name = name_arg; | 
| 21 | public readonly Requirement requirement = requirement_arg; | 32 | public readonly Requirement requirement = requirement_arg; | 
| 22 | } | 33 | } | 
| 23 | 34 | ||
| 35 | public readonly struct PortalDescription(string scene, string name) | ||
| 36 | { | ||
| 37 | public readonly string scene = scene; | ||
| 38 | public readonly string name = name; | ||
| 39 | } | ||
| 40 | |||
| 24 | public class SceneDescription | 41 | public class SceneDescription | 
| 25 | { | 42 | { | 
| 26 | public readonly List<LocationDescription> locations = []; | 43 | public readonly List<LocationDescription> locations = []; | 
| @@ -28,6 +45,7 @@ namespace ManifoldGardenArchipelago | |||
| 28 | public readonly Dictionary<int, Requirement> smokeWalls = []; | 45 | public readonly Dictionary<int, Requirement> smokeWalls = []; | 
| 29 | public readonly Dictionary<int, Requirement> worldGrows = []; | 46 | public readonly Dictionary<int, Requirement> worldGrows = []; | 
| 30 | public readonly Dictionary<int, Requirement> lasers = []; | 47 | public readonly Dictionary<int, Requirement> lasers = []; | 
| 48 | public readonly Dictionary<string, EntranceIdentifier> portals = []; | ||
| 31 | } | 49 | } | 
| 32 | 50 | ||
| 33 | public class GameStateListeners | 51 | public class GameStateListeners | 
| @@ -51,6 +69,8 @@ namespace ManifoldGardenArchipelago | |||
| 51 | public static readonly Dictionary<SceneItemReference, GameStateListeners> listenersBySphere = []; | 69 | public static readonly Dictionary<SceneItemReference, GameStateListeners> listenersBySphere = []; | 
| 52 | public static readonly Dictionary<string, GameStateListeners> listenersByItem = []; | 70 | public static readonly Dictionary<string, GameStateListeners> listenersByItem = []; | 
| 53 | 71 | ||
| 72 | public static readonly Dictionary<EntranceIdentifier, PortalDescription> portal_by_entrance = []; | ||
| 73 | |||
| 54 | public static Requirement ParseRequirement(string scene, Dictionary<object, object> yamlReq) | 74 | public static Requirement ParseRequirement(string scene, Dictionary<object, object> yamlReq) | 
| 55 | { | 75 | { | 
| 56 | List<Requirement> reqs = []; | 76 | List<Requirement> reqs = []; | 
| @@ -512,6 +532,19 @@ namespace ManifoldGardenArchipelago | |||
| 512 | } | 532 | } | 
| 513 | } | 533 | } | 
| 514 | 534 | ||
| 535 | if (sceneDetails.ContainsKey("portals")) | ||
| 536 | { | ||
| 537 | foreach (var portalPair in (Dictionary<object, object>)sceneDetails["portals"]) | ||
| 538 | { | ||
| 539 | string portalName = (string)portalPair.Key; | ||
| 540 | var portalData = (Dictionary<object, object>)portalPair.Value; | ||
| 541 | EntranceIdentifier entranceIdentifier = new((string)portalData["region"], (string)portalData["connection"]); | ||
| 542 | |||
| 543 | sceneDescription.portals[portalName] = entranceIdentifier; | ||
| 544 | portal_by_entrance[entranceIdentifier] = new(scenePair.Key, portalName); | ||
| 545 | } | ||
| 546 | } | ||
| 547 | |||
| 515 | scenes[scenePair.Key] = sceneDescription; | 548 | scenes[scenePair.Key] = sceneDescription; | 
| 516 | } | 549 | } | 
| 517 | } | 550 | } | 
