From 3f45ed478c0c7f25c12af20dabc6f0e6a12706e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=81=82=E3=82=8B=E3=81=A8?= Date: Fri, 19 Feb 2016 19:50:46 +0900 Subject: [PATCH] =?UTF-8?q?=E8=89=A6=E5=A8=98=E4=B8=80=E8=A6=A7=E3=82=A6?= =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=83=89=E3=82=A6=E3=81=ABcondition=E5=80=A4?= =?UTF-8?q?=E3=81=AB=E3=82=88=E3=82=8B=E3=83=95=E3=82=A3=E3=83=AB=E3=82=BF?= =?UTF-8?q?=E3=83=AA=E3=83=B3=E3=82=B0=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewModels/Catalogs/ShipCatalogFilter.cs | 78 +++++++++++++++++++ .../Catalogs/ShipCatalogWindowViewModel.cs | 5 +- .../Views/Catalogs/ShipCatalogWindow.xaml | 24 +++++- 3 files changed, 105 insertions(+), 2 deletions(-) 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}" /> + + + + + + + + + + + + + + + + +