//using Amazon.Runtime.Internal.Util; //using Google.Protobuf.WellKnownTypes; //using ServerCommon; //using ServerCore; using ServerBase; //using System; //using System.Collections.Concurrent; //using System.Collections.Generic; //using System.Data; //using System.Linq; //using System.Text; //using System.Threading.Tasks; //using static GameServer.ClientSessionManager; //using static GameServer.NoticeChatManager; //using static ServerCommon.BuffData; //namespace GameServer //{ // public class NoticeChatManager // { // private static readonly NoticeChatManager _instance = new(); // public static NoticeChatManager Instance { get { return _instance; } } // NoticeChatEntity noticeChatEntity = new(); // public async Task LoadNoticeChat() // { // var document = await GameServerApp.Instance.MainDB.GetNoticeChatList(); // if (document == null) // { // return; // } // noticeChatEntity = new NoticeChatEntity(document); // List CopyNoticeChats = CopyData(); // List removeNoticeChats = new(); // foreach (var info in CopyNoticeChats) // { // while (true) // { // if (info.repeatCount == 0) // { // removeNoticeChats.Add(info); // break; // } // if (info.startTime.ToDateTime() > DateTime.UtcNow) // { // break; // } // info.repeatCount -= 1; // info.startTime = info.startTime.ToDateTime().AddMinutes(info.repeatMinuteTime).ToTimestamp(); // } // } // foreach(var info in removeNoticeChats) // { // CopyNoticeChats.Remove(info); // } // noticeChatEntity.Attr.noticeList = CopyNoticeChats; // } // public void UpdateChat() // { // List CopyNoticeChats = CopyData(); // foreach (var info in CopyNoticeChats) // { // if (info.startTime <= DateTime.UtcNow.ToTimestamp()) // { // if (info.messageType != 10 && info.messageType != 11) // { // Log.getLogger().error($"NoticeChatInfo messageType is invalid. - GMTOOL Data. messageType : {info.messageType}"); // DelChat(info); // continue; // } // if (info.repeatCount <= 0) // { // DelChat(info); // continue; // } // List languageChatInfos = new(); // foreach (var detail in info.detailInfos) // { // ClientToGame clientMsg = new(); // clientMsg.Message = new ClientToGameMessage(); // clientMsg.Message.Chat = new(); // clientMsg.Message.Chat.Sender = info.sender; // clientMsg.Message.Chat.Type = info.messageType; // clientMsg.Message.Chat.Message = detail.chatMessage; // languageChatInfos.Add(new LanguageChatInfo() { languageType = detail.language, message = clientMsg }); // } // ClientSessionManager.Instance.ChatBroadcast(languageChatInfos); // info.repeatCount -= 1; // info.startTime = info.startTime.ToDateTime().AddMinutes(info.repeatMinuteTime).ToTimestamp(); // } // } // } // private List CopyData() // { // return new List(noticeChatEntity.Attr.noticeList); // } // public void DelChat(NoticeChatInfo noticeChatInfo) // { // noticeChatEntity.Attr.noticeList.Remove(noticeChatInfo); // } // public async Task TempFuncAddData(int messageType, string KoMessage, string EnMessage) // { // if(messageType != 10 && messageType != 11) // { // return; // } // int id = 0; // foreach (var noticeChatInfo in noticeChatEntity.Attr.noticeList) // { // if (id < noticeChatInfo.Id) // { // id = noticeChatInfo.Id; // } // } // NoticeChatInfo noticeChat = new(); // noticeChat.Id = id + 1; // noticeChat.startTime = DateTime.UtcNow.ToTimestamp(); // noticeChat.repeatCount = 10; // noticeChat.repeatMinuteTime = 1; // noticeChat.sender = "[GM]그리노스"; // noticeChat.messageType = messageType; // List detailInfos = new(); // detailInfos.Add(new DetailInfo() { chatMessage = $"{noticeChat.Id} {KoMessage}", language = LanguageType.Ko }); // detailInfos.Add(new DetailInfo() { chatMessage = $"{noticeChat.Id} {EnMessage}", language = LanguageType.En }); // detailInfos.Add(new DetailInfo() { chatMessage = $"{noticeChat.Id} ภาษาไทย", language = LanguageType.Th }); // noticeChat.detailInfos.AddRange(detailInfos); // noticeChatEntity.Attr.noticeList.Add(noticeChat); // if (await GameServerApp.Instance.MainDB.UpdateNoticeChat(noticeChatEntity) == false) // { // return; // } // } // } //}