public MapPlayerLocationButton(MapPlayerLocationGroup group, XNAPanel parent, Point mapLocation, Point miniMapLocation)
            : base(parent, 
            new Rectangle(miniMapLocation.X, miniMapLocation.Y,
                SIZE.X, SIZE.Y), "")
        {
            this.group = group;
            this.mapLocation = mapLocation;
            this.miniMapLocation = miniMapLocation;
            this.backgroundColor = Color.Transparent;
            this.mouseOverColor = Color.Transparent;

            this.font = MenuManager.BUTTON_FONT;
            this.fontColor = Color.Red;

            this.border = null;

            this.onClickListeners += this.OnClick;
        }
        public MapPlayerLocationGroup(XNAPanel parent, Point offset, String mapname)
        {
            this.parent = parent;
            this.offset = offset;

            XmlDocument xmldoc = new XmlDocument();
            xmldoc.Load(Game1.MAPS_FOLDER_LOCATION + "/" + mapname + ".xml");

            foreach (XmlNode rootChild in xmldoc.ChildNodes[1].ChildNodes)
            {
                if (rootChild.Name == "Players")
                {
                    this.buttons.Clear();
                    foreach (XmlNode playerNode in rootChild.ChildNodes)
                    {
                        Point mapLocation = new Point(
                            Int32.Parse(playerNode.Attributes["x"].Value), Int32.Parse(playerNode.Attributes["y"].Value));
                        Point minimapLocation = this.MapToMiniMap(mapLocation);
                        MapPlayerLocationButton button = new MapPlayerLocationButton(
                            this,
                            parent,
                            mapLocation,
                            minimapLocation);
                        this.buttons.AddLast(button);
                    }
                    if (parent is MapSelectionPanel) this.OnMapSelectionChanged(false);
                    else if (parent is MapPreviewPanel) this.OnMapSelectionChanged(true);
                }
                else if (rootChild.Name == "Data")
                {
                    this.mapWidth = Int32.Parse(rootChild.Attributes["width"].Value) *
                        Int32.Parse(rootChild.Attributes["tileWidth"].Value);
                    this.selectedMapHeight = Int32.Parse(rootChild.Attributes["height"].Value) *
                        Int32.Parse(rootChild.Attributes["tileHeight"].Value);
                }
            }

            // Console.WriteLine("StackTrace: '{0}'", Environment.StackTrace);
        }
Beispiel #3
0
        public MultiplayerLobby()
            : base(null, new Rectangle(
                Game1.GetInstance().graphics.PreferredBackBufferWidth / 2 - 400,
                Game1.GetInstance().graphics.PreferredBackBufferHeight / 2 - 300,
                800, 600))
        {
            gamesPanel = new XNAPanel(this, new Rectangle(5, 5, 590, 330));
            gamesPanel.border = new Border(gamesPanel, 1, Color.Blue);

            XNAPanel usersPanel = new XNAPanel(this, new Rectangle(600, 5, 195, 330));
            usersPanel.border = new Border(usersPanel, 1, Color.Blue);

            usersField = new XNATextField(usersPanel, new Rectangle(5, 5, 185, 320), Int32.MaxValue);
            usersField.font = MenuManager.SMALL_TEXTFIELD_FONT;
            usersField.isEditable = false;

            XNAPanel messagesPanel = new XNAPanel(this, new Rectangle(5, 340, 790, 210));
            messagesPanel.border = new Border(messagesPanel, 1, Color.Blue);

            messagesTextField = new XNATextField(messagesPanel, new Rectangle(5, 5, 780, 170), 12);
            messagesTextField.border = new Border(messagesTextField, 1, Color.Black);
            messagesTextField.font = MenuManager.SMALL_TEXTFIELD_FONT;
            messagesTextField.isEditable = false;

            messageTextField = new XNATextField(messagesPanel, new Rectangle(5, 180, 780, 25), 1);
            messageTextField.border = new Border(messageTextField, 1, Color.Black);
            messageTextField.font = MenuManager.SMALL_TEXTFIELD_FONT;
            messageTextField.onTextFieldKeyPressedListeners += this.OnKeyPressed;

            disconnectButton = new XNAButton(this,
                new Rectangle(this.bounds.Width - 105, this.bounds.Height - 45, 100, 40), "Disconnect");
            disconnectButton.onClickListeners += DisconnectBtnClicked;

            createGameButton = new XNAButton(this,
                new Rectangle(5, this.bounds.Height - 45, 100, 40), "Create Game");
            createGameButton.onClickListeners += CreateGameBtnClicked;
        }
Beispiel #4
0
        public GameLobby()
            : base(null,
                new Rectangle(
                Game1.GetInstance().graphics.PreferredBackBufferWidth / 2 - 400,
                Game1.GetInstance().graphics.PreferredBackBufferHeight / 2 - 300,
                800, 600))
        {
            gameOptionsPanel = new XNAPanel(this, new Rectangle(5, 5, 500, 330));
            gameOptionsPanel.border = new Border(gameOptionsPanel, 1, Color.Blue);

            XNAPanel mapPreviewPanel = new XNAPanel(this, new Rectangle(510, 5, 200, 200));
            mapPreviewPanel.border = new Border(gameOptionsPanel, 1, Color.Blue);

            this.creationTime = new TimeSpan(DateTime.UtcNow.Ticks).TotalMilliseconds;

            XNAPanel messagesPanel = new XNAPanel(this, new Rectangle(5, 340, 790, 210));
            messagesPanel.border = new Border(messagesPanel, 1, Color.Blue);

            messagesTextField = new XNATextField(messagesPanel, new Rectangle(5, 5, 780, 170), Int32.MaxValue);
            messagesTextField.border = new Border(messagesTextField, 1, Color.Black);
            messagesTextField.font = MenuManager.SMALL_TEXTFIELD_FONT;
            messagesTextField.isEditable = false;

            messageTextField = new XNATextField(messagesPanel, new Rectangle(5, 180, 780, 25), 1);
            messageTextField.border = new Border(messageTextField, 1, Color.Black);
            messageTextField.font = MenuManager.SMALL_TEXTFIELD_FONT;
            messageTextField.onTextFieldKeyPressedListeners += this.OnKeyPressed;

            startGameButton = new XNAButton(this,
                new Rectangle(this.bounds.Width - 105, this.bounds.Height - 45, 100, 40), "Start Game");
            startGameButton.onClickListeners += StartGame;
            startGameButton.visible = false;

            leaveGameButton = new XNAButton(this,
                new Rectangle(5, this.bounds.Height - 45, 100, 40), "Leave Game");
            leaveGameButton.onClickListeners += LeaveGame;
        }
Beispiel #5
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
            base.Initialize();

            XNAPanel parent = new XNAPanel(null, new Rectangle(0, 0, 1024, 768));
            parent.backgroundColor = Color.Transparent;
            parent.border = null;

            graphics.SynchronizeWithVerticalRetrace = false;
            graphics.ApplyChanges();
            //this.displayLbl = new XNALabel(parent, new Rectangle(5, 5, 200, 20), "");
            //this.displayLbl.backgroundColor = Color.Transparent;
            //BalloonPaintBucketMainGame.GetInstance().Initialize(this);
            //SquatBugsMainGame.GetInstance().Initialize(this);
            //KinectTestMainGame.GetInstance().Initialize(this);

            MenuManager.GetInstance().ShowMenu(MenuManager.Menu.MainMenu);
            StateManager.GetInstance().SetState(StateManager.State.MainMenu);
            KeyboardManager.GetInstance().keyPressedListeners += this.OnKeyPressed;
        }