Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
cadon committed Sep 10, 2024
2 parents b3e6e17 + fc25513 commit 150c58d
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 42 deletions.
26 changes: 13 additions & 13 deletions ARKBreedingStats/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions ARKBreedingStats/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public delegate void SetMessageLabelTextEventHandler(string text = null, Message
private static double[] _lastOcrValues;
private Species _lastOcrSpecies;

internal static readonly StatsOptionsSettings<StatLevelColors> StatsLevelColors = new StatsOptionsSettings<StatLevelColors>("statsLevelColors.json", "Level colors");
internal static readonly StatsOptionsSettings<ConsiderTopStats> StatsTopStats = new StatsOptionsSettings<ConsiderTopStats>("statsTopStats.json", "Consider for top stats");
internal static readonly StatsOptionsSettings<StatLevelColors> StatsOptionsLevelColors = new StatsOptionsSettings<StatLevelColors>("statsLevelColors.json", "Level colors");
internal static readonly StatsOptionsSettings<ConsiderTopStats> StatsOptionsConsiderTopStats = new StatsOptionsSettings<ConsiderTopStats>("statsTopStats.json", "Consider for top stats");

public Form1()
{
Expand Down Expand Up @@ -167,7 +167,7 @@ public Form1()
ocrControl1.OcrLabelSetsChanged += InitializeOcrLabelSets;
ocrControl1.OcrLabelSelectedSetChanged += SetCurrentOcrLabelSet;

StatsLevelColors.SettingsChanged += StatsLevelColors_SettingsChanged;
StatsOptionsLevelColors.SettingsChanged += StatsOptionsLevelColorsSettingsChanged;

openSettingsToolStripMenuItem.ShortcutKeyDisplayString = new KeysConverter()
.ConvertTo(Keys.Control, typeof(string))?.ToString().Replace("None", ",");
Expand Down Expand Up @@ -688,7 +688,7 @@ private void SpeciesSelector1OnSpeciesSelected(bool speciesChanged)
creatureInfoInputTester.SelectedSpecies = species;
radarChart1.SetLevels(species: species);
var statNames = species.statNames;
var levelGraphRepresentations = StatsLevelColors.GetStatsOptions(species);
var levelGraphRepresentations = StatsOptionsLevelColors.GetStatsOptions(species);

for (int s = 0; s < Stats.StatsCount; s++)
{
Expand Down Expand Up @@ -797,9 +797,9 @@ private void SpeciesSelector1OnSpeciesSelected(bool speciesChanged)
/// <summary>
/// Applies the level color settings to the stat controls. Call if a species setting was added or removed.
/// </summary>
private void StatsLevelColors_SettingsChanged()
private void StatsOptionsLevelColorsSettingsChanged()
{
var levelGraphRepresentations = StatsLevelColors.GetStatsOptions(speciesSelector1.SelectedSpecies);
var levelGraphRepresentations = StatsOptionsLevelColors.GetStatsOptions(speciesSelector1.SelectedSpecies);
if (levelGraphRepresentations == null) return;

for (int s = 0; s < Stats.StatsCount; s++)
Expand Down Expand Up @@ -1451,8 +1451,8 @@ private void SaveAppSettings()
/////// save settings for next session
Properties.Settings.Default.Save();

StatsLevelColors.SaveSettings();
StatsTopStats.SaveSettings();
StatsOptionsLevelColors.SaveSettings();
StatsOptionsConsiderTopStats.SaveSettings();
}

/// <summary>
Expand Down Expand Up @@ -2110,7 +2110,7 @@ private void OpenSettingsDialog(SettingsTabPages page = SettingsTabPages.Unknown
var gameSettingBefore = _creatureCollection.Game;
var displayLibraryCreatureIndexBefore = Properties.Settings.Default.DisplayLibraryCreatureIndex;

using (Settings settingsForm = new Settings(_creatureCollection, page, StatsLevelColors))
using (Settings settingsForm = new Settings(_creatureCollection, page))
{
var settingsSaved = settingsForm.ShowDialog() == DialogResult.OK;
_settingsLastTabPage = settingsForm.LastTabPageIndex;
Expand Down Expand Up @@ -3960,12 +3960,12 @@ private void showTokenPopupOnListeningToolStripMenuItem_Click(object sender, Eve

private void statsOptionsToolStripMenuItem_Click(object sender, EventArgs e)
{
StatsOptionsForm.ShowWindow(this, StatsLevelColors, StatsTopStats);
StatsOptionsForm.ShowWindow(this, StatsOptionsLevelColors, StatsOptionsConsiderTopStats);
}

private void ButtonOpenTopStatsSettingsClick(object sender, EventArgs e)
{
StatsOptionsForm.ShowWindow(this, StatsLevelColors, StatsTopStats, 1);
StatsOptionsForm.ShowWindow(this, StatsOptionsLevelColors, StatsOptionsConsiderTopStats, 1);
}

private void ExportAppSettings()
Expand Down Expand Up @@ -4049,7 +4049,7 @@ private void loadAppSettingsFromFileToolStripMenuItem_Click(object sender, Event

private void showStatsOptionsFileInExplorerToolStripMenuItem_Click(object sender, EventArgs e)
{
OpenFolderInExplorer(StatsLevelColors.SettingsFilePath);
OpenFolderInExplorer(StatsOptionsLevelColors.SettingsFilePath);
}
}
}
8 changes: 4 additions & 4 deletions ARKBreedingStats/Form1.library.cs
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ private void CalculateTopStats(List<Creature> creatures, Species onlySpecies = n
var lowestLevels = new int[Stats.StatsCount];
var highestMutationLevels = new int[Stats.StatsCount];
var lowestMutationLevels = new int[Stats.StatsCount];
var considerAsTopStat = StatsTopStats.GetStatsOptions(species).StatOptions;
var considerAsTopStat = StatsOptionsConsiderTopStats.GetStatsOptions(species).StatOptions;
var statWeights = breedingPlan1.StatWeighting.GetWeightingForSpecies(species);
for (int s = 0; s < Stats.StatsCount; s++)
{
Expand Down Expand Up @@ -576,7 +576,7 @@ private void CalculateTopStats(List<Creature> creatures, Species onlySpecies = n
continue;
if (!considerTopStats.TryGetValue(c.Species, out var consideredTopStats))
{
consideredTopStats = StatsTopStats.GetStatsOptions(c.Species).StatOptions.Select(si => si.ConsiderStat).ToArray();
consideredTopStats = StatsOptionsConsiderTopStats.GetStatsOptions(c.Species).StatOptions.Select(si => si.ConsiderStat).ToArray();
considerTopStats[c.Species] = consideredTopStats;
}
c.SetTopStatCount(consideredTopStats, considerWastedStatsForTopCreatures);
Expand Down Expand Up @@ -1124,8 +1124,8 @@ private ListViewItem CreateCreatureLvItem(Creature cr, bool displayIndex = false
// apply colors to the subItems
var displayZeroMutationLevels = Properties.Settings.Default.LibraryDisplayZeroMutationLevels;

var statOptionsColors = StatsLevelColors.GetStatsOptions(cr.Species).StatOptions;
var statOptionsTopStats = StatsTopStats.GetStatsOptions(cr.Species).StatOptions;
var statOptionsColors = StatsOptionsLevelColors.GetStatsOptions(cr.Species).StatOptions;
var statOptionsTopStats = StatsOptionsConsiderTopStats.GetStatsOptions(cr.Species).StatOptions;

for (int s = 0; s < Stats.StatsCount; s++)
{
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Pedigree/PedigreeCreature.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ public Creature Creature

_tt.SetToolTip(labelSex, "Sex: " + Loc.S(_creature.sex.ToString()));

var levelColorOptions = Form1.StatsLevelColors.GetStatsOptions(Creature.Species);
var levelColorOptions = Form1.StatsOptionsLevelColors.GetStatsOptions(Creature.Species);

for (int s = 0; s < DisplayedStatsCount; s++)
{
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
// Revision
//
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("0.63.1.1")]
[assembly: AssemblyFileVersion("0.63.1.2")]
[assembly: NeutralResourcesLanguage("en")]

8 changes: 7 additions & 1 deletion ARKBreedingStats/StatsOptions/StatsOptionsControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public StatsOptionsControl(StatsOptionsSettings<T> settings, ToolTip tt)

protected void InitializeControls(StatsOptionsSettings<T> settings, ToolTip tt)
{
if (settings == null) return;
StatsOptionsSettings = settings;
Tt = tt;

Expand Down Expand Up @@ -163,7 +164,7 @@ private void CbbOptions_SelectedIndexChanged(object sender, EventArgs e)
if (SelectedStatsOptions == null) return;

this.SuspendDrawing();
TbOptionsName.Text = SelectedStatsOptions.ToString();
TbOptionsName.Text = SelectedStatsOptions.Name;
var isNotRoot = SelectedStatsOptions.Name != string.Empty;
TbOptionsName.Enabled = isNotRoot;
LbParent.Visible = isNotRoot;
Expand Down Expand Up @@ -237,6 +238,11 @@ private void TbOptionsName_Leave(object sender, EventArgs e)
newName = newNameBase + "_" + ++suffix;

TbOptionsName.Text = newName;
if (SelectedStatsOptions.AffectedSpecies?.Any() != false)
{
SelectedStatsOptions.AffectedSpecies = new[] { newNameBase };
TbAffectedSpecies.Text = newNameBase;
}
StatsOptionsSettings.StatsOptionsDict.Remove(SelectedStatsOptions.Name);
SelectedStatsOptions.Name = newName;
StatsOptionsSettings.StatsOptionsDict.Add(newName, SelectedStatsOptions);
Expand Down
9 changes: 6 additions & 3 deletions ARKBreedingStats/StatsOptions/StatsOptionsForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@ public static void ShowWindow(Form parent,
Width = Properties.Settings.Default.LevelColorWindowRectangle.Width,
Height = Properties.Settings.Default.LevelColorWindowRectangle.Height,
StartPosition = FormStartPosition.Manual,
Location = new Point(Properties.Settings.Default.LevelColorWindowRectangle.X, Properties.Settings.Default.LevelColorWindowRectangle.Y)
Location = new Point(Properties.Settings.Default.LevelColorWindowRectangle.X, Properties.Settings.Default.LevelColorWindowRectangle.Y),
Text = "Stats options"
};

// stat settings tab
var tabs = new TabControl();
tabs.Dock = DockStyle.Fill;

AddAndDock(new LevelGraphOptionsControl(levelColorSettings, f.Tt), levelColorSettings.SettingsName);
AddAndDock(new ConsiderTopStatsControl(topStatsSettings, f.Tt), topStatsSettings.SettingsName);
if (levelColorSettings != null)
AddAndDock(new LevelGraphOptionsControl(levelColorSettings, f.Tt), levelColorSettings.SettingsName);
if (topStatsSettings != null)
AddAndDock(new ConsiderTopStatsControl(topStatsSettings, f.Tt), topStatsSettings.SettingsName);

void AddAndDock(Control c, string tabName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace ARKBreedingStats.StatsOptions.TopStatsSettings
/// Setting which stats are considered in top stats calculation.
/// </summary>
[JsonObject(MemberSerialization.OptIn)]
internal class ConsiderTopStats : StatOptionsBase
public class ConsiderTopStats : StatOptionsBase
{
[JsonProperty("top", DefaultValueHandling = DefaultValueHandling.Ignore)]
public bool ConsiderStat;
Expand Down
2 changes: 1 addition & 1 deletion ARKBreedingStats/_manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"ARK Smart Breeding": {
"Id": "ARK Smart Breeding",
"Category": "main",
"version": "0.63.1.1"
"version": "0.63.1.2"
},
"SpeciesColorImages": {
"Id": "SpeciesColorImages",
Expand Down
7 changes: 2 additions & 5 deletions ARKBreedingStats/settings/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,17 @@ public partial class Settings : Form
{
private MultiplierSetting[] _multSetter;
private readonly CreatureCollection _cc;
private readonly StatsOptionsSettings<StatLevelColors> _statsLevelColors;
private ToolTip _tt;
private Dictionary<string, string> _languages;
public SettingsTabPages LastTabPageIndex;
public bool LanguageChanged;
public bool ColorRegionDisplayChanged;
private CancellationTokenSource _cancellationTokenSource;

public Settings(CreatureCollection cc, SettingsTabPages page,
StatsOptionsSettings<StatLevelColors> statsLevelColors)
public Settings(CreatureCollection cc, SettingsTabPages page)
{
InitializeData();
_cc = cc;
_statsLevelColors = statsLevelColors;
CreateListOfProcesses();
LoadSettings(cc);
Localization();
Expand Down Expand Up @@ -1882,7 +1879,7 @@ private void BtnUpdateOfficialEventValues_Click(object sender, EventArgs e)

private void BtOpenLevelColorOptions_Click(object sender, EventArgs e)
{
StatsOptionsForm.ShowWindow(this, _statsLevelColors, null);
StatsOptionsForm.ShowWindow(this, Form1.StatsOptionsLevelColors, Form1.StatsOptionsConsiderTopStats);
}
}
}

0 comments on commit 150c58d

Please sign in to comment.