示例#1
0
        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");
        }
示例#2
0
 public ConditionalDialogBox(Utils.conditionChecker checker, string content, Rectangle area, UIElements.StretchableImage back)
     : base(content, area, back)
 {
     _conditionTest = checker;
 }
示例#3
0
        private void initialize()
        {
            NodeJSClient.ServerCom.Instance.majPlayerInfoCB = MajPlayerInfo;
            NodeJSClient.ServerCom.Instance.captureZonesCB = onCaptureTerritories;
            NodeJSClient.ServerCom.Instance.placeCommandersCB = onPlaceCommanders;
            NodeJSClient.ServerCom.Instance.questionCB = onQuestion;
            NodeJSClient.ServerCom.Instance.answersReceivedCB = onQuestionAnswered;
            NodeJSClient.ServerCom.Instance.playerMoveCB = onMoveRequested;
            NodeJSClient.ServerCom.Instance.resultCB = onResults;
            //NodeJSClient.ServerCom.Instance.battleResultCB = onBattleResult; -> done in lookForMove

            //My initialization logic
            _displayedPopups = new List<WarRoom.PopupStr>();

            _commanders = new List<Commander>();

            _userPosition = new Vector2(MyGame.ScreenCenter.X, MyGame.ScreenArea.Height - 100);

            _map = new TestXNA.Map(MyGame.SURFACE_WIDTH, MyGame.SURFACE_HEIGHT);
            _map.loadMap();

            GraphicsDevice GraphicsDevice = MyGame.SpriteBatch.GraphicsDevice;

            _iconImage = MyGame.ContentManager.Load<Texture2D>("Images/GameThumbnail");
            _popupImage = MyGame.ContentManager.Load<Texture2D>("Images/trollFace");
            _arrowImage = MyGame.ContentManager.Load<Texture2D>("Images/Arrow2");
            _mapBackground = MyGame.ContentManager.Load<Texture2D>("Images/Map");
            _mapOverlay = MyGame.ContentManager.Load<Texture2D>("Images/MapOverlay");
            _buttonTexture = MyGame.ContentManager.Load<Texture2D>("Images/buttonScroll");
            _messageTexture = MyGame.ContentManager.Load<Texture2D>("Images/messageScroll");
            _UIBack = MyGame.ContentManager.Load<Texture2D>("Images/RoundedRect");
            _commanderHighlight = MyGame.ContentManager.Load<Texture2D>("Images/TagHighlight");
            _fireSprite = MyGame.ContentManager.Load<Texture2D>("Images/fire");
            _ropeSprite = MyGame.ContentManager.Load<Texture2D>("Images/rope");
            _radialUICenter = MyGame.ContentManager.Load<Texture2D>("Images/centralRose");
            _playerUIBack = MyGame.ContentManager.Load<Texture2D>("Images/playerScroll");
            _radialProgress = MyGame.ContentManager.Load<Texture2D>("Images/centralProgress");

            Rectangle stretchAreaButton = new Rectangle(15, 20, 70, 60);
            _buttonStretchImage = new UIElements.StretchableImage(_buttonTexture, stretchAreaButton);

            Rectangle stretchAreaMessage = new Rectangle(40, 30, 20, 40);
            _messageStretchImage = new UIElements.StretchableImage(_messageTexture, stretchAreaMessage);

            _updateAction = emptyUpdate;

            initializePlayerUIs();
            //initializeRadialUI();
        }
示例#4
0
 public MessageDialogBox(string content, Rectangle area, UIElements.StretchableImage back)
 {
     _backTexture = back;
     _message     = Utils.fitText(content, MyGame.BasicFont, area);
     updateArea();
 }
示例#5
0
 public MessageDialogBox(string content, Rectangle area, UIElements.StretchableImage back)
 {
     _backTexture = back;
     _message = Utils.fitText(content, MyGame.BasicFont, area);
     updateArea();
 }
示例#6
0
        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();
            }
        }