CNCMaps.Engine.Game.Theater.TheaterTypeFromString C# (CSharp) Метод

TheaterTypeFromString() публичный статический Метод

public static TheaterTypeFromString ( string theater ) : TheaterType
theater string
Результат TheaterType
        public static TheaterType TheaterTypeFromString(string theater)
        {
            theater = theater.ToLower();
            if (theater == "lunar") return TheaterType.Lunar;
            else if (theater == "newurban") return TheaterType.NewUrban;
            else if (theater == "desert") return TheaterType.Desert;
            else if (theater == "temperate") return TheaterType.Temperate;
            else if (theater == "urban") return TheaterType.Urban;
            else if (theater == "snow") return TheaterType.Snow;
            else throw new InvalidOperationException();
        }

Usage Example

Пример #1
0
        public bool Initialize(MapFile mf, EngineType et)
        {
            if (et == EngineType.AutoDetect)
            {
                Logger.Fatal("Engine type needs to be known by now!");
                return(false);
            }
            Engine      = et;
            TheaterType = Theater.TheaterTypeFromString(mf.ReadString("Map", "Theater"));
            FullSize    = mf.FullSize;
            LocalSize   = mf.LocalSize;

            _tiles = new TileLayer(FullSize.Size);

            LoadAllObjects(mf);

            if (!IgnoreLighting)
            {
                _lighting = mf.Lighting;
            }
            else
            {
                _lighting = new Lighting {
                    Level = 0.0
                }
            };

            _wayPoints.AddRange(mf.Waypoints);

            if (!LoadInis())
            {
                Logger.Fatal("Ini files couldn't be loaded");
                return(false);
            }

            Logger.Info("Overriding rules.ini with map INI entries");
            _rules.MergeWith(mf);

            return(true);
        }