Exemple #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GameStateViewModel"/> class.
        /// </summary>
        /// <param name="eventAggregator">
        /// The event aggregator.
        /// </param>
        public GameStateViewModel(IEventAggregator eventAggregator)
        {
            var eventAgg = eventAggregator;

            // Get service for players
            var players = this.Container.Resolve<IPlayers>(ServiceNames.PlayersService);
            this.player1Player = players.PlayersList[(int)Player.Player1];
            this.player2Player = players.PlayersList[(int)Player.Player2];

            this.Game = this.Container.Resolve<IGame>(ServiceNames.GameService);

            this.MessageColor = Colors.Black;
            this.StateMessage = "Welcome to play Mylly Ultimate. Please choose new game to start the game";

            // Listen state changed messages
            eventAgg.GetEvent<GameStateEvent>().Subscribe(this.StateChanged);
            eventAgg.GetEvent<UndoRedoRestoreEvent>().Subscribe(this.StateChanged);
        }
Exemple #2
0
        /// <summary>
        ///     Initializes a new instance of the <see cref="PlayersService" /> class.
        /// </summary>
        public PlayersService()
        {
            var player1 = new PlayerModel
                              {
                                  Name = PlayerNames.Player1,
                                  Player = Player.Player1,
                                  Color = Colors.Black,
                                  Piece = PieceNames.Circle
                              };
            var player2 = new PlayerModel
                              {
                                  Name = PlayerNames.Player2,
                                  Player = Player.Player2,
                                  Color = Colors.White,
                                  Piece = PieceNames.Circle
                              };

            IList<PlayerModel> players = new List<PlayerModel>();
            players.Add(player1);
            players.Add(player2);

            this.PlayersList = players;
        }
Exemple #3
0
 /// <summary>
 /// The set owner properties.
 ///     Not used
 /// </summary>
 /// <param name="value">
 /// The value.
 /// </param>
 private static void SetOwnerProperties(PlayerModel value)
 {
     // Console.WriteLine(value.Piece);
 }
Exemple #4
0
 /// <summary>
 /// Setter for p data.
 /// </summary>
 /// <param name="element">
 /// The element.
 /// </param>
 /// <param name="value">
 /// The value.
 /// </param>
 public static void SetPData(UIElement element, PlayerModel value)
 {
     element.SetValue(PDataProperty, value);
     SetOwnerProperties(value);
 }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlayerNotification"/> class.
 /// </summary>
 /// <param name="player1">
 /// The player 1.
 /// </param>
 /// <param name="player2">
 /// The player 2.
 /// </param>
 public PlayerNotification(PlayerModel player1, PlayerModel player2)
 {
     this.Player1 = player1;
     this.Player2 = player2;
 }