diff --git a/source/Grabacr07.KanColleViewer/ViewModels/Catalogs/ShipCatalogFilter.cs b/source/Grabacr07.KanColleViewer/ViewModels/Catalogs/ShipCatalogFilter.cs index a00cca9f4..0eb89394a 100644 --- a/source/Grabacr07.KanColleViewer/ViewModels/Catalogs/ShipCatalogFilter.cs +++ b/source/Grabacr07.KanColleViewer/ViewModels/Catalogs/ShipCatalogFilter.cs @@ -681,4 +681,82 @@ public override bool Predicate(Ship ship) return false; } } + + public class ShipConditionFilter : ShipCatalogFilter + { + #region Both 変更通知プロパティ + + private bool _Both; + + public bool Both + { + get { return this._Both; } + set + { + if (this._Both != value) + { + this._Both = value; + this.RaisePropertyChanged(); + this.Update(); + } + } + } + + #endregion + + #region Brilliant 変更通知プロパティ + + private bool _Brilliant; + + public bool Brilliant + { + get { return this._Brilliant; } + set + { + if (this._Brilliant != value) + { + this._Brilliant = value; + this.RaisePropertyChanged(); + this.Update(); + } + } + } + + #endregion + + #region Unbrilliant 変更通知プロパティ + + private bool _Unbrilliant; + + public bool Unbrilliant + { + get { return this._Unbrilliant; } + set + { + if (this._Unbrilliant != value) + { + this._Unbrilliant = value; + this.RaisePropertyChanged(); + this.Update(); + } + } + } + + #endregion + + public ShipConditionFilter(Action updateAction) + : base(updateAction) + { + this._Both = true; + } + + public override bool Predicate(Ship ship) + { + if (this.Both) return true; + if (this.Brilliant && ship.ConditionType == ConditionType.Brilliant) return true; + if (this.Unbrilliant && ship.ConditionType >= ConditionType.Normal) return true; + + return false; + } + } } diff --git a/source/Grabacr07.KanColleViewer/ViewModels/Catalogs/ShipCatalogWindowViewModel.cs b/source/Grabacr07.KanColleViewer/ViewModels/Catalogs/ShipCatalogWindowViewModel.cs index 67716d27c..7bee84b78 100644 --- a/source/Grabacr07.KanColleViewer/ViewModels/Catalogs/ShipCatalogWindowViewModel.cs +++ b/source/Grabacr07.KanColleViewer/ViewModels/Catalogs/ShipCatalogWindowViewModel.cs @@ -31,6 +31,7 @@ public class ShipCatalogWindowViewModel : WindowViewModel public ShipExpeditionFilter ShipExpeditionFilter { get; } public ShipSallyAreaFilter ShipSallyAreaFilter { get; } public ShipDamagedFilter ShipDamagedFilter { get; } + public ShipConditionFilter ShipConditionFilter { get; } public bool CheckAllShipTypes { @@ -143,6 +144,7 @@ public ShipCatalogWindowViewModel() this.ShipExpeditionFilter = new ShipExpeditionFilter(this.Update); this.ShipSallyAreaFilter = new ShipSallyAreaFilter(this.Update); this.ShipDamagedFilter = new ShipDamagedFilter(this.Update); + this.ShipConditionFilter = new ShipConditionFilter(this.Update); this.updateSource .Do(_ => this.IsReloading = true) @@ -179,7 +181,8 @@ private IObservable UpdateAsync(SallyArea[] areas) .Where(this.ShipRemodelingFilter.Predicate) .Where(this.ShipExpeditionFilter.Predicate) .Where(this.ShipSallyAreaFilter.Predicate) - .Where(this.ShipDamagedFilter.Predicate); + .Where(this.ShipDamagedFilter.Predicate) + .Where(this.ShipConditionFilter.Predicate); this.Ships = this.SortWorker.Sort(list) .Select((x, i) => new ShipViewModel(i + 1, x, areas.FirstOrDefault(y => y.Area == x.SallyArea))) diff --git a/source/Grabacr07.KanColleViewer/Views/Catalogs/ShipCatalogWindow.xaml b/source/Grabacr07.KanColleViewer/Views/Catalogs/ShipCatalogWindow.xaml index 9edc588fa..447892196 100644 --- a/source/Grabacr07.KanColleViewer/Views/Catalogs/ShipCatalogWindow.xaml +++ b/source/Grabacr07.KanColleViewer/Views/Catalogs/ShipCatalogWindow.xaml @@ -247,7 +247,7 @@ @@ -407,6 +407,28 @@ IsChecked="{Binding Undamaged, Mode=TwoWay}" /> + + + + + + + + + + + + + + + + +