示例#1
0
    /// <summary>
    /// 读取数据
    /// </summary>
    void InitPlayData()
    {
        //全部英雄字典
        Dictionary <int, object> objDic = new Dictionary <int, object>();

        object ob;

        //已拥有的全部英雄
        object[] objHave = new object[Globe.alreadyHeroList.Count];

        object[] powerObjN;         //力量英雄
        object[] agileObjN;         //敏捷英雄
        object[] intelligenceObjN;  //智力英雄

        int powerIndex        = 0;
        int agileIndex        = 0;
        int intelligenceIndex = 0;

        if (Globe.alreadyHeroList.Count > 0)
        {
            //将所有英雄的数据保存在字典中
            for (int i = 0; i < objAll.Length; i++)
            {
                HeroTableVO heroVOAll = (HeroTableVO)objAll[i];
                objDic.Add(heroVOAll.id, objAll[i]);
            }

            //根据ID寻找已经拥有的英雄
            for (int i = 0; i < Globe.alreadyHeroList.Count; i++)
            {
                if (objDic.TryGetValue(Globe.alreadyHeroList[i], out ob))
                {
                    objHave[i] = ob;
                }
            }

            //遍历已拥有的英雄,设置每个类型的个数
            for (int i = 0; i < objHave.Length; i++)
            {
                HeroTableVO vo = (HeroTableVO)objHave[i];
                switch (vo.main_prop)
                {
                case 1:
                    powerIndex++;
                    break;

                case 2:
                    agileIndex++;
                    break;

                case 3:
                    intelligenceIndex++;
                    break;

                default:
                    break;
                }
            }

            powerObjN        = new object[powerIndex];
            agileObjN        = new object[agileIndex];
            intelligenceObjN = new object[intelligenceIndex];

            int powerIN        = 0;
            int agileIN        = 0;
            int intelligenceIN = 0;

            //便利已经拥有的所有英雄进行分类
            for (int i = 0; i < objHave.Length; i++)
            {
                HeroTableVO heroVOo = (HeroTableVO)objHave[i];

                switch (heroVOo.main_prop)
                {
                case 1:
                    powerObjN[powerIN] = objHave[i];
                    powerIN++;
                    break;

                case 2:
                    agileObjN[agileIN] = objHave[i];
                    agileIN++;
                    break;

                case 3:
                    intelligenceObjN[intelligenceIN] = objHave[i];
                    intelligenceIN++;
                    break;

                default:
                    break;
                }
            }

            //全部英雄
            allofMultList.InSize(objHave.Length, 5);
            allofMultList.Info(objHave);

            powerMultList.InSize(powerIndex, 5);
            powerMultList.Info(powerObjN);

            agileMultList.InSize(agileIndex, 5);
            agileMultList.Info(agileObjN);

            intelligenceMultList.InSize(intelligenceIndex, 5);
            intelligenceMultList.Info(intelligenceObjN);

            powerMultList.gameObject.SetActive(false);
            agileMultList.gameObject.SetActive(false);
            intelligenceMultList.gameObject.SetActive(false);
        }
    }
示例#2
0
    protected override void Parse(string data)
    {
        base.Parse(data);

        string[] textColumn = data.Split("\n".ToCharArray());

        obj = new object[textColumn.Length];

        for (int i = 0; i < textColumn.Length; i++)
        {
            string[] textRow = textColumn[i].Split(" ".ToCharArray());

            HeroTableVO vo = new HeroTableVO();

            for (int j = 0; j < textRow.Length; j++)
            {
                vo.id = int.Parse(textRow[0]);

                vo.name = textRow[1];

                vo.icon = textRow[2];

                vo.model = textRow[3];

                vo.image = textRow[4];

                vo.desc = textRow[5];

                vo.main_prop = int.Parse(textRow[6]);

                vo.sex = int.Parse(textRow[7]);

                vo.unlock_action = textRow[8];

                vo.init_star = int.Parse(textRow[9]);

                vo.init_str = float.Parse(textRow[10]);

                vo.init_int = float.Parse(textRow[11]);

                vo.init_agi = float.Parse(textRow[12]);

                vo.init_hp = int.Parse(textRow[13]);

                vo.init_patk = float.Parse(textRow[14]);

                vo.init_matk = float.Parse(textRow[15]);

                vo.init_pdef = float.Parse(textRow[16]);

                vo.init_mdef = float.Parse(textRow[17]);

                vo.init_pcrit = float.Parse(textRow[18]);

                vo.init_mcrit = float.Parse(textRow[19]);

                vo.init_dodge = int.Parse(textRow[20]);

                vo.init_hit = int.Parse(textRow[21]);

                vo.str_rate = float.Parse(textRow[22]);

                vo.str_rate_grow = float.Parse(textRow[23]);

                vo.agi_rate = float.Parse(textRow[24]);

                vo.agi_rate_grow = float.Parse(textRow[25]);

                vo.int_rate = float.Parse(textRow[26]);

                vo.int_rate_grow = float.Parse(textRow[27]);

                vo.stone_id = int.Parse(textRow[28]);

                vo.isHas = false;
            }


            obj[i] = vo;

            dic.Add(vo.id, vo);
        }
    }