예제 #1
0
파일: Game.cs 프로젝트: Joop7/yamb-game
        public bool EnterDiceValue(IViewTableForm frmTableDisplay, IConfirmForm frmConfirm, ColumnTypes column, LayerTypes layer, FieldTypes field)
        {
            if (_currentDiceThrow == DiceThrow.FIRST && !_turnEnded)
            {
                frmTableDisplay.DisplayMsg(Color.Red, _msg[4]);
                return false;
            }
            else
            {
                if (ValidEntering(frmConfirm, column))
                {
                    try
                    {
                        YambTable.GetInstance().InputValue(column, layer, field, _diceRoller.Dices, _currentDiceThrow);

                        if (column == ColumnTypes.ANNOUNCEMENT)
                        {
                            AnnouncementActions(frmTableDisplay, field);
                        }
                        else
                        {
                            NextTurn();
                            frmTableDisplay.EndOfTurnActions();
                        }

                        if (YambTable.GetInstance().IsTableFull())
                        {
                            frmTableDisplay.GameFinished();
                        }
                    }
                    catch (YambException)
                    {
                        frmTableDisplay.DisplayMsg(Color.Red, _msg[5]);
                        return false;
                    }
                }
                else
                {
                    return false;
                }
            }
            return true;
        }
예제 #2
0
파일: Game.cs 프로젝트: Joop7/yamb-game
 private bool ValidEntering(IConfirmForm frmConfirm, ColumnTypes column)
 {
     if (_currentDiceThrow == DiceThrow.FIRST && column == ColumnTypes.ANNOUNCEMENT)
     {
         return true;
     }
     else
     {
         string msg = GetMessage(column);
         return frmConfirm.ShowMsg(msg);
     }
 }