From bedbf679e6f74d43f5823141ab152c597eb74706 Mon Sep 17 00:00:00 2001 From: Huard Ouadi Date: Mon, 24 Jun 2019 15:59:29 +0200 Subject: [PATCH] v1.3.b13.a Fix MissingResourceException bug --- ConfigFile.cs | 4 ++-- UI/Stats.cs | 27 ++++++++++++++++++++++++--- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/ConfigFile.cs b/ConfigFile.cs index bcae03b..d35f9db 100644 --- a/ConfigFile.cs +++ b/ConfigFile.cs @@ -84,8 +84,8 @@ public override void OnChanged() AnotherRpgMod.visualConfig = this; if (AnotherRpgMod.Instance!= null) { AnotherRpgMod.Instance.healthBar.Reset(); - AnotherRpgMod.Instance.OpenST.OnInitialize(); - AnotherRpgMod.Instance.openStatMenu.OnInitialize(); + AnotherRpgMod.Instance.OpenST.Reset(); + AnotherRpgMod.Instance.openStatMenu.Reset(); } } } diff --git a/UI/Stats.cs b/UI/Stats.cs index e3b2a95..c04e39e 100644 --- a/UI/Stats.cs +++ b/UI/Stats.cs @@ -23,6 +23,7 @@ class OpenSTButton : UIState public float scale = Config.vConfig.HealthBarScale; public float yOffSet = Config.vConfig.HealthBarYoffSet; public bool hiden = false; + Texture2D Button; public void Erase() { @@ -48,6 +49,17 @@ public override void Update(GameTime gameTime) } public override void OnInitialize() + { + LoadTexture(); + Reset(); + } + + public void LoadTexture() + { + Button = ModContent.GetTexture("AnotherRpgMod/Textures/UI/skill_tree"); + } + + public void Reset() { Erase(); yOffSet = Config.vConfig.HealthBarYoffSet; @@ -62,7 +74,7 @@ public override void OnInitialize() OpenSTPanel.HAlign = 0; OpenSTPanel.VAlign = 0; - Texture2D Button = ModContent.GetTexture("AnotherRpgMod/Textures/UI/skill_tree"); + OpenStatButton OpenButton = new OpenStatButton(Button); OpenButton.Left.Set(0, 0f); OpenButton.Top.Set(0, 0f); @@ -94,7 +106,7 @@ class OpenStatsButton : UIState public UIElement OpenStatsPanel; public float scale = Config.vConfig.HealthBarScale; public float yOffSet = Config.vConfig.HealthBarYoffSet; - + Texture2D Button; public bool hiden = false; @@ -123,7 +135,17 @@ public override void Update(GameTime gameTime) public override void OnInitialize() { + LoadTexture(); + Reset(); + } + + public void LoadTexture() + { + Button = ModContent.GetTexture("AnotherRpgMod/Textures/UI/character"); + } + public void Reset() + { Erase(); yOffSet = Config.vConfig.HealthBarYoffSet; scale = Config.vConfig.HealthBarScale; @@ -137,7 +159,6 @@ public override void OnInitialize() OpenStatsPanel.HAlign = 0; OpenStatsPanel.VAlign = 0; - Texture2D Button = ModContent.GetTexture("AnotherRpgMod/Textures/UI/character"); OpenStatButton OpenButton = new OpenStatButton(Button); OpenButton.Left.Set(0, 0f); OpenButton.Top.Set(0, 0f);