Initial version - 1.2.0.60
EN: 1.2.0.60 CN: 1.2.0.61 JP: 1.2.0.63 KR: 1.2.0.67
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
local LampNoticeManager = {}
|
||||
local TimerManager = require("GameCore.Timer.TimerManager")
|
||||
local Event = require("GameCore.Event.Event")
|
||||
local objNoticePanel, totalTimer, intervalTimer
|
||||
local CreateLampNoticePanel = function()
|
||||
local noticePanel = require("Game.UI.LampNotice.LampNoticePanel")
|
||||
objNoticePanel = noticePanel.new(AllEnum.UI_SORTING_ORDER.LampNotice, PanelId.LampNoticePanel, {})
|
||||
objNoticePanel:_PreEnter()
|
||||
objNoticePanel:_Enter()
|
||||
end
|
||||
local HideLampNotice = function(_, isDelay)
|
||||
if intervalTimer ~= nil then
|
||||
intervalTimer:_Stop()
|
||||
intervalTimer = nil
|
||||
end
|
||||
if totalTimer ~= nil then
|
||||
totalTimer:_Stop()
|
||||
totalTimer = nil
|
||||
end
|
||||
EventManager.Hit("CloseLampNotice", isDelay)
|
||||
end
|
||||
local ShowLampNotice = function(_, noticeData)
|
||||
HideLampNotice(nil, false)
|
||||
local stopLampNotice = function()
|
||||
HideLampNotice(nil, false)
|
||||
end
|
||||
totalTimer = TimerManager.Add(1, noticeData.nTotalTime, nil, stopLampNotice, true, true, false, nil)
|
||||
local showNoticeUI = function()
|
||||
EventManager.Hit("ShowNoticeContent", noticeData.sContent, noticeData.nShowTime)
|
||||
end
|
||||
local nCount = noticeData.nTotalTime // noticeData.nIntervalTime
|
||||
intervalTimer = TimerManager.Add(nCount, noticeData.nIntervalTime, nil, showNoticeUI, true, true, false, nil)
|
||||
EventManager.Hit("ShowNoticeContent", noticeData.sContent, noticeData.nShowTime)
|
||||
end
|
||||
local NoticeChangeNotify = function(_, msgData)
|
||||
if not UTILS.CheckChannelList_Notice(msgData.Channel) then
|
||||
return
|
||||
end
|
||||
if msgData.IsStop then
|
||||
HideLampNotice(nil, false)
|
||||
return
|
||||
end
|
||||
local noticeData = {
|
||||
sContent = msgData.Content,
|
||||
nShowTime = msgData.Duration,
|
||||
nIntervalTime = msgData.Interval,
|
||||
nTotalTime = msgData.EndTime - CS.ClientManager.Instance.serverTimeStamp
|
||||
}
|
||||
ShowLampNotice(_, noticeData)
|
||||
end
|
||||
local function Uninit()
|
||||
EventManager.Remove("NoticeChangeNotify", LampNoticeManager, NoticeChangeNotify)
|
||||
EventManager.Remove(EventId.OpenLampNotice, LampNoticeManager, ShowLampNotice)
|
||||
EventManager.Remove(EventId.CloseLampNotice, LampNoticeManager, HideLampNotice)
|
||||
EventManager.Remove(EventId.CSLuaManagerShutdown, LampNoticeManager, Uninit)
|
||||
end
|
||||
function LampNoticeManager.Init()
|
||||
CreateLampNoticePanel()
|
||||
EventManager.Add("NoticeChangeNotify", LampNoticeManager, NoticeChangeNotify)
|
||||
EventManager.Add(EventId.OpenLampNotice, LampNoticeManager, ShowLampNotice)
|
||||
EventManager.Add(EventId.CloseLampNotice, LampNoticeManager, HideLampNotice)
|
||||
EventManager.Add(EventId.CSLuaManagerShutdown, LampNoticeManager, Uninit)
|
||||
end
|
||||
return LampNoticeManager
|
||||
Reference in New Issue
Block a user