示例#1
0
    public static bool Init()
    {
        items = new Map <int, CsvLevelItem>();
        Objv objv = CsvUtil.GetObjvByName("Level");

        for (int i = 0; i < objv.rowCount; i++)
        {
            CsvLevelItem item = new CsvLevelItem();
            item.index = (int)objv.QueryByIndex(i, "Index");
            item.name  = (string)objv.QueryByIndex(i, "Name");
            string type = (string)objv.QueryByIndex(i, "Type");
            item.etype.Clear();
            if (type != "")
            {
                string[] typeStr = type.Split('~');

                for (int index = 0; index < typeStr.Length; index++)
                {
                    EnemyType Etype    = new EnemyType();
                    string[]  etypeStr = typeStr[index].Split('+');
                    Etype.type = int.Parse(etypeStr[0]);
                    Etype.num  = int.Parse(etypeStr[1]);
                    item.etype.Add(Etype);
                }
            }



            string obstacle = (string)(objv.QueryByIndex(i, "Obstacle"));
            if (obstacle != "")
            {
                string[] ObstacleStr = obstacle.Split('~');

                for (int index = 0; index < ObstacleStr.Length; index++)
                {
                    ObstacleType Etype    = new ObstacleType();
                    string[]     etypeStr = ObstacleStr[index].Split('+');
                    Etype.type = int.Parse(etypeStr[0]);
                    Etype.pos  = ComUnitl.String2Vector3(etypeStr[1]);
                }
            }



            item.ornamental = (string)(objv.QueryByIndex(i, "Ornamental"));
            item.numtype1   = (int)(objv.QueryByIndex(i, "NumType1"));
            item.param1     = (int)(objv.QueryByIndex(i, "Param1-1"));
            item.numtype2   = (int)(objv.QueryByIndex(i, "NumType2"));
            item.param2     = (int)(objv.QueryByIndex(i, "Param2-1"));



            item.target = (string)(objv.QueryByIndex(i, "Target"));
            item.txt    = (string)(objv.QueryByIndex(i, "Txt"));


            items[item.index] = item;
        }
        return(true);
    }
示例#2
0
    public static Objv GetObjvByName(string csvName)
    {
        TextAsset ta       = Resources.Load <TextAsset>("CSV/csvconfig/" + csvName);
        string    fileData = ta.text;
        Objv      objv     = new Objv(csvName, fileData);

        return(objv);
    }