Beispiel #1
0
        /*********
        ** 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)
        {
            monitor      = Monitor;
            _helper      = helper;
            notifyHelper = new NotifyHelper(monitor, _helper);

            if (Thread.CurrentThread.GetApartmentState() == ApartmentState.STA)
            {
                ModEntry.notifyHelper.Notify(Resources.WARN_STA_LAUNCHER, NotifyPlace.Monitor, NotifyMoment.GameLaunched, LogLevel.Warn);
                ModEntry.notifyHelper.Notify(Resources.WARN_STA_LAUNCHER, NotifyPlace.GameHUD, NotifyMoment.SaveLoaded);
            }

            KeyboardInput_.Initialize(Game1.game1.Window);

            RegCommand(helper);
            HarmonyInstance harmony = HarmonyInstance.Create(ModManifest.UniqueID);

            harmony.PatchAll();

            //compatible with ChatCommands
            if (Helper.ModRegistry.Get("cat.chatcommands") != null)
            {
                notifyHelper.NotifyMonitor("Compatible with ChatCommands");
                Compatibility.PatchChatCommands(monitor, harmony);
            }
        }
Beispiel #2
0
        /*********
        ** 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)
        {
            monitor      = Monitor;
            _helper      = helper;
            notifyHelper = new NotifyHelper(monitor, _helper);
            mainThreadId = Thread.CurrentThread.ManagedThreadId;

            KeyboardInput_.Initialize(Game1.game1.Window);

            RegCommand(helper);
            HarmonyInstance harmony = HarmonyInstance.Create(ModManifest.UniqueID);

            harmony.PatchAll();

            Type       type   = AccessTools.TypeByName("Microsoft.Xna.Framework.WindowsGameHost");
            MethodInfo m_idle = AccessTools.Method(type, "ApplicationIdle");

            harmony.Patch(m_idle, null, new HarmonyMethod(typeof(ModEntry), "PumpMessage"));

            //compatible with ChatCommands
            if (Helper.ModRegistry.Get("cat.chatcommands") != null)
            {
                notifyHelper.NotifyMonitor("Compatible with ChatCommands");
                Compatibility.PatchChatCommands(monitor, harmony);
            }
        }