From 2bbd240a5d4c20137a4793406852d8365afceb35 Mon Sep 17 00:00:00 2001 From: MyAngelKamikaze Date: Tue, 17 Dec 2024 15:08:21 +0900 Subject: [PATCH] add monthly expedition filter (fixes #519) --- Browser/Browser.csproj | 2 +- ...ElectronicObserver.Avalonia.Samples.csproj | 1 + .../ElectronicObserver.Avalonia.csproj | 3 +- .../ExpeditionCalculator/Expedition.cs | 1 + .../ExpeditionCalculatorData.cs | 61 +++++++++++++++++++ .../ExpeditionCalculatorResources.en.resx | 3 + .../ExpeditionCalculatorResources.resx | 3 + .../ExpeditionCalculatorView.axaml | 16 +++-- .../ExpeditionCalculatorViewModel.cs | 29 +++++++-- .../ExpeditionScoreWeights.cs | 24 ++++---- .../ExpeditionViewModel.cs | 4 +- .../FleetInfoViewModel.cs | 8 +-- .../ShipGroup/DataGridSettingsModel.cs | 4 +- .../ShipGroup/ShipGroupItem.cs | 8 +-- .../ShipGroup/ShipGroupViewModel.cs | 30 ++++----- ElectronicObserver/ElectronicObserver.csproj | 2 +- .../ElectronicObserverCoreTests.csproj | 1 + KancolleProgress/KancolleProgress.csproj | 2 +- 18 files changed, 151 insertions(+), 51 deletions(-) diff --git a/Browser/Browser.csproj b/Browser/Browser.csproj index 69cd6b660..84a9e5765 100644 --- a/Browser/Browser.csproj +++ b/Browser/Browser.csproj @@ -40,7 +40,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/ElectronicObserver.Avalonia.Samples/ElectronicObserver.Avalonia.Samples.csproj b/ElectronicObserver.Avalonia.Samples/ElectronicObserver.Avalonia.Samples.csproj index e4ba5bfba..2746dfa87 100644 --- a/ElectronicObserver.Avalonia.Samples/ElectronicObserver.Avalonia.Samples.csproj +++ b/ElectronicObserver.Avalonia.Samples/ElectronicObserver.Avalonia.Samples.csproj @@ -23,6 +23,7 @@ + diff --git a/ElectronicObserver.Avalonia/ElectronicObserver.Avalonia.csproj b/ElectronicObserver.Avalonia/ElectronicObserver.Avalonia.csproj index 28e2a6d59..8689fa568 100644 --- a/ElectronicObserver.Avalonia/ElectronicObserver.Avalonia.csproj +++ b/ElectronicObserver.Avalonia/ElectronicObserver.Avalonia.csproj @@ -5,6 +5,7 @@ net8.0 enable enable + preview true @@ -28,7 +29,7 @@ - + diff --git a/ElectronicObserver.Avalonia/ExpeditionCalculator/Expedition.cs b/ElectronicObserver.Avalonia/ExpeditionCalculator/Expedition.cs index 64b99a148..1bd11a5cf 100644 --- a/ElectronicObserver.Avalonia/ExpeditionCalculator/Expedition.cs +++ b/ElectronicObserver.Avalonia/ExpeditionCalculator/Expedition.cs @@ -5,6 +5,7 @@ public class Expedition public required int Id { get; init; } public required string DisplayId { get; init; } public required GreatSuccessType GreatSuccessType { get; init; } + public required bool IsMonthly { get; init; } public required TimeSpan Duration { get; init; } diff --git a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorData.cs b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorData.cs index 7cd523b18..bf427243c 100644 --- a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorData.cs +++ b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorData.cs @@ -11,6 +11,7 @@ public static class ExpeditionCalculatorData Id = 1, DisplayId = "01", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(00, 15, 00), Ammo = 30, }, @@ -19,6 +20,7 @@ public static class ExpeditionCalculatorData Id = 2, DisplayId = "02", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(00, 30, 00), Ammo = 100, Steel = 30, @@ -33,6 +35,7 @@ public static class ExpeditionCalculatorData Id = 3, DisplayId = "03", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(00, 20, 00), Fuel = 30, Ammo = 30, @@ -43,6 +46,7 @@ public static class ExpeditionCalculatorData Id = 4, DisplayId = "04", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(00, 50, 00), Ammo = 70, Item1 = new() @@ -61,6 +65,7 @@ public static class ExpeditionCalculatorData Id = 5, DisplayId = "05", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(01, 30, 00), Fuel = 200, Ammo = 200, @@ -72,6 +77,7 @@ public static class ExpeditionCalculatorData Id = 6, DisplayId = "06", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(00, 40, 00), Bauxite = 80, Item1 = new() @@ -85,6 +91,7 @@ public static class ExpeditionCalculatorData Id = 7, DisplayId = "07", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(01, 00, 00), Steel = 50, Bauxite = 30, @@ -99,6 +106,7 @@ public static class ExpeditionCalculatorData Id = 8, DisplayId = "08", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(03, 00, 00), Fuel = 50, Ammo = 100, @@ -120,6 +128,7 @@ public static class ExpeditionCalculatorData Id = 100, DisplayId = "A1", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(00, 25, 00), Fuel = 45, Ammo = 45, @@ -129,6 +138,7 @@ public static class ExpeditionCalculatorData Id = 101, DisplayId = "A2", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = false, Duration = new(00, 55, 00), Fuel = 70, Ammo = 40, @@ -149,6 +159,7 @@ public static class ExpeditionCalculatorData Id = 102, DisplayId = "A3", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = false, Duration = new(02, 15, 00), Fuel = 120, Steel = 60, @@ -169,6 +180,7 @@ public static class ExpeditionCalculatorData Id = 103, DisplayId = "A4", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = true, Duration = new(01, 50, 00), Fuel = 80, Ammo = 120, @@ -189,6 +201,7 @@ public static class ExpeditionCalculatorData Id = 104, DisplayId = "A5", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = true, Duration = new(03, 00, 00), Ammo = 300, Bauxite = 100, @@ -208,6 +221,7 @@ public static class ExpeditionCalculatorData Id = 105, DisplayId = "A6", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = true, Duration = new(03, 30, 00), Fuel = 100, Ammo = 500, @@ -233,6 +247,7 @@ public static class ExpeditionCalculatorData Id = 9, DisplayId = "09", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(04, 00, 00), Fuel = 350, Item1 = new() @@ -251,6 +266,7 @@ public static class ExpeditionCalculatorData Id = 10, DisplayId = "10", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(01, 30, 00), Ammo = 50, Bauxite = 30, @@ -270,6 +286,7 @@ public static class ExpeditionCalculatorData Id = 11, DisplayId = "11", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(05, 00, 00), Bauxite = 250, Item1 = new() @@ -288,6 +305,7 @@ public static class ExpeditionCalculatorData Id = 12, DisplayId = "12", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(08, 00, 00), Fuel = 50, Ammo = 250, @@ -309,6 +327,7 @@ public static class ExpeditionCalculatorData Id = 13, DisplayId = "13", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(04, 00, 00), Fuel = 240, Ammo = 300, @@ -328,6 +347,7 @@ public static class ExpeditionCalculatorData Id = 14, DisplayId = "14", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(06, 00, 00), Ammo = 240, Steel = 200, @@ -348,6 +368,7 @@ public static class ExpeditionCalculatorData Id = 15, DisplayId = "15", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(12, 00, 00), Steel = 300, Bauxite = 400, @@ -367,6 +388,7 @@ public static class ExpeditionCalculatorData Id = 16, DisplayId = "16", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(15, 00, 00), Fuel = 500, Ammo = 500, @@ -388,6 +410,7 @@ public static class ExpeditionCalculatorData Id = 200, DisplayId = "B1", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(00, 35, 00), Steel = 10, Bauxite = 30, @@ -407,6 +430,7 @@ public static class ExpeditionCalculatorData Id = 201, DisplayId = "B2", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = true, Duration = new(08, 40, 00), Fuel = 300, Ammo = 200, @@ -427,6 +451,7 @@ public static class ExpeditionCalculatorData Id = 202, DisplayId = "B3", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = true, Duration = new(02, 50, 00), Ammo = 100, Steel = 100, @@ -447,6 +472,7 @@ public static class ExpeditionCalculatorData Id = 203, DisplayId = "B4", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = true, Duration = new(07, 30, 00), Steel = 1200, Bauxite = 650, @@ -466,6 +492,7 @@ public static class ExpeditionCalculatorData Id = 204, DisplayId = "B5", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = true, Duration = new(06, 30, 00), Fuel = 500, Ammo = 500, @@ -487,6 +514,7 @@ public static class ExpeditionCalculatorData Id = 205, DisplayId = "B6", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = true, Duration = new(05, 50, 00), Fuel = 600, Ammo = 1000, @@ -512,6 +540,7 @@ public static class ExpeditionCalculatorData Id = 17, DisplayId = "17", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(00, 45, 00), Fuel = 70, Ammo = 70, @@ -522,6 +551,7 @@ public static class ExpeditionCalculatorData Id = 18, DisplayId = "18", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(05, 00, 00), Steel = 300, Bauxite = 100, @@ -536,6 +566,7 @@ public static class ExpeditionCalculatorData Id = 19, DisplayId = "19", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(06, 00, 00), Fuel = 400, Ammo = 50, @@ -557,6 +588,7 @@ public static class ExpeditionCalculatorData Id = 20, DisplayId = "20", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(02, 00, 00), Steel = 150, Item1 = new() @@ -575,6 +607,7 @@ public static class ExpeditionCalculatorData Id = 21, DisplayId = "21", GreatSuccessType = GreatSuccessType.Drum, + IsMonthly = false, Duration = new(02, 20, 00), Fuel = 320, Ammo = 270, @@ -589,6 +622,7 @@ public static class ExpeditionCalculatorData Id = 22, DisplayId = "22", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(03, 00, 00), Ammo = 10, }, @@ -597,6 +631,7 @@ public static class ExpeditionCalculatorData Id = 23, DisplayId = "23", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(04, 00, 00), Ammo = 20, Bauxite = 100, @@ -606,6 +641,7 @@ public static class ExpeditionCalculatorData Id = 24, DisplayId = "24", GreatSuccessType = GreatSuccessType.Drum, + IsMonthly = false, Duration = new(08, 20, 00), Fuel = 500, Bauxite = 150, @@ -629,6 +665,7 @@ public static class ExpeditionCalculatorData Id = 41, DisplayId = "41", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = false, Duration = new(01, 00, 00), Fuel = 100, Bauxite = 20, @@ -648,6 +685,7 @@ public static class ExpeditionCalculatorData Id = 42, DisplayId = "42", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = true, Duration = new(08, 00, 00), Fuel = 800, Bauxite = 200, @@ -667,6 +705,7 @@ public static class ExpeditionCalculatorData Id = 43, DisplayId = "43", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = true, Duration = new(12, 00, 00), Fuel = 2000, Bauxite = 400, @@ -686,6 +725,7 @@ public static class ExpeditionCalculatorData Id = 44, DisplayId = "44", GreatSuccessType = GreatSuccessType.Drum, + IsMonthly = true, Duration = new(10, 00, 00), Ammo = 200, Bauxite = 800, @@ -705,6 +745,7 @@ public static class ExpeditionCalculatorData Id = 45, DisplayId = "45", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = false, Duration = new(03, 20, 00), Fuel = 40, Bauxite = 220, @@ -719,6 +760,7 @@ public static class ExpeditionCalculatorData Id = 46, DisplayId = "46", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = true, Duration = new(03, 30, 00), Fuel = 300, Steel = 150, @@ -743,6 +785,7 @@ public static class ExpeditionCalculatorData Id = 25, DisplayId = "25", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(40, 00, 00), Fuel = 900, Steel = 500, @@ -752,6 +795,7 @@ public static class ExpeditionCalculatorData Id = 26, DisplayId = "26", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(80, 00, 00), Bauxite = 900, Item1 = new() @@ -765,6 +809,7 @@ public static class ExpeditionCalculatorData Id = 27, DisplayId = "27", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(20, 00, 00), Steel = 800, Item1 = new() @@ -783,6 +828,7 @@ public static class ExpeditionCalculatorData Id = 28, DisplayId = "28", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(25, 00, 00), Steel = 900, Bauxite = 350, @@ -802,6 +848,7 @@ public static class ExpeditionCalculatorData Id = 29, DisplayId = "29", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(24, 00, 00), Ammo = 50, Bauxite = 100, @@ -821,6 +868,7 @@ public static class ExpeditionCalculatorData Id = 30, DisplayId = "30", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(48, 00, 00), Ammo = 50, Bauxite = 100, @@ -840,6 +888,7 @@ public static class ExpeditionCalculatorData Id = 31, DisplayId = "31", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(02, 00, 00), Ammo = 30, Item1 = new() @@ -853,6 +902,7 @@ public static class ExpeditionCalculatorData Id = 32, DisplayId = "32", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = false, Duration = new(24, 00, 00), Fuel = 50, Ammo = 50, @@ -874,6 +924,7 @@ public static class ExpeditionCalculatorData Id = 131, DisplayId = "D1", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = false, Duration = new(02, 00, 00), Ammo = 20, Steel = 20, @@ -889,6 +940,7 @@ public static class ExpeditionCalculatorData Id = 132, DisplayId = "D2", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = true, Duration = new(10, 00, 00), Steel = 400, Bauxite = 800, @@ -908,6 +960,7 @@ public static class ExpeditionCalculatorData Id = 133, DisplayId = "D3", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = true, Duration = new(12, 00, 00), Ammo = 800, Steel = 500, @@ -932,6 +985,7 @@ public static class ExpeditionCalculatorData Id = 35, DisplayId = "35", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(07, 00, 00), Steel = 240, Bauxite = 280, @@ -951,6 +1005,7 @@ public static class ExpeditionCalculatorData Id = 36, DisplayId = "36", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(09, 00, 00), Fuel = 480, Steel = 200, @@ -971,6 +1026,7 @@ public static class ExpeditionCalculatorData Id = 37, DisplayId = "37", GreatSuccessType = GreatSuccessType.Drum, + IsMonthly = false, Duration = new(02, 45, 00), Ammo = 380, Steel = 270, @@ -985,6 +1041,7 @@ public static class ExpeditionCalculatorData Id = 38, DisplayId = "38", GreatSuccessType = GreatSuccessType.Drum, + IsMonthly = false, Duration = new(02, 55, 00), Fuel = 420, Steel = 200, @@ -999,6 +1056,7 @@ public static class ExpeditionCalculatorData Id = 39, DisplayId = "39", GreatSuccessType = GreatSuccessType.Regular, + IsMonthly = false, Duration = new(30, 00, 00), Ammo = 30, Steel = 300, @@ -1018,6 +1076,7 @@ public static class ExpeditionCalculatorData Id = 40, DisplayId = "40", GreatSuccessType = GreatSuccessType.Drum, + IsMonthly = false, Duration = new(06, 50, 00), Fuel = 300, Ammo = 300, @@ -1038,6 +1097,7 @@ public static class ExpeditionCalculatorData Id = 141, DisplayId = "E1", GreatSuccessType = GreatSuccessType.Level, + IsMonthly = true, Duration = new(07, 30, 00), Ammo = 600, Steel = 600, @@ -1058,6 +1118,7 @@ public static class ExpeditionCalculatorData Id = 142, DisplayId = "E2", GreatSuccessType = GreatSuccessType.Drum, + IsMonthly = true, Duration = new(03, 05, 00), Ammo = 480, Item1 = new() diff --git a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorResources.en.resx b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorResources.en.resx index 70ee888d1..5e1ade228 100644 --- a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorResources.en.resx +++ b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorResources.en.resx @@ -183,4 +183,7 @@ Expedition Calculator + + Monthly + \ No newline at end of file diff --git a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorResources.resx b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorResources.resx index b0ff252c8..55838cfa6 100644 --- a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorResources.resx +++ b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorResources.resx @@ -183,4 +183,7 @@ 遠征計算機 + + マンスリー + \ No newline at end of file diff --git a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorView.axaml b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorView.axaml index 1814762d2..f513eb54c 100644 --- a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorView.axaml +++ b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorView.axaml @@ -29,8 +29,16 @@ - - + + + + - + @@ -81,7 +89,7 @@ diff --git a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorViewModel.cs b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorViewModel.cs index 181882340..b5d3a88bf 100644 --- a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorViewModel.cs +++ b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionCalculatorViewModel.cs @@ -1,18 +1,39 @@ -using CommunityToolkit.Mvvm.ComponentModel; +using System.Collections.ObjectModel; +using CommunityToolkit.Mvvm.ComponentModel; namespace ElectronicObserver.Avalonia.ExpeditionCalculator; -public class ExpeditionCalculatorViewModel : ObservableObject +public partial class ExpeditionCalculatorViewModel : ObservableObject { + [ObservableProperty] public partial bool? ShowMonthlyExpeditions { get; set; } = false; public FleetInfoViewModel FleetInfo { get; } = new(); public ExpeditionScoreWeights ExpeditionScoreWeights { get; } = new(); - public List Expeditions { get; } + public ObservableCollection Expeditions { get; } = []; public ExpeditionCalculatorViewModel() { - Expeditions = ExpeditionCalculatorData.Expeditions + UpdateExpeditions(); + } + + // ReSharper disable once UnusedParameterInPartialMethod + partial void OnShowMonthlyExpeditionsChanged(bool? value) + { + UpdateExpeditions(); + } + + private void UpdateExpeditions() + { + Expeditions.Clear(); + + List expeditions = ExpeditionCalculatorData.Expeditions + .Where(e => ShowMonthlyExpeditions is null || e.IsMonthly == ShowMonthlyExpeditions) .Select(e => new ExpeditionViewModel(e, FleetInfo, ExpeditionScoreWeights)) .ToList(); + + foreach (ExpeditionViewModel expedition in expeditions) + { + Expeditions.Add(expedition); + } } } diff --git a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionScoreWeights.cs b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionScoreWeights.cs index 030570cd2..4c938adfd 100644 --- a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionScoreWeights.cs +++ b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionScoreWeights.cs @@ -4,17 +4,17 @@ namespace ElectronicObserver.Avalonia.ExpeditionCalculator; public partial class ExpeditionScoreWeights : ObservableObject { - [ObservableProperty] private int _fuel = 1; - [ObservableProperty] private int _ammo = 1; - [ObservableProperty] private int _steel = 1; - [ObservableProperty] private int _bauxite = 1; + [ObservableProperty] public partial int Fuel { get; set; } = 1; + [ObservableProperty] public partial int Ammo { get; set; } = 1; + [ObservableProperty] public partial int Steel { get; set; } = 1; + [ObservableProperty] public partial int Bauxite { get; set; } = 1; - [ObservableProperty] private int _instantRepair = 100; - [ObservableProperty] private int _instantConstruction; - [ObservableProperty] private int _developmentMaterial; - [ObservableProperty] private int _improveMaterial; - [ObservableProperty] private int _furnitureBoxSmall; - [ObservableProperty] private int _furnitureBoxMedium; - [ObservableProperty] private int _furnitureBoxLarge; - [ObservableProperty] private int _moraleFoodIrako; + [ObservableProperty] public partial int InstantRepair { get; set; } = 100; + [ObservableProperty] public partial int InstantConstruction { get; set; } + [ObservableProperty] public partial int DevelopmentMaterial { get; set; } + [ObservableProperty] public partial int ImproveMaterial { get; set; } + [ObservableProperty] public partial int FurnitureBoxSmall { get; set; } + [ObservableProperty] public partial int FurnitureBoxMedium { get; set; } + [ObservableProperty] public partial int FurnitureBoxLarge { get; set; } + [ObservableProperty] public partial int MoraleFoodIrako { get; set; } } diff --git a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionViewModel.cs b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionViewModel.cs index bf09a483d..94019b8cb 100644 --- a/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionViewModel.cs +++ b/ElectronicObserver.Avalonia/ExpeditionCalculator/ExpeditionViewModel.cs @@ -13,7 +13,7 @@ public partial class ExpeditionViewModel : ObservableObject public string DisplayId => Model.DisplayId; public TimeSpan Duration => Model.Duration; - [ObservableProperty] private double _score; + [ObservableProperty] public partial double Score { get; set; } public int Fuel => Model.Fuel; public int Ammo => Model.Ammo; @@ -23,7 +23,7 @@ public partial class ExpeditionViewModel : ObservableObject public ExpeditionReward? Item1 => Model.Item1; public ExpeditionReward? Item2 => Model.Item2; - [ObservableProperty] private double _greatSuccessRate; + [ObservableProperty] public partial double GreatSuccessRate { get; set; } public ExpeditionViewModel(Expedition expedition, FleetInfoViewModel fleetInfo, ExpeditionScoreWeights weights) { diff --git a/ElectronicObserver.Avalonia/ExpeditionCalculator/FleetInfoViewModel.cs b/ElectronicObserver.Avalonia/ExpeditionCalculator/FleetInfoViewModel.cs index dfb3d7135..782bff160 100644 --- a/ElectronicObserver.Avalonia/ExpeditionCalculator/FleetInfoViewModel.cs +++ b/ElectronicObserver.Avalonia/ExpeditionCalculator/FleetInfoViewModel.cs @@ -4,8 +4,8 @@ namespace ElectronicObserver.Avalonia.ExpeditionCalculator; public partial class FleetInfoViewModel : ObservableObject { - [ObservableProperty] private bool _allSparkled; - [ObservableProperty] private int _sparkleCount; - [ObservableProperty] private int _drumCount; - [ObservableProperty] private int _flagshipLevel = 1; + [ObservableProperty] public partial bool AllSparkled { get; set; } + [ObservableProperty] public partial int SparkleCount { get; set; } + [ObservableProperty] public partial int DrumCount { get; set; } + [ObservableProperty] public partial int FlagshipLevel { get; set; } = 1; } diff --git a/ElectronicObserver.Avalonia/ShipGroup/DataGridSettingsModel.cs b/ElectronicObserver.Avalonia/ShipGroup/DataGridSettingsModel.cs index d0f212d11..d6e7b7bb6 100644 --- a/ElectronicObserver.Avalonia/ShipGroup/DataGridSettingsModel.cs +++ b/ElectronicObserver.Avalonia/ShipGroup/DataGridSettingsModel.cs @@ -4,6 +4,6 @@ namespace ElectronicObserver.Avalonia.ShipGroup; public partial class DataGridSettingsModel : ObservableObject { - [ObservableProperty] private int _columnHeaderHeight = 32; - [ObservableProperty] private int _rowHeight = 32; + [ObservableProperty] public partial int ColumnHeaderHeight { get; set; } = 32; + [ObservableProperty] public partial int RowHeight { get; set; } = 32; } diff --git a/ElectronicObserver.Avalonia/ShipGroup/ShipGroupItem.cs b/ElectronicObserver.Avalonia/ShipGroup/ShipGroupItem.cs index b65293016..99f9985b3 100644 --- a/ElectronicObserver.Avalonia/ShipGroup/ShipGroupItem.cs +++ b/ElectronicObserver.Avalonia/ShipGroup/ShipGroupItem.cs @@ -9,10 +9,10 @@ public partial class ShipGroupItem : ObservableObject { public IGroupItem Group { get; } - [ObservableProperty] private int _id; - [ObservableProperty] private string _name; - [ObservableProperty] private bool _isSelected; - [ObservableProperty] private int _frozenColumns; + [ObservableProperty] public partial int Id { get; set; } + [ObservableProperty] public partial string Name { get; set; } + [ObservableProperty] public partial bool IsSelected { get; set; } + [ObservableProperty] public partial int FrozenColumns { get; set; } public required ObservableCollection Columns { get; set; } public DataGridSortDescriptionCollection SortDescriptions { get; set; } = []; diff --git a/ElectronicObserver.Avalonia/ShipGroup/ShipGroupViewModel.cs b/ElectronicObserver.Avalonia/ShipGroup/ShipGroupViewModel.cs index 34c46e0af..5e0a30b71 100644 --- a/ElectronicObserver.Avalonia/ShipGroup/ShipGroupViewModel.cs +++ b/ElectronicObserver.Avalonia/ShipGroup/ShipGroupViewModel.cs @@ -15,23 +15,23 @@ public partial class ShipGroupViewModel : ObservableObject public DataGridSettingsModel DataGridSettings { get; } = new(); - [ObservableProperty] private int _conditionBorder; - [ObservableProperty] private bool _autoUpdate = true; - [ObservableProperty] private bool _showStatusBar = true; + [ObservableProperty] public partial int ConditionBorder { get; set; } + [ObservableProperty] public partial bool AutoUpdate { get; set; } = true; + [ObservableProperty] public partial bool ShowStatusBar { get; set; } = true; - [ObservableProperty] private ObservableCollection _groups = []; + [ObservableProperty] public partial ObservableCollection Groups { get; set; } = []; - [ObservableProperty] private GridLength _groupHeight; + [ObservableProperty] public partial GridLength GroupHeight { get; set; } - [ObservableProperty] private ObservableCollection _items = []; - [ObservableProperty] private DataGridCollectionView _collectionView = new(new List()); - [ObservableProperty] private string _shipCountText = ""; - [ObservableProperty] private string _levelTotalText = ""; - [ObservableProperty] private string _levelAverageText = ""; + [ObservableProperty] public partial ObservableCollection Items { get; set; } = []; + [ObservableProperty] public partial DataGridCollectionView CollectionView { get; set; } = new(new List()); + [ObservableProperty] public partial string ShipCountText { get; set; } = ""; + [ObservableProperty] public partial string LevelTotalText { get; set; } = ""; + [ObservableProperty] public partial string LevelAverageText { get; set; } = ""; - [ObservableProperty] private ObservableCollection _columnProperties = []; - [ObservableProperty] private DataGridSortDescriptionCollection _sortDescriptions = []; - [ObservableProperty] private int _frozenColumns; + [ObservableProperty] public partial ObservableCollection ColumnProperties { get; set; } = []; + [ObservableProperty] public partial DataGridSortDescriptionCollection SortDescriptions { get; set; } = []; + [ObservableProperty] public partial int FrozenColumns { get; set; } public required Action SelectGroupAction { get; init; } public required Func AddGroupAction { get; init; } @@ -47,7 +47,7 @@ public partial class ShipGroupViewModel : ObservableObject public required Action ExportCsvAction { get; init; } public required Func OpenDataGridSettingsAction { get; init; } - [ObservableProperty] private bool _anyShipsSelected; + [ObservableProperty] public partial bool AnyShipsSelected { get; set; } public List SelectedShips { get; private set; } = []; // hacky way cause the logic is in the EO project @@ -124,7 +124,7 @@ private void SelectGroup(ShipGroupItem group) private void AddToGroup() => AddToGroupAction.Invoke(); [RelayCommand] - private async Task CreateGroup() => await CreateGroupAction.Invoke(); + private async Task CreateGroup() => await CreateGroupAction.Invoke(); [RelayCommand] private void ExcludeFromGroup() => ExcludeFromGroupAction.Invoke(); diff --git a/ElectronicObserver/ElectronicObserver.csproj b/ElectronicObserver/ElectronicObserver.csproj index 083da48c1..789477c1c 100644 --- a/ElectronicObserver/ElectronicObserver.csproj +++ b/ElectronicObserver/ElectronicObserver.csproj @@ -96,7 +96,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/ElectronicObserverCoreTests/ElectronicObserverCoreTests.csproj b/ElectronicObserverCoreTests/ElectronicObserverCoreTests.csproj index 5accafe5f..645efcf82 100644 --- a/ElectronicObserverCoreTests/ElectronicObserverCoreTests.csproj +++ b/ElectronicObserverCoreTests/ElectronicObserverCoreTests.csproj @@ -9,6 +9,7 @@ + diff --git a/KancolleProgress/KancolleProgress.csproj b/KancolleProgress/KancolleProgress.csproj index cce0579ab..4fc4dd247 100644 --- a/KancolleProgress/KancolleProgress.csproj +++ b/KancolleProgress/KancolleProgress.csproj @@ -18,7 +18,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - +