Пример #1
0
        public TargetedDialogBox(SmallPlayerUI target, UIElements.SimpleButton button, float distanceFromMessage,
                                 string message, Rectangle messageArea, UIElements.StretchableImage back)

            : base(button, message, messageArea, back)
        {
            _target      = target;
            _distFromMes = distanceFromMessage;
            followTarget();
        }
Пример #2
0
 public SimpleButton(UIElements.StretchableImage texture, Rectangle area, string text)
     : base()
 {
     _text = text;
     _area = area;
     _position = Utils.pointToVector2(_area.Center);
     _width = _area.Width;
     _height = _area.Height;
     _buttonTexture = texture;
 }
Пример #3
0
 public SimpleButton(UIElements.StretchableImage texture, Rectangle area, string text)
     : base()
 {
     _text          = text;
     _area          = area;
     _position      = Utils.pointToVector2(_area.Center);
     _width         = _area.Width;
     _height        = _area.Height;
     _buttonTexture = texture;
 }
Пример #4
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();
        }
Пример #5
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");
        }
Пример #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();
            }
        }
Пример #7
0
 public ButtonDialogBox(UIElements.SimpleButton button, string message, Rectangle messageArea, UIElements.StretchableImage back)
     : base(message, messageArea, back)
 {
     _button = button;
 }