Exemple #1
0
        void processAnswer(string ans)
        {
            string key = getSoalCode(activePlayer) + noSoal.ToString();

            if (answers.ContainsKey(key))
            {
                if (isTiming)
                {
                    if (ans == answers[key]) //success!
                    {
                        sfxSuccess1.Play();
                        sfxSuccess2.Play();
                        time     = TimeSpan.FromMinutes(2);
                        isTiming = false;
                        MessageBoxScreen msgTrue = new MessageBoxScreen("Selamat, Anda benar!", false);
                        msgTrue.Accepted += new EventHandler <PlayerIndexEventArgs>(msgTrue_Accepted);
                        ScreenManager.AddScreen(msgTrue, ControllingPlayer);
                    }
                    else     //fail! :(
                    {
                        sfxFail.Play();
                        time     = TimeSpan.FromMinutes(2);
                        isTiming = false;
                        MessageBoxScreen msg = new MessageBoxScreen("Maaf, jawaban Anda salah!", false);
                        msg.Accepted += new EventHandler <PlayerIndexEventArgs>(msg_Accepted);
                        ScreenManager.AddScreen(msg, ControllingPlayer);
                    }
                } //else: do nothing
            }
        }
        void showSpinResult()
        {
            wheel.stop();
            string action = partitionContent[activePlayer, wheel.choosenOption];

            if (action.Contains("soal"))
            {
                //kalo soal belum pernah dipake
                if (soalPernah[activePlayer].IndexOf((int)(partitionContent[activePlayer, wheel.choosenOption][partitionContent[activePlayer, wheel.choosenOption].Length - 1] - 48)) == -1)
                {
                    soalPernah[activePlayer].Add((int)(partitionContent[activePlayer, wheel.choosenOption][partitionContent[activePlayer, wheel.choosenOption].Length - 1] - 48));
                    MessageBoxScreen msgSoal = new MessageBoxScreen("Kamu dapat Soal!", false);
                    msgSoal.Accepted += new EventHandler <PlayerIndexEventArgs>(msgSoal_Accepted);
                    ScreenManager.AddScreen(msgSoal, ControllingPlayer);
                }
                else //soal udah pernah dipake, spin lagi
                {
                    MessageBoxScreen msgPernah = new MessageBoxScreen("Sudah pernah dapat soal ini... Putar ulang ya...", false);
                    msgPernah.Accepted += new EventHandler <PlayerIndexEventArgs>(msgPernah_Accepted);
                    ScreenManager.AddScreen(msgPernah, ControllingPlayer);
                }
            }
            else if (action.Contains("hukuman"))
            {
                MessageBoxScreen msgHukum = new MessageBoxScreen("Kamu dapat Hukuman!", false);
                msgHukum.Accepted += new EventHandler <PlayerIndexEventArgs>(msgHukum_Accepted);
                ScreenManager.AddScreen(msgHukum, ControllingPlayer);
            }
            else if (action.Contains("extra"))
            {
                MessageBoxScreen msgExtra = new MessageBoxScreen("Kamu dapat extra spin!", false);
                msgExtra.Accepted += new EventHandler <PlayerIndexEventArgs>(msgHukum_Accepted);
                ScreenManager.AddScreen(msgExtra, ControllingPlayer);
            }
            else if (action.Contains("bonus"))
            {
                MessageBoxScreen msgExtra = new MessageBoxScreen("Kamu dapat bonus!", false);
                msgExtra.Accepted += new EventHandler <PlayerIndexEventArgs>(msgHukum_Accepted);
                ScreenManager.AddScreen(msgExtra, ControllingPlayer);

                if (activePlayer == 0)
                {
                    skorPlayer1 += 100;
                }

                if (activePlayer == 1)
                {
                    skorPlayer2 += 100;
                }

                if (activePlayer == 2)
                {
                    skorPlayer3 += 100;
                }
            }
        }
        /// <summary>
        /// When the user cancels the main menu, ask if they want to exit the sample.
        /// </summary>
        protected override void OnCancel(PlayerIndex playerIndex)
        {
            const string message = "Are you sure you want to exit this sample?";

            MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);

            confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
        }
        /// <summary>
        /// Event handler for when the Quit Game menu entry is selected.
        /// </summary>
        void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            const string message = "Are you sure you want to quit this game?";

            MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);

            confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
        }
        /// <summary>
        /// When the user cancels the main menu, ask if they want to exit the sample.
        /// </summary>
        protected override void OnCancel(PlayerIndex playerIndex)
        {
            const string message = "Are you sure you want to exit this sample?";

            MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);

            confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
        }
        /// <summary>
        /// When the user cancels the main menu, ask if they want to exit the sample.
        /// </summary>
        protected override void OnCancel(PlayerIndex playerIndex)
        {
            const string message = "Yakin ingin keluar?";

            MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);

            confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
        }
Exemple #7
0
        /// <summary>
        /// When the user cancels the main menu, ask if they want to exit the sample.
        /// </summary>
        protected override void OnCancel(PlayerIndex playerIndex)
        {
            const string message = "Yakin ingin keluar?";

            MessageBoxScreen confirmExitMessageBox = new MessageBoxScreen(message);

            confirmExitMessageBox.Accepted += ConfirmExitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmExitMessageBox, playerIndex);
        }
        /// <summary>
        /// Event handler for when the Quit Game menu entry is selected.
        /// </summary>
        void QuitGameMenuEntrySelected(object sender, PlayerIndexEventArgs e)
        {
            const string message = "Are you sure you want to quit this game?";

            MessageBoxScreen confirmQuitMessageBox = new MessageBoxScreen(message);

            confirmQuitMessageBox.Accepted += ConfirmQuitMessageBoxAccepted;

            ScreenManager.AddScreen(confirmQuitMessageBox, ControllingPlayer);
        }
        void buttonShow_Selected(object sender, PlayerIndexEventArgs e)
        {
            tabChoosable      = true;
            wheel.isSpinnable = true;
            MessageBoxScreen msg = new MessageBoxScreen("Tekan enter bila sudah siap!", false, new Vector2(500, 300));

            msg.Accepted += new EventHandler <PlayerIndexEventArgs>(msg_Accepted);
            soal          = new SoalScreen(activePlayer, wheel.choosenOption);
            ScreenManager.AddScreen(soal, ControllingPlayer);
            ScreenManager.AddScreen(msg, ControllingPlayer);
        }
        void invokeSoal()
        {
            tabChoosable      = true;
            wheel.isSpinnable = true;
            MessageBoxScreen msg = new MessageBoxScreen("Tekan enter bila sudah siap!", false, new Vector2(500, 300));

            msg.Accepted += new EventHandler <PlayerIndexEventArgs>(msg_Accepted);
            //soal = new SoalScreen(activePlayer, wheel.choosenOption);
            soal = new SoalScreen(activePlayer, (int)(partitionContent[activePlayer, wheel.choosenOption][partitionContent[activePlayer, wheel.choosenOption].Length - 1] - 48));
            ScreenManager.AddScreen(soal, ControllingPlayer);
            ScreenManager.AddScreen(msg, ControllingPlayer);
        }
        void showSpinResult()
        {
            wheel.stop();
            string action = partitionContent[activePlayer, wheel.choosenOption];
            if (action.Contains("soal"))
            {
                //kalo soal belum pernah dipake
                if (soalPernah[activePlayer].IndexOf((int)(partitionContent[activePlayer, wheel.choosenOption][partitionContent[activePlayer, wheel.choosenOption].Length - 1] - 48)) == -1)
                {
                    soalPernah[activePlayer].Add((int)(partitionContent[activePlayer, wheel.choosenOption][partitionContent[activePlayer, wheel.choosenOption].Length - 1] - 48));
                    MessageBoxScreen msgSoal = new MessageBoxScreen("Kamu dapat Soal!", false);
                    msgSoal.Accepted += new EventHandler<PlayerIndexEventArgs>(msgSoal_Accepted);
                    ScreenManager.AddScreen(msgSoal, ControllingPlayer);
                }
                else //soal udah pernah dipake, spin lagi
                {
                    MessageBoxScreen msgPernah = new MessageBoxScreen("Sudah pernah dapat soal ini... Putar ulang ya...", false);
                    msgPernah.Accepted += new EventHandler<PlayerIndexEventArgs>(msgPernah_Accepted);
                    ScreenManager.AddScreen(msgPernah, ControllingPlayer);
                }

            }
            else if (action.Contains("hukuman"))
            {
                MessageBoxScreen msgHukum = new MessageBoxScreen("Kamu dapat Hukuman!", false);
                msgHukum.Accepted += new EventHandler<PlayerIndexEventArgs>(msgHukum_Accepted);
                ScreenManager.AddScreen(msgHukum, ControllingPlayer);
            }
            else if (action.Contains("extra"))
            {
                MessageBoxScreen msgExtra = new MessageBoxScreen("Kamu dapat extra spin!", false);
                msgExtra.Accepted += new EventHandler<PlayerIndexEventArgs>(msgHukum_Accepted);
                ScreenManager.AddScreen(msgExtra, ControllingPlayer);
            }
            else if (action.Contains("bonus"))
            {
                MessageBoxScreen msgExtra = new MessageBoxScreen("Kamu dapat bonus!", false);
                msgExtra.Accepted += new EventHandler<PlayerIndexEventArgs>(msgHukum_Accepted);
                ScreenManager.AddScreen(msgExtra, ControllingPlayer);

                if (activePlayer == 0)
                {
                    skorPlayer1 += 100;
                }

                if (activePlayer == 1)
                {
                    skorPlayer2 += 100;
                }

                if (activePlayer == 2)
                {
                    skorPlayer3 += 100;
                }
            }
        }
 void invokeSoal()
 {
     tabChoosable = true;
     wheel.isSpinnable = true;
     MessageBoxScreen msg = new MessageBoxScreen("Tekan enter bila sudah siap!", false, new Vector2(500, 300));
     msg.Accepted += new EventHandler<PlayerIndexEventArgs>(msg_Accepted);
     //soal = new SoalScreen(activePlayer, wheel.choosenOption);
     soal = new SoalScreen(activePlayer, (int)(partitionContent[activePlayer, wheel.choosenOption][partitionContent[activePlayer, wheel.choosenOption].Length - 1] - 48));
     ScreenManager.AddScreen(soal, ControllingPlayer);
     ScreenManager.AddScreen(msg, ControllingPlayer);
 }
 void buttonShow_Selected(object sender, PlayerIndexEventArgs e)
 {
     tabChoosable = true;
     wheel.isSpinnable = true;
     MessageBoxScreen msg = new MessageBoxScreen("Tekan enter bila sudah siap!", false, new Vector2(500, 300));
     msg.Accepted += new EventHandler<PlayerIndexEventArgs>(msg_Accepted);
     soal = new SoalScreen(activePlayer, wheel.choosenOption);
     ScreenManager.AddScreen(soal, ControllingPlayer);
     ScreenManager.AddScreen(msg, ControllingPlayer);
 }
Exemple #14
0
        /// <summary>
        /// Updates the state of the game. This method checks the GameScreen.IsActive
        /// property, so the game will stop updating when the pause menu is active,
        /// or if you tab away to a different application.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                    bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, false);

            if (isTiming)
            {
                time = time.Subtract(TimeSpan.FromSeconds(gameTime.ElapsedGameTime.TotalSeconds));
            }

            //Console.WriteLine("total seconds: " + time.TotalSeconds);

            if (time.TotalSeconds < 0)
            {
                time     = TimeSpan.FromSeconds(5);
                isTiming = false;
                MessageBoxScreen msg = new MessageBoxScreen("Waktu habis! Tekan Enter untuk melanjutkan...", false);
                msg.Accepted += new EventHandler <PlayerIndexEventArgs>(msg_Accepted);
                ScreenManager.AddScreen(msg, ControllingPlayer);
            }
            newState = Mouse.GetState();

            if (newState.LeftButton == ButtonState.Pressed && oldState.LeftButton == ButtonState.Released)
            {
            }

            if (newState.LeftButton == ButtonState.Pressed && oldState.LeftButton == ButtonState.Pressed)
            {
            }
            //Console.WriteLine("Distance: " + Vector2.Distance(initDist, curDist));
            //Mouse Debugging
            //wheel.curRot = Vector2.Distance(initDist, curDist)/100;

            oldState = newState;

            foreach (TextureButton tb in buttons)
            {
                tb.Update(gameTime);
            }

            // Gradually fade in or out depending on whether we are covered by the pause screen.
            if (coveredByOtherScreen)
            {
                pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1);
            }
            else
            {
                pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0);
            }

            if (IsActive)
            {
                // Apply some random jitter to make the enemy move around.
                const float randomization = 10;

                // Apply a stabilizing force to stop the enemy moving off the screen.
                Vector2 targetPosition = new Vector2(
                    ScreenManager.GraphicsDevice.Viewport.Width / 2 - gameFont.MeasureString("Insert Gameplay Here").X / 2,
                    200);


                // TODO: this game isn't very fun! You could probably improve
                // it by inserting something more interesting in this space :-)
            }
        }
Exemple #15
0
 void processAnswer(string ans)
 {
     string key = getSoalCode(activePlayer) + noSoal.ToString();
     if (answers.ContainsKey(key))
     {
         if(isTiming){
             if (ans == answers[key]) //success!
             {
                 sfxSuccess1.Play();
                 sfxSuccess2.Play();
                 time = TimeSpan.FromMinutes(2);
                 isTiming = false;
                 MessageBoxScreen msgTrue = new MessageBoxScreen("Selamat, Anda benar!", false);
                 msgTrue.Accepted += new EventHandler<PlayerIndexEventArgs>(msgTrue_Accepted);
                 ScreenManager.AddScreen(msgTrue, ControllingPlayer);
             } else { //fail! :(
                 sfxFail.Play();
                 time = TimeSpan.FromMinutes(2);
                 isTiming = false;
                 MessageBoxScreen msg = new MessageBoxScreen("Maaf, jawaban Anda salah!", false);
                 msg.Accepted += new EventHandler<PlayerIndexEventArgs>(msg_Accepted);
                 ScreenManager.AddScreen(msg, ControllingPlayer);
             }
         } //else: do nothing
     }
 }
Exemple #16
0
        /// <summary>
        /// Updates the state of the game. This method checks the GameScreen.IsActive
        /// property, so the game will stop updating when the pause menu is active,
        /// or if you tab away to a different application.
        /// </summary>
        public override void Update(GameTime gameTime, bool otherScreenHasFocus,
                                                       bool coveredByOtherScreen)
        {
            base.Update(gameTime, otherScreenHasFocus, false);

            if (isTiming)
            {
                time = time.Subtract(TimeSpan.FromSeconds(gameTime.ElapsedGameTime.TotalSeconds));
            }

            //Console.WriteLine("total seconds: " + time.TotalSeconds);

            if (time.TotalSeconds < 0)
            {
                time = TimeSpan.FromSeconds(5);
                isTiming = false;
                MessageBoxScreen msg = new MessageBoxScreen("Waktu habis! Tekan Enter untuk melanjutkan...", false);
                msg.Accepted += new EventHandler<PlayerIndexEventArgs>(msg_Accepted);
                ScreenManager.AddScreen(msg, ControllingPlayer);
            }
            newState = Mouse.GetState();

            if (newState.LeftButton == ButtonState.Pressed && oldState.LeftButton == ButtonState.Released)
            {

            }

            if (newState.LeftButton == ButtonState.Pressed && oldState.LeftButton == ButtonState.Pressed)
            {

            }
            //Console.WriteLine("Distance: " + Vector2.Distance(initDist, curDist));
            //Mouse Debugging
            //wheel.curRot = Vector2.Distance(initDist, curDist)/100;

            oldState = newState;

            foreach (TextureButton tb in buttons)
            {
                tb.Update(gameTime);
            }

            // Gradually fade in or out depending on whether we are covered by the pause screen.
            if (coveredByOtherScreen)
                pauseAlpha = Math.Min(pauseAlpha + 1f / 32, 1);
            else
                pauseAlpha = Math.Max(pauseAlpha - 1f / 32, 0);

            if (IsActive)
            {
                // Apply some random jitter to make the enemy move around.
                const float randomization = 10;

                // Apply a stabilizing force to stop the enemy moving off the screen.
                Vector2 targetPosition = new Vector2(
                    ScreenManager.GraphicsDevice.Viewport.Width / 2 - gameFont.MeasureString("Insert Gameplay Here").X / 2,
                    200);

                // TODO: this game isn't very fun! You could probably improve
                // it by inserting something more interesting in this space :-)
            }
        }