초기커밋
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
|
||||
using Google.Protobuf.WellKnownTypes;
|
||||
|
||||
|
||||
using ServerCore; using ServerBase;
|
||||
using ServerCommon;
|
||||
|
||||
|
||||
namespace GameServer;
|
||||
|
||||
public static class UserBlockNotifyHelper
|
||||
{
|
||||
public static async Task send_GS2C_NTF_BLOCK_USERS(this Player player)
|
||||
{
|
||||
var server_logic = GameServerApp.getServerLogic();
|
||||
|
||||
var ntf_packet = new ClientToGame();
|
||||
ntf_packet.Message = new();
|
||||
ntf_packet.Message.BlockListNoti = new();
|
||||
|
||||
var block_agent_action = player.getEntityAction<BlockUserAgentAction>();
|
||||
|
||||
var block_users = block_agent_action.getBlockUsers();
|
||||
|
||||
foreach (var block_user in block_users.Values)
|
||||
{
|
||||
BlockInfo info = new();
|
||||
|
||||
var block_user_attribute = block_user.getEntityAttribute<BlockUserAttribute>();
|
||||
NullReferenceCheckHelper.throwIfNull(block_user_attribute, () => $"block_user_attribute is null !!! - {player.toBasicString()}");
|
||||
|
||||
info.Guid = block_user_attribute.BlockGuid;
|
||||
|
||||
info.CreateTime = Timestamp.FromDateTime(block_user_attribute.CreateTime);
|
||||
info.IsNew = block_user_attribute.IsNew;
|
||||
|
||||
(var result, var nickname_attrib) = await NicknameDoc.findNicknameFromGuid(block_user_attribute.BlockGuid);
|
||||
if (result.isFail())
|
||||
{
|
||||
Log.getLogger().error($"{block_user_attribute.BlockGuid} user not exitst Nickname");
|
||||
info.NickName = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
NullReferenceCheckHelper.throwIfNull(nickname_attrib, () => $"nickname_attrib is null !!! - {player.toBasicString()}");
|
||||
|
||||
info.NickName = nickname_attrib.Nickname;
|
||||
}
|
||||
|
||||
ntf_packet.Message.BlockListNoti.BlockList.Add(info);
|
||||
}
|
||||
|
||||
server_logic.onSendPacket(player, ntf_packet);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user