示例#1
0
        private void SetSquadrons(string apiname, dynamic data)
        {
            foreach (var elem in data)
            {
                int id = (int)elem.api_squadron_id;

                if (!Squadrons.ContainsKey(id))
                {
                    var a = new BaseAirCorpsSquadron();
                    a.LoadFromResponse(apiname, elem);
                    Squadrons.Add(a);
                }
                else
                {
                    Squadrons[id].LoadFromResponse(apiname, elem);
                }
            }
        }
示例#2
0
        public void UpdateApiStart2(dynamic data)
        {
            string APIName = "api_start2";

            if (data.api_data != null && data.api_result == 1)
            {
                data = data.api_data;
            }

            //特別置換処理
            data.api_mst_stype[7].api_name = "巡洋戦艦";

            //api_mst_ship
            foreach (var elem in data.api_mst_ship)
            {
                int id = (int)elem.api_id;
                if (MasterShips[id] == null)
                {
                    var ship = new ShipDataMaster();
                    ship.LoadFromResponse(APIName, elem);
                    m_newAddedMasterShips.Add(ship);
                }
                else if (!JToken.DeepEquals(MasterShips[id].RawData, elem))
                {
                    var ship = new ShipDataMaster();
                    ship.LoadFromResponse(APIName, elem);
                    m_updatedMasterShips.Add(ship);
                }
            }

            //api_mst_shipgraph
            foreach (var elem in data.api_mst_shipgraph)
            {
                int            id   = (int)elem.api_id;
                ShipDataMaster ship = m_updatedMasterShips[id];
                if (ship != null)
                {
                    ship.ResourceName = elem.api_filename;
                    dynamic versions = elem.api_version;
                    ship.ResourceGraphicVersion   = versions[0];
                    ship.ResourceVoiceVersion     = versions[1];
                    ship.ResourcePortVoiceVersion = versions[2];
                }
                ship = m_newAddedMasterShips[id];
                if (ship != null)
                {
                    ship.ResourceName = elem.api_filename;
                    dynamic versions = elem.api_version;
                    ship.ResourceGraphicVersion   = versions[0];
                    ship.ResourceVoiceVersion     = versions[1];
                    ship.ResourcePortVoiceVersion = versions[2];
                }
            }

            //api_mst_slotitem_equiptype
            foreach (var elem in data.api_mst_slotitem_equiptype)
            {
                int id = (int)elem.api_id;
                if (EquipmentTypes[id] == null)
                {
                    var eqt = new EquipmentType();
                    eqt.LoadFromResponse(APIName, elem);
                    m_newAddedEquipmentTypes.Add(eqt);
                }
                else if (!JToken.DeepEquals(EquipmentTypes[id].RawData, elem))
                {
                    var eqt = new EquipmentType();
                    eqt.LoadFromResponse(APIName, elem);
                    m_updatedEquipmentTypes.Add(eqt);
                }
            }

            //api_mst_stype
            foreach (var elem in data.api_mst_stype)
            {
                int id = (int)elem.api_id;
                if (ShipTypes[id] == null)
                {
                    var spt = new ShipType();
                    spt.LoadFromResponse(APIName, elem);
                    m_newAddedShipTypes.Add(spt);
                }
                else
                {
                    var spt = new ShipType();
                    spt.LoadFromResponse(APIName, elem);
                    if (!JToken.DeepEquals(ShipTypes[id].RawData, spt.RawData))
                    {
                        m_updatedShipTypes.Add(spt);
                    }
                }
            }

            //api_mst_slotitem
            foreach (var elem in data.api_mst_slotitem)
            {
                int id = (int)elem.api_id;
                if (MasterEquipments[id] == null)
                {
                    var eq = new EquipmentDataMaster();
                    eq.LoadFromResponse(APIName, elem);
                    m_newAddedEquipmentDataMaster.Add(eq);
                }
                else if (!JToken.DeepEquals(MasterEquipments[id].RawData, elem))
                {
                    var eq = new EquipmentDataMaster();
                    eq.LoadFromResponse(APIName, elem);
                    m_updatedEquipmentDataMaster.Add(eq);
                }
            }

            //api_mst_useitem
            foreach (var elem in data.api_mst_useitem)
            {
                int id = (int)elem.api_id;
                if (MasterUseItems[id] == null)
                {
                    var item = new UseItemMaster();
                    item.LoadFromResponse(APIName, elem);
                    m_newAddedUseItemMaster.Add(item);
                }
                else if (!JToken.DeepEquals(MasterUseItems[id].RawData, elem))
                {
                    var item = new UseItemMaster();
                    item.LoadFromResponse(APIName, elem);
                    m_updatedUseItemMaster.Add(item);
                }
            }

            //api_mst_maparea
            foreach (var elem in data.api_mst_maparea)
            {
                int id = (int)elem.api_id;
                if (MapArea[id] == null)
                {
                    var item = new MapAreaData();
                    item.LoadFromResponse(APIName, elem);
                    m_newAddedMapAreaData.Add(item);
                }
                else if (!JToken.DeepEquals(MapArea[id].RawData, elem))
                {
                    var item = new MapAreaData();
                    item.LoadFromResponse(APIName, elem);
                    m_updatedMapAreaData.Add(item);
                }
            }

            //api_mst_mapinfo
            foreach (var elem in data.api_mst_mapinfo)
            {
                int id = (int)elem.api_id;
                if (MapInfo[id] == null)
                {
                    var item = new MapInfoData();
                    item.LoadFromResponse(APIName, elem);
                    m_newAddedMapInfoData.Add(item);
                }
                else if (!JToken.DeepEquals(MapInfo[id].RawData, elem))
                {
                    var item = new MapInfoData();
                    item.LoadFromResponse(APIName, elem);
                    m_updatedMapInfoData.Add(item);
                }
            }

            //api_mst_mission
            foreach (var elem in data.api_mst_mission)
            {
                int id = (int)elem.api_id;
                if (Mission[id] == null)
                {
                    var item = new MissionData();
                    item.LoadFromResponse(APIName, elem);
                    m_newAddedMissionData.Add(item);
                }
                else if (!JToken.DeepEquals(Mission[id].RawData, elem))
                {
                    var item = new MissionData();
                    item.LoadFromResponse(APIName, elem);
                    m_updatedMissionData.Add(item);
                }
            }
        }
示例#3
0
        public void InitializeApiStart2(dynamic data)
        {
            string APIName = "api_start2";

            if (data.api_data != null && data.api_result == 1)
            {
                data = data.api_data;
            }

            //特別置換処理
            data.api_mst_stype[7].api_name = "巡洋戦艦";

            ClearUpdated();

            //api_mst_ship
            foreach (var elem in data.api_mst_ship)
            {
                int id = (int)elem.api_id;
                if (MasterShips[id] == null)
                {
                    var ship = new ShipDataMaster();
                    ship.LoadFromResponse(APIName, elem);
                    MasterShips.Add(ship);
                }
                else
                {
                    MasterShips[id].LoadFromResponse(APIName, elem);
                }
            }

            //改装関連のデータ設定
            foreach (var ship in MasterShips)
            {
                var remodelID = ship.Value.RemodelAfterShipID;
                if (remodelID != 0)
                {
                    MasterShips[remodelID].RemodelBeforeShipID = ship.Key;
                }
            }

            //api_mst_shipgraph
            foreach (var elem in data.api_mst_shipgraph)
            {
                int            id   = (int)elem.api_id;
                ShipDataMaster ship = MasterShips[id];
                if (ship != null)
                {
                    ship.ResourceName = elem.api_filename;
                    dynamic versions = elem.api_version;
                    ship.ResourceGraphicVersion   = versions[0];
                    ship.ResourceVoiceVersion     = versions[1];
                    ship.ResourcePortVoiceVersion = versions[2];
                }
            }

            //api_mst_slotitem_equiptype
            foreach (var elem in data.api_mst_slotitem_equiptype)
            {
                int id = (int)elem.api_id;
                if (EquipmentTypes[id] == null)
                {
                    var eqt = new EquipmentType();
                    eqt.LoadFromResponse(APIName, elem);
                    EquipmentTypes.Add(eqt);
                }
                else
                {
                    EquipmentTypes[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_stype
            foreach (var elem in data.api_mst_stype)
            {
                int id = (int)elem.api_id;
                if (ShipTypes[id] == null)
                {
                    var spt = new ShipType();
                    spt.LoadFromResponse(APIName, elem);
                    ShipTypes.Add(spt);
                }
                else
                {
                    ShipTypes[id].LoadFromResponse(APIName, elem);
                }
            }


            //api_mst_slotitem
            foreach (var elem in data.api_mst_slotitem)
            {
                int id = (int)elem.api_id;
                if (MasterEquipments[id] == null)
                {
                    var eq = new EquipmentDataMaster();
                    eq.LoadFromResponse(APIName, elem);
                    MasterEquipments.Add(eq);
                }
                else
                {
                    MasterEquipments[id].LoadFromResponse(APIName, elem);
                }
            }

            //api_mst_slotitemgraph

            /*
             *          foreach ( var elem in data.api_mst_slotitemgraph ) {
             *
             *                  int id = (int)elem.api_id;
             *                  EquipmentDataMaster eq = db.MasterEquipments[id];
             *                  if ( eq != null ) {
             *                          eq.ResourceVersion = elem.api_version;
             *                  }
             *          }
             */

            //api_mst_useitem
            foreach (var elem in data.api_mst_useitem)
            {
                int id = (int)elem.api_id;
                if (MasterUseItems[id] == null)
                {
                    var item = new UseItemMaster();
                    item.LoadFromResponse(APIName, elem);
                    MasterUseItems.Add(item);
                }
                else
                {
                    MasterUseItems[id].LoadFromResponse(APIName, elem);
                }
            }

            //api_mst_maparea
            foreach (var elem in data.api_mst_maparea)
            {
                int id = (int)elem.api_id;
                if (MapArea[id] == null)
                {
                    var item = new MapAreaData();
                    item.LoadFromResponse(APIName, elem);
                    MapArea.Add(item);
                }
                else
                {
                    MapArea[id].LoadFromResponse(APIName, elem);
                }
            }

            //api_mst_mapinfo
            foreach (var elem in data.api_mst_mapinfo)
            {
                int id = (int)elem.api_id;
                if (MapInfo[id] == null)
                {
                    var item = new MapInfoData();
                    item.LoadFromResponse(APIName, elem);
                    MapInfo.Add(item);
                }
                else
                {
                    MapInfo[id].LoadFromResponse(APIName, elem);
                }
            }

            //api_mst_mission
            foreach (var elem in data.api_mst_mission)
            {
                int id = (int)elem.api_id;
                if (Mission[id] == null)
                {
                    var item = new MissionData();
                    item.LoadFromResponse(APIName, elem);
                    Mission.Add(item);
                }
                else
                {
                    Mission[id].LoadFromResponse(APIName, elem);
                }
            }

            //api_mst_shipupgrade
            Dictionary <int, int> upgradeLevels = new Dictionary <int, int>();

            foreach (var elem in data.api_mst_shipupgrade)
            {
                int idbefore   = (int)elem.api_current_ship_id;
                int idafter    = (int)elem.api_id;
                var shipbefore = MasterShips[idbefore];
                var shipafter  = MasterShips[idafter];
                int level      = (int)elem.api_upgrade_level;

                if (upgradeLevels.ContainsKey(idafter))
                {
                    if (level < upgradeLevels[idafter])
                    {
                        shipafter.RemodelBeforeShipID = idbefore;
                        upgradeLevels[idafter]        = level;
                    }
                }
                else
                {
                    shipafter.RemodelBeforeShipID = idbefore;
                    upgradeLevels.Add(idafter, level);
                }

                if (shipbefore != null)
                {
                    shipbefore.NeedBlueprint = (int)elem.api_drawing_count;
                    shipbefore.NeedCatapult  = (int)elem.api_catapult_count;
                }
            }
        }