少年修仙传客户端代码仓库
7818 子 【2.0.200】【开发】聊天常用语下线依然保留 / 【2.0.200】【前端】聊天常用语下线依然保留
2个文件已修改
62 ■■■■■ 已修改文件
System/Chat/ChatCenter.cs 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Chat/ChatCtrl.cs 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
System/Chat/ChatCenter.cs
@@ -175,6 +175,40 @@
            return _recentlyChat;
        }
        public void SaveLocalRecentlyChat()
        {
            for (int i = 0; i < recentlyChats.Count; i++)
            {
                var localKey = StringUtility.Contact("RecentlyChat_", PlayerDatas.Instance.baseData.PlayerID, "_", i);
                LocalSave.SetString(localKey, recentlyChats[i].ToString());
            }
        }
        void GetLocalRecentlyChat()
        {
            recentlyChats.Clear();
            for (int i = 0; i < RecentlyChatNum; i++)
            {
                var localKey = StringUtility.Contact("RecentlyChat_", PlayerDatas.Instance.baseData.PlayerID, "_", i);
                if (LocalSave.HasKey(localKey))
                {
                    var json = LocalSave.GetString(localKey);
                    if (!string.IsNullOrEmpty(json))
                    {
                        RecentlyChat chat;
                        if (RecentlyChat.TryParse(json, out chat))
                        {
                            recentlyChats.Add(chat);
                        }
                    }
                }
            }
            if (RecentlyChatChangeEvent != null)
            {
                RecentlyChatChangeEvent();
            }
        }
        public void OnBeforePlayerDataInitialize()
        {
            recentlyChat = null;
@@ -224,6 +258,12 @@
            public List<string> itemInfos = new List<string>();
            public List<int> itemIndexs = new List<int>();
            public List<string> itemNames = new List<string>();
            public RecentlyChat()
            {
            }
            public RecentlyChat(string _chat)
            {
                display = _chat;
@@ -242,6 +282,26 @@
                {
                    itemIndexs.Add(i);
                }
            }
            public override string ToString()
            {
                return LitJson.JsonMapper.ToJson(this);
            }
            public static bool TryParse(string json, out RecentlyChat chat)
            {
                chat = null;
                try
                {
                    chat = LitJson.JsonMapper.ToObject<RecentlyChat>(json);
                }
                catch (Exception e)
                {
                    Debug.LogError(e.StackTrace + e.Message);
                    return false;
                }
                return chat != null;
            }
        }
@@ -749,6 +809,7 @@
        public void OnPlayerLoginOk()
        {
            serverInited = true;
            GetLocalRecentlyChat();
        }
        #region 聊天浮动
System/Chat/ChatCtrl.cs
@@ -309,6 +309,7 @@
                     _recentlyChat = chatCenter.SaveRecentlyChat(result);
                 }
                 msg = CheckHasItem(result, _recentlyChat);
                 chatCenter.SaveLocalRecentlyChat();
                 chatCenter.recentlyChat = null;
                 if (chatCenter.IsChatBanned || chatCenter.IsClientBan(type))