Esempio n. 1
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())));
            }
        }
Esempio n. 2
0
        public void AutoBattleEngine_GetResultOutput_Should_Pass()
        {
            var myEngine = new AutoBattleEngine();

            // Get number of rounds
            var Actual = myEngine.GetResultOutput();

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