示例#1
0
 /// <summary>
 /// Constructs a game user
 /// </summary>
 /// <param name="serverUser">Server user</param>
 public AGameUser(IServerUser serverUser)
 {
     if (serverUser == null)
     {
         throw new ArgumentNullException(nameof(serverUser));
     }
     if (!serverUser.IsValid)
     {
         throw new ArgumentException("Server user is not valid.", nameof(serverUser));
     }
     ServerUser = serverUser;
     serverUser.OnUsernameUpdated       += () => OnUsernameUpdated?.Invoke();
     serverUser.OnUserLobbyColorUpdated += () => OnUserLobbyColorUpdated?.Invoke();
     serverUser.OnGameLoadingFinished   += () => OnGameLoadingFinished?.Invoke();
     serverUser.OnClientTicked          += (entityDeltas, hits) => OnClientTicked?.Invoke(entityDeltas, hits);
     serverUser.OnServerTicked          += (time, entityDeltas, hits) => OnServerTicked?.Invoke(time, entityDeltas, hits);
 }
示例#2
0
 /// <summary>
 /// Updates user lobby color
 /// </summary>
 /// <param name="color">Lobby color</param>
 public void UpdateUserLobbyColor(Color lobbyColor)
 {
     SetLobbyColorInternally(lobbyColor);
     OnUserLobbyColorUpdated?.Invoke();
     ServerLobby.SendUserLobbyColorChangedMessage(this);
 }
示例#3
0
 /// <summary>
 /// Invokes the user lobby color updated event
 /// </summary>
 public void InvokeUserLobbyColorUpdatedEvent() => OnUserLobbyColorUpdated?.Invoke();