public async void UpdateQuests()
        {
            var quiz1 = await QuestDataStore.GetItemAsync("quiz1");

            Quest quiz1Quest = new Quest
            {
                Id           = "quiz1",
                Type         = "quiz",
                Name         = "Quiz 1 - Australian History",
                Topic        = "History",
                Experience   = 200,
                QuestDate    = DateTime.Now,
                Status       = "complete",
                QuestResult  = 4,
                NumQuestions = 4,
            };
            await QuestDataStore.UpdateItemAsync(quiz1Quest);
        }
Beispiel #2
0
        public async void OnGroup2Clicked(object obj)
        {
            Quest newItem = new Quest()
            {
                Id         = "group1",
                Status     = "complete",
                Type       = "group",
                Name       = "Complete the Six Hats Quiz",
                Topic      = "Group",
                Experience = 500,
                QuestDate  = DateTime.Now
            };
            await QuestDataStore.UpdateItemAsync(newItem);

            var user1 = await UserDataStore.GetItemAsync("User1");

            HatUser1            = user1.HatColour;
            PersonalExperience1 = user1.PersonalExperience;
            QuestionsAnswered1  = user1.QuestionsAnswered;
            QuestsCompleted1    = user1.QuestsCompleted;
            User newUser = new User()
            {
                Id                 = Guid.NewGuid().ToString(),
                Name               = "User1",
                Username           = "******",
                Password           = null,
                PersonalExperience = PersonalExperience1,
                PartyExperience    = 0 + 500,
                HatColour          = HatUser1,

                //statistics
                QuestionsAnswered            = 75,
                QuestsCompleted              = user1.QuestsCompleted + 1,
                CommentsPosted               = 3,
                AverageQuizAccuracy          = 99,
                AverageTimeTakenEachActivity = 23,

                //trophygained
                Trophy1Gained = false,
                Trophy2Gained = true,
                Trophy3Gained = true,
                Trophy4Gained = true,
                Trophy5Gained = true,
                Trophy6Gained = true,
                Trophy7Gained = false,
                Trophy8Gained = false,
                Trophy9Gained = false
            };
            await UserDataStore.UpdateItemAsync(newUser);

            Groups newGroup = new Groups()
            {
                Id        = Guid.NewGuid().ToString(),
                GroupName = "Crescent Regiment",
                MemberId1 = "User5",
                MemberId2 = "User6",
                MemberId3 = "User7",
                MemberId4 = "User1",
                GroupXP   = 600 + 500
            };
            await GroupDataStore.UpdateItemAsync(newGroup);

            //Display an alert
            await App.Current.MainPage.DisplayAlert("Your journey begins...", "You've joined a party! View the My Party tab for your party progress.", "Continue");

            MessagingCenter.Send <PartySelectionViewModel>(this, "popped");

            await Shell.Current.Navigation.PopToRootAsync().ConfigureAwait(true);

            //await Shell.Current.GoToAsync(nameof(QuestLog));
        }