예제 #1
0
		private void cmbList_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			m_Set = cmbList.SelectedItem as TileSet;

			lst.BeginUpdate();
			lst.Items.Clear();

			foreach ( TileMask mask in m_Set.Tiles )
			{
				lst.Items.Add( mask );
			}

			lst.EndUpdate();
		}
예제 #2
0
		/// <summary>
		/// Loads the roof tiles defined in rooftiles.cfg
		/// </summary>
		/// <returns>An array list of tilesets</returns>
		// Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
		public static List<TileSet> Load()
		{
			List<TileSet> list = new List<TileSet>();
			// Issue 10 - End

			StreamReader reader = new StreamReader( Pandora.DataAssembly.GetManifestResourceStream( "Data.rooftiles.cfg" ) );

			TileSet tileset = null;

			while ( reader.Peek() > -1 )
			{
				string line = reader.ReadLine();
				line.Trim();

				if ( line == null || line.Length == 0 || line.StartsWith( "#" ) )
				{
					continue;
				}

				if ( line.StartsWith( "[" ) )
				{
					line = line.Replace( "[", "" );
					line = line.Replace( "]", "" );

					tileset = new TileSet();
					tileset.m_Name = line;
					list.Add( tileset );

					continue;
				}

				string[] values = line.Split( ' ' );

				if ( values.Length == 2 )
				{
					uint flags = Convert.ToUInt32( values[ 0 ], 16 );
					int tile = Convert.ToInt32( values[ 1 ] );

					TileMask mask = new TileMask( flags, tile );
					tileset.m_Tiles.Add( mask );
				}
			}

			return list;
		}