fix: polish lobby chat and joystick

This commit is contained in:
ud18010
2026-07-28 17:23:11 +08:00
parent 48aed26725
commit 053a95b4fb
11 changed files with 176 additions and 9 deletions
+5 -1
View File
@@ -221,6 +221,7 @@ namespace XWorld.Server.Gateway
{
if (!_sessions.IsConnected(pid))
{
_logger.Warn($"world chat ignored pid={pid} reason=not_connected");
return;
}
@@ -228,6 +229,7 @@ namespace XWorld.Server.Gateway
string text = (req.Text ?? string.Empty).Trim();
if (text.Length == 0)
{
_logger.Warn($"world chat ignored pid={pid} reason=empty");
return;
}
if (text.Length > MaxWorldChatTextLength)
@@ -246,7 +248,9 @@ namespace XWorld.Server.Gateway
ServerTimeMs = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
};
byte[] encoded = msg.Encode();
foreach (int targetPid in _sessions.ConnectedPlayerIds())
IReadOnlyList<int> targets = _sessions.ConnectedPlayerIds();
_logger.Info($"world chat pid={pid} name={name} length={text.Length} targets={targets.Count}");
foreach (int targetPid in targets)
{
SendFramework(targetPid, FrameworkOpcode.WorldChatMessage, encoded);
}