void AppendShipData(KanColleLib.TransmissionData.api_get_member.values.ShipValue ship) { bool is_found = false; for (int i = 0; i < shipdata.Count; i++) { if (shipdata[i].shipid == ship.id) { is_found = true; shipdata[i].FromKanColleLib(ship); } } if (!is_found) { var temp = new ShipData(); temp.FromKanColleLib(ship); shipdata.Add(temp); } }
public void FromKanColleLib(KanColleLib.TransmissionData.api_get_member.values.ShipValue data) { shipid = data.id; characterid = data.ship_id; level = data.lv; exp_total = data.exp[0]; exp_to_next_lv = data.exp[1]; exp_percent_in_this_lv = data.exp[2]; hp_now = data.nowhp; hp_max = data.maxhp; condition = data.cond; fuel = data.fuel; ammo = data.bull; ndock_time = TimeSpan.FromMilliseconds(data.ndock_time); for (int i = 0; i < data.slotnum; i++) { int slot = data.slot.Length > i ? data.slot[i] : -1; if (Slots.Count > i) { if (Slots[i] != slot) { Slots[i] = slot; } } else { Slots.Add(slot); } int onslotcount = data.onslot.Length > i ? data.onslot[i] : 0; if (OnSlotCount.Count > i) { if (OnSlotCount[i] != onslotcount) { OnSlotCount[i] = onslotcount; } } else { OnSlotCount.Add(onslotcount); } } int slotovercount = Slots.Count - data.slotnum; for (int i = 0; i < slotovercount; i++) { Slots.RemoveAt(Slots.Count - 1); } int onslotcountovercount = OnSlotCount.Count - data.slotnum; for (int i = 0; i < onslotcountovercount; i++) { OnSlotCount.RemoveAt(Slots.Count - 1); } air_mastery = Tools.KanColleTools.ShipAirMastery(this); fire_power = data.karyoku[0]; armor = data.soukou[0]; torpedo = data.raisou[0]; evasion = data.kaihi[0]; anti_air = data.taiku[0]; anti_submarine = data.taisen[0]; reconnaissance = data.sakuteki[0]; luck = data.lucky[0]; }