コード例 #1
0
ファイル: FileManager.cs プロジェクト: Millmoss/soapdragon
    public static List <Person> initPersons(Place curRoom)
    {
        List <Person> people = new List <Person>();

        string[] fileNames = System.IO.Directory.GetFiles(@"Assets\GameData\InitData\CharacterData");

        for (int fni = 0; fni < fileNames.Length; fni++)
        {
            if (fileNames[fni].Contains(".meta"))
            {
                continue;
            }

            string data = "";

            System.IO.StreamReader inFile = new System.IO.StreamReader(fileNames[fni]);
            while (!inFile.EndOfStream)
            {
                data += inFile.ReadLine();
            }

            PersonData pd = PersonData.CreateFromJSON(data);

            Person p = new Person(pd, curRoom);
            people.Add(p);
        }

        return(people);
    }