using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DunGen; using DunGen.Graph; using UnityEngine; namespace DunGenPlus { public class API { /// /// Registers the to recieve the alternate dungeon generation changes defined by . /// /// /// /// /// /// if was successfully added. /// if was null or already has a registered . /// public static bool AddDunGenExtender(DungeonFlow dungeonFlow, DunGenExtender dunGenExtender) { if (dungeonFlow == null) { Plugin.logger.LogError("dungeonFlow was null"); return false; } if (ContainsDungeonFlow(dungeonFlow)) { Plugin.logger.LogWarning($"Already contains DunGenExtender asset for {dungeonFlow.name}"); return false; } Plugin.DunGenExtenders.Add(dungeonFlow, dunGenExtender); Plugin.logger.LogInfo($"Added DunGenExtender asset for {dungeonFlow.name}"); return true; } /// /// Registers the to recieve the alternate dungeon generation changes defined by . /// /// /// /// /// if was successfully added. /// if was null or already has a registered . /// public static bool AddDunGenExtender(DunGenExtender dunGenExtender) { if (dunGenExtender == null) { Plugin.logger.LogError("dunGenExtender was null"); return false; } return AddDunGenExtender(dunGenExtender.DungeonFlow, dunGenExtender); } /// /// Checks if has a registered . /// /// /// /// if has a registered . /// otherwise. /// public static bool ContainsDungeonFlow(DungeonFlow dungeonFlow) { return Plugin.DunGenExtenders.ContainsKey(dungeonFlow); } /// /// Creates and returns an empty . /// /// /// An empty . public static DunGenExtender CreateDunGenExtender(DungeonFlow dungeonFlow){ var extender = ScriptableObject.CreateInstance(); extender.DungeonFlow = dungeonFlow; return extender; } } }