feat: add world chat UI
This commit is contained in:
@@ -21,6 +21,8 @@ namespace XWorld.Framework.Protocol
|
||||
LobbyState = 13,
|
||||
LobbyMove = 14,
|
||||
LobbyLeave = 15,
|
||||
WorldChatSend = 16,
|
||||
WorldChatMessage = 17,
|
||||
}
|
||||
|
||||
public sealed class HeartbeatMsg
|
||||
@@ -381,4 +383,52 @@ namespace XWorld.Framework.Protocol
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class WorldChatSendMsg
|
||||
{
|
||||
public string Text;
|
||||
|
||||
public byte[] Encode()
|
||||
{
|
||||
var w = new PacketWriter();
|
||||
w.WriteString(Text);
|
||||
return w.ToArray();
|
||||
}
|
||||
|
||||
public static WorldChatSendMsg Decode(byte[] data)
|
||||
{
|
||||
var r = new PacketReader(data);
|
||||
return new WorldChatSendMsg { Text = r.ReadString() };
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class WorldChatMessageMsg
|
||||
{
|
||||
public int PlayerId;
|
||||
public string PlayerName;
|
||||
public string Text;
|
||||
public long ServerTimeMs;
|
||||
|
||||
public byte[] Encode()
|
||||
{
|
||||
var w = new PacketWriter();
|
||||
w.WriteVarInt(PlayerId);
|
||||
w.WriteString(PlayerName);
|
||||
w.WriteString(Text);
|
||||
w.WriteVarLong(ServerTimeMs);
|
||||
return w.ToArray();
|
||||
}
|
||||
|
||||
public static WorldChatMessageMsg Decode(byte[] data)
|
||||
{
|
||||
var r = new PacketReader(data);
|
||||
return new WorldChatMessageMsg
|
||||
{
|
||||
PlayerId = r.ReadVarInt(),
|
||||
PlayerName = r.ReadString(),
|
||||
Text = r.ReadString(),
|
||||
ServerTimeMs = r.ReadVarLong(),
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user