示例#1
0
        // GET: Board
        public ActionResult Index()
        {
            BdHelper helper = new BdHelper {
                Brow = Board.Brow, Irow = Board.Irow, Nrow = Board.Nrow, Grow = Board.Grow, Orow = Board.Orow
            };

            helper.totalBalls = Ball.totalBalls;

            Card.GenerateCard();

            helper.intRowB = Card.intRowB;
            helper.intRowI = Card.intRowI;
            helper.intRowN = Card.intRowN;
            helper.intRowG = Card.intRowG;
            helper.intRowO = Card.intRowO;

            return(View(helper));
        }
示例#2
0
        // GET: Board/Create
        public ActionResult Create()
        {
            Ball.CreateBall();

            //BdHelper

            if (Ball.letter == 'B')
            {
                int pos = Board.Brow.IndexOf(0);
                if (pos != -1)
                {
                    Board.Brow.RemoveAt(pos);
                    Board.Brow.Add(Ball.number);
                }
                else
                {
                    Create();
                }
            }

            if (Ball.letter == 'I')
            {
                int pos = Board.Irow.IndexOf(0);
                if (pos != -1)
                {
                    Board.Irow.RemoveAt(pos);
                    Board.Irow.Add(Ball.number);
                }
                else
                {
                    Create();
                }
            }

            if (Ball.letter == 'N')
            {
                int pos = Board.Nrow.IndexOf(0);
                if (pos != -1)
                {
                    Board.Nrow.RemoveAt(pos);
                    Board.Nrow.Add(Ball.number);
                }
                else
                {
                    Create();
                }
            }

            if (Ball.letter == 'G')
            {
                int pos = Board.Grow.IndexOf(0);
                if (pos != -1)
                {
                    Board.Grow.RemoveAt(pos);
                    Board.Grow.Add(Ball.number);
                }
                else
                {
                    Create();
                }
            }

            if (Ball.letter == 'O')
            {
                int pos = Board.Orow.IndexOf(0);
                if (pos != -1)
                {
                    Board.Orow.RemoveAt(pos);
                    Board.Orow.Add(Ball.number);
                }
                else
                {
                    Create();
                }
            }

            BdHelper helper = new BdHelper {
                Brow = Board.Brow, Irow = Board.Irow, Nrow = Board.Nrow, Grow = Board.Grow, Orow = Board.Orow
            };

            helper.totalBalls     = Ball.totalBalls;
            helper.lastCalledBall = new KeyValuePair <int, char>(Ball.number, Ball.letter);

            helper.intRowB = Card.intRowB;
            helper.intRowI = Card.intRowI;
            helper.intRowN = Card.intRowN;
            helper.intRowG = Card.intRowG;
            helper.intRowO = Card.intRowO;


            return(View(helper));
        }