Esempio n. 1
0
        private IEnumerable <ErrorMessageViewModel> ValidateTopGames(GameGroupLayoutCollectionViewModel topGames)
        {
            var errors = new List <ErrorMessageViewModel>();

            errors.AddRange(ValidateNumberOfGamesInTheTopGamesSection(topGames));
            errors.AddRange(ValidateGamesUsageInTheTopGamesSection(topGames));


            return(errors);
        }
Esempio n. 2
0
 public SkinDefinitionViewModel(IServiceLocator serviceLocator)
 {
     _triggers = new TriggerViewModelCollection(serviceLocator);
     _topGames = new GameGroupLayoutCollectionViewModel("Top Games", _triggers);
     _vipGames = new GameGroupLayoutCollectionViewModel("VIP Top Games", _triggers);
 }
Esempio n. 3
0
        private IEnumerable <ErrorMessageViewModel> ValidateGamesUsageInTheTopGamesSection(GameGroupLayoutCollectionViewModel topGames)
        {
            var errors = new List <ErrorMessageViewModel>();

            var allUsedGames = GetAllUsedGamesDictionary();

            foreach (var gameGroup in topGames)
            {
                foreach (var game in gameGroup.Games)
                {
                    if (!allUsedGames.ContainsKey(game.GameType))
                    {
                        errors.Add(new ErrorMessageViewModel(topGames.Title,
                                                             $"The game '{game.Name}[{game.GameType}]' is used in the '{topGames.Title}' but it is not used in any arena!",
                                                             ErrorServerity.Error,
                                                             () => NavigateToTopGames(topGames)));
                    }
                }
            }

            return(errors);
        }
Esempio n. 4
0
 private void NavigateToTopGames(GameGroupLayoutCollectionViewModel topGames)
 {
     _skinDesigner.NavigateToWorkspace(topGames);
 }
Esempio n. 5
0
        private IEnumerable <ErrorMessageViewModel> ValidateNumberOfGamesInTheTopGamesSection(GameGroupLayoutCollectionViewModel topGames)
        {
            var errors = new List <ErrorMessageViewModel>();

            foreach (var gameGroup in topGames)
            {
                if (gameGroup.Games.Count > Constants.MaxTopGamesItems)
                {
                    errors.Add(new ErrorMessageViewModel(topGames.Title,
                                                         $"The number of the games in the '{topGames.Title}' must be less than or equal to {Constants.MaxTopGamesItems}",
                                                         ErrorServerity.Error,
                                                         () => NavigateToTopGames(topGames)));
                }
            }

            return(errors);
        }
Esempio n. 6
0
        private void LoadGamesGroupCollection(string description, GameGroupLayoutCollection source, GameGroupLayoutCollectionViewModel destination)
        {
            foreach (var layout in source)
            {
                var viewModel = new GameGroupLayoutViewModel(new PlayerStatusTypeViewModel(PlayerStatusType.FromId(layout.PlayerStatus), _skinDefinition.Triggers));

                foreach (var game in layout.Games)
                {
                    AddGameToCollection(game.Id, viewModel.Games, description);
                }

                destination.Add(viewModel);
            }
        }