예제 #1
0
        //private int[] _turnsLeft;
        public MainForm(string[] players)
        {
            InitializeComponent();

            _fs = new FileSystem();

            _exitOnClose = true;

            _random = new Random();
            _dice   = new Die[] { die1, die2, die3, die4, die5 };

            _players = players;

            //_yahtzeesRolled = 0;

            _scoreSheet = new ScoreSheet(_players);
            pnlMain.Controls.Add(_scoreSheet);
            _scoreSheet.Margin   = new Padding(3);
            _scoreSheet.Location = new Point(_scoreSheet.Margin.Left,
                                             _scoreSheet.Margin.Top);

            InitializeRolls();
            SetDiceStatusEffects();

            lblStatusMessage.Text = (_players.Length > 1) ? "Okay, " + _scoreSheet.CurrentPlayer
                                    + ", it's your turn. To begin, please "
                                    + "roll the dice."
                                                          : "To begin, please roll the dice.";

            _scoreSheet.TurnChanged += ScoreSheet_TurnChanged;
        }
예제 #2
0
        public Form1()
        {
            InitializeComponent();
            for (int i = 1; i < 6; i++)
            {
                dieArray[i] = new Die(6);
            }

            picBoxArrayList.Add(picDie1);
            picBoxArrayList.Add(picDie2);
            picBoxArrayList.Add(picDie3);
            picBoxArrayList.Add(picDie4);
            picBoxArrayList.Add(picDie5);



            picArray[1] = picDie1;
            picArray[2] = picDie2;
            picArray[3] = picDie3;
            picArray[4] = picDie4;
            picArray[5] = picDie5;

            chkArray[1] = checkBox1;
            chkArray[2] = checkBox2;
            chkArray[3] = checkBox3;
            chkArray[4] = checkBox4;
            chkArray[5] = checkBox5;
            scoreSheet  = new ScoreSheet(dieArray);
        }
예제 #3
0
        public ScoreSheetViewModel(ScoreSheet scoreSheet, DiceRollerViewModel diceRollerViewModel)
        {
            this.diceRollerViewModel = diceRollerViewModel;
            this.scoreSheet          = scoreSheet;
            scoreLines = new List <ScoreLineViewModel>();
            List <ScoreLineViewModel> _scoreLines = new List <ScoreLineViewModel>();

            foreach (ScoreLine scoreLine in this.scoreSheet.ScoreLines)
            {
                _scoreLines.Add(new ScoreLineViewModel(scoreLine));
            }
            scoreLines = _scoreLines.AsReadOnly();
        }