Files
caliverse_server/GameServer/Contents/Party/RabbitMessageHandler/NotifyPartyInstanceHandler.cs
2025-05-01 07:20:41 +09:00

47 lines
2.0 KiB
C#

using Google.Protobuf;
using Google.Protobuf.WellKnownTypes;
using ServerCore;
using ServerBase;
using ServerCommon;
using ServerCommon.BusinessLogDomain;
using MetaAssets;
namespace GameServer;
public class NotifyPartyInstanceHandler
{
public async Task recvPartyInstance(ServerMessage.Types.PartyInstanceInfoNoti notify)
{
// 1. party 정보
var global_party = GameServerApp.getServerLogic().findGlobalEntity<GlobalParty>();
NullReferenceCheckHelper.throwIfNull(global_party, () => $"global_party is null !!!");
var party = global_party.getParty(notify.PartyGuid);
ArgumentNullException.ThrowIfNull(party);
// 2. party instance 데이터 로딩
var party_instance_action = party.getEntityAction<GlobalPartyDetailInstanceAction>();
ArgumentNullException.ThrowIfNull(party_instance_action);
var result = await party_instance_action.loadPartyInstance();
if (result.isFail()) return;
// 3. party instance 조회
var party_instance_attribute = party.getEntityAttribute<PartyInstanceAttribute>();
ArgumentNullException.ThrowIfNull(party_instance_attribute);
// 4. 파티 인스턴스 정보 알림 ( to client )
var client_message = new ClientToGame();
client_message.Message = new();
client_message.Message.PartyInstanceInfoNoti = new();
client_message.Message.PartyInstanceInfoNoti.InstanceId = party_instance_attribute.InstanceId;
client_message.Message.PartyInstanceInfoNoti.StartTime = party_instance_attribute.StartTime;
client_message.Message.PartyInstanceInfoNoti.EndTime = party_instance_attribute.EndTime;
client_message.Message.PartyInstanceInfoNoti.JoinMemberCount = party_instance_attribute.JoinMemberCount;
client_message.Message.PartyInstanceInfoNoti.IsEnd = party_instance_attribute.InstanceId == 0 ? BoolType.True : BoolType.False;
PartyHelper.BroadcastToClients(party, client_message, new List<string>());
}
}