/*********
        ** 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;
        }
Example #2
0
 // Use this for initialization
 void Start()
 {
     objC    = gameObject.GetComponent <ObjCreator>();
     floorC  = gameObject.GetComponent <FloorCreator>();
     wallC   = gameObject.GetComponent <WallCreator>();
     doorC   = gameObject.GetComponent <DoorCreator>();
     windowC = gameObject.GetComponent <WindowCreator>();
 }