Exemple #1
0
 public PolygonMapAreaMV(SelectionMarker selectionMarker, ICountryQuestion question, GeoPolygon polygon, double gloablLeft, double gloablTop, double gloablScale)
     : base(selectionMarker, question, polygon.Bounds, false)
 {
     Points = polygon.Shell
              .Select(c => Tuple.Create((c.X - gloablLeft) * gloablScale, (c.Y - gloablTop) * gloablScale))
              .ToList();
 }
Exemple #2
0
        public GameAnswerMV(IImageDataProvider imageDataProvider, ICountryQuestion question, ICountryAnswer answer)
        {
            _question = question;
            _answer   = answer;

            _flag = imageDataProvider.GetImage(_answer.Country.SmallFlag);

            GuessCommand = new RelayCommand(() => MessengerInstance.Send(new CountryGuessNotification(_question, _answer)));
        }
Exemple #3
0
        public CircleMapAreaMV(SelectionMarker selectionMarker, ICountryQuestion question, double gloablLeft, double gloablTop, double gloablScale)
            : base(selectionMarker, question, question.Country.Bounds, true)
        {
            var bounds = question.Country.Bounds;

            var width  = (bounds.Right - bounds.Left) * gloablScale;
            var height = (bounds.Bottom - bounds.Top) * gloablScale;

            Size = Math.Sqrt(Math.Pow(width, 2) + Math.Pow(height, 2)) + 40;

            Left = (bounds.Left - gloablLeft) * gloablScale - (Size - width) / 2;
            Top  = (bounds.Top - gloablTop) * gloablScale - (Size - height) / 2;

            question.OnStateChanged += (s, e) => Visible = e.State == QuestionState.Unanswered;
        }
Exemple #4
0
        private IList <IAnswer> GenerateAnswers(ICountryQuestion question)
        {
            var country = question.Country;

            var isHard   = Difficulty == Difficulty.Hard;
            var isNormal = Difficulty == Difficulty.Normal;

            var excluded = new HashSet <ICountryInfo>(Questions
                                                      .Cast <ICountryQuestion>()
                                                      .Where(o => o == question || o.State == QuestionState.Correct || (o.State == QuestionState.Incorrect && !isHard))
                                                      .Select(o => o.Country));

            IEnumerable <ICountryInfo> source = Questions
                                                .Cast <ICountryQuestion>()
                                                .Select(o => o.Country)
                                                .Where(c => !excluded.Contains(c))
                                                .Select(c => new { Country = c, Order = _random.Next() })
                                                .OrderBy(i => i.Order)
                                                .Select(i => i.Country)
                                                .Union(_randomizedContryList
                                                       .Where(c => !excluded.Contains(c))
                                                       .Skip(_random.Next() % (_randomizedContryList.Count - excluded.Count - 7)))
                                                .ToList();

            var count = 5;

            if (isNormal || isHard)
            {
                source = country.Borders
                         .Where(b => !b.Excluded && !excluded.Contains(b.Neighbor))
                         .Select(b => b.Neighbor)
                         .Select(c => new { Country = c, Order = _random.Next() })
                         .OrderBy(i => i.Order)
                         .Select(i => i.Country)
                         .Union(source)
                         .ToList();

                count = 7;
            }

            return(source
                   .Distinct()
                   .Take(count)
                   .Union(Enumerable.Repeat(country, 1))
                   .OrderBy(c => c.AdministrativeName)
                   .Select(c => new CountryAnswer(c, !isHard, true) as IAnswer)
                   .ToList());
        }
Exemple #5
0
        public MapAreaMV(SelectionMarker selectionMarker, ICountryQuestion question, GeoBounds bounds, bool markerOnly)
        {
            _selectionMarker = selectionMarker;
            _question        = question;

            _question.OnStateChanged           += (s, e) => FillState = e.State;
            _selectionMarker.OnSelectedChanged += (s, e) => Selected = e;


            StartGuessCommand = new RelayCommand(() =>
            {
                if (_question.State == QuestionState.Unanswered && !_selectionMarker.Selected)
                {
                    MessengerInstance.Send(new StartCountryGuessNotification(_question, _selectionMarker));
                }
            });

            Fill = new CountryAreaFill(question.Country.LargeFlag, bounds, question.Country.Bounds, markerOnly);

            ZIndex  = question.Country.ZIndex;
            Visible = true;
        }
Exemple #6
0
 public CountryGuessNotification(ICountryQuestion question, ICountryAnswer answer)
 {
     Question = question;
     Answer   = answer;
 }
 public StartCountryGuessNotification(ICountryQuestion question, SelectionMarker marker)
 {
     Question = question;
     Marker   = marker;
 }
 public QuizGameAnswerMV(IImageDataProvider imageDataProvider, ICountryQuestion question, ICountryAnswer answer, int column, int row)
     : base(imageDataProvider, question, answer)
 {
     Column = column;
     Row    = row;
 }