Skip to content

Commit

Permalink
preset for mutation colors
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Sep 8, 2024
1 parent b80b45f commit 31f7387
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ public override void PrepareForSaving()

public static StatLevelColors GetDefault() => new StatLevelColors
{
LevelGraphRepresentation = LevelGraphRepresentation.GetDefaultValue
LevelGraphRepresentation = LevelGraphRepresentation.GetDefaultValue,
LevelGraphRepresentationMutation = LevelGraphRepresentation.GetDefaultMutationLevelValue
};
}
}

0 comments on commit 31f7387

Please sign in to comment.