Esempio n. 1
0
        /// <summary>
        /// Invoked when the double down button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DblDwnBtn_Click(object sender, EventArgs e)
        {
            try
            {
                // Double the player's bet amount
                game.CurrentPlayer.DoubleDown();
                UpdateUIPlayerCards();
                ShowBankValue();

                //Make sure that the player didn't bust
                if (game.CurrentPlayer.HasBust())
                {
                    EndMoveDetected();
                    endResult = EndResult.PlayerBust;
                }
                else
                {
                    // Otherwise, let the dealer finish playing
                    game.DealerPlay(dealer);
                    UpdateUIPlayerCards();
                    EndMoveDetected();
                    endResult = GetGameResult();
                }
            }
            catch (Exception NotEnoughMoneyException)
            {
                MessageBox.Show(NotEnoughMoneyException.Message);
            }
        }
Esempio n. 2
0
        public bool Save(EndResult obj)
        {
            Connect();
            SqlCommand cmd = new SqlCommand("IUEndResult", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@HospitalID", HospitalID);
            cmd.Parameters.AddWithValue("@LocationID", LocationID);
            if (obj.EndResultID == 0)
            {
                cmd.Parameters.AddWithValue("@EndResultID", 0);
                cmd.Parameters.AddWithValue("@Mode", "Add");
            }
            else
            {
                cmd.Parameters.AddWithValue("@EndResultID", obj.EndResultID);
                cmd.Parameters.AddWithValue("@Mode", "Edit");
            }
            cmd.Parameters.AddWithValue("@EndResultName", obj.EndResultName);

            cmd.Parameters.AddWithValue("@CreationID", UserID);
            con.Open();
            int i = cmd.ExecuteNonQuery();

            con.Close();
            if (i > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
 //----------------------------------------------------------------------------------------------------
 public void Save(float t, int winner, EndResult res)
 {
     Debug.Log("Save: " + winner + " " + res.ToString() + " in time " + t);
     time     = t;
     winnerID = winner;
     result   = res;
 }
Esempio n. 4
0
        /// <summary>
        /// Invoked when the deal button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DealBtn_Click(object sender, EventArgs e)
        {
            try
            {
                // If the current bet is equal to 0, ask the player to place a bet
                if ((game.CurrentPlayer.Bet == 0) && (game.CurrentPlayer.Balance > 0))
                {
                    MessageBox.Show("You must place a bet before the dealer deals.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    // Place the bet
                    game.CurrentPlayer.PlaceBet();
                    ShowBankValue();

                    SetUpGameInPlay();
                    //game.DealNewGame(dealer);
                    UpdateUIPlayerCards();

                    EndMoveDetected();

                    // Check see if the current player has blackjack
                    if (game.CurrentPlayer.HasBlackJack())
                    {
                        EndMoveDetected();
                        endResult = EndResult.PlayerBlackJack;
                    }
                }
            }
            catch (Exception NotEnoughMoneyException)
            {
                MessageBox.Show(NotEnoughMoneyException.Message);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Invoked when the player has finished their turn and clicked the stand button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void StandBtn_Click(object sender, EventArgs e)
        {
            // Dealer should finish playing and the UI should be updated
            UpdateUIPlayerCards();

            // Check who won the game
            EndMoveDetected();
            endResult = GetGameResult();
        }
Esempio n. 6
0
        public void GameOver()
        {
            EndResult end = new EndResult(ResultAddvertisement(player, robot1, robot2, robot3));

            if (end.ShowDialog() == DialogResult.OK)
            {
                m_BoardGameForm.Close();
                Application.Exit();
            }
        }
        /// <summary>
        /// Takes an EndResult value and shows the resulting game ending in the UI
        /// </summary>
        /// <param name="endState"></param>
        private void EndGame(EndResult endState)
        {
            switch (endState)
            {
            case EndResult.DealerBust:
                gameOverTextBox.Text = "Dealer Bust!";
                game.PlayerWin();
                break;

            case EndResult.DealerBlackJack:
                gameOverTextBox.Text = "Dealer BlackJack!";
                game.PlayerLose();
                break;

            case EndResult.DealerWin:
                gameOverTextBox.Text = "Dealer Won!";
                game.PlayerLose();
                break;

            case EndResult.PlayerBlackJack:
                gameOverTextBox.Text        = "BlackJack!";
                game.CurrentPlayer.Balance += (game.CurrentPlayer.Bet * (decimal)2.5);
                game.CurrentPlayer.Wins    += 1;
                break;

            case EndResult.PlayerBust:
                gameOverTextBox.Text = "You Bust!";
                game.PlayerLose();
                break;

            case EndResult.PlayerWin:
                gameOverTextBox.Text = "You Won!";
                game.PlayerWin();
                break;

            case EndResult.Push:
                gameOverTextBox.Text        = "Push";
                game.CurrentPlayer.Push    += 1;
                game.CurrentPlayer.Balance += game.CurrentPlayer.Bet;
                break;
            }
            // Update the "My Record" values
            winTextBox.Text  = game.CurrentPlayer.Wins.ToString();
            lossTextBox.Text = game.CurrentPlayer.Losses.ToString();
            tiesTextBox.Text = game.CurrentPlayer.Push.ToString();
            SetUpNewGame();
            ShowBankValue();
            gameOverTextBox.Show();
            // Check if the current player is out of money
            if (game.CurrentPlayer.Balance == 0)
            {
                MessageBox.Show("Out of Money.  Please create a new game to play again.");
                this.Close();
            }
        }
Esempio n. 8
0
 public EzEndResult(
     EndResult result
     )
 {
     if (result.item != null)
     {
         Item = new EzProgress(result.item);
     }
     StampSheet = result.stampSheet;
     StampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
 }
Esempio n. 9
0
        public int Update()
        {
            result = teams.Update();

            if (result == EndResult.Persist)
            {
                parent.AddScore(teams.winTeam);
                var count = MainGameParameter.instance.GetWinCount(teams.winTeam);

                parent.SetNextState(count >= 3 ? STATENAME.End : STATENAME.Result);
            }
            return((int)STATENAME.Changeless);
        }
Esempio n. 10
0
        public int Update()
        {
            result = teams.Update();

            if (result == EndResult.Persist)
            {
                parent.AddScore(teams.winTeam);
                var count = MainGameParameter.instance.GetWinCount(teams.winTeam);

                parent.SetNextState(count >= 3 ? STATENAME.End : STATENAME.Result);
            }
            return (int)STATENAME.Changeless;
        }
Esempio n. 11
0
        // Takes an EndResult value and shows the resulting game ending in the UI
        public void EndGame(EndResult endState)
        {
            String res = refPlayer.Name + ": ";

            switch (endState)
            {
            case EndResult.DealerBust:
                res += "Dealer Bust!";
                game.PlayerWin(refPlayer);
                break;

            case EndResult.DealerBlackJack:
                res += "Dealer BlackJack!";
                break;

            case EndResult.DealerWin:
                res += "Dealer Won!";
                break;

            case EndResult.PlayerBlackJack:
                res += "Player BlackJack!";
                refPlayer.Balance += (refPlayer.Bet * (decimal)2.5);
                break;

            case EndResult.PlayerBust:
                res += "Player Bust!";
                break;

            case EndResult.PlayerWin:
                res += "Player Won!";
                game.PlayerWin(refPlayer);
                break;

            case EndResult.Push:
                res += "Push";
                refPlayer.Balance += refPlayer.Bet;
                break;
            }

            game.PlayerEndGame(res);

            SetUpNewGame();
            Tb_status.Show();

            // Check if the current player is out of money
            if (refPlayer.Balance == 0)
            {
                MessageBox.Show("Out of Money. Please create a new game to play again.");
                this.Close();
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Takes an EndResult value and shows the resulting game ending in the UI
        /// </summary>
        /// <param name="endState"></param>
        private void EndGame(EndResult endState)
        {
            switch (endState)
            {
            case EndResult.DealerBust:
                TempData["resultMessage"] = "Dealer Bust!";
                game.PlayerWin();
                break;

            case EndResult.DealerBlackJack:
                TempData["resultMessage"] = "Dealer BlackJack!";
                game.PlayerLose();
                break;

            case EndResult.DealerWin:
                TempData["resultMessage"] = "Dealer Won!";
                game.PlayerLose();
                break;

            case EndResult.PlayerBlackJack:
                TempData["resultMessage"]   = "BlackJack!";
                game.CurrentPlayer.Balance += (game.CurrentPlayer.Bet * (decimal)2.5);
                game.CurrentPlayer.Wins    += 1;
                break;

            case EndResult.PlayerBust:
                TempData["resultMessage"] = "You Bust!";
                game.PlayerLose();
                break;

            case EndResult.PlayerWin:
                TempData["resultMessage"] = "You Won!";
                game.PlayerWin();
                break;

            case EndResult.Push:
                TempData["resultMessage"]   = "Push";
                game.CurrentPlayer.Push    += 1;
                game.CurrentPlayer.Balance += game.CurrentPlayer.Bet;
                break;
            }

            firstTurn = true;
            ShowBankValue();
            // Check if the current player is out of money
            if (game.CurrentPlayer.Balance == 0)
            {
                TempData["resultMessage"] = "Out of Money. Please create a new game to play again.";
            }
        }
Esempio n. 13
0
        /// <summary>
        /// Invoked when the hit button is clicked
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void HitBtn_Click(object sender, EventArgs e)
        {
            // It is no longer the first turn, set this to false so that the cards will all be facing upwards
            firstTurn = false;
            // Hit once and update UI cards
            game.CurrentPlayer.Hit();
            UpdateUIPlayerCards();

            // Check to see if player has bust
            if (game.CurrentPlayer.HasBust())
            {
                EndMoveDetected();
                endResult = EndResult.PlayerBust;
            }
        }
Esempio n. 14
0
 public void LevelCompleted(EndResult result)
 {
     Debug.Log("Level completed: " + result);
     if (result == EndResult.TIME_UP)
     {
         GameOver();
     }
     else if (result == EndResult.FAILURE)
     {
         GameOver();
     }
     else
     {
         LoadLevelManager.Instance.LoadNextLevel();
     }
 }
Esempio n. 15
0
        private void btCalculate_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(tbFirstNumber.Text) || String.IsNullOrEmpty(tbSecondNumber.Text))
            {
                MessageBox.Show("Typ wat in");  //Shows a MessageBox with "Typ wat in"
            }
            else
            {
                int FirstNumber;                                     //Makes FirstNumber a Interger
                int SecondNumber;                                    //Makes SecondNumber a Interger
                int EndResult;                                       //Makes EndResult a Interger

                FirstNumber  = Convert.ToInt16(tbFirstNumber.Text);  //Converts tbFirstNumber to Interger
                SecondNumber = Convert.ToInt16(tbSecondNumber.Text); //Converts tbSecondNumber to Interger
                switch (cbPlus.SelectedItem)
                {
                case "plus":
                    EndResult        = FirstNumber + SecondNumber;
                    tbEndResult.Text = EndResult.ToString();
                    break;

                case "min":
                    EndResult        = FirstNumber - SecondNumber;
                    tbEndResult.Text = EndResult.ToString();
                    break;

                case "deel":
                    EndResult        = FirstNumber / SecondNumber;
                    tbEndResult.Text = EndResult.ToString();
                    break;

                case "keer":
                    EndResult = FirstNumber * SecondNumber; lol
                    tbEndResult.Text = EndResult.ToString();
                    break;

                default:
                    MessageBox.Show("Geef een teken");
                    break;

                    for (int i = 0; i < 5; i++)
                    {
                        Trace.WriteLine("Test");
                    }
                }
            }
        }
        public JsonResult EditEndResult(int EndResultID, string EndResultName, EndResult EndResult1)
        {
            string _Edit = null;

            if (db.CheckEndResult(EndResultID, EndResultName))
            {
                if (db.Save(EndResult1))
                {
                    _Edit = "EndResult Edited Successfully";
                }
            }
            else
            {
                _Edit = "EndResult Already Exist's";
            }
            return(new JsonResult {
                Data = _Edit, JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }
 public EzEndResult(
     EndResult result
     )
 {
     if (result.item != null)
     {
         Item = new EzProgress(result.item);
     }
     StampSheet = result.stampSheet;
     StampSheetEncryptionKeyId = result.stampSheetEncryptionKeyId;
     if (result.acquireExperience.HasValue)
     {
         AcquireExperience = result.acquireExperience.Value;
     }
     if (result.bonusRate.HasValue)
     {
         BonusRate = result.bonusRate.Value;
     }
 }
Esempio n. 18
0
    public void showPicture(PicturePointerData picturePointerData)
    {
        GameObject result          = picturePointerData.getGameObject();
        int        id              = picturePointerData.getID();
        Vector3    orginalPosition = result.transform.position;

        GameObject EndResult;

        GameObject ShowPictureCollection = transform.GetChild(1).GetChild(0).GetChild(1).GetChild(0).GetChild(0).gameObject;

        foreach (Transform VARIABLE in ShowPictureCollection.transform)
        {
            if (id == VARIABLE.gameObject.GetComponent <PictureAttribute>().ID)
            {
                EndResult = VARIABLE.gameObject;
                EndResult.AddComponent <RadialView>();
                break;
            }
        }
    }
        public ActionResult EndResult(EndResult obj1, FormCollection collection)
        {
            BL_EndResult db = new BL_EndResult();

            try
            {
                if (db.CheckEndResult(obj1.EndResultID, obj1.EndResultName))
                {
                    if (db.Save(obj1))
                    {
                        if (obj1.EndResultID > 0)
                        {
                            ModelState.Clear();
                            TempData["Msg"] = "EndResult Update Successfully";
                            return(RedirectToAction("EndResult", "EndResult"));
                        }
                        else
                        {
                            ModelState.Clear();
                            TempData["Msg"] = "EndResult Saved Successfully";
                            return(RedirectToAction("EndResult", "EndResult"));
                        }
                    }
                }
                else
                {
                    //TempData["Msg"] = "Error";
                    TempData["Msg"] = "EndResult Already Exist's";
                    return(RedirectToAction("EndResult", "EndResult"));
                }

                return(RedirectToAction("EndResult", "EndResult"));
            }
            catch (Exception ex)
            {
                TempData["Msg"] = ex.Message;
                return(RedirectToAction("EndResult", "EndResult"));
            }
        }
Esempio n. 20
0
        public EndResult GetEndResult(int EndResultID)
        {
            Connect();
            EndResult reason = new EndResult();

            SqlCommand cmd = new SqlCommand("GetEndResult", con);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@EndResultID", EndResultID));
            SqlDataAdapter sd = new SqlDataAdapter(cmd);
            DataTable      dt = new DataTable();

            con.Open();
            sd.Fill(dt);
            con.Close();
            foreach (DataRow dr in dt.Rows)
            {
                reason.EndResultID   = Convert.ToInt32(dr["EndResultID"]);
                reason.EndResultName = Convert.ToString(dr["EndResultName"]);
            }

            return(reason);
        }
Esempio n. 21
0
 public EndGameContext(bool wonGame, EndResult endResult)
 {
     WonGame   = wonGame;
     EndResult = endResult;
 }