From 31f73875228853de64e36f9ff47fe011fe17c472 Mon Sep 17 00:00:00 2001 From: cadon Date: Sun, 8 Sep 2024 15:00:08 +0200 Subject: [PATCH] preset for mutation colors --- .../LevelColorSettings/HueControl.cs | 9 ++++-- .../LevelGraphOptionsControl.cs | 2 +- .../LevelGraphRepresentation.cs | 32 +++++++++++++++++++ .../LevelColorSettings/StatLevelColors.cs | 3 +- 4 files changed, 41 insertions(+), 5 deletions(-) diff --git a/ARKBreedingStats/StatsOptions/LevelColorSettings/HueControl.cs b/ARKBreedingStats/StatsOptions/LevelColorSettings/HueControl.cs index ad1001a4..dbf55844 100644 --- a/ARKBreedingStats/StatsOptions/LevelColorSettings/HueControl.cs +++ b/ARKBreedingStats/StatsOptions/LevelColorSettings/HueControl.cs @@ -214,9 +214,12 @@ private void UpdateLevelRepresentation(int dx, int dy) private void ResetColors() { - var defaultSettings = LevelGraphRepresentation.GetDefaultValue; - SetColor(defaultSettings.LowerColor, false, BtColorLow); - SetColor(defaultSettings.UpperColor, true, BtColorHigh); + var newSettings = LevelGraphRepresentation.GetDefaultValue; + if (newSettings == LevelGraphRepresentation) + newSettings = LevelGraphRepresentation.GetDefaultMutationLevelValue; + + SetColor(newSettings.LowerColor, false, BtColorLow); + SetColor(newSettings.UpperColor, true, BtColorHigh); } } } diff --git a/ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphOptionsControl.cs b/ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphOptionsControl.cs index b1871d62..17f350c8 100644 --- a/ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphOptionsControl.cs +++ b/ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphOptionsControl.cs @@ -22,7 +22,7 @@ protected override void InitializeStatControls() { Text = @"Drag color gradient with mouse for fast editing. On color gradients use shift + right click to copy and shift + left click to paste color settings. -Ctrl + left click to reset colors.", +Ctrl + left click to cycle through presets.", AutoSize = true }); } diff --git a/ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphRepresentation.cs b/ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphRepresentation.cs index 981c28ce..d46fe6fc 100644 --- a/ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphRepresentation.cs +++ b/ARKBreedingStats/StatsOptions/LevelColorSettings/LevelGraphRepresentation.cs @@ -145,6 +145,15 @@ public static Color GetStatLevelColor(int level, int statIndex) => UpperColor = Color.FromArgb(0, 255, 0) }; + public static LevelGraphRepresentation GetDefaultMutationLevelValue => new LevelGraphRepresentation + { + //ColorGradientReversed = true, + LowerBound = 0, + UpperBound = 255, + LowerColor = Color.Cyan, + UpperColor = Color.DeepPink + }; + public LevelGraphRepresentation Copy() => new LevelGraphRepresentation { @@ -154,5 +163,28 @@ public LevelGraphRepresentation Copy() => UpperColor = UpperColor, ColorGradientReversed = ColorGradientReversed }; + + public static bool operator ==(LevelGraphRepresentation a, LevelGraphRepresentation b) + { + if (ReferenceEquals(a, b)) return true; + if (ReferenceEquals(a, null)) return false; + if (ReferenceEquals(b, null)) return false; + return a.Equals(b); + } + + public static bool operator !=(LevelGraphRepresentation a, LevelGraphRepresentation b) => !(a == b); + + public bool Equals(LevelGraphRepresentation oth) + { + if (ReferenceEquals(oth, null)) return false; + if (ReferenceEquals(this, oth)) return true; + return oth.LowerBound == LowerBound + && oth.UpperBound == UpperBound + && oth.ColorGradientReversed == ColorGradientReversed + && oth.LowerColor == LowerColor + && oth.UpperColor == UpperColor; + } + + public override int GetHashCode() => $"{LowerBound}-{UpperBound}_{LowerColor}-{UpperColor}_{ColorGradientReversed}".GetHashCode(); } } diff --git a/ARKBreedingStats/StatsOptions/LevelColorSettings/StatLevelColors.cs b/ARKBreedingStats/StatsOptions/LevelColorSettings/StatLevelColors.cs index 3075cba8..2a46f5c5 100644 --- a/ARKBreedingStats/StatsOptions/LevelColorSettings/StatLevelColors.cs +++ b/ARKBreedingStats/StatsOptions/LevelColorSettings/StatLevelColors.cs @@ -104,7 +104,8 @@ public override void PrepareForSaving() public static StatLevelColors GetDefault() => new StatLevelColors { - LevelGraphRepresentation = LevelGraphRepresentation.GetDefaultValue + LevelGraphRepresentation = LevelGraphRepresentation.GetDefaultValue, + LevelGraphRepresentationMutation = LevelGraphRepresentation.GetDefaultMutationLevelValue }; } }