using System;
|
using System.Collections;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Text;
|
namespace vnxbqy.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.IsOpen<MarqueeWin>())
|
{
|
WindowCenter.Instance.Open<MarqueeWin>();
|
}
|
}
|
|
public static void OnStageLoadFinish()
|
{
|
if (StageLoad.Instance.currentStage is LoginStage)
|
{
|
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.IsOpen<MarqueeWin>())
|
{
|
WindowCenter.Instance.Open<MarqueeWin>();
|
}
|
}
|
}
|
|
static bool CheckOpenMarquee()
|
{
|
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 (!WindowCenter.Instance.IsOpen<MessageWin>())
|
{
|
WindowCenter.Instance.Open<MessageWin>(true);
|
}
|
}
|
|
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 (!WindowCenter.Instance.IsOpen<MessageWin>())
|
{
|
WindowCenter.Instance.Open<MessageWin>(true);
|
}
|
}
|
|
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 (!WindowCenter.Instance.IsOpen<MessageWin>())
|
{
|
WindowCenter.Instance.Open<MessageWin>(true);
|
}
|
}
|
|
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 (!WindowCenter.Instance.IsOpen<MessageWin>())
|
{
|
WindowCenter.Instance.Open<MessageWin>(true);
|
}
|
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 (!WindowCenter.Instance.IsOpen<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
|
}
|
}
|
|