Optimize config saving
This commit is contained in:
1 parent
38d0c7eaee
commit
ed4d8ed090
3 files changed
+10
-7
No files matched your search
+5
-3
@@ -51,17 +51,19 @@ namespace CalamityMod.UI
|
||||
|
||||
void SavePosition()
|
||||
{
|
||||
bool changed = false;
|
||||
if (CalamityConfig.Instance.ChargeMeterPosX != screenRatioPosition.X)
|
||||
{
|
||||
CalamityConfig.Instance.ChargeMeterPosX = screenRatioPosition.X;
|
||||
CalamityMod.SaveConfig(CalamityConfig.Instance);
|
||||
changed = true;
|
||||
}
|
||||
if (CalamityConfig.Instance.ChargeMeterPosY != screenRatioPosition.Y)
|
||||
{
|
||||
CalamityConfig.Instance.ChargeMeterPosY = screenRatioPosition.Y;
|
||||
CalamityMod.SaveConfig(CalamityConfig.Instance);
|
||||
changed = true;
|
||||
}
|
||||
return;
|
||||
if (changed)
|
||||
CalamityMod.SaveConfig(CalamityConfig.Instance);
|
||||
}
|
||||
|
||||
// If the Charge Meter is turned off or the player is not holding an item, stop.
|
||||
|
||||
+5
-3
@@ -55,17 +55,19 @@ namespace CalamityMod.UI
|
||||
// If not drawing the stealth meter, save its latest position to config and leave.
|
||||
if (modPlayer.stealthUIAlpha <= 0f || !CalamityConfig.Instance.StealthMeter || modPlayer.rogueStealthMax <= 0f || !modPlayer.wearingRogueArmor)
|
||||
{
|
||||
bool changed = false;
|
||||
if (CalamityConfig.Instance.StealthMeterPosX != screenRatioPosition.X)
|
||||
{
|
||||
CalamityConfig.Instance.StealthMeterPosX = screenRatioPosition.X;
|
||||
CalamityMod.SaveConfig(CalamityConfig.Instance);
|
||||
changed = true;
|
||||
}
|
||||
if (CalamityConfig.Instance.StealthMeterPosY != screenRatioPosition.Y)
|
||||
{
|
||||
CalamityConfig.Instance.StealthMeterPosY = screenRatioPosition.Y;
|
||||
CalamityMod.SaveConfig(CalamityConfig.Instance);
|
||||
changed = true;
|
||||
}
|
||||
return;
|
||||
if (changed)
|
||||
CalamityMod.SaveConfig(CalamityConfig.Instance);
|
||||
}
|
||||
|
||||
float offset = (edgeTexture.Width - barTexture.Width) * 0.5f;
|
||||
|
||||
@@ -535,7 +535,6 @@ namespace CalamityMod.World
|
||||
#endregion
|
||||
|
||||
#region Planetoid Lab
|
||||
|
||||
public static void FillPlanetoidLaboratoryChest(Chest chest, int type, bool hasPlacedLogAndSchematic)
|
||||
{
|
||||
int potionType = Utils.SelectRandom(WorldGen.genRand, ItemID.EndurancePotion, ItemID.GravitationPotion, ItemID.HeartreachPotion, ItemID.LifeforcePotion);
|
||||
|
||||
Reference in new issue
Block a user