コード例 #1
0
        public static List <Mobs> LoadMobs(string user)
        {
            List <Mobs> mobsList = new List <Mobs>();


            StreamReader inputFile;

            inputFile = File.OpenText($"{Environment.CurrentDirectory}/save/{user}/{user}-Mobs.data");
            int i = 0;

            while (!inputFile.EndOfStream)
            {
                string line = inputFile.ReadLine();
                if (i != 0)
                {
                    string[] words = line.Split(',');

                    string id   = words[0];
                    string name = words[1];
                    string desc = words[2];

                    int hp = int.Parse(words[3]);

                    int attack = int.Parse(words[4]);

                    Mobs loadedMobs = Mobs.GetMobs(id, name, desc, hp, attack, words[5]);
                    mobsList.Add(loadedMobs);
                }

                i++;
            }
            return(mobsList);
        }