From 2a845f0babe52ac324b3cbe294db7dcec9346042 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 22 十二月 2025 19:07:24 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.1.20:10010/r/Project_SG_scripts

---
 Main/System/Chat/ChatManager.cs            |  141 ++++++++------
 Main/System/Chat/ChatPlayerMineCell.cs     |    2 
 Main/System/Chat/ChatBubbleBehaviour.cs    |   58 +----
 Main/System/Main/HomeWin.cs                |  209 ++++++++++++++++------
 Main/System/Chat/ChatBulletView.cs         |    4 
 Main/System/Chat/ChatSysCell.cs            |    2 
 Main/System/Chat/ChatWin.cs                |    2 
 Main/Utility/OperationLogCollect.cs        |   51 +++--
 Main/System/Chat/ChatPlayerOtherCell.cs    |    2 
 Main/System/Guild/GuildBaseWin.cs          |   24 ++
 Main/System/HeroUI/HeroUIManager.Reborn.cs |    6 
 11 files changed, 306 insertions(+), 195 deletions(-)

diff --git a/Main/System/Chat/ChatBubbleBehaviour.cs b/Main/System/Chat/ChatBubbleBehaviour.cs
index 9178ac3..de1a523 100644
--- a/Main/System/Chat/ChatBubbleBehaviour.cs
+++ b/Main/System/Chat/ChatBubbleBehaviour.cs
@@ -37,21 +37,16 @@
         Refresh();
     }
 
-    public void DisplayContent(string content, bool _left = false)
+    public void DisplayContent(string content)
     {
         if (m_Target == null)
         {
             return;
         }
-        left = _left;
         m_PreferredWidth = true;
         var richText = m_Target as RichText;
-        if (richText != null && !left)
-        {
-            richText.AutoNewLine = false;
-        }
         m_Target.text = content;
- 
+
         if (richText != null)
         {
             richText.AutoNewLine = true;
@@ -157,50 +152,27 @@
             rect.sizeDelta = sizeDelta;
         }
 
-        SetAnchor(m_Target.rectTransform);
+        if (m_Target.rectTransform.anchorMin != Vector2.up)
+        {
+            m_Target.rectTransform.anchorMin = Vector2.up;
+        }
+        if (m_Target.rectTransform.anchorMax != Vector2.up)
+        {
+            m_Target.rectTransform.anchorMax = Vector2.up;
+        }
+        if (m_Target.rectTransform.pivot != Vector2.up)
+        {
+            m_Target.rectTransform.pivot = Vector2.up;
+        }
 
         float top = padding.top;
         Vector2 position = Vector2.zero;
-        position.x = left ? padding.left : -padding.right;
+        position.x = padding.left;
 
         position.y = -top;
         if (targetRect.anchoredPosition != position)
         {
             targetRect.anchoredPosition = position;
-        }
-    }
-
-    void SetAnchor(RectTransform targetRect)
-    {
-        if (!left)
-        {
-            if (targetRect.anchorMin != Vector2.one)
-            {
-                targetRect.anchorMin = Vector2.one;
-            }
-            if (targetRect.anchorMax != Vector2.one)
-            {
-                targetRect.anchorMax = Vector2.one;
-            }
-            if (targetRect.pivot != Vector2.one)
-            {
-                targetRect.pivot = Vector2.one;
-            }
-        }
-        else
-        {
-            if (targetRect.anchorMin != Vector2.up)
-            {
-                targetRect.anchorMin = Vector2.up;
-            }
-            if (targetRect.anchorMax != Vector2.up)
-            {
-                targetRect.anchorMax = Vector2.up;
-            }
-            if (targetRect.pivot != Vector2.up)
-            {
-                targetRect.pivot = Vector2.up;
-            }
         }
     }
 
diff --git a/Main/System/Chat/ChatBulletView.cs b/Main/System/Chat/ChatBulletView.cs
index 462720b..e38c955 100644
--- a/Main/System/Chat/ChatBulletView.cs
+++ b/Main/System/Chat/ChatBulletView.cs
@@ -34,8 +34,10 @@
         ChatManager.Instance.OnUpdateTalkEvent -= OnUpdateTalkEvent;
     }
 
-    private void OnUpdateTalkEvent(ChatChannel channel, TalkData data)
+    private void OnUpdateTalkEvent(ChatChannel channel, TalkData data, bool isSendBullet)
     {
+        if (!isSendBullet)
+            return;
         if (!ChatManager.Instance.GetBulletSetting(channel))
             return;
         // 0-绯荤粺 1-鏃ユ湡 2-鑷繁 3-鍏朵粬鐜╁
diff --git a/Main/System/Chat/ChatManager.cs b/Main/System/Chat/ChatManager.cs
index 573bab0..6630b36 100644
--- a/Main/System/Chat/ChatManager.cs
+++ b/Main/System/Chat/ChatManager.cs
@@ -17,7 +17,7 @@
     public Dictionary<int, ChatBubbleData> chatBubbles = new Dictionary<int, ChatBubbleData>();
     //<ChannelType,鏃堕棿鎴�>
     public Dictionary<int, int> chatChannelSendTime = new Dictionary<int, int>();
-    public event Action<ChatChannel, TalkData> OnUpdateTalkEvent;
+    public event Action<ChatChannel, TalkData, bool> OnUpdateTalkEvent;
     public event Action OnUpdateTalkCacheListEvent;
 
     public Dictionary<int, int> chatChannelCD = new Dictionary<int, int>();
@@ -27,7 +27,6 @@
     public Color32 areaOtherColor;
     public Dictionary<int, int[]> chatChannelBulletColorArrDict = new Dictionary<int, int[]>();
     public Dictionary<ChatChannel, Color32> chatChannelBulletColorDict = new Dictionary<ChatChannel, Color32>();
-
     public int[] defaultChannelBulletColorArr;
     public Color32 defaultChannelBulletColor;
     public int characterLimit;
@@ -48,45 +47,21 @@
 
         config = FuncConfigConfig.Get("TalkColor");
         areaMyColorArr = ConfigParse.GetMultipleStr<int>(config.Numerical1);
-        areaMyColor = new Color32()
-        {
-            r = (byte)(areaMyColorArr.Length > 0 ? areaMyColorArr[0] : 0),
-            g = (byte)(areaMyColorArr.Length > 1 ? areaMyColorArr[1] : 0),
-            b = (byte)(areaMyColorArr.Length > 2 ? areaMyColorArr[2] : 0),
-            a = (byte)(areaMyColorArr.Length > 3 ? areaMyColorArr[3] : 255),
-        };
+        areaMyColor = ParseColor32(areaMyColorArr);
 
         areaOtherColorArr = ConfigParse.GetMultipleStr<int>(config.Numerical2);
-        areaOtherColor = new Color32()
-        {
-            r = (byte)(areaOtherColorArr.Length > 0 ? areaOtherColorArr[0] : 0),
-            g = (byte)(areaOtherColorArr.Length > 1 ? areaOtherColorArr[1] : 0),
-            b = (byte)(areaOtherColorArr.Length > 2 ? areaOtherColorArr[2] : 0),
-            a = (byte)(areaOtherColorArr.Length > 3 ? areaOtherColorArr[3] : 255),
-        };
+        areaOtherColor = ParseColor32(areaOtherColorArr);
 
         chatChannelBulletColorArrDict = ConfigParse.ParseIntArrayDict(config.Numerical3);
         foreach (var kv in chatChannelBulletColorArrDict)
         {
             if (!IsValidChatChannel(kv.Key))
                 continue;
-            chatChannelBulletColorDict[(ChatChannel)kv.Key] = new Color32()
-            {
-                r = (byte)(kv.Value.Length > 0 ? kv.Value[0] : 0),
-                g = (byte)(kv.Value.Length > 1 ? kv.Value[1] : 0),
-                b = (byte)(kv.Value.Length > 2 ? kv.Value[2] : 0),
-                a = (byte)(kv.Value.Length > 3 ? kv.Value[3] : 0),
-            };
+            chatChannelBulletColorDict[(ChatChannel)kv.Key] = ParseColor32(kv.Value);
         }
 
         defaultChannelBulletColorArr = ConfigParse.GetMultipleStr<int>(config.Numerical4);
-        defaultChannelBulletColor = new Color32()
-        {
-            r = (byte)(defaultChannelBulletColorArr.Length > 0 ? defaultChannelBulletColorArr[0] : 0),
-            g = (byte)(defaultChannelBulletColorArr.Length > 1 ? defaultChannelBulletColorArr[1] : 0),
-            b = (byte)(defaultChannelBulletColorArr.Length > 2 ? defaultChannelBulletColorArr[2] : 0),
-            a = (byte)(defaultChannelBulletColorArr.Length > 3 ? defaultChannelBulletColorArr[3] : 255),
-        };
+        defaultChannelBulletColor = ParseColor32(defaultChannelBulletColorArr);
 
         config = FuncConfigConfig.Get("TalkLimit");
         characterLimit = int.Parse(config.Numerical1);
@@ -94,15 +69,20 @@
         config = FuncConfigConfig.Get("TalkBubble");
         sysBubbleID = int.Parse(config.Numerical1);
         sysBubbleColorArr = ConfigParse.GetMultipleStr<int>(config.Numerical2);
-        sysBubbleColor = new Color32()
-        {
-            r = (byte)(sysBubbleColorArr.Length > 0 ? sysBubbleColorArr[0] : 0),
-            g = (byte)(sysBubbleColorArr.Length > 1 ? sysBubbleColorArr[1] : 0),
-            b = (byte)(sysBubbleColorArr.Length > 2 ? sysBubbleColorArr[2] : 0),
-            a = (byte)(sysBubbleColorArr.Length > 3 ? sysBubbleColorArr[3] : 255),
-        };
+        sysBubbleColor = ParseColor32(sysBubbleColorArr);
 
         ParseChatBubbleConfig();
+    }
+
+    public Color32 ParseColor32(int[] colorArr)
+    {
+        return new Color32()
+        {
+            r = (byte)(colorArr.Length > 0 ? colorArr[0] : 0),
+            g = (byte)(colorArr.Length > 1 ? colorArr[1] : 0),
+            b = (byte)(colorArr.Length > 2 ? colorArr[2] : 0),
+            a = (byte)(colorArr.Length > 3 ? colorArr[3] : 255),
+        };
     }
 
     public override void Release()
@@ -113,19 +93,28 @@
         GuildManager.Instance.EnterOrQuitGuildEvent -= EnterOrQuitGuildEvent;
     }
 
-    //琚涪鍑�/閫�鍑哄伐浼氭椂锛屽垏鎹㈣亰澶╅閬�
+    //琚涪鍑�/閫�鍑哄伐浼氭椂锛屽垏鎹㈣亰澶╅閬�,娓呯悊缂撳瓨鐨勬棫鍏細淇℃伅
     private void EnterOrQuitGuildEvent(bool obj)
     {
         if (!obj)
         {
             nowChatChannel = ChatChannel.World;
             nowChatTab = ChatTab.World;
+            if (talkDict.ContainsKey(ChatChannel.Guild))
+            {
+                talkDict[ChatChannel.Guild].Clear();
+            }
+            if (lastTalkDataDict.ContainsKey(ChatChannel.Guild))
+            {
+                lastTalkDataDict.Remove(ChatChannel.Guild);
+            }
         }
     }
-    
+
     private void OnBeforePlayerDataInitializeEvent()
     {
         talkDict.Clear();
+        lastTalkDataDict.Clear();
         currentDay = -1;
         nowChatChannel = ChatChannel.World;
         nowChatTab = ChatTab.World;
@@ -235,20 +224,8 @@
                 top = config.RightOffset.Length > 2 ? config.RightOffset[2] : 0,
                 bottom = config.RightOffset.Length > 3 ? config.RightOffset[3] : 0,
             };
-            bubble.myColor = new Color32()
-            {
-                r = (byte)(config.MyColor.Length > 0 ? config.MyColor[0] : 0),
-                g = (byte)(config.MyColor.Length > 1 ? config.MyColor[1] : 0),
-                b = (byte)(config.MyColor.Length > 2 ? config.MyColor[2] : 0),
-                a = (byte)(config.MyColor.Length > 3 ? config.MyColor[3] : 255),
-            };
-            bubble.otherColor = new Color32()
-            {
-                r = (byte)(config.OtherColor.Length > 0 ? config.OtherColor[0] : 0),
-                g = (byte)(config.OtherColor.Length > 1 ? config.OtherColor[1] : 0),
-                b = (byte)(config.OtherColor.Length > 2 ? config.OtherColor[2] : 0),
-                a = (byte)(config.OtherColor.Length > 3 ? config.OtherColor[3] : 255),
-            };
+            bubble.myColor = ParseColor32(config.MyColor);
+            bubble.otherColor = ParseColor32(config.OtherColor);
             bubble.top = config.Top;
             chatBubbles.Add(config.ID, bubble);
         }
@@ -367,8 +344,36 @@
         OnDeleteTalkEvent?.Invoke(type);
     }
 
-    public int currentDay = -1;
-    public void AddTalkData(ChatChannel type, TalkData data, bool isSend)
+
+
+    //璁板綍鍚勪釜棰戦亾鏈�鍚庝竴鏉¤亰澶╄褰�
+    public Dictionary<ChatChannel, TalkData> lastTalkDataDict = new Dictionary<ChatChannel, TalkData>();
+    public bool TryGetLastTalkData(out ChatChannel type, out TalkData data)
+    {
+        type = ChatChannel.World;
+        data = null;
+        bool isFound = false;
+        foreach (var kvp in lastTalkDataDict)
+        {
+            ChatChannel channelType = kvp.Key;
+            TalkData talkData = kvp.Value;
+            bool isOpen = GetBulletSetting(channelType);
+            if (!isOpen)
+                continue;
+            if (channelType == ChatChannel.Guild && !IsTabOpen(ChatTab.Guild, false))
+                continue;
+            if (data == null || talkData.TalkTime > data.TalkTime)
+            {
+                isFound = true;
+                type = channelType;
+                data = talkData;
+            }
+        }
+        return isFound;
+    }
+
+
+    public void AddTalkData(ChatChannel type, TalkData data, bool isSendBullet)
     {
         //濡傛灉瓒呰繃闄愬埗鍏堝垹闄ゆ棫鏁版嵁
         TryDeleteTalkData(type);
@@ -377,13 +382,24 @@
             talkDict[type] = new List<TalkData>();
         }
         talkDict[type].Add(data);
-        if (isSend)
+
+        if (!lastTalkDataDict.ContainsKey(type) || lastTalkDataDict[type].TalkTime <= data.TalkTime)
         {
-            OnUpdateTalkEvent?.Invoke(type, data);
+            //灞曠ず鐨勬秷鎭笉鑳芥槸鏃ユ湡琛屽拰绯荤粺琛�
+            if (!data.isDate && !data.isSystem)
+            {
+                lastTalkDataDict[type] = data;
+            }
+        }
+
+        if (isSendBullet)
+        {
+            OnUpdateTalkEvent?.Invoke(type, data, isSendBullet);
         }
     }
 
-    public bool TryAddDate(int allSeconds, ChatChannel type, bool isSend)
+    public int currentDay = -1;
+    public bool TryAddDate(int allSeconds, ChatChannel type, bool isSendBullet)
     {
         DateTime talkTime = TimeUtility.GetTime((uint)allSeconds);
         if (talkTime.Day != currentDay)
@@ -395,17 +411,17 @@
                 isDate = true,
                 Content = Language.Get("Chat09", talkTime.Month, talkTime.Day),
                 TalkTime = (uint)allSeconds,
-            }, isSend);
+            }, isSendBullet);
             return true;
         }
         return false;
     }
 
-    public void AddSysData(string msg, ArrayList infoList, ChatChannel type, bool isSend)
+    public void AddSysData(string msg, ArrayList infoList, ChatChannel type, bool isSendBullet)
     {
         int allSeconds = TimeUtility.AllSeconds;
         // 濡傛灉闅斿ぉ,澧炲姞鏃ユ湡琛�
-        TryAddDate(allSeconds, type, isSend);
+        TryAddDate(allSeconds, type, isSendBullet);
 
         if (!talkDict.ContainsKey(type))
         {
@@ -419,7 +435,7 @@
             BubbleBox = 1,
             TalkTime = (uint)allSeconds,
             InfoList = new ArrayList(infoList),
-        }, isSend);
+        }, isSendBullet);
     }
 
     public void UpdateTalk(HB310_tagMCTalk vNetData)
@@ -592,6 +608,7 @@
 
     private Dictionary<ChatChannel, bool> bulletSettingDict = new Dictionary<ChatChannel, bool>();
 
+
     private string settingsKey { get { return StringUtility.Concat("BulletChatSettings_", PlayerDatas.Instance.PlayerId.ToString()); } }
 
     // 璁剧疆鐗瑰畾棰戦亾鐨勫脊骞曞紑鍏崇姸鎬�
diff --git a/Main/System/Chat/ChatPlayerMineCell.cs b/Main/System/Chat/ChatPlayerMineCell.cs
index 67a3b53..a265049 100644
--- a/Main/System/Chat/ChatPlayerMineCell.cs
+++ b/Main/System/Chat/ChatPlayerMineCell.cs
@@ -15,7 +15,7 @@
         if (!manager.TryGetChatData(ChatManager.Instance.nowChatChannel, cell.index, out TalkData data))
             return;
 
-        m_ChatBubble.DisplayContent(data.Content, true);
+        m_ChatBubble.DisplayContent(data.Content);
 
         int bubbleID = ChatBubbleHelper.GetMyChatBubbleID();
         m_ChatBubble.DisplayBubble(bubbleID, (int)PlayerDatas.Instance.baseData.PlayerID);
diff --git a/Main/System/Chat/ChatPlayerOtherCell.cs b/Main/System/Chat/ChatPlayerOtherCell.cs
index a472369..f609c1e 100644
--- a/Main/System/Chat/ChatPlayerOtherCell.cs
+++ b/Main/System/Chat/ChatPlayerOtherCell.cs
@@ -16,7 +16,7 @@
         if (!manager.TryGetChatData(ChatManager.Instance.nowChatChannel, cell.index, out TalkData nowData) || nowData == null)
             return;
 
-        m_ChatBubble.DisplayContent(nowData.Content, true);
+        m_ChatBubble.DisplayContent(nowData.Content);
 
         bool hasNewPlayerInfo = manager.TryGetNewPlayerInfoByPlayerID(nowData.PlayerID, out TalkData newPlayerInfo);
         TalkData data = hasNewPlayerInfo ? newPlayerInfo : nowData;
diff --git a/Main/System/Chat/ChatSysCell.cs b/Main/System/Chat/ChatSysCell.cs
index 42e97b7..004743a 100644
--- a/Main/System/Chat/ChatSysCell.cs
+++ b/Main/System/Chat/ChatSysCell.cs
@@ -15,7 +15,7 @@
             chatText.SetExtenalData(data.InfoList);
         }
         m_ChatBubble.DisplaySysBubble(manager.sysBubbleID, manager.sysBubbleColor);
-        m_ChatBubble.DisplayContent(data.Content, true);
+        m_ChatBubble.DisplayContent(data.Content);
     }
 
     public float GetHeight(string content, ArrayList list)
diff --git a/Main/System/Chat/ChatWin.cs b/Main/System/Chat/ChatWin.cs
index 427087b..2216c3d 100644
--- a/Main/System/Chat/ChatWin.cs
+++ b/Main/System/Chat/ChatWin.cs
@@ -278,7 +278,7 @@
         CreaterAll(entrance);
     }
 
-    private void OnUpdateTalkEvent(ChatChannel type, TalkData data)
+    private void OnUpdateTalkEvent(ChatChannel type, TalkData data, bool isSendBullet)
     {
         RefreshAll(type, playerId: data.PlayerID);
     }
diff --git a/Main/System/Guild/GuildBaseWin.cs b/Main/System/Guild/GuildBaseWin.cs
index d45e089..da9c7ed 100644
--- a/Main/System/Guild/GuildBaseWin.cs
+++ b/Main/System/Guild/GuildBaseWin.cs
@@ -87,7 +87,7 @@
         ShowGuildInfo();
     }
 
-    private void OnUpdateTalkEvent(ChatChannel channel, TalkData data)
+    private void OnUpdateTalkEvent(ChatChannel channel, TalkData data, bool isSendBullet)
     {
         if (channel != ChatChannel.Guild)
             return;
@@ -247,6 +247,7 @@
         }
     }
 
+    List<TalkData> showTalkDatas = new List<TalkData>();
     void ShowTalkInfo()
     {
         if (!ChatManager.Instance.TryGetTalkData(ChatChannel.Guild, out List<TalkData> datas) || datas.IsNullOrEmpty())
@@ -254,15 +255,30 @@
             talkInfoText.text = string.Empty;
             return;
         }
+        showTalkDatas.Clear();
 
-        StringBuilder stringBuilder = new StringBuilder();
-        int startIndex = Mathf.Max(datas.Count - 2, 0);
-        for (int i = startIndex; i < datas.Count; i++)
+        // 浠庡悗鍚戝墠閬嶅巻锛屾壘鍒版渶鍚庝袱鏉$帺瀹舵秷鎭紙杩囨护鎺夌郴缁熸秷鎭拰鏃ユ湡娑堟伅锛�
+        int count = 0;
+        for (int i = datas.Count - 1; i >= 0 && count < 2; i--)
         {
             TalkData data = datas[i];
+            // 鍙繚鐣欑帺瀹舵秷鎭細闈炵郴缁熸秷鎭笖闈炴棩鏈熸秷鎭�
+            if (!data.isSystem && !data.isDate)
+            {
+                showTalkDatas.Insert(0, data); // 鎻掑叆鍒板垪琛ㄥ紑澶翠互淇濇寔鏃堕棿椤哄簭
+                count++;
+            }
+        }
+
+        StringBuilder stringBuilder = new StringBuilder();
+        for (int i = 0; i < showTalkDatas.Count; i++)
+        {
+            TalkData data = showTalkDatas[i];
             stringBuilder.Append(UIHelper.AppendColor(GetGuildChatAreaColor(data), GetGuildChatAreaContent(data)));
             stringBuilder.AppendLine();
         }
+
         talkInfoText.text = stringBuilder.ToString();
     }
+
 }
\ No newline at end of file
diff --git a/Main/System/HeroUI/HeroUIManager.Reborn.cs b/Main/System/HeroUI/HeroUIManager.Reborn.cs
index 603c14b..0e0537b 100644
--- a/Main/System/HeroUI/HeroUIManager.Reborn.cs
+++ b/Main/System/HeroUI/HeroUIManager.Reborn.cs
@@ -407,6 +407,12 @@
             return false;
         }
 
+        if (hero.heroStar >= hero.GetCurMaxStar())
+        {
+            SysNotifyMgr.Instance.ShowTip("HeroDelete1");
+            return false;
+        }
+
         if (selectDeleteHeroList.Contains(hero.itemHero.guid))
         {
             selectDeleteHeroList.Remove(hero.itemHero.guid);
diff --git a/Main/System/Main/HomeWin.cs b/Main/System/Main/HomeWin.cs
index 7036c9f..78e80dc 100644
--- a/Main/System/Main/HomeWin.cs
+++ b/Main/System/Main/HomeWin.cs
@@ -73,8 +73,16 @@
     [SerializeField] Text horseLVText;
 
     //鑱婂ぉ
-    [SerializeField] Button chatBtn;
+    [SerializeField] Transform transChatInfo;
     [SerializeField] Transform transFastChat;
+
+    [SerializeField] Button chatBtn;
+    [SerializeField] Button chatBtn1;
+
+    [SerializeField] ImageEx imgChatType;
+    [SerializeField] TextEx txtChatType;
+    [SerializeField] RichText txtChatInfo;
+
     [SerializeField] InputField inputFastChat;
     [SerializeField] ButtonEx btnFastChatSend;
     [SerializeField] ImageEx imgFastChatSend;
@@ -149,48 +157,41 @@
 
         horseBtn.AddListener(OpenHorse);
 
-        chatBtn.SetListener(() =>
-        {
-            if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Chat, true))
-                return;
+        chatBtn.SetListener(OnClickChatBtn);
+        chatBtn1.SetListener(OnClickChatBtn);
 
-            transFastChat.SetActive(true);
-            chatBtn.SetActive(false);
-            UpdateChat(ChatManager.Instance.nowChatTab);
+        // btnFastChatClose.SetListener(() =>
+        // {
+        //     transFastChat.SetActive(false);
+        //     transChatInfo.SetActive(true);
+        // });
+        // btnChatWin.SetListener(() =>
+        // {
+        //     transFastChat.SetActive(false);
+        //     transChatInfo.SetActive(true);
+        //     UIManager.Instance.OpenWindow<ChatWin>();
+        // });
 
-        });
-        btnFastChatClose.SetListener(() =>
-        {
-            transFastChat.SetActive(false);
-            chatBtn.SetActive(true);
-        });
-        btnChatWin.SetListener(() =>
-        {
-            transFastChat.SetActive(false);
-            chatBtn.SetActive(true);
-            UIManager.Instance.OpenWindow<ChatWin>();
-        });
+        // btnFastChatSend.SetListener(() =>
+        // {
+        //     // 濡傛灉鍦ㄨ亰澶╄緭鍏ョ晫闈㈡棤杈撳叆鏂囧瓧鐐瑰嚮鍙戦�侊紝鍒欏叧闂亰澶╄緭鍏ョ晫闈�
+        //     if (string.IsNullOrEmpty(inputFastChat.text))
+        //     {
+        //         transFastChat.SetActive(false);
+        //         transChatInfo.SetActive(true);
+        //         return;
+        //     }
 
-        btnFastChatSend.SetListener(() =>
-        {
-            // 濡傛灉鍦ㄨ亰澶╄緭鍏ョ晫闈㈡棤杈撳叆鏂囧瓧鐐瑰嚮鍙戦�侊紝鍒欏叧闂亰澶╄緭鍏ョ晫闈�
-            if (string.IsNullOrEmpty(inputFastChat.text))
-            {
-                transFastChat.SetActive(false);
-                chatBtn.SetActive(true);
-                return;
-            }
-
-            if (!ChatManager.Instance.CheckChatLimit(inputFastChat.text, out int errorCode))
-            {
-                ChatManager.Instance.ShowChatErrorTip(errorCode);
-                return;
-            }
-            ChatManager.Instance.SendChatInfo(ChatManager.Instance.nowChatChannel, inputFastChat.text);
-            ChatManager.Instance.AddChatChannelSendTime(ChatManager.Instance.nowChatChannel, TimeUtility.AllSeconds);
-            UpdateSendButton();
-            inputFastChat.text = string.Empty;
-        });
+        //     if (!ChatManager.Instance.CheckChatLimit(inputFastChat.text, out int errorCode))
+        //     {
+        //         ChatManager.Instance.ShowChatErrorTip(errorCode);
+        //         return;
+        //     }
+        //     ChatManager.Instance.SendChatInfo(ChatManager.Instance.nowChatChannel, inputFastChat.text);
+        //     ChatManager.Instance.AddChatChannelSendTime(ChatManager.Instance.nowChatChannel, TimeUtility.AllSeconds);
+        //     UpdateSendButton();
+        //     inputFastChat.text = string.Empty;
+        // });
 
         osMainLevelBtn.AddListener(() =>
         {
@@ -226,10 +227,11 @@
         DisplayHorse();
 
         DisplayChatBulletView();
-        chatBtn.SetActive(true);
-        transFastChat.SetActive(false);
-        inputFastChat.characterLimit = ChatManager.Instance.characterLimit;
-        UpdateSendButton();
+        transChatInfo.SetActive(true);
+        //transFastChat.SetActive(false);
+        //inputFastChat.characterLimit = ChatManager.Instance.characterLimit;
+        //UpdateSendButton();
+        ShowChatInfo();
     }
 
     protected override void OnPreOpen()
@@ -252,6 +254,8 @@
         ChatManager.Instance.OnChatTabChangeEvent += OnChatTabChangeEvent;
         GuildManager.Instance.EnterOrQuitGuildEvent += EnterOrQuitGuildEvent;
         TimeMgr.Instance.OnDayEvent += OnDayEvent;
+        ChatManager.Instance.OnUpdateTalkEvent += OnUpdateTalkEvent;
+        UIManager.Instance.OnOpenWindow += OnOpenWindow;
         Display();
         DisplayFirstChargeBtn();
         DisplayOSActivity();
@@ -284,39 +288,124 @@
         ChatManager.Instance.OnChatTabChangeEvent -= OnChatTabChangeEvent;
         GuildManager.Instance.EnterOrQuitGuildEvent -= EnterOrQuitGuildEvent;
         TimeMgr.Instance.OnDayEvent -= OnDayEvent;
+        ChatManager.Instance.OnUpdateTalkEvent -= OnUpdateTalkEvent;
+        UIManager.Instance.OnOpenWindow -= OnOpenWindow;
+
 
         //  鍏抽棴鐨勬椂鍊欐妸鎴樻枟鐣岄潰涔熺粰鍏充簡 铏界劧鏄湪澶栭潰寮�鐨�
         UIManager.Instance.CloseWindow<BattleWin>();
     }
 
-    private void UpdateSendButton()
+    private void OnOpenWindow(UIBase win)
     {
-        bool isCanSend = ChatManager.Instance.IsCanSend(ChatManager.Instance.nowChatChannel, out int remainingSeconds);
-        btnFastChatSend.interactable = isCanSend;
-        imgFastChatSend.gray = !isCanSend;
-        txtFastChatSend.text = isCanSend ? Language.Get("Chat11") : Language.Get("Chat14", remainingSeconds);
-        txtFastChatSend.colorType = isCanSend ? TextColType.NavyBrown : TextColType.LightWhite;
+        if (win is ChatWin)
+        {
+            transChatInfo.SetActive(false);
+        }
     }
 
+    private void OnUpdateTalkEvent(ChatChannel channel, TalkData data, bool isSendBullet)
+    {
+        ShowChatInfo();
+    }
 
+    private void OnClickChatBtn()
+    {
+        if (!FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.Chat, true))
+            return;
+
+        //transFastChat.SetActive(true);
+        // transChatInfo.SetActive(false);
+        // UpdateChat(ChatManager.Instance.nowChatTab);
+
+        bool hasLastTalkData = ChatManager.Instance.TryGetLastTalkData(out ChatChannel type, out TalkData data);
+        if (!hasLastTalkData)
+        {
+            ChatManager.Instance.nowChatTab = ChatTab.World;
+            ChatManager.Instance.nowChatChannel = ChatChannel.World;
+        }
+        else
+        {
+            switch (type)
+            {
+                case ChatChannel.World:
+                default:
+                    ChatManager.Instance.nowChatTab = ChatTab.World;
+                    ChatManager.Instance.nowChatChannel = ChatChannel.World;
+                    break;
+                case ChatChannel.Guild:
+                    ChatManager.Instance.nowChatTab = ChatTab.Guild;
+                    ChatManager.Instance.nowChatChannel = ChatChannel.Guild;
+                    break;
+            }
+        }
+        UIManager.Instance.OpenWindow<ChatWin>();
+    }
+
+    public string GetMainChatAreaContent(TalkData talkData)
+    {
+        int type = ChatManager.Instance.GetTalkDataType(talkData);
+        if (type == 0)
+        {
+            return Language.Get("L1100", Language.Get("Chat13"), talkData.Content);
+        }
+        else if (type == 1)
+        {
+            return Language.Get("L1100", Language.Get("Chat13"), talkData.Content);
+        }
+        else
+        {
+            return Language.Get("L1100", talkData.Name, talkData.Content);
+        }
+    }
+
+    private void ShowChatInfo()
+    {
+        bool hasLastTalkData = ChatManager.Instance.TryGetLastTalkData(out ChatChannel type, out TalkData data);
+        if (!hasLastTalkData)
+        {
+            imgChatType.SetActive(false);
+            txtChatInfo.text = string.Empty;
+            return;
+        }
+
+        imgChatType.SetActive(true);
+        txtChatType.text = Language.Get(StringUtility.Concat("ChatChannel", ((int)type).ToString()));
+        imgChatType.SetSprite(StringUtility.Concat("ChatChannelBg", ((int)type).ToString()));
+        if (data.InfoList != null)
+        {
+            txtChatInfo.SetExtenalData(data.InfoList);
+        }
+        txtChatInfo.text = GetMainChatAreaContent(data);
+    }
+
+    // private void UpdateSendButton()
+    // {
+    //     bool isCanSend = ChatManager.Instance.IsCanSend(ChatManager.Instance.nowChatChannel, out int remainingSeconds);
+    //     btnFastChatSend.interactable = isCanSend;
+    //     imgFastChatSend.gray = !isCanSend;
+    //     txtFastChatSend.text = isCanSend ? Language.Get("Chat11") : Language.Get("Chat14", remainingSeconds);
+    //     txtFastChatSend.colorType = isCanSend ? TextColType.NavyBrown : TextColType.LightWhite;
+    // }
 
     private void EnterOrQuitGuildEvent(bool obj)
     {
         if (!obj)
         {
-            UpdateChat(ChatManager.Instance.nowChatTab);
+            ShowChatInfo();
+            //UpdateChat(ChatManager.Instance.nowChatTab);
         }
     }
 
     private void OnChatTabChangeEvent(ChatTab tab)
     {
-        UpdateChat(tab);
+        //UpdateChat(tab);
     }
 
-    void UpdateChat(ChatTab tab)
-    {
-        txtChatChannel.text = ChatManager.Instance.GetChatTabName(tab);
-    }
+    // void UpdateChat(ChatTab tab)
+    // {
+    //     txtChatChannel.text = ChatManager.Instance.GetChatTabName(tab);
+    // }
 
     void DisplayChatBulletView()
     {
@@ -523,6 +612,12 @@
         {
             DisplayCard(TeamType.Story);
         }
+
+        if (closeUI is ChatWin)
+        {
+            transChatInfo.SetActive(true);
+        }
+
     }
 
 
@@ -661,7 +756,7 @@
     private void OnSecondEvent()
     {
         DisplayFirstChargeBtn();
-        UpdateSendButton();
+        //UpdateSendButton();
     }
 
     void OnUnLockHeroCountEvent()
diff --git a/Main/Utility/OperationLogCollect.cs b/Main/Utility/OperationLogCollect.cs
index f5f6242..c13a4eb 100644
--- a/Main/Utility/OperationLogCollect.cs
+++ b/Main/Utility/OperationLogCollect.cs
@@ -170,7 +170,10 @@
             tables["Title"] = "system";
             _content = _content.Replace("0000", "");
             if (ConfigManager.Instance.isLoadFinished && DTC0102_tagCDBPlayer.playerIdBuf != 0 && LoginManager.Instance.sdkLoginResult != null && !string.IsNullOrEmpty(LoginManager.Instance.sdkLoginResult.account))
-                _content = LoginManager.Instance.sdkLoginResult.account + _content;
+            {
+                _content = StringUtility.Concat(LoginManager.Instance.sdkLoginResult.account, "@", ServerListCenter.Instance.currentServer.region_flag.ToString(), " ", _content);
+            }
+            
             tables["Content"] = _content.Substring(0, Math.Min(800, _content.Length));
             tables["ClientInfo"] = contentPrefix;
 
@@ -187,30 +190,30 @@
     const string chatReportUrl = "http://xssgcenter.secondworld.net.cn:11000/center/eventreport.php?";
     public void ChatReport(string content, string channelName, string toPlayer, int chatType)
     {
-#if !UNITY_EDITOR
-        bool isFairy = false; //chatType == ChatInfoType.Fairy;
-        var tables = new Dictionary<string, string>();
-        tables["ProductID"] = VersionConfig.Get().gameId;
-        tables["OperatorID"] = VersionConfig.Get().appId;
-        tables["OperatorName"] = string.Empty;
-        tables["RegionName"] = StringUtility.Concat("s", ServerListCenter.Instance.currentServer.region_flag);
-        tables["RegionID"] = ServerListCenter.Instance.currentServer.region_flag.ToString();
-        tables["EventID"] = 9003.ToString();
-        tables["Time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
-        tables["IP"] = DeviceUtility.GetIp();
-        tables["ChatChannel"] = channelName;
-        var sdkLoginResult = ModelCenter.Instance.GetModel<LoginModel>().sdkLoginResult;
-        tables["AccountID"] = sdkLoginResult == null ? string.Empty : sdkLoginResult.account;
-        tables["RoleID"] = StringUtility.Concat(isFairy ? UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.FamilyName) : string.Empty,
-           isFairy ? "-" : string.Empty, UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName));
-        tables["ToRoleID"] = UIHelper.ServerStringTrim(toPlayer);
-        tables["Level"] = PlayerDatas.Instance.baseData.LV.ToString();
-        tables["VIPLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
-        tables["Content"] = WWW.EscapeURL(UIHelper.TrimContentToServer(content));
-        tables["DeviceFlag"] = ynmbxxjUtil.Instance.Device == null ? string.Empty : ynmbxxjUtil.Instance.Device.uniqueID;
+// #if !UNITY_EDITOR
+//         bool isFairy = false; //chatType == ChatInfoType.Fairy;
+//         var tables = new Dictionary<string, string>();
+//         tables["ProductID"] = VersionConfig.Get().gameId;
+//         tables["OperatorID"] = VersionConfig.Get().appId;
+//         tables["OperatorName"] = string.Empty;
+//         tables["RegionName"] = StringUtility.Concat("s", ServerListCenter.Instance.currentServer.region_flag);
+//         tables["RegionID"] = ServerListCenter.Instance.currentServer.region_flag.ToString();
+//         tables["EventID"] = 9003.ToString();
+//         tables["Time"] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
+//         tables["IP"] = DeviceUtility.GetIp();
+//         tables["ChatChannel"] = channelName;
+//         var sdkLoginResult = ModelCenter.Instance.GetModel<LoginModel>().sdkLoginResult;
+//         tables["AccountID"] = sdkLoginResult == null ? string.Empty : sdkLoginResult.account;
+//         tables["RoleID"] = StringUtility.Concat(isFairy ? UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.FamilyName) : string.Empty,
+//            isFairy ? "-" : string.Empty, UIHelper.ServerStringTrim(PlayerDatas.Instance.baseData.PlayerName));
+//         tables["ToRoleID"] = UIHelper.ServerStringTrim(toPlayer);
+//         tables["Level"] = PlayerDatas.Instance.baseData.LV.ToString();
+//         tables["VIPLevel"] = PlayerDatas.Instance.baseData.VIPLv.ToString();
+//         tables["Content"] = WWW.EscapeURL(UIHelper.TrimContentToServer(content));
+//         tables["DeviceFlag"] = ynmbxxjUtil.Instance.Device == null ? string.Empty : ynmbxxjUtil.Instance.Device.uniqueID;
 
-        HttpRequest.Instance.RequestHttpGet(StringUtility.Concat(chatReportUrl, HttpRequest.HashtablaToString(tables)), HttpRequest.defaultHttpContentType);
-#endif
+//         HttpRequest.Instance.RequestHttpGet(StringUtility.Concat(chatReportUrl, HttpRequest.HashtablaToString(tables)), HttpRequest.defaultHttpContentType);
+// #endif
     }
 
 }

--
Gitblit v1.8.0