示例#1
0
        public void InitTilesets()
        {
            int sectionIdx = 0;
            int setNum     = 0;

            while (true)
            {
                string sectionName = "TileSet" + sectionIdx.ToString("0000");
                var    sect        = _theaterIni.GetSection(sectionName);
                if (sect == null)
                {
                    break;
                }
                sectionIdx++;

                Logger.Trace("Loading tileset {0}", sectionName);
                var ts = new TileSet(sect.ReadString("FileName"), sect.ReadString("SetName"), sect.ReadInt("TilesInSet"));
                _setNumToFirstTile.Add((short)_drawables.Count);
                _tileSets.Add(ts);

                for (int j = 1; j <= ts.TilesInSet; j++)
                {
                    _tileNumToSet.Add((short)setNum);
                    var rs = new TileSetEntry(ts, j - 1);

                    // add as many tiles (with randomized name) as can be found
                    for (var r = (char)('a' - 1); r <= 'z'; r++)
                    {
                        if ((r >= 'a') && ts.SetName == "Bridges")
                        {
                            continue;
                        }

                        // filename = set filename + dd + .tmp/.urb/.des etc
                        string filename = ts.FileName + j.ToString("00");
                        if (r >= 'a')
                        {
                            filename += r;
                        }
                        filename += _theaterSettings.Extension;
                        var tmpFile = VFS.Open <TmpFile>(filename);
                        if (tmpFile != null)
                        {
                            rs.AddTile(tmpFile);
                        }
                        else
                        {
                            break;
                        }
                    }
                    ts.Entries.Add(rs);
                    _drawables.Add(new TileDrawable(null, null, rs));
                }
                setNum++;
            }

            _animsSectionsStartIdx = sectionIdx + 1;
        }
示例#2
0
        public void InitTilesets()
        {
            int sectionIdx = 0;
            int setNum     = 0;

            while (true)
            {
                string sectionName = "TileSet" + sectionIdx.ToString("0000");
                var    sect        = _theaterIni.GetSection(sectionName);
                if (sect == null)
                {
                    break;
                }

                Logger.Trace("Loading tileset {0}", sectionName);
                var ts = new TileSet(sect.ReadString("FileName"), sect.ReadString("SetName"), sect.ReadInt("TilesInSet"), (short)sectionIdx);
                _setNumToFirstTile.Add((short)_drawables.Count);
                _tileSets.Add(ts);
                sectionIdx++;

                for (int j = 1; j <= ts.TilesInSet; j++)
                {
                    _tileNumToSet.Add((short)setNum);
                    var rs = new TileSetEntry(ts, j - 1);

                    // add as many tiles (with randomized name) as can be found
                    for (var r = (char)('a' - 1); r <= 'z'; r++)
                    {
                        if ((r >= 'a') && (ts.TileSetNum == BridgeSet || ts.TileSetNum == TrainBridgeSet || ts.TileSetNum == WoodBridgeSet))
                        {
                            continue;
                        }

                        // filename = set filename + dd + .tmp/.urb/.des etc
                        string filename = ts.FileName + j.ToString("00");
                        if (r >= 'a')
                        {
                            filename += r;
                        }
                        filename += _theaterSettings.Extension;
                        var tmpFile = _vfs.Open <TmpFile>(filename);
                        if (tmpFile == null && _theaterSettings.Type == TheaterType.NewUrban)
                        {
                            tmpFile = _vfs.Open <TmpFile>(filename.Replace(".ubn", ".tem"));
                        }
                        if (tmpFile != null)
                        {
                            rs.AddTile(tmpFile);
                        }
                        else
                        {
                            break;
                        }
                    }
                    ts.Entries.Add(rs);
                    _drawableIndexNameMap[_drawables.Count] = ts.SetName;

                    var td = AddObject(sectionName) as TileDrawable;
                    td.TsEntry = rs;
                }
                setNum++;
            }

            _animsSectionsStartIdx = sectionIdx + 1;
        }
示例#3
0
		public void InitTilesets() {
			int sectionIdx = 0;
			int setNum = 0;
			while (true) {
				string sectionName = "TileSet" + sectionIdx.ToString("0000");
				var sect = _theaterIni.GetSection(sectionName);
				if (sect == null)
					break;
				sectionIdx++;

				Logger.Trace("Loading tileset {0}", sectionName);
				var ts = new TileSet(sect.ReadString("FileName"), sect.ReadString("SetName"), sect.ReadInt("TilesInSet"));
				_setNumToFirstTile.Add((short)_drawables.Count);
				_tileSets.Add(ts);

				for (int j = 1; j <= ts.TilesInSet; j++) {
					_tileNumToSet.Add((short)setNum);
					var rs = new TileSetEntry(ts, j-1);

					// add as many tiles (with randomized name) as can be found
					for (var r = (char)('a' - 1); r <= 'z'; r++) {
						if ((r >= 'a') && ts.SetName == "Bridges") continue;

						// filename = set filename + dd + .tmp/.urb/.des etc
						string filename = ts.FileName + j.ToString("00");
						if (r >= 'a') filename += r;
						filename += _theaterSettings.Extension;
						var tmpFile = VFS.Open<TmpFile>(filename);
						if (tmpFile != null) rs.AddTile(tmpFile);
						else break;
					}
					ts.Entries.Add(rs);
					_drawableIndexNameMap[_drawables.Count] = ts.SetName;

					var td = AddObject(sectionName) as TileDrawable;
					td.TsEntry = rs;
				}
				setNum++;
			}

			_animsSectionsStartIdx = sectionIdx + 1;
		}