Beispiel #1
0
        public PlayFieldSpectatorViewModel()
        {
            InGameChatViewModel = new InGameChatViewModel();
            OpponentsViewModel  = new OpponentViewModel[OpponentCount];
            for (int i = 0; i < OpponentCount; i++)
            {
                OpponentsViewModel[i] = new OpponentViewModel();
            }

            ClientChanged += OnClientChanged;
        }
Beispiel #2
0
 private void OnPlayerLeft(int playerId, string playerName, LeaveReasons reason)
 {
     if (Client.IsSpectator)
         return;
     OpponentViewModel opponent = GetOpponentViewModel(playerId);
     if (opponent != null)
     {
         opponent.PlayerId = -1;
         opponent.PlayerName = "Not playing";
         opponent.Team = "";
     }
 }
Beispiel #3
0
        private void OnPlayerJoined(int playerId, string playerName, string team)
        {
            if (Client.IsSpectator)
                return;

            OpponentViewModel opponent = GetOpponentViewModel(playerId);
            if (opponent != null)
            {
                opponent.PlayerId = playerId;
                opponent.PlayerName = playerName;
                opponent.Team = team;
            }
        }
Beispiel #4
0
        private void OnPlayerJoined(int playerId, string playerName, string team)
        {
            if (!Client.IsSpectator)
            {
                return;
            }

            OpponentViewModel opponent = OpponentsViewModel[playerId];

            if (opponent != null)
            {
                opponent.PlayerId   = playerId;
                opponent.PlayerName = playerName;
                opponent.Team       = team;
            }
        }
Beispiel #5
0
        private void OnPlayerLeft(int playerId, string playerName, LeaveReasons reason)
        {
            if (!Client.IsSpectator)
            {
                return;
            }

            OpponentViewModel opponent = OpponentsViewModel[playerId];

            if (opponent != null)
            {
                opponent.PlayerId   = -1;
                opponent.PlayerName = "Not playing";
                opponent.Team       = "";
            }
        }
Beispiel #6
0
        public PlayFieldViewModel()
        {
            _achievementTimer = new Timer(100);
            _achievementTimer.Elapsed += (sender, args) =>
            {
                TimeSpan timeSpan = DateTime.Now - _lastAchievement;
                if (timeSpan.TotalSeconds > 5)
                {
                    AchievementOpacity -= 0.1;
                    if (AchievementOpacity <= 0)
                        _achievementTimer.Stop();
                }
            };

            GameInfoViewModel = new GameInfoViewModel();
            InGameChatViewModel = new InGameChatViewModel();
            PlayerViewModel = new PlayerViewModel();
            OpponentsViewModel = new OpponentViewModel[OpponentCount];
            for (int i = 0; i < OpponentCount; i++)
                OpponentsViewModel[i] = new OpponentViewModel();

            ClientChanged += OnClientChanged;
        }