public RadialAnswerContainer(Texture2D center, Texture2D progressText, float outterRad, float innerRad, string text, float touchedScale = 1.3f) : base(outterRad, innerRad, touchedScale) { _centralImg = center; float width = (float)innerRad * 1.8f; Rectangle textArea = new Rectangle(0, 0, (int)width, (int)width); _questionText = Utils.fitText(text, MyGame.BasicFont, textArea); _progressBar = new ProgressBar(progressText, progressText, textArea); }
private void clearProgressAndDialog() { if (_progressBar != null) { lock (_progressBar) { _progressBar = null; } } _currentDialog = null; }
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; }
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; } } }