コード例 #1
0
        /// <summary>
        /// Function for when player is first starting their turn
        /// </summary>
        private void StartingTurn()
        {
            if (_rollButton.Hidden)
            {
                _rollButton.Hidden = false;
            }
            _diceRow.Hidden = true;
            _diceRow.Clear();

            //RollingDice.Hidden = true;
            // RollingDice.Clear();

            _textPrompts.Clear();
            if (_firstPlay)
            {
                Engine.PlaySound("StartTurn");
                _firstPlay = false;
                Client.SendMessage(_localMonster.Name + " is starting their turn!");
            }
            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
            }));

            if (_rollButton.MouseOver(Engine.InputManager.FreshMouseState) && Engine.InputManager.LeftClick())
            {
                _gameState = GameState.Rolling;
                Client.SendActionPacket(GameStateController.Roll());
                System.Threading.Thread.Sleep(200);
                _diceRow.AddDice(DiceController.GetDice());
                _diceRow.Hidden = false;
                //RollingDice.AddDice(DiceController.GetDice());
                //RollingDice.Hidden = false;
            }
        }
コード例 #2
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
            }));
        }