private void ControlEvents_KeyPressed(object sender, EventArgsKeyPressed e) { if (e.KeyPressed == Keys.F5) { this.Config = this.Helper.ReadConfig <HealthBarConfig>(); this.Monitor.Log("Config reloaded", LogLevel.Info); } }
/********* ** 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.Config = helper.ReadConfig <HealthBarConfig>(); GameEvents.FirstUpdateTick += this.GameEvents_FirstUpdateTick; GraphicsEvents.OnPostRenderEvent += this.GraphicsEvents_OnPostRenderEvent; ControlEvents.KeyPressed += this.ControlEvents_KeyPressed; this.Monitor.Log("Initialized (press F5 to reload config)"); }
/********* ** 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 = helper.ReadConfig <HealthBarConfig>(); // build bar texture this.BarTexture = this.GetBarTexture(); // hook events GraphicsEvents.OnPostRenderEvent += this.GraphicsEvents_OnPostRenderEvent; ControlEvents.KeyPressed += this.ControlEvents_KeyPressed; this.Monitor.Log("Initialized (press F5 to reload config)"); }
/********* ** 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.Config = helper.ReadConfig <HealthBarConfig>(); int innerBarWidth = this.Config.BarWidth - this.Config.BarBorderWidth * 2; int innerBarHeight = this.Config.BarHeight - this.Config.BarBorderHeight * 2; this.TextureBar = new Texture2D(Game1.graphics.GraphicsDevice, innerBarWidth, innerBarHeight); var data = new uint[innerBarWidth * innerBarHeight]; for (int i = 0; i < data.Length; i++) { data[i] = 0xffffffff; } this.TextureBar.SetData(data); GraphicsEvents.OnPostRenderEvent += this.GraphicsEvents_OnPostRenderEvent; ControlEvents.KeyPressed += this.ControlEvents_KeyPressed; this.Monitor.Log("Initialized (press F5 to reload config)"); }
public override void Entry(params object[] objects) { ModConfig = new HealthBarConfig().InitializeConfig(BaseConfigPath); int innerBarWidth = ModConfig.BarWidth - ModConfig.BarBorderWidth * 2; int innerBarHeight = ModConfig.BarHeight - ModConfig.BarBorderHeight * 2; GameEvents.FirstUpdateTick += (sender, args) => { texBar = new Texture2D(Game1.graphics.GraphicsDevice, innerBarWidth, innerBarHeight); var data = new uint[innerBarWidth * innerBarHeight]; for (int i = 0; i < data.Length; i++) { data[i] = 0xffffffff; } texBar.SetData <uint>(data); }; GraphicsEvents.OnPreRenderGuiEventNoCheck += GraphicsEvents_DrawTick; ControlEvents.KeyPressed += ControlEvents_KeyPressed; Log.Info(GetType().Name + " by Zoryn => Initialized (Press F5 To Reload Config)"); }