Exemplo n.º 1
0
 private void clearProgressAndDialog()
 {
     if (_progressBar != null)
     {
         lock (_progressBar)
         {
             _progressBar = null;
         }
     }
     _currentDialog = null;
 }
Exemplo n.º 2
0
        private void questionWaitUpdate(float dt)
        {
            if (_progressBar == null)
            {
                initProgressBar();
            }

            lock (_progressBar)
            {
                if (_animatedFire != null)
                {
                    _animatedFire.update(dt);
                    updateDialogBox(dt);
                }

                commonUpdate(dt);

                _timeSinceLastQuestion += dt;
                //display progress bar
                _progressBar.Progress = _timeSinceLastQuestion / _questionMaxAllowedTime;

                bool cheat = false;

                KeyboardState keyState = Keyboard.GetState();
                if (keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter) &&
                    keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Space))
                {
                    cheat = true;
                }

                //send timeout onEnd
                if (_timeSinceLastQuestion >= _questionMaxAllowedTime || cheat)
                {
                    Console.WriteLine("send timeout");
                    ServerCom.Instance.Socket.Emit("timeout", new
                    {
                        id = 0//_questionId
                    });

                    _progressBar   = null;
                    _currentDialog = null;
                    UpdateAction   = emptyUpdate;
                }
            }
        }
Exemplo n.º 3
0
        private void initProgressBar()
        {
            _timeSinceLastQuestion = 0f;
            //_questionId = questionInfo.id;

            Rectangle progressArea = new Rectangle((int)MyGame.ScreenCenter.X - 300, (int)MyGame.ScreenCenter.Y - 300
                                                   , 600, 50);

            //_progressBar = new UIElements.ProgressBar(_UIBack, _UIBack, progressArea);
            _animatedFire       = new UIElements.AnimatedTexture(_fireSprite, _fireSprite.Width / 4, _fireSprite.Height, 0.1f, true);
            _animatedFire.Scale = 0.3f;
            _progressBar        = new UIElements.AnimatedProgressBar(_animatedFire, _ropeSprite, progressArea);

            MessageDialogBox msgBox = new MessageDialogBox("You should be answering questions on your phone right now",
                                                           new Rectangle(0, 0, 400, 600), _messageStretchImage);

            msgBox.Position = MyGame.ScreenCenter;
            msgBox.Show();

            _currentDialog = msgBox;
        }