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
@@ -584,6 +584,7 @@ namespace XGame
lobbyWorld?.HandleFrame(frame);
break;
case FrameworkOpcode.WorldChatMessage:
Debug.Log("[CSharpClientApp] recv WorldChatMessage bytes=" + (frame.Payload?.Length ?? 0));
worldChat?.HandleWorldChatMessage(WorldChatMessageMsg.Decode(frame.Payload));
break;
}
@@ -701,13 +702,25 @@ namespace XGame
private void SendWorldChat(string text)
{
text = (text ?? string.Empty).Trim();
if (text.Length == 0 || lobbyNet == null)
if (text.Length == 0)
{
return;
}
if (lobbyNet == null)
{
Debug.LogWarning("[CSharpClientApp] drop WorldChatSend: lobbyNet is null");
return;
}
if (!lobbyNet.IsConnected)
{
Debug.LogWarning("[CSharpClientApp] drop WorldChatSend: lobbyNet is disconnected");
return;
}
byte[] payload = new WorldChatSendMsg { Text = text }.Encode();
Debug.Log("[CSharpClientApp] send WorldChatSend bytes=" + payload.Length);
lobbyNet.SendFramework(
FrameworkOpcode.WorldChatSend,
new WorldChatSendMsg { Text = text }.Encode());
payload);
}
private void CloseWorldChat()
@@ -40,7 +40,7 @@ namespace XGame
private const float DirectionChangeDot = 0.98f;
private const float JoystickRadius = 74f;
private const float JoystickKnobRadius = 28f;
private const float JoystickPadding = 34f;
private const float JoystickPadding = 100.0f;
private const float JoystickDeadZone = 0.18f;
private const float JoystickAcquireRadiusMultiplier = 1.6f;
private const float CameraMinDistance = 3.5f;