private void GeneratePokemonBox() { Pokemon pokemon = PokemonFactory.Generate(); pokemons.Add(pokemon); PokemonBox pokemonBox = new PokemonBox(pokemon); pokemonBox.Render(this.Size); this.Controls.Add(pokemonBox); }
public Backpack() { InitializeComponent(); pokemons = PokemonFactory.Generate(14); pokemonBoxes = new List <PokemonBox>(); numberOfColumn = (this.Width - gutter) / (pokemonBoxWidth + gutter); for (int index = 0; index < pokemons.Count; index++) { PokemonBox pokemonBox = new PokemonBox(PokemonFactory.Generate()); pokemonBox.Render(this.Size); pokemonBox.Size = new Size(150, 180); int x = start.X + (index % numberOfColumn) * (pokemonBox.Width + gutter); int y = start.Y + (index / numberOfColumn) * (pokemonBox.Height + gutter); pokemonBox.Location = new Point(x, y); this.Controls.Add(pokemonBox); pokemonBoxes.Add(pokemonBox); } }