コード例 #1
0
ファイル: WeatherFile.cs プロジェクト: gitter-badger/ORTS-MG
        protected virtual bool TryParse(JsonReader reader)
        {
            switch (reader.Path)
            {
            case "":
            case "Changes[].":
                // Ignore these items.
                break;

            case "Changes[].Type":
                switch (reader.AsString(""))
                {
                case "Clear":
                    Changes.Add(new OvercastCondition(reader));
                    break;

                case "Precipitation":
                    Changes.Add(new PrecipitationCondition(reader));
                    break;

                case "Fog":
                    Changes.Add(new FogCondition(reader));
                    break;

                default: return(false);
                }
                break;

            default: return(false);
            }
            return(true);
        }
コード例 #2
0
        protected virtual bool TryParse(JsonReader item)
        {
            switch (item.Path)
            {
            case "":
            case "Changes[].":
                // Ignore these items.
                break;

            case "Changes[].Type":
                switch (item.AsString(""))
                {
                case "Clear":
                    Changes.Add(new WeatherSettingOvercast(item));
                    break;

                case "Precipitation":
                    Changes.Add(new WeatherSettingPrecipitation(item));
                    break;

                case "Fog":
                    Changes.Add(new WeatherSettingFog(item));
                    break;

                default: return(false);
                }
                break;

            default: return(false);
            }
            return(true);
        }