root/Code/oMaE/oMaE/MiniGames/Match.cs @ 44

Revision 44, 2.3 KB (checked in by acarter, 2 years ago)

Created a minimap.

Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Microsoft.Xna.Framework;
6using Microsoft.Xna.Framework.Audio;
7using Microsoft.Xna.Framework.Content;
8using Microsoft.Xna.Framework.GamerServices;
9using Microsoft.Xna.Framework.Graphics;
10using Microsoft.Xna.Framework.Input;
11using Microsoft.Xna.Framework.Media;
12using oMaE.Widgets;
13
14namespace oMaE.MiniGames
15{
16    using Overworld;
17    /// <summary>
18    /// The energy matching minigame.
19    /// </summary>
20    public class Match : MiniGame
21    {
22        private enum line_t { NONE, NEW, WRONG, CORRECT };
23        RadioGroup radioGroup, matchGroup;
24        int[] offset = new int[]{22, 17, 0, 25, 38};
25        String[] energies = new String[] { "Kinetic Energy", "Electric Energy", "Chemical Energy", "Sound Energy", "Light Energy", "Thermal Energy", "Wind Energy" };
26
27        /// <summary>
28        /// Initializes the match minigame.
29        /// </summary>
30        public override void Initialize()
31        {
32            radioGroup = new RadioGroup();
33            children.Add(radioGroup);
34            for (int i = 0; i < 2; ++i)
35                for (int j = 0; j < energies.Length; ++j)
36                    radioGroup.addRadioButton(new Vector2(i == 0 ? 165 : 590, 40 * j + 106), energies[j], i == 0 ? TextLocation.LEFT : TextLocation.RIGHT);
37            matchGroup = new RadioGroup();
38            children.Add(matchGroup);
39            children.Add(new MatchImage(matchGroup, new Image2D("Sprites/drum", new Rectangle(310, 20, 100, 100))));
40            children.Add(new MatchImage(matchGroup, new Image2D("Sprites/microphone", new Rectangle(325, 170, 50, 100))));
41            children.Add(new MatchImage(matchGroup, new Image2D("Sprites/speaker", new Rectangle(300, 320, 100, 100))));
42            base.Initialize();
43        }
44        /// <summary>
45        /// Draws the match minigame.
46        /// </summary>
47        /// <param name="screen">The screen to be drawn to.</param>
48        /// <param name="gameState">The current game state.</param>
49        public override void Draw(Screen2D screen, GameState gameState)
50        {
51            if (radioGroup.ActiveButton != null)
52                screen.DrawLine(radioGroup.ActiveButton.Center, gameState.MousePos, Color.Black);
53            base.Draw(screen, gameState);
54        }
55    }
56}
Note: See TracBrowser for help on using the browser.