public override void Entry(IModHelper helper) { // Set up the monitor and helper monitor = Monitor; modHelper = helper; manifest = ModManifest; multiplayer = helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue(); i18n = helper.Translation; // Load in our assets ModResources.SetUpAssets(helper); // Initialize the timer for fishing trip fishingTripTimer.Value = 0; // Set up our notification system on the trawler _eventSecondInterval = 600; _isTripEnding.Value = false; _activeNotification = String.Empty; _notificationAlpha = 1f; _isNotificationFading = false; // Load our Harmony patches try { var harmony = new Harmony(this.ModManifest.UniqueID); // Apply our patches new BeachPatch(monitor).Apply(harmony); new IslandSouthEastPatch(monitor).Apply(harmony); new GameLocationPatch(monitor).Apply(harmony); } catch (Exception e) { Monitor.Log($"Issue with Harmony patching: {e}", LogLevel.Error); return; } // Add in our debug commands helper.ConsoleCommands.Add("ft_getflags", "Gives all the variations of the ancient flag.\n\nUsage: ft_getflags", this.DebugGetAllFlags); helper.ConsoleCommands.Add("ft_getspecials", "Gives all the special rewards.\n\nUsage: ft_getspecials", this.DebugGetSpecialRewards); // Hook into GameLoops related events helper.Events.GameLoop.UpdateTicking += this.OnUpdateTicking; helper.Events.GameLoop.OneSecondUpdateTicking += this.OnOneSecondUpdateTicking; helper.Events.GameLoop.GameLaunched += this.OnGameLaunched; helper.Events.GameLoop.DayStarted += this.OnDayStarted; helper.Events.GameLoop.DayEnding += this.OnDayEnding; // Hook into Display related events helper.Events.Display.RenderingHud += this.OnRenderingHud; helper.Events.Display.RenderedHud += this.OnRenderedHud; // Hook into Player related events helper.Events.Player.Warped += this.OnWarped; // Hook into MouseClicked helper.Events.Input.ButtonPressed += this.OnButtonPressed; // Hook into Multiplayer related helper.Events.Multiplayer.PeerConnected += this.OnPeerConnected; helper.Events.Multiplayer.ModMessageReceived += this.OnModMessageReceived; }
public override void Entry(IModHelper helper) { // Set up the monitor and helper monitor = Monitor; modHelper = helper; manifest = ModManifest; multiplayer = helper.Reflection.GetField <Multiplayer>(typeof(Game1), "multiplayer").GetValue(); i18n = helper.Translation; // Load in our assets ModResources.SetUpAssets(helper); // Initialize the timer for fishing trip fishingTripTimer.Value = 0; // Set up notification messages MESSAGE_EVERYTHING_FAILING = new KeyValuePair <string, int>(helper.Translation.Get("status_message.ship_falling_apart"), 10); MESSAGE_LOSING_FISH = new KeyValuePair <string, int>(helper.Translation.Get("status_message.losing_fish"), 9); MESSAGE_MAX_LEAKS = new KeyValuePair <string, int>(helper.Translation.Get("status_message.taking_on_water"), 8); MESSAGE_MULTI_PROBLEMS = new KeyValuePair <string, int>(helper.Translation.Get("status_message.lots_of_problems"), 7); MESSAGE_ENGINE_PROBLEM = new KeyValuePair <string, int>(helper.Translation.Get("status_message.engine_failing"), 7); MESSAGE_NET_PROBLEM = new KeyValuePair <string, int>(helper.Translation.Get("status_message.nets_torn"), 6); MESSAGE_LEAK_PROBLEM = new KeyValuePair <string, int>(helper.Translation.Get("status_message.leak"), 5); // Set up our notification system on the trawler _eventSecondInterval = 600; _isTripEnding.Value = false; _activeNotification = String.Empty; _notificationAlpha = 1f; _isNotificationFading = false; // Load our Harmony patches try { var harmony = HarmonyInstance.Create(this.ModManifest.UniqueID); // Apply our patches new BeachPatch(monitor).Apply(harmony); new GameLocationPatch(monitor).Apply(harmony); } catch (Exception e) { Monitor.Log($"Issue with Harmony patching: {e}", LogLevel.Error); return; } // Hook into GameLoops related events helper.Events.GameLoop.UpdateTicking += this.OnUpdateTicking; helper.Events.GameLoop.OneSecondUpdateTicking += this.OnOneSecondUpdateTicking; helper.Events.GameLoop.GameLaunched += this.OnGameLaunched; helper.Events.GameLoop.DayStarted += this.OnDayStarted; helper.Events.GameLoop.DayEnding += this.OnDayEnding; // Hook into Display related events helper.Events.Display.RenderingHud += this.OnRenderingHud; helper.Events.Display.RenderedHud += this.OnRenderedHud; // Hook into Player related events helper.Events.Player.Warped += this.OnWarped; // Hook into MouseClicked helper.Events.Input.ButtonPressed += this.OnButtonPressed; // Hook into Multiplayer related helper.Events.Multiplayer.PeerConnected += this.OnPeerConnected; helper.Events.Multiplayer.ModMessageReceived += this.OnModMessageReceived; }