Example #1
0
    void readGameMonster()
    {
        using (ReadWriteCsv.CsvFileReader reader = new ReadWriteCsv.CsvFileReader("D://GameMonster.CSV"))
        {
            ReadWriteCsv.CsvRow row = new ReadWriteCsv.CsvRow();
            int i = 1;
            while (reader.ReadRow(row))
            {
                Model.GameMonster temp = new Model.GameMonster();
                if (i > 4)
                {
                    temp.id          = row[0];
                    temp.MonsterName = row[1];
                    int.TryParse(row[2], out temp.TypeID);
                    temp.TeamHeadIcon = row[3];
                    int.TryParse(row[4], out temp.BaseLife);
                    int.TryParse(row[5], out temp.BaseDef);
                    int.TryParse(row[6], out temp.BaseAct);
                    float.TryParse(row[7], out temp.AttrProp);
                    mEvent.Add(temp);
                }

                i++;
            }
        }
    }
Example #2
0
    //8-15层返回随机怪物
    public Model.GameMonster get15Monster()
    {
        List <Model.GameMonster> g = newData.mEvent;

        Model.GameMonster result = new Model.GameMonster();
        Random            ro     = new Random(10);
        long   tick = DateTime.Now.Ticks;
        Random ran  = new Random((int)(tick & 0xffffffffL) | (int)(tick >> 32));
        int    k    = ran.Next(3, 6);

        return(g[k]);
    }