コード例 #1
0
        public SpinView(SpinController spinC)
        {
            InitializeComponent();
            _controllerSpin = spinC;

            Spin.Font = new Font(Spin.Font.FontFamily, Spin.Font.Size + 50f, Spin.Font.Style);
            spinlbl = Spin;

            //btn_spin.Enabled = false;
        }
コード例 #2
0
        private void Roulette_Load(object sender, EventArgs e)
        {
            Console.WriteLine(money);
            int aantalNummers = 1;
            int marginHorizontal = 5;
            int marginVertical = 5;
            int marginLeftFromNumbers = 50;

            ////////// SPIN START //////////
            for (int spinNummer = 0; spinNummer < aantalNummers; ++spinNummer)
            {
                // Maak instantie aan van spinController
                SpinController tijdelijkeTeerling = new SpinController(this);

                spin.Add(tijdelijkeTeerling);
            }

            // spin tonen
            for (int spinNummer = 0; spinNummer < aantalNummers; ++spinNummer)
            {
                // Maak instantie aan van spinController
                SpinView spinView = spin[spinNummer].getView();

                // breedte van spinner ophalen en positie berekenen (0 * breedte spin, ...)
                int horizontalPosition = spinNummer * spinView.Width;

                spinView.Location = new System.Drawing.Point(horizontalPosition, 0);

                Controls.Add(spinView);
            }
            ////////// SPIN END //////////

            ////////// BOARD START //////////

            //controllers maken
            for (int i = 0; i < 36; i++)
            {
                BoardController tmpBoardControl = new BoardController(this);
                numbers.Add(tmpBoardControl);
            }

            //variabelen om grid te maken
            int heightAmount = 0;
            int widthAmount = 0;

            //laten zien
            for (int i = 0; i < 36; i++)
            {
                BoardView boardView = numbers[i].getView();

                int horizontalPosition = aantalNummers * spin[0].getView().Width + marginLeftFromNumbers + widthAmount * (boardView.Width + marginHorizontal);
                int verticalPosition = (heightAmount * (boardView.Height + marginVertical)) + 10;
                boardView.Location = new System.Drawing.Point(horizontalPosition, verticalPosition);
                heightAmount++;
                if (heightAmount == 3)
                {
                    heightAmount = 0;
                    widthAmount++;
                }

                boardView.setNumber(i + 1);
                boardView.setColour();
                Controls.Add(boardView);
            }
            // 0 button
            zero = new BoardController(this);
            BoardView zeroView = zero.getView();

            zeroView.setNumber(0);
            zeroView.resize(numbers[0].getView().Height * 3 + marginVertical * 2);
            zeroView.Location = new System.Drawing.Point(spin[0].getView().Width + 6, 10);
            zeroView.setColour();
            ///
            ////////// BOARD END //////////

            ////////// BET START //////////
            int[] betAmounts = { 1, 5, 25, 100, 500 };

            for (int i = 0; i < betAmounts.Length; i++)
            {
                MakeBetController tempBet = new MakeBetController(betAmounts[i], this);
                bets.Add(tempBet);
            }
            int amountBetsAdded = 0;
            bool makeFirstActive = true;
            for (int i = 0; i < betAmounts.Length; i++)
            {
                MakeBetView betView = bets[i].getView();
                if (makeFirstActive)
                {
                    bets[i].getView().makeActive();
                    makeFirstActive = false;
                }
                betView.Location = new System.Drawing.Point(500 + bets[0].getView().Width * amountBetsAdded, spin[0].getView().Height - betView.Height);
                amountBetsAdded++;
                Controls.Add(betView);
            }

            MakeBetController bet1 = new MakeBetController(1, this);
            MakeBetView bet1View = bet1.getView();
            bet1View.Location = new System.Drawing.Point(500, spin[0].getView().Height - bet1View.Height);
            Controls.Add(bet1View);
            ////////// BET END //////////

            Controls.Add(zeroView);

            /////MONEY/////
            moneyC = new MoneyController(this);
            moneyV = moneyC.getView();

            moneyV.Location = new System.Drawing.Point(spin[0].getView().Width + 5, spin[0].getView().Height - moneyC.getView().Height);
            Controls.Add(moneyV);
            /////MONEY END/////
        }