using DG.Tweening; using PhxhSDK; using System.Collections; using System.Collections.Generic; using UnityEngine; public class ScrollNoticeManager : Singlenton { private bool allowNotice = true; private bool isShow = false; private Queue receives = new Queue(); void ShowNotice() { if (receives.Count > 0 && allowNotice && !isShow) { string notice = receives.Dequeue(); isShow = true; DebugUtil.Log("展示滚动公告:" + notice); // TODO Action(notice); //*临时代码 DebugUtil.Log("这里是临时代码,需要替换为实际的滚动公告展示代码"); Sequence sequence = DOTween.Sequence(); sequence.AppendInterval(5f); sequence.AppendCallback(() => { ShowFinished(); }); //*/ } } #region public /// /// 设置当前是否允许显示滚动公告 /// /// public void SetAllowNotice(bool allow) { allowNotice = allow; if (allowNotice) { ShowNotice(); } } /// /// 添加滚动公告 /// /// public void AddNotice(string notice) { receives.Enqueue(notice); DebugUtil.Log("添加滚动公告:" + notice); if(!isShow && allowNotice) { ShowNotice(); } } /// /// 当前滚动公告显示完成 /// public void ShowFinished() { isShow = false; ShowNotice(); } /// /// 清空滚动公告 /// public void ClearNotice() { receives.Clear(); } #endregion }