private void ParseData() { if (!KanColleClient.Current.IsStarted || this.RawData == null) { return; // 初始化未完成 } lock (this._updateLock) { this.IsReady = false; var newItems = new IdentifiableTable <BaseSlotItemInfo>(); foreach (var item in this.RawData.Items.Where(item => item.GetBaseSlotInfo() != null)) { if (!newItems.ContainsKey(item.SlotId)) { newItems.Add(new BaseSlotItemInfo(item)); } else { newItems[item.SlotId].AddUpgradeSlotItem(item); } } foreach (var item in newItems.Values) { 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; this.IsReady = true; } }
private void ParseData() { if (!KanColleClient.Current.IsStarted || this.RawData == null) return; // 初始化未完成 lock (this._updateLock) { this.IsReady = false; var newItems = new IdentifiableTable<BaseSlotItemInfo>(); foreach (var item in this.RawData.Items.Where(item => item.GetBaseSlotInfo() != null)) { if (!newItems.ContainsKey(item.SlotId)) newItems.Add(new BaseSlotItemInfo(item)); else newItems[item.SlotId].AddUpgradeSlotItem(item); } foreach (var item in newItems.Values) 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; this.IsReady = true; } }