public EndGameRoom() { Rectangle area = new Microsoft.Xna.Framework.Rectangle( (int)MyGame.ScreenArea.Width - _buttonWidth , (int)_buttonHeight/2 , _buttonWidth , _buttonHeight); _buttonBack = MyGame.ContentManager.Load<Texture2D>("Images/buttonScroll"); _roomBackground = MyGame.ContentManager.Load<Texture2D>("Images/WaitingBack"); _playerUIBack = MyGame.ContentManager.Load<Texture2D>("Images/playerScroll"); _centerRose = MyGame.ContentManager.Load<Texture2D>("Images/centralRose"); _progressTexture = MyGame.ContentManager.Load<Texture2D>("Images/centralProgress"); Texture2D messageBack = MyGame.ContentManager.Load<Texture2D>("Images/messageScroll"); Rectangle stretchAreaButton = new Rectangle(15, 20, 70, 60); UIElements.StretchableImage stretchButtonTexture = new UIElements.StretchableImage(_buttonBack, stretchAreaButton); _restartButton = new UIElements.SimpleButton(stretchButtonTexture, area, "Restart"); }
private void initPickZoneDialog(int player, int nbOfZone) { UIElements.SimpleButton button = new UIElements.SimpleButton( _buttonStretchImage, new Rectangle(0, 0, 150, 90), "OK"); Rectangle boxArea = new Rectangle(0, 0, 400, 600); _pickZoneDialog = new DialogBoxes.TargetedDialogBox( _miniUIs[player], button, 0.7f, PlayerData.Instance[player].Name + "\n" + "Please, pick " + nbOfZone + " free territories", boxArea , _messageStretchImage); _pickZoneDialog.Position = MyGame.ScreenCenter; _pickZoneDialog.Show(); _currentDialog = _pickZoneDialog; }
private void initCommandersInstructionsDialog() { UIElements.SimpleButton button = new UIElements.SimpleButton( _buttonStretchImage, new Rectangle((int)MyGame.ScreenCenter.X - 150, (int)MyGame.ScreenCenter.Y + MyGame.ScreenArea.Height / 4 , 300, 125), "OK"); Rectangle boxArea = new Rectangle(0, 0, 400, 600); _commanderInstructionsDialog = new DialogBoxes.ButtonDialogBox( button, "Spread your commanders on the territories you own.\nChoose wisely.", boxArea, _messageStretchImage); _commanderInstructionsDialog.Position = MyGame.ScreenCenter; _commanderInstructionsDialog.Show(); _currentDialog = _commanderInstructionsDialog; }
public WaitingRoom() { Microsoft.Xna.Framework.Rectangle area = new Microsoft.Xna.Framework.Rectangle( (int)MyGame.ScreenCenter.X - _buttonWidth / 2 , (int)(MyGame.ScreenCenter.Y * 1.75f) - _buttonHeight / 2 , _buttonWidth , _buttonHeight); _buttonBack = MyGame.ContentManager.Load<Texture2D>("Images/buttonScroll"); _roomBackground = MyGame.ContentManager.Load<Texture2D>("Images/WaitingBack"); _playerUIBack = MyGame.ContentManager.Load<Texture2D>("Images/playerScroll"); Texture2D messageBack = MyGame.ContentManager.Load<Texture2D>("Images/messageScroll"); Rectangle stretchAreaButton = new Rectangle(15, 20, 70, 60); UIElements.StretchableImage stretchButtonTexture = new UIElements.StretchableImage(_buttonBack, stretchAreaButton); _startButton = new UIElements.SimpleButton(stretchButtonTexture, area, "Start Game"); _playerUIs = new List<UIElements.LargePLayerUI>(); _posStart = new Vector2(MyGame.ScreenArea.Width / 5, 470f); _offset = new Vector2(MyGame.ScreenArea.Width / 5, 0f); //Create QR Code QRCodeEncoder encoder = new QRCodeEncoder(); string ip = Utils.LocalIPAddress(); Console.WriteLine("\n\n\n\nServer ip : " + ip + "\n\n\n"); if (ip == "") { Rectangle stretchAreaMessage = new Rectangle(30, 30, 40, 40); UIElements.StretchableImage stretchImg = new UIElements.StretchableImage(messageBack, stretchAreaMessage); Console.WriteLine("Creating dialog"); _dialog = new ConditionalDialogBox( delegate() { return Utils.LocalIPAddress() != ""; } , "Network could not be reached\n" + "Please find de way to connect to a reliable, working network\n" + "(Unice hotsport is NOT one of those networks...)" , new Microsoft.Xna.Framework.Rectangle((int)MyGame.ScreenCenter.X , (int)MyGame.ScreenCenter.Y , 600, 600) , stretchImg); _dialog.Position = MyGame.ScreenCenter; _dialog.Show(); } else { System.Drawing.Bitmap qrCodeImage = encoder.Encode(ip); Color[] pixels = new Color[qrCodeImage.Width * qrCodeImage.Height]; for (int y = 0; y < qrCodeImage.Height; y++) { for (int x = 0; x < qrCodeImage.Width; x++) { System.Drawing.Color c = qrCodeImage.GetPixel(x, y); pixels[(y * qrCodeImage.Width) + x] = new Color(c.R, c.G, c.B, c.A); } } _QRCode = new Texture2D( MyGame.SpriteBatch.GraphicsDevice, qrCodeImage.Width, qrCodeImage.Height); _QRCode.SetData<Color>(pixels); int recWidth = MyGame.ScreenArea.Width / 8; _QrCodeArea = new Rectangle((int)(MyGame.ScreenCenter.X - recWidth / 2), 30, recWidth, recWidth); NodeJSClient.ServerCom.Instance.playerConnectCB = OnPlayerConnect; NodeJSClient.ServerCom.Instance.Execute(); //initializeRadialUI(); } }