diff --git a/RemodelHelper/Models/ConsumptionData.cs b/RemodelHelper/Models/ConsumptionData.cs new file mode 100644 index 0000000..9c70ebf --- /dev/null +++ b/RemodelHelper/Models/ConsumptionData.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace RemodelHelper.Models +{ + public class ConsumptionData + { + public int Lv { get; set; } + public int[] BKit { get; set; } + public int[] RKit { get; set; } + public int CId { get; set; } + public int Count { get; set; } + } +} diff --git a/RemodelHelper/Models/ConsumptionInfo.cs b/RemodelHelper/Models/ConsumptionInfo.cs new file mode 100644 index 0000000..b5a0f89 --- /dev/null +++ b/RemodelHelper/Models/ConsumptionInfo.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Grabacr07.KanColleWrapper.Models; + +namespace RemodelHelper.Models +{ + public class ConsumptionInfo + { + public int Level { get; internal set; } + + public KitCount BuildKit { get; internal set; } + public KitCount RemodelKit { get; internal set; } + + public SlotItemInfo ConsumeSlotItem { get; internal set; } + public int ConsumeCount { get; internal set; } + } + + public class KitCount + { + public int Normal { get; internal set; } + public int Ensure { get; internal set; } + + public override string ToString() + { + var n = this.Normal >= 0 ? this.Normal.ToString() : "-"; + var e = this.Ensure >= 0 ? this.Ensure.ToString() : "-"; + return $"{n}/{e}"; + } + } +} diff --git a/RemodelHelper/Models/ItemInfo.cs b/RemodelHelper/Models/ItemInfo.cs new file mode 100644 index 0000000..9ea26c6 --- /dev/null +++ b/RemodelHelper/Models/ItemInfo.cs @@ -0,0 +1,72 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows.Documents; +using Grabacr07.KanColleWrapper.Models; + +namespace RemodelHelper.Models +{ + public abstract class ItemInfo : IIdentifiable + { + public int Id => this.Info?.Id ?? 0; + + public SlotItemInfo Info { get; } + + + internal ItemInfo(SlotItemInfo info) + { + this.Info = info; + } + } + + + public class BaseSlotItemInfo : ItemInfo + { + public IdentifiableTable UpgradeSlotItems { get; } = new IdentifiableTable(); + + + internal BaseSlotItemInfo(Item item) : base(item.GetBaseSlotInfo()) + { + this.AddUpgradeSlotItem(item); + } + + internal void AddUpgradeSlotItem(Item item) + { + if (!this.UpgradeSlotItems.ContainsKey(item.NewId)) + this.UpgradeSlotItems.Add(new UpgradeSlotItemInfo(item)); + else + this.UpgradeSlotItems[item.NewId].AddAssistant(item); + } + + public bool IsAvailable(DayOfWeek day) => this.UpgradeSlotItems.Values.Any(newSlot => newSlot.IsAvailable(day)); + } + + + public class UpgradeSlotItemInfo : ItemInfo + { + public IdentifiableTable Assistants { get; } = new IdentifiableTable(); + + public int Level { get; set; } + + public int Fuel { get; internal set; } + public int Ammo { get; internal set; } + public int Steel { get; internal set; } + public int Bauxite { get; internal set; } + + public ConsumptionInfo[] Consumptions { get; internal set; } + + internal UpgradeSlotItemInfo(Item item) : base(item.GetUpgradeSlotInfo()) + { + this.AddAssistant(item); + } + + internal void AddAssistant(Item item) + { + this.Assistants.Add(new AssistantInfo(item)); + } + + public bool IsAvailable(DayOfWeek day) => this.Assistants.Values.Any(ship => ship.IsAvailable(day)); + } +} diff --git a/RemodelHelper/Models/RemodelDataProvider.cs b/RemodelHelper/Models/RemodelDataProvider.cs index 4e2e434..98ecb33 100644 --- a/RemodelHelper/Models/RemodelDataProvider.cs +++ b/RemodelHelper/Models/RemodelDataProvider.cs @@ -39,9 +39,9 @@ private RemodelData RawData public string Version => this.RawData?.Version; - private IdentifiableTable _items = new IdentifiableTable(); + private IdentifiableTable _items = new IdentifiableTable(); - public IdentifiableTable Items + public IdentifiableTable Items { get { return this._items; } private set @@ -125,20 +125,38 @@ private void ParseData() { this.IsReady = false; - var newItems = new IdentifiableTable(); + var newItems = new IdentifiableTable(); foreach (var item in this.RawData.Items.Where(item => item.GetBaseSlotInfo() != null)) { if (!newItems.ContainsKey(item.SlotId)) - newItems.Add(new BaseSlotInfo(item)); + newItems.Add(new BaseSlotItemInfo(item)); else - newItems[item.SlotId].AddUpgradeSlot(item); + newItems[item.SlotId].AddUpgradeSlotItem(item); } foreach (var item in newItems.Values) - foreach (var newSlot in item.UpgradeSlots.Values) - newSlot.Level = - this.RawData.NewSlots.FirstOrDefault(s => s.Id == item.Id && s.NewId == newSlot.Id)?.Lv ?? 0; + foreach (var newItem in item.UpgradeSlotItems.Values) + { + var rawData = this.RawData.NewSlots.First(s => s.Id == item.Id && s.NewId == newItem.Id); + newItem.Level = rawData.Lv; + + newItem.Fuel = rawData.Meterials[0]; + newItem.Ammo = rawData.Meterials[1]; + newItem.Steel = rawData.Meterials[2]; + newItem.Bauxite = rawData.Meterials[3]; + + newItem.Consumptions = rawData.Consumption + .Select(c => new ConsumptionInfo + { + Level = c.Lv, + BuildKit = new KitCount { Normal = c.BKit[0], Ensure = c.BKit[1] }, + RemodelKit = new KitCount { Normal = c.RKit[0], Ensure = c.RKit[1] }, + ConsumeSlotItem = KanColleClient.Current.Master.SlotItems[c.CId], + ConsumeCount = c.Count, + }) + .ToArray(); + } this.Items = newItems; diff --git a/RemodelHelper/Models/SlotInfo.cs b/RemodelHelper/Models/SlotInfo.cs deleted file mode 100644 index ad1e5ee..0000000 --- a/RemodelHelper/Models/SlotInfo.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Documents; -using Grabacr07.KanColleWrapper.Models; - -namespace RemodelHelper.Models -{ - public abstract class SlotInfo : IIdentifiable - { - public int Id => this.Info?.Id ?? 0; - - public SlotItemInfo Info { get; } - - - internal SlotInfo(SlotItemInfo info) - { - this.Info = info; - } - } - - - public class BaseSlotInfo : SlotInfo - { - public IdentifiableTable UpgradeSlots { get; } = new IdentifiableTable(); - - - internal BaseSlotInfo(Item item) : base(item.GetBaseSlotInfo()) - { - this.AddUpgradeSlot(item); - } - - internal void AddUpgradeSlot(Item item) - { - if (!this.UpgradeSlots.ContainsKey(item.NewId)) - this.UpgradeSlots.Add(new UpgradeSlotInfo(item)); - else - this.UpgradeSlots[item.NewId].AddAssistant(item); - } - - public bool IsAvailable(DayOfWeek day) => this.UpgradeSlots.Values.Any(newSlot => newSlot.IsAvailable(day)); - } - - - public class UpgradeSlotInfo : SlotInfo - { - public IdentifiableTable Assistants { get; } = new IdentifiableTable(); - - public int Level { get; set; } - - internal UpgradeSlotInfo(Item item) : base(item.GetUpgradeSlotInfo()) - { - this.AddAssistant(item); - } - - internal void AddAssistant(Item item) - { - this.Assistants.Add(new AssistantInfo(item)); - } - - public bool IsAvailable(DayOfWeek day) => this.Assistants.Values.Any(ship => ship.IsAvailable(day)); - } -} diff --git a/RemodelHelper/Models/UpgradeData.cs b/RemodelHelper/Models/UpgradeData.cs index 9f6afe9..1790ae7 100644 --- a/RemodelHelper/Models/UpgradeData.cs +++ b/RemodelHelper/Models/UpgradeData.cs @@ -13,5 +13,9 @@ public class UpgradeData public int NewId { get; set; } public int Lv { get; set; } + + public int[] Meterials { get; set; } + + public ConsumptionData[] Consumption { get; set; } } } diff --git a/RemodelHelper/Plugin.cs b/RemodelHelper/Plugin.cs index 059bdb0..9c4891a 100644 --- a/RemodelHelper/Plugin.cs +++ b/RemodelHelper/Plugin.cs @@ -12,7 +12,7 @@ namespace RemodelHelper [Export(typeof(IPlugin))] [ExportMetadata("Title", "改修助手")] [ExportMetadata("Description", "改修工厂辅助插件")] - [ExportMetadata("Version", "1.0.1")] + [ExportMetadata("Version", "1.1.0")] [ExportMetadata("Author", "Yoctillion")] [ExportMetadata("Guid", "71C1EE7A-A153-437F-B75F-E3E22ED833F1")] public class Plugin : ITool, IPlugin diff --git a/RemodelHelper/Properties/AssemblyInfo.cs b/RemodelHelper/Properties/AssemblyInfo.cs index 67d5399..6ad639f 100644 --- a/RemodelHelper/Properties/AssemblyInfo.cs +++ b/RemodelHelper/Properties/AssemblyInfo.cs @@ -51,4 +51,4 @@ // すべての値を指定するか、下のように '*' を使ってビルドおよびリビジョン番号を // 既定値にすることができます: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.1")] +[assembly: AssemblyVersion("1.1.0")] diff --git a/RemodelHelper/RemodelHelper.csproj b/RemodelHelper/RemodelHelper.csproj index 53ef0e7..a0cf970 100644 --- a/RemodelHelper/RemodelHelper.csproj +++ b/RemodelHelper/RemodelHelper.csproj @@ -159,20 +159,23 @@ + + - + + - - + + DetailWindow.xaml diff --git a/RemodelHelper/ViewModels/ConsumptionViewModel.cs b/RemodelHelper/ViewModels/ConsumptionViewModel.cs new file mode 100644 index 0000000..fa9609c --- /dev/null +++ b/RemodelHelper/ViewModels/ConsumptionViewModel.cs @@ -0,0 +1,66 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Grabacr07.KanColleWrapper.Models; +using Livet; +using RemodelHelper.Models; + +namespace RemodelHelper.ViewModels +{ + public class ConsumptionViewModel : ViewModel + { + public string Name + { + get + { + if (this.Info != null) + { + switch (this.Info.Level) + { + case 0: + return "初期"; + case 6: + return "★6"; + case 10: + return "★max"; + } + } + + return string.Empty; + } + } + + private bool _isDifferent; + + public bool IsDifferent + { + get { return this._isDifferent; } + set + { + if (this._isDifferent != value) + { + this._isDifferent = value; + this.RaisePropertyChanged(); + } + } + } + + private ConsumptionInfo _info; + + public ConsumptionInfo Info + { + get { return this._info; } + set + { + if (this._info != value) + { + this._info = value; + this.RaisePropertyChanged(); + this.RaisePropertyChanged(nameof(this.Name)); + } + } + } + } +} diff --git a/RemodelHelper/ViewModels/DetailViewModel.cs b/RemodelHelper/ViewModels/DetailViewModel.cs index f8e0467..944ca83 100644 --- a/RemodelHelper/ViewModels/DetailViewModel.cs +++ b/RemodelHelper/ViewModels/DetailViewModel.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.ComponentModel.Composition.Primitives; using System.Linq; +using System.Windows; using Grabacr07.KanColleWrapper; using MetroTrilithon.Mvvm; using RemodelHelper.Models; @@ -13,6 +14,21 @@ public class DetailViewModel : ItemsViewModel public string[] DaysOfWeek { get; } = {"周日(日)", "周一(月)", "周二(水)", "周三(火)", "周四(木)", "周五(金)", "周六(土)"}; + private int _width; + + public int Width + { + get { return this._width; } + private set + { + if (this._width != value) + { + this._width = value; + this.RaisePropertyChanged(); + } + } + } + private DayOfWeek _currentDay; public DayOfWeek CurrentDay @@ -34,16 +50,16 @@ public DayOfWeek CurrentDay } - private SlotTypeViewModel[] _slotTypes; + private SlotItemTypeViewModel[] _slotItemTypes; - public SlotTypeViewModel[] SlotTypes + public SlotItemTypeViewModel[] SlotItemTypes { - get { return this._slotTypes; } + get { return this._slotItemTypes; } set { - if (this._slotTypes != value) + if (this._slotItemTypes != value) { - this._slotTypes = value; + this._slotItemTypes = value; this.RaisePropertyChanged(); } } @@ -53,9 +69,9 @@ public bool? IsAllTypeSelected { get { - if (SlotTypes.All(type => type.IsSelected)) + if (SlotItemTypes.All(type => type.IsSelected)) return true; - if (SlotTypes.All(type => !type.IsSelected)) + if (SlotItemTypes.All(type => !type.IsSelected)) return false; else return null; @@ -64,7 +80,7 @@ public bool? IsAllTypeSelected { if (value != null) { - foreach (var type in SlotTypes) type.SetSelected((bool)value); + foreach (var type in SlotItemTypes) type.SetSelected((bool)value); this.UpdateSlotInfo(); } } @@ -102,10 +118,46 @@ public bool IsOnlyShowCurrentDay } } + + private bool _isHideConsumption; + + public bool IsHideConsumption + { + get { return this._isHideConsumption; } + set + { + if (this._isHideConsumption != value) + { + this._isHideConsumption = value; + this.RaisePropertyChanged(); + this.ConsumptionVisibility = value ? Visibility.Collapsed : Visibility.Visible; + this.Width = value ? 550 : 850; + } + } + } + + private Visibility _consumptionVisibility; + + public Visibility ConsumptionVisibility + { + get { return this._consumptionVisibility; } + set + { + if (this._consumptionVisibility != value) + { + this._consumptionVisibility = value; + this.RaisePropertyChanged(); + } + } + } + + private readonly DateChangeTrigger _dayTrigger; public DetailViewModel() { + this.Width = 850; + var timeZone = TimeZoneInfo.FindSystemTimeZoneById("Tokyo Standard Time"); this._dayTrigger = DateChangeTrigger.GetTigger(timeZone); this._dayTrigger.DateChanged += (before, after) => this.CurrentDay = after.DayOfWeek; @@ -124,10 +176,10 @@ public DetailViewModel() public void UpdateSlotTypes() { - this.SlotTypes = DataProvider.Items.Values - .Select(slot => slot.Info.EquipType) + this.SlotItemTypes = DataProvider.Items.Values + .Select(s => s.Info.EquipType) .Distinct() - .Select(type => new SlotTypeViewModel(type) { SelectionChangedAction = this.SlotTypeSelectionChanged }) + .Select(type => new SlotItemTypeViewModel(type) { SelectionChangedAction = this.SlotTypeSelectionChanged }) .ToArray(); this.RaisePropertyChanged(nameof(this.IsAllTypeSelected)); @@ -139,55 +191,99 @@ private void SlotTypeSelectionChanged() this.RaisePropertyChanged(nameof(this.IsAllTypeSelected)); } - protected override bool FilterBaseSlot(BaseSlotInfo baseSlot) + protected override bool FilterBaseSlotItem(BaseSlotItemInfo baseSlotItem) { if (IsOnlyShowCurrentDay) { // 今日不可改修 - if (!baseSlot.IsAvailable(this.CurrentDay)) return false; + if (!baseSlotItem.IsAvailable(this.CurrentDay)) return false; } if (this.IsOnlyShowAvailable) { // 无此装备 - var slotId = baseSlot.Info.Id; - if (KanColleClient.Current.Homeport.Itemyard.SlotItems.Values.All(slot => slot.Info.Id != slotId)) + if (KanColleClient.Current.Homeport.Itemyard.SlotItems.Values.All(s => s.Info != baseSlotItem.Info)) { return false; } } // filter - if (this.SlotTypes != null) + if (this.SlotItemTypes != null) { - var slotType = baseSlot.Info.EquipType; - if (this.SlotTypes.Where(type => !type.IsSelected).Any(type => type.Equals(slotType))) + var slotType = baseSlotItem.Info.EquipType; + if (this.SlotItemTypes.Where(type => !type.IsSelected).Any(type => type.Equals(slotType))) { return false; } } - return base.FilterBaseSlot(baseSlot); + return base.FilterBaseSlotItem(baseSlotItem); } - protected override bool FilterUpgradeSlot(BaseSlotInfo baseSlot, UpgradeSlotInfo upgradeSlot) + protected override bool FilterUpgradeSlotItem(BaseSlotItemInfo baseSlotItem, UpgradeSlotItemInfo upgradeSlotItem) { - // All Lv Max & no upgrade - if (upgradeSlot.Info == null) + if (this.IsOnlyShowAvailable) { - var bId = baseSlot.Id; - if ( - KanColleClient.Current.Homeport.Itemyard.SlotItems.Values - .Where(slot => slot.Info.Id == bId) - .All(slot => slot.Level == 10)) + var materials = KanColleClient.Current.Homeport.Materials; + var slotItems = KanColleClient.Current.Homeport.Itemyard.SlotItems; + + // 资材 + if (materials.Fuel < upgradeSlotItem.Fuel || + materials.Ammunition < upgradeSlotItem.Ammo || + materials.Steel < upgradeSlotItem.Steel || + materials.Bauxite < upgradeSlotItem.Bauxite) + { + return false; + } + + var baseItems = slotItems.Values + .Where(s => s.Info == baseSlotItem.Info) + .ToArray(); + // All Lv Max & no upgrade + if (upgradeSlotItem.Info == null && baseItems.All(s => s.Level == 10)) + { + return false; + } + + // 不同等级阶段的开发资材/改修资材/装备消耗 + var canRemodel = false; + if (baseItems.Any(s => s.Level >= 0 && s.Level < 6)) + { + var info = upgradeSlotItem.Consumptions[0]; + canRemodel |= this.Check(info); + } + if (baseItems.Any(s => s.Level >= 6 && s.Level < 10)) + { + var info = upgradeSlotItem.Consumptions[1]; + canRemodel |= this.Check(info); + } + if (baseItems.Any(s => s.Level == 10)) + { + var info = upgradeSlotItem.Consumptions[2]; + canRemodel |= this.Check(info); + } + + if (!canRemodel) { return false; } } - return base.FilterUpgradeSlot(baseSlot, upgradeSlot); + + return base.FilterUpgradeSlotItem(baseSlotItem, upgradeSlotItem); + } + + private bool Check(ConsumptionInfo info) + { + var materials = KanColleClient.Current.Homeport.Materials; + var slotItems = KanColleClient.Current.Homeport.Itemyard.SlotItems; + + return materials.DevelopmentMaterials >= info.BuildKit.Normal && + materials.ImprovementMaterials >= info.RemodelKit.Normal && + slotItems.Values.Count(s => s.Info == info.ConsumeSlotItem && s.Level == 0 && s.RawData.api_locked == 0) >= info.ConsumeCount; } - protected override bool FilterAssistant(BaseSlotInfo baseSlot, UpgradeSlotInfo upgradeSlot, + protected override bool FilterAssistant(BaseSlotItemInfo baseSlotItem, UpgradeSlotItemInfo upgradeSlotItem, AssistantInfo assistant) { if (this.IsOnlyShowCurrentDay) @@ -213,7 +309,7 @@ protected override bool FilterAssistant(BaseSlotInfo baseSlot, UpgradeSlotInfo u return true; } - return base.FilterAssistant(baseSlot, upgradeSlot, assistant); + return base.FilterAssistant(baseSlotItem, upgradeSlotItem, assistant); } public void BackToToday() diff --git a/RemodelHelper/ViewModels/ItemsViewModel.cs b/RemodelHelper/ViewModels/ItemsViewModel.cs index 789a21f..e489469 100644 --- a/RemodelHelper/ViewModels/ItemsViewModel.cs +++ b/RemodelHelper/ViewModels/ItemsViewModel.cs @@ -14,16 +14,16 @@ public abstract class ItemsViewModel : ViewModel protected static RemodelDataProvider DataProvider => RemodelDataProvider.Current; - private BaseSlotViewModel[] _baseSlots; + private BaseSlotItemViewModel[] _baseSlotItems; - public BaseSlotViewModel[] BaseSlots + public BaseSlotItemViewModel[] BaseSlotItems { - get { return this._baseSlots; } + get { return this._baseSlotItems; } set { - if (this._baseSlots != value) + if (this._baseSlotItems != value) { - this._baseSlots = value; + this._baseSlotItems = value; this.RaisePropertyChanged(); } } @@ -48,27 +48,39 @@ public void Update() public void UpdateSlotInfo() { - this.BaseSlots = this.GetUpdateSlotInfo().ToArray(); + this.BaseSlotItems = this.GetUpdateSlotItemInfo().ToArray(); } - protected virtual IEnumerable GetUpdateSlotInfo() + protected virtual IEnumerable GetUpdateSlotItemInfo() { return DataProvider.Items.Values - .Where(this.FilterBaseSlot) - .Select(bSlot => new BaseSlotViewModel + .Where(this.FilterBaseSlotItem) + .Select(baseItem => new BaseSlotItemViewModel { - Info = bSlot.Info, - UpgradeSlots = bSlot.UpgradeSlots.Values - .Where(upgradeSlot => this.FilterUpgradeSlot(bSlot, upgradeSlot)) - .Select(uSlot => new UpgradeSlotViewModel + Info = baseItem.Info, + UpgradeSlotItems = baseItem.UpgradeSlotItems.Values + .Where(upgradeSlot => this.FilterUpgradeSlotItem(baseItem, upgradeSlot)) + .Select(upgradeItem => new UpgradeSlotItemViewModel { - Info = uSlot.Info, - Level = uSlot.Level, - NeedAssistant = uSlot.Assistants.Values.Any(ship => ship.ShipInfo == null), - Assistants = uSlot.Assistants.Values - .Where(a => this.FilterAssistant(bSlot, uSlot, a)) + Info = upgradeItem.Info, + Level = upgradeItem.Level, + Fuel = upgradeItem.Fuel, + Ammo = upgradeItem.Ammo, + Steel = upgradeItem.Steel, + Bauxite = upgradeItem.Bauxite, + Consumptions = upgradeItem.Consumptions + .Where(c => c.ConsumeCount >= 0) + .Select(c => new ConsumptionViewModel + { + Info = c, + IsDifferent = c.ConsumeSlotItem != null && baseItem.Id != c.ConsumeSlotItem.Id, + }) .ToArray(), - AssistantGroups = uSlot.Assistants.Values.Where(a => this.FilterAssistant(bSlot, uSlot, a)) + NeedAssistant = upgradeItem.Assistants.Values.Any(ship => ship.ShipInfo == null), + Assistants = upgradeItem.Assistants.Values + .Where(a => this.FilterAssistant(baseItem, upgradeItem, a)) + .ToArray(), + AssistantGroups = upgradeItem.Assistants.Values.Where(a => this.FilterAssistant(baseItem, upgradeItem, a)) .GroupBy(assistant => assistant.Week) .Select(group => new AssistantGroupViewModel { @@ -76,23 +88,23 @@ protected virtual IEnumerable GetUpdateSlotInfo() Assistants = group.ToArray(), }).ToArray(), }) - .Where(newSlot => newSlot.NeedAssistant || newSlot.Assistants.Length > 0) + .Where(newItem => newItem.NeedAssistant || newItem.Assistants.Length > 0) .ToArray(), }) - .Where(item => item.UpgradeSlots.Length > 0); + .Where(item => item.UpgradeSlotItems.Length > 0); } - protected virtual bool FilterBaseSlot(BaseSlotInfo baseSlot) + protected virtual bool FilterBaseSlotItem(BaseSlotItemInfo baseSlotItem) { return true; } - protected virtual bool FilterUpgradeSlot(BaseSlotInfo baseSlot, UpgradeSlotInfo upgradeSlot) + protected virtual bool FilterUpgradeSlotItem(BaseSlotItemInfo baseSlotItem, UpgradeSlotItemInfo upgradeSlotItem) { return true; } - protected virtual bool FilterAssistant(BaseSlotInfo baseSlot, UpgradeSlotInfo upgradeSlot, AssistantInfo assistant) + protected virtual bool FilterAssistant(BaseSlotItemInfo baseSlotItem, UpgradeSlotItemInfo upgradeSlotItem, AssistantInfo assistant) { return true; } diff --git a/RemodelHelper/ViewModels/SlotTypeViewModel.cs b/RemodelHelper/ViewModels/SlotItemTypeViewModel.cs similarity index 89% rename from RemodelHelper/ViewModels/SlotTypeViewModel.cs rename to RemodelHelper/ViewModels/SlotItemTypeViewModel.cs index 4f30845..84a7205 100644 --- a/RemodelHelper/ViewModels/SlotTypeViewModel.cs +++ b/RemodelHelper/ViewModels/SlotItemTypeViewModel.cs @@ -10,7 +10,7 @@ namespace RemodelHelper.ViewModels { public delegate void SelectionChangedEvent(bool selected); - public class SlotTypeViewModel : ViewModel, IEquatable + public class SlotItemTypeViewModel : ViewModel, IEquatable { public Action SelectionChangedAction { get; set; } @@ -34,7 +34,7 @@ public bool IsSelected } } - public SlotTypeViewModel(SlotItemEquipType type) + public SlotItemTypeViewModel(SlotItemEquipType type) { this.Id = type.Id; this.Name = type.Name; diff --git a/RemodelHelper/ViewModels/SlotViewModel.cs b/RemodelHelper/ViewModels/SlotItemViewModel.cs similarity index 62% rename from RemodelHelper/ViewModels/SlotViewModel.cs rename to RemodelHelper/ViewModels/SlotItemViewModel.cs index 4a8f70a..8d1da5c 100644 --- a/RemodelHelper/ViewModels/SlotViewModel.cs +++ b/RemodelHelper/ViewModels/SlotItemViewModel.cs @@ -11,28 +11,38 @@ namespace RemodelHelper.ViewModels { - public class SlotViewModel : ViewModel + public class SlotItemViewModel : ViewModel { public SlotItemInfo Info { get; set; } } - public class BaseSlotViewModel : SlotViewModel + public class BaseSlotItemViewModel : SlotItemViewModel { - public UpgradeSlotViewModel[] UpgradeSlots { get; set; } + public UpgradeSlotItemViewModel[] UpgradeSlotItems { get; set; } public bool IsAvailable(DayOfWeek day) { - return this.UpgradeSlots.Any(slot => slot.IsAvailable(day)); + return this.UpgradeSlotItems.Any(slot => slot.IsAvailable(day)); } } - public class UpgradeSlotViewModel : SlotViewModel + public class UpgradeSlotItemViewModel : SlotItemViewModel { public string Name => this.Info?.Name ?? "更新不可"; public int Level { get; set; } + public int Fuel { get; set; } + + public int Ammo { get; set; } + + public int Steel { get; set; } + + public int Bauxite { get; set; } + + public ConsumptionViewModel[] Consumptions { get; set; } + public bool NeedAssistant { get; set; } public AssistantInfo[] Assistants { get; set; } diff --git a/RemodelHelper/ViewModels/ToolViewModel.cs b/RemodelHelper/ViewModels/ToolViewModel.cs index 69e90fb..f17100b 100644 --- a/RemodelHelper/ViewModels/ToolViewModel.cs +++ b/RemodelHelper/ViewModels/ToolViewModel.cs @@ -61,21 +61,21 @@ public ToolViewModel() .AddTo(this); } - protected override IEnumerable GetUpdateSlotInfo() + protected override IEnumerable GetUpdateSlotItemInfo() { - return base.GetUpdateSlotInfo().Where(item => item.IsAvailable(this.CurrentDay)); + return base.GetUpdateSlotItemInfo().Where(item => item.IsAvailable(this.CurrentDay)); } - protected override bool FilterBaseSlot(BaseSlotInfo baseSlot) + protected override bool FilterBaseSlotItem(BaseSlotItemInfo baseSlotItem) { - if (!baseSlot.IsAvailable(this.CurrentDay)) return false; + if (!baseSlotItem.IsAvailable(this.CurrentDay)) return false; - return base.FilterBaseSlot(baseSlot); + return base.FilterBaseSlotItem(baseSlotItem); } - protected override bool FilterAssistant(BaseSlotInfo baseSlot, UpgradeSlotInfo upgradeSlot, AssistantInfo assistant) + protected override bool FilterAssistant(BaseSlotItemInfo baseSlotItem, UpgradeSlotItemInfo upgradeSlotItem, AssistantInfo assistant) { - return base.FilterAssistant(baseSlot, upgradeSlot, assistant) && assistant.IsAvailable(this.CurrentDay); + return base.FilterAssistant(baseSlotItem, upgradeSlotItem, assistant) && assistant.IsAvailable(this.CurrentDay); } public void OpenDetailWindow() diff --git a/RemodelHelper/Views/DetailWindow.xaml b/RemodelHelper/Views/DetailWindow.xaml index d3e0f84..399c5b5 100644 --- a/RemodelHelper/Views/DetailWindow.xaml +++ b/RemodelHelper/Views/DetailWindow.xaml @@ -13,9 +13,9 @@ Background="{DynamicResource ThemeBrushKey}" Foreground="{DynamicResource ActiveForegroundBrushKey}" FontFamily="{DynamicResource DefaultFontFamilyKey}" - Title="DetailWindow" - Width="800" - Height="720" + Title="改修情报一览" + Width="1100" + Height="800" FontSize="12" IsRestoringWindowPlacement="True" UseLayoutRounding="True" @@ -90,7 +90,7 @@ + ItemsSource="{Binding SlotItemTypes}"> @@ -158,9 +158,13 @@ + + @@ -170,7 +174,7 @@ - - + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + @@ -300,6 +348,11 @@ + + + + + @@ -339,6 +392,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RemodelHelper/Views/ToolView.xaml b/RemodelHelper/Views/ToolView.xaml index c74abcc..218bea1 100644 --- a/RemodelHelper/Views/ToolView.xaml +++ b/RemodelHelper/Views/ToolView.xaml @@ -63,7 +63,7 @@ - - + @@ -147,8 +147,8 @@ - - +