Trigger Config SaveChanges only when it's actually changed

This commit is contained in:
Flowaria committed 2025-12-18 21:24:54 +09:00
1 parent a4236508a2
commit 2d08872235
6 files changed
+8 -8

No files matched your search

+1 -1
View File
@@ -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();
+1 -1
View File
@@ -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();
+2 -2
View File
@@ -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();
+1 -1
View File
@@ -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();
@@ -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();
+2 -2
View File
@@ -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();