/// <inheritdoc cref="ISpecializedEvents.LoadStageChanged"/> /// <param name="sender">The event sender.</param> /// <param name="e">The event arguments.</param> private void OnLoadStageChanged(object sender, LoadStageChangedEventArgs e) { if (e.NewStage == LoadStage.SaveParsed) { LegacyDataMigrator.OnSaveParsed(this.Helper.ModRegistry); } }
public override void Entry(IModHelper helper) { Mod.Instance = this; Log.Monitor = this.Monitor; Mod.Config = this.Helper.ReadConfig <Configuration>(); this.LegacyDataMigrator = new(this.Monitor); helper.Events.GameLoop.GameLaunched += this.OnGameLaunched; helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded; helper.Events.GameLoop.DayStarted += this.OnDayStarted; helper.Events.GameLoop.Saving += this.OnSaving; Framework.Magic.Init(helper.Events, helper.Input, helper.Multiplayer.GetNewID); }
/********* ** 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) { I18n.Init(helper.Translation); Mod.Instance = this; Log.Monitor = this.Monitor; Mod.Config = this.Helper.ReadConfig <Configuration>(); this.LegacyDataMigrator = new(this.Monitor); helper.Events.GameLoop.GameLaunched += this.OnGameLaunched; helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded; helper.Events.GameLoop.DayStarted += this.OnDayStarted; helper.Events.GameLoop.Saving += this.OnSaving; helper.Events.GameLoop.UpdateTicked += this.OnUpdateTicked; Framework.Magic.Init(helper.Events, helper.Input, helper.ModRegistry, helper.Multiplayer.GetNewID); ConsoleCommandHelper.RegisterCommandsInAssembly(this); }
/********* ** Public methods *********/ /// <inheritdoc /> public override void Entry(IModHelper helper) { Mod.Instance = this; Log.Monitor = this.Monitor; this.LegayDataMigrator = new(helper.Data, this.Monitor); Command.Register("player_addmana", Mod.HandleAddManaCommand); Command.Register("player_setmaxmana", Mod.HandleSetMaxManaCommand); helper.Events.GameLoop.DayStarted += Mod.OnDayStarted; helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded; helper.Events.Display.RenderedHud += Mod.OnRenderedHud; Mod.ManaBg = helper.Content.Load <Texture2D>("assets/manabg.png"); Color manaCol = new Color(0, 48, 255); Mod.ManaFg = new Texture2D(Game1.graphics.GraphicsDevice, 1, 1); Mod.ManaFg.SetData(new[] { manaCol }); }
public override void Entry(IModHelper helper) { Mod.Instance = this; Log.Monitor = this.Monitor; Mod.Config = helper.ReadConfig <Configuration>(); this.HungerBar = helper.Content.Load <Texture2D>("assets/hungerbar.png"); this.LegacyDataMigrator = new LegacyDataMigrator(helper.Data, this.Monitor); helper.ConsoleCommands.Add("player_addfullness", "Add to your fullness", this.Commands); helper.Events.GameLoop.GameLaunched += this.OnGameLaunched; helper.Events.Display.RenderedHud += this.RenderHungerBar; SpaceEvents.AfterGiftGiven += this.OnGiftGiven; SpaceEvents.OnItemEaten += this.OnItemEaten; helper.Events.GameLoop.DayEnding += this.CheckFedSpouse; helper.Events.GameLoop.UpdateTicked += this.AfterTick; helper.Events.GameLoop.TimeChanged += this.TimeChanged; helper.Events.GameLoop.SaveLoaded += this.OnSaveLoaded; }