Exemplo n.º 1
0
        private void Cell_Click(object sender, EventArgs e)
        {
            JeopardyButton btn = (JeopardyButton)sender;
            Gameboard      gb  = (Gameboard)Session["Gameboard"];

            gb.getQuestion(btn.category, btn.dollarValue).display = false;
            updateGameboard(gb);
            Session["Gameboard"] = gb;
        }
Exemplo n.º 2
0
        /// <summary>
        /// retrieve the question for the clicked cell and redirect to wager or questionui
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Cell_Click(object sender, EventArgs e)
        {
            JeopardyButton btn = (JeopardyButton)sender;
            Gameboard      gb  = (Gameboard)Session["Gameboard"];

            gb.getQuestion(btn.category, btn.dollarValue).display = false;
            Session["Gameboard"] = gb;
            Question q = gb.getQuestion(btn.category, btn.dollarValue);

            Session["Question"] = q;
            if (q.wagerActive)
            {
                Response.Redirect("Wager.aspx");
            }
            else
            {
                Response.Redirect("QuestionUI.aspx");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// create and initialize elements of the gameboard display
        /// </summary>
        /// <param name="gb">current gameboard</param>
        private void drawGameboard(Gameboard gb)
        {
            List <JeopardyButton> buttons = new List <JeopardyButton>();
            TableRow Header = new TableRow();

            tblGameboard.Rows.Add(Header);
            foreach (string category in gb.roundCategories)
            {
                TableCell cell = new TableCell();
                cell.ForeColor       = System.Drawing.Color.White;
                cell.HorizontalAlign = HorizontalAlign.Center;
                cell.VerticalAlign   = VerticalAlign.Middle;
                cell.Text            = category;
                cell.CssClass        = "boardHead";
                Header.Cells.Add(cell);
            }
            foreach (int value in gb.values)
            {
                TableRow row = new TableRow();
                tblGameboard.Rows.Add(row);
                foreach (string category in gb.roundCategories)
                {
                    Question  q    = gb.getQuestion(category, value);
                    TableCell cell = new TableCell();

                    cell.CssClass        = "boardCell";
                    cell.HorizontalAlign = HorizontalAlign.Center;
                    cell.VerticalAlign   = VerticalAlign.Middle;
                    JeopardyButton b = new JeopardyButton();
                    b.category    = category;
                    b.dollarValue = value;
                    b.Text        = "$" + value.ToString();
                    cell.Controls.Add(b);
                    b.Click += Cell_Click;
                    buttons.Add(b);
                    b.CssClass = "GameBoardCell";

                    row.Cells.Add(cell);
                }
            }
            Session["GameBoardButtons"] = buttons;
            updateGameInfo();
        }