private void RoundTimer_Tick(object sender, EventArgs e)
        {
            _ticks++;
            int myCountdown = roundLimit - _ticks;

            TimerCountTextbox.Text = myCountdown.ToString();
            if (_ticks == roundLimit)
            {
                RoundTimer.Stop();

                if (PlayerOneGroupbox.Enabled == true)
                {
                    TimeOutSwitch(PlayerOneGroupbox, PlayerTwoGroupbox);
                }
                else if (PlayerTwoGroupbox.Enabled == true)
                {
                    TimeOutSwitch(PlayerTwoGroupbox, PlayerThreeGroupbox);
                }
                else if (PlayerThreeGroupbox.Enabled == true)
                {
                    TimeOutSwitch(PlayerThreeGroupbox, PlayerOneGroupbox);
                }
                StartTimer();
            }
        }
        private void GameplayForm_Load(object sender, EventArgs e)
        {
            PlayerOneGroupbox.Text = Player1.Name;
            PlayerTwoGroupbox.Text = Player2.Name;

            RoundTimer.Start();
        }
示例#3
0
 private void Start()
 {
     CreateGrid();
     CreatePlantArea();
     CreateBlocks();
     _rTime             = FindObjectOfType <RoundTimer>();
     _rScore            = FindObjectOfType <RoundScoring>();
     _rTime.RoundStart += OnRoundChange;
 }
示例#4
0
 private void Awake()
 {
     gameRules        = GetComponent <GameRules>();
     gameStateChanger = GetComponent <GameStateChanger>();
     objectPooler     = GetComponent <ObjectPooler>();
     spriteBucket     = GetComponent <SpriteBucket>();
     panelBucket      = GetComponent <PanelBucket>();
     sessionData      = GetComponent <SessionData>();
     roundCoordinator = GetComponent <RoundCoordinator>();
     roundTimer       = GetComponent <RoundTimer>();
 }
示例#5
0
        public void StartPexeso(int row, int columns)
        {
            CreateCardsForGame(row, columns);
            Score = 0;

            RoundTimer.Start();
            ChoseSecondCardTimer.Start();
            TurnTimer.Start();

            RoundStopWatch.Start();
            TurnStopWatch.Start();
            //ChoseSecondCardStopwatch.Start();
        }
示例#6
0
 private bool disposedValue = false; // 偵測多餘的呼叫
 protected override void Dispose(bool disposing)
 {
     if (!disposedValue)
     {
         if (disposing)
         {
             EffectObjects.Clear();
             GameObjects.Clear();
             UIObjects.Clear();
             RoundTimer.Enabled = false;
             RoundTimer.Dispose();
         }
         disposedValue = true;
     }
     base.Dispose(disposing);
 }
示例#7
0
        }//End PlusLabel

        //Method For Timer
        private void RoundTimer_Tick(object sender, EventArgs e)
        {
            //If Time Remaining Is Not 0 Keep Ticking Down
            //Else Print 'Out Of Time Error'
            if (rtime != 0)
            {
                rtime           = rtime - 1;
                RTimeLabel.Text = rtime + " Seconds";
            }
            else
            {
                RoundTimer.Stop();
                RTimeLabel.Text = "Out Of Time!";
                MessageBox.Show("You Did Not Finish In The Time Allowed!", "Too Bad!");
                DoneButton.PerformClick();
            }//End If Else
            //Make Time Label Red If 10 Seconds Or Less Are Left
            if (rtime <= 10)
            {
                RTimeLabel.BackColor = Color.Red;
            } //End If
        }     //End Round Timer
        private void RoundTimer_Tick(object sender, EventArgs e)
        {
            _ticks++;
            int myCountdown = roundLimit - _ticks;

            TimeCountLabel.Text = myCountdown.ToString();
            if (_ticks == roundLimit)
            {
                RoundTimer.Stop();

                if (PlayerOneGroupbox.Enabled == true)
                {
                    SwitchPlayer(PlayerOneGroupbox, PlayerTwoGroupbox);
                }
                else if (PlayerTwoGroupbox.Enabled == true)
                {
                    SwitchPlayer(PlayerTwoGroupbox, PlayerOneGroupbox);
                }
                _ticks = 0;
                RoundTimer.Start();
            }
        }
        private void GamePlayCompare(Player activeP, Player passiveP, TextBox T, TextBox dispT, GroupBox activeG, GroupBox passiveG)
        {
            string response = activeP.Compare(T, passiveP);

            if (response == null)
            {
                MessageBox.Show("Invalid Entry!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
            }
            string display = T.Text + " - " + response;

            dispT.Text += display + "\r\n";
            Operation.ScrollTextBox(dispT);
            T.ResetText();
            if (response == Operation.WinWord)
            {
                MessageBox.Show($"{activeP.Name} won", "Game Over", MessageBoxButtons.OK, MessageBoxIcon.Information);
                RoundTimer.Stop();
                activeG.Enabled = false;
                return;
            }
            passiveG.Enabled = true;
            activeG.Enabled  = false;
        }
示例#10
0
        void StartRoundTimers(bool initialRound)
        {
            if (gameEnding)
            {
                return;
            }
            if (initialRound)
            {
                roundTimer = new GameObject().AddComponent <RoundTimer>();
                roundTimer.StartTimer(configData.GameSettings.GameTimer_Slasher, configData.GameSettings.GameTimer_Player);
                foreach (var player in SlasherPlayers)
                {
                    player.player.inventory.Strip();
                    string msg;
                    if (player.team == Team.SLASHER)
                    {
                        foreach (var item in configData.Slashers.Clothing)
                        {
                            CreateItem(player.player, item.Key, 1, item.Value, "wear", null, null);
                        }

                        var weapon = configData.Slashers.Weapon;
                        CreateItem(player.player, weapon.Shortname, weapon.Amount, 0, "belt", weapon.AmmoType, weapon.Attachments);
                        CreateItem(player.player, weapon.AmmoType, weapon.AmmoAmount, 0, "main", null, null);

                        msg = "Kill the <color=#cc0000>Hunted</color>";
                    }
                    else
                    {
                        foreach (var item in configData.Players.Clothing)
                        {
                            CreateItem(player.player, item.Key, 1, item.Value, "wear", null, null);
                        }

                        var weapon = configData.Players.Weapon;
                        CreateItem(player.player, weapon.Shortname, weapon.Amount, 0, "belt", weapon.AmmoType, weapon.Attachments);
                        CreateItem(player.player, weapon.AmmoType, weapon.AmmoAmount, 0, "main", null, null);

                        msg = "Hide from the <color=#cc0000>Slasher</color>";
                    }
                    PopupMessage(player.player, msg);
                }
            }
            else
            {
                foreach (var player in SlasherPlayers)
                {
                    string msg;
                    if (player.team == Team.SLASHER)
                    {
                        msg = "The hunter has become the <color=#cc0000>Hunted</color>";
                    }
                    else
                    {
                        var weapon = configData.Slashers.Weapon;
                        CreateItem(player.player, weapon.Shortname, weapon.Amount, 0, "belt", weapon.AmmoType, weapon.Attachments);
                        CreateItem(player.player, weapon.AmmoType, weapon.AmmoAmount, 0, "main", null, null);

                        msg = "Hunt down the <color=#cc0000>Slasher</color>";
                    }
                    PopupMessage(player.player, msg);
                }
            }
        }
示例#11
0
        }//End Form1

        //Method BeginGame Sets Up All Variables For Game Or Round
        public void BeginGame()
        {
            //Declaring Necessary Variables
            int m = 0, n = 0, x = 0, y = 0, a = 0, b = 0, c = 0, d = 0, e = 0, f = 0, t = 0, s = 0;

            //If Else Loops To Make The Game Harder Based On Current Score
            if (totalscore <= 300)
            {
                LevelLabel.Text = "Easy";
                //Addition / Subtraction bounds
                m = -20;
                n = 50;
                //Multiplication Bounds
                x = -10;
                y = 10;
                //Division Bounds
                t = -20;
                s = 100;
                a = 1;
                b = 10;
                //Mod Bounds
                c     = 1;
                d     = 50;
                e     = 1;
                f     = 10;
                rtime = 60;
            }
            else if ((totalscore > 300) && (totalscore <= 600))
            {
                LevelLabel.Text = "Medium";
                //Addition / Subtraction Bounds
                m = -50;
                n = 500;
                //Multiplication Bounds
                x = -15;
                y = 15;
                //Division Bounds
                t = -20;
                s = 150;
                a = 1;
                b = 15;
                //Mod Bounds
                c     = 10;
                d     = 100;
                e     = 10;
                f     = 20;
                rtime = 45;
            }
            else if ((totalscore > 600) && (totalscore <= 1000))
            {
                LevelLabel.Text = "Hard";
                //Addition / Subtraction Bounds
                m = -100;
                n = 1000;
                //Multiplication Bounds
                x = -25;
                y = 25;
                //Division Bounds
                t = -100;
                s = 500;
                a = 1;
                b = 50;
                //Mod Bounds
                c     = 50;
                d     = 200;
                e     = 10;
                f     = 50;
                rtime = 30;
            }//End Levels If Else
            //Getting And Setting Random Number And Putting Them In Their Respective Labels
            ooanum          = randnum.Next(m, n);
            otanum          = randnum.Next(m, n);
            OOALabel.Text   = ooanum.ToString();
            OTALabel.Text   = otanum.ToString();
            aresult         = ooanum + otanum;
            oosnum          = randnum.Next(m, n);
            otsnum          = randnum.Next(m, n);
            sresult         = oosnum - otsnum;
            OOSLabel.Text   = oosnum.ToString();
            OTSLabel.Text   = otsnum.ToString();
            oomnum          = randnum.Next(x, y);
            otmnum          = randnum.Next(x, y);
            mresult         = oomnum * otmnum;
            OOMLabel.Text   = oomnum.ToString();
            OTMLabel.Text   = otmnum.ToString();
            oodnum          = randnum.Next(t, s);
            otdnum          = randnum.Next(a, b);
            dresult         = oodnum / otdnum;
            OODLabel.Text   = oodnum.ToString();
            OTDLabel.Text   = otdnum.ToString();
            oomodnum        = randnum.Next(c, d);
            otmodnum        = randnum.Next(e, f);
            modresult       = oomodnum % otmodnum;
            OOModLabel.Text = oomodnum.ToString();
            OTModLabel.Text = otmodnum.ToString();
            RTimeLabel.Text = rtime.ToString() + " seconds";
            RoundTimer.Start();
        }//End Begin Game
示例#12
0
        }//End Ready Button Click

        //Events Triggered By Pressing The 'Done' Button
        private void DoneButton_Click(object sender, EventArgs e)
        {
            //Declaring Necessary Variables
            int numright = 0, numwrong = 0, roundscore = 0;

            //Stop Timer and Calculate Number Of Correct Answers
            RoundTimer.Stop();
            if (ooanum + otanum == AAF.Value)
            {
                numright++;
            }//End Add Check If
            if (oosnum - otsnum == SAF.Value)
            {
                numright++;
            }//End Subtract Check If
            if (oomnum * otmnum == MAF.Value)
            {
                numright++;
            }//End Multiply Check If
            if (oodnum / otdnum == DAF.Value)
            {
                numright++;
            }//End Divide Check If
            if (oomodnum % otmodnum == ModAF.Value)
            {
                numright++;
            }//End Mod Check If
            //Events To Perform When 'Done' Button Clicked
            numwrong = 5 - numright;
            NextRoundButton.Enabled = true;
            roundscore = CalcRoundScore(numright, numwrong);
            UpdateScore(roundscore);
            AOLabel.Visible               = true;
            AAnswerLabel.Visible          = true;
            AAnswerLabel.Text             = aresult.ToString();
            ATLabel.Visible               = true;
            CSAnswerLabel.Visible         = true;
            CSAnswerLabel.Text            = sresult.ToString();
            ATHLabel.Visible              = true;
            CMAnswerLabel.Visible         = true;
            CMAnswerLabel.Text            = mresult.ToString();
            AFLabel.Visible               = true;
            CDAnswerLabel.Visible         = true;
            CDAnswerLabel.Text            = dresult.ToString();
            AFiLabel.Visible              = true;
            CModAnswerLabel.Visible       = true;
            CModAnswerLabel.Text          = modresult.ToString();
            DoneButton.Visible            = false;
            DoneButton.Enabled            = false;
            NextRoundButton.Enabled       = true;
            ExitButton.Visible            = true;
            ExitButton.Enabled            = true;
            RSLabel.Visible               = true;
            TopRoundScoreLabel.Visible    = true;
            TopRoundScoreLabel.Text       = numright.ToString();
            BottomRoundScoreLabel.Visible = true;
            LineScoreLabel.Visible        = true;
            AAF.Enabled   = false;
            SAF.Enabled   = false;
            MAF.Enabled   = false;
            DAF.Enabled   = false;
            ModAF.Enabled = false;

            //Message Box To Show The Number Of Points Rewarded After Each Round
            MessageBox.Show(" You Get " + roundscore + " Points! Click 'Next Round' When Ready.", "Results");

            //If User Scores Over 1000 Points Print Message and Picture
            if (totalscore >= 1000)
            {
                WinningPictureBox.Visible = true;
                MessageBox.Show("You Beat The Game! You Have Great Math Skills!", "Congratulations!");
                NextRoundButton.Enabled = false;
                DoneButton.Enabled      = false;
                AAF.Enabled             = false;
                SAF.Enabled             = false;
                MAF.Enabled             = false;
                DAF.Enabled             = false;
                ModAF.Enabled           = false;
                ReplayButton.Enabled    = true;
                ReplayButton.Visible    = true;
                ExitButton.Enabled      = true;
                ExitButton.Visible      = true;
            } //End If
        }     //end Done Button Click
        private void ThreePlayersGameplayCompare(
            RadioButton opp1Radio, RadioButton opp2Radio,
            Player activePlayer, Player opp1, Player opp2,
            TextBox activeNums, TextBox activeDisp, TextBox oppDisp, TextBox otherOppDisp,
            GroupBox activeGrp, GroupBox opp1Grp, GroupBox opp2Grp)
        {
            string response = null, display = null;

            //Check which player is selected for number comparison
            if (opp1Radio.Checked && opp1.IsActive)
            {
                response = activePlayer.Compare(activeNums, opp1);
            }

            else if (opp2Radio.Checked && opp2.IsActive)
            {
                response = activePlayer.Compare(activeNums, opp2);
            }

            else
            {
                MessageBox.Show("Choose an opponent in the game", "Notification"); return;
            }

            //Variable to store which player has been selected
            var opponent = (opp1Radio.Checked) ? opp1 : opp2;
            //Variable to hold other players who should get the result
            var otherOpponent = (opp1Radio.Checked) ? otherOppDisp : oppDisp;

            if (response == null)
            {
                MessageBox.Show("Invalid Entry!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return;
            }

            display = activeNums.Text + " - " + response + $" ({opponent.Name})";
            //Carriage return plus a new line
            activeDisp.Text    += display + "\r\n";
            otherOpponent.Text += display + "\r\n";
            Operation.ScrollTextBox(activeDisp);
            Operation.ScrollTextBox(otherOpponent);
            activeNums.ResetText();

            if (response == Operation.WinWord)
            {
                RoundTimer.Stop();
                MessageBox.Show($"{opponent.Name} is out of the game");
                activeGrp.Enabled = false;
                opponent.IsActive = false;
                if (opp1.IsActive)
                {
                    opp1Grp.Enabled = true;
                }
                else if (opp2.IsActive)
                {
                    opp2Grp.Enabled = true;
                }
                else
                {
                    RoundTimer.Stop(); MessageBox.Show($"{activePlayer.Name} has won", "Congratulations", MessageBoxButtons.OK);
                }
                return;
            }
            activeGrp.Enabled = false;
            if (opp1.IsActive)
            {
                opp1Grp.Enabled = true;
            }
            else if (opp2.IsActive)
            {
                opp2Grp.Enabled = true;
            }
        }
 void StartTimer()
 {
     _ticks = 0;
     RoundTimer.Start();
 }