Update UnityGameSession.cs
This commit is contained in:
@@ -163,6 +163,9 @@ namespace BrewMonster.Network
|
||||
{
|
||||
BaseSecurity.Initizalize();
|
||||
ProtocolFactory.RegisterAllProtocols();
|
||||
// Type 204 is used for both addfriendrqst (server→client request) and addfriendrqstres (client→server response).
|
||||
// Client only receives addfriendrqst; ensure decode uses it so we don't get InvalidCastException.
|
||||
Protocol.Register<addfriendrqst>((uint)ProtocolType.RPC_ADDFRIENDRQST);
|
||||
_gameSession = new GameSession();
|
||||
#if UNITY_EDITOR
|
||||
var path = Application.dataPath.Substring(0, Application.dataPath.LastIndexOf("Assets"));
|
||||
@@ -633,6 +636,10 @@ namespace BrewMonster.Network
|
||||
{
|
||||
Instance._gameSession.Friend_GetList();
|
||||
}
|
||||
public static void Friend_AddResponse(uint xid, bool agree)
|
||||
{
|
||||
Instance._gameSession.Friend_AddResponse(xid, agree);
|
||||
}
|
||||
public static void c2s_CmdTeamKickMember(int idMember)
|
||||
{
|
||||
Instance._gameSession.c2s_SendCmdTeamKickMember(idMember);
|
||||
@@ -708,15 +715,15 @@ namespace BrewMonster.Network
|
||||
/// <summary>
|
||||
/// Handles unexpected server disconnections. Shows a message box and returns to login.
|
||||
/// </summary>
|
||||
private void OnFriendRequestReceived(int srcroleid, string askerName)
|
||||
private void OnFriendRequestReceived(uint xid, int srcroleid, string askerName)
|
||||
{
|
||||
string name = string.IsNullOrEmpty(askerName) ? ("Player " + srcroleid) : askerName;
|
||||
CECUIManager.Instance?.ShowMessageBox(
|
||||
title: "Friend Request",
|
||||
message: $"{name} wants to add you as a friend.",
|
||||
messageBoxType: MessageBoxType.BothYesNoButton,
|
||||
onClickedYes: () => { /* TODO: accept and call friend_AddResponse */ },
|
||||
onClickedNo: () => { /* TODO: refuse */ });
|
||||
onClickedYes: () => Friend_AddResponse(xid, agree: true),
|
||||
onClickedNo: () => Friend_AddResponse(xid, agree: false));
|
||||
}
|
||||
|
||||
private void OnAddFriendResultReceived(byte retcode, string message)
|
||||
|
||||
Reference in New Issue
Block a user