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; }
private bool CheckForAutoInput(IViewTableForm frmTableDisplay) { //Ako je najavljeno i bačeno je 3 puta, automatski se upiuje vrijednost DiceThrow diceThrow = IncreaseThrowCount(); if (diceThrow == DiceThrow.FIRST && _autoValueInput) { EnterDiceValue(frmTableDisplay, null, ColumnTypes.ANNOUNCEMENT, GetFieldsLayer(_announcedField), _announcedField); return false; } return true; }
public void SelectDice(IViewTableForm frmTableDisplay, int diceIndex) { if (_currentDiceThrow != DiceThrow.FIRST) { _selectedDices[diceIndex - 1] = !_selectedDices[diceIndex - 1]; if (_selectedDices[diceIndex - 1]) { frmTableDisplay.DisplayDiceSelection(diceIndex, Color.Transparent); } else { frmTableDisplay.DisplayDiceSelection(diceIndex, Color.SteelBlue); } } }
private void AnnouncementActions(IViewTableForm frmTableDisplay, FieldTypes field) { if (_announced) { _announced = false; _autoValueInput = false; NextTurn(); frmTableDisplay.EndOfTurnActions(); } else { _announcedField = field; _announced = true; _autoValueInput = true; } frmTableDisplay.AnnouncementDisplayActions(_announced); }
public void RollDices(IViewTableForm frmTableDisplay) { YambTable.GetInstance().AddObserver(frmTableDisplay); if (_turnEnded) { frmTableDisplay.DisplayMsg(Color.Purple, _msg[1]); } else if (OnlyAnnouncementLeft() && !_announced && _currentDiceThrow == DiceThrow.SECOND) { frmTableDisplay.DisplayMsg(Color.Red, _msg[2]); } else { frmTableDisplay.DisplayMsg(Color.ForestGreen, ""); _diceRoller.RollDices(_selectedDices); frmTableDisplay.SimulateRollingDice(_selectedDices); frmTableDisplay.DisplayGivenDices(_diceRoller.Dices, _selectedDices); int throwsLeft = frmTableDisplay.DecreasDisplayDiceThrow(); bool displayInputValueMsg = CheckForAutoInput(frmTableDisplay); if (throwsLeft == 0 && displayInputValueMsg) { frmTableDisplay.DisplayMsg(Color.ForestGreen, _msg[3]); } else { frmTableDisplay.DisplayMsg(Color.ForestGreen, _msg[0]); } } }