From eb27e5fd31f73b998a4bbd85511a31e40b8c61b7 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 21 十一月 2025 17:03:47 +0800
Subject: [PATCH] 0312 关闭游戏内日志

---
 Main/System/Message/MessageWin.cs |  556 ++++++++++++++++++++++++++++---------------------------
 1 files changed, 283 insertions(+), 273 deletions(-)

diff --git a/Main/System/Message/MessageWin.cs b/Main/System/Message/MessageWin.cs
index 7eae546..7267c66 100644
--- a/Main/System/Message/MessageWin.cs
+++ b/Main/System/Message/MessageWin.cs
@@ -1,302 +1,312 @@
-锘�// using System.Collections;
-// using System.Collections.Generic;
-// using UnityEngine;
-// using UnityEngine.UI;
-// using CJ.Wait;
-// using System;
+using UnityEngine;
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine.UI;
+using DG.Tweening;
+using Cysharp.Threading.Tasks;
 
-// using System.Text.RegularExpressions;
-// using DG.Tweening;
-// namespace vnxbqy.UI
-// {
-    
-//     public class MessageWin : Window
-//     {
-//         [SerializeField] RectTransform m_ContainerNormalHint;
-//         [SerializeField] RichText m_NormalHint;
-//         [SerializeField] RectTransform m_ContainerChatHint;
-//         [SerializeField] RichText m_NormalChatHint; //鏄剧ず鍦ㄨ亰澶╃晫闈㈢殑浣嶇疆
+using System;
 
-//         [SerializeField] RectTransform m_ContainerServerTip;
-//         [SerializeField] ScaleTween m_ServerTipScaleTween;
-//         [SerializeField] PositionTween m_ServerTipPositionTween;
-//         [SerializeField] RichText m_ServerTip;
-//         [SerializeField, Header("鍏ㄦ湇骞挎挱鍋滅暀鏃堕棿")] float m_ServerTipKeepTime = 1.5f;
+using System.Text.RegularExpressions;
+using DG.Tweening;
 
-//         [SerializeField] RectTransform m_ContainerGM;
-//         [SerializeField] Text m_GmRichText;
-//         [SerializeField] ScrollerController m_ScrollControl;
-//         [SerializeField] Toggle m_AutoPopToggle;
-//         [SerializeField] Toggle m_AutoRefreshToggle;
-//         [SerializeField] Button m_GMClose;
+public class MessageWin : UIBase
+{
+	[SerializeField] RectTransform m_ContainerNormalHint;
+    [SerializeField] RichText m_NormalHint;
+    [SerializeField] RectTransform m_ContainerChatHint;
+    [SerializeField] RichText m_NormalChatHint; //鏄剧ず鍦ㄨ亰澶╃晫闈㈢殑浣嶇疆
 
-//         bool m_ServerTipPrepared = true;
+    [SerializeField] RectTransform m_ContainerServerTip;
+    [SerializeField] ScaleTween m_ServerTipScaleTween;
+    [SerializeField] PositionTween m_ServerTipPositionTween;
+    [SerializeField] RichText m_ServerTip;
+    [SerializeField, Header("鍏ㄦ湇骞挎挱鍋滅暀鏃堕棿")] float m_ServerTipKeepTime = 1.5f;
 
-//         protected override void BindController()
-//         {
-//         }
+    [SerializeField] RectTransform m_ContainerGM;
+    [SerializeField] Text m_GmRichText;
+    [SerializeField] ScrollerController m_ScrollControl;
+    [SerializeField] Toggle m_AutoPopToggle;
+    [SerializeField] Toggle m_AutoRefreshToggle;
+    [SerializeField] Button m_GMClose;
 
-//         protected override void AddListeners()
-//         {
-//             m_ContainerNormalHint.OnWaitCompelete(OnHintDisplayComplete);
-//             m_ContainerChatHint.OnWaitCompelete(OnHintDisplayComplete);
-//             m_ScrollControl.OnRefreshCell += OnRefreshGmCell;
-//             m_ScrollControl.OnGetDynamicSize += OnGetDynamicSize;
-//             m_ScrollControl.lockType = EnhanceLockType.LockVerticalBottom;
-//             m_GMClose.onClick.AddListener(OnGMClose);
-//         }
+    bool m_ServerTipPrepared = true;
 
-//         protected override void OnPreOpen()
-//         {
-//             m_ServerTipPrepared = true;
+    // 鐢熷懡鍛ㄦ湡
+    protected override void Awake()
+    {
+        base.Awake();
+    }
 
-// #if UNITY_EDITOR
-//             m_ContainerGM.SetActive(VersionConfig.Get().debugVersion);
-// #else
-//             m_ContainerGM.SetActive(false);
-// #endif
-//             ServerTipDetails.normalHintRefresh += CheckNormalHint;
-//             ServerTipDetails.serverHintRefresh += CheckServerHint;
-//             ServerTipDetails.gmMessageRefresh += DisplayGM;
-//             ServerTipDetails.gmOpenEvent += GmOpenEvent;
-//             ServerTipDetails.chatHintRefresh += CheckChatHint;
-//             CheckNormalHint();
-//             CheckChatHint();
-//             CheckServerHint();
-//             DisplayGM(string.Empty);
+    protected override void Start()
+    {
+        base.Start();
+        // 鍒濆鍖栨暟鎹�
+    }
 
-//             if (ServerTipDetails.requireOpenGM)
-//             {
-//                 if (hasOnFrom)
-//                 {
-//                     OnGMOpen();
-//                 }
-//                 ServerTipDetails.requireOpenGM = false;
-//             }
-//         }
+    protected override void InitComponent()
+    {
+        base.InitComponent();
+        // 鍒濆鍖栫粍浠�
+        m_ContainerNormalHint.OnWaitCompelete(OnHintDisplayComplete);
+        m_ContainerChatHint.OnWaitCompelete(OnHintDisplayComplete);
+        m_ScrollControl.OnRefreshCell += OnRefreshGmCell;
+        m_ScrollControl.OnGetDynamicSize += OnGetDynamicSize;
+        m_ScrollControl.lockType = EnhanceLockType.LockVerticalBottom;
+        m_GMClose.onClick.AddListener(OnGMClose);
+    }
 
-//         protected override void OnAfterOpen()
-//         {
-//         }
+    protected override void OnPreOpen()
+    {
+        // 瀛愮被鍙互閲嶅啓姝ゆ柟娉曡繘琛岄澶栫殑棰勬墦寮�鎿嶄綔
+        base.OnPreOpen();
+        m_ServerTipPrepared = true;
 
-//         protected override void OnPreClose()
-//         {
-//             ServerTipDetails.normalHintRefresh -= CheckNormalHint;
-//             ServerTipDetails.serverHintRefresh -= CheckServerHint;
-//             ServerTipDetails.gmMessageRefresh -= DisplayGM;
-//             ServerTipDetails.gmOpenEvent -= GmOpenEvent;
-//             ServerTipDetails.chatHintRefresh -= CheckChatHint;
-//         }
+#if UNITY_EDITOR
+        m_ContainerGM.SetActive(VersionConfig.Get().debugVersion);
+#else
+        m_ContainerGM.SetActive(false);
+#endif
+        ServerTipDetails.normalHintRefresh += CheckNormalHint;
+        ServerTipDetails.serverHintRefresh += CheckServerHint;
+        ServerTipDetails.gmMessageRefresh += DisplayGM;
+        ServerTipDetails.gmOpenEvent += GmOpenEvent;
+        ServerTipDetails.chatHintRefresh += CheckChatHint;
+        CheckNormalHint();
+        CheckChatHint();
+        CheckServerHint();
+        DisplayGM(string.Empty);
 
-//         protected override void OnAfterClose()
-//         {
-//         }
+        if (ServerTipDetails.requireOpenGM)
+        {
+            if (hasOnFrom)
+            {
+                OnGMOpen();
+            }
+            ServerTipDetails.requireOpenGM = false;
+        }
+    }
 
-//         private void GmOpenEvent()
-//         {
-//             if (ServerTipDetails.requireOpenGM)
-//             {
-//                 OnGMOpen();
-//                 ServerTipDetails.requireOpenGM = false;
-//             }
-//         }
+    // UI浜嬩欢
+    protected override void OnOpen()
+    {
+        base.OnOpen();
+        // 绐楀彛鎵撳紑鏃剁殑閫昏緫
+    }
 
-//         void CheckNormalHint()
-//         {
-//             var hint = ServerTipDetails.RequireNormalHint();
-//             if (hint != null)
-//             {
-//                 DisplayNormalHint(hint);
-//             }
-//         }
+    protected override void OnClose()
+    {
+        base.OnClose();
+        ServerTipDetails.normalHintRefresh -= CheckNormalHint;
+        ServerTipDetails.serverHintRefresh -= CheckServerHint;
+        ServerTipDetails.gmMessageRefresh -= DisplayGM;
+        ServerTipDetails.gmOpenEvent -= GmOpenEvent;
+        ServerTipDetails.chatHintRefresh -= CheckChatHint;
+        // 绐楀彛鍏抽棴鏃剁殑閫昏緫
+        
+    }
 
-//         void DisplayNormalHint(SystemHintData hint)
-//         {
-//             transform.SetAsLastSibling();
-//             m_NormalHint.SetExtenalData(hint.extentionData);
-//             m_NormalHint.text = hint.message;
-//             if (!m_ContainerNormalHint.gameObject.activeInHierarchy)
-//             {
-//                 m_ContainerNormalHint.SetActive(true);
-//             }
-//             m_ContainerNormalHint.DoWaitRestart();
-//         }
+    private void GmOpenEvent()
+    {
+        if (ServerTipDetails.requireOpenGM)
+        {
+            OnGMOpen();
+            ServerTipDetails.requireOpenGM = false;
+        }
+    }
 
-//         private void OnHintDisplayComplete(Component com)
-//         {
-//             com.DoWaitStop();
-//             com.SetActive(false);
-//         }
+    private void OnDisable()
+    {
+        m_ContainerNormalHint.SetActive(false);
+        m_ContainerChatHint.SetActive(false);
+        DisableServerTip();
+        StopAllCoroutines();
+    }
 
-//         void CheckServerHint()
-//         {
-//             if (!m_ServerTipPrepared)
-//             {
-//                 return;
-//             }
-//             var hint = ServerTipDetails.RequireServerTip();
-//             if (hint != null && gameObject.activeInHierarchy)
-//             {
-//                 DisplayServerHint(hint);
-//             }
-//             else
-//             {
-//                 DisableServerTip();
-//             }
-//         }
+    void CheckNormalHint()
+    {
+        var hint = ServerTipDetails.RequireNormalHint();
+        if (hint != null)
+        {
+            DisplayNormalHint(hint);
+        }
+    }
 
-//         public void DisplayServerHint(SystemHintData hint)
-//         {
-//             transform.SetAsLastSibling();
-//             m_ServerTipPrepared = false;
-//             if (!m_ServerTipScaleTween.gameObject.activeSelf)
-//             {
-//                 m_ServerTipScaleTween.SetActive(true);
-//             }
-//             m_ServerTipScaleTween.SetStartState();
-//             m_ServerTipPositionTween.SetStartState();
-//             m_ContainerServerTip.SetActive(true);
-//             m_ServerTip.SetExtenalData(hint.extentionData);
-//             m_ServerTip.text = hint.message;
-//             m_ServerTipScaleTween.Play();
-//             TimeMgr.Instance.Register(m_ServerTip, ServerTipStartHide, m_ServerTipKeepTime + m_ServerTipScaleTween.duration);
-//         }
+    void DisplayNormalHint(SystemHintData hint)
+    {
+        transform.SetAsLastSibling();
+        m_NormalHint.SetExtenalData(hint.extentionData);
+        m_NormalHint.text = hint.message;
+        if (!m_ContainerNormalHint.gameObject.activeInHierarchy)
+        {
+            m_ContainerNormalHint.SetActive(true);
+        }
+        m_ContainerNormalHint.DoWaitRestart();
+    }
 
-//         private void ServerTipStartHide(Component comp)
-//         {
-//             m_ServerTipPositionTween.Play();
-//             TimeMgr.Instance.Register(m_ServerTipPositionTween, ServerTipTweenComplete, m_ServerTipPositionTween.duration);
-//         }
+    private void OnHintDisplayComplete(Component com)
+    {
+        com.DoWaitStop();
+        com.SetActive(false);
+    }
 
-//         private void ServerTipTweenComplete(Component comp)
-//         {
-//             m_ServerTipPrepared = true;
-//             DisableServerTip();
-//             CheckServerHint();
-//         }
+    void CheckServerHint()
+    {
+        if (!m_ServerTipPrepared)
+        {
+            return;
+        }
+        var hint = ServerTipDetails.RequireServerTip();
+        if (hint != null && gameObject.activeInHierarchy)
+        {
+            DisplayServerHint(hint);
+        }
+        else
+        {
+            DisableServerTip();
+        }
+    }
 
-//         private void DisableServerTip()
-//         {
-//             TimeMgr.Instance.UnRegister(m_ServerTip);
-//             TimeMgr.Instance.UnRegister(m_ServerTipPositionTween);
-//             m_ContainerServerTip.SetActive(false);
-//             m_ServerTipScaleTween.Stop();
-//             m_ServerTipPositionTween.Stop();
-//             m_ServerTipScaleTween.SetStartState();
-//             m_ServerTipPositionTween.SetStartState();
-//         }
+    public void DisplayServerHint(SystemHintData hint)
+    {
+        transform.SetAsLastSibling();
+        m_ServerTipPrepared = false;
+        if (!m_ServerTipScaleTween.gameObject.activeSelf)
+        {
+            m_ServerTipScaleTween.SetActive(true);
+        }
+        m_ServerTipScaleTween.SetStartState();
+        m_ServerTipPositionTween.SetStartState();
+        m_ContainerServerTip.SetActive(true);
+        m_ServerTip.SetExtenalData(hint.extentionData);
+        m_ServerTip.text = hint.message;
+        m_ServerTipScaleTween.Play();
+        TimeMgr.Instance.Register(m_ServerTip, ServerTipStartHide, m_ServerTipKeepTime + m_ServerTipScaleTween.duration);
+    }
+
+    private void ServerTipStartHide(Component comp)
+    {
+        m_ServerTipPositionTween.Play();
+        TimeMgr.Instance.Register(m_ServerTipPositionTween, ServerTipTweenComplete, m_ServerTipPositionTween.duration);
+    }
+
+    private void ServerTipTweenComplete(Component comp)
+    {
+        m_ServerTipPrepared = true;
+        DisableServerTip();
+        CheckServerHint();
+    }
+
+    private void DisableServerTip()
+    {
+        TimeMgr.Instance.UnRegister(m_ServerTip);
+        TimeMgr.Instance.UnRegister(m_ServerTipPositionTween);
+        m_ContainerServerTip.SetActive(false);
+        m_ServerTipScaleTween.Stop();
+        m_ServerTipPositionTween.Stop();
+        m_ServerTipScaleTween.SetStartState();
+        m_ServerTipPositionTween.SetStartState();
+    }
 
 
-//         #region GM
-//         readonly Regex autoPopRegex = new Regex("鍙傛暟閿欒|鎵цGM鍛戒护閿欒|^###");
-//         void DisplayGM(string latest)
-//         {
-//             if (!string.IsNullOrEmpty(latest))
-//             {
-//                 if (m_AutoPopToggle.isOn && hasOnFrom)
-//                 {
-//                     RectTransform rt = m_ContainerGM;
-//                     Vector3 pos = new Vector3(hasOnFrom ? -rt.sizeDelta.x / 2 : rt.sizeDelta.x / 2, 0, 0);
-//                     rt.DOLocalMove(pos, 1.0f);
-//                     hasOnFrom = !hasOnFrom;
-//                     m_GMClose.SetActive(!hasOnFrom);
-//                 }
-//             }
-//             if (m_ScrollControl.GetNumberOfCells(m_ScrollControl.m_Scorller) >= 300)
-//             {
-//                 m_ScrollControl.m_Scorller.RefreshActiveCellViews();
-//                 return;
-//             }
-//             m_ScrollControl.Refresh();
-//             for (int i = 0; i < ServerTipDetails.gmMessages.Count; i++)
-//             {
-//                 m_ScrollControl.AddCell(ScrollerDataType.Normal, i);
-//             }
-//             m_ScrollControl.Restart();
-//             if (autoPopRegex.IsMatch(latest))
-//             {
-//                 if (hasOnFrom)
-//                 {
-//                     OnGMOpen();
-//                 }
-//             }
-//         }
+    readonly Regex autoPopRegex = new Regex("鍙傛暟閿欒|鎵цGM鍛戒护閿欒|^###");
+    void DisplayGM(string latest)
+    {
+        if (!string.IsNullOrEmpty(latest))
+        {
+            if (m_AutoPopToggle.isOn && hasOnFrom)
+            {
+                RectTransform rt = m_ContainerGM;
+                Vector3 pos = new Vector3(hasOnFrom ? -rt.sizeDelta.x / 2 : rt.sizeDelta.x / 2, 0, 0);
+                rt.DOLocalMove(pos, 1.0f);
+                hasOnFrom = !hasOnFrom;
+                m_GMClose.SetActive(!hasOnFrom);
+            }
+        }
+        if (m_ScrollControl.GetNumberOfCells(m_ScrollControl.m_Scorller) >= 300)
+        {
+            m_ScrollControl.m_Scorller.RefreshActiveCellViews();
+            return;
+        }
+        m_ScrollControl.Refresh();
+        for (int i = 0; i < ServerTipDetails.gmMessages.Count; i++)
+        {
+            m_ScrollControl.AddCell(ScrollerDataType.Normal, i);
+        }
+        m_ScrollControl.Restart();
+        if (autoPopRegex.IsMatch(latest))
+        {
+            if (hasOnFrom)
+            {
+                OnGMOpen();
+            }
+        }
+    }
 
-//         private void OnRefreshGmCell(ScrollerDataType type, CellView cell)
-//         {
-//             if (cell.index < ServerTipDetails.gmMessages.Count)
-//             {
-//                 Text text = cell.transform.Find("Text").GetComponent<Text>();
-//                 text.text = ServerTipDetails.gmMessages[cell.index];
-//             }
-//         }
+    private void OnRefreshGmCell(ScrollerDataType type, CellView cell)
+    {
+        if (cell.index < ServerTipDetails.gmMessages.Count)
+        {
+            Text text = cell.transform.Find("Text").GetComponent<Text>();
+            text.text = ServerTipDetails.gmMessages[cell.index];
+        }
+    }
 
-//         private bool OnGetDynamicSize(ScrollerDataType type, int index, out float height)
-//         {
-//             var msg = index < ServerTipDetails.gmMessages.Count ? ServerTipDetails.gmMessages[index] : string.Empty;
-//             height = m_GmRichText.cachedTextGeneratorForLayout.GetPreferredHeight(msg,
-//                 m_GmRichText.GetGenerationSettings(new Vector2(m_GmRichText.rectTransform.rect.size.x, 0.0f)))
-//                 / m_GmRichText.pixelsPerUnit;
-//             height += 5;
-//             return true;
-//         }
+    private bool OnGetDynamicSize(ScrollerDataType type, int index, out float height)
+    {
+        var msg = index < ServerTipDetails.gmMessages.Count ? ServerTipDetails.gmMessages[index] : string.Empty;
+        height = m_GmRichText.cachedTextGeneratorForLayout.GetPreferredHeight(msg,
+            m_GmRichText.GetGenerationSettings(new Vector2(m_GmRichText.rectTransform.rect.size.x, 0.0f)))
+            / m_GmRichText.pixelsPerUnit;
+        height += 5;
+        return true;
+    }
 
-//         private void OnGMClose()
-//         {
-//             if (!hasOnFrom)
-//             {
-//                 RectTransform rt = m_ContainerGM;
-//                 Vector3 pos = new Vector3(hasOnFrom ? -rt.sizeDelta.x / 2 : rt.sizeDelta.x / 2, 0, 0);
-//                 rt.DOLocalMove(pos, 1.0f);
-//                 hasOnFrom = !hasOnFrom;
-//                 m_GMClose.SetActive(!hasOnFrom);
-//             }
-//         }
-//         #endregion
+    private void OnGMClose()
+    {
+        if (!hasOnFrom)
+        {
+            RectTransform rt = m_ContainerGM;
+            Vector3 pos = new Vector3(hasOnFrom ? -rt.sizeDelta.x / 2 : rt.sizeDelta.x / 2, 0, 0);
+            rt.DOLocalMove(pos, 1.0f);
+            hasOnFrom = !hasOnFrom;
+            m_GMClose.SetActive(!hasOnFrom);
+        }
+    }
 
-//         private void OnDisable()
-//         {
-//             m_ContainerNormalHint.SetActive(false);
-//             m_ContainerChatHint.SetActive(false);
-//             DisableServerTip();
-//             StopAllCoroutines();
-//         }
+    private Vector3 gmTo = new Vector3(442, 0, 0);
+    private Vector3 gmFrom = new Vector3(892, 0, 0);
+    private bool hasOnFrom = true;
+    public void OnGMOpen()
+    {
+        RectTransform rt = m_ContainerGM;
+        Vector3 pos = new Vector3(hasOnFrom ? -rt.sizeDelta.x / 2 : rt.sizeDelta.x / 2, 0, 0);
+        rt.DOLocalMove(pos, 1.0f);
+        hasOnFrom = !hasOnFrom;
+        m_GMClose.SetActive(!hasOnFrom);
+    }
 
-//         private Vector3 gmTo = new Vector3(442, 0, 0);
-//         private Vector3 gmFrom = new Vector3(892, 0, 0);
-//         private bool hasOnFrom = true;
-//         public void OnGMOpen()
-//         {
-//             RectTransform rt = m_ContainerGM;
-//             Vector3 pos = new Vector3(hasOnFrom ? -rt.sizeDelta.x / 2 : rt.sizeDelta.x / 2, 0, 0);
-//             rt.DOLocalMove(pos, 1.0f);
-//             hasOnFrom = !hasOnFrom;
-//             m_GMClose.SetActive(!hasOnFrom);
-//         }
+    void CheckChatHint()
+    {
+        var hint = ServerTipDetails.RequireChatHint();
+        if (hint != null)
+        {
+            DisplayChatHint(hint);
+        }
+    }
 
-//         void CheckChatHint()
-//         {
-//             var hint = ServerTipDetails.RequireChatHint();
-//             if (hint != null)
-//             {
-//                 DisplayChatHint(hint);
-//             }
-//         }
-
-//         void DisplayChatHint(SystemHintData hint)
-//         {
-//             if (!WindowCenter.Instance.IsOpen<ChatWin>())
-//             {
-//                 return;
-//             }
-//             if (!m_ContainerChatHint.gameObject.activeInHierarchy)
-//             {
-//                 m_ContainerChatHint.gameObject.SetActive(true);
-//             }
-//             m_NormalChatHint.SetExtenalData(hint.extentionData);
-//             m_NormalChatHint.text = hint.message;
-//             m_ContainerChatHint.DoWaitRestart();
-//         }
-//     }
-// }
-
+    void DisplayChatHint(SystemHintData hint)
+    {
+        if (!UIManager.Instance.IsOpened<ChatWin>())
+        {
+            return;
+        }
+        if (!m_ContainerChatHint.gameObject.activeInHierarchy)
+        {
+            m_ContainerChatHint.gameObject.SetActive(true);
+        }
+        m_NormalChatHint.SetExtenalData(hint.extentionData);
+        m_NormalChatHint.text = hint.message;
+        m_ContainerChatHint.DoWaitRestart();
+    }
+}

--
Gitblit v1.8.0