Example #1
0
        /// <summary>
        /// /kcsapi/api_req_kaisou/slot_deprive
        /// </summary>
        /// <param name="queryParam"></param>
        /// <param name="responseJson"></param>
        /// <param name="_memberShip"></param>
        /// <param name="_memberItem"></param>
        void PullOutSlotItem(IDictionary <string, string> queryParam, string responseJson,
                             MemberData.Ship _memberShip, MemberData.Item _memberItem)
        {
            int srcShipId, dstShipId;

            if (!int.TryParse(queryParam["api_unset_ship"], out srcShipId) ||
                !int.TryParse(queryParam["api_set_ship"], out dstShipId))
            {
                return;
            }

            var json = JsonConvert.DeserializeObject <KCB.api_req_kaisou.SlotDeprive>(responseJson);

            if (json.api_result != 1)
            {
                return;
            }

            // 装備装着先変更
            _memberShip.LoadShipInfo(new List <KCB.api_get_member.ApiDataShip>()
            {
                json.api_data.api_ship_data.api_unset_ship
            }
                                     , _masterShip, json.api_data.api_ship_data.api_unset_ship.api_id);
            _memberShip.LoadShipInfo(new List <KCB.api_get_member.ApiDataShip>()
            {
                json.api_data.api_ship_data.api_set_ship
            }
                                     , _masterShip, json.api_data.api_ship_data.api_set_ship.api_id);

            _memberItem.UpdateItemOwnerShip(_memberShip);

            _memberShip.ApplySlotItemData(_memberItem);
            _memberShip.UpdateDeckInfo(_memberDeck);

            UpdateDetailStatus("装備を引き抜き装着しました");

            _parent.UpdateSlotItemInfo(json.api_data.api_ship_data.api_unset_ship.api_id);
            _parent.UpdateSlotItemInfo(json.api_data.api_ship_data.api_set_ship.api_id);
        }
Example #2
0
            /// <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;
                    }
                }
            }
Example #3
0
        /// <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
        }