少年修仙传客户端代码仓库
Client_PangDeRong
2018-08-23 85448a839d432aab4220e6b23e55a0270e007b6f
System/Tip/ServerTipDetails.cs
@@ -1,106 +1,138 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Snxxz.UI
{
    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 (!WindowCenter.Instance.CheckOpen<MarqueeWin>())
            {
                WindowCenter.Instance.Open<MarqueeWin>();
            }
        }
        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> hintTips = new List<SystemHintData>();
        public static void ShowServerTip(string msg, ArrayList info, int order)
        {
            hintTips.Add(new SystemHintData()
            {
                message = msg,
                order = order,
                extentionData = info == null ? info : new ArrayList(info),
                appendTime = DateTime.Now,
            });
            hintTips.Sort(SysNotifyMgr.Instance.Compare);
            MessageWin.Inst.ShowServerTip();
        }
        public static SystemHintData RequireServerTip()
        {
            if (hintTips.Count > 0)
            {
                var _hint = hintTips[0];
                hintTips.RemoveAt(0);
                return _hint;
            }
            return null;
        }
        #endregion
        public static void ClearHint()
        {
            hintTips.Clear();
            m_Marquees.Clear();
            queueTrumpetTips.Clear();
        }
        #region 喇叭信息
        private static Queue<ChatTrumpetData> queueTrumpetTips = new Queue<ChatTrumpetData>();
        public static void ShowTrumpetTip(ChatTrumpetData trumpetData)
        {
            queueTrumpetTips.Enqueue(trumpetData);
            if (!WindowCenter.Instance.CheckOpen<TrumpetWin>())
            {
                WindowCenter.Instance.Open<TrumpetWin>();
            }
        }
        public static ChatTrumpetData RequireTrumpetTip()
        {
            if (queueTrumpetTips.Count > 0)
            {
                return queueTrumpetTips.Dequeue();
            }
            return null;
        }
        public static int GetTrumpetSurplusCnt()
        {
            return queueTrumpetTips.Count;
        }
        #endregion
    }
}
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Snxxz.UI
{
    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 (!WindowCenter.Instance.CheckOpen<MarqueeWin>())
            {
                WindowCenter.Instance.Open<MarqueeWin>();
            }
        }
        public static void OnStageLoadFinish()
        {
            if (StageManager.Instance.CurrentStage is LoginStage
                || StageManager.Instance.CurrentStage is SelectRoleStage)
            {
                m_Marquees.Clear();
                return;
            }
            SnxxzGame.Instance.StartCoroutine(Co_StageLoadFinish());
        }
        static IEnumerator Co_StageLoadFinish()
        {
            yield return null;
            if (CheckOpenMarquee() && m_Marquees.Count > 0)
            {
                if (!WindowCenter.Instance.CheckOpen<MarqueeWin>())
                {
                    WindowCenter.Instance.Open<MarqueeWin>();
                }
            }
        }
        static bool CheckOpenMarquee()
        {
            return (StageManager.Instance.CurrentStage is DungeonStage) && !StageManager.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> hintTips = new List<SystemHintData>();
        public static void ShowServerTip(string msg, ArrayList info, int order)
        {
            hintTips.Add(new SystemHintData()
            {
                message = msg,
                order = order,
                extentionData = info == null ? info : new ArrayList(info),
                appendTime = DateTime.Now,
            });
            hintTips.Sort(SysNotifyMgr.Instance.Compare);
            MessageWin.Inst.ShowServerTip();
        }
        public static SystemHintData RequireServerTip()
        {
            if (hintTips.Count > 0)
            {
                var _hint = hintTips[0];
                hintTips.RemoveAt(0);
                return _hint;
            }
            return null;
        }
        #endregion
        public static void ClearHint()
        {
            hintTips.Clear();
            m_Marquees.Clear();
            queueTrumpetTips.Clear();
        }
        #region 喇叭信息
        private static Queue<ChatTrumpetData> queueTrumpetTips = new Queue<ChatTrumpetData>();
        public static void ShowTrumpetTip(ChatTrumpetData trumpetData)
        {
            queueTrumpetTips.Enqueue(trumpetData);
            if (!WindowCenter.Instance.CheckOpen<TrumpetWin>())
            {
                WindowCenter.Instance.Open<TrumpetWin>();
            }
        }
        public static ChatTrumpetData RequireTrumpetTip()
        {
            if (queueTrumpetTips.Count > 0)
            {
                return queueTrumpetTips.Dequeue();
            }
            return null;
        }
        public static int GetTrumpetSurplusCnt()
        {
            return queueTrumpetTips.Count;
        }
        #endregion
    }
}