/********* ** 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) { this.displayManager = new DisplayManager(helper.Content.Load <Texture2D>("assets/border.png"), helper.Content.Load <Texture2D>("assets/filled_in.png"), new Dictionary <RangeItem, Color> { { RangeItem.Sprinkler, Color.LightSkyBlue }, { RangeItem.Scarecrow, Color.SaddleBrown }, { RangeItem.BeeHouse, Color.Yellow }, { RangeItem.JunimoHut, Color.LimeGreen } }); SprinklerRangeCreator sprinklerRangeCreator = new SprinklerRangeCreator(); ScarecrowRangeCreator scarecrowRangeCreator = new ScarecrowRangeCreator(); this.objectRangeCreators = new List <IRangeCreator <SObject> > { sprinklerRangeCreator, scarecrowRangeCreator, new BeeHouseRangeCreator() }; this.buildingRangeCreators = new List <IRangeCreator <Building> > { new JunimoHutRangeCreator() }; this.modRegistryListeners = new List <IModRegistryListener> { sprinklerRangeCreator, scarecrowRangeCreator }; this.config = helper.ReadConfig <ModConfig>(); helper.Events.Display.RenderingHud += this.OnRenderingHud; helper.Events.Input.ButtonPressed += this.OnButtonPressed; helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked; if (this.config.ShowRangeOfHeldItem || this.config.ShowRangeOfHoveredOverItem) { helper.Events.Input.CursorMoved += this.OnCursorMoved; if (this.config.ShowRangeOfHoveredOverItem) { helper.Events.Input.ButtonReleased += this.OnButtonReleased; } } helper.Events.GameLoop.GameLaunched += this.OnGameLaunched; }
//Need to fix rendering and item change (walking) public override void Entry(IModHelper helper) { this.displayManager = new DisplayManager(helper.Content.Load <Texture2D>("assets/border.png"), helper.Content.Load <Texture2D>("assets/filled_in.png"), new Dictionary <RangeItem, Color>() { { RangeItem.Sprinkler, Color.LightSkyBlue }, { RangeItem.Scarecrow, Color.SaddleBrown }, { RangeItem.Bee_House, Color.Yellow }, { RangeItem.Junimo_Hut, Color.LimeGreen } }); this.sprinklerRangeCreator = new SprinklerRangeCreator(); this.scarecrowRangeCreator = new ScarecrowRangeCreator(); this.objectRangeCreators = new List <IObjectRangeCreator>() { this.sprinklerRangeCreator, this.scarecrowRangeCreator, new BeeHouseRangeCreator() }; this.buildingRangeCreators = new List <IBuildingRangeCreator>() { new JunimoHutRangeCreator() }; this.config = helper.ReadConfig <RangeDisplayConfig>(); //handle compatability for the versions where we assigned the modifier key badly if (this.config.HoverModifierKey == "control") { this.config.HoverModifierKey = "leftcontrol,rightcontrol"; helper.WriteConfig(this.config); } helper.Events.Display.RenderingHud += this.OnRenderingHud; helper.Events.Input.ButtonPressed += this.OnButtonPressed; helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked; if (this.config.ShowRangeOfHeldItem || this.config.ShowRangeOfHoveredOverItem) { helper.Events.Input.CursorMoved += this.OnCursorMoved; if (this.config.ShowRangeOfHoveredOverItem) { helper.Events.Input.ButtonReleased += this.OnButtonReleased; } } helper.Events.GameLoop.GameLaunched += this.OnGameLaunched; }