From 2d0887223529ea4044615831845cc8734f070b25 Mon Sep 17 00:00:00 2001 From: Flowaria Date: Thu, 18 Dec 2025 21:24:54 +0900 Subject: [PATCH] Trigger Config SaveChanges only when it's actually changed --- UI/DraedonsArsenal/ChargeMeterUI.cs | 2 +- UI/FlightBar/FlightBar.cs | 2 +- UI/Rippers/RipperUI.cs | 4 ++-- UI/StealthUI.cs | 2 +- UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs | 2 +- UI/UnstableCastersGauntlet/VisUI.cs | 4 ++-- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/UI/DraedonsArsenal/ChargeMeterUI.cs b/UI/DraedonsArsenal/ChargeMeterUI.cs index df22dcd4cb..84f2a693e8 100644 --- a/UI/DraedonsArsenal/ChargeMeterUI.cs +++ b/UI/DraedonsArsenal/ChargeMeterUI.cs @@ -129,7 +129,7 @@ namespace CalamityMod.UI.DraedonsArsenal } // When the mouse is released, save the config and destroy the drag offset. - if (ms.LeftButton == ButtonState.Released) + if (dragOffset.HasValue && ms.LeftButton == ButtonState.Released) { dragOffset = null; CalamityClientConfig.Instance.SaveChanges(); diff --git a/UI/FlightBar/FlightBar.cs b/UI/FlightBar/FlightBar.cs index a788cd2913..6339989af1 100644 --- a/UI/FlightBar/FlightBar.cs +++ b/UI/FlightBar/FlightBar.cs @@ -171,7 +171,7 @@ namespace CalamityMod.UI } // When the mouse is released, save the config and destroy the drag offset. - if (ms.LeftButton == ButtonState.Released) + if (dragOffset.HasValue && ms.LeftButton == ButtonState.Released) { dragOffset = null; CalamityClientConfig.Instance.SaveChanges(); diff --git a/UI/Rippers/RipperUI.cs b/UI/Rippers/RipperUI.cs index f36c398ae7..0ecab2c12f 100644 --- a/UI/Rippers/RipperUI.cs +++ b/UI/Rippers/RipperUI.cs @@ -222,7 +222,7 @@ namespace CalamityMod.UI.Rippers } // When the mouse is released, save the config and destroy the drag offset. - if (ms.LeftButton == ButtonState.Released) + if (rageDragOffset.HasValue && ms.LeftButton == ButtonState.Released) { rageDragOffset = null; CalamityClientConfig.Instance.SaveChanges(); @@ -264,7 +264,7 @@ namespace CalamityMod.UI.Rippers } // When the mouse is released, save the config and destroy the drag offset. - if (ms.LeftButton == ButtonState.Released) + if (adrenDragOffset.HasValue && ms.LeftButton == ButtonState.Released) { adrenDragOffset = null; CalamityClientConfig.Instance.SaveChanges(); diff --git a/UI/StealthUI.cs b/UI/StealthUI.cs index 8d9f46f226..c672532e74 100644 --- a/UI/StealthUI.cs +++ b/UI/StealthUI.cs @@ -135,7 +135,7 @@ namespace CalamityMod.UI } // When the mouse is released, save the config and destroy the drag offset. - if (ms.LeftButton == ButtonState.Released) + if (dragOffset.HasValue && ms.LeftButton == ButtonState.Released) { dragOffset = null; CalamityClientConfig.Instance.SaveChanges(); diff --git a/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs b/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs index f6b1e35b38..924de8f7cb 100644 --- a/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs +++ b/UI/SulphurousWaterMeter/SulphurousWaterMeterUI.cs @@ -120,7 +120,7 @@ namespace CalamityMod.UI.SulphurousWaterMeter } // When the mouse is released, save the config and destroy the drag offset. - if (ms.LeftButton == ButtonState.Released) + if (dragOffset.HasValue && ms.LeftButton == ButtonState.Released) { dragOffset = null; CalamityClientConfig.Instance.SaveChanges(); diff --git a/UI/UnstableCastersGauntlet/VisUI.cs b/UI/UnstableCastersGauntlet/VisUI.cs index f70469d37f..33f697ee43 100644 --- a/UI/UnstableCastersGauntlet/VisUI.cs +++ b/UI/UnstableCastersGauntlet/VisUI.cs @@ -1,4 +1,5 @@ using System; +using CalamityMod.CalPlayer; using CalamityMod.Items.Weapons.Magic; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -6,7 +7,6 @@ using Microsoft.Xna.Framework.Input; using ReLogic.Content; using Terraria; using Terraria.ModLoader; -using CalamityMod.CalPlayer; namespace CalamityMod.UI.DraedonsArsenal { @@ -130,7 +130,7 @@ namespace CalamityMod.UI.DraedonsArsenal } // When the mouse is released, save the config and destroy the drag offset. - if (ms.LeftButton == ButtonState.Released) + if (dragOffset.HasValue && ms.LeftButton == ButtonState.Released) { dragOffset = null; CalamityClientConfig.Instance.SaveChanges();