private void RefreshGame() { OddOneOutActivity activity = this.currentActivity <= this.game.Activities.Length - 1 ? this.game.Activities[this.currentActivity] : null; // We have completed the game. if (activity == null) { this.soundtrack.Stop(); this.bubbleMovement.Stop(); action(null, null); return; } // for (int i = 0; i < 4; i++) { if (activity[i].IsWrong) { this.expectedAnswer = i; break; } } int[] randomOrder = GenerateRandomSequence(); this.FirstOption = activity[randomOrder[0]].Option.ImageSource; this.FirstOptionImg.Source = activity[randomOrder[0]].Option.ImageSource; this.SecondOption = activity[randomOrder[1]].Option.ImageSource; this.SecondOptionImg.Source = activity[randomOrder[1]].Option.ImageSource; this.ThirdOption = activity[randomOrder[2]].Option.ImageSource; this.ThirdOptionImg.Source = activity[randomOrder[2]].Option.ImageSource; this.FourthOption = activity[randomOrder[3]].Option.ImageSource; this.FourthOptionImg.Source = activity[randomOrder[3]].Option.ImageSource; // this.activityStart = DateTime.Now; }
private static void ExtractOddOneOutActivity(ZipArchive archive, IEnumerable <XElement> sequencies, OddOneOutGame activity) { List <OddOneOutActivity> seqs = new List <OddOneOutActivity>(); foreach (XElement sequence in sequencies) { OddOneOutActivity seq = new OddOneOutActivity { new GameOption { Option = new ImageBrush(StreamManipulation.ExtractBitmapImage(archive, string.Format(Images, sequence.Attribute("rightAnswerPath").Value).RemoveFirstSlash())), IsWrong = true }, new GameOption { Option = new ImageBrush(StreamManipulation.ExtractBitmapImage(archive, string.Format(Images, sequence.Attribute("WrongAnswerPath1").Value).RemoveFirstSlash())), IsWrong = false }, new GameOption { Option = new ImageBrush(StreamManipulation.ExtractBitmapImage(archive, string.Format(Images, sequence.Attribute("WrongAnswerPath2").Value).RemoveFirstSlash())), IsWrong = false }, new GameOption { Option = new ImageBrush(StreamManipulation.ExtractBitmapImage(archive, string.Format(Images, sequence.Attribute("WrongAnswerPath3").Value).RemoveFirstSlash())), IsWrong = false } }; seq.PositiveFeedback = sequence.Attribute("positiveFeedback").Value; seq.NegativeFeedback = sequence.Attribute("negativeFeedback").Value; seqs.Add(seq); } activity.Activities = seqs.ToArray(); }