Пример #1
0
    public void Load(string name)
    {
        if (isLoad)
        {
            return;
        }
        isLoad = true;


        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

        LitJson.JSONNode json = LitJson.JSON.Parse(content);


        dataBattles = new List <DataBattle> ();
//		dataBattlesNormal = new Dictionary<int, DataBattle> ();
//		dataBattlesElite = new Dictionary<int, DataBattle> ();

        foreach (LitJson.JSONNode subNode in json.Childs)
        {
            DataBattle data = new DataBattle();
            data.Load(subNode);

            dataBattles.Add(data);
//			if(data.difficulty == DataConfig.MISSION_DIFFICULTY.NORMAL)
//			{
//				dataBattlesNormal.Add (data.chapter, data);
//			}
//			else
//			{
//				dataBattlesElite.Add (data.chapter, data);
//			}
        }
    }
Пример #2
0
    public void Load(string name)
    {
        if (isLoad)
        {
            return;
        }
        isLoad = true;

        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

        LitJson.JSONNode json = LitJson.JSON.Parse(content);

        dataUnits = new Dictionary <int, DataUnit> ();

        foreach (LitJson.JSONNode subNode in json.Childs)
        {
            DataUnit unit = new DataUnit();
            unit.Load(subNode);

            Assert.assert(GetUnitUnlockWithItem(unit.chipId) == null, "one chip link to multi items");

            dataUnits.Add(unit.id, unit);
        }
    }
Пример #3
0
 public void Load(LitJson.JSONNode json)
 {
     errorCode = JsonReader.Int(json, "ErrorCode");
     operation = JsonReader.Int(json, "Operation");
     message   = json["Message"];
     detial    = json["Detail"];
 }
Пример #4
0
 public void Load(LitJson.JSONNode json)
 {
     level      = int.Parse(json["Lv"]);
     honor      = int.Parse(json["Honor"]);
     Leadership = int.Parse(json["Leadership"]);
     Energy     = int.Parse(json["Energy"]);
 }
Пример #5
0
    public void Load(string name)
    {
        if (isLoad)
        {
            return;
        }
        isLoad = true;

        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

        LitJson.JSONNode json = LitJson.JSON.Parse(content);

        dataMissions = new Dictionary <int, DataMission> ();

        foreach (LitJson.JSONNode subNode in json.Childs)
        {
            DataMission data = new DataMission();
            data.Load(subNode);

            /*
             * Dictionary<int, DataMission> missions;
             * dataMissions.TryGetValue((int)data.difficulty, out missions);
             * if(missions == null)
             * {
             *      missions = new Dictionary<int, DataMission>();
             *      dataMissions.Add((int)data.difficulty, missions);
             * }
             */

            dataMissions.Add(data.magicId, data);
        }

        CollectChapterData();
    }
Пример #6
0
    public void Load(LitJson.JSONNode json)
    {
        type        = JsonReader.Int(json, "Type");
        id          = JsonReader.Int(json, "ID");
        level       = JsonReader.Int(json, "Level");
        playerLevel = JsonReader.Int(json, "PlayerLevel");
        openLevel   = JsonReader.Int(json, "OpenLevel");

        string str_buildingID = json ["BuildingID"];

        buildingID = StringHelper.ReadIntArrayFromString(str_buildingID);
        string str_buildingLevel = json ["BuildingLevel"];

        buildingLevel = StringHelper.ReadIntArrayFromString(str_buildingLevel);
        upgradeCash   = JsonReader.Float(json, "UpgradeCash");

        categoryId = JsonReader.Int(json, "CategoryID");
        name       = json ["Name"];
        assset     = json ["Asset"];

        description = json["Description"];

        cost = new DataUnit.BasicCost();
        cost.Load(json);
    }
Пример #7
0
    public void Load(string name)
    {
        if (isLoad)
        {
            return;
        }
        isLoad = true;


        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

        LitJson.JSONNode json = LitJson.JSON.Parse(content);

        dataUnitParts = new Dictionary <int, Dictionary <int, DataUnitPart> > ();

        foreach (LitJson.JSONNode subNode in json.Childs)
        {
            DataUnitPart data = new DataUnitPart();
            data.Load(subNode);

            Dictionary <int, DataUnitPart> parts;
            dataUnitParts.TryGetValue(data.id, out parts);
            if (parts == null)
            {
                parts = new Dictionary <int, DataUnitPart>();
                dataUnitParts.Add(data.id, parts);
            }

            parts.Add(data.level, data);
        }
    }
Пример #8
0
    public void Load(LitJson.JSONNode json)
    {
        resourcesMin = JsonReader.Int(json, "ResourcesMin");

        foodDiscount  = JsonReader.Float(json, "FoodDiscount");
        oilDiscount   = JsonReader.Float(json, "OilDiscount");
        metalDiscount = JsonReader.Float(json, "MetalDiscount");
        rareDiscount  = JsonReader.Float(json, "RareDiscount");
    }
Пример #9
0
 public void Load(LitJson.JSONNode json)
 {
     //type = int.Parse (json ["Type"]);
     //id = int.Parse (json ["ID"]);
     level        = int.Parse(json ["Level"]);
     resourceType = int.Parse(json ["ResourceType"]);
     produceSpeed = float.Parse(json ["ProduceSpeed"]);
     capacity     = float.Parse(json ["Capacity"]);
 }
Пример #10
0
 public void Load(LitJson.JSONNode json)
 {
     costTime  = JsonReader.Int(json, "TimeCost");
     costFood  = JsonReader.Int(json, "FoodCost");
     costOil   = JsonReader.Int(json, "OilCost");
     costMetal = JsonReader.Int(json, "MetalCost");
     costRare  = JsonReader.Int(json, "RareCost");
     costCash  = JsonReader.Int(json, "CashCost");
 }
Пример #11
0
    public void Load(LitJson.JSONNode json)
    {
        level = JsonReader.Int(json, "Lv");
        Assert.assert(level > 0);

        for (int i = 0; i < qualityExp.Length; ++i)
        {
            qualityExp[i] = JsonReader.Int(json, "Quality_" + (i + 1));
        }
    }
Пример #12
0
    public void Load(LitJson.JSONNode json)
    {
        magicId = int.Parse(json["ID"]);
        name    = json ["Name"];
        ParseStageMissionId(magicId);
//		difficulty = (DataConfig.MISSION_DIFFICULTY)int.Parse(json["Difficulty"]);

        string str_teamsId = json["TeamsID"];

        teamsId = StringHelper.ReadIntArrayFromString(str_teamsId);

        playerRotation = JsonReader.Float(json, "PlayerRotate");

        string str_teamsRotation = json["TeamsRotation"];

        teamsRotation = StringHelper.ReadFloatArrayFromString(str_teamsRotation);

        Assert.assert(teamsId.Length == teamsRotation.Length);

        powerScale = float.Parse(json["PowerScale"]);

        asset = json ["BattleBackground"];

        honor       = JsonReader.Int(json, "Honor");
        exp         = JsonReader.Int(json, "Exp");
        itemGroupId = JsonReader.Int(json, "ItemGroupID");
        evaluate    = JsonReader.Int(json, "Evaluate");

//		string str_itemsId = json["Item"];
//		itemsId = StringHelper.ReadIntArrayFromString (str_itemsId);

        EnergyCost  = JsonReader.Int(json, "EnergyCost");
        Star        = JsonReader.Int(json, "Star");
        PlayerLevel = JsonReader.Int(json, "PlayerLevel");

        string str_rateIds = json["RateIDs"];

        RateIds = StringHelper.ReadIntArrayFromString(str_rateIds);
        if (RateIds.Length < 2)
        {
            RateIds = ArrayHelper.Fill <int> (RateIds, 0, 2 - RateIds.Length);
        }

        for (int i = 0; i < ARROW_COUNT_MAX; ++i)
        {
            string arrowContent = json ["Arrow" + (i + 1)];
            DataConfig.CAMPAIGN_ARROW arrow;
            float arrowRot;
            ReadArrow(arrowContent, out arrow, out arrowRot);

            arrows[i]         = arrow;
            arrowsRotation[i] = arrowRot;
        }
    }
Пример #13
0
    public void Load(LitJson.JSONNode json)
    {
        type  = (TYPE)int.Parse(json["ID"]);
        level = int.Parse(json["Level"]);

        effect      = JsonReader.Float(json, "Effect");
        effectRange = JsonReader.Float(json, "EffectRange");
        hintRange   = JsonReader.Float(json, "HintRange");
        duration    = JsonReader.Float(json, "Duration");
        name        = json["Name"];
    }
Пример #14
0
    public void Load(LitJson.JSONNode json)
    {
        rank   = int.Parse(json["Rank"]);
        honor  = int.Parse(json["Honor"]);
        cash   = int.Parse(json["Cash"]);
        combat = int.Parse(json["Combat"]);

        itemId    = JsonReader.Int(json, "Item");
        itemNum   = JsonReader.Int(json, "ItemNum");
        dropGroup = int.Parse(json["DropGroup"]);
    }
Пример #15
0
    public static float Float(LitJson.JSONNode json, string key)
    {
        string field = json [key];

        if (field == null || field == "")
        {
            return(0);
        }

        return(float.Parse(field));
    }
Пример #16
0
    public void Load(LitJson.JSONNode json)
    {
        id = JsonReader.Int(json, "ID");

        kTank    = JsonReader.Float(json, "Tank");
        kGun     = JsonReader.Float(json, "Gun");
        kMissile = JsonReader.Float(json, "Missile");
        kCannon  = JsonReader.Float(json, "Cannon");
        kUnknown = JsonReader.Float(json, "Unknown");
        quality  = JsonReader.Int(json, "Quality");
        skill    = (DataSkill.TYPE)JsonReader.Int(json, "Skill");
    }
Пример #17
0
    public void Load(LitJson.JSONNode json)
    {
        id      = JsonReader.Int(json, "ID");
        chapter = JsonReader.Int(json, "Chapter");
//		preChapter = JsonReader.Int (json, "PreChapter");
        difficulty = (DataConfig.MISSION_DIFFICULTY)JsonReader.Int(json, "Difficulty");

//		string missionsStr = json["MissionIDs"];
//		missionIds = StringHelper.ReadIntArrayFromString (missionsStr);

//		difficulty = (preChapter > 0) ? DataConfig.MISSION_DIFFICULTY.ELITE : DataConfig.MISSION_DIFFICULTY.NORMAL;
    }
Пример #18
0
    public void Load(LitJson.JSONNode json)
    {
        id = int.Parse(json["ID"]);

        battleParam = new BasicBattleParam();
        battleParam.Load(json);

        name       = json["Name"];
        asset      = json["Asset"];
        bulletType = (DataConfig.BULLET_TYPE) int.Parse(json ["CannonType"]);
        bodyType   = (DataConfig.BODY_TYPE) int.Parse(json ["BodyType"]);
        quality    = JsonReader.Int(json, "Quality");

        targetSelect = (DataConfig.TARGET_SELECT)JsonReader.Int(json, "targetSelect");
        shootCD      = JsonReader.Float(json, "shootCD");    //5;

        shootRange = JsonReader.Float(json, "shootRange");   //150;
        closeRange = JsonReader.Float(json, "closeRange");   //80;
        fightRange = JsonReader.Float(json, "fightRange");   //40;
//		Assert.assert (shootRange >= closeRange);
        Assert.assert(closeRange >= fightRange);

        stopToFire      = true;                                      //int.Parse (json ["stopToFire"]) != 0;
        canStandTurn    = JsonReader.Int(json, "canStandTurn") != 0;
        firePrepareTime = JsonReader.Float(json, "firePrepareTime"); //1;
        damageRange     = JsonReader.Float(json, "damageRange");
        length          = JsonReader.Float(json, "length");          //7;
        Assert.assert(length <= MapGrid.GRID_SIZE);
        breakTime = JsonReader.Float(json, "breakTime");             //2;
        speed     = float.Parse(json ["Speed"]);

        costCdCash = JsonReader.Float(json, "CdCash");

        fireCount    = int.Parse(json ["FireCount"]);
        fireInterval = float.Parse(json ["FireInterval"]);
//		shootInterval = float.Parse (json ["ShootInterval"]);
//		targetsPerFire = int.Parse (json ["TargetsPerFire"]);
//		targetsSelectType = (DataConfig.TARGETS_SELECT_TYPE)int.Parse (json ["TargetSelectType"]);

        string str_partsId = json["PartsID"];

        partsId = StringHelper.ReadIntArrayFromString(str_partsId);

        cost = new BasicCost();
        cost.Load(json);

        buildingLevel = int.Parse(json ["BuildingLevel"]);

        repairRate = float.Parse(json ["RepairRate"]);

        chipId    = JsonReader.Int(json, "ChipID");
        chipCount = JsonReader.Int(json, "ChipCount");
    }
Пример #19
0
    public void Load(string name)
    {
        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

        LitJson.JSONNode json = LitJson.JSON.Parse(content);

        foreach (LitJson.JSONNode subNode in json.Childs)
        {
            _dataInitialConfig = new DataInitialConfig();
            _dataInitialConfig.Load(subNode);
        }
    }
Пример #20
0
    public void Load(LitJson.JSONNode json)
    {
        id = JsonReader.Int(json, "ID");

        string cmdStr = json["Command"];

        command = GetCmdCode(cmdStr);

        A = JsonReader.Float(json, "A");
        B = JsonReader.Float(json, "B");

        descript = json["Descript"];
    }
Пример #21
0
    public void Load(LitJson.JSONNode json)
    {
        id = JsonReader.Int(json, "Id");

        command = json["Command"];
        A       = JsonReader.Float(json, "A");
        B       = JsonReader.Float(json, "B");

        title     = json["Title"];
        stepDesc  = json["StepDescript"];
        stepImage = json["StepImage"];

        task = JsonReader.Int(json, "Task");
    }
Пример #22
0
    public void Load(string name)
    {
        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

        LitJson.JSONNode json = LitJson.JSON.Parse(content);

        foreach (LitJson.JSONNode subNode in json.Childs)
        {
            DataDiscount data = new DataDiscount();
            data.Load(subNode);
            _discount.Add(data);
        }
    }
Пример #23
0
        public void Load(LitJson.JSONNode json)
        {
            damage = float.Parse(json ["AP"]);
            ammo   = float.Parse(json ["DP"]);
            hp     = float.Parse(json ["HP"]);
//			speed = 10; //test
            hitRate = float.Parse(json ["HitRate"]);
//			missRate = 1 - hitRate;
            dodgeRate        = float.Parse(json ["DodgeRate"]);
            doubleDamageRate = float.Parse(json ["DoubleDamageRate"]);


            Assert.assert(hitRate >= 0 && hitRate <= 1, "Assert BasicBattleParam hitRate " + hitRate);
        }
Пример #24
0
    public void LoadHerosExp(string name)
    {
        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

        LitJson.JSONNode json = LitJson.JSON.Parse(content);

        foreach (LitJson.JSONNode subNode in json.Childs)
        {
            DataHeroExp data = new DataHeroExp();
            data.Load(subNode);

            heroesExpMap[data.level] = data;
        }
    }
Пример #25
0
    public void Load(LitJson.JSONNode json)
    {
        id           = JsonReader.Int(json, "ID");
        stage        = JsonReader.Int(json, "Stage");
        requireLevel = JsonReader.Int(json, "Lv");

        kAP = JsonReader.Float(json, "AP");
        kDP = JsonReader.Float(json, "DP");
        kHP = JsonReader.Float(json, "HP");

        aLeadership = JsonReader.Int(json, "Leadership");

        itemId    = JsonReader.Int(json, "ItemID");
        itemCount = JsonReader.Int(json, "Count");
    }
Пример #26
0
    public void Load(LitJson.JSONNode json)
    {
        id   = JsonReader.Int(json, "ID");
        name = json ["Name"];
//		level = JsonReader.Int (json, "Level");

        basicParam = new DataUnit.BasicBattleParam();
        basicParam.Load(json);

        leadership = JsonReader.Int(json, "Leadership");
        type       = JsonReader.Int(json, "Arms");
//		exp = JsonReader.Int (json, "Exp");

//		skill = (DataSkill.TYPE)JsonReader.Int (json, "Skill");
//		quality = JsonReader.Int (json, "Quality");
    }
Пример #27
0
    public void Load(LitJson.JSONNode json)
    {
        id = int.Parse(json["ID"]);

        string str_unitId = json["EnemiesID"];

        unitId = StringHelper.ReadIntArrayFromString(str_unitId);

        string str_unitCount = json["EnemiesCount"];

        unitCount = StringHelper.ReadIntArrayFromString(str_unitCount);

        Assert.assert(unitId.Length == unitCount.Length);
        memberCount = unitId.Length;
        Assert.assert(memberCount > 0);
    }
Пример #28
0
    public void Load(string name)
    {
        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

        LitJson.JSONNode json = LitJson.JSON.Parse(content);

        _dataErrorCodes = new Dictionary <int, DataErrorCode> ();

        foreach (LitJson.JSONNode subNode in json.Childs)
        {
            DataErrorCode data = new DataErrorCode();
            data.Load(subNode);
            _dataErrorCodes.Add(data.errorCode, data);
        }
    }
Пример #29
0
    public void Load(LitJson.JSONNode json)
    {
        initCash  = JsonReader.Float(json, "Cash");
        initFood  = JsonReader.Float(json, "Food");
        intiOil   = JsonReader.Float(json, "Oil");
        initMetal = JsonReader.Float(json, "Metal");
        initRare  = JsonReader.Float(json, "Rare");

        unitCashFactor     = JsonReader.Float(json, "UnitCash");
        buildingCashFactor = JsonReader.Float(json, "BuildingCash");
        skillCashFactor    = JsonReader.Float(json, "SkillCash");

        foodToCashRate  = JsonReader.Float(json, "FoodCash");
        oilToCashRate   = JsonReader.Float(json, "OilCash");
        metalToCashRate = JsonReader.Float(json, "MetalCash");
        rareToCashRate  = JsonReader.Float(json, "RareCash");
    }
Пример #30
0
    public void Load(string name)
    {
        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

        LitJson.JSONNode json = LitJson.JSON.Parse(content);

        _leadersMap = new Dictionary <int, DataLeader> ();

        foreach (LitJson.JSONNode subNode in json.Childs)
        {
            DataLeader data = new DataLeader();
            data.Load(subNode);

            _leadersMap.Add(data.level, data);
        }
    }
		public override void Add (string aKey, JSONNode aItem)
		{
			var tmp = new JSONClass();
			tmp.Add(aKey, aItem);
			Set(tmp);
		}
		public override void Add (JSONNode aItem)
		{
			var tmp = new JSONArray();
			tmp.Add(aItem);
			Set(tmp);
		}
		private void Set(JSONNode aVal)
		{
			if (m_Key == null)
			{
				m_Node.Add(aVal);
			}
			else
			{
				m_Node.Add(m_Key, aVal);
			}
			m_Node = null; // Be GC friendly.
		}
		public JSONLazyCreator(JSONNode aNode, string aKey)
		{
			m_Node = aNode;
			m_Key = aKey;
		}
		public JSONLazyCreator(JSONNode aNode)
		{
			m_Node = aNode;
			m_Key  = null;
		}
 public virtual JSONNode Remove(JSONNode aNode) { return aNode; }
 public override JSONNode Remove(JSONNode aNode)
 {
     try
     {
         var item = m_Dict.Where(k => k.Value == aNode).First();
         m_Dict.Remove(item.Key);
         return aNode;
     }
     catch
     {
         return null;
     }
 }
 public override void Add(string aKey, JSONNode aItem)
 {
     if (!string.IsNullOrEmpty(aKey))
     {
         if (m_Dict.ContainsKey(aKey))
             m_Dict[aKey] = aItem;
         else
             m_Dict.Add(aKey, aItem);
     }
     else
         m_Dict.Add(Guid.NewGuid().ToString(), aItem);
 }
 public virtual void Add(JSONNode aItem)
 {
     Add("", aItem);
 }
 public virtual void Add(string aKey, JSONNode aItem){ }
 public override JSONNode Remove(JSONNode aNode)
 {
     m_List.Remove(aNode);
     return aNode;
 }
 public override void Add(string aKey, JSONNode aItem)
 {
     m_List.Add(aItem);
 }