Update - 1.9.0.103

EN: 1.9.0.103
CN: 1.9.0.104
JP: 1.9.0.106
KR: 1.9.0.108
This commit is contained in:
SL1900
2026-04-18 00:15:00 +09:00
parent 35fe1f046d
commit e0549005e1
1150 changed files with 941124 additions and 19847 deletions
@@ -0,0 +1,70 @@
local NotificationManager = {}
local TimerManager = require("GameCore.Timer.TimerManager")
local Event = require("GameCore.Event.Event")
local SDKManager = CS.SDKManager.Instance
local tbNotification = {}
local bAppSuspended = false
local OnApplicationFocus = function(_, bFocus)
bAppSuspended = not bFocus
end
function NotificationManager.RegisterNotification(nId, nSubkey, nTime)
if not SDKManager:IsSDKInit() then
return
end
if not NovaAPI.IsMobilePlatform() then
return
end
local configData = ConfigTable.GetData("NotificationConfig", nId)
if configData == nil then
printLog("NotificationManager 注册推送失败,配置表数据不存在")
return
end
local setTime = nTime - 5000
if setTime <= CS.ClientManager.Instance.serverTimeStamp then
return
end
local data = {
id = nId,
key = nId + nSubkey,
time = nTime,
timer = TimerManager.Add(1, setTime - CS.ClientManager.Instance.serverTimeStamp, nil, function()
if not bAppSuspended then
printLog("NotificationManager 由计时器触发的取消推送成功,id:", tostring(nId + nSubkey))
UnregisterNotification(nId, nSubkey)
end
end, true, true, false, nil)
}
table.insert(tbNotification, data)
local sContent = configData.Content
sContent = string.gsub(sContent, "==PLAYER_NAME==", PlayerData.Base:GetPlayerNickName())
SDKManager:BuildLocalNotification(nId + nSubkey, configData.Title, sContent, nTime)
printLog("NotificationManager 注册推送成功,id:", tostring(nId + nSubkey), "title:", configData.Title, "content:", sContent, "time:", tostring(setTime))
end
function NotificationManager.UnregisterNotification(nId, nSubkey)
if not SDKManager:IsSDKInit() then
return
end
if not NovaAPI.IsMobilePlatform() then
return
end
local tbRemove = {}
for i, data in ipairs(tbNotification) do
if data.id == nId and data.key == nId + nSubkey then
data.timer:_Stop()
table.remove(tbNotification, i)
table.insert(tbRemove, nId + nSubkey)
break
end
end
SDKManager:DeleteLocalNotification(tbRemove)
printLog("NotificationManager 取消推送成功,id:", tostring(nId + nSubkey))
end
local function Uninit()
EventManager.Remove(EventId.CSLuaManagerShutdown, NotificationManager, Uninit)
EventManager.Remove("CS2LuaEvent_OnApplicationFocus", NotificationManager, OnApplicationFocus)
end
function NotificationManager.Init()
EventManager.Add(EventId.CSLuaManagerShutdown, NotificationManager, Uninit)
EventManager.Add("CS2LuaEvent_OnApplicationFocus", NotificationManager, OnApplicationFocus)
end
return NotificationManager