fix: polish lobby chat and joystick
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user