示例#1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            //DMControls dMControls
            this.IsMouseVisible = true;
            base.Initialize();
            dm.Show();
            dm.UpdateEvent += UpdateReceived;

            palatte.SelectUpdateEvent += PalatteUpdate;
            palatte.Show();

            game = new GameControl(new Vector2(0, 0),
                                   new Vector2(0, 0),
                                   new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight));
            game.background = new Texture2D(graphics.GraphicsDevice, 1, 1);
            game.background.SetData(new Color[] { Color.CornflowerBlue });
            //Player display area
            ListBox pList = new ListBox(game.absoluteLocation,
                                        new Vector2(0, 0),
                                        new Vector2(150, graphics.PreferredBackBufferHeight / 2),
                                        graphics.GraphicsDevice);

            pList.selectEvent += selected.selectEventReceiverFromList;
            game.Add(pList);
            //game.Add(new ListBox(game.absoluteLocation,
            //    new Vector2(0, 0),
            //    new Vector2(75, graphics.PreferredBackBufferHeight / 2)));
            //Ally / neutral display area
            ListBox aList = new ListBox(game.absoluteLocation,
                                        new Vector2(0, graphics.PreferredBackBufferHeight / 2),
                                        new Vector2(150, graphics.PreferredBackBufferHeight / 2),
                                        graphics.GraphicsDevice);

            aList.selectEvent += selected.selectEventReceiverFromList;
            game.Add(aList);
            //game.Add(new ListBox(game.absoluteLocation,
            //    new Vector2(0, graphics.PreferredBackBufferHeight/2),
            //    new Vector2(75, graphics.PreferredBackBufferHeight / 2)));
            //Enemy display area
            ListBox eList = new ListBox(
                game.absoluteLocation,
                new Vector2(graphics.PreferredBackBufferWidth - 150, 0),
                new Vector2(150, graphics.PreferredBackBufferHeight),
                graphics.GraphicsDevice
                );

            eList.selectEvent += selected.selectEventReceiverFromList;
            game.Add(eList);
            //game.Add(new ListBox(
            //    game.absoluteLocation,
            //    new Vector2(graphics.PreferredBackBufferWidth - 75, 0),
            //    new Vector2(75, graphics.PreferredBackBufferHeight)
            //    ));
            Grid g = new Grid(game.absoluteLocation,
                              new Vector2(150, 0),
                              new Vector2(graphics.PreferredBackBufferWidth - 300, graphics.PreferredBackBufferHeight),
                              20, 20,
                              graphics.GraphicsDevice);

            g.background = new Texture2D(graphics.GraphicsDevice, 1, 1);
            g.background.SetData(new Color[] { Color.CornflowerBlue });
            g.selectEvent += selected.selectEventReceiverFromTile;
            game.Add(g);

            mouseTracker.MouseUpEvent += MouseClickToGame;
            //for(int i = 0; i < 400; i++)
            //{
            //    (Tile)(g.children[i])
            //}
            //for (int i = 0; i < )
            //game.Add(new Grid(
            //    game.absoluteLocation,
            //    new Vector2(75, 0),
            //    new Vector2(graphics.PreferredBackBufferWidth - 150, graphics.PreferredBackBufferHeight),
            //    20, 20));
            //for(int i = 0; i < game[3])
        }
示例#2
0
 public void Add(GameControl gc)
 {
     children.Add(gc);
 }