using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using ServerCore; using ServerBase; using ServerCommon; using Nettention.Proud; using System.Diagnostics.CodeAnalysis; using Amazon.DynamoDBv2.DocumentModel; namespace GameServer { public class OwnedBlockList { //BlockListEntity blockListEntity = new(); public OwnedBlockList() { } // public async Task LoadDB(string accountGuid) // { // // var data = await GameServerApp.Instance.MainDB.GetBlockList(accountGuid); // // if (data == null) // // { // // Log.getLogger().error("GetBlockList dataList is null"); // // return false; // // } // // // // blockListEntity = data; // return true; // } // public bool BlockUser(string myGuid, string targetGuid, string targetNickName, [MaybeNullWhen(false)] out Document document) // { // document = null; // BlockInfo blockInfo = blockListEntity.MakeNewBlockInfo(targetGuid, targetNickName); // if (!blockListEntity.Attr.blockList.TryAdd(targetGuid, blockInfo)) // { // Log.getLogger().error($"BlockList TryAdd Error myGuid : {myGuid}, targetGuid = {targetGuid}, targetNickName = {targetNickName}"); // return false; // } // document = new();// blockListEntity.DocumentForInsert(myGuid, blockInfo); // // return true; // } // // public List GetBlockList() // { // return blockListEntity.Attr.blockList.Values.ToList(); // } // // public BlockInfo? GetBlockInfo(string guid) // { // if (!blockListEntity.Attr.blockList.TryGetValue(guid, out var blockInfo)) // { // //Log.getLogger().error($"GetBlockInfo TryGetValue return false guid : {guid}"); // return null; // } // // return blockInfo; // } // // public bool isBlockUser(string guid) // { // return blockListEntity.Attr.blockList.ContainsKey(guid); // } // public async Task isBlocked(string? myGuid, string guid) // { // if (myGuid == null) return false; // // BlockListAttr? attr = await getOthersBlockList(guid); // if (attr is null) return false; // // return attr.blockList.ContainsKey(myGuid); // } // public async Task getOthersBlockList(string accountGuid) // { // // BlockListEntity? entity = await GameServerApp.Instance.MainDB.GetBlockList(accountGuid); // // if (entity is null) return null; // // // return entity.Attr; // return null; // } // public bool CancelBlock(string myGuid, string targetGuid, [MaybeNullWhen(false)] out Document document) // { // //document = blockListEntity.DocumentForDelete(myGuid, targetGuid); // document = new(); // if (!blockListEntity.Attr.blockList.Remove(targetGuid)) // { // Log.getLogger().warn($"BlockList TryAdd Error myGuid : {myGuid}, targetGuid = {targetGuid}"); // } // return true; // } // // public bool CheckBlockUser(string targetGuid) // { // return blockListEntity.Attr.blockList.ContainsKey(targetGuid); // } // // public void SendInfo(HostID hostId) // { // ClientToGame clientToGame = new ClientToGame(); // clientToGame.Message = new ClientToGameMessage(); // clientToGame.Message.BlockListNoti = new ClientToGameMessage.Types.BlockListNoti(); // clientToGame.Message.BlockListNoti.BlockList.AddRange(blockListEntity.Attr.blockList.Values.ToArray()); // //GameServer.Instance._proxy.Message(hostId, RmiContext.ReliableSend, clientToGame); // } } }