/********* ** Public methods *********/ /// <summary>Construct an instance.</summary> /// <param name="doorTileInfoManager">Manages information about the tiles needed to draw doors.</param> /// <param name="timer">Callback timer for door animations.</param> /// <param name="errorQueue">Error manager for reading door definitions from map files.</param> public DoorCreator(GeneratedDoorTileInfoManager doorTileInfoManager, CallbackTimer timer, ErrorQueue errorQueue, ISemanticVersion modVersion) { this.doorTileInfoManager = doorTileInfoManager; this.errorQueue = errorQueue; this.timer = timer; this.modVersion = modVersion; }
/********* ** Public methods *********/ /// <summary>The mod entry point, called after the mod is first loaded.</summary> /// <param name="helper">Provides simplified APIs for writing mods.</param> public override void Entry(IModHelper helper) { // Read config. this.config = new ConfigManager(this.Helper).GetConfig(); // Create helper classes that make the mod work. ErrorQueue errorQueue = new ErrorQueue(this.Monitor); ContentPackLoader packLoader = new ContentPackLoader(this.Helper, this.Monitor, errorQueue); this.serializer = new DoorPositionSerializer(this.Helper.Data); this.timer = new CallbackTimer(); this.doorTileInfoManager = new GeneratedDoorTileInfoManager(); this.generator = new DoorSpriteGenerator(this.doorTileInfoManager, packLoader.LoadContentPacks(), this.Helper.Multiplayer.ModID, this.Monitor, Game1.graphics.GraphicsDevice); this.creator = new DoorCreator(this.doorTileInfoManager, this.timer, errorQueue, this.Helper.ModRegistry.Get(this.Helper.ModRegistry.ModID).Manifest.Version); this.assetLoader = new DoorAssetLoader(this.Helper.Content); this.mapTileSheetManager = new MapTileSheetManager(); this.manager = new DoorManager(this.config, this.OnDoorToggled); // Apply Harmony patches. BetterDoorsMod.Instance = this; HarmonyInstance harmony = HarmonyInstance.Create(this.Helper.ModRegistry.ModID); harmony.PatchAll(Assembly.GetExecutingAssembly()); // Attach events. this.Enable(); this.Helper.Events.Multiplayer.PeerContextReceived += this.Multiplayer_PeerContextReceived; this.Helper.Events.GameLoop.ReturnedToTitle += this.GameLoop_ReturnedToTitle; }