/// <summary> /// コンストラクタ /// </summary> /// <param name="info">艦隊情報</param> public ShipStatus(KCB.api_get_member.ApiDataShip it, int order, MasterData.Ship masterShip, MemberData.Item memberItem) { Order = order; Name = masterShip.LookupShipMaster(it.api_ship_id).Name; Condition = it.api_cond; HP = new MemberData.Ship.Info.NowMax(it.api_nowhp, it.api_maxhp); DamageControl = false; foreach (var item in it.api_slot) { if (item < 0) { continue; } var item_info = memberItem.GetItem(item); if (item_info == null) { continue; } if (item_info.TypeNum == 14) { DamageControl = true; break; } } }
/// <summary> /// 艦船マスターの更新 /// </summary> /// <param name="shipMaster"></param> public void UpdateMaster(MasterData.Ship shipMaster, MasterData.Item itemMaster) { if (InvokeRequired) { BeginInvoke((MethodInvoker)(() => _updateMasterData(shipMaster, itemMaster))); } else { _updateMasterData(shipMaster, itemMaster); } }
/// <summary> /// 艦船の状態を更新する。shipDataは艦隊情報が更新されていると仮定している /// ジョブキュースレッドから呼ばれる /// /kcsapi/api_get_member/ship_deck /// </summary> /// <param name="shipData"></param> public void UpdateShipStatus(KCB.api_get_member.Ship_Deck shipDeck, MasterData.Ship masterShip, MemberData.Item memberItem) { Debug.WriteLine("Updating ShipStatus"); Dictionary <int, int> shipOrder = new Dictionary <int, int>(); foreach (var it in shipDeck.api_data.api_deck_data) { int id = it.api_id - 1; int order = 0; foreach (var it2 in it.api_ship) { if (it2 < 0) { continue; } shipOrder[it2] = order + id * 6; order++; } } lock (((IList)_shipList).SyncRoot) { _shipList.Clear(); foreach (var it in shipDeck.api_data.api_ship_data) { _shipList.Add(new ShipStatus(it, shipOrder[it.api_id], masterShip, memberItem)); } _shipList.Sort(); bUpdateCompleted = true; } #if DEBUG foreach (var it in _shipList) { Debug.WriteLine(it); } #endif }
void _updateMasterData(MasterData.Ship shipMaster, MasterData.Item itemMaster) { lvShip.BeginUpdate(); lvShip.Items.Clear(); lvShip.Items.AddRange(shipMaster.GetMasterLVItemList()); lvShip.EndUpdate(); lvSlotItem.BeginUpdate(); lvSlotItem.Items.Clear(); lvSlotItem.Items.AddRange(itemMaster.GetLVList()); lvSlotItem.EndUpdate(); lvSType.BeginUpdate(); lvSType.Items.Clear(); MasterData.Ship.ShipTypeLVItem.InitializeColumn(itemMaster, lvSType); lvSType.LoadColumnWithOrder(Properties.Settings.Default.MasterShipTypeColumnWidth); lvSType.Items.AddRange(shipMaster.GetMasterSTypeLVItems()); lvSType.EndUpdate(); }