using System; 
 | 
using System.Collections; 
 | 
using System.Collections.Generic; 
 | 
using System.Linq; 
 | 
using System.Text; 
 | 
using Cysharp.Threading.Tasks; 
 | 
  
 | 
public class ServerTipDetails 
 | 
{ 
 | 
    #region 跑马灯 
 | 
    public static bool OnTweening = false; 
 | 
    private static List<SystemHintData> m_Marquees = new List<SystemHintData>(); 
 | 
    public static void ShowMarquee(string msg, ArrayList info, int _order, int loopCnt = 1) 
 | 
    { 
 | 
        m_Marquees.Add(new SystemHintData() 
 | 
        { 
 | 
            appendTime = DateTime.Now, 
 | 
            message = msg, 
 | 
            extentionData = info == null ? info : new ArrayList(info), 
 | 
            order = _order 
 | 
        }); 
 | 
  
 | 
        m_Marquees.Sort(SysNotifyMgr.Instance.Compare); 
 | 
  
 | 
        if (!CheckOpenMarquee()) 
 | 
        { 
 | 
            return; 
 | 
        } 
 | 
  
 | 
        // if (!UIManager.Instance.IsOpened<MarqueeWin>()) 
 | 
        // { 
 | 
        //     UIManager.Instance.OpenWindow<MarqueeWin>(); 
 | 
        // } 
 | 
    } 
 | 
  
 | 
    public static void OnStageLoadFinish() 
 | 
    { 
 | 
        // if (StageLoad.Instance.currentStage is LoginStage) 
 | 
        // { 
 | 
        //     m_Marquees.Clear(); 
 | 
        //     return; 
 | 
        // } 
 | 
        // Co_StageLoadFinish().Forget(); 
 | 
    } 
 | 
  
 | 
    private static async UniTask Co_StageLoadFinish() 
 | 
    { 
 | 
        await UniTask.Yield(); 
 | 
        if (CheckOpenMarquee() && m_Marquees.Count > 0) 
 | 
        { 
 | 
            if (!UIManager.Instance.IsOpened<MarqueeWin>()) 
 | 
            { 
 | 
                UIManager.Instance.OpenWindow<MarqueeWin>(); 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
  
 | 
  
 | 
    static bool CheckOpenMarquee() 
 | 
    { 
 | 
        return true; 
 | 
        // TODO YYL 
 | 
        // return (StageLoad.Instance.currentStage is DungeonStage) && !StageLoad.Instance.isLoading; 
 | 
    } 
 | 
  
 | 
    public static SystemHintData RequireMarquee() 
 | 
    { 
 | 
        if (m_Marquees.Count > 0) 
 | 
        { 
 | 
            var _hint = m_Marquees[0]; 
 | 
            m_Marquees.RemoveAt(0); 
 | 
            return _hint; 
 | 
        } 
 | 
        return null; 
 | 
    } 
 | 
  
 | 
    #endregion 
 | 
  
 | 
    #region 固定全服消息 
 | 
    private static List<SystemHintData> serverHints = new List<SystemHintData>(); 
 | 
    public static event Action serverHintRefresh; 
 | 
    public static void ShowServerTip(string msg, ArrayList info, int order) 
 | 
    { 
 | 
        serverHints.Add(new SystemHintData() 
 | 
        { 
 | 
            message = msg, 
 | 
            order = order, 
 | 
            extentionData = info == null ? info : new ArrayList(info), 
 | 
            appendTime = DateTime.Now, 
 | 
        }); 
 | 
  
 | 
        serverHints.Sort(SysNotifyMgr.Instance.Compare); 
 | 
  
 | 
        if (serverHintRefresh != null) 
 | 
        { 
 | 
            serverHintRefresh(); 
 | 
        } 
 | 
  
 | 
        if (!UIManager.Instance.IsOpened<MessageWin>()) 
 | 
        { 
 | 
            UIManager.Instance.OpenWindow<MessageWin>(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public static SystemHintData RequireServerTip() 
 | 
    { 
 | 
        if (serverHints.Count > 0) 
 | 
        { 
 | 
            var hint = serverHints[0]; 
 | 
            serverHints.RemoveAt(0); 
 | 
            return hint; 
 | 
        } 
 | 
        return null; 
 | 
    } 
 | 
    #endregion 
 | 
  
 | 
    #region 普通信息提示 
 | 
    private static List<SystemHintData> normalHints = new List<SystemHintData>(); 
 | 
    public static event Action normalHintRefresh; 
 | 
    public static void DisplayNormalTip(string msg, ArrayList info = null) 
 | 
    { 
 | 
        normalHints.Clear(); 
 | 
        normalHints.Add(new SystemHintData() 
 | 
        { 
 | 
            message = msg, 
 | 
            order = 0, 
 | 
            extentionData = info == null ? info : new ArrayList(info), 
 | 
            appendTime = DateTime.Now, 
 | 
        }); 
 | 
        if (normalHintRefresh != null) 
 | 
        { 
 | 
            normalHintRefresh(); 
 | 
        } 
 | 
        if (!UIManager.Instance.IsOpened<MessageWin>()) 
 | 
        { 
 | 
            UIManager.Instance.OpenWindow<MessageWin>(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public static SystemHintData RequireNormalHint() 
 | 
    { 
 | 
        if (normalHints.Count > 0) 
 | 
        { 
 | 
            var hint = normalHints[0]; 
 | 
            normalHints.RemoveAt(0); 
 | 
            return hint; 
 | 
        } 
 | 
        return null; 
 | 
    } 
 | 
    #endregion 
 | 
  
 | 
    #region 聊天界面信息提示 
 | 
    private static List<SystemHintData> chatHints = new List<SystemHintData>(); 
 | 
    public static event Action chatHintRefresh; 
 | 
    public static void DisplayChatTip(string msg, ArrayList info = null) 
 | 
    { 
 | 
        chatHints.Clear(); 
 | 
        chatHints.Add(new SystemHintData() 
 | 
        { 
 | 
            message = msg, 
 | 
            order = 0, 
 | 
            extentionData = info == null ? info : new ArrayList(info), 
 | 
            appendTime = DateTime.Now, 
 | 
        }); 
 | 
        if (chatHintRefresh != null) 
 | 
        { 
 | 
            chatHintRefresh(); 
 | 
        } 
 | 
        if (!UIManager.Instance.IsOpened<MessageWin>()) 
 | 
        { 
 | 
            UIManager.Instance.OpenWindow<MessageWin>(); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public static SystemHintData RequireChatHint() 
 | 
    { 
 | 
        if (chatHints.Count > 0) 
 | 
        { 
 | 
            var hint = chatHints[0]; 
 | 
            chatHints.RemoveAt(0); 
 | 
            return hint; 
 | 
        } 
 | 
        return null; 
 | 
    } 
 | 
    #endregion 
 | 
    #region GM消息 
 | 
    public static List<string> gmMessages = new List<string>(); 
 | 
    public static event Action<string> gmMessageRefresh; 
 | 
    public static void ReceivePackage(string message) 
 | 
    { 
 | 
        message = message.Replace("###", string.Empty); 
 | 
        if (gmMessages.Count >= 300) 
 | 
        { 
 | 
            gmMessages.RemoveAt(0); 
 | 
        } 
 | 
        gmMessages.Add(message); 
 | 
  
 | 
        if (gmMessageRefresh != null) 
 | 
        { 
 | 
            gmMessageRefresh(message); 
 | 
        } 
 | 
    } 
 | 
  
 | 
    public static event Action gmOpenEvent; 
 | 
    public static bool requireOpenGM; 
 | 
    public static void OpenGMPanel() 
 | 
    { 
 | 
        requireOpenGM = true; 
 | 
        if (!UIManager.Instance.IsOpened<MessageWin>()) 
 | 
        { 
 | 
            UIManager.Instance.OpenWindow<MessageWin>(); 
 | 
        } 
 | 
        else 
 | 
        { 
 | 
            if (gmOpenEvent != null) 
 | 
            { 
 | 
                gmOpenEvent(); 
 | 
            } 
 | 
        } 
 | 
    } 
 | 
    #endregion 
 | 
  
 | 
    public static void ClearHint() 
 | 
    { 
 | 
        serverHints.Clear(); 
 | 
        m_Marquees.Clear(); 
 | 
        // queueTrumpetTips.Clear(); 
 | 
        normalHints.Clear(); 
 | 
        chatHints.Clear(); 
 | 
    } 
 | 
  
 | 
    // #region 喇叭信息 
 | 
    // private static Queue<ChatTrumpetData> queueTrumpetTips = new Queue<ChatTrumpetData>(); 
 | 
    // public static void ShowTrumpetTip(ChatTrumpetData trumpetData) 
 | 
    // { 
 | 
    //     queueTrumpetTips.Enqueue(trumpetData); 
 | 
    //     if (!UIManager.Instance.IsOpened<TrumpetWin>()) 
 | 
    //     { 
 | 
    //         UIManager.Instance.OpenWindow<TrumpetWin>(); 
 | 
    //     } 
 | 
    // } 
 | 
    // public static ChatTrumpetData RequireTrumpetTip() 
 | 
    // { 
 | 
    //     if (queueTrumpetTips.Count > 0) 
 | 
    //     { 
 | 
    //         return queueTrumpetTips.Dequeue(); 
 | 
    //     } 
 | 
    //     return null; 
 | 
    // } 
 | 
    // public static int GetTrumpetSurplusCnt() 
 | 
    // { 
 | 
    //     return queueTrumpetTips.Count; 
 | 
    // } 
 | 
    // #endregion 
 | 
} 
 |