示例#1
0
 public void Receive(Virvar.Net.ServerPacket msg)
 {
     if (msg.Scores != null)
     {
         _gameState.Scores = msg.Scores;
     }
 }
示例#2
0
 public void Receive(Virvar.Net.ServerPacket msg)
 {
     foreach (var playerHealth in msg.PlayersHealths)
     {
         // обновление состояния здоровья персонажа
         if (_gameState.Players.ContainsKey(playerHealth.Key))
             _gameState.Players[playerHealth.Key].Health = playerHealth.Value;
     }
     foreach (var playerMana in msg.PlayersMana)
     {
         // обновление состояния маны персонажа
         if (_gameState.Players.ContainsKey(playerMana.Key))
             _gameState.Players[playerMana.Key].Mana = playerMana.Value;
     }
 }
 public void Receive(Virvar.Net.ServerPacket msg)
 {
     foreach (var item in msg.PlayersConnections)
     {
         if (item.Value == Virvar.Net.ConnectionState.Connected)
         {
             if (!_gameState.Players.ContainsKey(item.Key))
             {
                 _gameState.CreateCharacter(item.Key);
             }
         }
         else if (item.Value == Virvar.Net.ConnectionState.Disconnected)
         {
             _gameState.RemoveCharacter(item.Key);
         }
     }
 }