Esempio n. 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);

        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);
        }
    }
Esempio n. 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);


        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);
//			}
        }
    }
Esempio n. 3
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);
        }
    }
Esempio n. 4
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();
    }
Esempio n. 5
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);
        }
    }
Esempio n. 6
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);
        }
    }
Esempio n. 7
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;
        }
    }
    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);
        }
    }
Esempio n. 9
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);
        }
    }
Esempio n. 10
0
    public Dictionary <int, Guide> guideMap = new Dictionary <int, Guide>();   //id, guide

    public void LoadHeros(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)
        {
            DataGuide data = new DataGuide();
            data.Load(subNode);

            guidesGroup.Add(data);
        }

        CollectGuide();
    }
Esempio n. 11
0
    public void Load(string name)
    {
        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

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

        _hashMap = new Dictionary <int, DataSkill> ();

        foreach (LitJson.JSONNode subNode in json.Childs)
        {
            DataSkill skill = new DataSkill();
            skill.Load(subNode);

            int hash = GetHash(skill.type, skill.level);
            _hashMap.Add(hash, skill);
        }
    }
Esempio n. 12
0
    public DataMap QueryMap(int id)
    {
        if (dataMaps.ContainsKey(id))
        {
            return(dataMaps [id]);
        }

        string name = AppConfig.FOLDER_DATACONFIG + "Map" + id + ".json";

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

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

        DataMap map = new DataMap();

        map.Load(json);

        dataMaps [id] = map;
        return(map);
    }
Esempio n. 13
0
    public void LoadHerosUpgrade(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)
        {
            DataHeroUpgrade data = new DataHeroUpgrade();
            data.Load(subNode);

            if (!heroesUpgradeMap.ContainsKey(data.id))
            {
                Assert.assert(GetHeroUnlockWithItem(data.itemId) <= 0, "one item link to multi heroes");

                heroesUpgradeMap[data.id] = new Dictionary <int, DataHeroUpgrade>();
            }
            Dictionary <int, DataHeroUpgrade> stagesMap = heroesUpgradeMap[data.id];
            stagesMap[data.stage] = data;
        }
    }
Esempio n. 14
0
    public void Load(string name)
    {
        byte[] bin     = DynamicFileControl.QueryFileContent(name);
        string content = StringHelper.ReadFromBytes(bin);

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

        _dropCollectionMap = new Dictionary <int, DropCollection> ();

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

            if (!_dropCollectionMap.ContainsKey(data.id))
            {
                _dropCollectionMap.Add(data.id, new DropCollection());
            }
            DropCollection collection = _dropCollectionMap[data.id];

            collection.drops.Add(data);
        }
    }
Esempio n. 15
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);

        dataTeams = new Dictionary <int, DataTeam> ();

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

            dataTeams.Add(data.id, data);
        }
    }
Esempio n. 16
0
    /*
     * public void GetHeroProperty(int id, int exp, int stage,
     *                          out DataHero hero, out DataHeroLeadership leadership, out DataHeroUpgrade upgrade)
     * {
     *      int level = GetHeroLevel (id, exp);
     *      hero = GetHero (id, level);
     *      leadership = GetHeroLeadership (id);
     *      upgrade = GetHeroUpgrade (id, stage);
     * }
     */

    public void LoadHeros(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)
        {
            DataHero data = new DataHero();
            data.Load(subNode);

            heroesMap[data.id] = data;

            /*
             * if(!heroesMap.ContainsKey(data.id))
             * {
             *      heroesMap[data.id] = new Dictionary<int, DataHero>();
             * }
             * Dictionary<int, DataHero> levelsMap = heroesMap[data.id];
             * levelsMap[data.level] = data;
             */
        }
    }