Esempio n. 1
0
    public static void CreateCityList()
    {
        //string path = "Assets/SourceFiles/städte.csv";
        TextAsset citiesFile = ResourceLoader.CitiesText();

        if (citiesFile == null)
        {
            throw new FileNotFoundException("City resource do not exist");
        }


        string input = citiesFile.text;

        string[] lines = input.Split('\n');
        cities = new Dictionary <string, City>();

        for (int row = 0; row < lines.Length - 1; row++)
        {
            string[] columns = lines[row].Split(';');
            cities.Add(columns[0],
                       new City(columns[0],                           //name
                                float.Parse(columns[1], deCulture),   //culture pro 12h
                                float.Parse(columns[2], deCulture),   //student pro 24h
                                float.Parse(columns[3], deCulture),   //student pro 12h
                                float.Parse(columns[4], deCulture),   //businessman pro 24h
                                float.Parse(columns[5], deCulture))); //businessmann pro 12h
        }
    }