예제 #1
0
        private void UpdateSchoolScores(IEnumerable <SchoolScoreDto> schools)
        {
            foreach (var school in schools)
            {
                SchoolScore score;
                if (!_schoolScores.TryGetValue(school.Id, out score))
                {
                    score = new SchoolScore {
                        Id = school.Id
                    };
                    _schoolScores.Add(school.Id, score);
                }
                score.Name = school.Name;
                score.UpdateHouseScores(school.Houses);
            }

            if (!_isInitialized)
            {
                if (Initialized != null)
                {
                    Initialized();
                }
                _isInitialized = true;
            }
        }
예제 #2
0
        private void UpdateSchoolScores(IEnumerable<SchoolScoreDto> schools)
        {
            foreach (var school in schools)
            {
                SchoolScore score;
                if (!_schoolScores.TryGetValue(school.Id, out score))
                {
                    score = new SchoolScore { Id = school.Id };
                    _schoolScores.Add(school.Id, score);
                }
                score.Name = school.Name;
                score.UpdateHouseScores(school.Houses);
            }

            if (!_isInitialized)
            {
                if (Initialized != null) Initialized();
                _isInitialized = true;
            }
        }
예제 #3
0
 private void AddHouse(SchoolScore school, string houseName, int id)
 {
     school.UpdateHouseScores(new[]
     {
         new HouseScoreDto
         {
             Id = id,
             Name = houseName,
             Amount = 0
         }
     });
 }
예제 #4
0
 private void IncrementHouse(KeyboardState ks, SchoolScore school)
 {
     if (ks.IsKeyPressedOnce(Keys.D1)) school.HouseScores.ToArray()[0].Amount += _inc;
     if (ks.IsKeyPressedOnce(Keys.D2)) school.HouseScores.ToArray()[1].Amount += _inc;
     if (ks.IsKeyPressedOnce(Keys.D3)) school.HouseScores.ToArray()[2].Amount += _inc;
     if (ks.IsKeyPressedOnce(Keys.D4)) school.HouseScores.ToArray()[3].Amount += _inc;
 }
예제 #5
0
        private void AddSchool(string schoolName, params string[] houseNames)
        {
            SchoolScore school = new SchoolScore { Name = schoolName };
            school.Amount = 0;
            for (int i = 0; i < houseNames.Length; i++)
            {
                AddHouse(school, houseNames[i], i);
            }

            _schoolScores.Add(school);
        }