private void HowToPlay_Load(object sender, EventArgs e) { int counter = 0; int tileSize = 32; int labelLength = 132; Dictionary <TileTypes, string> descriptions = new Dictionary <TileTypes, string>(); descriptions.Add(TileTypes.Grass, "Grass, You can walk on it"); descriptions.Add(TileTypes.Tree, "Trees, Cut these down with an axe"); descriptions.Add(TileTypes.Sticks, "Sticks, Collect these to craft tools"); descriptions.Add(TileTypes.Rocks, "Rocks, Collect these to craft tools"); descriptions.Add(TileTypes.Bush, "Bush, Collect berries for food from bushes"); descriptions.Add(TileTypes.Water, "Water, Build a bridge to cross it"); descriptions.Add(TileTypes.Bridge, "Bridges, Create these with a log"); descriptions.Add(TileTypes.Passive, "Cows, Kill these with a sword for food"); descriptions.Add(TileTypes.Hostile, "Tigers, Don't come to close, they will eat you"); descriptions.Add(TileTypes.Treasure, "Treasure, Dig up the relic with a spade"); descriptions.Add(TileTypes.Chest, "Chest, Contains a relic"); descriptions.Add(TileTypes.Home, "Home Village, Your humble abode"); foreach (TileTypes tileType in Enum.GetValues(typeof(TileTypes))) { if (tileType == TileTypes.Cave || tileType == TileTypes.Stone || tileType == TileTypes.Ravine || tileType == TileTypes.Player)//Ignore removed types and player tiles { continue; } Tile tileRef = TileOperators.extractControlFromType(tileType, Zone.Surface); Image image = tileRef.Image; Utils.nonAntialiasingPictureBox tileIcon = new Utils.nonAntialiasingPictureBox(); tileIcon.Image = image; tileIcon.BackColor = Color.Transparent; tileIcon.SizeMode = PictureBoxSizeMode.Zoom; tileIcon.Size = new Size(tileSize, tileSize); tileIcon.Location = new Point((tileSize + labelLength) * (counter / 5) + 10, (tileSize + 5) * (counter % 5) + 300); this.Controls.Add(tileIcon); tileIcon.BringToFront(); tileIcon.Show(); Label lblDescription = new Label(); lblDescription.Text = descriptions[tileType]; lblDescription.BackColor = Color.Transparent; lblDescription.ForeColor = Color.White; lblDescription.Size = new Size(labelLength, tileSize); lblDescription.TextAlign = ContentAlignment.MiddleCenter; lblDescription.Font = new Font("Times new Roman", 9, FontStyle.Italic); lblDescription.Location = new Point((tileSize + labelLength) * (counter / 5) + 10 + tileSize, (tileSize + 5) * (counter % 5) + 300); this.Controls.Add(lblDescription); lblDescription.BringToFront(); lblDescription.Show(); counter++; } }
private void MenuScreen_Load(object sender, EventArgs e) { Utils.nonAntialiasingPictureBox background = new Utils.nonAntialiasingPictureBox(); background.BackgroundImage = this.BackgroundImage; background.Location = new Point(0, 0); background.Size = this.ClientSize; this.Controls.Add(background); background.BringToFront(); Label lblGender = new Label(); lblGender.Text = "Are You"; lblGender.BackColor = Color.Transparent; lblGender.ForeColor = Color.White; lblGender.Size = new Size(200, 60); lblGender.TextAlign = ContentAlignment.MiddleCenter; lblGender.Font = new Font("Times new Roman", 32, FontStyle.Bold); lblGender.Location = new Point((this.ClientSize.Width / 2) - (lblGender.Size.Width / 2), (this.ClientSize.Height / 2) - (lblGender.Size.Height / 2)); this.Controls.Add(lblGender); lblGender.BringToFront(); lblGender.Show(); Button btnFemale = new Button(); btnFemale.Text = "Female"; btnFemale.Font = new Font("Times new Roman", 24, FontStyle.Bold); btnFemale.Size = new Size(130, 50); btnFemale.Location = new Point((this.ClientSize.Width / 2) + (btnFemale.Size.Width / 4), (this.ClientSize.Height / 2) - (lblGender.Size.Height / 2) + (lblGender.Height)); this.Controls.Add(btnFemale); btnFemale.BringToFront(); btnFemale.Show(); btnFemale.TabStop = false; btnFemale.Click += btnFemale_Click; Button btnMale = new Button(); btnMale.Text = "Male"; btnMale.Font = new Font("Times new Roman", 24, FontStyle.Bold); btnMale.Size = btnFemale.Size; btnMale.Location = new Point((this.ClientSize.Width / 2) - (btnMale.Size.Width) - (btnMale.Size.Width / 4), (this.ClientSize.Height / 2) - (lblGender.Size.Height / 2) + (lblGender.Height)); this.Controls.Add(btnMale); btnMale.BringToFront(); btnMale.Show(); btnMale.TabStop = false; btnMale.Click += btnMale_Click; background.Tag = "Gender"; lblGender.Tag = "Gender"; btnMale.Tag = "Gender"; btnFemale.Tag = "Gender"; }