feat: add world chat UI

This commit is contained in:
ud18010
2026-07-28 11:54:07 +08:00
parent 09c89aadf0
commit 48aed26725
28 changed files with 5308 additions and 99 deletions
@@ -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(),
};
}
}
}