public void OnSetPlayerName(uint clientId, SetPlayerNameClientMessage clientClientMessage) { GameState.SetPlayerName(clientId, clientClientMessage.Name); Messenger.Broadcast(new SetPlayerNameServerMessage(clientId, clientClientMessage.Name)); Logger.Log($"Player {clientId} set name: {clientClientMessage.Name}"); GameServer.BroadCastTop(); }
public void OnPlayerHit(uint clientId, PlayerHitClientMessage msg) { var hitterPlayer = GameState.GetPlayer(msg.PlayeId); if (hitterPlayer != null && hitterPlayer.Hp > 0) { var targetPlayer = GameState.HitPlayer(msg.PlayeId, msg.HitPoints, clientId); Messenger.Broadcast(new SetPlayerHpServerMessage(targetPlayer)); if (targetPlayer.Hp == 0) { Logger.Log(GameState.top); GameServer.BroadCastTop(); } } }