Esempio n. 1
0
        public override void Apply(ImperaPlus.Domain.User user, HistoryTurn historyTurn, DTO.Games.Map.Map previousMap)
        {
            if (historyTurn.Game.State == GameState.Ended)
            {
                return;
            }

            // Apply to current turn
            this.Apply(user, historyTurn.Game);

            // Apply to previous turn map
            this.ApplyMap(user, historyTurn.Game, previousMap);

            var visibleCountries = new HashSet <string>(previousMap.Countries.Select(x => x.Identifier));

            var visibleActions = new List <HistoryEntry>();

            foreach (var action in historyTurn.Actions.ToArray())
            {
                // Check that at least origin or destination of each action is visible, or no country is involved
                if ((action.OriginIdentifier == null && action.DestinationIdentifier == null) ||
                    visibleCountries.Contains(action.OriginIdentifier) ||
                    visibleCountries.Contains(action.DestinationIdentifier))
                {
                    visibleActions.Add(action);
                }
            }

            historyTurn.Actions = visibleActions.ToArray();
        }
 public override void Apply(ImperaPlus.Domain.User user, HistoryTurn historyTurn, DTO.Games.Map.Map previousHistoryTurn)
 {
     // Do not modify anything
 }
 public override void Apply(ImperaPlus.Domain.User user, Game game)
 {
     // Do not modify anything
 }
 public abstract void Apply(ImperaPlus.Domain.User user, HistoryTurn historyTurn, DTO.Games.Map.Map previousMap);
 public abstract void Apply(ImperaPlus.Domain.User user, Game game);
Esempio n. 6
0
 public override void Apply(ImperaPlus.Domain.User user, Game game)
 {
     this.ApplyMap(user, game, game.Map);
 }