Example #1
0
    public void saveFellowInfo()
    {
        lightFellowInfo  = new List <fellow>();
        shadowFellowInfo = new List <fellow>();
        TextAsset  FellowAll = Resources.Load <TextAsset>("config/FellowSkill");
        JSONObject json      = new JSONObject(FellowAll.text);
        JSONObject lightJson = new JSONObject(FellowAll.text).GetField("lightFellow");
        JSONObject darkJson  = new JSONObject(FellowAll.text).GetField("darkFellow");

        for (int i = 0; i < lightJson.Count; i++)
        {
            fellow     subFellow  = new fellow();
            int        index      = i + 1;
            JSONObject FellowInfo = lightJson.GetField(index + "");
            subFellow.isLightFellow   = true;
            subFellow.fellowName      = FellowInfo.GetField("name").str;
            subFellow.fellowSkillInfo = FellowInfo.GetField("skillIntro").str;
            subFellow.fellowHistory   = FellowInfo.GetField("HistoryIntro").str;
            subFellow.straightSpeed   = (int)FellowInfo.GetField("straightSpeed").n;
            subFellow.curveSpeed      = (int)FellowInfo.GetField("curveSpeed").n;
            subFellow.fellowValue     = (int)FellowInfo.GetField("valueNum").n;
            subFellow.skillType       = (int)FellowInfo.GetField("skillType").n;
            subFellow.skillValue      = (int)FellowInfo.GetField("skillValue").n;
            if (subFellow.skillType == 1)
            {
                subFellow.skillCount = 1;
            }
            lightFellowInfo.Add(subFellow);
        }
        for (int i = 0; i < darkJson.Count; i++)
        {
            fellow     subFellow  = new fellow();
            int        index      = i + 1;
            JSONObject FellowInfo = darkJson.GetField(index + "");
            subFellow.isLightFellow   = false;
            subFellow.fellowName      = FellowInfo.GetField("name").str;
            subFellow.fellowSkillInfo = FellowInfo.GetField("skillIntro").str;
            subFellow.fellowHistory   = FellowInfo.GetField("HistoryIntro").str;
            subFellow.straightSpeed   = (int)FellowInfo.GetField("straightSpeed").n;
            subFellow.curveSpeed      = (int)FellowInfo.GetField("curveSpeed").n;
            subFellow.fellowValue     = (int)FellowInfo.GetField("valueNum").n;
            subFellow.skillType       = (int)FellowInfo.GetField("skillType").n;
            subFellow.skillValue      = (int)FellowInfo.GetField("skillValue").n;
            if (subFellow.skillType == 1)
            {
                subFellow.skillCount = 1;
            }
            shadowFellowInfo.Add(subFellow);
        }
    }
Example #2
0
    public void saveInfo()
    {
        cardInfo   = new Dictionary <int, card>();
        weaponInfo = new Dictionary <int, equip>();
        fellowInfo = new Dictionary <int, fellow>();
        TextAsset         info         = Resources.Load <TextAsset>("config/cardInfo");
        JSONObject        json         = new JSONObject(info.text);
        JSONObject        cardJson     = new JSONObject(info.text).GetField("Card");
        JSONObject        weaponJson   = new JSONObject(info.text).GetField("Weapon");
        JSONObject        cardListJson = new JSONObject(info.text).GetField("CardList");
        List <JSONObject> cardList     = cardListJson.list;

        for (int i = 0; i < cardList.Count; i++)
        {
            card       subCard  = new card();
            int        cardId   = (int)cardList[i].n;
            JSONObject cardData = cardJson.GetField(cardId + "");
            subCard.name        = cardData.GetField("name").str;
            subCard.skillType   = (int)cardData.GetField("skillType").n;
            subCard.damageType  = (int)cardData.GetField("damageType").n;
            subCard.damageScale = (int)cardData.GetField("damageScale").n;
            subCard.cardValue   = (int)cardData.GetField("cardValue").n;
            //Debug.LogError(subCard.name + " " + subCard.skillType + " " + subCard.damageType + " " + subCard.damageScale + " " + subCard.cardValue);
            cardInfo.Add(cardId, subCard);
        }
        for (int i = 0; i < weaponJson.Count; i++)
        {
            equip      subWeapon  = new equip();
            int        index      = i + 1;
            JSONObject weaponData = weaponJson.GetField(index + "");
            subWeapon.name           = weaponData.GetField("name").str;
            subWeapon.physicalAttack = (int)weaponData.GetField("physicalAttack").n;
            subWeapon.magicAttack    = (int)weaponData.GetField("magicAttack").n;
            List <JSONObject> card = weaponData.GetField("initCard").list;
            subWeapon.initCard = new List <int>();
            for (int j = 0; j < card.Count; j++)
            {
                subWeapon.initCard.Add((int)card[j].n);
            }
            subWeapon.equipValue  = (int)weaponData.GetField("equipValue").n;
            subWeapon.CanEquipNum = (int)weaponData.GetField("CanEquipNum").n;
            //Debug.LogError(subWeapon.name+" "+ subWeapon.physicalAttack + " " + subWeapon.magicAttack + " " + subWeapon.initCard.Count + " " + subWeapon.equipValue + " " + subWeapon.CanEquipNum);
            weaponInfo.Add(index, subWeapon);
        }
        info = Resources.Load <TextAsset>("config/fellowInfo");
        JSONObject fellowJson = new JSONObject(info.text).GetField("Fellow");

        for (int i = 0; i < fellowJson.Count; i++)
        {
            fellow     subFellow  = new fellow();
            int        index      = i + 1;
            JSONObject fellowData = fellowJson.GetField(index + "");
            subFellow.name = fellowData.GetField("name").str;
            subFellow.initPhysicalAttack  = (int)fellowData.GetField("initPhysicalAttack").n;
            subFellow.initMagicAttack     = (int)fellowData.GetField("initMagicAttack").n;
            subFellow.initAttackSpeed     = fellowData.GetField("initAttackSpeed").f;
            subFellow.initPhysicalDefense = (int)fellowData.GetField("initPhysicalDefense").n;
            subFellow.initMagicDefense    = (int)fellowData.GetField("initMagicDefense").n;
            subFellow.initHealth          = (int)fellowData.GetField("initHealth").n;
            subFellow.initWeapon          = (int)fellowData.GetField("initWeapon").n;
            subFellow.fellowQuality       = (int)fellowData.GetField("fellowQuality").n;
            //Debug.LogError(subFellow.name + " " + subFellow.initPhysicalAttack + " " + subFellow.initMagicAttack + " " + subFellow.initPhysicalDefense + " " + subFellow.initMagicDefense + " " + subFellow.initHealth + " " + subFellow.initWeapon + " " + subFellow.fellowQuality);
            fellowInfo.Add(index, subFellow);
        }
    }