Exemple #1
0
        /// <summary>
        /// Function for when a player is in their Rolling gamestate. Here the dice are displayed
        /// and the player has the option to roll when pressing 'R'. They can also save the dice
        /// by clicking on them.
        /// </summary>
        private void Rolling()
        {
            _diceRow.Hidden = false;
            //RollingDice.Hidden = false;
            if (MonsterController.RollsRemaining(_localPlayer) == 0 || Engine.InputManager.KeyPressed(Keys.E))
            {
                _rollButton.Hidden = true;
                _textPrompts.Clear();
                Client.SendMessage("Rolled: " + GetDiceText(DiceController.GetDice()));
                Client.SendActionPacket(GameStateController.EndRolling());
                //Buy Cards?
                _gameState = AskForCards(MonsterController.Energy(_localPlayer)) ? GameState.BuyCardPrompt : GameState.EndingTurn;
                return;
            }

            /*
             * if (Engine.InputManager.KeyPressed(Keys.R) && RollAnimation <= 0)
             * {
             *  Client.SendActionPacket(GameStateController.Roll());
             *  RollAnimation = 30;
             * }
             */

            if (Engine.InputManager.LeftClick())
            {
                if (_rollButton.MouseOver(Engine.InputManager.FreshMouseState))
                {
                    Client.SendActionPacket(GameStateController.Roll());
                }

                foreach (var ds in _diceRow.DiceSprites)
                {
                    if (ds.MouseOver(Engine.InputManager.FreshMouseState))
                    {
                        ds.Click();
                    }
                }

                /*
                 * if (_rollButton.MouseOver(Engine.InputManager.FreshMouseState) && RollAnimation <= 0)
                 * {
                 *  Client.SendActionPacket(GameStateController.Roll());
                 *  RollAnimation = 30;
                 * }
                 */
            }

            if (_textPrompts.Count > 0)
            {
                _textPrompts.Remove(_textPrompts[_textPrompts.Count - 1]);
            }

            var cardsOwned = "";

            if (MonsterController.Cards(_localPlayer).Count > 0)
            {
                cardsOwned = MonsterController.Cards(_localPlayer)[0].Name;                                                  //TODO only displays first cards owned, need to show all if this works
            }
            _textPrompts.Add(new TextBlock("RollPrompt", new List <string> {
                "Your Turn! Rolls Left: " + MonsterController.GetById(_localPlayer).RemainingRolls,
                "Cards: " + cardsOwned
            }));
        }