コード例 #1
0
ファイル: ModEntry.cs プロジェクト: xxjbcxx/smapi-mod-dump
        /*
         * NOTE:
         * Emotes are only visible by other players with the mod installed.
         */
        public override void Entry(IModHelper helper)
        {
            ModMonitor         = Monitor;
            ModHelper          = Helper;
            MultiplayerMessage = new MultiplayerModMessage(helper);

            ModPatchManager patchManager = new ModPatchManager(helper);

            patchManager.PatchList.Add(FarmerPatch.DoEmotePatch.CreatePatch(helper.Reflection));
            patchManager.PatchList.Add(CharacterPatch.DoEmotePatch.CreatePatch(helper.Reflection));
            patchManager.ApplyPatch();

            this.Monitor.Log("Loading mod config...", LogLevel.Debug);
            Config = helper.ReadConfig <ModConfig>();

            this.Monitor.Log("Loading mod data...", LogLevel.Debug);
            Data = this.Helper.Data.ReadJsonFile <ModData>("data.json") ?? new ModData();

            helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;

            // TODO: Command to stop emotes from NPC and FarmAnimals
            helper.ConsoleCommands.Add("emote", "Play the emote animation with the passed id.\n\nUsage: emote <value>\n- value: a integer representing the animation id.", this.Emote);
            helper.ConsoleCommands.Add("emote_npc", "Force a npc to play the emote animation with the given id.\n\nUsage: emote_npc <name> <value>\n- name: a string representing the npc name.\n- value: a integer representing the animation id.", this.EmoteNpc);
            helper.ConsoleCommands.Add("emote_animal", "Force a farm animal to play the emote animation with the given id.\n\nUsage: emote_animal <name> <value>\n- name: a string representing the farm animal name.\n- value: a integer representing the animation id.", this.EmoteFarmAnimal);
            helper.ConsoleCommands.Add("stop_emote", "Stop any emote being played by you.\n\nUsage: stop_emote", this.StopEmote);
            helper.ConsoleCommands.Add("stop_all_emotes", "Stop any emote being played.\n\nUsage: stop_all_emotes", this.StopAllEmotes);
            helper.ConsoleCommands.Add("multiplayer_emotes", "List all the players that have this mod and can send and receive emotes.\n\nUsage: multiplayer_emotes", this.MultiplayerEmotesAvailable);

#if DEBUG
            helper.Events.Input.ButtonPressed += DebugActionsKeyBinds;
#endif
        }
コード例 #2
0
        /*
         * NOTE:
         * Emotes are only visible by other players with the mod installed.
         */
        public override void Entry(IModHelper helper)
        {
            I18n.Init(helper.Translation);

            ModMonitor         = Monitor;
            ModHelper          = Helper;
            MultiplayerMessage = new MultiplayerModMessage(helper);

            ModPatchManager patchManager = new ModPatchManager(helper);

            // patchManager.PatchList.Add(FarmerPatch.DoEmotePatch.CreatePatch(helper.Reflection));
            patchManager.PatchList.Add(CharacterPatch.DoEmotePatch.CreatePatch(helper.Reflection));
            patchManager.ApplyPatch();

            this.Monitor.Log("Loading mod config...", LogLevel.Debug);
            Config = helper.ReadConfig <ModConfig>();

            this.Monitor.Log("Loading mod data...", LogLevel.Debug);
            Data = this.Helper.Data.ReadJsonFile <ModData>("data.json") ?? new ModData();

            helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded;


            // TODO: Command to stop emotes from NPC and FarmAnimals
            helper.ConsoleCommands.Add("play_emote", I18n.Command_PlayEmote(), this.Emote);
            helper.ConsoleCommands.Add("play_emote_npc", I18n.Command_PlayEmoteNpc(), this.EmoteNpc);
            helper.ConsoleCommands.Add("play_emote_animal", I18n.Command_PlayEmoteAnimal(), this.EmoteFarmAnimal);
            helper.ConsoleCommands.Add("stop_emote", I18n.Command_StopEmote(), this.StopEmote);
            helper.ConsoleCommands.Add("stop_emote_npc", I18n.Command_StopEmoteNpc(), this.StopEmoteNpc);
            helper.ConsoleCommands.Add("stop_emote_animal", I18n.Command_StopEmoteAnimal(), this.StopEmoteFarmAnimal);
            helper.ConsoleCommands.Add("stop_all_emotes", I18n.Command_StopAllEmotes(), this.StopAllEmotes);
            helper.ConsoleCommands.Add("multiplayer_emotes", I18n.Command_MultiplayerEmotes(), this.MultiplayerEmotesAvailable);

#if DEBUG
            helper.Events.Input.ButtonPressed += DebugActionsKeyBinds;
#endif
        }