Example #1
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(@"D:\Dev\Pandora 2.0\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);
                }
            }

            reader.Close();

            return(list);
        }
Example #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()
        {
            var list = new List <TileSet>();
            // Issue 10 - End

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

            TileSet tileset = null;

            while (reader.Peek() > -1)
            {
                var 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;
                }

                var values = line.Split(' ');

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

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

            return(list);
        }
Example #3
0
		private void lst_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			Mask = lst.SelectedItem as TileMask;
		}
Example #4
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;
		}