コード例 #1
0
ファイル: Map.cs プロジェクト: dkeetonx/ccmaps-net
		public bool Initialize(MapFile mf, EngineType et, List<string> customRulesININames, List<string> customArtININames) {
			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();

			_wayPoints.AddRange(mf.Waypoints);

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

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

			return true;
		}
コード例 #2
0
ファイル: Palette.cs プロジェクト: dkeetonx/ccmaps-net
		public void ApplyLighting(Lighting l, int level = 0, bool applyTints = true) {
			_ambientMult = (l.Ambient + l.Ground) + l.Level * level;
			if (applyTints) {
				_redMult = l.Red;
				_greenMult = l.Green;
				_blueMult = l.Blue;
			}
		}
コード例 #3
0
ファイル: MapFile.cs プロジェクト: dkeetonx/ccmaps-net
		public void Initialize() {
			var map = GetSection("Map");
			string[] size = map.ReadString("Size").Split(',');
			FullSize = new Rectangle(int.Parse(size[0]), int.Parse(size[1]), int.Parse(size[2]), int.Parse(size[3]));
			Tiles = new TileLayer(FullSize.Width, FullSize.Height);
			size = map.ReadString("LocalSize").Split(',');
			LocalSize = new Rectangle(int.Parse(size[0]), int.Parse(size[1]), int.Parse(size[2]), int.Parse(size[3]));

			Logger.Info("Reading map");
			Logger.Debug("Reading tiles");
			ReadTiles();

			Logger.Debug("Reading map overlay");
			ReadOverlay();

			Logger.Debug("Reading map terrain objects");
			ReadTerrain();

			Logger.Debug("Reading map smudge objects");
			ReadSmudges();

			Logger.Debug("Reading infantry on map");
			ReadInfantry();

			Logger.Debug("Reading vehicles on map");
			ReadUnits();

			Logger.Debug("Reading aircraft on map");
			ReadAircraft();

			Logger.Debug("Reading map structures");
			ReadStructures();

			Logger.Debug("Waypoints");
			ReadWaypoints();

			Lighting = new Lighting(GetOrCreateSection("Lighting"));
		}
コード例 #4
0
ファイル: GameObjects.cs プロジェクト: zzattack/ccmaps-net
        void Initialize(IniFile.IniSection lamp, Lighting scenario)
        {
            logger.Trace("Loading LightSource {0} at ({1},{2})", lamp.Name, Tile);

            // Read and assume default values
            LightVisibility = lamp.ReadDouble("LightVisibility", 5000.0);
            LightIntensity = lamp.ReadDouble("LightIntensity", 0.0);
            LightRedTint = lamp.ReadDouble("LightRedTint", 1.0);
            LightGreenTint = lamp.ReadDouble("LightGreenTint", 1.0);
            LightBlueTint = lamp.ReadDouble("LightBlueTint", 1.0);
            this.scenario = scenario;
        }
コード例 #5
0
ファイル: GameObjects.cs プロジェクト: zzattack/ccmaps-net
 public LightSource(IniFile.IniSection lamp, Lighting scenario)
     : base("nobody", lamp.Name, 0, 0)
 {
     Initialize(lamp, scenario);
 }