diff --git a/ARKBreedingStats/App.config b/ARKBreedingStats/App.config index 819bdad96..86a8e4344 100644 --- a/ARKBreedingStats/App.config +++ b/ARKBreedingStats/App.config @@ -463,6 +463,18 @@ False + + False + + + False + + + False + + + False + diff --git a/ARKBreedingStats/BreedingPlanning/BreedingPlan.cs b/ARKBreedingStats/BreedingPlanning/BreedingPlan.cs index 97ac771e3..ca9bffa5a 100644 --- a/ARKBreedingStats/BreedingPlanning/BreedingPlan.cs +++ b/ARKBreedingStats/BreedingPlanning/BreedingPlan.cs @@ -771,7 +771,7 @@ private void DetermineBestLevels(List creatures = null) /// If true, the display of the best species library will be updated, if false the best filtered species will be updated. private void SetBestLevels(int[] bestLevels, IEnumerable creatures, bool bestInSpecies) { - BreedingScore.SetBestLevels(creatures, bestLevels, _statWeights); + BreedingScore.SetBestLevels(creatures, bestLevels, _statWeights, CbConsiderOnlyEvenForHighStats.Checked); // display top levels in species int? levelStep = CreatureCollection.getWildLevelStep(); @@ -1181,6 +1181,7 @@ private void CbConsiderOnlyEvenForHighStats_CheckedChanged(object sender, EventA { Settings.Default.BreedingPlannerConsiderOnlyEvenForHighStats = CbConsiderOnlyEvenForHighStats.Checked; CalculateBreedingScoresAndDisplayPairs(); + DetermineBestLevels(); } private void CbDontSuggestOverLimitOffspring_CheckedChanged(object sender, EventArgs e) diff --git a/ARKBreedingStats/BreedingPlanning/BreedingScore.cs b/ARKBreedingStats/BreedingPlanning/BreedingScore.cs index 63f1d8da3..bac0e769b 100644 --- a/ARKBreedingStats/BreedingPlanning/BreedingScore.cs +++ b/ARKBreedingStats/BreedingPlanning/BreedingScore.cs @@ -207,7 +207,10 @@ public static List CalculateBreedingScores(Creature[] females, Cre return breedingPairs; } - public static void SetBestLevels(IEnumerable creatures, int[] bestLevels, double[] statWeights) + /// + /// Sets the best levels in the passed bestLevels array, depending on the statWeights and onlyHighEvenLevels. + /// + public static void SetBestLevels(IEnumerable creatures, int[] bestLevels, double[] statWeights, bool onlyHighEvenLevels) { for (int s = 0; s < Stats.StatsCount; s++) bestLevels[s] = -1; @@ -217,7 +220,10 @@ public static void SetBestLevels(IEnumerable creatures, int[] bestLeve for (int s = 0; s < Stats.StatsCount; s++) { if ((s == Stats.Torpidity || statWeights[s] >= 0) && c.levelsWild[s] > bestLevels[s]) - bestLevels[s] = c.levelsWild[s]; + { + if (!onlyHighEvenLevels || c.levelsWild[s] % 2 == 0) + bestLevels[s] = c.levelsWild[s]; + } else if (s != Stats.Torpidity && statWeights[s] < 0 && c.levelsWild[s] >= 0 && (c.levelsWild[s] < bestLevels[s] || bestLevels[s] < 0)) bestLevels[s] = c.levelsWild[s]; } diff --git a/ARKBreedingStats/Form1.collection.cs b/ARKBreedingStats/Form1.collection.cs index 425780872..9452db539 100644 --- a/ARKBreedingStats/Form1.collection.cs +++ b/ARKBreedingStats/Form1.collection.cs @@ -560,7 +560,7 @@ private bool LoadCollectionFile(string filePath, bool keepCurrentCreatures = fal FilterLibRecalculate(); // apply last sorting - //listViewLibrary.Sort(); // TODO + SortLibrary(); UpdateTempCreatureDropDown(); diff --git a/ARKBreedingStats/Form1.cs b/ARKBreedingStats/Form1.cs index aad896eed..8adb0c0c6 100644 --- a/ARKBreedingStats/Form1.cs +++ b/ARKBreedingStats/Form1.cs @@ -1351,7 +1351,7 @@ private void lbLibrarySelectionInfo_Click(object sender, EventArgs e) private void listBoxSpeciesLib_SelectedIndexChanged(object sender, EventArgs e) { SetSpecies(listBoxSpeciesLib.SelectedItem as Species); - FilterLibRecalculate(); + FilterLibRecalculate(true); } /// diff --git a/ARKBreedingStats/Form1.importExported.cs b/ARKBreedingStats/Form1.importExported.cs index 5c8ff2f88..034b7a7ae 100644 --- a/ARKBreedingStats/Form1.importExported.cs +++ b/ARKBreedingStats/Form1.importExported.cs @@ -73,21 +73,56 @@ private void ImportLastExportedCreature() if (Utils.GetFirstImportExportFolder(out string folder)) { var files = Directory.GetFiles(folder); - if (files.Length > 0) + if (files.Length == 0) { - ExtractExportedFileInExtractor(files.OrderByDescending(f => File.GetLastWriteTime(f)).First()); + // some users forget to select the id folder where the export files are located. Check if that's the case + FileInfo lastExportFile = null; + if (Path.GetFileName(folder) == "DinoExports") + { + // check subfolders for export files + var subFolders = Directory.GetDirectories(folder); + foreach (var sf in subFolders) + { + var d = new DirectoryInfo(sf); + var fs = d.GetFiles("*.ini"); + if (!fs.Any()) continue; + var expFile = fs.OrderByDescending(f => f.LastWriteTime).First(); + if (lastExportFile == null || expFile.LastWriteTime > lastExportFile.LastWriteTime) + lastExportFile = expFile; + } + } + + if (lastExportFile == null) + { + MessageBoxes.ShowMessageBox( + $"No exported creature-file found in the set folder\n{folder}\nYou have to export a creature first ingame.\n\n" + + "You may also want to check the set folder in the settings. Usually the folder path ends with\n" + + @"…\ARK\ShooterGame\Saved\DinoExports\", + $"No files found"); + return; + } + + if (MessageBox.Show( + $"No exported creature-file found in the set folder\n{folder}\n\nThere seems to be an export file in a subfolder, do you want to use this folder instead?\n{lastExportFile.DirectoryName}", + $"Use subfolder with export file? - {Utils.ApplicationNameVersion}", + MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) + { + var exportFolders = Properties.Settings.Default.ExportCreatureFolders; + var firstExportFolder = ATImportExportedFolderLocation.CreateFromString(exportFolders[0]); + firstExportFolder.FolderPath = lastExportFile.DirectoryName; + exportFolders[0] = firstExportFolder.ToString(); + + ExtractExportedFileInExtractor(lastExportFile.FullName); + } return; } - MessageBoxes.ShowMessageBox($"No exported creature-file found in the set folder\n{folder}\nYou have to export a creature first ingame.\n\n" + - "You may also want to check the set folder in the settings. Usually the folder is\n" + - @"…\Steam\steamapps\common\ARK\ShooterGame\Saved\DinoExports\", - $"No files found"); + ExtractExportedFileInExtractor(files.OrderByDescending(File.GetLastWriteTime).First()); return; } if (MessageBox.Show("There is no folder set where the exported creatures are located, or the set folder does not exist. Set this folder in the settings. " + - "Usually the folder is\n" + @"…\Steam\steamapps\common\ARK\ShooterGame\Saved\DinoExports\" + "\n\nOpen the settings-page?", + "Usually the folder path ends with\n" + @"…\ARK\ShooterGame\Saved\DinoExports\" + "\n\nOpen the settings-page?", $"No default export-folder set - {Utils.ApplicationNameVersion}", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes) { OpenSettingsDialog(Settings.SettingsTabPages.ExportedImport); diff --git a/ARKBreedingStats/Form1.library.cs b/ARKBreedingStats/Form1.library.cs index 3bde10296..6fd093690 100644 --- a/ARKBreedingStats/Form1.library.cs +++ b/ARKBreedingStats/Form1.library.cs @@ -756,7 +756,7 @@ private void UpdateIncubationParents(CreatureCollection cc) private void ShowCreaturesInListView(IEnumerable creatures) { listViewLibrary.BeginUpdate(); - _creaturesDisplayed = _creatureListSorter.DoSort(creatures.Where(cr => cr.Species != null)); + _creaturesDisplayed = _creatureListSorter.DoSort(creatures); listViewLibrary.VirtualListSize = _creaturesDisplayed.Length; _libraryListViewItemCache = null; listViewLibrary.EndUpdate(); @@ -828,7 +828,6 @@ private void ListViewLibrary_CacheVirtualItems(object sender, CacheVirtualItemsE /// private void UpdateDisplayedCreatureValues(Creature cr, bool creatureStatusChanged, bool ownerServerChanged) { - _reactOnCreatureSelectionChange = false; // if row is selected, save and reselect later var selectedCreatures = new HashSet(); foreach (int i in listViewLibrary.SelectedIndices) @@ -854,16 +853,28 @@ private void UpdateDisplayedCreatureValues(Creature cr, bool creatureStatusChang SetCollectionChanged(true, cr.Species); SelectCreaturesInLibrary(selectedCreatures); - - _reactOnCreatureSelectionChange = true; } - private void SelectCreaturesInLibrary(HashSet selectedCreatures) + /// + /// Selects the passed creatures in the library and sets _reactOnCreatureSelectionChange on true again. + /// + /// + private void SelectCreaturesInLibrary(HashSet selectedCreatures, bool selectFirstIfNothingIsSelected = false) { var selectedCount = selectedCreatures?.Count ?? 0; if (selectedCount == 0) { listViewLibrary.SelectedIndices.Clear(); + if (selectFirstIfNothingIsSelected && _creaturesDisplayed.Length != 0) + { + _reactOnCreatureSelectionChange = true; + listViewLibrary.SelectedIndices.Add(0); + listViewLibrary.EnsureVisible(0); + } + else + { + creatureBoxListView.Clear(); + } return; } @@ -871,11 +882,13 @@ private void SelectCreaturesInLibrary(HashSet selectedCreatures) listViewLibrary.SelectedIndices.Clear(); + var creatureSelected = false; // for loop is faster than foreach loop for small selected item amount, which is usually the case for (int i = 0; i < _creaturesDisplayed.Length; i++) { if (selectedCreatures.Contains(_creaturesDisplayed[i])) { + creatureSelected = true; if (--selectedCount == 0) { _reactOnCreatureSelectionChange = true; @@ -886,6 +899,22 @@ private void SelectCreaturesInLibrary(HashSet selectedCreatures) listViewLibrary.SelectedIndices.Add(i); } } + + if (!creatureSelected) + { + if (selectFirstIfNothingIsSelected && _creaturesDisplayed.Length != 0) + { + _reactOnCreatureSelectionChange = true; + listViewLibrary.SelectedIndices.Add(0); + listViewLibrary.EnsureVisible(0); + } + else + { + creatureBoxListView.Clear(); + } + } + + _reactOnCreatureSelectionChange = true; // make sure it reacts again even if the previously creature is not visible anymore } /// @@ -1145,6 +1174,9 @@ private void libraryListView_ColumnClick(object sender, ColumnClickEventArgs e) SortLibrary(e.Column); } + /// + /// /// Sort the library by given column index. If the columnIndex is -1, use last sorting. + /// private void SortLibrary(int columnIndex = -1) { listViewLibrary.BeginUpdate(); @@ -1219,17 +1251,17 @@ private void LibrarySelectedIndexChanged() /// Display the creatures with the current filter. /// Recalculate all filters. /// - private void FilterLibRecalculate() + private void FilterLibRecalculate(bool selectFirstIfNothingIsSelected = false) { _creaturesPreFiltered = null; - FilterLib(); + FilterLib(selectFirstIfNothingIsSelected); } /// /// Display the creatures with the current filter. /// Use the pre filtered list (if available) and only apply the live filter. /// - private void FilterLib() + private void FilterLib(bool selectFirstIfNothingIsSelected = false) { if (!_filterListAllowed) return; @@ -1244,7 +1276,7 @@ private void FilterLib() if (_creaturesPreFiltered == null) { filteredList = from creature in _creatureCollection.creatures - where !creature.flags.HasFlag(CreatureFlags.Placeholder) + where creature.Species != null && !creature.flags.HasFlag(CreatureFlags.Placeholder) select creature; // if only one species should be shown adjust headers if the selected species has custom statNames @@ -1376,7 +1408,7 @@ private void FilterLib() ShowCreaturesInListView(filteredList); // select previous selected creatures again - SelectCreaturesInLibrary(selectedCreatures); + SelectCreaturesInLibrary(selectedCreatures, selectFirstIfNothingIsSelected); } /// @@ -1399,6 +1431,15 @@ private IEnumerable ApplyLibraryFilterSettings(IEnumerable c if (Properties.Settings.Default.FilterOnlyIfColorId != 0) creatures = creatures.Where(c => c.colors.Contains(Properties.Settings.Default.FilterOnlyIfColorId)); + if (Properties.Settings.Default.FilterHideAdults) + creatures = creatures.Where(c => c.Maturation < 1); + if (Properties.Settings.Default.FilterHideNonAdults) + creatures = creatures.Where(c => c.Maturation >= 1); + if (Properties.Settings.Default.FilterHideCooldowns) + creatures = creatures.Where(c => c.cooldownUntil == null || c.cooldownUntil < DateTime.Now); + if (Properties.Settings.Default.FilterHideNonCooldowns) + creatures = creatures.Where(c => c.cooldownUntil != null && c.cooldownUntil > DateTime.Now); + // tags filter if (Properties.Settings.Default.FilterHideTags?.Any() ?? false) { @@ -1556,7 +1597,7 @@ private void ShowMultiSetter() private void ToolStripTextBoxLibraryFilter_TextChanged(object sender, EventArgs e) { - filterLibraryDebouncer.Debounce(ToolStripTextBoxLibraryFilter.Text == string.Empty ? 0 : 300, FilterLib, Dispatcher.CurrentDispatcher); + filterLibraryDebouncer.Debounce(ToolStripTextBoxLibraryFilter.Text == string.Empty ? 0 : 500, FilterLib, Dispatcher.CurrentDispatcher, false); } private void ToolStripButtonLibraryFilterClear_Click(object sender, EventArgs e) diff --git a/ARKBreedingStats/Program.cs b/ARKBreedingStats/Program.cs index e78165216..9f0ce24f2 100644 --- a/ARKBreedingStats/Program.cs +++ b/ARKBreedingStats/Program.cs @@ -13,7 +13,9 @@ static class Program static void Main() { AppDomain currentDomain = AppDomain.CurrentDomain; +#if !DEBUG currentDomain.UnhandledException += UnhandledExceptionHandler; +#endif Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); diff --git a/ARKBreedingStats/Properties/AssemblyInfo.cs b/ARKBreedingStats/Properties/AssemblyInfo.cs index 71f3c940b..45281f0c1 100644 --- a/ARKBreedingStats/Properties/AssemblyInfo.cs +++ b/ARKBreedingStats/Properties/AssemblyInfo.cs @@ -30,6 +30,6 @@ // Revision // [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("0.50.2.0")] +[assembly: AssemblyFileVersion("0.50.3.0")] [assembly: NeutralResourcesLanguage("en")] diff --git a/ARKBreedingStats/Properties/Settings.Designer.cs b/ARKBreedingStats/Properties/Settings.Designer.cs index 11f4d8a8c..fec0663f6 100644 --- a/ARKBreedingStats/Properties/Settings.Designer.cs +++ b/ARKBreedingStats/Properties/Settings.Designer.cs @@ -2075,5 +2075,53 @@ public bool UseTribeFilterForBreedingPlan { this["UseTribeFilterForBreedingPlan"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool FilterHideAdults { + get { + return ((bool)(this["FilterHideAdults"])); + } + set { + this["FilterHideAdults"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool FilterHideNonAdults { + get { + return ((bool)(this["FilterHideNonAdults"])); + } + set { + this["FilterHideNonAdults"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool FilterHideCooldowns { + get { + return ((bool)(this["FilterHideCooldowns"])); + } + set { + this["FilterHideCooldowns"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool FilterHideNonCooldowns { + get { + return ((bool)(this["FilterHideNonCooldowns"])); + } + set { + this["FilterHideNonCooldowns"] = value; + } + } } } diff --git a/ARKBreedingStats/Properties/Settings.settings b/ARKBreedingStats/Properties/Settings.settings index 4073c4d9b..fc7e6f1b7 100644 --- a/ARKBreedingStats/Properties/Settings.settings +++ b/ARKBreedingStats/Properties/Settings.settings @@ -521,5 +521,17 @@ False + + False + + + False + + + False + + + False + \ No newline at end of file diff --git a/ARKBreedingStats/_manifest.json b/ARKBreedingStats/_manifest.json index 42bfe0b04..6a7ef5d3a 100644 --- a/ARKBreedingStats/_manifest.json +++ b/ARKBreedingStats/_manifest.json @@ -4,7 +4,7 @@ "ARK Smart Breeding": { "Id": "ARK Smart Breeding", "Category": "main", - "version": "0.50.2.0" + "version": "0.50.3.0" }, "SpeciesColorImages": { "Id": "SpeciesColorImages", diff --git a/ARKBreedingStats/library/DummyCreatures.cs b/ARKBreedingStats/library/DummyCreatures.cs index 0ccb4891d..91c29501b 100644 --- a/ARKBreedingStats/library/DummyCreatures.cs +++ b/ARKBreedingStats/library/DummyCreatures.cs @@ -202,7 +202,7 @@ private static List BreedCreatures(Creature[] creatures, Species speci allCreatures.AddRange(femalesMales[Sex.Male]); } - BreedingScore.SetBestLevels(allCreatures, bestLevels, statWeights); + BreedingScore.SetBestLevels(allCreatures, bestLevels, statWeights, true); var allCreaturesArray = noGender ? allCreatures.ToArray() : null; var pairs = BreedingScore.CalculateBreedingScores(noGender ? allCreaturesArray : femalesMales[Sex.Female].ToArray(), diff --git a/ARKBreedingStats/ocr/OCRControl.cs b/ARKBreedingStats/ocr/OCRControl.cs index e538bbbb9..944674451 100644 --- a/ARKBreedingStats/ocr/OCRControl.cs +++ b/ARKBreedingStats/ocr/OCRControl.cs @@ -269,9 +269,8 @@ internal void DisplayBmpInOcrControl(Bitmap bmp) _screenshot = bmp; } - private void RedrawScreenshot(object ob) + private void RedrawScreenshot((int, bool, int, Rectangle) args) { - var args = ((int, bool, int, Rectangle))ob; RedrawScreenshot(args.Item1, args.Item2, args.Item3, args.Item4); } diff --git a/ARKBreedingStats/settings/ATImportExportedFolderLocation.cs b/ARKBreedingStats/settings/ATImportExportedFolderLocation.cs index 0f5d39d10..3540d5da8 100644 --- a/ARKBreedingStats/settings/ATImportExportedFolderLocation.cs +++ b/ARKBreedingStats/settings/ATImportExportedFolderLocation.cs @@ -26,6 +26,9 @@ public static ATImportExportedFolderLocation CreateFromString(string path) new ATImportExportedFolderLocation(path, string.Empty, path); } + /// + /// String representation of this export folder, used to save it. + /// public override string ToString() => $"{ConvenientName}|{OwnerSuffix}|{FolderPath}"; } } diff --git a/ARKBreedingStats/uiControls/LibraryFilter.Designer.cs b/ARKBreedingStats/uiControls/LibraryFilter.Designer.cs index 467d5deff..192abe0db 100644 --- a/ARKBreedingStats/uiControls/LibraryFilter.Designer.cs +++ b/ARKBreedingStats/uiControls/LibraryFilter.Designer.cs @@ -53,6 +53,9 @@ private void InitializeComponent() this.CbUseFilterInTopStatCalculation = new System.Windows.Forms.CheckBox(); this.BtApply = new System.Windows.Forms.Button(); this.BtCancel = new System.Windows.Forms.Button(); + this.LbMaturation = new System.Windows.Forms.Label(); + this.ClbMaturationFilters = new System.Windows.Forms.CheckedListBox(); + this.CbMaturationAll = new System.Windows.Forms.CheckBox(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.flowLayoutPanel1.SuspendLayout(); @@ -72,18 +75,21 @@ private void InitializeComponent() this.tableLayoutPanel1.RowCount = 2; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.Size = new System.Drawing.Size(800, 450); + this.tableLayoutPanel1.Size = new System.Drawing.Size(874, 450); this.tableLayoutPanel1.TabIndex = 0; // // tableLayoutPanel2 // - this.tableLayoutPanel2.ColumnCount = 6; + this.tableLayoutPanel2.ColumnCount = 7; this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F)); this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 110F)); this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 112F)); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 110F)); + this.tableLayoutPanel2.Controls.Add(this.CbMaturationAll, 6, 1); + this.tableLayoutPanel2.Controls.Add(this.LbMaturation, 6, 0); this.tableLayoutPanel2.Controls.Add(this.CbTagsAll, 3, 1); this.tableLayoutPanel2.Controls.Add(this.CbServersAll, 2, 1); this.tableLayoutPanel2.Controls.Add(this.CbTribesAll, 1, 1); @@ -102,6 +108,7 @@ private void InitializeComponent() this.tableLayoutPanel2.Controls.Add(this.flowLayoutPanel1, 5, 2); this.tableLayoutPanel2.Controls.Add(this.BtClearColorFilters, 5, 1); this.tableLayoutPanel2.Controls.Add(this.BtClearFlagFilter, 4, 1); + this.tableLayoutPanel2.Controls.Add(this.ClbMaturationFilters, 6, 2); this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel2.Location = new System.Drawing.Point(2, 2); this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); @@ -111,13 +118,13 @@ private void InitializeComponent() this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(796, 408); + this.tableLayoutPanel2.Size = new System.Drawing.Size(870, 408); this.tableLayoutPanel2.TabIndex = 3; // // CbTagsAll // this.CbTagsAll.AutoSize = true; - this.CbTagsAll.Location = new System.Drawing.Point(432, 19); + this.CbTagsAll.Location = new System.Drawing.Point(405, 19); this.CbTagsAll.Name = "CbTagsAll"; this.CbTagsAll.Size = new System.Drawing.Size(36, 17); this.CbTagsAll.TabIndex = 12; @@ -128,7 +135,7 @@ private void InitializeComponent() // CbServersAll // this.CbServersAll.AutoSize = true; - this.CbServersAll.Location = new System.Drawing.Point(290, 19); + this.CbServersAll.Location = new System.Drawing.Point(272, 19); this.CbServersAll.Name = "CbServersAll"; this.CbServersAll.Size = new System.Drawing.Size(36, 17); this.CbServersAll.TabIndex = 11; @@ -139,7 +146,7 @@ private void InitializeComponent() // CbTribesAll // this.CbTribesAll.AutoSize = true; - this.CbTribesAll.Location = new System.Drawing.Point(148, 19); + this.CbTribesAll.Location = new System.Drawing.Point(139, 19); this.CbTribesAll.Name = "CbTribesAll"; this.CbTribesAll.Size = new System.Drawing.Size(36, 17); this.CbTribesAll.TabIndex = 10; @@ -152,7 +159,7 @@ private void InitializeComponent() this.LbStatus.Anchor = System.Windows.Forms.AnchorStyles.None; this.LbStatus.AutoSize = true; this.LbStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.LbStatus.Location = new System.Drawing.Point(616, 3); + this.LbStatus.Location = new System.Drawing.Point(580, 3); this.LbStatus.Name = "LbStatus"; this.LbStatus.Size = new System.Drawing.Size(19, 13); this.LbStatus.TabIndex = 8; @@ -163,7 +170,7 @@ private void InitializeComponent() this.LbTags.Anchor = System.Windows.Forms.AnchorStyles.None; this.LbTags.AutoSize = true; this.LbTags.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.LbTags.Location = new System.Drawing.Point(494, 3); + this.LbTags.Location = new System.Drawing.Point(463, 3); this.LbTags.Name = "LbTags"; this.LbTags.Size = new System.Drawing.Size(11, 13); this.LbTags.TabIndex = 7; @@ -174,7 +181,7 @@ private void InitializeComponent() this.LbServers.Anchor = System.Windows.Forms.AnchorStyles.None; this.LbServers.AutoSize = true; this.LbServers.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.LbServers.Location = new System.Drawing.Point(349, 3); + this.LbServers.Location = new System.Drawing.Point(327, 3); this.LbServers.Name = "LbServers"; this.LbServers.Size = new System.Drawing.Size(17, 13); this.LbServers.TabIndex = 6; @@ -185,7 +192,7 @@ private void InitializeComponent() this.LbTribes.Anchor = System.Windows.Forms.AnchorStyles.None; this.LbTribes.AutoSize = true; this.LbTribes.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.LbTribes.Location = new System.Drawing.Point(208, 3); + this.LbTribes.Location = new System.Drawing.Point(195, 3); this.LbTribes.Name = "LbTribes"; this.LbTribes.Size = new System.Drawing.Size(15, 13); this.LbTribes.TabIndex = 5; @@ -196,9 +203,9 @@ private void InitializeComponent() this.ClbTags.CheckOnClick = true; this.ClbTags.Dock = System.Windows.Forms.DockStyle.Fill; this.ClbTags.FormattingEnabled = true; - this.ClbTags.Location = new System.Drawing.Point(432, 48); + this.ClbTags.Location = new System.Drawing.Point(405, 48); this.ClbTags.Name = "ClbTags"; - this.ClbTags.Size = new System.Drawing.Size(136, 354); + this.ClbTags.Size = new System.Drawing.Size(127, 354); this.ClbTags.TabIndex = 3; // // ClbServers @@ -206,9 +213,9 @@ private void InitializeComponent() this.ClbServers.CheckOnClick = true; this.ClbServers.Dock = System.Windows.Forms.DockStyle.Fill; this.ClbServers.FormattingEnabled = true; - this.ClbServers.Location = new System.Drawing.Point(290, 48); + this.ClbServers.Location = new System.Drawing.Point(272, 48); this.ClbServers.Name = "ClbServers"; - this.ClbServers.Size = new System.Drawing.Size(136, 354); + this.ClbServers.Size = new System.Drawing.Size(127, 354); this.ClbServers.TabIndex = 2; // // ClbTribes @@ -216,9 +223,9 @@ private void InitializeComponent() this.ClbTribes.CheckOnClick = true; this.ClbTribes.Dock = System.Windows.Forms.DockStyle.Fill; this.ClbTribes.FormattingEnabled = true; - this.ClbTribes.Location = new System.Drawing.Point(148, 48); + this.ClbTribes.Location = new System.Drawing.Point(139, 48); this.ClbTribes.Name = "ClbTribes"; - this.ClbTribes.Size = new System.Drawing.Size(136, 354); + this.ClbTribes.Size = new System.Drawing.Size(127, 354); this.ClbTribes.TabIndex = 1; // // ClbOwners @@ -228,7 +235,7 @@ private void InitializeComponent() this.ClbOwners.FormattingEnabled = true; this.ClbOwners.Location = new System.Drawing.Point(6, 48); this.ClbOwners.Name = "ClbOwners"; - this.ClbOwners.Size = new System.Drawing.Size(136, 354); + this.ClbOwners.Size = new System.Drawing.Size(127, 354); this.ClbOwners.TabIndex = 0; // // LbOwners @@ -236,7 +243,7 @@ private void InitializeComponent() this.LbOwners.Anchor = System.Windows.Forms.AnchorStyles.None; this.LbOwners.AutoSize = true; this.LbOwners.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.LbOwners.Location = new System.Drawing.Point(50, 3); + this.LbOwners.Location = new System.Drawing.Point(46, 3); this.LbOwners.Name = "LbOwners"; this.LbOwners.Size = new System.Drawing.Size(47, 13); this.LbOwners.TabIndex = 4; @@ -256,7 +263,7 @@ private void InitializeComponent() // FlpStatus // this.FlpStatus.Dock = System.Windows.Forms.DockStyle.Fill; - this.FlpStatus.Location = new System.Drawing.Point(574, 48); + this.FlpStatus.Location = new System.Drawing.Point(538, 48); this.FlpStatus.Name = "FlpStatus"; this.FlpStatus.Size = new System.Drawing.Size(104, 354); this.FlpStatus.TabIndex = 14; @@ -266,7 +273,7 @@ private void InitializeComponent() this.LbColors.Anchor = System.Windows.Forms.AnchorStyles.None; this.LbColors.AutoSize = true; this.LbColors.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.LbColors.Location = new System.Drawing.Point(728, 3); + this.LbColors.Location = new System.Drawing.Point(692, 3); this.LbColors.Name = "LbColors"; this.LbColors.Size = new System.Drawing.Size(18, 13); this.LbColors.TabIndex = 15; @@ -276,7 +283,7 @@ private void InitializeComponent() // this.flowLayoutPanel1.Controls.Add(this.BtColorFilter); this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.flowLayoutPanel1.Location = new System.Drawing.Point(684, 48); + this.flowLayoutPanel1.Location = new System.Drawing.Point(648, 48); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; this.flowLayoutPanel1.Size = new System.Drawing.Size(106, 354); this.flowLayoutPanel1.TabIndex = 16; @@ -294,7 +301,7 @@ private void InitializeComponent() // BtClearColorFilters // this.BtClearColorFilters.Dock = System.Windows.Forms.DockStyle.Fill; - this.BtClearColorFilters.Location = new System.Drawing.Point(684, 19); + this.BtClearColorFilters.Location = new System.Drawing.Point(648, 19); this.BtClearColorFilters.Name = "BtClearColorFilters"; this.BtClearColorFilters.Size = new System.Drawing.Size(106, 23); this.BtClearColorFilters.TabIndex = 17; @@ -305,7 +312,7 @@ private void InitializeComponent() // BtClearFlagFilter // this.BtClearFlagFilter.Dock = System.Windows.Forms.DockStyle.Fill; - this.BtClearFlagFilter.Location = new System.Drawing.Point(574, 19); + this.BtClearFlagFilter.Location = new System.Drawing.Point(538, 19); this.BtClearFlagFilter.Name = "BtClearFlagFilter"; this.BtClearFlagFilter.Size = new System.Drawing.Size(104, 23); this.BtClearFlagFilter.TabIndex = 18; @@ -321,7 +328,7 @@ private void InitializeComponent() this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(5, 415); this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(790, 30); + this.panel1.Size = new System.Drawing.Size(864, 30); this.panel1.TabIndex = 4; // // CbUseFilterInTopStatCalculation @@ -339,7 +346,7 @@ private void InitializeComponent() // this.BtApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.BtApply.DialogResult = System.Windows.Forms.DialogResult.OK; - this.BtApply.Location = new System.Drawing.Point(708, 0); + this.BtApply.Location = new System.Drawing.Point(782, 0); this.BtApply.Name = "BtApply"; this.BtApply.Size = new System.Drawing.Size(75, 23); this.BtApply.TabIndex = 0; @@ -351,13 +358,45 @@ private void InitializeComponent() // this.BtCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.BtCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.BtCancel.Location = new System.Drawing.Point(627, 0); + this.BtCancel.Location = new System.Drawing.Point(701, 0); this.BtCancel.Name = "BtCancel"; this.BtCancel.Size = new System.Drawing.Size(75, 23); this.BtCancel.TabIndex = 1; this.BtCancel.Text = "Cancel"; this.BtCancel.UseVisualStyleBackColor = true; // + // LbMaturation + // + this.LbMaturation.Anchor = System.Windows.Forms.AnchorStyles.None; + this.LbMaturation.AutoSize = true; + this.LbMaturation.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.LbMaturation.Location = new System.Drawing.Point(778, 3); + this.LbMaturation.Name = "LbMaturation"; + this.LbMaturation.Size = new System.Drawing.Size(67, 13); + this.LbMaturation.TabIndex = 19; + this.LbMaturation.Text = "Maturation"; + // + // ClbMaturationFilters + // + this.ClbMaturationFilters.CheckOnClick = true; + this.ClbMaturationFilters.Dock = System.Windows.Forms.DockStyle.Fill; + this.ClbMaturationFilters.FormattingEnabled = true; + this.ClbMaturationFilters.Location = new System.Drawing.Point(760, 48); + this.ClbMaturationFilters.Name = "ClbMaturationFilters"; + this.ClbMaturationFilters.Size = new System.Drawing.Size(104, 354); + this.ClbMaturationFilters.TabIndex = 20; + // + // CbMaturationAll + // + this.CbMaturationAll.AutoSize = true; + this.CbMaturationAll.Location = new System.Drawing.Point(760, 19); + this.CbMaturationAll.Name = "CbMaturationAll"; + this.CbMaturationAll.Size = new System.Drawing.Size(36, 17); + this.CbMaturationAll.TabIndex = 21; + this.CbMaturationAll.Text = "all"; + this.CbMaturationAll.UseVisualStyleBackColor = true; + this.CbMaturationAll.CheckedChanged += new System.EventHandler(this.CbMaturationAll_CheckedChanged); + // // LibraryFilter // this.AcceptButton = this.BtApply; @@ -365,7 +404,7 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScroll = true; this.CancelButton = this.BtCancel; - this.ClientSize = new System.Drawing.Size(800, 450); + this.ClientSize = new System.Drawing.Size(874, 450); this.Controls.Add(this.tableLayoutPanel1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow; this.Name = "LibraryFilter"; @@ -408,5 +447,8 @@ private void InitializeComponent() private System.Windows.Forms.Button BtColorFilter; private System.Windows.Forms.Button BtClearColorFilters; private System.Windows.Forms.Button BtClearFlagFilter; + private System.Windows.Forms.Label LbMaturation; + private System.Windows.Forms.CheckedListBox ClbMaturationFilters; + private System.Windows.Forms.CheckBox CbMaturationAll; } } \ No newline at end of file diff --git a/ARKBreedingStats/uiControls/LibraryFilter.cs b/ARKBreedingStats/uiControls/LibraryFilter.cs index 743d89c61..d9f9b9998 100644 --- a/ARKBreedingStats/uiControls/LibraryFilter.cs +++ b/ARKBreedingStats/uiControls/LibraryFilter.cs @@ -16,6 +16,13 @@ public partial class LibraryFilter : Form private List private SortOrder _lastOrder; - + + /// + /// Sort list by given column index. If the columnIndex is -1, use last sorting. + /// public Creature[] DoSort(IEnumerable list, int columnIndex = -1) { if (list == null) return null; diff --git a/ARKBreedingStats/utils/Debouncer.cs b/ARKBreedingStats/utils/Debouncer.cs index 006a2bfdd..e67eeca28 100644 --- a/ARKBreedingStats/utils/Debouncer.cs +++ b/ARKBreedingStats/utils/Debouncer.cs @@ -10,6 +10,7 @@ namespace ARKBreedingStats.utils public class Debouncer { private Timer _timer; + private Type _argsType; /// /// Call to debounce the action with the given interval. @@ -48,7 +49,7 @@ public void Debounce(int interval, Action action, Dispatcher dispatcher) /// Action to perform after interval elapsed without another debounce call /// Dispatcher to use, usually the one of the UI thread /// Arguments for the action - public void Debounce(int interval, Action action, Dispatcher dispatcher, object args) + public void Debounce(int interval, Action action, Dispatcher dispatcher, T args) { _timer?.Stop(); if (interval <= 0)