Esempio n. 1
0
 /// <summary>
 ///     Creates a new random rectangle tiler
 /// </summary>
 /// <param name="tileset">The random tileset to use</param>
 /// <param name="rectangle">The rectangle for the tiling</param>
 /// <param name="fillpercentage">The percentage of the rectangle that should be filled</param>
 /// <param name="map">The map on which the tiling will occur</param>
 public RandomRectangle(RandomTilesList tileset, Rectangle rectangle, double fillpercentage, int map)
 {
     m_TileSet   = tileset;
     m_Rectangle = rectangle;
     m_Fill      = fillpercentage;
     m_Map       = map;
 }
Esempio n. 2
0
		/// <summary>
		/// Creates a new random rectangle tiler
		/// </summary>
		/// <param name="tileset">The random tileset to use</param>
		/// <param name="rectangle">The rectangle for the tiling</param>
		/// <param name="fillpercentage">The percentage of the rectangle that should be filled</param>
		/// <param name="map">The map on which the tiling will occur</param>
		public RandomRectangle( RandomTilesList tileset, Rectangle rectangle, double fillpercentage, int map )
		{
			m_TileSet = tileset;
			m_Rectangle = rectangle;
			m_Fill = fillpercentage;
			m_Map = map;
		}
Esempio n. 3
0
        /// <summary>
        ///     Creates the message that will perform the brush using a single hue
        /// </summary>
        /// <param name="tileset">The tileset to use in the message</param>
        /// <param name="hue">The hue to use for the items</param>
        /// <param name="fill">Percentage of the area to fill</param>
        /// <returns>A message that can be sent to the server</returns>
        public RandomBrushMessage CreateMessage(RandomTilesList tileset, int hue, double fill)
        {
            // Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
            var list = new List <int>();

            // Issue 10 - End
            list.Add(hue);

            return(CreateMessage(tileset, list, fill));
        }
Esempio n. 4
0
        /// <summary>
        ///     Creates the message that performs the brush
        /// </summary>
        /// <param name="tileset">The tileset for the brush</param>
        /// <param name="hues">A list of hues to use for the brush</param>
        /// <param name="fill">The are percentage to fill</param>
        /// <returns>The server message created</returns>
        // Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
        private RandomBrushMessage CreateMessage(RandomTilesList tileset, List <int> hues, double fill)
        // Issue 10 - End
        {
            var msg = new RandomBrushMessage();
            var rnd = new Random();

            RandomizeBrush(fill);

            for (var x = 0; x < Width; x++)
            {
                for (var y = 0; y < Height; y++)
                {
                    if (m_Grid[x, y])
                    {
                        var tile = tileset.Tiles[rnd.Next(tileset.Tiles.Count)] as RandomTile;

                        foreach (int id in tile.Items)
                        {
                            var item = new BuildItem();

                            item.ID = id;
                            // Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
                            item.Hue = hues[rnd.Next(hues.Count)];
                            // Issue 10 - End

                            item.X = x - (Width / 2);
                            item.Y = y - (Height / 2);

                            msg.Items.Add(item);
                        }
                    }
                }
            }

            return(msg);
        }
Esempio n. 5
0
		private void bDelete_Click(object sender, System.EventArgs e)
		{
			if ( m_TileSet != null )
			{
				m_List.List.Remove( m_TileSet );

				int index = cmbGroups.Items.IndexOf( m_TileSet );
				cmbGroups.Items.Remove( m_TileSet );

				if ( index < cmbGroups.Items.Count )
				{
					cmbGroups.SelectedIndex = index;
				}
				else
				{
					if ( --index >= 0 && cmbGroups.Items.Count > 0 )
					{
						cmbGroups.SelectedIndex = index;
					}
					else
					{
						TileSet = null;
					}
				}
			}
		}
Esempio n. 6
0
		private void cmbGroups_SelectedIndexChanged(object sender, System.EventArgs e)
		{
			TileSet = cmbGroups.SelectedItem as RandomTilesList;
		}
Esempio n. 7
0
		private void bNew_Click(object sender, System.EventArgs e)
		{
			RandomTilesList list = new RandomTilesList( txNew.Text );
			txNew.Text = "";

			m_List.List.Add( list );

			cmbGroups.Items.Add( list );
			cmbGroups.SelectedItem = list;
		}
Esempio n. 8
0
		/// <summary>
		/// Creates the message that will perform the brush using a single hue
		/// </summary>
		/// <param name="tileset">The tileset to use in the message</param>
		/// <param name="hue">The hue to use for the items</param>
		/// <param name="fill">Percentage of the area to fill</param>
		/// <returns>A message that can be sent to the server</returns>
		public RandomBrushMessage CreateMessage( RandomTilesList tileset, int hue, double fill )
		{
			// Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
			List<int> list = new List<int>();
			// Issue 10 - End
			list.Add( hue );

			return CreateMessage( tileset, list, fill );
		}
Esempio n. 9
0
		/// <summary>
		/// Creates the message that will perform the brush using a random hue
		/// </summary>
		/// <param name="tileset">The tileset to choose items from</param>
		/// <param name="hues">The hues list to choose hues from</param>
		/// <param name="fill">The percentage of the area to fill</param>
		/// <returns>A message that can be sent to the server</returns>
		public RandomBrushMessage CreateMessage( RandomTilesList tileset, HuesCollection hues, double fill )
		{
			return CreateMessage( tileset, hues.Hues, fill );
		}
Esempio n. 10
0
		/// <summary>
		/// Creates the message that performs the brush
		/// </summary>
		/// <param name="tileset">The tileset for the brush</param>
		/// <param name="hues">A list of hues to use for the brush</param>
		/// <param name="fill">The are percentage to fill</param>
		/// <returns>The server message created</returns>
		// Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
		private RandomBrushMessage CreateMessage( RandomTilesList tileset, List<int> hues, double fill )
		// Issue 10 - End
		{
			RandomBrushMessage msg = new RandomBrushMessage();
			Random rnd = new Random();

			RandomizeBrush( fill );

			for( int x = 0; x < m_Width; x++ )
			{
				for ( int y = 0; y < m_Height; y++ )
				{
					if ( m_Grid[ x, y ] )
					{
						RandomTile tile = tileset.Tiles[ rnd.Next( tileset.Tiles.Count ) ] as RandomTile;

						foreach( int id in tile.Items )
						{
							BuildItem item = new BuildItem();

							item.ID = id;
							// Issue 10 - Update the code to Net Framework 3.5 - http://code.google.com/p/pandorasbox3/issues/detail?id=10 - Smjert
							item.Hue = hues[ rnd.Next( hues.Count ) ];
							// Issue 10 - End

							item.X = x - ( m_Width / 2 );
							item.Y = y - ( m_Height / 2 );

							msg.Items.Add( item );
						}
					}
				}
			}

			return msg;
		}
Esempio n. 11
0
 /// <summary>
 ///     Creates the message that will perform the brush using a random hue
 /// </summary>
 /// <param name="tileset">The tileset to choose items from</param>
 /// <param name="hues">The hues list to choose hues from</param>
 /// <param name="fill">The percentage of the area to fill</param>
 /// <returns>A message that can be sent to the server</returns>
 public RandomBrushMessage CreateMessage(RandomTilesList tileset, HuesCollection hues, double fill)
 {
     return(CreateMessage(tileset, hues.Hues, fill));
 }
Esempio n. 12
0
		public RandomItem( RandomTilesList tileset ) : this( tileset, 0 )
		{
		}
Esempio n. 13
0
		public RandomItem( RandomTilesList tileset, int hue ) : this()
		{
			m_Hues.Add( hue );
			m_Items.AddRange( tileset.Tiles );
		}
Esempio n. 14
0
		public RandomItem( RandomTilesList tileset, HuesCollection hues ) : this()
		{
			m_Hues.AddRange( hues.Hues );
			m_Items.AddRange( tileset.Tiles );			
		}