Skip to content

Commit

Permalink
feat: more records
Browse files Browse the repository at this point in the history
  • Loading branch information
shoter committed Oct 28, 2023
1 parent 56e4fcd commit 1c4e67d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 27 deletions.
9 changes: 1 addition & 8 deletions OpenTTDAdminPort/Events/AdminClientJoinEvent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,8 @@

namespace OpenTTDAdminPort.Events
{
public class AdminClientJoinEvent : IAdminEvent
public record AdminClientJoinEvent(Player Player) : IAdminEvent
{
public Player Player { get; }

public AdminEventType EventType => AdminEventType.ClientJoin;

public AdminClientJoinEvent(Player player)
{
this.Player = player;
}
}
}
27 changes: 8 additions & 19 deletions OpenTTDAdminPort/Messages/AdminChatMessage.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,15 @@

namespace OpenTTDAdminPort.Messages
{
public class AdminChatMessage : IAdminMessage
public record AdminChatMessage(
NetworkAction NetworkAction,
ChatDestination ChatDestination,
uint Destination,
string Message) : IAdminMessage
{
public AdminMessageType MessageType => AdminMessageType.ADMIN_PACKET_ADMIN_CHAT;

public NetworkAction NetworkAction { get; }

public ChatDestination ChatDestination { get; }

public uint Destination { get; }

public string Message { get; }

public AdminChatMessage(NetworkAction networkAction, ChatDestination chatDestination, uint destination, string message)
{
this.NetworkAction = networkAction;
this.ChatDestination = chatDestination;
this.Message = message;
this.Destination = destination;
}

public override string ToString() => $"{MessageType} - {NetworkAction} - {ChatDestination} - {Destination} - {Message}";
public override string ToString() =>
$"{MessageType} - {NetworkAction} - {ChatDestination} - {Destination} - {Message}";
}
}
}

0 comments on commit 1c4e67d

Please sign in to comment.