58 lines
1.9 KiB
C#
58 lines
1.9 KiB
C#
using Google.Protobuf;
|
|
using Google.Protobuf.WellKnownTypes;
|
|
|
|
|
|
using ServerCore;
|
|
using ServerBase;
|
|
using ServerCommon;
|
|
using ServerCommon.BusinessLogDomain;
|
|
using MetaAssets;
|
|
|
|
|
|
namespace GameServer;
|
|
|
|
public class NotifyInvitePartyRecvResultHandler
|
|
{
|
|
public async Task recvInvitePartyRecvResult(ServerMessage.Types.GS2C_NTF_PARTY_INVITE_RESULT notify)
|
|
{
|
|
// 0. client login 체크
|
|
var player_manager = GameServerApp.getServerLogic().getPlayerManager();
|
|
ArgumentNullException.ThrowIfNull(player_manager);
|
|
|
|
if (!player_manager.tryGetUserByPrimaryKey(notify.InviteHostGuid, out var player))
|
|
{
|
|
Log.getLogger().error($"Failed to get recv user !! - {notify.InviteUserGuid} / {nameof(recvInvitePartyRecvResult)}");
|
|
return;
|
|
}
|
|
|
|
ArgumentNullException.ThrowIfNull(player);
|
|
|
|
// 1. client 에 파티초대 결과 전송
|
|
var message = new ClientToGame
|
|
{
|
|
Message = new()
|
|
{
|
|
InvitePartyResult = new()
|
|
{
|
|
ErrorCode = notify.ErrorCode,
|
|
InviteUserGuid = notify.InviteUserGuid
|
|
}
|
|
}
|
|
};
|
|
|
|
GameServerApp.getServerLogic().onSendPacket(player, message);
|
|
|
|
if (notify.ErrorCode == ServerErrorCode.Success) return;
|
|
|
|
// 2. 실패시 send list 삭제
|
|
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
|
|
ArgumentNullException.ThrowIfNull(global_party);
|
|
|
|
var party = global_party.getParty(notify.InvitePartyGuid);
|
|
ArgumentNullException.ThrowIfNull(party);
|
|
|
|
var party_send_action = party.getEntityAction<GlobalPartyInvitePartySendAction>();
|
|
NullReferenceCheckHelper.throwIfNull(party_send_action, () => $"party_send_action is null !!!");
|
|
_ = await party_send_action.deleteInvitePartySend(notify.InviteUserGuid);
|
|
}
|
|
} |