冲刺活动

This commit is contained in:
puxuan 2025-09-25 20:12:22 +08:00
parent a20f3f0dd1
commit 6546675a6f
77 changed files with 17020 additions and 1169 deletions

View File

@ -0,0 +1,222 @@
local BIReportV2 = {}
-- 所有上报事件
local EVENT_NAME_PRODUCTION_SALES_V2 = "client_production_sales_v2" -- 产销
local EVENT_NAME_FIGHT_V2 = "client_fight_v2" -- 玩法
local EVENT_NAME_LEVEL_UP_V2 = "client_level_up_v2" -- 升级
local EVENT_NAME_OPERATION_V2 = "client_operation_v2" -- 操作
BIReportV2.PRODUCTION_SALES_TYPE = {
ITEM = "道具",
CURRENCY = "货币"
}
BIReportV2.PRODUCTION_SALES_EVENT_TYPE = {
USE = "获得",
GET = "消耗"
}
BIReportV2.FIGHT_TYPE = {
FIGHT_BEGIN = "开始",
FIGHT_END = "结束"
}
BIReportV2.FIGHT_NAME = {
[1] = "主线关卡",
[2] = "日常副本",
[3] = "爬塔",
[4] = "世界BOSS",
[5] = "精英挑战",
[6] = "元素地牢",
[18] = "竞技场",
}
BIReportV2.FIGHT_NAME_DUNGEON_GOLD = "金币副本"
BIReportV2.FIGHT_NAME_DUNGEON_MATERIAL = "材料副本"
BIReportV2.FIGHT_RESULT = {
WIN = "胜利",
FAIL = "失败",
FINISH = "完成",
QUIT = "退出",
UNKNOW = "未知"
}
BIReportV2.OPERATION_TYPE = {
CLICK = "点击",
SHOW = "展示",
}
BIReportV2.LEVEL_UP_TYPE = {
GET_PLAYER_EXP = "获取账号经验",
}
BIReportV2.OPERATION_UI_NAME = {
LOGIN_UI = "登陆",
FIRST_RECHARGE_PAGE_1 = "首充第一档",
FIRST_RECHARGE_PAGE_2 = "首充第二档",
FIRST_RECHARGE_PAGE_3 = "首充第三档",
POP_CHAPTER_UI = "章节弹出礼包",
ROUTINE_GIFT_1 = "新手礼包",
ROUTINE_GIFT_2 = "日礼包",
ROUTINE_GIFT_3 = "周礼包",
ROUTINE_GIFT_4 = "月礼包",
PRIVILEGE_CARD = "特权卡",
PRIVILEGE_CARD_1 = "特权每日福利",
PRIVILEGE_CARD_2 = "免广告",
PRIVILEGE_CARD_3 = "月卡",
PRIVILEGE_CARD_4 = "终身卡",
PRIVILEGE_CARD_5 = "挑战征服卡",
FUND_LEVEL = "成长基金",
FUND_CHAPTER = "关卡基金",
BOUNTY_COLLECTION = "宝物战令",
TOWER_BOUNTY = "爬塔战令",
SING_WEEK = "7日签到",
SIGN_MONTH = "30日签到",
ACT_SEVENDAY_TASK = "七天乐任务",
ACT_SEVENDAY_GIFT = "七天乐礼包",
ACT_SEVENDAY_TASK_2 = "七天乐任务第二期",
ACT_SEVENDAY_GIFT_2 = "七天乐礼包第二期",
ACT_SEVENDAY_LOOP_TASK_1 = "七日达标1循环任务",
ACT_SEVENDAY_LOOP_GIFT_1 = "七日达标1循环礼包",
ACT_SEVENDAY_LOOP_TASK_2 = "七日达标2循环任务",
ACT_SEVENDAY_LOOP_GIFT_2 = "七日达标2循环礼包",
ACT_SEVENDAY_LOOP_TASK_3 = "七日达标3循环任务",
ACT_SEVENDAY_LOOP_GIFT_3 = "七日达标3循环礼包",
SHOP_CHAPTER = "商店章节礼包",
SHOP_DAILY_STORE = "每日商店",
SHOP_GEM_STORE = "钻石礼包",
SHOP_GOLD_STORE = "金币礼包",
MAIN_SHOP = "商城",
ACT_SUMMON_LOGIN = "卡池活动登录福利",
ACT_SUMMON_UPGRADE_1 = "卡池活动英雄升级1",
ACT_SUMMON_UPGRADE_2 = "卡池活动英雄升级2",
ACT_SUMMON_GEM = "特惠礼包",
ACT_SUMMON_RECHARGE = "连冲豪礼",
SUMMON_MAIN = "普通召唤",
SUMMON_ACT_1 = "召唤界面:电闪雷鸣",
SUMMON_ACT_2 = "召唤界面:虎豹之争",
GIFT_CHAIN_POP = "连锁礼包弹窗",
ACT_SPRINT_NEW_SUMMON = "普通召唤新手冲刺活动版本2-加签到任务不改",
ACT_SPRINT_NEW_BOX = "史诗芯魂宝箱新手冲刺活动版本2-加签到任务不改",
ACT_SPRINT_LOOP_SUMMON = "普通召唤冲刺-循环版版本2",
ACT_SPRINT_LOOP_BOX = "史诗芯魂冲刺-循环版版本2",
ACT_SPRINT_LOOP_TREE = "钻石消耗冲刺-循环版版本2",
}
BIReportV2.UI_PATH_NAME = {
}
function BIReportV2:postProductionSales(productionType, eventType, id, num, getType)
local args = {
itemCategory = productionType, -- 产销类型
itemId = id, -- 产销物品id
quantity = num, -- 产销数量
approach = getType, -- 产销途径
eventType = eventType, -- 产销事件
}
BIReport:report(EVENT_NAME_PRODUCTION_SALES_V2, args)
end
function BIReportV2:postItemProductionSales(optType, itemId, itemNum, getType)
if itemNum == 0 then
return
end
self:postProductionSales(BIReportV2.PRODUCTION_SALES_TYPE.ITEM, optType, itemId, itemNum, getType)
end
function BIReportV2:postCurrencyProductionSales(optType, itemId, itemNum, getType)
if itemNum == 0 then
return
end
self:postProductionSales(BIReportV2.PRODUCTION_SALES_TYPE.CURRENCY, optType, itemId, itemNum, getType)
end
function BIReportV2:getFightName(battleType, id)
local fightName = battleType
if battleType == ModuleManager.BattleManager.BATTLE_TYPE.DUNGEON then
local dungeonDailyType = DataManager.DungeonDailyData:getDungeonDailyTypeByChapterId(id)
if dungeonDailyType == GConst.DungeonConst.DUNGEON_DAILY_TYPE.GOLD then
fightName = BIReportV2.FIGHT_NAME_DUNGEON_GOLD
elseif dungeonDailyType == GConst.DungeonConst.DUNGEON_DAILY_TYPE.MATERIAL then
fightName = BIReportV2.FIGHT_NAME_DUNGEON_MATERIAL
end
else
fightName = BIReportV2.FIGHT_NAME[battleType] or tostring(battleType)
end
return fightName
end
function BIReportV2:getFightResult(battleType, fightResult)
if battleType == ModuleManager.BattleManager.BATTLE_TYPE.TOWER then
return BIReportV2.FIGHT_RESULT.FINISH
else
if fightResult == BIReport.FIGHT_END_TYPE.WIN then
return BIReportV2.FIGHT_RESULT.WIN
elseif fightResult == BIReport.FIGHT_END_TYPE.FAIL then
return BIReportV2.FIGHT_RESULT.FAIL
elseif fightResult == BIReport.FIGHT_END_TYPE.QUIT then
return BIReportV2.FIGHT_RESULT.QUIT
else
return BIReportV2.FIGHT_RESULT.UNKNOW
end
end
end
function BIReportV2:postFightBegin(battleType, id)
local args = {
playType = self:getFightName(battleType, id),
playName = id,
eventType = BIReportV2.FIGHT_TYPE.FIGHT_BEGIN
}
BIReport:report(EVENT_NAME_FIGHT_V2, args)
end
function BIReportV2:postFightEnd(battleType, id, fightResult, time, ext)
local args = {
playType = self:getFightName(battleType, id),
playName = id,
playResult = self:getFightResult(battleType, fightResult),
ext1 = ext,
playTime = time,
eventType = BIReportV2.FIGHT_TYPE.FIGHT_END
}
BIReport:report(EVENT_NAME_FIGHT_V2, args)
end
function BIReportV2:postLevelUp(exp, getType, beforeLevel, afterLevel)
local args = {
exp = exp,
approach = getType,
beforeLevel = beforeLevel,
afterLevel = afterLevel,
eventType = BIReportV2.LEVEL_UP_TYPE.GET_PLAYER_EXP
}
BIReport:report(EVENT_NAME_LEVEL_UP_V2, args)
end
function BIReportV2:postOperation(uiName)
if uiName == nil then
return
end
local args = {
operationName = uiName,
eventType = BIReportV2.OPERATION_TYPE.CLICK
}
BIReport:report(EVENT_NAME_OPERATION_V2, args)
end
function BIReportV2:postOpenUI(uiPath)
if uiPath == nil then
return
end
local uiName = BIReportV2.UI_PATH_NAME[uiPath]
if uiName == nil then
return
end
self:postOperation(uiName)
end
return BIReportV2

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: efc4642fbd8c94d8c9f76f2ccc1ec37d
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -36,10 +36,16 @@ function DataManager:init()
self:initManager("PaymentData", "app/userdata/payment/payment_data")
self:initManager("FundLevelData", "app/userdata/fund_level/fund_level_data")
self:initManager("SignWeekData", "app/userdata/sign/sign_week_data")
self:initManager("SignMonthData", "app/userdata/sign/sign_month_data")
self:initManager("SignWeekData", "app/userdata/sign/sign_week_data")
self:initManager("SignMonthData", "app/userdata/sign/sign_month_data")
self:initManager("ChapterFundData", "app/userdata/chapter_fund/chapter_fund_data")
self:initManager("ActSevenDayData", "app/userdata/activity/act_seven_day/act_seven_day_data")
-- 冲刺活动
self:initManager("ActTimeData", "app/userdata/activity/act_time_data")
self:initManager("ActSprintData", "app/userdata/activity/act_sprint/act_sprint_data")
self:initManager("ActSprintSummonDataAll", "app/userdata/activity/act_sprint/act_sprint_summon_data_all")
end
function DataManager:initManager(name, path)
@ -56,10 +62,10 @@ end
function DataManager:checkDataBind()
local changeBindFunc = function(baseData, curBaseData)
local data = baseData.data
if data then
local bindList = baseData.bindList
if bindList then
for fieldName, list in pairs(bindList) do
if data then
local bindList = baseData.bindList
if bindList then
for fieldName, list in pairs(bindList) do
for _, v in ipairs(list) do
if v.binder.unBind then
v.binder:unBind(baseData, fieldName)
@ -73,13 +79,13 @@ function DataManager:checkDataBind()
end
end
end
end
end
baseData:clearBindAll()
end
end
end
baseData:clearBindAll()
end
end
if self._cacheManager then -- 如果已经存在就检查一下绑定
if self._cacheManager then -- 如果已经存在就检查一下绑定
for name, baseData in pairs(self._cacheManager) do
if name == "BagData" then
changeBindFunc(baseData.ItemData, self[name].ItemData)
@ -89,16 +95,16 @@ function DataManager:checkDataBind()
end
end
end
end
end
end
function DataManager:clear()
self.loginSuccess = false
self.initWithServer = false
if self.cacheTimer then
SchedulerManager:unscheduleGlobal(self.cacheTimer)
self.cacheTimer = nil
end
SchedulerManager:unscheduleGlobal(self.cacheTimer)
self.cacheTimer = nil
end
self.cdCallBack = {}
for _, v in pairs(self._cacheManager) do
v:clear()
@ -146,14 +152,14 @@ function DataManager:initWithServerData(data)
self.DailyTaskData:init(data.task_daily, data.task_achievement)
self.IdleData:init(data.idle)
self.ShopData:init()
-- self.ShopData:refreshChapterShop(data.mall_chapter)
-- self.ShopData:refreshCoreSoulShop(data.soul)
self.ShopData:refreshDailyShop(data.mall_daily_store)
-- self.ShopData:refreshGoldShop(data.mall_gold)
-- self.ShopData:refreshEmblemShop(data.mall_mythic_store)
-- self.ShopData:initVit(data.energy_limit)
-- self.ShopData:initThirdPayOrder(data.third_pay)
-- self.ShopData:initThirdPayGiftOrder(data.third_pay)
-- self.ShopData:refreshChapterShop(data.mall_chapter)
-- self.ShopData:refreshCoreSoulShop(data.soul)
self.ShopData:refreshDailyShop(data.mall_daily_store)
-- self.ShopData:refreshGoldShop(data.mall_gold)
-- self.ShopData:refreshEmblemShop(data.mall_mythic_store)
-- self.ShopData:initVit(data.energy_limit)
-- self.ShopData:initThirdPayOrder(data.third_pay)
-- self.ShopData:initThirdPayGiftOrder(data.third_pay)
-- self.ShopData:initBase()
-- self.ShopData:initActGift(data.act) -- 礼包购买信息
-- self.ShopData:initMallDaily(data.mall_daily_store) -- 每日特惠
@ -164,11 +170,16 @@ function DataManager:initWithServerData(data)
-- 基金
self.FundLevelData:initData(data.fund) -- levelGiftData要放到PaymentData后面因为要处理数据
self.ChapterFundData:initData(data.chapter_fund)
self.SignWeekData:initData(data.sign)
self.SignWeekData:initData(data.sign)
self.SignMonthData:initData(data.sign_30)
-- 活动要在礼包后初始化
self.ActivityData:init()
self.ActTimeData:init(data.activities) -- 全活动时间, after PlayerData
self.ActivityData:initExchangeData(data.activity_exchange)
self.ActivityData:initTaskData(data.activity_task)
self.ActSprintData:init(data.activity_rush_exchange)
self.ActSevenDayData:initData(data.seven_days, true)
-- self.ActSprintSummonDataAll:initTaskData(data.activity_score_task, data.activity_task)
-- 商店礼包都初始化完了后检查一下每日红点
-- self.ShopData:checkShopDiscountRedPoint()
-- self.ShopData:checkLoginPopInfo() -- 需要写在shopdata所有初始化之后
@ -181,7 +192,6 @@ function DataManager:initWithServerData(data)
self:checkDataBind()
ModuleManager.ArenaManager:reqArenaInfo()
self:dealOpenActivity(data.activities)
-- 写在最后防止某些数据还未初始化就被bi访问报错
self.initWithServer = true
end
@ -283,29 +293,142 @@ function DataManager:scheduleGlobal()
return
end
if EDITOR_MODE then
Logger.logHighlight("==========================================================")
Logger.logHighlight("本地显示日期:" .. Time:formatTimeYMD())
Logger.logHighlight("当前时间戳:" .. Time:getServerTime())
Logger.logHighlight("本日时间戳:" .. Time:getDayBeginTimeStamp() .. "-" .. Time:getDayOverTimeStamp())
Logger.logHighlight("本周时间戳:" ..
Time:getWeekBeginTimeStamp() .. "-" .. Time:getWeekOverTimeStamp() .. " 当前处于本周第" .. Time:getDayofWeek() .. "")
Logger.logHighlight("本月时间戳:" ..
Time:getMonthBeginTimeStamp() ..
"-" .. Time:getMonthOverTimeStamp() .. " 当前处于本月第" .. Time:getDayofMonth() .. "")
Logger.logHighlight("==========================================================")
end
self.crossDayTS = Time:getDayOverTimeStamp()
self.cacheTimer = SchedulerManager:scheduleGlobal(function (inter)
self.cacheTimer = SchedulerManager:scheduleGlobal(function(inter)
for k, v in ipairs(self.cdCallBack) do
if self[v] and self[v].updateCd then
self[v]:updateCd()
end
end
if Time:getServerTime() > self.crossDayTS then
if Time:getServerTime() > self.crossDayTS and GFunc.IsGotServerTime() then
self.crossDayTS = Time:getDayOverTimeStamp()
self.weekOverTime = Time:getWeekOverTimeStamp()
self.monthOverTime = Time:getMonthOverTimeStamp()
self.loginCount = self.loginCount + 1
-- 跨天先刷新活动时间
DataManager.ActTimeData:refreshActTime(true)
Logger.logHighlight("跨天===========================================================================")
if self.crossDayCallbacks then
for i, info in ipairs(self.crossDayCallbacks) do
if info.func and info.open then
info.func()
end
end
-- DataManager.GiftPopData:activeLoginPopGift()
end
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_LOGIN_DAY)
self:doCrossDay()
-- 登录天数
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.LOGIN_NUM)
self:tryOpenModules() -- 开服天数限制的
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CROSS_DAY)
-- 重置
if self.timeEveryDayCallbacks then
for k, v in ipairs(self.timeEveryDayCallbacks) do
v.triggerToday = false
end
end
end
-- 每日特定时间消息
if self.timeEveryDayCallbacks then
local timeToday = Time:getDayBeginTimeStamp(Time:getServerTime() + 1)
local passTime = Time:getServerTime() - timeToday
for k, v in ipairs(self.timeEveryDayCallbacks) do
if not v.triggerToday and v.func and v.open and passTime > v.time then
v.triggerToday = true
v.func()
end
end
end
end, 1)
end
function DataManager:doCrossDay()
local delayTime = math.random(1, 10000) / 1000
SchedulerManager:performWithDelayGlobal(function()
ModuleManager.MaincityManager:reqPassDay()
end, delayTime)
end
function DataManager:onCrossDay(info)
if info.activities then
self.ActTimeData:init(info.activities) -- 全活动时间, after PlayerData
end
if info.door then
self.DoorData:init(info.door)
end
if info.mall_daily_store then
self.ShopData:refreshDailyShop(info.mall_daily_store)
end
if info.elemental_dungeon then
self.ElementData:init(info.elemental_dungeon)
end
if info.dispatch then
self.DispatchData:init(info.dispatch)
end
end
function DataManager:registerTimeEveryDayFunc(bindId, time, func)
if not bindId or not time or not func then
return
end
if not self.timeEveryDayCallbacks then
self.timeEveryDayCallbacks = {}
end
local timeToday = Time:getDayBeginTimeStamp(Time:getServerTime() + 1)
local passTime = Time:getServerTime() - timeToday
for i, info in ipairs(self.timeEveryDayCallbacks) do
if info.bindId == bindId then
self.timeEveryDayCallbacks[i].func = func
self.timeEveryDayCallbacks[i].time = time
self.timeEveryDayCallbacks[i].triggerToday = passTime > time
self.timeEveryDayCallbacks[i].open = true
return
end
end
table.insert(self.timeEveryDayCallbacks, {
bindId = bindId,
func = func,
time = time,
triggerToday = passTime > time,
open = true
})
end
function DataManager:unRegisterTimeEveryDayFunc(bindId)
if not bindId then
return
end
if not self.timeEveryDayCallbacks then
return
end
for i, info in ipairs(self.timeEveryDayCallbacks) do
if info.bindId == bindId then
self.timeEveryDayCallbacks[i].open = false
return
end
end
end
function DataManager:tryOpenModules()
if not self.tryOpenCallbacks then
return
@ -374,179 +497,4 @@ function DataManager:getLoginSuccess()
return self.loginSuccess
end
-- 获取建号时间
function DataManager:getCreatePlayerTime()
return self.createPlayerTime or Time:getServerTime()
end
-- 记录sync了多少次数据如果以后游戏中要回到登录界面则此值应当被清除
function DataManager:markSyncDataCount()
if not self.syncDataCount then
self.syncDataCount = 1
else
self.syncDataCount = self.syncDataCount + 1
end
end
function DataManager:getSyncDataCount()
return self.syncDataCount or 0
end
function DataManager:needDealGm()
return self:getSyncDataCount() >= 2
end
function DataManager:getManager(name, path)
if self[name] then
return self[name]
end
self[name] = require(path):create()
return self[name]
end
---- 缓存一下活动战令
function DataManager:getActivityBountyLevelByActId(actId)
if not self.activityBountyLevelMap then
self.activityBountyLevelMap = {}
local cfg = ConfigManager:getConfig("activity_bounty_level")
for id, info in pairs(cfg) do
if info.act_id then
if not self.activityBountyLevelMap[info.act_id] then
self.activityBountyLevelMap[info.act_id] = {}
end
table.insert(self.activityBountyLevelMap[info.act_id], id)
end
end
end
return self.activityBountyLevelMap[actId]
end
---- 缓存一下活动兑换商店
function DataManager:getActivityExchangeByActId(actId)
if not self.activityExchangeMap then
self.activityExchangeMap = {}
local cfg = ConfigManager:getConfig("activity_exchange")
for id, info in pairs(cfg) do
if info.activity then
if not self.activityExchangeMap[info.activity] then
self.activityExchangeMap[info.activity] = {}
end
table.insert(self.activityExchangeMap[info.activity], id)
end
end
end
return self.activityExchangeMap[actId]
end
---- 缓存一下活动排行榜
function DataManager:getActivityRankByActId(actId)
if not self.activityRankMap then
self.activityRankMap = {}
local cfg = ConfigManager:getConfig("activity_rank")
for id, info in pairs(cfg) do
if info.act_id then
if not self.activityRankMap[info.act_id] then
self.activityRankMap[info.act_id] = {}
end
table.insert(self.activityRankMap[info.act_id], id)
end
end
end
return self.activityRankMap[actId]
end
function DataManager:dealOpenActivity(activityInfo)
local curTime = Time:getServerTime()
if not activityInfo then
return
end
local newActivityList = {}
local map = {}
for _, info in ipairs(activityInfo) do
if info.type then
if not map[info.type] then
map[info.type] = info
else
if map[info.type].start_at > info.start_at then
map[info.type] = info
end
end
end
end
for actType, info in pairs(map) do
table.insert(newActivityList, info)
end
local dealTypeMap = {}
for _, info in ipairs(newActivityList) do
local startTime = GFunc.formatTimeStep(info.start_at)
if startTime <= curTime and curTime <= GFunc.formatTimeStep(info.end_at) then
local reqFunc = DataManager.activityOpenFunc[info.type]
if reqFunc and not dealTypeMap[info.type] then
dealTypeMap[info.type] = true
reqFunc(info)
end
elseif startTime > curTime then
local waitOpenFunc = DataManager.waitOpenActivity[info.type]
if waitOpenFunc and not dealTypeMap[info.type] then
dealTypeMap[info.type] = true
waitOpenFunc(info)
end
end
end
end
DataManager.activityOpenFunc = {
[2] = function(params)
DataManager.ActBossRushData:setActivityInfo(params)
ModuleManager.ActBossRushManager:reqActData()
end,
[3] = function(params)
DataManager.ActPvpData:setActivityId(params.id)
DataManager.ActPvpData:setActivityInfo(params)
DataManager.ActPvpData:init({}) -- 默认初始化
ModuleManager.ActPvpManager:reqActData()
end,
[4] = function(params)
DataManager.FullMoonData:setActStatus(params)
ModuleManager.FullMoonManager:reqActData()
ModuleManager.FullMoonManager:initTimer()
end,
[5] = function(params)
DataManager.TournWaveData:setActStatus(params)
ModuleManager.TournWaveManager:reqActData()
ModuleManager.TournWaveManager:initTimer()
end,
[6] = function(params)
DataManager.TournArenaData:setActStatus(params)
ModuleManager.TournArenaManager:reqActData()
ModuleManager.TournArenaManager:initTimer()
end,
}
DataManager.waitOpenActivity = {
[2] = function(params)
DataManager.ActBossRushData:init({activity_id = params.id}) -- 默认初始化
DataManager.ActBossRushData:setActivityInfo(params)
end,
[3] = function(params)
DataManager.ActPvpData:setActivityId(params.id)
DataManager.ActPvpData:setActivityInfo(params)
DataManager.ActPvpData:init({}) -- 默认初始化
end,
[4] = function(params)
DataManager.FullMoonData:setActStatus(params)
ModuleManager.FullMoonManager:initTimer()
end,
[5] = function(params)
DataManager.TournWaveData:setActStatus(params)
ModuleManager.TournWaveManager:initTimer()
end,
[6] = function(params)
DataManager.TournArenaData:setActStatus(params)
ModuleManager.TournArenaManager:initTimer()
end,
}
return DataManager

View File

@ -84,6 +84,8 @@ local MODULE_PATHS = {
SignManager = "app/module/sign/sign_manager",
-- 活动七天乐
ActSevenDayManager = "app/module/activity/act_seven_day/act_seven_day_manager",
-- 冲刺活动
ActSprintManager = "app/module/activity/act_sprint/act_sprint_manager",
}
-- 这里的key对应func_open里的id

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: e6c27959d37fd427e8315a450d564be1
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,278 @@
local act_exchange = {
[10101]={
["sort"]=1,
["reward"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=209,
["id_for_nothing"]="VAhV",
["num"]=1,
["num_for_nothing"]="Vw=="
},
["refresh_type"]=2,
["limit"]=1
},
[10102]={
["sort"]=5,
["reward"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=805001,
["id_for_nothing"]="XghZA2VQ",
["num"]=1,
["num_for_nothing"]="Vw=="
},
["cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=209,
["id_for_nothing"]="VAhV",
["num"]=20,
["num_for_nothing"]="VAg="
},
["refresh_type"]=3,
["limit"]=1,
["func_open"]="defenseline"
},
[10103]={
["sort"]=6,
["reward"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=805002,
["id_for_nothing"]="XghZA2VT",
["num"]=1,
["num_for_nothing"]="Vw=="
},
["cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=209,
["id_for_nothing"]="VAhV",
["num"]=20,
["num_for_nothing"]="VAg="
},
["refresh_type"]=3,
["limit"]=1,
["func_open"]="defenseline"
},
[10104]={
["sort"]=7,
["reward"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=904001,
["id_for_nothing"]="XwhYA2VQ",
["num"]=1,
["num_for_nothing"]="Vw=="
},
["cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=209,
["id_for_nothing"]="VAhV",
["num"]=15,
["num_for_nothing"]="Vw0="
},
["refresh_type"]=3,
["limit"]=1
},
[10105]={
["sort"]=8,
["reward"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=904002,
["id_for_nothing"]="XwhYA2VT",
["num"]=1,
["num_for_nothing"]="Vw=="
},
["cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=209,
["id_for_nothing"]="VAhV",
["num"]=15,
["num_for_nothing"]="Vw0="
},
["refresh_type"]=3,
["limit"]=1
},
[10106]={
["sort"]=9,
["reward"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=235,
["id_for_nothing"]="VAtZ",
["num"]=1,
["num_for_nothing"]="Vw=="
},
["cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=209,
["id_for_nothing"]="VAhV",
["num"]=15,
["num_for_nothing"]="Vw0="
},
["refresh_type"]=2,
["limit"]=8,
["func_open"]="defenseline"
},
[10107]={
["sort"]=11,
["reward"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=237,
["id_for_nothing"]="VAtb",
["num"]=1,
["num_for_nothing"]="Vw=="
},
["cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=209,
["id_for_nothing"]="VAhV",
["num"]=10,
["num_for_nothing"]="Vwg="
},
["refresh_type"]=2,
["limit"]=8
},
[10108]={
["sort"]=12,
["reward"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=5,
["id_for_nothing"]="Uw==",
["num"]=10,
["num_for_nothing"]="Vwg="
},
["cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=209,
["id_for_nothing"]="VAhV",
["num"]=2,
["num_for_nothing"]="VA=="
},
["refresh_type"]=2,
["limit"]=50
},
[10109]={
["sort"]=13,
["reward"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=68,
["id_for_nothing"]="UAA=",
["num"]=10,
["num_for_nothing"]="Vwg="
},
["cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=209,
["id_for_nothing"]="VAhV",
["num"]=3,
["num_for_nothing"]="VQ=="
},
["refresh_type"]=2,
["limit"]=50,
["func_open"]="core_soul"
},
[10110]={
["sort"]=2,
["reward"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=905001,
["id_for_nothing"]="XwhZA2VQ",
["num"]=1,
["num_for_nothing"]="Vw=="
},
["cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=209,
["id_for_nothing"]="VAhV",
["num"]=30,
["num_for_nothing"]="VQg="
},
["refresh_type"]=3,
["limit"]=1,
["force_id"]=4003
},
[10111]={
["sort"]=3,
["reward"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=905002,
["id_for_nothing"]="XwhZA2VT",
["num"]=1,
["num_for_nothing"]="Vw=="
},
["cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=209,
["id_for_nothing"]="VAhV",
["num"]=30,
["num_for_nothing"]="VQg="
},
["refresh_type"]=3,
["limit"]=1,
["force_id"]=4004
},
[10112]={
["sort"]=10,
["reward"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=238,
["id_for_nothing"]="VAtU",
["num"]=1,
["num_for_nothing"]="Vw=="
},
["cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=209,
["id_for_nothing"]="VAhV",
["num"]=20,
["num_for_nothing"]="VAg="
},
["refresh_type"]=2,
["limit"]=8
},
[10113]={
["sort"]=4,
["reward"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=805003,
["id_for_nothing"]="XghZA2VS",
["num"]=1,
["num_for_nothing"]="Vw=="
},
["cost"]={
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=209,
["id_for_nothing"]="VAhV",
["num"]=20,
["num_for_nothing"]="VAg="
},
["refresh_type"]=3,
["limit"]=1,
["func_open"]="defenseline"
}
}
local config = {
data=act_exchange,count=13
}
return config

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 879287732b71c4ea295fc202f0416b8b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

2598
lua/app/config/act_task.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 392a8c5c9ce384eabbe97390dca4be5b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

File diff suppressed because it is too large Load Diff

View File

@ -491,6 +491,29 @@ local const = {
}
}
},
["act_gogogo_round_limit_5"]={
["value"]=5.0
},
["act_gogogo_round_reward_5"]={
["cost"]={
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=231,
["id_for_nothing"]="VAtd",
["num"]=1,
["num_for_nothing"]="Vw=="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=37,
["id_for_nothing"]="VQ8=",
["num"]=50,
["num_for_nothing"]="Uwg="
}
}
},
["act_bounty_buy_cost"]={
["cost"]={
{

View File

@ -833,6 +833,26 @@ local LocalizationGlobalConst =
GIFT_ROUTINE_DESC_18 = "GIFT_ROUTINE_DESC_18",
GIFT_ROUTINE_DESC_19 = "GIFT_ROUTINE_DESC_19",
FREE_DESC = "FREE_DESC",
ACT_GOGOGO_DESC_1 = "ACT_GOGOGO_DESC_1",
ACT_GOGOGO_DESC_2 = "ACT_GOGOGO_DESC_2",
ACT_GOGOGO_DESC_3 = "ACT_GOGOGO_DESC_3",
ACT_GOGOGO_DESC_4 = "ACT_GOGOGO_DESC_4",
ACT_GOGOGO_DESC_5 = "ACT_GOGOGO_DESC_5",
ACT_GOGOGO_DESC_6 = "ACT_GOGOGO_DESC_6",
ACT_GOGOGO_DESC_7 = "ACT_GOGOGO_DESC_7",
ACT_GOGOGO_DESC_8 = "ACT_GOGOGO_DESC_8",
ACT_GOGOGO_DESC_9 = "ACT_GOGOGO_DESC_9",
ACT_GOGOGO_DESC_10 = "ACT_GOGOGO_DESC_10",
ACT_GOGOGO_DESC_11 = "ACT_GOGOGO_DESC_11",
ACT_GOGOGO_DESC_12 = "ACT_GOGOGO_DESC_12",
ACT_GOGOGO_DESC_13 = "ACT_GOGOGO_DESC_13",
ACT_GOGOGO_DESC_14 = "ACT_GOGOGO_DESC_14",
ACT_GOGOGO_DESC_15 = "ACT_GOGOGO_DESC_15",
ACT_GOGOGO_DESC_16 = "ACT_GOGOGO_DESC_16",
ACT_GOGOGO_DESC_17 = "ACT_GOGOGO_DESC_17",
ACT_GOGOGO_DESC_18 = "ACT_GOGOGO_DESC_18",
ACT_GOGOGO_DESC_19 = "ACT_GOGOGO_DESC_19",
ACT_GOGOGO_DESC_20 = "ACT_GOGOGO_DESC_20",
}
return LocalizationGlobalConst

View File

@ -832,6 +832,27 @@ local localization_global =
["GIFT_ROUTINE_DESC_18"] = "精彩活动",
["GIFT_ROUTINE_DESC_19"] = "必买",
["FREE_DESC"] = "免费",
["ACT_GOGOGO_DESC_1"] = "限时冲刺",
["ACT_GOGOGO_DESC_2"] = "{0}冲刺",
["ACT_GOGOGO_DESC_3"] = "冲刺商店",
["ACT_GOGOGO_DESC_4"] = "冲刺星星兑换",
["ACT_GOGOGO_DESC_5"] = "每日限购:{0}/{1}",
["ACT_GOGOGO_DESC_6"] = "每周限购:{0}/{1}",
["ACT_GOGOGO_DESC_7"] = "永久限购:{0}/{1}",
["ACT_GOGOGO_DESC_8"] = "已售罄",
["ACT_GOGOGO_DESC_9"] = "当前轮次",
["ACT_GOGOGO_DESC_10"] = "冲刺礼包",
["ACT_GOGOGO_DESC_11"] = "冲刺任务",
["ACT_GOGOGO_DESC_12"] = "完成本轮获得",
["ACT_GOGOGO_DESC_13"] = "已完成",
["ACT_GOGOGO_DESC_14"] = "前往",
["ACT_GOGOGO_DESC_15"] = "活动剩余时间",
["ACT_GOGOGO_DESC_16"] = "消耗{0},获取奖励",
["ACT_GOGOGO_DESC_17"] = "1. 完成任务,可获得奖励。\n2. 所有任务全部完成,视为完成一轮,可领取轮次奖励。\n3. 轮次奖励有领取上限,达到上限后任务不再计数。",
["ACT_GOGOGO_DESC_18"] = "消耗金钥匙,获得奖励",
["ACT_GOGOGO_DESC_19"] = "召唤英雄,获得奖励",
["ACT_GOGOGO_DESC_20"] = "冲刺签到",
}
return localization_global

View File

@ -38,6 +38,7 @@ function Game:initBase()
BF.exports.Logger = require "app/common/logger"
BF.exports.LocalData = require "app/common/local_data"
BF.exports.BIReport = require "app/common/bi_report"
BF.exports.BIReportV2 = require "app/common/bi_report_v2"
BF.exports.SchedulerManager = require "app/common/scheduler_manager"
BF.exports.ResourceManager = require "app/common/resource_manager"
BF.exports.AudioManager = require "app/common/audio_manager"

View File

@ -29,6 +29,8 @@ local CONST_PATHS = {
TournArenaConst = "app/module/activity/tourn_arena/tourn_arena_const",
BountyConst = "app/module/bounty/bounty_const",
SignConst = "app/module/sign/sign_const",
ActSprintConst = "app/module/activity/act_sprint/act_sprint_const",
}
if EDITOR_MODE then

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a61562936c7ce4303bcc632ee31b9e35
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,221 @@
local ActSprintConst = {}
ActSprintConst.ACT_ID = {
-- SUMMON = 11301,
-- CORE_SOUL_BOX = 11401,
-- SUMMON_V2 = 11501,
-- CORE_SOUL_BOX_V2 = 11601,
-- 新版新手
SUMMON_ALL = 11701,
-- CORE_SOUL_BOX_ALL = 11801,
-- -- Loop
-- SUMMON_LOOP = 11901,
-- CORE_SOUL_BOX_LOOP = 12001,
-- TREE_LOOP = 12101,
}
ActSprintConst.ACT_ID_NOT_SHOP = {
-- [ActSprintConst.ACT_ID.SUMMON] = true,
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX] = true,
-- [ActSprintConst.ACT_ID.SUMMON_V2] = true,
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_V2] = true,
}
ActSprintConst.ACT_ID_MAP = {
-- [ActSprintConst.ACT_ID.SUMMON] = true,
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX] = true,
-- [ActSprintConst.ACT_ID.SUMMON_V2] = true,
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_V2] = true,
[ActSprintConst.ACT_ID.SUMMON_ALL] = true,
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_ALL] = true,
-- [ActSprintConst.ACT_ID.SUMMON_LOOP] = true,
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_LOOP] = true,
-- [ActSprintConst.ACT_ID.TREE_LOOP] = true,
}
ActSprintConst.ACT_LIST_BANNER = {
-- [ActSprintConst.ACT_ID.SUMMON] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_2.png",
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_5.png",
-- [ActSprintConst.ACT_ID.SUMMON_V2] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_2.png",
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_V2] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_5.png",
[ActSprintConst.ACT_ID.SUMMON_ALL] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_2.png",
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_ALL] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_5.png",
-- [ActSprintConst.ACT_ID.SUMMON_LOOP] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_2.png",
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_LOOP] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_5.png",
-- [ActSprintConst.ACT_ID.TREE_LOOP] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_7.png",
}
ActSprintConst.ACT_LIST_NAME = {
-- [ActSprintConst.ACT_ID.SUMMON] = I18N.GlobalConst.ACT_GOGOGO_DESC_1,
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX] = I18N.GlobalConst.ACT_GOGOGO_DESC_1,
-- [ActSprintConst.ACT_ID.SUMMON_V2] = I18N.GlobalConst.ACT_GOGOGO_DESC_1,
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_V2] = I18N.GlobalConst.ACT_GOGOGO_DESC_1,
[ActSprintConst.ACT_ID.SUMMON_ALL] = I18N.GlobalConst.ACT_GOGOGO_DESC_1,
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_ALL] = I18N.GlobalConst.ACT_GOGOGO_DESC_1,
-- [ActSprintConst.ACT_ID.SUMMON_LOOP] = I18N.GlobalConst.ACT_GOGOGO_DESC_1,
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_LOOP] = I18N.GlobalConst.ACT_GOGOGO_DESC_1,
-- [ActSprintConst.ACT_ID.TREE_LOOP] = I18N.GlobalConst.ACT_GOGOGO_DESC_1,
}
ActSprintConst.ACT_MAIN_BANNER = {
-- [ActSprintConst.ACT_ID.SUMMON] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_1.png",
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_4.png",
-- [ActSprintConst.ACT_ID.SUMMON_V2] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_1.png",
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_V2] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_4.png",
[ActSprintConst.ACT_ID.SUMMON_ALL] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_1.png",
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_ALL] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_4.png",
-- [ActSprintConst.ACT_ID.SUMMON_LOOP] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_1.png",
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_LOOP] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_4.png",
-- [ActSprintConst.ACT_ID.TREE_LOOP] = "assets/arts/textures/background/act_gogogo/act_gogogo_bg_6.png",
}
ActSprintConst.ACT_ROUND_LIMIT = {
-- [ActSprintConst.ACT_ID.SUMMON] = GFunc.getConstIntValue("act_gogogo_round_limit_1"),
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX] = GFunc.getConstIntValue("act_gogogo_round_limit_2"),
-- [ActSprintConst.ACT_ID.SUMMON_V2] = GFunc.getConstIntValue("act_gogogo_round_limit_3"),
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_V2] = GFunc.getConstIntValue("act_gogogo_round_limit_4"),
[ActSprintConst.ACT_ID.SUMMON_ALL] = GFunc.getConstIntValue("act_gogogo_round_limit_5"),
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_ALL] = GFunc.getConstIntValue("act_gogogo_round_limit_6"),
-- [ActSprintConst.ACT_ID.SUMMON_LOOP] = GFunc.getConstIntValue("act_gogogo_round_limit_7"),
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_LOOP] = GFunc.getConstIntValue("act_gogogo_round_limit_8"),
-- [ActSprintConst.ACT_ID.TREE_LOOP] = GFunc.getConstIntValue("act_gogogo_round_limit_9"),
}
ActSprintConst.ACT_ROUND_REWARD = {
-- [ActSprintConst.ACT_ID.SUMMON] = GFunc.getConstCost("act_gogogo_round_reward_1", true),
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX] = GFunc.getConstCost("act_gogogo_round_reward_2", true),
-- [ActSprintConst.ACT_ID.SUMMON_V2] = GFunc.getConstCost("act_gogogo_round_reward_3", true),
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_V2] = GFunc.getConstCost("act_gogogo_round_reward_4", true),
[ActSprintConst.ACT_ID.SUMMON_ALL] = GFunc.getConstCost("act_gogogo_round_reward_5", true),
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_ALL] = GFunc.getConstCost("act_gogogo_round_reward_6", true),
-- [ActSprintConst.ACT_ID.SUMMON_LOOP] = GFunc.getConstCost("act_gogogo_round_reward_7", true),
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_LOOP] = GFunc.getConstCost("act_gogogo_round_reward_8", true),
-- [ActSprintConst.ACT_ID.TREE_LOOP] = GFunc.getConstCost("act_gogogo_round_reward_9", true),
}
ActSprintConst.REFRESH_TYPE = {
DAY = 1,
WEEK = 2,
ONCE = 3,
}
ActSprintConst.MAIN_PAGE_TYPE = {
STANDARD = 1,
GIFT = 2,
TASK = 3,
LOGIN = 4,
}
ActSprintConst.MAIN_PAGE_BTN_ICON_1 = {
-- [ActSprintConst.ACT_ID.SUMMON] = {
-- [1] = "act_common_btn_27_1",
-- [2] = "act_common_btn_28_1",
-- [3] = "act_common_btn_29_1",
-- },
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX] = {
-- [1] = "act_common_btn_27_1",
-- [2] = "act_common_btn_28_1",
-- [3] = "act_common_btn_29_1",
-- },
-- [ActSprintConst.ACT_ID.SUMMON_V2] = {
-- [1] = "act_common_btn_27_1",
-- [2] = "act_common_btn_34_1",
-- [3] = "act_common_btn_28_1",
-- },
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_V2] = {
-- [1] = "act_common_btn_27_1",
-- [2] = "act_common_btn_34_1",
-- [3] = "act_common_btn_28_1",
-- },
[ActSprintConst.ACT_ID.SUMMON_ALL] = {
[1] = "act_common_btn_27_1",
[2] = "act_common_btn_34_1",
[3] = "act_common_btn_29_1",
[4] = "act_common_btn_28_1",
},
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_ALL] = {
-- [1] = "act_common_btn_27_1",
-- [2] = "act_common_btn_34_1",
-- [3] = "act_common_btn_29_1",
-- [4] = "act_common_btn_28_1",
-- },
-- [ActSprintConst.ACT_ID.SUMMON_LOOP] = {
-- [1] = "act_common_btn_27_1",
-- [2] = "act_common_btn_34_1",
-- [3] = "act_common_btn_28_1",
-- },
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_LOOP] = {
-- [1] = "act_common_btn_27_1",
-- [2] = "act_common_btn_34_1",
-- [3] = "act_common_btn_28_1",
-- },
-- [ActSprintConst.ACT_ID.TREE_LOOP] = {
-- [1] = "act_common_btn_27_1",
-- [2] = "act_common_btn_34_1",
-- [3] = "act_common_btn_28_1",
-- },
}
ActSprintConst.MAIN_PAGE_BTN_ICON_2 = {
-- [ActSprintConst.ACT_ID.SUMMON] = {
-- [1] = "act_common_btn_27_2",
-- [2] = "act_common_btn_28_2",
-- [3] = "act_common_btn_29_2",
-- },
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX] = {
-- [1] = "act_common_btn_27_2",
-- [2] = "act_common_btn_28_2",
-- [3] = "act_common_btn_29_2",
-- },
-- [ActSprintConst.ACT_ID.SUMMON_V2] = {
-- [1] = "act_common_btn_27_2",
-- [2] = "act_common_btn_34_2",
-- [3] = "act_common_btn_28_2",
-- },
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_V2] = {
-- [1] = "act_common_btn_27_2",
-- [2] = "act_common_btn_34_2",
-- [3] = "act_common_btn_28_2",
-- },
[ActSprintConst.ACT_ID.SUMMON_ALL] = {
[1] = "act_common_btn_27_2",
[2] = "act_common_btn_34_2",
[3] = "act_common_btn_29_2",
[4] = "act_common_btn_28_2",
},
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_ALL] = {
-- [1] = "act_common_btn_27_2",
-- [2] = "act_common_btn_34_2",
-- [3] = "act_common_btn_29_2",
-- [4] = "act_common_btn_28_2",
-- },
-- [ActSprintConst.ACT_ID.SUMMON_LOOP] = {
-- [1] = "act_common_btn_27_2",
-- [2] = "act_common_btn_34_2",
-- [3] = "act_common_btn_28_2",
-- },
-- [ActSprintConst.ACT_ID.CORE_SOUL_BOX_LOOP] = {
-- [1] = "act_common_btn_27_2",
-- [2] = "act_common_btn_34_2",
-- [3] = "act_common_btn_28_2",
-- },
-- [ActSprintConst.ACT_ID.TREE_LOOP] = {
-- [1] = "act_common_btn_27_2",
-- [2] = "act_common_btn_34_2",
-- [3] = "act_common_btn_28_2",
-- },
}
ActSprintConst.MAIN_PAGE_BTN_DESC = {
[ActSprintConst.MAIN_PAGE_TYPE.STANDARD] = "ACT_GOGOGO_DESC_1",
[ActSprintConst.MAIN_PAGE_TYPE.GIFT] = "ACT_GOGOGO_DESC_10",
[ActSprintConst.MAIN_PAGE_TYPE.TASK] = "ACT_GOGOGO_DESC_11",
[ActSprintConst.MAIN_PAGE_TYPE.LOGIN] = "ACT_GOGOGO_DESC_20",
}
return ActSprintConst

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: ae5e0bf7c865d460ab482202a964e728
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,191 @@
local ActSprintManager = class("ActSprintManager", BaseModule)
local CLIENT_MODE = false
function ActSprintManager:showActSprintListUI(params)
UIManager:showUI("app/ui/activity/act_sprint/act_sprint_list_ui", params)
end
function ActSprintManager:showActSprintShopUI(params)
UIManager:showUI("app/ui/activity/act_sprint/act_sprint_shop_ui", params)
end
function ActSprintManager:showActSprintMainUI(params)
local actId = params.actId
if actId == GConst.ActSprintConst.ACT_ID.SUMMON_ALL then
UIManager:showUI("app/ui/activity/act_sprint_summon_all/act_sprint_main_ui", params)
end
-- if actId == GConst.ActSprintConst.ACT_ID.SUMMON then
-- UIManager:showUI("app/ui/activity/act_sprint_summon/act_sprint_main_ui", params)
-- elseif actId == GConst.ActSprintConst.ACT_ID.CORE_SOUL_BOX then
-- UIManager:showUI("app/ui/activity/act_sprint_box/act_sprint_main_ui", params)
-- elseif actId == GConst.ActSprintConst.ACT_ID.SUMMON_V2 then
-- UIManager:showUI("app/ui/activity/act_sprint_summon_v2/act_sprint_main_ui", params)
-- elseif actId == GConst.ActSprintConst.ACT_ID.CORE_SOUL_BOX_V2 then
-- UIManager:showUI("app/ui/activity/act_sprint_box_v2/act_sprint_main_ui", params)
-- elseif actId == GConst.ActSprintConst.ACT_ID.SUMMON_ALL then
-- UIManager:showUI("app/ui/activity/act_sprint_summon_all/act_sprint_main_ui", params)
-- elseif actId == GConst.ActSprintConst.ACT_ID.CORE_SOUL_BOX_ALL then
-- UIManager:showUI("app/ui/activity/act_sprint_box_all/act_sprint_main_ui", params)
-- elseif actId == GConst.ActSprintConst.ACT_ID.SUMMON_LOOP then
-- UIManager:showUI("app/ui/activity/act_sprint_summon_rp/act_sprint_main_ui", params)
-- elseif actId == GConst.ActSprintConst.ACT_ID.CORE_SOUL_BOX_LOOP then
-- UIManager:showUI("app/ui/activity/act_sprint_box_rp/act_sprint_main_ui", params)
-- elseif actId == GConst.ActSprintConst.ACT_ID.TREE_LOOP then
-- UIManager:showUI("app/ui/activity/act_sprint_tree_rp/act_sprint_main_ui", params)
-- end
end
-- 冲刺活动 商店兑换
function ActSprintManager:reqExchange(id, count)
if EDITOR_MODE and CLIENT_MODE then
self:rspExchange({
err_code = GConst.ERROR_STR.SUCCESS,
reqData = {
id = id,
count = count,
}
})
return
end
self:sendMessage(ProtoMsgType.FromMsgEnum.ActivityRushExchangeReq, {id = id, count = count}, self.rspExchange, BIReport.ITEM_GET_TYPE.ACT_SPRINT_EXCHANGE)
end
function ActSprintManager:rspExchange(result)
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
return
end
DataManager.ActSprintData:onExchangeSuccess(result.reqData.id, result.reqData.count)
if result.rewards then
GFunc.showRewardBox(result.rewards)
end
end
-- 冲刺活动 达标奖励
function ActSprintManager:reqStandardReward(id)
if EDITOR_MODE and CLIENT_MODE then
self:rspStandardReward({
err_code = GConst.ERROR_STR.SUCCESS,
reqData = {
activity_id = id,
}
})
return
end
self:sendMessage(ProtoMsgType.FromMsgEnum.ActivityScoreTaskRoundClaimReq, {activity_id = id}, self.rspStandardReward, BIReport.ITEM_GET_TYPE.ACT_SPRINT_STANDARD)
end
function ActSprintManager:rspStandardReward(result)
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
return
end
local sprintData = DataManager.ActSprintData:getSprintDetailData(result.reqData.activity_id)
sprintData:onGetStandardTurnReward(result.reqData.id)
if result.rewards then
GFunc.showRewardBox(result.rewards)
end
-- bi
local biType = sprintData:getBIType()
local taskFinishNum, taskTotalNum = sprintData:getBISprintTaskNumInfo()
local sprintTaskRound = sprintData:getStandardTurn()
local sprintRewardRound = sprintData:getStandardClaimedTurn()
BIReport:postActSprintClaimSprintReward(result.reqData.activity_id, biType, taskFinishNum, taskTotalNum, sprintTaskRound, sprintRewardRound)
end
-- 冲刺活动 章节礼包
function ActSprintManager:reqGift(id)
if EDITOR_MODE and CLIENT_MODE then
local giftData = {}
giftData.gift_type = PayManager.PURCHARSE_TYPE.ACT_GIFT
giftData.id = id
giftData.buy_count = DataManager.PaymentData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, id) + 1
giftData.latest_buy_at = Time:getServerTime() -- * 1000 -- 服务器都是毫秒
DataManager.PaymentData:updateGiftInfo(giftData, {})
return
end
PayManager:purchasePackage(id, PayManager.PURCHARSE_TYPE.ACT_GIFT, true)
end
-- 冲刺活动 达标/任务奖励
function ActSprintManager:reqTask(actId, id, isStandard)
self:sendMessage(ProtoMsgType.FromMsgEnum.ActivityTaskClaimReq, {activity_id = actId, task_id = id}, self.rspTask, BIReport.ITEM_GET_TYPE.ACT_SPRINT_TASK)
end
function ActSprintManager:rspTask(result)
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
return
end
if result.rewards then
GFunc.showRewardBox(result.rewards)
end
DataManager.ActSprintData:getSprintDetailData(result.reqData.activity_id):onNormalTaskSuccess(result.reqData.task_id)
-- bi
local sprintData = DataManager.ActSprintData:getSprintDetailData(result.reqData.activity_id)
local biType = sprintData:getBIType()
local taskFinishNum, taskTotalNum = sprintData:getBINormalTaskNumInfo()
local sprintTaskRound = sprintData:getStandardTurn()
local sprintRewardRound = sprintData:getStandardClaimedTurn()
BIReport:postActSprintClaimNormalTask(result.reqData.activity_id, biType, result.reqData.task_id, taskFinishNum, taskTotalNum, sprintTaskRound, sprintRewardRound)
end
function ActSprintManager:reqStandardTask(actId, id)
self:sendMessage(ProtoMsgType.FromMsgEnum.ActivityScoreTaskClaimReq, {activity_id = actId, task_id = id}, self.rspStandardTask, BIReport.ITEM_GET_TYPE.ACT_SPRINT_TASK)
end
function ActSprintManager:rspStandardTask(result)
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
return
end
if result.rewards then
GFunc.showRewardBox(result.rewards)
end
local sprintData = DataManager.ActSprintData:getSprintDetailData(result.reqData.activity_id)
local canGetRewardStandardTaskList = sprintData:getCanGetRewardStandardTaskList()
sprintData:onStandardTaskSuccess(result.reqData.task_id)
-- bi
local biType = sprintData:getBIType()
local taskFinishNum, taskTotalNum = sprintData:getBISprintTaskNumInfo()
local sprintTaskRound = sprintData:getStandardTurn()
local sprintRewardRound = sprintData:getStandardClaimedTurn()
BIReport:postActSprintClaimSprintTask(result.reqData.activity_id, biType, canGetRewardStandardTaskList, taskFinishNum, taskTotalNum, sprintTaskRound, sprintRewardRound)
end
function ActSprintManager:reqSprintBountySign(actType, actId, grade)
local sprintData = DataManager.ActSprintData:getSprintDetailData(actId)
local day = sprintData:getBountyCurrDay()
local actId = sprintData:getActId()
local args = {
act_type = actType,
bi_act_type = sprintData:getBIType(),
lv = 0,
grade = grade,
day = day,
act_id = actId
}
self:sendMessage(ProtoMsgType.FromMsgEnum.ActivityRushSignReq, args, self.rspSprintBountySign, BIReport.ITEM_GET_TYPE.ACT_SPRINT_SIGN_BOX)
end
function ActSprintManager:rspSprintBountySign(result)
if result.err_code ~= GConst.ERROR_STR.SUCCESS then
return
end
if result.rewards then
GFunc.showRewardBox(result.rewards)
end
local sprintData = DataManager.ActSprintData:getSprintDetailData(result.reqData.act_id)
sprintData:onBountySign(result.sign)
BIReport:postActSprintSignBounty(result.reqData.act_id, result.reqData.bi_act_type, result.reqData.day, result.reqData.grade == 1)
end
function ActSprintManager:onBuyBountyPro(giftId)
PayManager:purchasePackage(giftId, PayManager.PURCHARSE_TYPE.ACT_GIFT, true)
end
return ActSprintManager

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4dca279aa868f43bca55c99a65de6461
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -27,6 +27,7 @@ MainCityConst.RIGHT_SIDE_BARS = {
"app/ui/main_city/cell/side_bar_sign_cell", -- 签到
"app/ui/main_city/cell/side_bar_seven_day_cell", -- 七天乐第一期
"app/ui/main_city/cell/side_bar_seven_day_cell_2", -- 七天乐第二期
"app/ui/main_city/cell/side_bar_act_sprint_cell", -- 冲刺活动
}
return MainCityConst

View File

@ -122,4 +122,13 @@ function MaincityManager:checkShowPowerUI()
end
--@endregion
--@region 跨天数据
function MaincityManager:reqPassDay()
self:sendMessage(ProtoMsgType.FromMsgEnum.PassDayReq, {}, self.rspPassDay)
end
function MaincityManager:rspPassDay(result)
DataManager:onCrossDay(result)
end
--@endregion
return MaincityManager

View File

@ -5,289 +5,289 @@ local GIFT_COMP = "app/ui/activity/act_seven_day/component/gift_comp"
local DAY_COMP = "app/ui/activity/act_seven_day/component/day_comp"
function ActSevenDayUI:getPeriod()
return 1
return 1
end
function ActSevenDayUI:isFullScreen()
return false
return false
end
function ActSevenDayUI:onPressBackspace()
self:onClickClose()
self:onClickClose()
end
function ActSevenDayUI:ctor()
end
function ActSevenDayUI:getPrefabPath()
return "assets/prefabs/ui/activity/act_sevenday/act_sevenday_ui.prefab"
return "assets/prefabs/ui/activity/act_sevenday/act_sevenday_ui.prefab"
end
function ActSevenDayUI:onLoadRootComplete()
local uiMap = self.root:genAllChildren()
uiMap["act_sevenday_ui.d_menu.d_menu_1.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.TASK_DESC_1))
uiMap["act_sevenday_ui.d_menu.d_menu_1.desc_tx_choose"]:setText(I18N:getGlobalText(I18N.GlobalConst.TASK_DESC_1))
uiMap["act_sevenday_ui.d_menu.d_menu_2.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.GIFT_DESC_4))
uiMap["act_sevenday_ui.d_menu.d_menu_2.desc_tx_choose"]:setText(I18N:getGlobalText(I18N.GlobalConst.GIFT_DESC_4))
if self:getPeriod() == 1 then
uiMap["act_sevenday_ui.bg.title_img.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_SEVENDAY))
else
uiMap["act_sevenday_ui.bg.title_img.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_SEVENDAY_2))
end
self.timeTx = uiMap["act_sevenday_ui.bg.time_bg.time_tx"]
self.timeBg = uiMap["act_sevenday_ui.bg.time_bg"]
uiMap["act_sevenday_ui.bg.time_bg.help"]:addClickListener(function()
local params = {
desc = I18N:getGlobalText(I18N.GlobalConst.ACT_SEVENDAY_HELP)
}
ModuleManager.TipsManager:showHelpTips(params)
end)
local uiMap = self.root:genAllChildren()
uiMap["act_sevenday_ui.d_menu.d_menu_1.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.TASK_DESC_1))
uiMap["act_sevenday_ui.d_menu.d_menu_1.desc_tx_choose"]:setText(I18N:getGlobalText(I18N.GlobalConst.TASK_DESC_1))
uiMap["act_sevenday_ui.d_menu.d_menu_2.desc_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.GIFT_DESC_4))
uiMap["act_sevenday_ui.d_menu.d_menu_2.desc_tx_choose"]:setText(I18N:getGlobalText(I18N.GlobalConst.GIFT_DESC_4))
if self:getPeriod() == 1 then
uiMap["act_sevenday_ui.bg.title_img.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_SEVENDAY))
else
uiMap["act_sevenday_ui.bg.title_img.text"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_SEVENDAY_2))
end
self.timeTx = uiMap["act_sevenday_ui.bg.time_bg.time_tx"]
self.timeBg = uiMap["act_sevenday_ui.bg.time_bg"]
uiMap["act_sevenday_ui.bg.time_bg.help"]:addClickListener(function()
local params = {
desc = I18N:getGlobalText(I18N.GlobalConst.ACT_SEVENDAY_HELP)
}
ModuleManager.TipsManager:showHelpTips(params)
end)
self:initComps()
self:_display()
self:_addListeners()
self:_bind()
self:initComps()
self:_display()
self:_addListeners()
self:_bind()
self:scheduleGlobal(function()
self:updateTime()
end, 1)
self:updateTime()
self:updateTime()
end
function ActSevenDayUI:_display()
local page = 1
if DataManager.ActSevenDayData:hasTaskRp(self:getPeriod()) then
page = 1
end
self:switchComp(page)
self:refreshTitle()
local page = 1
if DataManager.ActSevenDayData:hasTaskRp(self:getPeriod()) then
page = 1
end
self:switchComp(page)
self:refreshTitle()
end
function ActSevenDayUI:_addListeners()
local uiMap = self.root:genAllChildren()
uiMap["act_sevenday_ui.mask"]:addClickListener(function()
self:onClickClose()
end)
uiMap["act_sevenday_ui.close_btn"]:addClickListener(function()
self:onClickClose()
end)
local uiMap = self.root:genAllChildren()
uiMap["act_sevenday_ui.mask"]:addClickListener(function()
self:onClickClose()
end)
uiMap["act_sevenday_ui.close_btn"]:addClickListener(function()
self:onClickClose()
end)
self:addEventListener(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, function()
self:closeUI()
end)
self:addEventListener(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, function()
self:closeUI()
end)
end
function ActSevenDayUI:onClickClose()
self:closeUI()
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.MAIN_UI_CHECK_POP)
self:closeUI()
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.MAIN_UI_CHECK_POP)
end
function ActSevenDayUI:_bind()
self:bind(DataManager.ActSevenDayData, "isDirty", function()
if not self.day or not self.page then
return
end
if self:getMaxShowDay() < self.day then
self.day = self:getMaxShowDay()
end
self:refreshTitle()
self:refreshBottoms()
self:refreshDayComp(self.day)
self.subComps[self.page]:refresh(self, self.day, self:getPeriod())
end)
self:bind(DataManager.PlayerData, "isDirty", function()
if not self.day or not self.page then
return
end
if self:getMaxShowDay() < self.day then
self.day = self:getMaxShowDay()
end
self:refreshTitle()
self:refreshBottoms()
self:refreshDayComp(self.day)
self.subComps[self.page]:refresh(self, self.day, self:getPeriod())
end)
self:bind(DataManager.PaymentData, "isDirty", function()
if not self.day or not self.page then
return
end
if self:getMaxShowDay() < self.day then
self.day = self:getMaxShowDay()
end
self:refreshTitle()
self:refreshBottoms()
self:refreshDayComp(self.day)
self.subComps[self.page]:refresh(self, self.day, self:getPeriod())
end)
self:bind(DataManager.ActSevenDayData, "isDirty", function()
if not self.day or not self.page then
return
end
if self:getMaxShowDay() < self.day then
self.day = self:getMaxShowDay()
end
self:refreshTitle()
self:refreshBottoms()
self:refreshDayComp(self.day)
self.subComps[self.page]:refresh(self, self.day, self:getPeriod())
end)
self:bind(DataManager.PlayerData, "isDirty", function()
if not self.day or not self.page then
return
end
if self:getMaxShowDay() < self.day then
self.day = self:getMaxShowDay()
end
self:refreshTitle()
self:refreshBottoms()
self:refreshDayComp(self.day)
self.subComps[self.page]:refresh(self, self.day, self:getPeriod())
end)
self:bind(DataManager.PaymentData, "isDirty", function()
if not self.day or not self.page then
return
end
if self:getMaxShowDay() < self.day then
self.day = self:getMaxShowDay()
end
self:refreshTitle()
self:refreshBottoms()
self:refreshDayComp(self.day)
self.subComps[self.page]:refresh(self, self.day, self:getPeriod())
end)
end
function ActSevenDayUI:initComps()
if self.subComps then
return
end
local uiMap = self.root:genAllChildren()
self.subComps = {}
if self.subComps then
return
end
local uiMap = self.root:genAllChildren()
self.subComps = {}
local taskComp = uiMap["act_sevenday_ui.task_comp"]
taskComp:initPrefabHelper()
taskComp:genAllChildren()
self.subComps[1] = taskComp:addLuaComponent(TASK_COMP)
local taskComp = uiMap["act_sevenday_ui.task_comp"]
taskComp:initPrefabHelper()
taskComp:genAllChildren()
self.subComps[1] = taskComp:addLuaComponent(TASK_COMP)
local giftComp = uiMap["act_sevenday_ui.gift_comp"]
giftComp:initPrefabHelper()
giftComp:genAllChildren()
self.subComps[2] = giftComp:addLuaComponent(GIFT_COMP)
local giftComp = uiMap["act_sevenday_ui.gift_comp"]
giftComp:initPrefabHelper()
giftComp:genAllChildren()
self.subComps[2] = giftComp:addLuaComponent(GIFT_COMP)
local dayComp = uiMap["act_sevenday_ui.r_menu"]
dayComp:initPrefabHelper()
dayComp:genAllChildren()
self.dayComp = dayComp:addLuaComponent(DAY_COMP)
local dayComp = uiMap["act_sevenday_ui.r_menu"]
dayComp:initPrefabHelper()
dayComp:genAllChildren()
self.dayComp = dayComp:addLuaComponent(DAY_COMP)
end
function ActSevenDayUI:refreshTitle()
end
function ActSevenDayUI:refreshBottoms()
if not self.bottomBtns then
local uiMap = self.root:genAllChildren()
self.bottomBtns = {}
self.bgs = {}
self.hlBgs = {}
self.txs = {}
self.hlTxs = {}
self.rps = {}
for i = 1, 2 do
local prefix = "act_sevenday_ui.d_menu.d_menu_" .. i
self.bottomBtns[i] = uiMap[prefix]
self.bottomBtns[i]:addClickListener(function()
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_BTN_SWITCH_2)
self:switchComp(i)
end)
self.bgs[i] = uiMap[prefix .. ".d_menu"]
self.hlBgs[i] = uiMap[prefix .. ".d_menu_choose"]
self.txs[i] = uiMap[prefix .. ".desc_tx"]
self.hlTxs[i] = uiMap[prefix .. ".desc_tx_choose"]
self.rps[i] = uiMap[prefix .. ".point_img"]
end
end
if not self.bottomBtns then
local uiMap = self.root:genAllChildren()
self.bottomBtns = {}
self.bgs = {}
self.hlBgs = {}
self.txs = {}
self.hlTxs = {}
self.rps = {}
for i = 1, 2 do
local prefix = "act_sevenday_ui.d_menu.d_menu_" .. i
self.bottomBtns[i] = uiMap[prefix]
self.bottomBtns[i]:addClickListener(function()
AudioManager:playEffect(AudioManager.EFFECT_ID.UI_BTN_SWITCH_2)
self:switchComp(i)
end)
self.bgs[i] = uiMap[prefix .. ".d_menu"]
self.hlBgs[i] = uiMap[prefix .. ".d_menu_choose"]
self.txs[i] = uiMap[prefix .. ".desc_tx"]
self.hlTxs[i] = uiMap[prefix .. ".desc_tx_choose"]
self.rps[i] = uiMap[prefix .. ".point_img"]
end
end
for index = 1, 2 do
local select = index == self.page
self.hlBgs[index]:setVisible(select)
self.txs[index]:setVisible(not select)
self.bgs[index]:setVisible(not select)
self.hlTxs[index]:setVisible(select)
if index == 1 then
self.rps[index]:setVisible(DataManager.ActSevenDayData:hasTaskRp(self:getPeriod()))
elseif index == 2 then
self.rps[index]:setVisible(DataManager.ActSevenDayData:hasGiftRp(self:getPeriod()))
end
end
for index = 1, 2 do
local select = index == self.page
self.hlBgs[index]:setVisible(select)
self.txs[index]:setVisible(not select)
self.bgs[index]:setVisible(not select)
self.hlTxs[index]:setVisible(select)
if index == 1 then
self.rps[index]:setVisible(DataManager.ActSevenDayData:hasTaskRp(self:getPeriod()))
elseif index == 2 then
self.rps[index]:setVisible(DataManager.ActSevenDayData:hasGiftRp(self:getPeriod()))
end
end
end
function ActSevenDayUI:switchComp(page, force)
if self.page == page and not force then
return
end
self.page = page
local day = self:getMaxShowDay()
day = self:refreshDayComp() or day
self.day = day
for index, comp in ipairs(self.subComps) do
comp:getBaseObject():setActive(index == page)
comp:refresh(self, day, self:getPeriod())
end
self:refreshBottoms()
if self.page == page and not force then
return
end
self.page = page
local day = self:getMaxShowDay()
day = self:refreshDayComp() or day
self.day = day
for index, comp in ipairs(self.subComps) do
comp:getBaseObject():setActive(index == page)
comp:refresh(self, day, self:getPeriod())
end
self:refreshBottoms()
-- if self:getPeriod() == 1 then -- 第一期
-- if self.page == 1 then
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.ACT_SEVENDAY_TASK)
-- else
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.ACT_SEVENDAY_GIFT)
-- end
-- else
-- if self.page == 1 then
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.ACT_SEVENDAY_TASK_2)
-- else
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.ACT_SEVENDAY_GIFT_2)
-- end
-- end
if self:getPeriod() == 1 then -- 第一期
if self.page == 1 then
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.ACT_SEVENDAY_TASK)
else
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.ACT_SEVENDAY_GIFT)
end
else
if self.page == 1 then
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.ACT_SEVENDAY_TASK_2)
else
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.ACT_SEVENDAY_GIFT_2)
end
end
end
function ActSevenDayUI:refreshDayComp(targetDay)
local maxShowDay = self:getMaxShowDay()
local dataInfo = {}
local minRpDay = maxShowDay
for day = 1, 7 do
local over = false
local rp = false
if day <= maxShowDay then
over = true
if self.page == 1 then
local tasks = DataManager.ActSevenDayData:getTaskIdsByDay(day, self:getPeriod())
if tasks then
for _, id in ipairs(tasks) do
if not DataManager.ActSevenDayData:isTaskReceived(id) then
over = false
end
local maxShowDay = self:getMaxShowDay()
local dataInfo = {}
local minRpDay = maxShowDay
for day = 1, 7 do
local over = false
local rp = false
if day <= maxShowDay then
over = true
if self.page == 1 then
local tasks = DataManager.ActSevenDayData:getTaskIdsByDay(day, self:getPeriod())
if tasks then
for _, id in ipairs(tasks) do
if not DataManager.ActSevenDayData:isTaskReceived(id) then
over = false
end
if DataManager.ActSevenDayData:canClaimTask(id) then
rp = true
if minRpDay > day then
minRpDay = day
end
break
end
end
if DataManager.ActSevenDayData:canClaimTask(id) then
rp = true
if minRpDay > day then
minRpDay = day
end
break
end
end
end
elseif self.page == 2 then
rp = DataManager.ActSevenDayData:hasGiftDayRp(day, self:getPeriod())
over = DataManager.ActSevenDayData:getIsGiftAllOverDay(day, self:getPeriod())
if rp and minRpDay > day then
minRpDay = day
end
end
end
end
elseif self.page == 2 then
rp = DataManager.ActSevenDayData:hasGiftDayRp(day, self:getPeriod())
over = DataManager.ActSevenDayData:getIsGiftAllOverDay(day, self:getPeriod())
if rp and minRpDay > day then
minRpDay = day
end
end
end
table.insert(dataInfo, {
over = over,
rp = rp,
func = function(selectDay)
self.day = selectDay
self.subComps[self.page]:refresh(self, selectDay, self:getPeriod())
end
})
end
targetDay = targetDay or minRpDay
self.dayComp:refresh(self, dataInfo, targetDay, maxShowDay, self:getPeriod())
return minRpDay
table.insert(dataInfo, {
over = over,
rp = rp,
func = function(selectDay)
self.day = selectDay
self.subComps[self.page]:refresh(self, selectDay, self:getPeriod())
end
})
end
targetDay = targetDay or minRpDay
self.dayComp:refresh(self, dataInfo, targetDay, maxShowDay, self:getPeriod())
return minRpDay
end
function ActSevenDayUI:getMaxShowDay()
local day = DataManager.ActSevenDayData:getActDay(self:getPeriod())
if day <= 0 or day >= 7 then
day = 7
end
return day
local day = DataManager.ActSevenDayData:getActDay(self:getPeriod())
if day <= 0 or day >= 7 then
day = 7
end
return day
end
function ActSevenDayUI:updateTime()
local cd = DataManager.ActSevenDayData:getRemainTime(self:getPeriod())
local timeStr = GConst.EMPTY_STRING
local remainDay = -1
local timeStr = GConst.EMPTY_STRING
local remainDay = -1
if cd <= 0 then
timeStr = I18N:getGlobalText(I18N.GlobalConst.ADVENTURE_CLOSED)
else
remainDay = cd // 86400
timeStr = I18N:getGlobalText(I18N.GlobalConst.TIME_END_DESC_1, GFunc.getTimeStr(cd))
else
remainDay = cd // 86400
timeStr = I18N:getGlobalText(I18N.GlobalConst.TIME_END_DESC_1, GFunc.getTimeStr(cd))
end
self.timeTx:setText(timeStr)
if remainDay >= 0 and self.remainDay ~= remainDay then
self.remainDay = remainDay
local width = self.timeTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
self.timeBg:setSizeDeltaX(width + 74)
end
self.timeTx:setText(timeStr)
if remainDay >= 0 and self.remainDay ~= remainDay then
self.remainDay = remainDay
local width = self.timeTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).preferredWidth
self.timeBg:setSizeDeltaX(width + 74)
end
end
return ActSevenDayUI

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: fbc57e01919bd42e78f48783c435f530
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,144 @@
local ActSprintListUI = class("ActSprintListUI", BaseUI)
local ACTIVITY_CELL = "app/ui/activity/act_sprint/cell/activity_cell"
function ActSprintListUI:isFullScreen()
return false
end
function ActSprintListUI:onPressBackspace()
self:closeUI()
end
function ActSprintListUI:ctor(params)
self.params = params or {}
self.autoPop = self.params.autoPop
self.showToday = self.params.showToday
self.activityList = DataManager.ActSprintData:getActSprintIdList()
end
function ActSprintListUI:getPrefabPath()
return "assets/prefabs/ui/activity/act_sprint/act_sprint_list_ui.prefab"
end
-- function ActSprintListUI:currencyParams()
-- local params = {}
-- params.showType = GConst.CURRENCY_TYPE.HORIZONTAL
-- params.itemIds = {}
-- -- 填充活动对应的兑换道具 约定同时开的不会超过4个
-- local itemMap = {}
-- local exchangeIdList = DataManager.ActSprintData:getExchangeIdList()
-- for index, exchangeId in ipairs(exchangeIdList) do
-- local exchangeCfg = DataManager.ActSprintData:getExchangeConfig(exchangeId)
-- if exchangeCfg.cost then
-- itemMap[exchangeCfg.cost.id] = true
-- end
-- end
-- for itemId, _ in pairs(itemMap) do
-- table.insert(params.itemIds, itemId)
-- end
-- return params, true
-- end
function ActSprintListUI:onLoadRootComplete()
if self.autoPop and self.showToday then -- 今天内不在提示
local time = LocalData:getMessageBoxShowTodayTime(self.showToday)
local todayTime = Time:getBeginningOfServerToday()
if time > 0 and time == todayTime then
self:closeUI()
return
else
LocalData:setMessageBoxShowTodayTime(self.showToday, todayTime)
end
end
self:_display()
self:_addListeners()
self:_bind()
self:scheduleGlobal(function()
self:updateTime()
end, 1)
self:updateTime()
self:updateRp()
end
function ActSprintListUI:_display()
local uiMap = self.root:genAllChildren()
self.mask = uiMap["act_sprint_list_ui.mask"]
self.closeBtn = uiMap["act_sprint_list_ui.bg.close_btn"]
self.titleTx = uiMap["act_sprint_list_ui.bg.title_tx"]
self.scrollrect = uiMap["act_sprint_list_ui.bg.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.shopBtn = uiMap["act_sprint_list_ui.bg.shop_btn"]
self.shopTx = uiMap["act_sprint_list_ui.bg.shop_btn.tx"]
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_1))
self.shopTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_3))
-- 屏蔽兑换
self.shopBtn:setActive(DataManager.ActSprintData:isShopOpen())
end
function ActSprintListUI:_addListeners()
-- self.mask:addClickListener(function()
-- self:closeUI()
-- end)
self.closeBtn:addClickListener(function()
self:closeUI()
end)
self.shopBtn:addClickListener(function()
ModuleManager.ActSprintManager:showActSprintShopUI()
end)
-- self:addEventListener(EventManager.CUSTOM_EVENT.CLOSE_ACT_SPRINT_LIST_UI, function()
-- self:closeUI()
-- end)
end
function ActSprintListUI:_bind()
self:bind(DataManager.ActSprintData, "isDirty", function()
self:updateScrollrect()
-- self:updateCurrencyBar()
self:updateRp()
end)
end
function ActSprintListUI:updateTime()
self:updateScrollrect()
if not DataManager.ActSprintData:getIsOpen() then
self:closeUI()
end
end
function ActSprintListUI:updateScrollrect()
self.activityList = DataManager.ActSprintData:getActSprintIdList()
if not self.initScrollrect then
self.initScrollrect = true
self.scrollrect:addInitCallback(function()
return ACTIVITY_CELL
end)
self.scrollrect:addRefreshCallback(function(index, cell)
cell:refresh(self.activityList[index], function() self:closeUI() end)
end)
self.scrollrect:clearCells()
self.scrollrect:refillCells(#self.activityList)
else
if self.scrollrect:getTotalCount() == #self.activityList then
self.scrollrect:updateAllCell()
else
self.scrollrect:refillCells(#self.activityList)
end
end
end
function ActSprintListUI:updateRp()
if DataManager.ActSprintData:hasExchangeRp() then
self.shopBtn:addRedPoint(40, 30, 0.6)
else
self.shopBtn:removeRedPoint()
end
end
return ActSprintListUI

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 0eeb0d272a2003f4ca0197c08f9be9b6
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,107 @@
local ActSprintShopUI = class("ActSprintShopUI", BaseUI)
local CELL = "app/ui/activity/act_sprint/cell/shop_cell"
function ActSprintShopUI:isFullScreen()
return false
end
function ActSprintShopUI:onPressBackspace()
self:onClickClose()
end
function ActSprintShopUI:ctor(params)
self.params = params or {}
end
function ActSprintShopUI:getPrefabPath()
return "assets/prefabs/ui/activity/act_sprint/act_sprint_shop_ui.prefab"
end
-- function ActSprintShopUI:currencyParams()
-- local params = {}
-- params.showType = GConst.CURRENCY_TYPE.HORIZONTAL
-- params.itemIds = {}
-- -- 填充活动对应的兑换道具 约定同时开的不会超过4个
-- local itemMap = {}
-- local exchangeIdList = DataManager.ActSprintData:getExchangeIdList()
-- for index, exchangeId in ipairs(exchangeIdList) do
-- local exchangeCfg = DataManager.ActSprintData:getExchangeConfig(exchangeId)
-- if exchangeCfg.cost then
-- itemMap[exchangeCfg.cost.id] = true
-- end
-- end
-- for itemId, _ in pairs(itemMap) do
-- table.insert(params.itemIds, itemId)
-- end
-- return params, true
-- end
function ActSprintShopUI:onLoadRootComplete()
self:_display()
self:_addListeners()
self:_bind()
self:scheduleGlobal(function()
self:updateTime()
end, 1)
self:updateTime()
self:updateScrollrect()
end
function ActSprintShopUI:_display()
local uiMap = self.root:genAllChildren()
self.mask = uiMap["act_sprint_shop_ui.mask"]
self.titleTx = uiMap["act_sprint_shop_ui.bg.tx_title"]
self.scrollrect = uiMap["act_sprint_shop_ui.bg.scrollrect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.closeBtn = uiMap["act_sprint_shop_ui.bg.btn_close"]
self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_3))
end
function ActSprintShopUI:_addListeners()
self.closeBtn:addClickListener(function()
self:closeUI()
end)
end
function ActSprintShopUI:_bind()
self:bind(DataManager.ActSprintData, "isDirty", function()
self:updateScrollrect()
-- self:updateCurrencyBar()
end)
end
function ActSprintShopUI:updateTime()
if not DataManager.ActSprintData:getIsOpen() then
self:closeUI()
end
end
function ActSprintShopUI:updateData()
self.shopList = DataManager.ActSprintData:getExchangeIdList()
end
function ActSprintShopUI:updateScrollrect()
self:updateData()
if not self.initScrollrect then
self.initScrollrect = true
self.scrollrect:addInitCallback(function()
return CELL
end)
self.scrollrect:addRefreshCallback(function(index, cell)
cell:refresh(self.shopList[index])
end)
self.scrollrect:clearCells()
self.scrollrect:refillCells(#self.shopList)
else
if self.scrollrect:getTotalCount() == #self.shopList then
self.scrollrect:updateAllCell()
else
self.scrollrect:refillCells(#self.shopList)
end
end
end
return ActSprintShopUI

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: cf78d6182353eff459b79602220b34be
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e7defc4efb1e278419e76982a2e046ae
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,42 @@
local ActivityCell = class("ActivityCell", BaseCell)
local REWARD_CELL_COUNT = 3
function ActivityCell:refresh(actId, callback)
local actCfg = ConfigManager:getConfig("activity")[actId]
local showReward = actCfg.show_reward
local uiMap = self:getUIMap()
local banner = uiMap["activity_cell.banner"]
local timeTx = uiMap["activity_cell.banner.time_tx"]
local titleTx = uiMap["activity_cell.banner.title_tx"]
if not self.rewardList then
self.rewardList = {}
for i = 1, REWARD_CELL_COUNT do
table.insert(self.rewardList, CellManager:addCellComp(uiMap["activity_cell.banner.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL))
end
end
local redPoint = uiMap["activity_cell.banner.red_point"]
-- 刷新
banner:setTexture(GConst.ActSprintConst.ACT_LIST_BANNER[actId])
timeTx:setText(Time:formatNumTimeStr(DataManager.ActSprintData:getRemainTime(actId)))
titleTx:setText(I18N:getGlobalText(GConst.ActSprintConst.ACT_LIST_NAME[actId]))
for i = 1, REWARD_CELL_COUNT do
if showReward and i <= #showReward then
self.rewardList[i].baseObject:setActive(true)
self.rewardList[i]:refreshByConfig(showReward[i])
else
self.rewardList[i].baseObject:setActive(false)
end
end
self:addClickListener(function()
ModuleManager.ActSprintManager:showActSprintMainUI({actId = actId})
-- EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CLOSE_ACT_SPRINT_LIST_UI)
if callback then
callback()
end
end)
redPoint:setVisible(DataManager.ActSprintData:hasRedPoint(true))
end
return ActivityCell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 482f8536e3388cf4195cb7a3e247f57a
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,78 @@
local ShopCell = class("ShopCell", BaseCell)
local FREE_BG = "act_common_bg_30"
local COST_BG = "act_common_bg_31"
function ShopCell:refresh(id)
local uiMap = self:getUIMap()
local bg = uiMap["shop_cell.bg"]
local nameTx = uiMap["shop_cell.bg.name_tx"]
if not self.rewardCell then
self.rewardCell = CellManager:addCellComp(uiMap["shop_cell.bg.reward_cell"], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
end
local limitTx = uiMap["shop_cell.bg.limit_tx"]
local mask = uiMap["shop_cell.bg.mask"]
local costImg = uiMap["shop_cell.bg.cost_img"]
local costTx = uiMap["shop_cell.bg.cost_tx"]
local sellOutTx = uiMap["shop_cell.bg.sell_out_tx"]
sellOutTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_8))
local reward = DataManager.ActSprintData:getExchangeReward(id)
local cost = DataManager.ActSprintData:getExchangeCost(id)
local refreshType = DataManager.ActSprintData:getExchangeRefreshType(id)
local limit = DataManager.ActSprintData:getExchangeLimit(id)
local useTimes = DataManager.ActSprintData:getExchangeCount(id)
local isFree = cost == nil
local refreshTypeStr
if refreshType == GConst.ActSprintConst.REFRESH_TYPE.DAY then
refreshTypeStr = I18N.GlobalConst.ACT_GOGOGO_DESC_5
elseif refreshType == GConst.ActSprintConst.REFRESH_TYPE.WEEK then
refreshTypeStr = I18N.GlobalConst.ACT_GOGOGO_DESC_6
elseif refreshType == GConst.ActSprintConst.REFRESH_TYPE.ONCE then
refreshTypeStr = I18N.GlobalConst.ACT_GOGOGO_DESC_7
end
local canBuy = useTimes < limit
bg:setSprite(GConst.ATLAS_PATH.UI_ACT_COMMON, isFree and FREE_BG or COST_BG)
nameTx:setText()
self.rewardCell:refreshByConfig(reward)
limitTx:setText(I18N:getGlobalText(refreshTypeStr, limit - useTimes, limit))
if canBuy then
if cost then
costImg:setVisible(true)
costImg:setSprite(GFunc.getIconRes(cost.id))
costTx:setVisible(true)
costTx:setText(cost.num)
GFunc.centerImgAndTx(costImg, costTx, 5)
else
costImg:setVisible(false)
costTx:setVisible(true)
costTx:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC))
costTx:setSizeDeltaX(160)
costTx:setAnchoredPositionX(0)
end
mask:setVisible(false)
else
costImg:setVisible(false)
costTx:setVisible(false)
mask:setVisible(true)
end
self:addClickListener(function()
if canBuy then
if cost then
if GFunc.checkCost(cost.id, cost.num, true) then
ModuleManager.ActSprintManager:reqExchange(id, 1)
end
else
ModuleManager.ActSprintManager:reqExchange(id, 1)
end
end
end)
end
return ShopCell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 6d162d47c479a0449b4b38ab580f4d2e
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6f50b2cfdce5a46d89c1e0211a04f51b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,236 @@
local ActSprintMainUI = class("ActSprintMainUI", BaseUI)
local BTN_WIDTH = 82
local BTN_RIGHT = 20
local BTN_SPACING = 26
function ActSprintMainUI:showCommonBG()
return false
end
function ActSprintMainUI:onPressBackspace()
self:closeUI()
end
function ActSprintMainUI:getPrefabPath()
return "assets/prefabs/ui/activity/act_sprint/act_sprint_main_ui_1_all.prefab"
end
function ActSprintMainUI:onClose()
if self.subComps then
for _, comp in pairs(self.subComps) do
if comp.onClose then
comp:onClose()
end
end
end
local callback = self.callback
self.callback = nil
if callback then
callback()
end
end
function ActSprintMainUI:currencyParams()
self.params = {}
self.params.showType = GConst.CURRENCY_TYPE.HORIZONTAL
if self.curPage == 3 then
self.params.itemIds = {
GConst.ItemConst.ITEM_ID_GEM,
}
else
self.params.itemIds = {}
end
return self.params, true
end
function ActSprintMainUI:ctor(params)
self.params = params or {}
self.actId = params.actId
self.curPage = params.page or self:getRpPage()
end
function ActSprintMainUI:onLoadRootComplete()
if not self.actId then
self:closeUI()
return
end
local uiMap = self.root:genAllChildren()
self.btnClose = uiMap["act_sprint_main_ui.bottom.btn_close"]
self.btnNode = uiMap["act_sprint_main_ui.bottom.btns"]
self.btnContent = uiMap["act_sprint_main_ui.bottom.btns.viewport.content"]
self.btns = {}
self.txBtns = {}
for i = 1, 4 do
table.insert(self.btns, uiMap["act_sprint_main_ui.bottom.btns.viewport.content.btn_" .. i])
table.insert(self.txBtns, uiMap["act_sprint_main_ui.bottom.btns.viewport.content.btn_" .. i .. ".tx_desc"])
end
self.compsRoot = uiMap["act_sprint_main_ui.comps"]
for i, btn in ipairs(self.btns) do
btn:addClickListener(function()
self:onChangePage(i)
end)
end
self.txBtns[1]:setText(I18N:getGlobalText(I18N.GlobalConst[GConst.ActSprintConst.MAIN_PAGE_BTN_DESC[GConst.ActSprintConst.MAIN_PAGE_TYPE.STANDARD]]))
self.txBtns[2]:setText(I18N:getGlobalText(I18N.GlobalConst[GConst.ActSprintConst.MAIN_PAGE_BTN_DESC[GConst.ActSprintConst.MAIN_PAGE_TYPE.LOGIN]]))
self.txBtns[3]:setText(I18N:getGlobalText(I18N.GlobalConst[GConst.ActSprintConst.MAIN_PAGE_BTN_DESC[GConst.ActSprintConst.MAIN_PAGE_TYPE.GIFT]]))
self.txBtns[4]:setText(I18N:getGlobalText(I18N.GlobalConst[GConst.ActSprintConst.MAIN_PAGE_BTN_DESC[GConst.ActSprintConst.MAIN_PAGE_TYPE.TASK]]))
self:initComps()
self:scheduleGlobal(function()
self:updateTime()
end, 1)
self:updateTime()
self.btnClose:addClickListener(function()
self:closeUI()
end)
self:bind(DataManager.ActSprintSummonDataAll, "isDirty", function()
self:refreshRedPoint()
self:onRefresh()
end)
self:bind(DataManager.PaymentData, "isDirty", function()
self:refreshRedPoint()
self:onRefresh()
end)
self:addEventListener(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, function()
self:closeUI()
end)
self:refreshRedPoint()
self:onRefresh()
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.ACT_SPRINT_NEW_SUMMON)
end
function ActSprintMainUI:initComps()
if self.subComps then
return
end
local uiMap = self.root:genAllChildren()
self.subComps = {}
-- 预制体挂载
local obj = uiMap["act_sprint_main_ui.standard_comp"]
obj:initPrefabHelper()
obj:genAllChildren()
local comp = obj:addLuaComponent("app/ui/activity/act_sprint_summon_all/comp/standard_comp")
self.subComps[1] = comp
local obj2 = uiMap["act_sprint_main_ui.login_comp"]
obj2:initPrefabHelper()
obj2:genAllChildren()
self.subComps[2] = obj2:addLuaComponent("app/ui/activity/act_sprint_summon_all/comp/login_comp")
local obj3 = uiMap["act_sprint_main_ui.gift_comp"]
obj3:initPrefabHelper()
obj3:genAllChildren()
self.subComps[3] = obj3:addLuaComponent("app/ui/activity/act_sprint_summon_all/comp/gift_comp")
local obj4 = uiMap["act_sprint_main_ui.task_comp"]
obj4:initPrefabHelper()
obj4:genAllChildren()
self.subComps[4] = obj4:addLuaComponent("app/ui/activity/act_sprint_summon_all/comp/task_comp")
end
function ActSprintMainUI:updateTime()
if self.subComps then
for _, comp in pairs(self.subComps) do
if comp.updateTime then
comp:updateTime(self.actId)
end
end
end
if not DataManager.ActSprintSummonDataAll:getIsOpen() then
self:closeUI()
end
end
function ActSprintMainUI:onChangePage(page)
if self.curPage == page then
return
end
for i, comp in pairs(self.subComps) do
if page ~= i and self.curPage == i and comp.onClose then
comp:onClose()
end
end
self.curPage = page
self:onRefresh()
end
function ActSprintMainUI:onRefresh()
local openCount = 0
for i, btn in ipairs(self.btns) do
if self:isOpen(i) then
btn:setActive(true)
openCount = openCount + 1
if self.curPage == i then
btn:setSprite(GConst.ATLAS_PATH.UI_ACT_COMMON, GConst.ActSprintConst.MAIN_PAGE_BTN_ICON_1[self.actId][i])
else
btn:setSprite(GConst.ATLAS_PATH.UI_ACT_COMMON, GConst.ActSprintConst.MAIN_PAGE_BTN_ICON_2[self.actId][i])
end
else
btn:setActive(false)
end
end
local width = BTN_RIGHT + BTN_WIDTH * openCount + BTN_SPACING * (openCount - 1) + 20
self.btnContent:setSizeDeltaX(width)
self.btnContent:setAnchoredPositionX(math.max(width - self.btnNode:getSizeDeltaX(), 0))
for i, comp in pairs(self.subComps) do
if self.curPage == i then
comp:getBaseObject():setActive(true)
comp:refresh(self.actId)
else
comp:getBaseObject():setActive(false)
end
end
self:updateCurrencyBar()
-- 红点
self:refreshRedPoint()
end
function ActSprintMainUI:refreshRedPoint()
for i, btn in ipairs(self.btns) do
if self:hasRedPoint(i) then
btn:addRedPoint(30, 30, 0.9)
else
btn:removeRedPoint()
end
end
end
function ActSprintMainUI:isOpen(type)
return true
end
function ActSprintMainUI:hasRedPoint(page)
if page == 1 then
return DataManager.ActSprintSummonDataAll:hasStandardRp()
elseif page == 2 then
return DataManager.ActSprintSummonDataAll:hasBountyRp()
elseif page == 3 then
return DataManager.ActSprintSummonDataAll:hasGiftRp()
elseif page == 4 then
return DataManager.ActSprintSummonDataAll:hasTaskRp()
end
return false
end
function ActSprintMainUI:getRpPage()
for i = 1, 4 do
if self:hasRedPoint(i) then
return i
end
end
return 1
end
return ActSprintMainUI

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: ce95387387faadd4b8e34476e0a4a7df
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3badef5720aa26742a9d6e505bd0b80e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,119 @@
local GiftCell = class("GiftCell", BaseCell)
local REWARD_CELL_COUNT = 3
local BG_NAME_1 = "act_common_bg_27" -- 售罄
local BG_NAME_2 = "act_common_bg_28" -- 正常
local BTN_NAME_1 = "common_btn_grey_5"
local BTN_NAME_2 = "common_btn_yellow_5"
function GiftCell:refresh(actGiftId)
local uiMap = self:getUIMap()
local bg = uiMap["gift_cell.bg"]
local descTx = uiMap["gift_cell.bg.desc_tx"]
if not self.rewardList then
self.rewardList = {}
for i = 1, REWARD_CELL_COUNT do
table.insert(self.rewardList, CellManager:addCellComp(uiMap["gift_cell.bg.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL))
end
end
local offBg = uiMap["gift_cell.bg.off_bg"]
local offTx = uiMap["gift_cell.bg.off_bg.desc_tx"]
local limitTx = uiMap["gift_cell.bg.limit_tx"]
local funcBtn = uiMap["gift_cell.bg.func_btn"]
local funcTx = uiMap["gift_cell.bg.func_btn.desc_tx"]
local funcAdIcon = uiMap["gift_cell.bg.func_btn.ad"]
local funcAdTx = uiMap["gift_cell.bg.func_btn.ad_tx"]
local func2AdTx = uiMap["gift_cell.bg.func_btn.ad_2_tx"]
local isFree = DataManager.ActSprintSummonDataAll:getActGiftIsFree(actGiftId)
local isAd = DataManager.ActSprintSummonDataAll:getActGiftIsAd(actGiftId)
local costItem = DataManager.ActSprintSummonDataAll:getActGiftCostItem(actGiftId)
local rechargeId = DataManager.ActSprintSummonDataAll:getActGiftRechargeId(actGiftId)
local buyCount = DataManager.ActSprintSummonDataAll:getActGiftBuyCount(actGiftId)
local limitCount = DataManager.ActSprintSummonDataAll:getActGiftLimit(actGiftId)
local value = DataManager.ActSprintSummonDataAll:getActGiftValue(actGiftId) -- 超值标识
local rewards = DataManager.ActSprintSummonDataAll:getActGiftReward(actGiftId)
local soldOut = buyCount >= limitCount
bg:setSprite(GConst.ATLAS_PATH.UI_ACT_COMMON, (isFree or isAd) and BG_NAME_1 or BG_NAME_2)
funcBtn:setSprite(GConst.ATLAS_PATH.COMMON, soldOut and BTN_NAME_1 or BTN_NAME_2)
if soldOut then
funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_8))
funcAdIcon:setVisible(false)
funcAdTx:setVisible(false)
func2AdTx:setVisible(false)
else
if rechargeId then
funcTx:setText(GFunc.getFormatPrice(rechargeId))
funcAdIcon:setVisible(false)
funcAdTx:setVisible(false)
func2AdTx:setVisible(false)
else
if isFree then
funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC))
funcAdIcon:setVisible(false)
funcAdTx:setVisible(false)
func2AdTx:setVisible(false)
elseif isAd then
funcTx:setText()
funcAdIcon:setVisible(true)
funcAdTx:setVisible(true)
func2AdTx:setVisible(false)
GFunc.setAdsSprite(funcAdIcon)
funcAdTx:setText(I18N:getGlobalText(I18N.GlobalConst.FREE_DESC))
elseif costItem then
funcTx:setText()
funcAdIcon:setVisible(true)
funcAdIcon:setSprite(GFunc.getIconRes(costItem.id))
if GFunc.checkCost(costItem.id, costItem.num, false) then
funcAdTx:setVisible(true)
func2AdTx:setVisible(false)
funcAdTx:setText(costItem.num)
else
funcAdTx:setVisible(true)
func2AdTx:setVisible(false)
funcAdTx:setText("<color=#FF6C73>" .. costItem.num .. "</color>")
end
end
end
end
descTx:setText(DataManager.ActSprintSummonDataAll:getActGiftI18NName(actGiftId))
for i = 1, REWARD_CELL_COUNT do
local reward = rewards and rewards[i]
if reward then
self.rewardList[i].baseObject:setActive(true)
self.rewardList[i]:refreshByConfig(reward)
else
self.rewardList[i].baseObject:setActive(false)
end
end
local limitStr = I18N:getGlobalText(I18N.GlobalConst.GIFT_ROUTINE_DESC_8) .. "(" .. (limitCount - buyCount) .. "/" .. limitCount .. ")"
limitTx:setText(soldOut and "<color=#2C6A65>" .. limitStr .. "</color>" or "<color=#6A482D>" .. limitStr .. "</color>")
if value then
offBg:setVisible(true)
offTx:setText(value .. "%")
else
offBg:setVisible(false)
end
funcBtn:addClickListener(function()
if not soldOut then
if isAd then
SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.AD_ACT_SPRINT, function()
ModuleManager.ActSprintManager:reqGift(actGiftId)
end)
else
if costItem then
if GFunc.checkCost(costItem.id, costItem.num, true) then
ModuleManager.ActSprintManager:reqGift(actGiftId)
end
else
ModuleManager.ActSprintManager:reqGift(actGiftId)
end
end
end
end)
end
return GiftCell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: d5597e85c63eaf342b933c03bbf3cf7c
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,93 @@
local SummonActCell = class("SummonActCell", BaseCell)
function SummonActCell:init()
local uiMap = self:getUIMap()
self.dayIcon = uiMap["bounty_cell.day_icon"]
self.dayTx = uiMap["bounty_cell.day_icon.day_tx"]
self.dayTxGrey = uiMap["bounty_cell.day_icon.day_tx_grey"]
self.upSlider = uiMap["bounty_cell.up_slider"]
self.upIcon = uiMap["bounty_cell.up_slider.icon"]
self.downSlider = uiMap["bounty_cell.down_slider"]
self.downIcon = uiMap["bounty_cell.down_slider.icon"]
self.bg = uiMap["bounty_cell.bg"]
self.freeRewardCell = uiMap["bounty_cell.reward_free.reward_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
self.proRewardCells = {}
for i = 1, 2 do
self.proRewardCells[i] = uiMap["bounty_cell.reward_pro.reward_cell_" .. i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
end
end
function SummonActCell:refresh(day, maxDay, info)
local curDay = DataManager.ActSprintSummonDataAll:getBountyCurrDay()
local freeGot = DataManager.ActSprintSummonDataAll:getHasGotBountyReward(0, day)
local proGot = DataManager.ActSprintSummonDataAll:getHasGotBountyReward(1, day)
local freeCanGet = DataManager.ActSprintSummonDataAll:canClaimBountyReward(0, day)
local proCanGet = DataManager.ActSprintSummonDataAll:canClaimBountyReward(1, day)
local rewardFree = info.reward[1]
local rewardPro1 = info.reward_pro[1]
local rewardPro2 = info.reward_pro[2]
local isUnlockPro = DataManager.ActSprintSummonDataAll:isUnlockBountyPro()
local dayStr = tostring(day)
self.dayTx:setText(dayStr)
self.dayTxGrey:setText(dayStr)
-- 刷新slider部分
self.upSlider:setVisible(day ~= 1)
self.downSlider:setVisible(day ~= maxDay)
self.upIcon:setVisible(day <= curDay)
self.downIcon:setVisible(day < curDay)
-- 奖励
self.freeRewardCell:refreshByConfig(rewardFree, freeGot, freeGot)
if freeCanGet then
self.freeRewardCell:showFrameAnimation()
self.freeRewardCell:addClickListener(function()
self:onClickClaimRewards()
end)
self.dayTx:setVisible(true)
self.dayTxGrey:setVisible(false)
GFunc.setGrey(self.bg:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), false)
GFunc.setGrey(self.dayIcon:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), false)
else
self.freeRewardCell:hideFrameAnimation()
-- self.freeRewardCell:setClickShowTips()
self.dayTx:setVisible(freeGot)
self.dayTxGrey:setVisible(not freeGot)
GFunc.setGrey(self.bg:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), not freeGot)
GFunc.setGrey(self.dayIcon:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE), not freeGot)
end
self.proRewardCells[1]:refreshByConfig(rewardPro1, proGot, proGot)
if rewardPro2 then
self.proRewardCells[2]:setActive(true)
self.proRewardCells[2]:refreshByConfig(rewardPro2, proGot, proGot)
else
self.proRewardCells[2]:setActive(false)
end
self.proRewardCells[1]:showLock(not isUnlockPro)
self.proRewardCells[2]:showLock(not isUnlockPro)
if proCanGet and isUnlockPro and not proGot then
self.proRewardCells[1]:showFrameAnimation()
self.proRewardCells[2]:showFrameAnimation()
self.proRewardCells[1]:addClickListener(function()
self:onClickClaimRewards()
end)
self.proRewardCells[2]:addClickListener(function()
self:onClickClaimRewards()
end)
else
self.proRewardCells[1]:hideFrameAnimation()
self.proRewardCells[2]:hideFrameAnimation()
-- self.proRewardCells[1]:setClickShowTips()
-- self.proRewardCells[2]:setClickShowTips()
end
end
function SummonActCell:onClickClaimRewards()
local actId = DataManager.ActSprintSummonDataAll:getActId()
local actType = DataManager.ActSprintSummonDataAll:getActType(actId)
local grade = DataManager.ActSprintSummonDataAll:isUnlockBountyPro() and 1 or 0
ModuleManager.ActSprintManager:reqSprintBountySign(actType, actId, grade)
end
return SummonActCell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: a8b0bda5edab9ab44a9d8cd117347310
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,57 @@
local StandardCell = class("StandardCell", BaseCell)
local REWARD_CELL_COUNT = 3
function StandardCell:refresh(actTaskId)
local uiMap = self:getUIMap()
local bg = uiMap["standard_cell.bg"]
local descTx = uiMap["standard_cell.bg.desc_tx"]
if not self.slider then
self.slider = uiMap["standard_cell.bg.slider_bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
end
local sliderTx = uiMap["standard_cell.bg.slider_bg.tx"]
if not self.rewardList then
self.rewardList = {}
for i = 1, REWARD_CELL_COUNT do
table.insert(self.rewardList, CellManager:addCellComp(uiMap["standard_cell.bg.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL))
end
end
local rewardLayout = uiMap["standard_cell.bg.rewards"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT)
local num = DataManager.ActSprintSummonDataAll:getActTaskNum(actTaskId)
local type = DataManager.ActSprintSummonDataAll:getActTaskType(actTaskId)
local limit = DataManager.ActSprintSummonDataAll:getActTaskNumber1(actTaskId)
local rewards = DataManager.ActSprintSummonDataAll:getActTaskReward(actTaskId)
local hasGot = DataManager.ActSprintSummonDataAll:getHasGotTaskReward(actTaskId)
local canGet = num >= limit and not hasGot
-- 修订
if num > limit then
num = limit
end
if hasGot then
num = limit
end
descTx:setText(GFunc.getTaskDesc(type, limit))
self.slider.value = num / limit
sliderTx:setText(num .. "/" .. limit)
for i = 1, REWARD_CELL_COUNT do
local reward = rewards and rewards[i]
if reward then
self.rewardList[i].baseObject:setActive(true)
self.rewardList[i]:refreshByConfig(reward, hasGot, hasGot)
if canGet then
self.rewardList[i]:showFrameAnimation()
self.rewardList[i]:addClickListener(function()
ModuleManager.ActSprintManager:reqStandardTask(DataManager.ActSprintSummonDataAll:getActId(), 0)
end)
else
self.rewardList[i]:hideFrameAnimation()
end
else
self.rewardList[i].baseObject:setActive(false)
end
end
rewardLayout:RefreshLayout()
end
return StandardCell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 5a3367bd1aee89d4f8df29c64f7e9685
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,77 @@
local TaskCell = class("TaskCell", BaseCell)
local REWARD_CELL_COUNT = 1
function TaskCell:refresh(actTaskId)
local uiMap = self:getUIMap()
local bg = uiMap["task_cell.bg"]
local descTx = uiMap["task_cell.bg.desc_tx"]
if not self.rewardList then
self.rewardList = {}
for i = 1, REWARD_CELL_COUNT do
table.insert(self.rewardList, CellManager:addCellComp(uiMap["task_cell.bg.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL))
end
end
if not self.slider then
self.slider = uiMap["task_cell.bg.slider_bg.slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER)
end
local sliderTx = uiMap["task_cell.bg.slider_bg.tx"]
local gotFlag = uiMap["task_cell.bg.got_flag"]
local gotTx = uiMap["task_cell.bg.got_flag.desc_tx"]
local funcBtn = uiMap["task_cell.bg.func_btn"]
local funcTx = uiMap["task_cell.bg.func_btn.desc_tx"]
local num = DataManager.ActSprintSummonDataAll:getActTaskNum(actTaskId)
local taskType = DataManager.ActSprintSummonDataAll:getActTaskType(actTaskId)
local limit = DataManager.ActSprintSummonDataAll:getActTaskNumber1(actTaskId)
local rewards = DataManager.ActSprintSummonDataAll:getActTaskReward(actTaskId)
local hasGot = DataManager.ActSprintSummonDataAll:getHasGotTaskReward(actTaskId)
-- 修订
if num > limit then
num = limit
end
descTx:setText(GFunc.getTaskDesc(taskType, limit))
self.slider.value = num / limit
sliderTx:setText(num .. "/" .. limit)
for i = 1, REWARD_CELL_COUNT do
local reward = rewards and rewards[i]
if reward then
self.rewardList[i].baseObject:setActive(true)
self.rewardList[i]:refreshByConfig(reward)
else
self.rewardList[i].baseObject:setActive(false)
end
end
if hasGot then
gotFlag:setVisible(true)
gotTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_13))
funcBtn:setActive(false)
else
gotFlag:setVisible(false)
funcBtn:setActive(true)
if num >= limit then
funcBtn:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_yellow_5")
funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CLAIM))
else
funcBtn:setSprite(GConst.ATLAS_PATH.COMMON, "common_btn_blue_1")
funcTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_14))
end
end
funcBtn:addClickListener(function()
if not hasGot then
if num >= limit then
-- 领取
local actId = DataManager.ActSprintSummonDataAll:getActTaskActivityId(actTaskId)
ModuleManager.ActSprintManager:reqTask(actId, actTaskId)
else
-- 跳转
ModuleManager.TaskManager:goToTask(taskType)
end
end
end)
end
return TaskCell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 48fc395edac664a4da2ccdaf9696b5a0
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: b984e5e58db26214e9e8c0bcfb43f0c8
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,61 @@
local GiftComp = class("GiftComp", LuaComponent)
local CELL = "app/ui/activity/act_sprint_summon_all/cell/gift_cell"
function GiftComp:init()
local uiMap = self:getUIMap()
self.banner = uiMap["gift_comp.bg.banner"]
self.txTitle = uiMap["gift_comp.top.title_tx"]
self.txTime = uiMap["gift_comp.top.time_bg.time_tx"]
self.scrollrect = uiMap["gift_comp.scrollrect"]
end
function GiftComp:refresh(actId)
self.txTitle:setText(I18N:getGlobalText(GConst.ActSprintConst.ACT_LIST_NAME[actId]))
self.banner:setTexture(GConst.ActSprintConst.ACT_MAIN_BANNER[actId])
local cfgList = DataManager.ActSprintSummonDataAll:getActGiftList(actId)
self.giftList = table.clearOrCreate(self.giftList)
for _, id in ipairs(cfgList) do
table.insert(self.giftList, id)
end
-- 排序
table.sort(self.giftList, function(a, b)
-- 免费 > 可购买 > 已售罄 > id
local isFreeA = DataManager.ActSprintSummonDataAll:getActGiftIsFree(a) or DataManager.ActSprintSummonDataAll:getActGiftIsAd(a)
local isFreeB = DataManager.ActSprintSummonDataAll:getActGiftIsFree(b) or DataManager.ActSprintSummonDataAll:getActGiftIsAd(b)
if isFreeA == isFreeB then
local canBuyA = DataManager.ActSprintSummonDataAll:getActGiftRemainCount(a) > 0
local canBuyB = DataManager.ActSprintSummonDataAll:getActGiftRemainCount(b) > 0
if canBuyA == canBuyB then
return a < b
else
return canBuyA
end
else
return isFreeA
end
end)
if self.scrollRect == nil then
self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRect:addInitCallback(function()
return CELL
end)
self.scrollRect:addRefreshCallback(function(index, cell)
cell:refresh(self.giftList[index])
end)
end
if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then
self.scrollRect:refillCells(#self.giftList)
elseif self.scrollRect:getTotalCount() ~= #self.giftList then
self.scrollRect:clearCells()
self.scrollRect:refillCells(#self.giftList)
else
self.scrollRect:updateAllCell()
end
end
function GiftComp:updateTime()
self.txTime:setText(Time:formatNumTimeStr(DataManager.ActSprintSummonDataAll:getRemainTime()))
end
return GiftComp

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 179f9ae95bad42a408979f724a68060b
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,81 @@
local SummonActLogin = class("SummonActLogin", LuaComponent)
local CELL = "app/ui/activity/act_sprint_summon_all/cell/login_cell"
function SummonActLogin:onClose()
end
function SummonActLogin:init()
local uiMap = self:getUIMap()
self.txTitle = uiMap["login_comp.top.title_tx"]
self.txTime = uiMap["login_comp.top.time_bg.time_tx"]
self.banner = uiMap["login_comp.top.banner"]
self.scrollrectPrefab = uiMap["login_comp.scrollrect"]
self.scrollrect = self.scrollrectPrefab:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.getBtn = uiMap["login_comp.get_btn"]
self.getBtn:addClickListener(function()
local actId = DataManager.ActSprintSummonDataAll:getActId()
local actType = DataManager.ActSprintSummonDataAll:getActType(actId)
local grade = DataManager.ActSprintSummonDataAll:isUnlockBountyPro() and 1 or 0
ModuleManager.ActSprintManager:reqSprintBountySign(actType, actId, grade)
end)
self.getBtnTx = uiMap["login_comp.get_btn.text"]
self.getBtnTx:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CLAIMALL))
self.payBtn = uiMap["login_comp.pay_btn"]
self.payBtn:addClickListener(function()
if DataManager.ActSprintSummonDataAll:isUnlockBountyPro() then
return
end
local giftId = DataManager.ActSprintSummonDataAll:getBountyProGiftId()
ModuleManager.ActSprintManager:onBuyBountyPro(giftId)
end)
self.payBtnTx = uiMap["login_comp.pay_btn.text"]
uiMap["login_comp.scrollrect.title.tx_scro_title_1"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_HERO_SUIT_DESC_4))
uiMap["login_comp.scrollrect.title.tx_scro_title_2"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_HERO_SUIT_DESC_5))
uiMap["login_comp.scrollrect.title.tx_scro_title_3"]:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_HERO_SUIT_DESC_6))
end
--endregion
--region基础初始化方法
function SummonActLogin:updateTime()
self.txTime:setText(Time:formatNumTimeStr(DataManager.ActSprintSummonDataAll:getRemainTime()))
end
function SummonActLogin:refresh()
local actId = DataManager.ActSprintSummonDataAll:getActId()
self.txTitle:setText(I18N:getGlobalText(GConst.ActSprintConst.ACT_LIST_NAME[actId]))
self.banner:setTexture(GConst.ActSprintConst.ACT_MAIN_BANNER[actId])
self.getBtn:setActive(DataManager.ActSprintSummonDataAll:isHaveUnclaimedBountyReward())
self.payBtn:setActive(not DataManager.ActSprintSummonDataAll:isUnlockBountyPro())
local rechargeId = DataManager.ActSprintSummonDataAll:getBountyProRechargeId()
self.payBtnTx:setText(GFunc.getFormatPrice(rechargeId))
self:refreshScrollRect()
end
function SummonActLogin:refreshScrollRect()
self.cfgList = DataManager.ActSprintSummonDataAll:getBountyCfgList()
if not self.isInitScrollrect then
self.isInitScrollrect = true
self.scrollrect:addInitCallback(function()
return CELL
end)
self.scrollrect:addRefreshCallback(function(index, cell)
cell:refresh(index, #self.cfgList, self.cfgList[index])
end)
self.scrollrect:clearCells()
self.scrollrect:refillCells(#self.cfgList)
else
if self.scrollrect:getTotalCount() == #self.cfgList then
self.scrollrect:updateAllCell()
else
self.scrollrect:refillCells(#self.cfgList)
end
end
-- local minIndex = self.dataManager:getMinUnclaimedRewardIndex()
-- self.scrollrect:moveToIndex(minIndex)
end
--endregion
return SummonActLogin

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 8c51d0d3dc469e64a9480443efbe5eb4
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,101 @@
local StandardComp = class("StandardComp", LuaComponent)
local REWARD_CELL_COUNT = 3
local CELL = "app/ui/activity/act_sprint_summon_all/cell/standard_cell"
function StandardComp:init()
local uiMap = self:getUIMap()
self.banner = uiMap["standard_comp.bg.banner"]
self.txTitle = uiMap["standard_comp.top.title_tx"]
self.txTitle2 = uiMap["standard_comp.top.title_2_tx"]
self.txDesc = uiMap["standard_comp.top.turn_bg.desc_tx"]
self.txTime = uiMap["standard_comp.top.time_bg.time_tx"]
self.goBtn = uiMap["standard_comp.top.go_bg"]
self.goTx = uiMap["standard_comp.top.go_bg.desc_tx"]
self.getBtn = uiMap["standard_comp.top.turn_reward_bg.get_btn"]
self.getTx = uiMap["standard_comp.top.turn_reward_bg.get_btn.tx"]
self.helpBtn = uiMap["standard_comp.top.title_tx.btn_help"]
if not self.rewardList then
self.rewardList = {}
for i = 1, REWARD_CELL_COUNT do
table.insert(self.rewardList, CellManager:addCellComp(uiMap["standard_comp.top.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL))
end
end
self.rewardDescTx = uiMap["standard_comp.top.turn_reward_bg.desc_tx"]
self.scrollrect = uiMap["standard_comp.scrollrect"]
end
function StandardComp:refresh(actId)
local turn = DataManager.ActSprintSummonDataAll:getStandardTurn(actId)
local maxTurn = DataManager.ActSprintSummonDataAll:getStandardMaxTurn(actId)
local canGetTurnReward = DataManager.ActSprintSummonDataAll:getCanGetTurnReward(actId)
local gotAllTurnReward = DataManager.ActSprintSummonDataAll:getGotAllTurnReward(actId)
-- 轮次奖励
local rewards = DataManager.ActSprintSummonDataAll:getStandardRewards(actId)
for i = 1, REWARD_CELL_COUNT do
local reward = rewards and rewards[i]
if reward then
self.rewardList[i].baseObject:setActive(true)
if gotAllTurnReward then
self.rewardList[i]:refreshByConfig(reward, true, true)
self.rewardList[i]:hideFrameAnimation()
else
self.rewardList[i]:refreshByConfig(reward)
if canGetTurnReward then
self.rewardList[i]:showFrameAnimation()
self.rewardList[i]:addClickListener(function()
ModuleManager.ActSprintManager:reqStandardReward(actId)
end)
else
self.rewardList[i]:hideFrameAnimation()
end
end
else
self.rewardList[i].baseObject:setActive(false)
end
end
self.rewardDescTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_12))
self.banner:setTexture(GConst.ActSprintConst.ACT_MAIN_BANNER[actId])
self.txTitle:setText(I18N:getGlobalText(GConst.ActSprintConst.ACT_LIST_NAME[actId]))
self.txTitle2:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_19))
self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_9) .. "(" .. (turn >= maxTurn and maxTurn or (turn + 1)) .. "/" .. maxTurn .. ")")
self.txTime:setText(Time:formatNumTimeStr(DataManager.ActSprintSummonDataAll:getRemainTime()))
self.goTx:setText(I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_14))
self.goBtn:addClickListener(function()
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, {page = GConst.MainCityConst.BOTTOM_PAGE.MAIN})
ModuleManager.SummonManager:showSummonMainUI()
end)
self.getBtn:setActive(false)
self.helpBtn:addClickListener(function()
local params = {}
params.desc = I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_17)
ModuleManager.TipsManager:showHelpTips(params)
end)
-- 滑动窗
self.standardList = DataManager.ActSprintSummonDataAll:getActStandardList(actId)
if self.scrollRect == nil then
self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRect:addInitCallback(function()
return CELL
end)
self.scrollRect:addRefreshCallback(function(index, cell)
cell:refresh(self.standardList[index])
end)
end
if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then
self.scrollRect:refillCells(#self.standardList)
elseif self.scrollRect:getTotalCount() ~= #self.standardList then
self.scrollRect:clearCells()
self.scrollRect:refillCells(#self.standardList)
else
self.scrollRect:updateAllCell()
end
end
function StandardComp:updateTime()
self.txTime:setText(Time:formatNumTimeStr(DataManager.ActSprintSummonDataAll:getRemainTime()))
end
return StandardComp

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: dfb4b457808240949843517d59105702
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,41 @@
local TaskComp = class("TaskComp", LuaComponent)
local CELL = "app/ui/activity/act_sprint_summon_all/cell/task_cell"
function TaskComp:init()
local uiMap = self:getUIMap()
self.banner = uiMap["task_comp.bg.banner"]
self.txTitle = uiMap["task_comp.top.title_tx"]
self.txTime = uiMap["task_comp.top.time_bg.time_tx"]
self.scrollrect = uiMap["task_comp.scrollrect"]
end
function TaskComp:refresh(actId)
self.txTitle:setText(I18N:getGlobalText(GConst.ActSprintConst.ACT_LIST_NAME[actId]))
self.banner:setTexture(GConst.ActSprintConst.ACT_MAIN_BANNER[actId])
self.taskList = DataManager.ActSprintSummonDataAll:getActTaskList(actId)
if self.scrollRect == nil then
self.scrollRect = self.scrollrect:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
self.scrollRect:addInitCallback(function()
return CELL
end)
self.scrollRect:addRefreshCallback(function(index, cell)
cell:refresh(self.taskList[index])
end)
end
if self.scrollRect:getTotalCount() == nil or self.scrollRect:getTotalCount() <= 0 then
self.scrollRect:refillCells(#self.taskList)
elseif self.scrollRect:getTotalCount() ~= #self.taskList then
self.scrollRect:clearCells()
self.scrollRect:refillCells(#self.taskList)
else
self.scrollRect:updateAllCell()
end
end
function TaskComp:updateTime(actId)
self:refresh(actId)
self.txTime:setText(Time:formatNumTimeStr(DataManager.ActSprintSummonDataAll:getRemainTime()))
end
return TaskComp

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: c132ed2b81e467745ac7ee7bd2e8b83f
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -129,7 +129,7 @@ function CommonBoxUI:onRefresh()
self:onClickReward(index)
end)
else
cell:setClickShowTips()
-- cell:setClickShowTips()
end
end)
end

View File

@ -157,7 +157,7 @@ function BountyCollectionComp:refresh()
-- self.scrollRect:moveToIndex(DataManager.BountyCollectionData:getMoveIdx())
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.BOUNTY_COLLECTION)
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.BOUNTY_COLLECTION)
end
return BountyCollectionComp

View File

@ -139,7 +139,7 @@ function FundChapterComp:refresh(isAuto)
end
self.scrollRect:moveToIndex(self.minIndex)
if self.curStage then
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.FUND_LEVEL .. self.curStage)
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.FUND_LEVEL .. self.curStage)
end
end

View File

@ -144,7 +144,7 @@ function FundLevelComp:refresh(isAuto)
self.scrollRect:moveToIndex(self.minIndex)
if self.curStage then
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.FUND_CHAPTER .. self.curStage)
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.FUND_CHAPTER .. self.curStage)
end
local count = 0
for i,id in ipairs(self.cfgList) do

View File

@ -116,7 +116,6 @@ function FundMainUI:initComps()
if GConst.ShopConst.FUND_COMP_NAME[id] then
-- 预制体挂载
local obj = uiMap[GConst.ShopConst.FUND_COMP_NAME[id]]
-- self:initGlobalHelp(obj)
obj:initPrefabHelper()
obj:genAllChildren()
local comp = obj:addLuaComponent(GConst.ShopConst.FUND_COMP[id])

View File

@ -118,7 +118,7 @@ function TowerBountyComp:refresh(isAuto)
-- self.scrollRect:moveToIndex(self.minIndex)
-- if self.curStage then
-- -- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.TOWER_BOUNTY .. self.curStage)
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.TOWER_BOUNTY .. self.curStage)
-- end
end

View File

@ -238,7 +238,7 @@ function HeroComp:refreshScrollRect()
self.heroList = DataManager.HeroData:getAllHeroesSort(self.battleType, self.elementType) -- 每次都重新算一次
local power = 0
for i = 1, 5 do
local heroId = self.curFormation[i]
local hero = DataManager.HeroData:getHeroById(heroId)
@ -259,7 +259,7 @@ function HeroComp:refreshScrollRect()
spineObject:playAnimation("idle", true)
spineObject:setLocalScale(0.7, 0.7, 0.7)
self.heroSpineList[i] = spineObject
self.heroSpineList[i]:setLocalPosition(0, -60, 0)
self.heroSpineList[i]:setLocalPosition(0, -53, 0)
end)
end
else

View File

@ -0,0 +1,53 @@
local SideBarActSprintCell = class("SideBarActSprintCell", SideBarBaseCell)
function SideBarActSprintCell:getModuleKey()
return ModuleManager.MODULE_KEY.ACTIVITY
end
function SideBarActSprintCell:getIsOpen()
return DataManager.ActSprintData:getIsOpen()
end
function SideBarActSprintCell:getHasPurchase()
return true
end
function SideBarActSprintCell:getSpineName()
return "ui_main_btn_shop"
end
function SideBarActSprintCell:onClick()
ModuleManager.ActSprintManager:showActSprintListUI()
end
function SideBarActSprintCell:getIsShowRedPoint()
return DataManager.ActSprintData:hasRedPoint()
end
function SideBarActSprintCell:getCellName()
return I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_1)
end
function SideBarActSprintCell:updateTime()
if self:getIsOpen() then
self:_refreshTime()
else
self.isInitSpine = false
self:closeBtn()
end
end
function SideBarActSprintCell:_refreshTime()
local remainTime = DataManager.ActSprintData:getRemainTime()
if remainTime then
self.timeBg:setActive(true)
self.timeBg:setAnchoredPositionY(-70)
self.txName:setAnchoredPositionY(5)
if remainTime < 0 then
remainTime = 0
end
self.txTime:setText(Time:formatNumTimeStr(remainTime))
else
self.timeBg:setActive(false)
self.txName:setAnchoredPositionY(5)
end
end
return SideBarActSprintCell

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 1bf53e190d9ab4e9d8c574e484fd3c40
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -106,9 +106,9 @@ function FirstRechargeUI:onLoadRootComplete()
end
function FirstRechargeUI:postChangePage()
-- if self.curGear then
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME["FIRST_RECHARGE_PAGE_" .. self.curGear])
-- end
if self.curGear then
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME["FIRST_RECHARGE_PAGE_" .. self.curGear])
end
end
function FirstRechargeUI:onRefresh()

View File

@ -67,7 +67,7 @@ function SignMonthComp:refresh()
self:refreshScrollRect()
self:refreshBtn()
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.SIGN_MONTH)
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.SIGN_MONTH)
end
function SignMonthComp:refreshTop()

View File

@ -38,7 +38,7 @@ function SignWeekComp:refresh()
-- 尝试请求一次未领取奖励
ModuleManager.SignManager:reqSignAutoRewardsClaimed()
-- BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.SING_WEEK)
BIReportV2:postOperation(BIReportV2.OPERATION_UI_NAME.SING_WEEK)
end
function SignWeekComp:refreshTop()

View File

@ -0,0 +1,178 @@
local ActBaseData = class("ActBaseData", BaseData)
-- 必须重写 --------------------------------------------------------------------------------------------------------------
function ActBaseData:setActivityInfo()
Logger.logFatal("不能被调用,必须重写")
end
function ActBaseData:getActNameStr()
return ""
end
-- 通用逻辑 --------------------------------------------------------------------------------------------------------------
function ActBaseData:initActInfo(data)
if self.actId ~= data.actId then
self:tryResetGift(true)
self:tryResetProBought()
self:clear()
end
self.actId = data.actId
self.startTime = data.startTime
self.endTime = data.endTime
self.extraTime = data.extraTime
end
function ActBaseData:getActId()
return self.actId
end
function ActBaseData:setActId(id)
self.actId = id
end
function ActBaseData:clearActId()
self:setActId(nil)
end
function ActBaseData:getStartTime()
return self.startTime
end
function ActBaseData:getEndTime()
return self.endTime
end
function ActBaseData:getExtraTime()
return self.extraTime
end
function ActBaseData:getRemainTime()
if not self:getStartTime() then
return 0
end
local nowTime = Time:getServerTime()
if self:getExtraTime() < nowTime then
return 0
end
return self:getExtraTime() - nowTime
end
function ActBaseData:getNormalRemainTime()
local nowTime = Time:getServerTime()
if self:getEndTime() < nowTime then
return 0
end
return self:getEndTime() - nowTime
end
function ActBaseData:getTotalRemainTime()
local remainTime = self:getNormalRemainTime()
if remainTime <= 0 then
remainTime = self:getRemainTime()
end
return remainTime
end
function ActBaseData:getIsLastDay()
if not self:getStartTime() then
return false
end
local nowTime = Time:getServerTime()
if self:getExtraTime() > nowTime and nowTime >= self:getEndTime() then
return true
end
return false
end
function ActBaseData:getActivityDay()
local time = Time:getDayBeginTimeStamp(self:getStartTime())
return (Time:getServerTime() - time) // GConst.SECONDS_PRE_DAY + 1
end
function ActBaseData:getTimeOpen()
if not self:getStartTime() then
return false
end
local nowTime = Time:getServerTime()
if self:getStartTime() <= nowTime and nowTime <= self:getExtraTime() then
return true
end
return false
end
function ActBaseData:getIsOpen()
if GFunc.isShenhe() then
return false
end
if not ModuleManager:getIsOpen(DataManager.ActivityData:getActOpenKey(), true) then
return false
end
local actId = self:getActId()
if not actId or actId <= 0 then
return false
end
return self:getTimeOpen()
end
function ActBaseData:setLoginRp()
self.loginRp = true
end
function ActBaseData:getLoginRp()
if DataManager.PaymentData:getIsSkipAd() then
return true
end
return not self.loginRp
end
-- 重置礼包购买次数
-- force true重置所有礼包 false只重置免费礼包
function ActBaseData:tryResetGift(force)
local actId = self:getActId()
if not actId or actId <= 0 then
return
end
if EDITOR_MODE then
Logger.logHighlight("重置活动礼包数据 act_id = " .. tostring(actId))
end
DataManager.ActGiftData:tryResetGift(actId, force)
end
function ActBaseData:tryResetProBought()
local actId = self:getActId()
if not actId or actId <= 0 then
return
end
if EDITOR_MODE then
Logger.logHighlight("重置活动战令数据 act_id = " .. tostring(actId))
Logger.logHighlight("重置轮次数据 act_id = " .. tostring(actId))
end
DataManager.ActBountyData:tryResetProBought(actId)
DataManager.ActRoundTaskData:tryResetProBought(actId)
end
-- 今日已买次数
function ActBaseData:getTodayExchangeCount(id)
return DataManager.ActivityData:getExchangeCount(id)
end
return ActBaseData

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 60b360bcd258f4aa3a729d34af55922f
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7aac4f4004ba94c10baab7a46d0ba28e
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,376 @@
local ActBaseData = require "app/userdata/activity/act_base_data"
local ActSprintData = class("ActSprintData", ActBaseData)
function ActSprintData:ctor()
self:clear()
end
function ActSprintData:clear()
DataManager:unregisterCrossDayFunc("ActSprintData")
ModuleManager.TaskManager:unRegisterAllModuleTask("ActSprintData")
self.isInit = false
self.exchanged = {} -- 兑换道具
end
function ActSprintData:setDirty()
self.data.isDirty = not self.data.isDirty
end
function ActSprintData:init(data)
data = data or {}
self.exchanged = data.exchanged or {}
if not self.isInit then
self.isInit = true
-- 跨天
DataManager:registerCrossDayFunc("ActSprintData", function()
local isCrossWeek = Time:getDayofWeek() == 1
-- 重置兑换
for id, _ in pairs(self.exchanged) do
if self:getExchangeRefreshType(id) == 1 then
self.exchanged[id] = 0
elseif self:getExchangeRefreshType(id) == 2 then
if isCrossWeek then
self.exchanged[id] = 0
end
end
end
self:setDirty()
end)
end
end
function ActSprintData:getSprintDetailData(actId)
if actId == GConst.ActSprintConst.ACT_ID.SUMMON_ALL then
return DataManager.ActSprintSummonDataAll
end
-- if actId == GConst.ActSprintConst.ACT_ID.SUMMON then
-- return DataManager.ActSprintSummonData
-- elseif actId == GConst.ActSprintConst.ACT_ID.CORE_SOUL_BOX then
-- return DataManager.ActSprintBoxData
-- elseif actId == GConst.ActSprintConst.ACT_ID.SUMMON_V2 then
-- return DataManager.ActSprintSummonDataV2
-- elseif actId == GConst.ActSprintConst.ACT_ID.CORE_SOUL_BOX_V2 then
-- return DataManager.ActSprintBoxDataV2
-- elseif actId == GConst.ActSprintConst.ACT_ID.SUMMON_ALL then
-- return DataManager.ActSprintSummonDataAll
-- elseif actId == GConst.ActSprintConst.ACT_ID.CORE_SOUL_BOX_ALL then
-- return DataManager.ActSprintBoxDataAll
-- elseif actId == GConst.ActSprintConst.ACT_ID.SUMMON_LOOP then
-- return DataManager.ActSprintSummonDataLoop
-- elseif actId == GConst.ActSprintConst.ACT_ID.CORE_SOUL_BOX_LOOP then
-- return DataManager.ActSprintBoxDataLoop
-- elseif actId == GConst.ActSprintConst.ACT_ID.TREE_LOOP then
-- return DataManager.ActSprintTreeDataLoop
-- end
end
function ActSprintData:getIsOpen()
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.ACTIVITY, true) then
return false
end
return self:getTimeOpen()
end
function ActSprintData:getActSprintIdList()
self.openIdList = table.clearOrCreate(self.openIdList)
for key, actId in pairs(GConst.ActSprintConst.ACT_ID) do
local data = self:getSprintDetailData(actId)
if data and data:getIsOpen() then
table.insert(self.openIdList, actId)
end
end
if EDITOR_MODE then
Logger.logHighlight("当前开启的冲刺活动:")
Logger.printTable(self.openIdList)
end
return self.openIdList
end
-- 任意活动开启均有效
function ActSprintData:getTimeOpen()
local isAnyOpen = false
for key, actId in pairs(GConst.ActSprintConst.ACT_ID) do
local data = self:getSprintDetailData(actId)
if data and data:getTimeOpen() and data:getIsShow() then
isAnyOpen = true
break
end
end
return isAnyOpen
end
function ActSprintData:getIsLastDay()
local isLastDay = false
for key, actId in pairs(GConst.ActSprintConst.ACT_ID) do
local data = self:getSprintDetailData(actId)
if data and data:getIsLastDay() then
isLastDay = true
break
end
end
return isLastDay
end
function ActSprintData:getTotalRemainTime()
local totalRemainTime
for key, actId in pairs(GConst.ActSprintConst.ACT_ID) do
local data = self:getSprintDetailData(actId)
if data and data:getTotalRemainTime() then
totalRemainTime = data:getTotalRemainTime()
break
end
end
return totalRemainTime
end
function ActSprintData:getRemainTime()
local maxRemainTime = 0
for key, actId in pairs(GConst.ActSprintConst.ACT_ID) do
local data = self:getSprintDetailData(actId)
if data and data:getRemainTime() > maxRemainTime then
maxRemainTime = data:getRemainTime()
end
end
return maxRemainTime
end
function ActSprintData:getNormalRemainTime(actId)
-- 找目前最长时间的
local maxRemainTime = 0
for key, actId in pairs(GConst.ActSprintConst.ACT_ID) do
local data = self:getSprintDetailData(actId)
if data and data:getNormalRemainTime() > maxRemainTime then
maxRemainTime = data:getNormalRemainTime()
end
end
return maxRemainTime
end
function ActSprintData:hasRedPoint(ignoreExchange)
if not self:getIsOpen() then
return false
end
-- 兑换商店
if not ignoreExchange then
if self:hasExchangeRp() then
return true
end
end
if self:hasStandardRp() then
return true
end
if self:hasGiftRp() then
return true
end
if self:hasTaskRp() then
return true
end
if self:hasBountyRp() then
return true
end
return false
end
function ActSprintData:getActNameStr()
return I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_1)
end
function ActSprintData:hasExchangeRp()
if self:isShopOpen() then
return self:getHasFreeExchangeItem()
else
return false
end
end
function ActSprintData:hasStandardRp()
for key, actId in pairs(GConst.ActSprintConst.ACT_ID) do
local data = self:getSprintDetailData(actId)
if data and data:hasStandardRp() then
return true
end
end
return false
end
function ActSprintData:hasGiftRp()
for key, actId in pairs(GConst.ActSprintConst.ACT_ID) do
local data = self:getSprintDetailData(actId)
if data and data:hasGiftRp() then
return true
end
end
return false
end
function ActSprintData:hasTaskRp()
for key, actId in pairs(GConst.ActSprintConst.ACT_ID) do
local data = self:getSprintDetailData(actId)
if data and data:hasTaskRp() then
return true
end
end
return false
end
function ActSprintData:hasBountyRp()
for key, actId in pairs(GConst.ActSprintConst.ACT_ID) do
local data = self:getSprintDetailData(actId)
if data and data:hasBountyRp() then
return true
end
end
return false
end
--@endregion
-- 活动数据相关 **********************************************************************
function ActSprintData:getActConfig(id)
if id then
return ConfigManager:getConfig("activity")[id]
else
return ConfigManager:getConfig("activity")
end
end
function ActSprintData:getActType(id)
return self:getActConfig(id).act_type
end
function ActSprintData:getActGiftList(id)
return self:getActConfig(id).act_gift
end
function ActSprintData:getActShowReward(id)
return self:getActConfig(id).show_reward
end
-- 兑换道具相关 **********************************************************************
function ActSprintData:isShopOpen()
-- 特定活动才会开放
for key, actId in pairs(GConst.ActSprintConst.ACT_ID) do
local data = self:getSprintDetailData(actId)
if data and data:getIsOpen() then
if not GConst.ActSprintConst.ACT_ID_NOT_SHOP[actId] then
return true
end
end
end
return false
end
function ActSprintData:getExchangeCount(id)
return self.exchanged[id] or 0
end
function ActSprintData:setExchangeCount(id, count)
self.exchanged[id] = count
end
function ActSprintData:onExchangeSuccess(id, count)
self.exchanged[id] = (self.exchanged[id] or 0) + count
self:setDirty()
end
function ActSprintData:getExchangeConfig(id)
if id then
return ConfigManager:getConfig("act_exchange")[id]
else
return ConfigManager:getConfig("act_exchange")
end
end
function ActSprintData:getExchangeIdList()
local cfg = self:getExchangeConfig()
self.exchangeIdList = table.clearOrCreate(self.exchangeIdList)
for id, info in pairs(cfg) do
-- 策划说不配的是兑换活动 相信策划 不会改的
if info.activity == nil and self:getExchangeShow(id) then
table.insert(self.exchangeIdList, id)
end
end
-- 排序
table.sort(self.exchangeIdList, function(a, b)
local isFreeA = self:getExchangeCost(a) == nil
local isFreeB = self:getExchangeCost(b) == nil
if isFreeA == isFreeB then
local canBuyA = DataManager.ActSprintData:getExchangeRemainCount(a) > 0
local canBuyB = DataManager.ActSprintData:getExchangeRemainCount(b) > 0
if canBuyA and canBuyB then
return a < b
elseif not canBuyA and not canBuyB then
return a < b
else
return canBuyA
end
else
return isFreeA
end
end)
return self.exchangeIdList
end
function ActSprintData:getExchangeReward(id)
return self:getExchangeConfig(id).reward
end
function ActSprintData:getExchangeCost(id)
return self:getExchangeConfig(id).cost
end
function ActSprintData:getExchangeRefreshType(id)
return self:getExchangeConfig(id).refresh_type
end
function ActSprintData:getExchangeLimit(id)
return self:getExchangeConfig(id).limit
end
function ActSprintData:getExchangeFuncOpen(id)
return self:getExchangeConfig(id).func_open
end
function ActSprintData:getExchangeForceId(id)
return self:getExchangeConfig(id).force_id
end
function ActSprintData:getExchangeShow(id)
-- local funcOpen = self:getExchangeFuncOpen(id)
-- local forceId = self:getExchangeForceId(id)
-- if funcOpen and not ModuleManager:getIsOpen(funcOpen, true) then
-- return false
-- end
-- if forceId and not DataManager.ForceData:getIsOwnForce(forceId) then
-- return false
-- end
return true
end
function ActSprintData:getExchangeRemainCount(id)
return self:getExchangeLimit(id) - self:getExchangeCount(id)
end
function ActSprintData:getHasFreeExchangeItem()
local cfgList = self:getExchangeIdList()
for _, id in ipairs(cfgList) do
if self:getExchangeCost(id) == nil and self:getExchangeRemainCount(id) > 0 then
return true
end
end
return false
end
return ActSprintData

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 2207d5305b819a94d8ebe208df6a39da
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,904 @@
local ActBaseData = require "app/userdata/activity/act_base_data"
local ActSprintSummonData = class("ActSprintSummonData", ActBaseData)
function ActSprintSummonData:ctor()
self:clear()
self.actId = 11701
self.startTime = Time:getServerTime()
self.endTime = Time:getServerTime() + 864000
self.extraTime = Time:getServerTime() + 864000
self:initBountyCfg()
end
function ActSprintSummonData:clear()
DataManager:unregisterCrossDayFunc("ActSprintSummonDataAll")
ModuleManager.TaskManager:unRegisterAllModuleTask("ActSprintSummonDataAll")
self.isInit = false
-- 达标任务数据
self.standardScore = 0
self.standardTotalScore = 0
self.standardTurn = 0
self.standardClaimed = 0
self.standardClaimedTaskMap = {}
-- 普通任务进度
self.taskProgressMap = {}
self.taskClaimedMap = {}
end
function ActSprintSummonData:setDirty()
self.data.isDirty = not self.data.isDirty
end
function ActSprintSummonData:clearActInfo(actId)
if self.actId ~= actId then
-- 重置礼包
self:tryResetGift(actId, true)
end
end
-- 初始化任务数据
function ActSprintSummonData:initTaskData(standardData, normalData)
standardData = standardData and standardData.task_data or {}
normalData = normalData and normalData.task_data or {}
if EDITOR_MODE then
Logger.logHighlight("任务模块")
Logger.printTable(standardData)
Logger.printTable(normalData)
end
-- 达标任务
for _, info in ipairs(standardData) do
if info.activity_id == self.actId then
-- 约定只有1个
local score = info.score
local totalScore = info.total_score
local round = info.round
local roundClaimed = info.round_claimed
local claimedTaskList = info.claimed
self.standardScore = score
self.standardTotalScore = totalScore
self.standardTurn = round
self.standardClaimed = roundClaimed
self.standardClaimedTaskMap = table.clearOrCreate(self.standardClaimedTaskMap)
for _, taskId in ipairs(claimedTaskList) do
self.standardClaimedTaskMap[taskId] = true
end
end
end
-- 常规任务
for _, info in ipairs(normalData) do
if info.activity_id == self.actId then
local taskId = info.data.id
local progress = info.data.progress
local stageClaimed = info.data.stage_claimed
self.taskProgressMap[taskId] = progress
self.taskClaimedMap[taskId] = stageClaimed > 0
end
end
end
function ActSprintSummonData:setActivityInfo(data, isCrossDayClientRefresh)
if self.actId ~= data.actId then
self:clear()
end
self.actId = data.actId
self.startTime = data.startTime
self.endTime = data.endTime
self.extraTime = data.extraTime
if data.data ~= GConst.EMPTY_STRING then
local info = NetManager:decodeActivityData("ActivityRushSign", data.data)
if info and not isCrossDayClientRefresh then
self:initActivityData(info)
end
end
self:initBountyCfg()
if not self.isInit then
self.isInit = true
-- 跨天
DataManager:registerCrossDayFunc("ActSprintSummonDataAll", function()
-- 当天开启 重置任务
if self:getStartTime() == Time:getBeginningOfServerToday() then
-- 达标任务数据
self.standardScore = 0
self.standardTotalScore = 0
self.standardTurn = 0
self.standardClaimed = 0
self.standardClaimedTaskMap = {}
-- 普通任务进度
self.taskProgressMap = {}
self.taskClaimedMap = {}
end
local isCrossWeek = Time:getDayofWeek() == 1
-- 重置礼包
for _, actGiftId in ipairs(self:getActGiftList(self.actId)) do
local cfgInfo = self:getActGiftConfig(actGiftId)
if cfgInfo and cfgInfo.limit_type == 1 then
DataManager.PaymentData:resetGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, actGiftId)
end
if cfgInfo and cfgInfo.limit_type == 2 and isCrossWeek then
DataManager.PaymentData:resetGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, actGiftId)
end
end
if self.bountyCurrDay then
self.bountyCurrDay = self.bountyCurrDay + 1
end
self:setDirty()
end)
-- 注册任务监听
for id, info in pairs(self:getActTaskConfig()) do
if info.activity == self.actId and info.display ~= nil then
ModuleManager.TaskManager:registerTask("ActSprintSummonDataAll", info.type, function(count)
self:addTaskProgress(info.type, count)
end)
end
end
end
end
function ActSprintSummonData:initActivityData(data)
if EDITOR_MODE then
Logger.logHighlight("初始化冲刺战令数据")
Logger.printTable(data)
end
self.bountyCurrDay = data.day
self.bountyInfo = data.sign or GConst.EMPTY_TABLE
end
function ActSprintSummonData:onBountySign(sign)
if sign then
self.bountyInfo = sign
self:setDirty()
end
end
function ActSprintSummonData:initBountyCfg()
if self.bountyCfg == nil then
self.bountyCfg = {}
for id, info in pairs(ConfigManager:getConfig("act_bounty")) do
if info.activity == self:getActId() then
info.id = id
self.bountyCfg[id] = info
end
end
end
if not self.bountyCfgList then
self.bountyCfgList = {}
for k,v in pairs(self.bountyCfg) do
table.insert(self.bountyCfgList, v)
end
table.sort(self.bountyCfgList, function(a, b) return a.id < b.id end)
end
end
function ActSprintSummonData:getBountyCfg(id)
if id then
return self.bountyCfg[id]
else
return self.bountyCfg
end
end
function ActSprintSummonData:getBountyCfgList(id)
if id then
return self.bountyCfgList[id]
else
return self.bountyCfgList
end
end
function ActSprintSummonData:getBountyCurrDay()
return self.bountyCurrDay or 0
end
function ActSprintSummonData:getHasGotBountyReward(grade, day)
if self.bountyInfo == nil then
return false
end
local claimedMap = self.bountyInfo.claimed
if claimedMap == nil then
return false
end
local bountyCfg = self.bountyCfgList[day]
if bountyCfg == nil then
return false
end
local claimed = claimedMap[bountyCfg.id]
if claimed == nil then
return false
end
local list = claimed.grade
if list == nil then
return false
end
for k, v in ipairs(list) do
if v == grade then
return true
end
end
return false
end
function ActSprintSummonData:isUnlockBountyPro()
if self.bountyCfgList == nil then
return false
end
local giftId = self.bountyCfgList[1].reward_pro_pay
if giftId == nil then
return false
end
local boughtTime = DataManager.PaymentData:getGiftBoughtTime(PayManager.PURCHARSE_TYPE.ACT_GIFT, giftId)
if self:getStartTime() <= boughtTime and boughtTime <= self:getEndTime() then
return true
end
return false
end
function ActSprintSummonData:getBountyProGiftId()
if self.bountyCfgList == nil then
return 0
end
local giftId = self.bountyCfgList[1].reward_pro_pay
return giftId
end
function ActSprintSummonData:getBountyProRechargeId()
if self.bountyCfgList == nil then
return 0
end
local giftId = self.bountyCfgList[1].reward_pro_pay
local cfg = ConfigManager:getConfig("act_gift")[giftId]
return cfg and cfg.recharge_id or 0
end
function ActSprintSummonData:isHaveUnclaimedBountyReward()
if self.bountyCfgList == nil then
return false
end
local maxDay = #self.bountyCfgList
local currDay = self:getBountyCurrDay()
if currDay > maxDay then
currDay = maxDay
end
for i = 1, currDay do
if self:canClaimBountyReward(0, i) then
return true
end
if self:canClaimBountyReward(1, i) then
return true
end
end
return false
end
function ActSprintSummonData:canClaimBountyReward(grade, day)
local currDay = self:getBountyCurrDay()
if currDay < day then -- 没到时间
return false
end
if self:getHasGotBountyReward(grade, day) then -- 已经领过了
return false
end
if grade == 0 then -- 免费
return true
else
if self:isUnlockBountyPro() then
return true
end
end
return false
end
function ActSprintSummonData:hasBountyRp()
if self:isHaveUnclaimedBountyReward() then
return true
end
return false
end
--@region 活动时间
function ActSprintSummonData:syncedData()
return self.syncData
end
function ActSprintSummonData:getIsOpen()
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.ACTIVITY, true) then
return false
end
return self:getTimeOpen()
end
function ActSprintSummonData:getIsShow()
local funcOpen = self:getActFuncOpen(self:getActId())
if funcOpen then
local isFuncOpen = ModuleManager:getIsOpen(funcOpen, true)
return isFuncOpen
end
return true
end
function ActSprintSummonData:getActId()
return self.actId
end
function ActSprintSummonData:clearActId()
self.actId = nil
end
-- 任意活动开启均有效
function ActSprintSummonData:getTimeOpen()
if not self.startTime then
return false
end
local nowTime = Time:getServerTime()
if self.startTime <= nowTime and nowTime <= self.extraTime then
return true
end
return false
end
function ActSprintSummonData:getIsLastDay()
if not self:getStartTime() then
return false
end
local nowTime = Time:getServerTime()
if self:getExtraTime() > nowTime and nowTime >= self:getEndTime() then
return true
end
end
function ActSprintSummonData:getTotalRemainTime()
local remainTime = self:getNormalRemainTime()
if remainTime <= 0 then
remainTime = self:getRemainTime()
end
return remainTime
end
-- 获取活动时间
function ActSprintSummonData:getStartTime()
return self.startTime or 0
end
function ActSprintSummonData:getEndTime()
return self.endTime or 0
end
function ActSprintSummonData:getExtraTime()
return self.extraTime or 0
end
function ActSprintSummonData:getRemainTime()
if not self.startTime then
return 0
end
local nowTime = Time:getServerTime()
if self.extraTime < nowTime then
return 0
end
return self.extraTime - nowTime
end
function ActSprintSummonData:getNormalRemainTime()
local nowTime = Time:getServerTime()
if self:getEndTime() < nowTime then
return 0
end
return self:getEndTime() - nowTime
end
function ActSprintSummonData:hasRedPoint()
if not self:syncedData() then
return false
end
if not self:getIsOpen() then
return false
end
if self:hasStandardRp() then
return true
end
if self:hasGiftRp() then
return true
end
if self:hasTaskRp() then
return true
end
if self:hasBountyRp() then
return true
end
return false
end
function ActSprintSummonData:getActNameStr()
return I18N:getGlobalText(I18N.GlobalConst.ACT_GOGOGO_DESC_1)
end
function ActSprintSummonData:hasStandardRp(actId)
actId = actId or self:getActId()
return self:getCanGetTurnReward(actId) or self:getCanAnyStandardTaskCanGetReward(actId)
end
function ActSprintSummonData:hasGiftRp(actId)
actId = actId or self:getActId()
return self:getHasFreeGiftCanBuy(actId)
end
function ActSprintSummonData:hasTaskRp(actId)
actId = actId or self:getActId()
return self:getCanAnyNormalTaskCanGetReward(actId)
end
--@endregion
-- 活动数据相关 **********************************************************************
function ActSprintSummonData:getActConfig(id)
if id then
return ConfigManager:getConfig("activity")[id]
else
return ConfigManager:getConfig("activity")
end
end
function ActSprintSummonData:getActType(id)
return self:getActConfig(id).act_type
end
function ActSprintSummonData:getActGiftList(id)
return self:getActConfig(id).act_gift
end
function ActSprintSummonData:getActShowReward(id)
return self:getActConfig(id).show_reward
end
function ActSprintSummonData:getActFuncOpen(id)
return self:getActConfig(id).func_open
end
-- 活动任务相关 **********************************************************************
function ActSprintSummonData:addTaskProgress(taskType, progress)
local standardList = self:getActStandardTaskIdList(self.actId)
local normalList = self:getActNormalTaskIdList(self.actId)
-- 约定只有1个类型
if standardList and standardList[1] then
if self:getActTaskType(standardList[1]) == taskType then
self.standardScore = (self.standardScore or 0) + progress
end
end
for _, taskId in ipairs(normalList) do
if self:getActTaskType(taskId) == taskType then
if table.containValue(GConst.TaskConst.TASK_TARGRT_TYPE, taskType) then
-- 特别处理升星
if taskType == GConst.TaskConst.TASK_TYPE.HERO_LEGEND_STAR_UP_TO then
if self:getActTaskNum(taskId) < progress and progress <= self:getActTaskNumber1(taskId) then
self:setActTaskNum(taskId, progress)
end
else
if self:getActTaskNum(taskId) < progress then
self:setActTaskNum(taskId, progress)
end
end
else
self:addActTaskNum(taskId, progress)
end
end
end
end
function ActSprintSummonData:getActTaskConfig(id)
if id then
return ConfigManager:getConfig("act_task")[id]
else
return ConfigManager:getConfig("act_task")
end
end
-- 达标任务
function ActSprintSummonData:getActStandardTaskIdList(actId)
actId = actId or self.actId
local cfg = self:getActTaskConfig()
local actTaskList = {}
for taskId, info in pairs(cfg) do
if info.activity == actId and info.display == 1 then
table.insert(actTaskList, taskId)
end
end
return actTaskList
end
-- 普通任务
function ActSprintSummonData:getActNormalTaskIdList(actId)
actId = actId or self.actId
local cfg = self:getActTaskConfig()
local actTaskList = {}
for taskId, info in pairs(cfg) do
if info.activity == actId and info.display == 2 then
table.insert(actTaskList, taskId)
end
end
return actTaskList
end
function ActSprintSummonData:getActTaskActivityId(actTaskId)
return self:getActTaskConfig(actTaskId).activity
end
function ActSprintSummonData:getActTaskDisplay(actTaskId)
return self:getActTaskConfig(actTaskId).display
end
function ActSprintSummonData:getActTaskType(actTaskId)
return self:getActTaskConfig(actTaskId).type
end
function ActSprintSummonData:getActTaskNumber1(actTaskId)
return self:getActTaskConfig(actTaskId).number_1
end
function ActSprintSummonData:getActTaskReward(actTaskId)
return self:getActTaskConfig(actTaskId).reward
end
function ActSprintSummonData:getActTaskI18NName(actTaskId)
return ConfigManager:getConfig("act_task")[actTaskId].desc
end
-- 达标任务列表
function ActSprintSummonData:getActStandardList(id)
id = id or self.actId
local list = {}
local cfg = self:getActTaskConfig()
for taskId, info in pairs(cfg) do
if info.activity == id and info.display == 1 then
table.insert(list, taskId)
end
end
table.sort(list, function(a, b)
-- 已完成(可领奖) > 进行中 > 已完成(已领奖) > id
local canGetA = self:getCanGetTaskReward(a)
local canGetB = self:getCanGetTaskReward(b)
if canGetA == canGetB then
local gotA = self:getHasGotTaskReward(a)
local gotB = self:getHasGotTaskReward(b)
if gotA == gotB then
return a < b
else
return gotB
end
else
return canGetA
end
end)
return list
end
-- 普通任务列表
function ActSprintSummonData:getActTaskList(id)
id = id or self.actId
local list = {}
local cfg = self:getActTaskConfig()
for taskId, info in pairs(cfg) do
if info.activity == id and info.display == 2 then
table.insert(list, taskId)
end
end
table.sort(list, function(a, b)
-- 已完成(可领奖) > 进行中 > 已完成(已领奖) > id
local canGetA = self:getCanGetTaskReward(a)
local canGetB = self:getCanGetTaskReward(b)
if canGetA == canGetB then
local gotA = self:getHasGotTaskReward(a)
local gotB = self:getHasGotTaskReward(b)
if gotA == gotB then
return a < b
else
return gotB
end
else
return canGetA
end
end)
return list
end
function ActSprintSummonData:getStandardTurn()
return self.standardTurn or 0
end
function ActSprintSummonData:getStandardClaimedTurn()
return self.standardClaimed or 0
end
function ActSprintSummonData:getStandardMaxTurn(actId)
actId = actId or self.actId
return GConst.ActSprintConst.ACT_ROUND_LIMIT[actId]
end
function ActSprintSummonData:getStandardRewards(actId)
actId = actId or self.actId
return GConst.ActSprintConst.ACT_ROUND_REWARD[actId]
end
function ActSprintSummonData:getCanGetTurnReward(actId)
actId = actId or self.actId
-- 当前任务全部领取 未领取当前波次奖励
if (self.standardClaimed < self:getStandardTurn(actId)) then
return true
else
return false
end
end
function ActSprintSummonData:getCanAnyStandardTaskCanGetReward(actId)
actId = actId or self.actId
local taskList = self:getActStandardList(actId)
for _, actTaskId in ipairs(taskList) do
if self:getCanGetTaskReward(actTaskId) then
return true
end
end
return false
end
function ActSprintSummonData:getAllStandardTaskGotReward(actId)
actId = actId or self.actId
local taskList = self:getActStandardList(actId)
for _, actTaskId in ipairs(taskList) do
if not self:getHasGotTaskReward(actTaskId) then
return false
end
end
return true
end
-- 成功领取轮次奖励
function ActSprintSummonData:onGetStandardTurnReward(actId)
self.standardClaimed = (self.standardClaimed or 0) + 1
self:setDirty()
end
-- 是否已经领完了全部的轮次奖励
function ActSprintSummonData:getGotAllTurnReward(actId)
local claimed = self.standardClaimed or 0
local maxTurn = self:getStandardMaxTurn(actId)
return claimed >= maxTurn
end
function ActSprintSummonData:getActTaskNum(actTaskId)
if self:getActTaskDisplay(actTaskId) == 1 then
return self.standardScore or 0
else
return self.taskProgressMap[actTaskId] or 0
end
end
function ActSprintSummonData:addActTaskNum(actTaskId, progress)
self.taskProgressMap[actTaskId] = (self.taskProgressMap[actTaskId] or 0) + progress
end
function ActSprintSummonData:setActTaskNum(actTaskId, progress)
self.taskProgressMap[actTaskId] = progress
end
function ActSprintSummonData:getHasGotTaskReward(actTaskId)
if self:getActTaskDisplay(actTaskId) == 1 then
return self.standardTurn >= self:getStandardMaxTurn(self:getActId()) or self.standardClaimedTaskMap[actTaskId]
else
return self.taskClaimedMap[actTaskId]
end
end
-- 特定任务是否可领奖
function ActSprintSummonData:getCanGetTaskReward(actTaskId)
if not self:getHasGotTaskReward(actTaskId) and self:getActTaskNum(actTaskId) >= self:getActTaskNumber1(actTaskId) then
return true
else
return false
end
end
function ActSprintSummonData:getCanAnyNormalTaskCanGetReward(actId)
local taskList = self:getActNormalTaskIdList(actId)
for _, actTaskId in ipairs(taskList) do
if self:getCanGetTaskReward(actTaskId) then
return true
end
end
return false
end
-- 领取任务成功
function ActSprintSummonData:onStandardTaskSuccess(actTaskId)
if actTaskId and actTaskId > 0 then
self.standardClaimedTaskMap[actTaskId] = true
else
local list = self:getActStandardTaskIdList(self:getActId())
for _, id in ipairs(list) do
if self:getCanGetTaskReward(id) then
self.standardClaimedTaskMap[id] = true
end
end
end
-- 如果所有任务都领取了 增加轮次
local list = self:getActStandardTaskIdList(self:getActId())
local isAllGot = true
for _, id in ipairs(list) do
if not self:getHasGotTaskReward(id) then
isAllGot = false
break
end
end
if isAllGot then
self.standardTurn = (self.standardTurn or 0) + 1
self.standardClaimedTaskMap = {}
self.standardScore = self.standardScore - self:getStandardTurnScoreLimit()
end
self:setDirty()
end
function ActSprintSummonData:onNormalTaskSuccess(actTaskId)
self.taskClaimedMap[actTaskId] = true
self:setDirty()
end
function ActSprintSummonData:getStandardTurnScoreLimit()
local scoreLimit = 0
local list = self:getActStandardTaskIdList(self:getActId())
for _, id in ipairs(list) do
local cfg = self:getActTaskConfig(id)
if cfg then
if self:getActTaskNumber1(id) > scoreLimit then
scoreLimit = self:getActTaskNumber1(id)
end
end
end
return scoreLimit
end
-- 活动礼包相关 **********************************************************************
function ActSprintSummonData:getActGiftBuyCount(actGiftId)
return DataManager.PaymentData:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, actGiftId)
end
function ActSprintSummonData:getActGiftIsFree(actGiftId)
local rechargeId = self:getActGiftRechargeId(actGiftId)
local value = self:getActGiftParameterPro(actGiftId)
local cost = self:getActGiftCostItem(actGiftId)
return not rechargeId and (value and value[1] == 1) and not cost
end
function ActSprintSummonData:getActGiftIsAd(actGiftId)
local rechargeId = self:getActGiftRechargeId(actGiftId)
local value = self:getActGiftParameterPro(actGiftId)
local cost = self:getActGiftCostItem(actGiftId)
return not rechargeId and not value and not cost
end
function ActSprintSummonData:onGiftBuySuccess(actGiftId)
self:setDirty()
end
function ActSprintSummonData:getActGiftConfig(id)
if id then
return ConfigManager:getConfig("act_gift")[id]
else
return ConfigManager:getConfig("act_gift")
end
end
function ActSprintSummonData:getActGiftRechargeId(actGiftId)
return self:getActGiftConfig(actGiftId).recharge_id
end
function ActSprintSummonData:getActGiftParameterPro(actGiftId)
return self:getActGiftConfig(actGiftId).parameter_pro
end
function ActSprintSummonData:getActGiftCostItem(actGiftId)
return self:getActGiftConfig(actGiftId).item_cost and self:getActGiftConfig(actGiftId).item_cost[1]
end
function ActSprintSummonData:getActGiftReward(actGiftId)
return self:getActGiftConfig(actGiftId).reward
end
function ActSprintSummonData:getActGiftLimitType(actGiftId)
return self:getActGiftConfig(actGiftId).limit_type
end
function ActSprintSummonData:getActGiftLimit(actGiftId)
return self:getActGiftConfig(actGiftId).limit
end
-- 超值标识
function ActSprintSummonData:getActGiftValue(actGiftId)
return self:getActGiftConfig(actGiftId).value
end
-- 礼包名
function ActSprintSummonData:getActGiftI18NName(actGiftId)
return I18N:getConfig("act_gift")[actGiftId] and I18N:getConfig("act_gift")[actGiftId].value
end
function ActSprintSummonData:getActGiftRemainCount(actGiftId)
return self:getActGiftLimit(actGiftId) - self:getActGiftBuyCount(actGiftId)
end
function ActSprintSummonData:getHasFreeGiftCanBuy()
local cfgList = self:getActGiftList(self:getActId())
if cfgList then
for _, giftId in ipairs(cfgList) do
if self:getActGiftIsFree(giftId) and self:getActGiftRemainCount(giftId) > 0 then
return true
end
end
end
end
function ActSprintSummonData:getBIType()
return BIReport.ACT_SPRINT_TYPE.SUMMON
end
function ActSprintSummonData:getBISprintTaskNumInfo()
local num, totalNum = 0, 0
local taskList = self:getActStandardTaskIdList()
for _, taskId in ipairs(taskList) do
if self:getHasGotTaskReward(taskId) then
num = num + 1
end
totalNum = totalNum + 1
end
return num, totalNum
end
function ActSprintSummonData:getBINormalTaskNumInfo()
local num, totalNum = 0, 0
local taskList = self:getActNormalTaskIdList()
for _, taskId in ipairs(taskList) do
if self:getHasGotTaskReward(taskId) then
num = num + 1
end
totalNum = totalNum + 1
end
return num, totalNum
end
function ActSprintSummonData:getCanGetRewardStandardTaskList()
local taskIdList = {}
local taskList = self:getActStandardTaskIdList()
for _, taskId in ipairs(taskList) do
if self:getCanGetTaskReward(taskId) then
table.insert(taskIdList, taskId)
end
end
return taskIdList
end
return ActSprintSummonData

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 380a5680b7fa1ad4ca9f27b2b89572bd
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

View File

@ -0,0 +1,180 @@
local ActTimeData = class("ActTimeData", BaseData)
function ActTimeData:ctor()
self.isInited = false
self.actTimeList = {}
end
function ActTimeData:setDirty()
self.data.isDirty = not self.data.isDirty
end
function ActTimeData:clear()
end
---- 活动改版后服务器只会发一个活动类型的当前或下一次的数据不是想之前一样无脑把activity表转过来
function ActTimeData:init(data)
if EDITOR_MODE then
Logger.logHighlight("活动时间初始化-------------------------------------------------------------")
for index, info in ipairs(data) do
Logger.logHighlight("活动时间初始化:%s id:%s type:%s time:%s %s %s cur:%s", index, info.id, info.type, info.start_at, info.end_at, info.extra_at, Time:getServerTime())
end
end
data = data or {}
self.actTimeList = data
self:refreshActTime()
self.isInited = true
end
function ActTimeData:refreshActTime(isCrossDayClientRefresh)
local curTime = Time:getServerTime()
self.actTypeTimeList = {}
for _, info in ipairs(self.actTimeList) do
local actId = info.id
if ModuleManager.ActivityManager:getActivityInCfg(actId) then
local actType = info.type
local startTime = info.start_at or 0
if startTime < 0 then
startTime = 0
end
local endTime = info.end_at
if endTime < 0 then
endTime = 0
end
local extraTime = info.extra_at
if extraTime < endTime then
extraTime = endTime
end
local version = info.version or 0
local actGifts = info.gifts or {}
local data = info.data
Logger.logHighlight("活动暂未开启:" .. (curTime - extraTime))
if startTime <= curTime and curTime < extraTime then -- 在有效期内
if self.actTypeTimeList[actType] == nil or self.actTypeTimeList[actType].endTime > endTime then
self.actTypeTimeList[actType] = {actId = actId, actType = actType, startTime = startTime, endTime = endTime, extraTime = extraTime, actGifts = actGifts, data = data, version = version}
self:initActivityData(actType, self.actTypeTimeList[actType], isCrossDayClientRefresh)
else
-- 如果start_time更小 替换
if self.actTypeTimeList[actType].startTime > startTime then
self.actTypeTimeList[actType] = {actId = actId, actType = actType, startTime = startTime, endTime = endTime, extraTime = extraTime, actGifts = actGifts, data = data, version = version}
self:initActivityData(actType, self.actTypeTimeList[actType], isCrossDayClientRefresh)
-- 如果version更小 替换
elseif self.actTypeTimeList[actType].version > version then
self.actTypeTimeList[actType] = {actId = actId, actType = actType, startTime = startTime, endTime = endTime, extraTime = extraTime, actGifts = actGifts, data = data, version = version}
self:initActivityData(actType, self.actTypeTimeList[actType], isCrossDayClientRefresh)
end
end
else
if EDITOR_MODE then
Logger.logHighlight("活动暂未开启:" .. info.id)
end
end
end
end
self:setDirty()
end
function ActTimeData:getActTimeList()
return self.actTimeList
end
function ActTimeData:getActTimeInfoByActId(id)
for _, info in ipairs(self.actTimeList) do
if info.id == id then
return info
end
end
end
function ActTimeData:getActStartTime(actId)
for _, info in ipairs(self.actTimeList) do
if info.id == actId then
return info.start_at
end
end
end
function ActTimeData:getActEndTime(actId)
for _, info in ipairs(self.actTimeList) do
if info.id == actId then
local extraTime = info.extra_at
if extraTime < info.end_at then
extraTime = info.end_at
end
return extraTime
end
end
end
function ActTimeData:getActExtraTime(actId)
for _, info in ipairs(self.actTimeList) do
if info.id == actId then
local extraTime = info.extra_at
if extraTime < info.end_at then
extraTime = info.end_at
end
return extraTime
end
end
end
function ActTimeData:getActIsOpen(actId)
local curTime = Time:getServerTime()
local actStartTime = self:getActStartTime(actId) or 0
local actEndTime = self:getActEndTime(actId) or 0
if actStartTime <= curTime and curTime < actEndTime then
return true
end
return false
end
function ActTimeData:getActTypeTimeList()
return self.actTypeTimeList or {}
end
function ActTimeData:initActivityData(actType, info, isCrossDayClientRefresh)
if isCrossDayClientRefresh and GConst.ActivityConst.DISABLE_CLIENT_CROSS_DAY_REFRESH[actType] then
return
end
local data = DataManager[GConst.ActivityConst.ACTIVITY_TYPE_DATA[actType]]
if data then
if self.isInited and not data:getIsOpen() then
-- 跨天开启的新活动,提前清理礼包数据
if EDITOR_MODE then
Logger.logHighlight("开启活动 act_id = " .. tostring(info.actId))
end
if data.clearActInfo then
data:clearActInfo(info.actId)
end
end
if data.initActInfo then
data:initActInfo(info)-- 初始化基类方法
end
data:setActivityInfo(info)-- 初始化子类方法
else
-- 冲刺活动 无法用type区分 用id区分
local data = DataManager.ActSprintData:getSprintDetailData(info.actId)
if data then
if self.isInited and not data:getIsOpen() then
-- 跨天开启的新活动,提前清理礼包数据
if EDITOR_MODE then
Logger.logHighlight("开启活动 act_id = " .. tostring(info.actId))
end
if data.clearActInfo then
data:clearActInfo(info.actId)
end
end
if data.initActInfo then
data:initActInfo(info)-- 初始化基类方法
end
data:setActivityInfo(info, isCrossDayClientRefresh)-- 初始化子类方法
end
end
end
return ActTimeData

View File

@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: fb52ab52086c2440d851d07ced5bf5b1
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}

File diff suppressed because it is too large Load Diff