Esempio n. 1
0
        // Upon Auto Battle clicked, run a new Auto Battle
        // Return a score after the battle end.
        private async void AutoBattleButton_Command(object sender, EventArgs e)
        {
            // Can create a new battle engine...
            var myEngine = new AutoBattleEngine();

            var result = myEngine.RunAutoBattle();

            if (result == false)
            {
                await DisplayAlert("Error", "No Characters Available", "OK");

                return;
            }

            if (myEngine.GetRoundsValue() < 1)
            {
                await DisplayAlert("Error", "No Rounds Fought", "OK");

                return;
            }

            var myResult = myEngine.GetResultsOutput();
            var myScore  = myEngine.GetScoreValue();

            var outputString = "Battle Over! Score " + myScore.ToString();

            var action = await DisplayActionSheet(outputString, "Cancel", null, "View Score");

            if (action == "View Score")
            {
                var myScoreObject = myEngine.GetScoreObject();
                await Navigation.PushAsync(new Views.Scores.ScoreDetailPage(new ScoreDetailViewModel(myScoreObject)));
            }
        }
Esempio n. 2
0
        public void AutoBattleEngine_GetScoreObject_Should_Pass()
        {
            var myEngine = new AutoBattleEngine();

            // Get score object
            var Actual = myEngine.GetScoreObject();

            // Assert that it's not null.
            Assert.AreNotEqual(null, Actual, TestContext.CurrentContext.Test.Name);
        }
        public void AutoBattleEngine_GetScoreObject_Default_Should_Pass()
        {
            // Arrange

            // Act
            var result = Engine.GetScoreObject();

            // Reset

            // Assert
            Assert.IsNotNull(result);
        }
        // This ensures the GetScoreObject doesn't return a null object
        public void AutoBattleEngine_GetScoreObject_Should_Pass()
        {
            MockForms.Init();
            // New AutoBattleEngine object
            AutoBattleEngine test1 = new AutoBattleEngine();

            // Call GetResultsOutput
            var Actual = test1.GetScoreObject();

            // Assert
            Assert.IsNotNull(Actual, TestContext.CurrentContext.Test.Name);
        }
        /// <summary>
        /// Jump to the Dungeon
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        async void AutobattleButton_Clicked(object sender, EventArgs e)
        {
            // Run the Autobattle simulation from here
            AutoBattleEngine AutoEngine = new AutoBattleEngine();

            var catchResult = await AutoEngine.RunAutoBattle();

            ScoreModel endScore = AutoEngine.GetScoreObject();

            // Call to the Score Page

            await Navigation.PushModalAsync(new NavigationPage(new ScorePage(new GenericViewModel <ScoreModel>(endScore))));
        }
        public void AutoBattleEngine_GetScoreObject_Should_Pass()
        {
            // Arrange
            var myEngine = new AutoBattleEngine();

            // Act
            var Actual = myEngine.GetScoreObject();

            // Reset

            // Assert
            Assert.NotNull(Actual, TestContext.CurrentContext.Test.Name);
        }
Esempio n. 7
0
        public async void AutobattleButton_Clicked(object sender, EventArgs e)
        {
            // Call into Auto Battle from here to do the Battle...

            //var Engine = new Game.Engine.AutoBattleEngine();

            String BattleMessage = "";

            var result = await Engine.RunAutoBattle();

            var Score = Engine.GetScoreObject();

            //string BattleMessage = string.Format("Number of Rounds: 7 \n Monsters Killed: 19\n EXP Gained:9500\n Items Dropped:\n Blue Horn X 1, Golden Hair Pin X 3");

            BattleMessage = string.Format("Done {0} Rounds", Score.RoundCount);

            BattleMessageValue.Text = BattleMessage;
        }
Esempio n. 8
0
        // Auto Battle Starts here when this button is clicked
        private async void AutoBattleButton_Command(object sender, EventArgs e)
        {
            // Can create a new battle engine...
            var myBattleEngine = new AutoBattleEngine();

            // run auto battle
            var result = myBattleEngine.RunAutoBattle();

            if (result == false)
            {
                await DisplayAlert("Error", "No Characters Available", "OK");

                return;
            }

            if (myBattleEngine.GetRoundsValue() < 1)
            {
                await DisplayAlert("Error", "No Rounds Fought", "OK");

                return;
            }

            // output results of the game after battle is over
            var myResult = myBattleEngine.GetResultsOutput();
            var myScore  = myBattleEngine.GetScoreValue();



            var outputString = "Mellow Fox Battle Over!";

            // the pop up for either cancel or see the score details
            var action = await DisplayActionSheet(outputString,
                                                  "Cancel",
                                                  null,
                                                  "View Score Results");

            // Show the results
            if (action == "View Score Results")
            {
                var myScoreObject = myBattleEngine.GetScoreObject();
                await Navigation.PushAsync(new GameOver(new ScoreDetailViewModel(myScoreObject)));
            }
        }
Esempio n. 9
0
        // Button Logic for AutoBattle page.
        private async void AutoBattleButton_Command(object sender, EventArgs e)
        {
            // Hold the score property to give to the score navigation later
            Score myScoreObject = new Score();

            // Can create a new battle engine...
            var myEngine = new AutoBattleEngine();


            //await Task.Run(async () =>
            //{
            var result = myEngine.ExecuteAutoBattle();

            if (result == false)
            {
                await DisplayAlert("Error", "No Characters Avaialbe", "OK");

                return;
            }

            if (myEngine.GetRoundCount() < 1)
            {
                await DisplayAlert("Error", "No Rounds Fought", "OK");

                return;
            }

            var myResult = myEngine.GetResultsOutput();
            var myScore  = myEngine.GetScoreValue();

            var outputString = "Battle Over! Score " + myScore.ToString();

            myScoreObject = myEngine.GetScoreObject();
            // });

            await Navigation.PushAsync(new ScoreDetailPage(new ScoreDetailViewModel(myScoreObject)));
        }
Esempio n. 10
0
        public async void AutobattleButton_Clicked(object sender, EventArgs e)
        {
            // Call into Auto Battle from here to do the Battle...

            // To See Level UP happening, a character needs to be close to the next level
            var Character = new CharacterModel
            {
                ExperienceTotal = 300,          // Enough for next level
                Name            = "Mike Level Example",
                Speed           = 100,          // Go first
            };

            var CharacterPlayer = new PlayerInfoModel(Character);

            Engine.CharacterList.Add(CharacterPlayer);

            await Engine.RunAutoBattle();

            var Score = Engine.GetScoreObject();

            var BattleMessage = string.Format("Done {0} Rounds", Score.RoundCount);

            BattleMessageValue.Text = BattleMessage;
        }
Esempio n. 11
0
        // When this button is clicked, run auto battle and return results
        private async void AutoBattleButton_Command(object sender, EventArgs e)
        {
            // Can create a new battle engine...
            var myBattleEngine = new AutoBattleEngine();

            await DisplayAlert("Starting autobattle...", null, "Continue");

            // Start AutoBattle
            myBattleEngine.RunAutoBattle();

            // Display result of AutoBattle
            await DisplayAlert(null, myBattleEngine.GetResultOutput(), null, "Next");

            // String to hold score.
            var outputString = "Score: " + myBattleEngine.GetScoreValue();

            // Show player their score, and allow option to view more details.
            var action = await DisplayActionSheet(outputString, "Cancel", null, "View Score");

            // If user wants to view more score details, take them there.
            if (action == "View Score")
            {
                await Navigation.PushAsync(new ScoreDetailPage(new ScoreDetailViewModel(myBattleEngine.GetScoreObject())));
            }
        }