少年修仙传客户端代码仓库
client_linchunjie
2018-09-19 9203f8bd22b3cf3fa9bfd537fd16b2e86d7223b1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
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 (!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
    }
}