diff --git a/lua/app/common/bi_report.lua b/lua/app/common/bi_report.lua
index 714662f6..fa265224 100644
--- a/lua/app/common/bi_report.lua
+++ b/lua/app/common/bi_report.lua
@@ -68,6 +68,8 @@ BIReport.ITEM_GET_TYPE = {
RECOVERY_TIME = "RecoveryTime",
ADS_BUY_VIT = "AdsBuyVit",
GEM_BUY_VIT = "GemBuyVit",
+ ADS_BUY_ARENA_TICKET = "AdsBuyArenaTicket",
+ GEM_BUY_ARENA_TICKET = "GemBuyArenaTicket",
TASK_DAILY_REFRESH = "TaskDailyRefresh",
TASK_DAILY_REWARD = "TaskDailyReward",
BOUNTY_UNLOCK_LEVEL = "BountyUnlockLevel",
@@ -111,6 +113,7 @@ BIReport.ITEM_GET_TYPE = {
CHANGE_NAME = "ChangeName", -- 重命名
CHANGE_AVATAR = "ChangeAvatar", -- 修改头像
CHANGE_FRAME = "ChangeFrame", -- 修改头像框
+ INTRODUCTORY_GIFT = "IntroductoryGift", -- 入门礼包
}
BIReport.ADS_CLICK_TYPE = {
@@ -119,6 +122,8 @@ BIReport.ADS_CLICK_TYPE = {
TASK_DAILY_REFRESH = "TaskDailyRefresh",
TASK_DAILY_TASK = "TaskDailyTask",
IDLE_QUICK_DROP = "IdleQuickDrop",
+ ARENA_TICKET = "ArenaTicket",
+ ARENA_REMATCH = "ArenaRematch",
MALL_DAILY = "MallDaily",
MALL_DAILY_RESET = "MallDailyReset",
@@ -164,6 +169,7 @@ BIReport.GIFT_TYPE = {
GROWTH_FUND = "GrowthFund",
GROW_UP_GIFT = "GrowUpGift",
ARENA_BOUNTY = "ArenaBounty",
+ INTRODUCTORY_GIFT = "IntroductoryGift",
}
BIReport.COIN_TYPE = {
diff --git a/lua/app/common/data_manager.lua b/lua/app/common/data_manager.lua
index e6091ab2..bec2a288 100644
--- a/lua/app/common/data_manager.lua
+++ b/lua/app/common/data_manager.lua
@@ -10,6 +10,7 @@ function DataManager:init()
self:initManager("ChapterData", "app/userdata/chapter/chapter_data")
self:initManager("DailyChallengeData", "app/userdata/daily_challenge/daily_challenge_data")
self:initManager("DungeonData", "app/userdata/dungeon/dungeon_data")
+ self:initManager("ArenaData", "app/userdata/arena/arena_data")
self:initManager("HeroData", "app/userdata/hero/hero_data")
self:initManager("BagData", "app/userdata/bag/bag_data")
self:initManager("BattleData", "app/userdata/battle/battle_data")
@@ -89,6 +90,7 @@ function DataManager:clear()
self.ChapterData:clear()
self.DailyChallengeData:clear()
self.DungeonData:clear()
+ self.ArenaData:clear()
self.HeroData:clear()
self.BagData:clear()
self.FormationData:clear()
@@ -144,6 +146,7 @@ function DataManager:initWithServerData(data)
self.ShopData:initCommonDailyGoldGift(data.mall_idle and data.mall_idle.ad_count) -- 常驻金币礼包
self.ShopData:initGrowUpGift(data.act_grow_up_gift, data.now_ts) -- 成长礼包
self.ShopData:initLevelUpGift(data.act_level_up_gift) -- 助力/金币礼包
+ self.ShopData:initIntroductGift(data.act_introductory_gift) -- 入门礼包
-- 商店礼包都初始化完了后检查一下每日红点
self.ShopData:checkShopDiscountRedPoint()
self.SummonData:init(data.summon, true)
@@ -156,6 +159,7 @@ function DataManager:initWithServerData(data)
self.TaskData:init()
self:scheduleGlobal()
self:checkDataBind()
+ ModuleManager.ArenaManager:reqArenaInfo()
-- 写在最后,防止某些数据还未初始化,就被bi访问报错
self.initWithServer = true
diff --git a/lua/app/common/module_manager.lua b/lua/app/common/module_manager.lua
index f91b8c3c..69dec9d7 100644
--- a/lua/app/common/module_manager.lua
+++ b/lua/app/common/module_manager.lua
@@ -55,6 +55,8 @@ local MODULE_PATHS = {
AccountManager= "app/module/account/account_manager",
-- 活动副本
DungeonManager = "app/module/dungeon/dungeon_manager",
+ -- 竞技场
+ ArenaManager = "app/module/arena/arena_manager",
}
-- 这里的key对应func_open里的id
@@ -76,6 +78,8 @@ ModuleManager.MODULE_KEY = {
MAIL = "mail_open", -- 邮件
DUNGEON_SHARDS = "dungeon_shards_open", -- 碎片副本
DUNGEON_GOLD = "dungeon_gold_open", -- 金币副本
+ INTRODUCT_GIFT = "introduct_gift", -- 入门礼包
+ ARENA = "arena", -- 竞技场
}
local _moduleMgrs = {}
diff --git a/lua/app/common/pay_manager.lua b/lua/app/common/pay_manager.lua
index 22264140..45636927 100644
--- a/lua/app/common/pay_manager.lua
+++ b/lua/app/common/pay_manager.lua
@@ -11,6 +11,7 @@ PayManager.PURCHARSE_TYPE = {
PayManager.PURCHARSE_ACT_TYPE = {
FIRST_RECHARGE = 1,
COIN_GIFT = 2,
+ INTRODUCTORY_GIFT = 3,
BEGINNER_GIFT = 4,
LEVEL_UP_GIFT = 5,
GROWTH_FUND = 6,
@@ -30,6 +31,7 @@ PayManager.BI_ITEM_GET_TYPE = {
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
[PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = BIReport.ITEM_GET_TYPE.FIRST_RECHARGE,
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.ITEM_GET_TYPE.COIN_GIFT,
+ [PayManager.PURCHARSE_ACT_TYPE.INTRODUCTORY_GIFT] = BIReport.ITEM_GET_TYPE.INTRODUCTORY_GIFT,
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.ITEM_GET_TYPE.BEGINNER_GIFT,
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.ITEM_GET_TYPE.LEVEL_UP_GIFT,
[PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND] = BIReport.ITEM_GET_TYPE.GROWTH_FUND,
@@ -46,6 +48,7 @@ PayManager.BI_GIFT_TYPE = {
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
[PayManager.PURCHARSE_ACT_TYPE.FIRST_RECHARGE] = BIReport.GIFT_TYPE.FIRST_RECHARGE,
[PayManager.PURCHARSE_ACT_TYPE.COIN_GIFT] = BIReport.GIFT_TYPE.COIN_GIFT,
+ [PayManager.PURCHARSE_ACT_TYPE.INTRODUCTORY_GIFT] = BIReport.GIFT_TYPE.INTRODUCTORY_GIFT,
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = BIReport.GIFT_TYPE.BEGINNER_GIFT,
[PayManager.PURCHARSE_ACT_TYPE.LEVEL_UP_GIFT] = BIReport.GIFT_TYPE.LEVEL_UP_GIFT,
[PayManager.PURCHARSE_ACT_TYPE.GROWTH_FUND] = BIReport.GIFT_TYPE.GROWTH_FUND,
diff --git a/lua/app/global/global_const.lua b/lua/app/global/global_const.lua
index b63ca318..0f5d6e69 100644
--- a/lua/app/global/global_const.lua
+++ b/lua/app/global/global_const.lua
@@ -177,6 +177,7 @@ GConst.TYPEOF_LUA_CLASS = {
POP_HERO_CELL = "app/ui/shop/cell/pop_hero_cell",
POP_REWARD_CELL = "app/ui/shop/cell/pop_reward_cell",
GIFT_REWARD_CELL = "app/ui/shop/cell/gift_reward_cell",
+ ARENA_GRADING_CELL = "app/ui/arena/cell/arena_grading_cell",
-- comp
HERO_FORMATION_COMP = "app/ui/common/component/hero_formation_comp",
@@ -188,6 +189,7 @@ GConst.ATLAS_PATH = {
BATTLE = "assets/arts/atlas/ui/battle.asset",
DAILY_CHALLENGE = "assets/arts/atlas/ui/daily_challenge.asset",
DUNGEON = "assets/arts/atlas/ui/dungeon.asset",
+ ARENA = "assets/arts/atlas/ui/arena.asset",
ICON_ITEM = "assets/arts/atlas/icon/item.asset",
UI_LOGIN = "assets/arts/atlas/ui/login.asset",
ICON_SKILL = "assets/arts/atlas/icon/skill.asset",
diff --git a/lua/app/module/arena/arena_manager.lua b/lua/app/module/arena/arena_manager.lua
new file mode 100644
index 00000000..ff15208d
--- /dev/null
+++ b/lua/app/module/arena/arena_manager.lua
@@ -0,0 +1,123 @@
+local ArenaManager = class("ArenaManager", BaseModule)
+
+-- 赛季改变
+function ArenaManager:onSeasonChanged()
+ if not self.isResetting then
+ return
+ end
+
+ DataManager.ArenaData:onSeasonChanged()
+ self:reqArenaInfo()
+end
+
+-- 匹配
+function ArenaManager:reqMatch()
+ self:sendMessage(ProtoMsgType.FromMsgEnum.MatchReq, {}, {}, self.rspMatch, nil)
+end
+
+function ArenaManager:rspMatch(result)
+ if result.err_code == GConst.ERROR_STR.SUCCESS then
+ DataManager.ArenaData:onMatchInfoReceived(result.match_info)
+ end
+end
+
+-- 挑战
+function ArenaManager:reqChallenge()
+ self:sendMessage(ProtoMsgType.FromMsgEnum.PVPChallengeStartReq, {}, {}, self.rspChallenge, nil)
+end
+
+function ArenaManager:rspChallenge(result)
+ if result.err_code == GConst.ERROR_STR.SUCCESS then
+ end
+end
+
+-- 结算
+function ArenaManager:reqSettlement()
+ local parmas = {
+ win = nil,
+ heroes = nil,
+ }
+ self:sendMessage(ProtoMsgType.FromMsgEnum.PVPChallengeSettlementReq, parmas, {}, self.rspSettlement, nil)
+end
+
+function ArenaManager:rspSettlement(result)
+ if result.err_code == GConst.ERROR_STR.SUCCESS then
+ DataManager.ArenaData:onBattleResultReceived(result.settlement)
+
+ -- 总共赢的次数result.total_win_count
+ -- 总共输的次数result.total_lose_count
+
+ -- 展示结算界面
+ end
+end
+
+-- 战报
+function ArenaManager:reqRecord()
+ self:sendMessage(ProtoMsgType.FromMsgEnum.PVPRecordHistoryReq, {}, {}, self.rspRecord, nil)
+end
+
+function ArenaManager:rspRecord(result)
+ if result.err_code == GConst.ERROR_STR.SUCCESS then
+ DataManager.ArenaData:onRecentBattleReceived(result.history)
+ end
+end
+
+-- 排行榜
+function ArenaManager:reqRank()
+ self:sendMessage(ProtoMsgType.FromMsgEnum.PVPRankReq, {}, {}, self.rspRank, nil)
+end
+
+function ArenaManager:rspRank(result)
+ if result.err_code == GConst.ERROR_STR.SUCCESS then
+ DataManager.ArenaData:onRankDataReceived(result.rank, result.top100.info)
+ end
+end
+
+-- 排行榜玩家编队信息
+function ArenaManager:reqRankHeroes(id)
+ self:sendMessage(ProtoMsgType.FromMsgEnum.PVPRankHeroesReq, {rid = id}, {}, self.rspRankHeroes, nil)
+end
+
+function ArenaManager:rspRankHeroes(result)
+ if result.err_code == GConst.ERROR_STR.SUCCESS then
+ DataManager.ArenaData:onRankFormationReceived(result.reqData.rid, result.array_heroes)
+ end
+end
+
+-- 领取上赛季奖励
+function ArenaManager:reqLastSeasonReward()
+ self:sendMessage(ProtoMsgType.FromMsgEnum.PVPSeasonRewardReq, {}, {}, self.rspLastSeasonReward, nil)
+end
+
+function ArenaManager:rspLastSeasonReward(result)
+ if result.err_code == GConst.ERROR_STR.SUCCESS then
+ DataManager.ArenaData:onLastSeasonRewardReceived()
+ GFunc.showRewardBox(result.rewards)
+ end
+end
+
+-- 更新赛季信息
+function ArenaManager:reqArenaInfo()
+ self.isResetting = true
+ self:sendMessage(ProtoMsgType.FromMsgEnum.PVPInfoReq, {}, {}, self.rspArenaInfo, nil)
+end
+
+function ArenaManager:rspArenaInfo(result)
+ if result.err_code == GConst.ERROR_STR.SUCCESS then
+ self.isResetting = false
+ DataManager.ArenaData:init(result.arena_info)
+ end
+end
+
+-- 结束匹配cd
+function ArenaManager:reqOverCD(isAd)
+ self:sendMessage(ProtoMsgType.FromMsgEnum.PVPOverCDReq, {ad = isAd}, {}, self.rspOverCD, nil)
+end
+
+function ArenaManager:rspOverCD(result)
+ if result.err_code == GConst.ERROR_STR.SUCCESS then
+ DataManager.ArenaData:onOverFreeRematchCD(result.reqData.ad)
+ end
+end
+
+return ArenaManager
\ No newline at end of file
diff --git a/lua/app/module/arena/arena_manager.lua.meta b/lua/app/module/arena/arena_manager.lua.meta
new file mode 100644
index 00000000..6e50a15a
--- /dev/null
+++ b/lua/app/module/arena/arena_manager.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: a11e7fd70ab0c9a45a852859ee03bb02
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/module/battle/battle_const.lua b/lua/app/module/battle/battle_const.lua
index 13e7b1c0..223c0ef6 100644
--- a/lua/app/module/battle/battle_const.lua
+++ b/lua/app/module/battle/battle_const.lua
@@ -89,6 +89,13 @@ BattleConst.IS_PVP_BATTLE = {
[BattleConst.BATTLE_TYPE.ARENA] = true,
}
+-- 编队
+BattleConst.FORMATION_TYPE = {
+ STAGE = "1",-- 主线章节
+ ARENA_ATTACK = "2",-- 竞技场进攻
+ ARENA_DEFEND = "3",-- 竞技场防守
+}
+
BattleConst.TYPEOF_LUA_COMP = {
BATTLE_HERO_COMPONENT = "app/module/battle/component/battle_hero_comp",
BATTLE_MONSTER_COMPONENT = "app/module/battle/component/battle_monster_comp",
diff --git a/lua/app/module/chapter/chapter_manager.lua b/lua/app/module/chapter/chapter_manager.lua
index 0010b04d..c8926c96 100644
--- a/lua/app/module/chapter/chapter_manager.lua
+++ b/lua/app/module/chapter/chapter_manager.lua
@@ -23,7 +23,7 @@ function ChapterManager:openBoxFinish(result)
end
function ChapterManager:startFight()
- if not ModuleManager.FormationManager:formationIsFull() then
+ if not DataManager.ArenaData:formationIsFull(GConst.BattleConst.BATTLE_TYPE.STAGE) then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_8))
return
end
@@ -126,6 +126,10 @@ function ChapterManager:endFightFinish(result)
-- 章节通关 检查是否要弹出功能解锁界面
DataManager.PlayerData:checkIfCanShowModuleUnlock(maxChapter)
end
+ -- 第二章战斗结算,触发成长礼包
+ if result.reqData.chapter_id == GConst.ShopConst.INTRODUCTORY_GIFT_TRIGGER_CHAPTER_ID then
+ DataManager.ShopData:onTriggerIntroductGift()
+ end
ModuleManager.TaskManager:addFightTaskProgress(reqData.task_stat)
end
diff --git a/lua/app/module/commerce/commerce_manager.lua b/lua/app/module/commerce/commerce_manager.lua
index 7bb07164..85c83e06 100644
--- a/lua/app/module/commerce/commerce_manager.lua
+++ b/lua/app/module/commerce/commerce_manager.lua
@@ -1,5 +1,7 @@
local CommerceManager = class("CommerceManager", BaseModule)
+-- 体力
+
function CommerceManager:showBuyVitUI()
UIManager:showUI("app/ui/commerce/buy_vit_ui")
end
@@ -38,4 +40,31 @@ function CommerceManager:onBuyBitFinish(data)
end
end
+-- 竞技场入场券
+
+function CommerceManager:showBuyArenaTicketUI()
+ UIManager:showUI("app/ui/arena/arena_buy_ticket_ui")
+end
+
+function CommerceManager:onBuyArenaTicket(isAd)
+ self:sendMessage(ProtoMsgType.FromMsgEnum.BuyTicketReq, {ad = isAd}, {}, self.onBuyArenaTicketFinish, nil)
+end
+
+function CommerceManager:onBuyArenaTicketFinish(data)
+ if data.status ~= 0 then
+ return
+ end
+
+ if data.costs then
+ -- 钻石购买
+ DataManager.PlayerData:addArenaTicketGemBuyCount()
+ else
+ -- 激励视频
+ DataManager.PlayerData:addArenaTicketAdBuyCount()
+ end
+ if data.rewards then
+ GFunc.showRewardBox(data.rewards)
+ end
+end
+
return CommerceManager
\ No newline at end of file
diff --git a/lua/app/module/daily_challenge/daily_challenge_manager.lua b/lua/app/module/daily_challenge/daily_challenge_manager.lua
index c07e35b8..f3551261 100644
--- a/lua/app/module/daily_challenge/daily_challenge_manager.lua
+++ b/lua/app/module/daily_challenge/daily_challenge_manager.lua
@@ -54,7 +54,7 @@ function DailyChallengeManager:startChallenge()
end
-- 检查阵容
- if not ModuleManager.FormationManager:formationIsFull() then
+ if not DataManager.ArenaData:formationIsFull(GConst.BattleConst.BATTLE_TYPE.STAGE) then
GFunc.showToast(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_8))
return
end
diff --git a/lua/app/module/formation/formation_manager.lua b/lua/app/module/formation/formation_manager.lua
index 80bec5bb..a8783d8d 100644
--- a/lua/app/module/formation/formation_manager.lua
+++ b/lua/app/module/formation/formation_manager.lua
@@ -1,13 +1,12 @@
local FormationManager = class("FormationManager", BaseModule)
+-- 主线编队
function FormationManager:upHeroToStageFormation(heroId, matchType)
local formation = DataManager.FormationData:getStageFormation()
if formation[matchType] == heroId then
return
end
local args = {
- -- formationType = GConst.BattleConst.BATTLE_TYPE.STAGE,
- -- matchType = matchType,
id = heroId
}
self:sendMessage(ProtoMsgType.FromMsgEnum.HeroPutOnReq, args, {}, self.upHeroToStageFormationFinish)
@@ -26,25 +25,20 @@ function FormationManager:upHeroToStageFormationFinish(result)
end
end
-function FormationManager:formationIsFull()
- local actvieMap = DataManager.HeroData:getMatchActiveHeroMap()
- local formation = DataManager.FormationData:getStageFormation()
- local count = 0
- for matchtype = 1, GConst.BattleConst.ELEMENT_TYPE_COUNT do
- if not formation[matchtype] or formation[matchtype] <= 0 then
- if actvieMap[matchtype] and table.nums(actvieMap[matchtype]) > 0 then
- return false
- end
- else
- count = count + 1
- end
- end
+-- 竞技场编队
+function FormationManager:reqArenaFormation()
+ local parmas = {
+ -- 需要五个数据,空位用0补齐
+ attack_heroIds = DataManager.FormationData:getArenaAttackFormation(),-- 进攻编队
+ defend_heroIds = DataManager.FormationData:getArenaDefendFormation(),-- 防守编队
+ }
+ self:sendMessage(ProtoMsgType.FromMsgEnum.PVPHeroesArrayReq, parmas, {}, self.rspArenaFormation, nil)
+end
- if count <= 0 then
- return false
- end
-
- return true
+function FormationManager:rspArenaFormation(result)
+ if result.err_code == GConst.ERROR_STR.SUCCESS then
+ DataManager.FormationData:initArena(result.reqData.attack_heroIds, result.reqData.defend_heroIds)
+ end
end
return FormationManager
\ No newline at end of file
diff --git a/lua/app/module/item/item_const.lua b/lua/app/module/item/item_const.lua
index 5a7121d5..1f3ba49b 100644
--- a/lua/app/module/item/item_const.lua
+++ b/lua/app/module/item/item_const.lua
@@ -15,6 +15,7 @@ ItemConst.ITEM_ID_BOX_KEY_LV_3 = 15
ItemConst.ITEM_ID_BOX_LV_5 = 18
ItemConst.ITEM_ID_RANDOM_FRAGMENT = 19
ItemConst.ITEM_ID_ARENA_BOUNTY_EXP = 21
+ItemConst.ITEM_ID_ARENA_TICKET = 22
ItemConst.ITEM_TYPE = {
RES = 1,
diff --git a/lua/app/module/maincity/maincity_const.lua b/lua/app/module/maincity/maincity_const.lua
index 1bffbd83..db45b9a0 100644
--- a/lua/app/module/maincity/maincity_const.lua
+++ b/lua/app/module/maincity/maincity_const.lua
@@ -14,11 +14,17 @@ MainCityConst.BOTTOM_ICON = {
MainCityConst.BOTTOM_CLOSE_ICON = {
}
--- main界面模块,序号是模块从左往右的切换顺序,需要是连续的
+-- main界面模块
MainCityConst.MAIN_MODULE = {
- DAILY_CHALLENGE = 1,
- CHAPTER = 2,
- DUNGEON = 3,
+ -- 左侧模块,负数,绝对值升序
+ ARENA = -1,
+ DAILY_CHALLENGE = -2,
+
+ -- 主模块
+ CHAPTER = 0,
+
+ -- 右侧模块,正数,绝对值升序
+ DUNGEON = 1,
}
MainCityConst.LEFT_SIDE_BARS = {
@@ -31,7 +37,8 @@ MainCityConst.LEFT_SIDE_BARS = {
MainCityConst.RIGHT_SIDE_BARS = {
"app/ui/main_city/cell/side_bar_gold_pig_cell",
- "app/ui/main_city/cell/side_bar_first_recharge_cell",
+ -- "app/ui/main_city/cell/side_bar_first_recharge_cell", 已作废
+ "app/ui/main_city/cell/side_bar_introduct_gift_cell",
"app/ui/main_city/cell/side_bar_beginner_gift_cell",
"app/ui/main_city/cell/side_bar_grow_up_gift_1_cell",
"app/ui/main_city/cell/side_bar_grow_up_gift_2_cell",
diff --git a/lua/app/module/shop/shop_const.lua b/lua/app/module/shop/shop_const.lua
index df94a88c..7f3a5600 100644
--- a/lua/app/module/shop/shop_const.lua
+++ b/lua/app/module/shop/shop_const.lua
@@ -2,6 +2,8 @@ local ShopConst = {}
ShopConst.FIRST_RECHARGE_ID = 10102 -- 首充礼包ID
ShopConst.BEGINNER_GIFT_ID = 40102 -- 新手礼包ID
+ShopConst.INTRODUCT_GIFT_ID = 30102 -- 入门礼包ID
+ShopConst.INTRODUCTORY_GIFT_TRIGGER_CHAPTER_ID = 2 -- 入门礼包触发的章节ID
ShopConst.MAIN_UI_POP_TYPE = { -- 当触发弹窗时,相关联的类型礼包也要触发
[PayManager.PURCHARSE_TYPE.ACT_GIFT] = {
[PayManager.PURCHARSE_ACT_TYPE.BEGINNER_GIFT] = true,
diff --git a/lua/app/module/shop/shop_manager.lua b/lua/app/module/shop/shop_manager.lua
index 6a8bf62e..10c69827 100644
--- a/lua/app/module/shop/shop_manager.lua
+++ b/lua/app/module/shop/shop_manager.lua
@@ -24,9 +24,15 @@ end
-- 触发弹窗礼包
function ShopManager:triggerGiftPopUI(actType, actId)
- if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.ACT_GIFT_SHOW_OPEN, true) then
+ -- 入门礼包不在通用触发条件内
+ if (actType == PayManager.PURCHARSE_TYPE.ACT_GIFT and actId == GConst.ShopConst.INTRODUCT_GIFT_ID) then
self:showGiftPopUI(actType, actId, false)
DataManager.ShopData:removePopUpGift(actType, actId)
+ else
+ if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.ACT_GIFT_SHOW_OPEN, true) then
+ self:showGiftPopUI(actType, actId, false)
+ DataManager.ShopData:removePopUpGift(actType, actId)
+ end
end
end
@@ -36,6 +42,8 @@ function ShopManager:showGiftPopUI(actType, actId, onlySelf)
end
if actType == PayManager.PURCHARSE_TYPE.ACT_GIFT and actId == GConst.ShopConst.FIRST_RECHARGE_ID then
UIManager:showUI("app/ui/shop/first_recharge_pop_ui")
+ elseif actType == PayManager.PURCHARSE_TYPE.ACT_GIFT and actId == GConst.ShopConst.INTRODUCT_GIFT_ID then
+ UIManager:showUI("app/ui/shop/introduct_pop_ui")
else
UIManager:showUI("app/ui/shop/gift_pop_ui", {type = actType, id = actId, onlySelf = onlySelf})
end
diff --git a/lua/app/module/tips/tips_manager.lua b/lua/app/module/tips/tips_manager.lua
index d923c250..9604aed2 100644
--- a/lua/app/module/tips/tips_manager.lua
+++ b/lua/app/module/tips/tips_manager.lua
@@ -104,6 +104,15 @@ function TipsManager:showHeroFragmentTips(itemId)
UIManager:showUI("app/ui/tips/hero_fragment_tips", params)
end
+-- formation = {{id = 000, level = 000}, {id = 000, level = 000}, ...}
+function TipsManager:showHeroFormation(targetObj, formation)
+ local params = {
+ targetObj = targetObj,
+ formation = formation,
+ }
+ UIManager:showUI("app/ui/tips/formation_tips", params)
+end
+
function TipsManager:showBoxTips(itemId)
local params = {
itemId = itemId
diff --git a/lua/app/proto/proto_msg_type.lua b/lua/app/proto/proto_msg_type.lua
index ab112b62..fde37e2d 100644
--- a/lua/app/proto/proto_msg_type.lua
+++ b/lua/app/proto/proto_msg_type.lua
@@ -37,6 +37,8 @@ local ProtoMsgType = {
[904224593] = "ArenaBountyLevelUnlockRsp",
[1008447203] = "DeleteReq",
[1008449036] = "DeleteRsp",
+ [1067411524] = "BuyTicketReq",
+ [1067413357] = "BuyTicketRsp",
[1068769299] = "ReconnectReq",
[1068771132] = "ReconnectRsp",
[1070841461] = "LoginReq",
@@ -77,6 +79,8 @@ local ProtoMsgType = {
[2285873970] = "ChapterBoxRewardRsp",
[2429586383] = "MailCycleReq",
[2429588216] = "MailCycleRsp",
+ [2494225153] = "PVPSettlementADRewardReq",
+ [2494226986] = "PVPSettlementADRewardRsp",
[2494731810] = "TriggerGoldGiftReq",
[2494733643] = "TriggerGoldGiftRsp",
[2514397758] = "PVPInfoReq",
@@ -198,6 +202,8 @@ local ProtoMsgType = {
ArenaBountyLevelUnlockRsp = 904224593,
DeleteReq = 1008447203,
DeleteRsp = 1008449036,
+ BuyTicketReq = 1067411524,
+ BuyTicketRsp = 1067413357,
ReconnectReq = 1068769299,
ReconnectRsp = 1068771132,
LoginReq = 1070841461,
@@ -238,6 +244,8 @@ local ProtoMsgType = {
ChapterBoxRewardRsp = 2285873970,
MailCycleReq = 2429586383,
MailCycleRsp = 2429588216,
+ PVPSettlementADRewardReq = 2494225153,
+ PVPSettlementADRewardRsp = 2494226986,
TriggerGoldGiftReq = 2494731810,
TriggerGoldGiftRsp = 2494733643,
PVPInfoReq = 2514397758,
@@ -359,6 +367,8 @@ local ProtoMsgType = {
ArenaBountyLevelUnlockRsp = "ArenaBountyLevelUnlockRsp",
DeleteReq = "DeleteReq",
DeleteRsp = "DeleteRsp",
+ BuyTicketReq = "BuyTicketReq",
+ BuyTicketRsp = "BuyTicketRsp",
ReconnectReq = "ReconnectReq",
ReconnectRsp = "ReconnectRsp",
LoginReq = "LoginReq",
@@ -399,6 +409,8 @@ local ProtoMsgType = {
ChapterBoxRewardRsp = "ChapterBoxRewardRsp",
MailCycleReq = "MailCycleReq",
MailCycleRsp = "MailCycleRsp",
+ PVPSettlementADRewardReq = "PVPSettlementADRewardReq",
+ PVPSettlementADRewardRsp = "PVPSettlementADRewardRsp",
TriggerGoldGiftReq = "TriggerGoldGiftReq",
TriggerGoldGiftRsp = "TriggerGoldGiftRsp",
PVPInfoReq = "PVPInfoReq",
diff --git a/lua/app/ui/arena/arena_buy_ticket_ui.lua b/lua/app/ui/arena/arena_buy_ticket_ui.lua
new file mode 100644
index 00000000..e49c59a4
--- /dev/null
+++ b/lua/app/ui/arena/arena_buy_ticket_ui.lua
@@ -0,0 +1,109 @@
+-- 竞技场:购买入场券
+local ArenaBuyTicketUI = class("ArenaBuyTicketUI", BaseUI)
+
+function ArenaBuyTicketUI:isFullScreen()
+ return false
+end
+
+function ArenaBuyTicketUI:showCommonBG()
+ return false
+end
+
+function ArenaBuyTicketUI:getPrefabPath()
+ return "assets/prefabs/ui/arena/arena_buy_ticket_ui.prefab"
+end
+
+function ArenaBuyTicketUI:onPressBackspace()
+ self:closeUI()
+end
+
+function ArenaBuyTicketUI:onLoadRootComplete()
+ local uiMap = self.root:genAllChildren()
+ uiMap["arena_buy_ticket_ui.bg.close_btn"]:addClickListener(function()
+ self:closeUI()
+ end)
+
+ uiMap["arena_buy_ticket_ui.bg.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.BUY_ENERGY))
+ local constCfg = ConfigManager:getConfig("const")
+ local diamondReward = constCfg["arena_notes_diamond_buy"].reward
+ local adReward = constCfg["arena_notes_ad_buy"].reward
+ uiMap["arena_buy_ticket_ui.bg.cell_1.num_tx_1"]:setText("x" .. GFunc.getRewardNum(diamondReward))
+ uiMap["arena_buy_ticket_ui.bg.cell_2.num_tx_1"]:setText("x" .. GFunc.getRewardNum(adReward))
+
+ self.descTx1 = uiMap["arena_buy_ticket_ui.bg.cell_1.desc_tx"]
+ self.descTx2 = uiMap["arena_buy_ticket_ui.bg.cell_2.desc_tx"]
+ self.numTx1 = uiMap["arena_buy_ticket_ui.bg.cell_1.num_tx_2"]
+ self.numTx2 = uiMap["arena_buy_ticket_ui.bg.cell_2.num_tx_2"]
+ self.checkImg1 = uiMap["arena_buy_ticket_ui.bg.cell_1.check_img"]
+ self.checkImg2 = uiMap["arena_buy_ticket_ui.bg.cell_2.check_img"]
+ self.iconImg1 = uiMap["arena_buy_ticket_ui.bg.cell_1.icon_img"]
+ self.iconImg2 = uiMap["arena_buy_ticket_ui.bg.cell_2.icon_img"]
+
+ self.buyBtn1 = uiMap["arena_buy_ticket_ui.bg.cell_1"]
+ self.buyBtn2 = uiMap["arena_buy_ticket_ui.bg.cell_2"]
+ self.buyBtn1:addClickListener(function()
+ local diamondCost = constCfg["arena_notes_diamond_cost"].reward
+ if not GFunc.checkCost(GFunc.getRewardId(diamondCost), GFunc.getRewardNum(diamondCost), true, BIReport.ITEM_GET_TYPE.GEM_BUY_ARENA_TICKET) then
+ return
+ end
+ ModuleManager.CommerceManager:onBuyArenaTicket(false)
+ end)
+ self.buyBtn2:addClickListener(function()
+ SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.ARENA_TICKET, function ()
+ ModuleManager.CommerceManager:onBuyArenaTicket(true)
+ end)
+ end)
+
+ self:bind(DataManager.PlayerData, "arenaTicketGemCount", function()
+ self:onRefresh()
+ end)
+ self:bind(DataManager.PlayerData, "arenaTicketADCount", function()
+ self:onRefresh()
+ end)
+end
+
+function ArenaBuyTicketUI:onRefresh()
+ local gemBuyCount = DataManager.PlayerData:getArenaTicketGemBuyCount()
+ local adBuyCount = DataManager.PlayerData:getArenaTicketAdBuyCount()
+ local maxGemBuy = GFunc.getConstIntValue("arena_notes_diamond_times")
+ local maxAdBuy = GFunc.getConstIntValue("arena_notes_ad_times")
+ if gemBuyCount < maxGemBuy then
+ self.buyBtn1:setTouchEnable(true)
+ self.checkImg1:setVisible(false)
+ self.iconImg1:setVisible(true)
+ self.numTx1:setVisible(true)
+ else
+ self.buyBtn1:setTouchEnable(false)
+ self.checkImg1:setVisible(true)
+ self.iconImg1:setVisible(false)
+ self.numTx1:setVisible(false)
+ end
+
+ GFunc.setAdsSprite(self.iconImg2, false)
+ if adBuyCount < maxAdBuy then
+ self.buyBtn2:setTouchEnable(true)
+ self.checkImg2:setVisible(false)
+ self.iconImg2:setVisible(true)
+ self.numTx2:setVisible(true)
+ else
+ self.buyBtn2:setTouchEnable(false)
+ self.checkImg2:setVisible(true)
+ self.iconImg2:setVisible(false)
+ self.numTx2:setVisible(false)
+ end
+
+ self.descTx1:setText(I18N:getGlobalText(I18N.GlobalConst.TODAY_REMAIN_TIMES, maxGemBuy - gemBuyCount))
+ self.descTx2:setText(I18N:getGlobalText(I18N.GlobalConst.TODAY_REMAIN_TIMES, maxAdBuy - adBuyCount))
+
+ local constCfg = ConfigManager:getConfig("const")
+ local diamondCost = constCfg["arena_notes_diamond_cost"].reward
+ self.numTx1:setText(tostring(GFunc.getRewardNum(diamondCost)))
+ self.numTx2:setText((maxAdBuy - adBuyCount) .. "/" .. GFunc.getConstIntValue("arena_notes_ad_times"))
+ if not self.adjustIconAndNum then
+ self.adjustIconAndNum = true
+ GFunc.centerImgAndTx(self.iconImg1, self.numTx1)
+ GFunc.centerImgAndTx(self.iconImg2, self.numTx2)
+ end
+end
+
+return ArenaBuyTicketUI
\ No newline at end of file
diff --git a/lua/app/ui/arena/arena_buy_ticket_ui.lua.meta b/lua/app/ui/arena/arena_buy_ticket_ui.lua.meta
new file mode 100644
index 00000000..5940a61b
--- /dev/null
+++ b/lua/app/ui/arena/arena_buy_ticket_ui.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 17e60861d0a06c443a76e9d662eefe9a
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/arena/arena_formation_ui.lua b/lua/app/ui/arena/arena_formation_ui.lua
new file mode 100644
index 00000000..23f8c31d
--- /dev/null
+++ b/lua/app/ui/arena/arena_formation_ui.lua
@@ -0,0 +1,67 @@
+-- 竞技场:调整阵容
+local ArenaFormationUI = class("ArenaFormationUI", BaseUI)
+
+function ArenaFormationUI:isFullScreen()
+ return false
+end
+
+function ArenaFormationUI:showCommonBG()
+ return false
+end
+
+function ArenaFormationUI:getPrefabPath()
+ return "assets/prefabs/ui/arena/arena_formation_ui.prefab"
+end
+
+function ArenaFormationUI:onPressBackspace()
+ self:closeUI()
+end
+
+function ArenaFormationUI:ctor(params)
+ self.formationType = params
+end
+
+function ArenaFormationUI:onCover()
+end
+
+function ArenaFormationUI:onReshow()
+end
+
+function ArenaFormationUI:onClose()
+end
+
+function ArenaFormationUI:onLoadRootComplete()
+ local uiMap = self.root:genAllChildren()
+
+ uiMap["arena_formation_ui.banner.btn_ok.tx_ok"]:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_24))
+ uiMap["arena_formation_ui.banner.btn_ok"]:addClickListener(function()
+ ModuleManager.FormationManager:reqArenaFormation()
+ if self.isMatch then
+ UIManager:showUI("app/ui/arena/arena_match_ui", true)
+ end
+ self:closeUI()
+ end)
+
+ local heroUI = uiMap["arena_formation_ui.hero_ui"]
+ heroUI:initPrefabHelper()
+ heroUI:genAllChildren()
+ self.heroComp = heroUI:addLuaComponent("app/ui/hero/hero_comp")
+
+ self:bind(DataManager.HeroData, "isDirty", function()
+ self:onRefresh()
+ end)
+
+ self:bind(DataManager.BagData.ItemData, "dirty", function()
+ self:onRefresh()
+ end)
+end
+
+function ArenaFormationUI:onRefresh()
+ if self.formationType == GConst.BattleConst.FORMATION_TYPE.ARENA_ATTACK then
+ -- 从匹配界面进来的
+ self.isMatch = true
+ end
+ self.heroComp:refresh(self.formationType)
+end
+
+return ArenaFormationUI
\ No newline at end of file
diff --git a/lua/app/ui/arena/arena_formation_ui.lua.meta b/lua/app/ui/arena/arena_formation_ui.lua.meta
new file mode 100644
index 00000000..7b02d08f
--- /dev/null
+++ b/lua/app/ui/arena/arena_formation_ui.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 93e588c4cd4c6104c95a51a9de77f4a3
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/arena/arena_match_ui.lua b/lua/app/ui/arena/arena_match_ui.lua
new file mode 100644
index 00000000..f9f3493b
--- /dev/null
+++ b/lua/app/ui/arena/arena_match_ui.lua
@@ -0,0 +1,228 @@
+-- 竞技场:匹配
+local ArenaMatchUI = class("ArenaMatchUI", BaseUI)
+
+function ArenaMatchUI:isFullScreen()
+ return true
+end
+
+function ArenaMatchUI:showCommonBG()
+ return false
+end
+
+function ArenaMatchUI:getPrefabPath()
+ return "assets/prefabs/ui/arena/arena_match_ui.prefab"
+end
+
+function ArenaMatchUI:onPressBackspace()
+ self:closeUI()
+end
+
+function ArenaMatchUI:ctor(isBack)
+ self.isBack = isBack-- 是否是返回到匹配结果界面
+end
+
+function ArenaMatchUI:onCover()
+end
+
+function ArenaMatchUI:onReshow()
+end
+
+function ArenaMatchUI:onClose()
+ if self.waitSid then
+ ModuleManager.BattleManager:unscheduleGlobal(self.waitSid)
+ end
+ if self.countdownSid then
+ ModuleManager.BattleManager:unscheduleGlobal(self.countdownSid)
+ end
+end
+
+function ArenaMatchUI:onLoadRootComplete()
+ local uiMap = self.root:genAllChildren()
+
+ -- 匹配等待页
+ self.matchLoading = uiMap["arena_match_ui.match_loading"]
+ self.txSeason = uiMap["arena_match_ui.match_loading.tx_season"]
+ self.txLoading = uiMap["arena_match_ui.match_loading.tx_loading"]
+ self.btnCancel = uiMap["arena_match_ui.match_loading.btn_cancel"]
+ self.txCancel = uiMap["arena_match_ui.match_loading.btn_cancel.tx_cancel"]
+
+ -- 匹配结果页
+ self.matchResult = uiMap["arena_match_ui.match_result"]
+ self.btnClose = uiMap["arena_match_ui.match_result.btn_close"]
+ -- 对手信息
+ self.matchAvatar = CellManager:addCellComp(uiMap["arena_match_ui.match_result.match.info.player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL)
+ self.matchTxName = uiMap["arena_match_ui.match_result.match.info.tx_name"]
+ self.matchTxLevel = uiMap["arena_match_ui.match_result.match.info.tx_level"]
+ self.matchGrading = uiMap["arena_match_ui.match_result.match.arena_grading_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.ARENA_GRADING_CELL)
+ self.matchHeroFormationComp = uiMap["arena_match_ui.match_result.match.formation.hero_formation_comp"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_FORMATION_COMP)
+ -- 自己信息
+ self.selfAvatar = CellManager:addCellComp(uiMap["arena_match_ui.match_result.self.info.player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL)
+ self.selfTxName = uiMap["arena_match_ui.match_result.self.info.tx_name"]
+ self.selfTxLevel = uiMap["arena_match_ui.match_result.self.info.tx_level"]
+ self.selfGrading = uiMap["arena_match_ui.match_result.self.arena_grading_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.ARENA_GRADING_CELL)
+ self.selfHeroFormationComp = uiMap["arena_match_ui.match_result.self.formation.hero_formation_comp"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_FORMATION_COMP)
+ -- 功能按钮
+ self.btnStart = uiMap["arena_match_ui.match_result.btn_start"]
+ self.imgCost = uiMap["arena_match_ui.match_result.btn_start.cost.img_cost"]
+ self.txStart = uiMap["arena_match_ui.match_result.btn_start.tx_start"]
+ self.txConst = uiMap["arena_match_ui.match_result.btn_start.cost.tx_cost"]
+ self.btnRematch = uiMap["arena_match_ui.match_result.btn_rematch"]
+ self.txRematch = uiMap["arena_match_ui.match_result.btn_rematch.tx_rematch"]
+ self.txFreeCountdown = uiMap["arena_match_ui.match_result.btn_rematch.tx_free_countdown"]
+ self.imgAd = uiMap["arena_match_ui.match_result.btn_rematch.img_ad"]
+ self.btnFormation = uiMap["arena_match_ui.match_result.btn_formation"]
+ self.txFormation = uiMap["arena_match_ui.match_result.btn_formation.tx_formation"]
+
+ self.btnCancel:addClickListener(function()
+ self:closeUI()
+ end)
+ self.btnClose:addClickListener(function()
+ self:closeUI()
+ end)
+ self.btnStart:addClickListener(function()
+ ModuleManager.ArenaManager:reqChallenge()
+ self:closeUI()
+ end)
+ self.btnRematch:addClickListener(function()
+ self:onClickRematch()
+ end)
+ self.btnFormation:addClickListener(function()
+ UIManager:showUI("app/ui/arena/arena_formation_ui", GConst.BattleConst.FORMATION_TYPE.ARENA_ATTACK)
+ self:closeUI()
+ end)
+ self:bind(DataManager.ArenaData, "isDirty", function()
+ self:showMatchResult()
+ end)
+end
+
+function ArenaMatchUI:onRefresh()
+ if DataManager.ArenaData:getMatchInfo() == nil then
+ ModuleManager.ArenaManager:reqMatch()
+ end
+
+ if self.isBack and DataManager.ArenaData:getMatchInfo() ~= nil then
+ self:showMatchResult()
+ else
+ self:showMatchLoading()
+ end
+end
+
+-- 展示匹配等待页
+function ArenaMatchUI:showMatchLoading()
+ self.matchLoading:setActive(true)
+ self.matchResult:setActive(false)
+
+ self.txSeason:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_21, DataManager.ArenaData:getSeason()))
+ self.txLoading:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_22))
+ self.txCancel:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_TEXT_CANCEL))
+
+ -- 等待
+ if self.waitSid then
+ ModuleManager.BattleManager:unscheduleGlobal(self.waitSid)
+ end
+ self.waitSid = self.matchLoading:performWithDelayGlobal(function()
+ self:showMatchResult()
+ end, 1.5)
+end
+
+-- 展示匹配结果页
+function ArenaMatchUI:showMatchResult()
+ local matchInfo = DataManager.ArenaData:getMatchInfo()
+ if not matchInfo then
+ -- 基本不会走到这
+ Logger.logError("没有匹配对象却进入了匹配结果页,检查是否是网络慢了等情况")
+ return
+ end
+
+ self.matchLoading:setActive(false)
+ self.matchResult:setActive(true)
+ self.freeRematchCD = DataManager.ArenaData:getFreeRematchCd()
+
+ Logger.printTable(matchInfo)
+ Logger.printTable(self.freeRematchCD)
+
+ self.txStart:setText(I18N:getGlobalText(I18N.GlobalConst.TASK_CHALLENGE))
+ self.txConst:setText(DataManager.ArenaData:getFightCostNum())
+ self.txRematch:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_23))
+ self.txFormation:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_10))
+ self.imgAd:setActive(self.freeRematchCD > 0 and DataManager.ArenaData:canAdRematch())
+
+ self.matchAvatar:refresh(matchInfo.avatar, matchInfo.avatar_frame)
+ self.matchTxName:setText(matchInfo.name)
+ self.matchTxLevel:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, matchInfo.level))
+ self.matchGrading:refresh(DataManager.ArenaData:getGradingIdFromScore(matchInfo.score))
+ self.matchHeroFormationComp:refreshBriefInfo(matchInfo.array_heroes)
+
+ self.selfAvatar:refresh(nil, nil, false)
+ self.selfTxName:setText(DataManager.PlayerData:getNickname())
+ self.selfTxLevel:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, DataManager.PlayerData:getLv()))
+ self.selfGrading:refresh(DataManager.ArenaData:getGradingId())
+
+ GFunc.centerImgAndTx(self.imgCost, self.txConst, 5)
+
+ local formation = {}
+ for idx, id in pairs(DataManager.FormationData:getArenaAttackFormation()) do
+ local hero = DataManager.HeroData:getHeroById(id)
+
+ if hero then
+ formation[idx] = {id = id, level = hero:getLv()}
+ else
+ formation[idx] = nil
+ end
+ end
+ self.selfHeroFormationComp:refreshBriefInfo(formation)
+
+ if self.countdownSid then
+ ModuleManager.BattleManager:unscheduleGlobal(self.countdownSid)
+ end
+ self.countdownSid = self.txFreeCountdown:scheduleGlobal(function()
+ self:refreshCountdown()
+ end, 1)
+ self:refreshCountdown()
+end
+
+function ArenaMatchUI:refreshCountdown()
+ self.freeRematchCD = self.freeRematchCD - 1
+ if self.freeRematchCD <= 0 then
+ -- 冷却已好
+ self.txFreeCountdown:setActive(false)
+
+ ModuleManager.BattleManager:unscheduleGlobal(self.countdownSid)
+ else
+ -- 冷却未好
+ self.txFreeCountdown:setActive(true)
+ self.txFreeCountdown:setText(GFunc.getTimeStrWithHMS(self.freeRematchCD))
+ end
+end
+
+-- 点击重新匹配
+function ArenaMatchUI:onClickRematch()
+ if self.freeRematchCD > 0 then
+ -- 在cd时间内
+
+ if DataManager.ArenaData:canAdRematch() then
+ -- 看视频
+ SDKManager:showFullScreenAds(BIReport.ADS_CLICK_TYPE.ARENA_REMATCH, function ()
+ ModuleManager.ArenaManager:reqOverCD(true)
+ end)
+ else
+ -- 钻石
+ local params ={
+ content = I18N:getGlobalText(I18N.GlobalConst.BOUNTY_BUY_LEVEL_COUNTENT),
+ boxType = GConst.MESSAGE_BOX_TYPE.MB_OK_CANCEL,
+ costId = ItemConst.ITEM_ID_GEM,
+ costNum = DataManager.ArenaData:getRematchConstGem(),
+ okFunc = function()
+ ModuleManager.ArenaManager:reqOverCD(false)
+ end,
+ }
+ GFunc.showMessageBox(params)
+ end
+ else
+ -- 冷却已好
+ ModuleManager.ArenaManager:reqMatch()
+ self:showMatchLoading()
+ end
+end
+
+return ArenaMatchUI
\ No newline at end of file
diff --git a/lua/app/ui/arena/arena_match_ui.lua.meta b/lua/app/ui/arena/arena_match_ui.lua.meta
new file mode 100644
index 00000000..feab1f8a
--- /dev/null
+++ b/lua/app/ui/arena/arena_match_ui.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: ce9dee8d5caa5e6498370256f94d5ed6
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/arena/arena_rank_ui.lua b/lua/app/ui/arena/arena_rank_ui.lua
new file mode 100644
index 00000000..80048a23
--- /dev/null
+++ b/lua/app/ui/arena/arena_rank_ui.lua
@@ -0,0 +1,70 @@
+-- 竞技场:排行榜
+local ArenaRankUI = class("ArenaRankUI", BaseUI)
+
+function ArenaRankUI:isFullScreen()
+ return false
+end
+
+function ArenaRankUI:showCommonBG()
+ return false
+end
+
+function ArenaRankUI:getPrefabPath()
+ return "assets/prefabs/ui/arena/arena_rank_ui.prefab"
+end
+
+function ArenaRankUI:onPressBackspace()
+ self:closeUI()
+end
+
+function ArenaRankUI:ctor()
+ ModuleManager.ArenaManager:reqRank()
+end
+
+function ArenaRankUI:onCover()
+end
+
+function ArenaRankUI:onReshow()
+end
+
+function ArenaRankUI:onClose()
+end
+
+function ArenaRankUI:onLoadRootComplete()
+ local uiMap = self.root:genAllChildren()
+
+ self.txTitle = uiMap["arena_rank_ui.bg.title.tx_title"]
+ self.closeBtn = uiMap["arena_rank_ui.bg.close_btn"]
+ self.txRank = uiMap["arena_rank_ui.bg.my_rank.tx_rank"]
+ self.playerHeadCell = CellManager:addCellComp(uiMap["arena_rank_ui.bg.my_rank.player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL)
+ self.txName = uiMap["arena_rank_ui.bg.my_rank.tx_name"]
+ self.cellGrading = uiMap["arena_rank_ui.bg.my_rank.arena_grading_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.ARENA_GRADING_CELL)
+ self.scrollRectComp = uiMap["arena_rank_ui.bg.list_rank"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
+
+ self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5))
+ self.txRank:setText(DataManager.ArenaData:getRank())
+ self.txName:setText(DataManager.PlayerData:getNickname())
+ self.cellGrading:refresh(DataManager.ArenaData:getGradingId())
+ self.playerHeadCell:refresh(nil, nil, false)
+
+ self.scrollRectComp:addInitCallback(function()
+ return "app/ui/arena/cell/arena_rank_cell"
+ end)
+ self.scrollRectComp:addRefreshCallback(function(index, cell)
+ cell:refresh(index)
+ end)
+
+ self.closeBtn:addClickListener(function()
+ self:closeUI()
+ end)
+ self:bind(DataManager.ArenaData, "isDirty", function()
+ self:onRefresh()
+ end)
+end
+
+function ArenaRankUI:onRefresh()
+ self.scrollRectComp:clearCells()
+ self.scrollRectComp:refillCells(DataManager.ArenaData:getRankCount())
+end
+
+return ArenaRankUI
\ No newline at end of file
diff --git a/lua/app/ui/arena/arena_rank_ui.lua.meta b/lua/app/ui/arena/arena_rank_ui.lua.meta
new file mode 100644
index 00000000..02b15003
--- /dev/null
+++ b/lua/app/ui/arena/arena_rank_ui.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 0245d41639981524eb068a539427d5cf
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/arena/arena_recent_battle_ui.lua b/lua/app/ui/arena/arena_recent_battle_ui.lua
new file mode 100644
index 00000000..15e91cc4
--- /dev/null
+++ b/lua/app/ui/arena/arena_recent_battle_ui.lua
@@ -0,0 +1,107 @@
+-- 竞技场:最近战报
+local ArenaRecentBattleUI = class("ArenaRecentBattleUI", BaseUI)
+
+function ArenaRecentBattleUI:isFullScreen()
+ return false
+end
+
+function ArenaRecentBattleUI:showCommonBG()
+ return false
+end
+
+function ArenaRecentBattleUI:getPrefabPath()
+ return "assets/prefabs/ui/arena/arena_recent_battle_ui.prefab"
+end
+
+function ArenaRecentBattleUI:onPressBackspace()
+ self:closeUI()
+end
+
+function ArenaRecentBattleUI:ctor()
+ ModuleManager.ArenaManager:reqRecord()
+end
+
+function ArenaRecentBattleUI:onCover()
+end
+
+function ArenaRecentBattleUI:onReshow()
+end
+
+function ArenaRecentBattleUI:onClose()
+end
+
+function ArenaRecentBattleUI:onLoadRootComplete()
+ local uiMap = self.root:genAllChildren()
+
+ self.txTitle = uiMap["arena_recent_battle_ui.bg.title.tx_title"]
+ self.btnClose = uiMap["arena_recent_battle_ui.bg.btn_close"]
+ self.txResult = uiMap["arena_recent_battle_ui.bg.tab.tx_result"]
+ self.txName = uiMap["arena_recent_battle_ui.bg.tab.tx_name"]
+ self.txScore = uiMap["arena_recent_battle_ui.bg.tab.tx_score"]
+ self.txNone = uiMap["arena_recent_battle_ui.bg.tx_none"]
+ self.records = {}
+ for i = 1, 5 do
+ self.records[i] = uiMap["arena_recent_battle_ui.bg.records.battle_record_cell_"..i]
+ end
+
+ self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_7))
+ self.txResult:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_14))
+ self.txName:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_15))
+ self.txScore:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_16))
+
+ self.btnClose:addClickListener(function()
+ self:closeUI()
+ end)
+ self:bind(DataManager.ArenaData, "isDirty", function()
+ self:onRefresh()
+ end)
+end
+
+function ArenaRecentBattleUI:onRefresh()
+ local showCount = 0
+ for idx, obj in pairs(self.records) do
+ local info = DataManager.ArenaData:getRecentBattleByIdx(idx)
+ if info then
+ showCount = showCount + 1
+ obj:setActive(true)
+ self:refreshRecord(obj, info)
+ else
+ obj:setActive(false)
+ end
+ end
+
+ if showCount == 0 then
+ self.txNone:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_8))
+ else
+ self.txNone:setText("")
+ end
+end
+
+function ArenaRecentBattleUI:refreshRecord(obj, info)
+ local uiMap = obj:genAllChildren()
+
+ local playerHeadCell = CellManager:addCellComp(uiMap["player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL)
+ playerHeadCell:refresh(info.match_info.avatar, info.match_info.avatar_frame)
+ uiMap["tx_name"]:setText(info.match_info.name)
+ if info.win then
+ obj:setSprite(GConst.ATLAS_PATH.ARENA,"arena_bg_3")
+ uiMap["tx_score"]:setText("+"..info.incr_score.."")
+ uiMap["img_result"]:setSprite(GConst.ATLAS_PATH.ARENA, "arena_dec_2")
+ if info.attacker then
+ uiMap["tx_result"]:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_19))
+ else
+ uiMap["tx_result"]:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_17))
+ end
+ else
+ obj:setSprite(GConst.ATLAS_PATH.ARENA,"arena_bg_4")
+ uiMap["tx_score"]:setText(""..info.incr_score.."")
+ uiMap["img_result"]:setSprite(GConst.ATLAS_PATH.ARENA, "arena_dec_3")
+ if info.attacker then
+ uiMap["tx_result"]:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_20))
+ else
+ uiMap["tx_result"]:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_18))
+ end
+ end
+end
+
+return ArenaRecentBattleUI
\ No newline at end of file
diff --git a/lua/app/ui/arena/arena_recent_battle_ui.lua.meta b/lua/app/ui/arena/arena_recent_battle_ui.lua.meta
new file mode 100644
index 00000000..d1b1ce51
--- /dev/null
+++ b/lua/app/ui/arena/arena_recent_battle_ui.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 3347c147e7632ef408c220f332dce805
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/arena/arena_season_reward_ui.lua b/lua/app/ui/arena/arena_season_reward_ui.lua
new file mode 100644
index 00000000..846f0bc1
--- /dev/null
+++ b/lua/app/ui/arena/arena_season_reward_ui.lua
@@ -0,0 +1,125 @@
+-- 竞技场:赛季奖励
+local ArenaSeasonRewardUI = class("ArenaSeasonRewardUI", BaseUI)
+
+function ArenaSeasonRewardUI:isFullScreen()
+ return false
+end
+
+function ArenaSeasonRewardUI:showCommonBG()
+ return false
+end
+
+function ArenaSeasonRewardUI:getPrefabPath()
+ return "assets/prefabs/ui/arena/arena_season_reward_ui.prefab"
+end
+
+function ArenaSeasonRewardUI:onPressBackspace()
+ self:closeUI()
+end
+
+function ArenaSeasonRewardUI:ctor()
+end
+
+function ArenaSeasonRewardUI:onCover()
+end
+
+function ArenaSeasonRewardUI:onReshow()
+end
+
+function ArenaSeasonRewardUI:onClose()
+end
+
+function ArenaSeasonRewardUI:onLoadRootComplete()
+ local uiMap = self.root:genAllChildren()
+
+ self.txTitle = uiMap["arena_season_reward_ui.bg.title.tx_title"]
+ self.closeBtn = uiMap["arena_season_reward_ui.bg.close_btn"]
+ -- 赛季奖励
+ self.seasonReward = uiMap["arena_season_reward_ui.bg.season_reward"]
+ self.txDesc = uiMap["arena_season_reward_ui.bg.season_reward.tx_desc"]
+ self.txTime = uiMap["arena_season_reward_ui.bg.season_reward.countdown.tx_time"]
+ self.seasonRewardComp = uiMap["arena_season_reward_ui.bg.season_reward.reward_list"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
+ -- 领取奖励
+ self.getReward = uiMap["arena_season_reward_ui.bg.last_reward"]
+ self.txSeason = uiMap["arena_season_reward_ui.bg.last_reward.tx_season"]
+ self.imgGrading = uiMap["arena_season_reward_ui.bg.last_reward.img_grading"]
+ self.txGrading = uiMap["arena_season_reward_ui.bg.last_reward.img_grading.tx_grading"]
+ self.getRewardComp = uiMap["arena_season_reward_ui.bg.last_reward.rewards"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
+ self.btnGet = uiMap["arena_season_reward_ui.bg.last_reward.btn_get"]
+ self.txGet = uiMap["arena_season_reward_ui.bg.last_reward.btn_get.tx_get"]
+
+ self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_11))
+
+ self.closeBtn:addClickListener(function()
+ self:closeUI()
+ end)
+ self.btnGet:addClickListener(function()
+ ModuleManager.ArenaManager:reqLastSeasonReward()
+ end)
+ self:bind(DataManager.ArenaData, "isDirty", function()
+ self:closeUI()
+ end)
+end
+
+function ArenaSeasonRewardUI:onRefresh()
+ if DataManager.ArenaData:hasSeasonReward() then
+ self:showGetReward()
+ else
+ self:showSeasonReward()
+ end
+end
+
+-- 显示赛季奖励
+function ArenaSeasonRewardUI:showSeasonReward()
+ self.seasonReward:setActive(true)
+ self.getReward:setActive(false)
+
+ self.txDesc:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_12, DataManager.ArenaData:getSeason()))
+
+ if self.seasonChangeSid then
+ ModuleManager.BattleManager:unscheduleGlobal(self.seasonChangeSid)
+ end
+ self.seasonChangeSid = self.txTime:scheduleGlobal(function()
+ self:refreshCountdown()
+ end, 1)
+
+ local ids = DataManager.ArenaData:getGradingIdList()
+ self.seasonRewardComp:addInitCallback(function()
+ return "app/ui/arena/cell/arena_season_reward_cell"
+ end)
+ self.seasonRewardComp:addRefreshCallback(function(index, cell)
+ cell:refresh(ids[index])
+ end)
+ self.seasonRewardComp:clearCells()
+ self.seasonRewardComp:refillCells(#ids)
+end
+
+function ArenaSeasonRewardUI:refreshCountdown()
+ self.txTime:setText(Time:formatNumTimeStr(DataManager.ArenaData:getRemainSeasonTime()))
+end
+
+-- 显示领取奖励
+function ArenaSeasonRewardUI:showGetReward()
+ self.seasonReward:setActive(false)
+ self.getReward:setActive(true)
+
+ local lastId = DataManager.ArenaData:getLastGradingId()
+ local rewards = DataManager.ArenaData:getGradingRewardInfo(lastId)
+ self.txSeason:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_13, DataManager.ArenaData:getSeason() - 1))
+ self.imgGrading:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getGradingIconName(lastId))
+ self.txGrading:setText(DataManager.ArenaData:getGradingName(lastId))
+ self.txGet:setText(I18N:getGlobalText(I18N.GlobalConst.BTN_CLAIM))
+
+ self.btnGet:addRedPoint(65, 35, 0.6)
+
+ self.getRewardComp:addInitCallback(function()
+ return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
+ end)
+ self.getRewardComp:addRefreshCallback(function(index, cell)
+ cell:refresh(rewards[index])
+ end)
+ self.seasonRewardComp:clearCells()
+ self.seasonRewardComp:refillCells(#rewards)
+end
+
+return ArenaSeasonRewardUI
\ No newline at end of file
diff --git a/lua/app/ui/arena/arena_season_reward_ui.lua.meta b/lua/app/ui/arena/arena_season_reward_ui.lua.meta
new file mode 100644
index 00000000..b2fe0028
--- /dev/null
+++ b/lua/app/ui/arena/arena_season_reward_ui.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 894baca67a318bb4aa5cc0ddaa6ed1e1
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/arena/cell/arena_grading_cell.lua b/lua/app/ui/arena/cell/arena_grading_cell.lua
new file mode 100644
index 00000000..d00dcc29
--- /dev/null
+++ b/lua/app/ui/arena/cell/arena_grading_cell.lua
@@ -0,0 +1,17 @@
+local ArenaGradingCell = class("ArenaGradingCell", BaseCell)
+
+function ArenaGradingCell:init()
+ local uiMap = self:getUIMap()
+
+ self.imgGrading = uiMap["arena_grading_cell.img_grading"]
+ self.imgIdx = uiMap["arena_grading_cell.img_idx"]
+ self.txGrading = uiMap["arena_grading_cell.tx_grading"]
+end
+
+function ArenaGradingCell:refresh(id)
+ self.txGrading:setText(DataManager.ArenaData:getGradingName(id))
+ self.imgIdx:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getGradingNumName(id))
+ self.imgGrading:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getGradingIconName(id))
+end
+
+return ArenaGradingCell
\ No newline at end of file
diff --git a/lua/app/ui/arena/cell/arena_grading_cell.lua.meta b/lua/app/ui/arena/cell/arena_grading_cell.lua.meta
new file mode 100644
index 00000000..2a5f4a6b
--- /dev/null
+++ b/lua/app/ui/arena/cell/arena_grading_cell.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 3c23c830632924a4d924642e20e11848
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/arena/cell/arena_rank_cell.lua b/lua/app/ui/arena/cell/arena_rank_cell.lua
new file mode 100644
index 00000000..f11a46ec
--- /dev/null
+++ b/lua/app/ui/arena/cell/arena_rank_cell.lua
@@ -0,0 +1,42 @@
+local ArenaRankCell = class("ArenaRankCell", BaseCell)
+
+function ArenaRankCell:init()
+ local uiMap = self:getUIMap()
+
+ self.txRank = uiMap["arena_rank_cell.tx_rank"]
+ self.playerHeadCell = CellManager:addCellComp(uiMap["arena_rank_cell.player_head_cell"], GConst.TYPEOF_LUA_CLASS.PLAYER_HEAD_CELL)
+ self.txName = uiMap["arena_rank_cell.tx_name"]
+ self.cellGrading = uiMap["arena_rank_cell.arena_grading_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.ARENA_GRADING_CELL)
+ self.btnFormation = uiMap["arena_rank_cell.btn_formation"]
+
+ self.btnFormation:addClickListener(function()
+ if DataManager.ArenaData:hasRankFormation() then
+ self:showHeroFormationTips()
+ else
+ self.clickFormation = true
+ ModuleManager.ArenaManager:reqRankHeroes(self.rankInfo.ID)
+ end
+ end)
+ self:bind(DataManager.ArenaData, "isDirty", function()
+ if self.clickFormation then
+ self:showHeroFormationTips()
+ end
+ end)
+end
+
+function ArenaRankCell:refresh(rank)
+ self.clickFormation = false
+ self.rankInfo = DataManager.ArenaData:getRankData(rank)
+
+ self.playerHeadCell:refresh(self.rankInfo.avatar, self.rankInfo.avatar_frame)
+ self.txRank:setText(self.rankInfo.rank)
+ self.txName:setText(rank)
+ self.cellGrading:refresh(DataManager.ArenaData:getGradingIdFromScore(self.rankInfo.score))
+end
+
+function ArenaRankCell:showHeroFormationTips()
+ self.clickFormation = false
+ ModuleManager.TipsManager:showHeroFormation(self.btnFormation, DataManager.ArenaData:getRankFormation(self.rankInfo.ID))
+end
+
+return ArenaRankCell
\ No newline at end of file
diff --git a/lua/app/ui/arena/cell/arena_rank_cell.lua.meta b/lua/app/ui/arena/cell/arena_rank_cell.lua.meta
new file mode 100644
index 00000000..deea12b4
--- /dev/null
+++ b/lua/app/ui/arena/cell/arena_rank_cell.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: fa896f488ffeb9c46b542ce1a6c080fe
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/arena/cell/arena_season_reward_cell.lua b/lua/app/ui/arena/cell/arena_season_reward_cell.lua
new file mode 100644
index 00000000..9c751cac
--- /dev/null
+++ b/lua/app/ui/arena/cell/arena_season_reward_cell.lua
@@ -0,0 +1,28 @@
+local ArenaSeasonRewardCell = class("ArenaSeasonRewardCell", BaseCell)
+
+function ArenaSeasonRewardCell:init()
+ local uiMap = self:getUIMap()
+
+ self.cellGrading = uiMap["arena_reward_cell.arena_grading_cell"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.ARENA_GRADING_CELL)
+ self.rewards = {}
+ for i = 1, 4 do
+ self.rewards[i] = uiMap["arena_reward_cell.rewards.reward_cell_"..i]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
+ end
+end
+
+function ArenaSeasonRewardCell:refresh(id)
+ local rewards = DataManager.ArenaData:getGradingRewardInfo(id)
+
+ for idx, cell in pairs(self.rewards) do
+ if rewards[idx] then
+ cell:setVisible(true)
+ cell:refreshByConfig(rewards[idx])
+ else
+ cell:setVisible(false)
+ end
+
+ end
+ self.cellGrading:refresh(id)
+end
+
+return ArenaSeasonRewardCell
\ No newline at end of file
diff --git a/lua/app/ui/arena/cell/arena_season_reward_cell.lua.meta b/lua/app/ui/arena/cell/arena_season_reward_cell.lua.meta
new file mode 100644
index 00000000..bcde10a0
--- /dev/null
+++ b/lua/app/ui/arena/cell/arena_season_reward_cell.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: eb384b8f81faa034699408a272a77a96
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/common/cell/hero_cell.lua b/lua/app/ui/common/cell/hero_cell.lua
index 8646a464..100967f1 100644
--- a/lua/app/ui/common/cell/hero_cell.lua
+++ b/lua/app/ui/common/cell/hero_cell.lua
@@ -2,19 +2,26 @@ local HeroCell = class("HeroCell", BaseCell)
function HeroCell:init()
local uiMap = self.baseObject:genAllChildren()
+ -- 通用
self.icon = uiMap["hero_cell.hero_bg.icon"]
self.heroBg = uiMap["hero_cell.hero_bg"]
self.heroDec = uiMap["hero_cell.hero_bg.dec"]
self.check = uiMap["hero_cell.hero_bg.mask"]
self.matchImg = uiMap["hero_cell.hero_bg.match_img"]
- self.progressBg = uiMap["hero_cell.hero_bg.progress_bg"]
- self.progress = uiMap["hero_cell.hero_bg.progress"]
- self.progressTx = uiMap["hero_cell.hero_bg.progress_tx"]
self.lvTx = uiMap["hero_cell.hero_bg.lv_tx"]
- self.unlockTx = uiMap["hero_cell.hero_bg.unlock_tx"]
- self.lvUpArrow = uiMap["hero_cell.hero_bg.effect_node.ui_spine_obj"]
- self.fragmenImg = uiMap["hero_cell.hero_bg.progress_bg.fragment_img"]
self.sImg = uiMap["hero_cell.hero_bg.s"]
+ -- 个人节点
+ self.selfNode = uiMap["hero_cell.hero_bg.self_node"]
+ self.progressBg = uiMap["hero_cell.hero_bg.self_node.progress_bg"]
+ self.progress = uiMap["hero_cell.hero_bg.self_node.progress_bg.progress"]
+ self.progressTx = uiMap["hero_cell.hero_bg.self_node.progress_bg.progress_tx"]
+ self.unlockTx = uiMap["hero_cell.hero_bg.self_node.unlock_tx"]
+ self.fragmenImg = uiMap["hero_cell.hero_bg.self_node.progress_bg.fragment_img"]
+ self.lvUpArrow = uiMap["hero_cell.hero_bg.self_node.effect_node.ui_spine_obj"]
+ -- 他人节点
+ self.otherNode = uiMap["hero_cell.hero_bg.other_node"]
+ self.otherTxName = uiMap["hero_cell.hero_bg.other_node.tx_name"]
+
self.isGray = false
self.baseObject:addClickListener(function()
if self.clickCallback then
@@ -23,7 +30,11 @@ function HeroCell:init()
end)
end
+-- 显示自己英雄
function HeroCell:refresh(heroEntity, isGray)
+ self.selfNode:setVisible(true)
+ self.otherNode:setVisible(false)
+
local heroInfo = heroEntity:getConfig()
self:_refresh(heroInfo, isGray)
@@ -70,6 +81,17 @@ function HeroCell:refresh(heroEntity, isGray)
end
end
+--显示其他人英雄
+function HeroCell:refreshBriefInfo(id, level)
+ self.selfNode:setVisible(false)
+ self.otherNode:setVisible(true)
+
+ self:_refresh(ConfigManager:getConfig("hero")[id])
+
+ self.otherTxName:setText(ModuleManager.HeroManager:getHeroName(id))
+ self.lvTx:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, level))
+end
+
function HeroCell:refreshWithCfgId(id, isGray)
local heroInfo = ConfigManager:getConfig("hero")[id]
self:_refresh(heroInfo, isGray)
diff --git a/lua/app/ui/common/cell/large_hero_cell.lua b/lua/app/ui/common/cell/large_hero_cell.lua
index 07931ca5..ccb7372b 100644
--- a/lua/app/ui/common/cell/large_hero_cell.lua
+++ b/lua/app/ui/common/cell/large_hero_cell.lua
@@ -28,11 +28,11 @@ function LargeHeroCell:init()
return
end
self.baseObject:setAnchoredPositionX(OUT_SCREEN_X)
- ModuleManager.FormationManager:upHeroToStageFormation(self.heroId, self.matchType)
+ self.onClickUseFunc(self.heroId, self.matchType)
end)
end
-function LargeHeroCell:refresh(heroEntity, isGray)
+function LargeHeroCell:refresh(heroEntity, isGray, useFunc)
self.heroId = heroEntity:getCfgId()
self.matchType = heroEntity:getMatchType()
local heroInfo = heroEntity:getConfig()
@@ -44,6 +44,7 @@ function LargeHeroCell:refresh(heroEntity, isGray)
str = I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_9)
end
self.infoBtnDesc:setText(str)
+ self.onClickUseFunc = useFunc
end
function LargeHeroCell:refreshWithCfgId(id, isGray)
diff --git a/lua/app/ui/common/component/hero_formation_comp.lua b/lua/app/ui/common/component/hero_formation_comp.lua
index 9bca851e..678940ed 100644
--- a/lua/app/ui/common/component/hero_formation_comp.lua
+++ b/lua/app/ui/common/component/hero_formation_comp.lua
@@ -11,12 +11,11 @@ function HeroFormationComp:init()
uiMap["hero_formation_comp.hero_cell_4"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
uiMap["hero_formation_comp.hero_cell_5"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_CELL),
}
+ self:setFormationActive(true)
end
+-- 显示英雄升级/使用等等信息
function HeroFormationComp:refresh()
-
- -- todo 传参控制显示对手还是自己的编队
-
local formation = DataManager.FormationData:getStageFormation()
for i, heroCell in ipairs(self.heroCells) do
if formation[i] then
@@ -36,8 +35,21 @@ function HeroFormationComp:refresh()
end
end
-function HeroFormationComp:setFormationVisible(visible)
- self.baseObject:setVisible(visible)
+-- 显示英雄等级/名称/品级信息
+-- formation = {{id = 000, level=000},{id = 000, level=000}, ...}
+function HeroFormationComp:refreshBriefInfo(formation)
+ for i, heroCell in ipairs(self.heroCells) do
+ if formation[i] then
+ heroCell:setVisible(true, 1)
+ heroCell:refreshBriefInfo(formation[i].id, formation[i].level)
+ else
+ heroCell:setVisible(false)
+ end
+ end
+end
+
+function HeroFormationComp:setFormationActive(active)
+ self.baseObject:setActive(active)
end
function HeroFormationComp:getFormationPosY()
diff --git a/lua/app/ui/currency_bar/cell/currency_cell.lua b/lua/app/ui/currency_bar/cell/currency_cell.lua
index 9400eab4..337093a8 100644
--- a/lua/app/ui/currency_bar/cell/currency_cell.lua
+++ b/lua/app/ui/currency_bar/cell/currency_cell.lua
@@ -47,6 +47,11 @@ function ResourceCell:show(itemId, hideAddImg)
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_SHOP, {page = GConst.ShopConst.PAGE_TYPE.MAIN, subType = GConst.ShopConst.MAIN_PAGE_TYPE.GEM})
end)
self.addImg:setVisible(true)
+ elseif itemId == GConst.ItemConst.ITEM_ID_ARENA_TICKET then
+ self.baseObject:addClickListener(function()
+ ModuleManager.CommerceManager:showBuyArenaTicketUI()
+ end)
+ self.addImg:setVisible(true)
else
self.baseObject:removeClickListener()
self.addImg:setVisible(false)
diff --git a/lua/app/ui/hero/hero_comp.lua b/lua/app/ui/hero/hero_comp.lua
index b8245e12..37b52d65 100644
--- a/lua/app/ui/hero/hero_comp.lua
+++ b/lua/app/ui/hero/hero_comp.lua
@@ -10,7 +10,7 @@ function HeroComp:init()
return HERO_LIST_CELL
end)
self.scrollRect:addRefreshCallback(function(index, cell)
- cell:refresh(index, self.heroList, self.stageFormation, self.allHeroCount, self.unlockCount, function(cell, heroId)
+ cell:refresh(index, self.heroList, self.curFormation, self.allHeroCount, self.unlockCount, function(cell, heroId)
self:onClickHero(cell, heroId)
end)
end)
@@ -42,6 +42,8 @@ function HeroComp:init()
}
self.heroSpineList = {}
self.largeHeroCell = CellManager:addCellComp(self.uiMap["hero_ui.scrollrect.viewport.content.large_hero_cell"], GConst.TYPEOF_LUA_CLASS.LARGE_HERO_CELL)
+ self.txTitle = self.uiMap["hero_ui.top_bg.title_bg_img.title_tx"]
+ self.rimgTopBG = self.uiMap["hero_ui.top_bg"]
self.content = self.uiMap["hero_ui.scrollrect.viewport.content"]
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
self.content:addClickListener(function()
@@ -50,7 +52,7 @@ function HeroComp:init()
for index, obj in ipairs(self.heroNodeList) do
obj:addClickListener(function()
- local heroId = self.stageFormation[index]
+ local heroId = self.curFormation[index]
if heroId then
local hero = DataManager.HeroData:getHeroById(heroId)
if hero then
@@ -62,21 +64,66 @@ function HeroComp:init()
self.heroBgSpineObj[index]:playAnim("idle", true, false)
end
end
-
- self.uiMap["hero_ui.top_bg.title_bg_img.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.MAIN_BTN_2))
end
-function HeroComp:refresh()
+function HeroComp:refresh(battleType)
+ self.battleType = battleType
+
self:clearAdapt()
self:adapt()
- self.stageFormation = DataManager.FormationData:getStageFormation()
- self:refreshStageFormation()
+ if self.battleType == GConst.BattleConst.FORMATION_TYPE.STAGE then
+ self:refreshStageFormation()
+ elseif self.battleType == GConst.BattleConst.FORMATION_TYPE.ARENA_ATTACK then
+ self:refreshArenaFightFormation()
+ elseif self.battleType == GConst.BattleConst.FORMATION_TYPE.ARENA_DEFEND then
+ self:refreshArenaDefendFormation()
+ end
+end
+
+-- 展示主线章节阵容
+function HeroComp:refreshStageFormation()
+ self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.MAIN_BTN_2))
+ self.rimgTopBG:setTexture("assets/arts/textures/background/hero/hero_bg_1.png")
+ self.curFormation = DataManager.FormationData:getStageFormation()
+
+ self.onClickUseFunc = function(id, type)
+ ModuleManager.FormationManager:upHeroToStageFormation(id, type)
+ end
+
self:refreshScrollRect()
end
-function HeroComp:refreshStageFormation()
+-- 展示竞技场进攻阵容
+function HeroComp:refreshArenaFightFormation()
+ self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_10))
+ self.rimgTopBG:setTexture("assets/arts/textures/background/arena/arena_bg_2.png")
+ self.curFormation = DataManager.FormationData:getArenaAttackFormation()
+
+ self.onClickUseFunc = function(id, type)
+ DataManager.FormationData:upHeroToFormation(self.battleType, type, id)
+ self:refreshArenaFightFormation()
+ end
+
+ self:refreshScrollRect()
+end
+
+-- 展示竞技场防守阵容
+function HeroComp:refreshArenaDefendFormation()
+ self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_9))
+ self.rimgTopBG:setTexture("assets/arts/textures/background/arena/arena_bg_2.png")
+ self.curFormation = DataManager.FormationData:getArenaDefendFormation()
+
+ self.onClickUseFunc = function(id, type)
+ DataManager.FormationData:upHeroToFormation(self.battleType, type, id)
+ self:refreshArenaDefendFormation()
+ end
+
+ self:refreshScrollRect()
+end
+
+function HeroComp:refreshScrollRect()
for i = 1, 5 do
- local heroId = self.stageFormation[i]
+ local heroId = self.curFormation[i]
local hero = DataManager.HeroData:getHeroById(heroId)
if hero and hero:getLv() > 0 then
self.heroAddImgList[i]:setVisible(false)
@@ -85,7 +132,7 @@ function HeroComp:refreshStageFormation()
self.heroSpineList[i]:playAnimation("idle", true)
else
SpineManager:loadHeroAsync(hero:getModelId(), self.heroNodeList[i], function(spineObject)
- if heroId ~= self.stageFormation[i] then
+ if heroId ~= self.curFormation[i] then
return
end
if self.heroSpineList[i] then
@@ -104,9 +151,7 @@ function HeroComp:refreshStageFormation()
end
end
end
-end
-function HeroComp:refreshScrollRect()
self:sortHeroList()
self.allHeroCount = #self.heroList
self.unlockCount = DataManager.HeroData:getUnlockHeroCount()
@@ -164,14 +209,14 @@ function HeroComp:onClickHero(cell, heroId)
local entity = DataManager.HeroData:getHeroById(heroId)
if entity then
- if entity:isActived() and not DataManager.FormationData:heroInFormation(GConst.BattleConst.BATTLE_TYPE.STAGE, heroId) then
+ if entity:isActived() and not DataManager.FormationData:heroInFormation(self.battleType, heroId) then
local targetPos = cell:getBaseObject():getTransform().position
local sPoint = UIManager:getUICameraComponent():WorldToScreenPoint(targetPos)
targetPos = CS.BF.Utils.RectTransformScreenPointToLocalPointInRectangle(self.content:getTransform(), sPoint.x, sPoint.y, UIManager:getUICameraComponent())
self.largeHeroCell:getBaseObject():setAnchoredPosition(targetPos.x, targetPos.y)
self.largeHeroCell:getBaseObject():getTransform():SetAsLastSibling()
- self.largeHeroCell:refresh(entity, not entity:isActived())
- self.largeHeroCell:showCheck(self.stageFormation[entity:getMatchType()] == heroId)
+ self.largeHeroCell:refresh(entity, not entity:isActived(), self.onClickUseFunc)
+ self.largeHeroCell:showCheck(self.curFormation[entity:getMatchType()] == heroId)
else
ModuleManager.HeroManager:showHeroDetailUI(heroId)
self.largeHeroCell:getBaseObject():setAnchoredPositionX(OUT_SCREEN_X)
diff --git a/lua/app/ui/main_city/cell/side_bar_introduct_gift_cell.lua b/lua/app/ui/main_city/cell/side_bar_introduct_gift_cell.lua
new file mode 100644
index 00000000..47a63b55
--- /dev/null
+++ b/lua/app/ui/main_city/cell/side_bar_introduct_gift_cell.lua
@@ -0,0 +1,46 @@
+local SideBarBaseCellComp = require "app/ui/main_city/cell/side_bar_base_cell"
+local SideBarIntroductGiftCell = class("SideBarIntroductGiftCell", SideBarBaseCellComp)
+
+function SideBarIntroductGiftCell:getModuleKey()
+ return ModuleManager.MODULE_KEY.INTRODUCT_GIFT
+end
+
+function SideBarIntroductGiftCell:getIsOpen()
+ return DataManager.ShopData:getIntroductGiftShowSideBar()
+end
+
+function SideBarIntroductGiftCell:getSpineName()
+ return "main_btn_gift_new"
+end
+
+function SideBarIntroductGiftCell:onClick()
+ ModuleManager.ShopManager:showGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.INTRODUCT_GIFT_ID, true)
+end
+
+function SideBarIntroductGiftCell:getIsShowRedPoint()
+ return false
+end
+
+function SideBarIntroductGiftCell:onRefresh()
+ self.timeBg:setVisible(true)
+ self:_refreshTime()
+end
+
+function SideBarIntroductGiftCell:updateTime()
+ if self:getIsOpen() then
+ self:_refreshTime()
+ else
+ self:closeBtn()
+ end
+end
+
+function SideBarIntroductGiftCell:_refreshTime()
+ local remainTime = DataManager.ShopData:getIntroductGiftRemainTime()
+ if remainTime >= 0 then
+ self.timeTx:setText(GFunc.getTimeStr(remainTime))
+ else
+ self.timeTx:setText("00:00:00")
+ end
+end
+
+return SideBarIntroductGiftCell
\ No newline at end of file
diff --git a/lua/app/ui/main_city/cell/side_bar_introduct_gift_cell.lua.meta b/lua/app/ui/main_city/cell/side_bar_introduct_gift_cell.lua.meta
new file mode 100644
index 00000000..3914613c
--- /dev/null
+++ b/lua/app/ui/main_city/cell/side_bar_introduct_gift_cell.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: c8bc1461168b10444b874ff8cdd0c025
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/main_city/component/arena_comp.lua b/lua/app/ui/main_city/component/arena_comp.lua
new file mode 100644
index 00000000..466fc321
--- /dev/null
+++ b/lua/app/ui/main_city/component/arena_comp.lua
@@ -0,0 +1,146 @@
+local MainCompBaseCell = require "app/ui/main_city/component/main_comp_base_cell"
+local ArenaComp = class("ArenaComp", MainCompBaseCell)
+
+function ArenaComp:getIsOpen()
+ return DataManager.ArenaData:isOpen()
+end
+
+function ArenaComp:getEntranceName()
+ return I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_1)
+end
+
+function ArenaComp:getFightDesc()
+ return I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_2)
+end
+
+function ArenaComp:onClickFight()
+ UIManager:showUI("app/ui/arena/arena_match_ui")
+end
+
+function ArenaComp:getShowEntranceRedPoint()
+ return DataManager.ArenaData:hasEntranceRedDot()
+end
+
+function ArenaComp:ctor()
+end
+
+function ArenaComp:init()
+ local uiMap = self:getBaseObject():genAllChildren()
+
+ self.txSeason = uiMap["arena_comp.tx_season"]
+ self.txTitle = uiMap["arena_comp.tx_title"]
+ self.txCountdown = uiMap["arena_comp.countdown.tx_time"]
+ self.txGarding = uiMap["arena_comp.tx_garding"]
+ self.imgGarding = uiMap["arena_comp.img_garding"]
+ self.imgProg = uiMap["arena_comp.prog.img_prog"]
+ self.txProg = uiMap["arena_comp.prog.tx_prog"]
+ self.btnHelp = uiMap["arena_comp.tx_season.btn_help"]
+ self.btnRecord = uiMap["arena_comp.btn_record"]
+ self.txRecord = uiMap["arena_comp.btn_record.tx_record"]
+ self.btnFormation = uiMap["arena_comp.btn_formation"]
+ self.txFormation = uiMap["arena_comp.btn_formation.tx_formation"]
+ self.btnReward = uiMap["arena_comp.btn_reward"]
+ self.txReward = uiMap["arena_comp.btn_reward.tx_reward"]
+ self.btnRank = uiMap["arena_comp.btn_rank"]
+ self.txRank = uiMap["arena_comp.btn_rank.tx_rank"]
+
+ self.txTitle:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_4))
+ self.txRecord:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_7))
+ self.txFormation:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_9))
+ self.txReward:setText(I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC))
+ self.txRank:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_5))
+
+ self.btnHelp:addClickListener(function()
+ ModuleManager.TipsManager:showDescTips(DataManager.DungeonData:getRule(self.moduleKey), self.btnHelp)
+ end)
+ self.btnRecord:addClickListener(function()
+ UIManager:showUI("app/ui/arena/arena_recent_battle_ui")
+ end)
+ self.btnFormation:addClickListener(function()
+ UIManager:showUI("app/ui/arena/arena_formation_ui", GConst.BattleConst.FORMATION_TYPE.ARENA_DEFEND)
+ end)
+ self.btnReward:addClickListener(function()
+ UIManager:showUI("app/ui/arena/arena_season_reward_ui")
+ end)
+ self.btnRank:addClickListener(function()
+ UIManager:showUI("app/ui/arena/arena_rank_ui")
+ end)
+ self:initBounty()
+ self:refreshShow()
+end
+
+function ArenaComp:initBounty()
+ local uiMap = self:getBaseObject():genAllChildren()
+
+ self.bountyNode = uiMap["arena_comp.bounty_node"]
+ self.bountyBanner = uiMap["arena_comp.bounty_node.banner"]
+ self.bountyBanner:addClickListener(function()
+ ModuleManager.ArenaBountyManager:showBountyMainUI()
+ end)
+ self.bountyRewardSpine = uiMap["arena_comp.bounty_node.banner.spine"]
+ self.bountyBannerInfo = uiMap["arena_comp.bounty_node.banner.info"]
+ self.bountyBannerDescTx = uiMap["arena_comp.bounty_node.banner.desc"]
+ self.bountyBannerSlider = uiMap["arena_comp.bounty_node.banner.info.progress_bg.slider"]
+ self.bountyBannerSliderTx = uiMap["arena_comp.bounty_node.banner.info.progress_bg.slider_tx"]
+ self.bountyBannerLvTx = uiMap["arena_comp.bounty_node.banner.info.progress_bg.lv_tx"]
+ uiMap["arena_comp.bounty_node.banner.info.name"]:setText(I18N:getGlobalText(I18N.GlobalConst.BOUNTY_TITLE))
+end
+
+function ArenaComp:refreshBounty()
+ if DataManager.ArenaBountyData:getIfCanClaimReward() then
+ self.bountyRewardSpine:setVisible(true)
+ self.bountyRewardSpine:playAnim("idle", true)
+ self.bountyRewardSpine:getSkeletonGraphic().enabled = true
+ self.bountyBannerInfo:setVisible(false)
+ self.bountyBannerDescTx:setText(I18N:getGlobalText(I18N.GlobalConst.COLLET_REWARDS))
+ else
+ self.bountyRewardSpine:setVisible(false)
+ self.bountyRewardSpine:getSkeletonGraphic().enabled = false
+ local bannerName = DataManager.ArenaBountyData:getBannerName()
+ self.bountyBanner:setSprite(GConst.ATLAS_PATH.BOUNTY, bannerName)
+ self.bountyBannerInfo:setVisible(true)
+ self.bountyBannerDescTx:setText(GConst.EMPTY_STRING)
+ local exp = DataManager.ArenaBountyData:getExp()
+ local lvUpExp = DataManager.ArenaBountyData:getLvUpExp()
+ local level = DataManager.ArenaBountyData:getLevel()
+ local maxLevel = DataManager.ArenaBountyData:getMaxLevel()
+ self.bountyBannerSliderTx:setText(exp .. "/" .. lvUpExp)
+ self.bountyBannerSlider:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = exp / lvUpExp
+ if level >= maxLevel then
+ self.bountyBannerLvTx:setText(I18N:getGlobalText(I18N.GlobalConst.STR_MAX))
+ else
+ self.bountyBannerLvTx:setText(tostring(level))
+ end
+ end
+end
+
+function ArenaComp:refreshShow()
+ local maxScore = DataManager.ArenaData:getGradingScoreTotal()
+ local curScore = DataManager.ArenaData:getGradingScore()
+ self.txSeason:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_3, DataManager.ArenaData:getSeason()))
+ self.txGarding:setText(DataManager.ArenaData:getGradingName(DataManager.ArenaData:getGradingId()))
+ self.txProg:setText(curScore.."/"..maxScore)
+ self.imgProg:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = curScore/maxScore
+
+ self.seasonChangeCD = DataManager.ArenaData:getRemainSeasonTime()
+ if self.seasonChangeSid then
+ ModuleManager.BattleManager:unscheduleGlobal(self.seasonChangeSid)
+ end
+ self.seasonChangeSid = self.txCountdown:scheduleGlobal(function()
+ self:refreshCountdown()
+ end, 1)
+
+ self:refreshBounty() -- 刷新战令
+end
+
+function ArenaComp:refreshCountdown()
+ self.seasonChangeCD = self.seasonChangeCD - 1
+ if self.seasonChangeCD < 0 then
+ ModuleManager.ArenaManager:onSeasonChanged()
+ return
+ end
+
+ self.txCountdown:setText(Time:formatNumTimeStr(self.seasonChangeCD))
+end
+
+return ArenaComp
\ No newline at end of file
diff --git a/lua/app/ui/main_city/component/arena_comp.lua.meta b/lua/app/ui/main_city/component/arena_comp.lua.meta
new file mode 100644
index 00000000..bead850c
--- /dev/null
+++ b/lua/app/ui/main_city/component/arena_comp.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 4ed7562a967f4424f900ab045362eae1
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/main_city/component/chapter_comp.lua b/lua/app/ui/main_city/component/chapter_comp.lua
index 7f5d55f3..75dca4b3 100644
--- a/lua/app/ui/main_city/component/chapter_comp.lua
+++ b/lua/app/ui/main_city/component/chapter_comp.lua
@@ -15,15 +15,23 @@ function ChapterComp:getEntranceName()
return I18N:getGlobalText(I18N.GlobalConst.MAIN_CHAPTER)
end
-function ChapterComp:getEntranceIcon()
- return GConst.ATLAS_PATH.MAIN,"main_dec_5"
+function ChapterComp:isShowTopNode()
+ return true
end
-function ChapterComp:getEntranceBg()
- return GConst.ATLAS_PATH.MAIN,"main_btn_ringt"
+function ChapterComp:isShowSideBar()
+ return true
end
-function ChapterComp:getHpCost()
+function ChapterComp:isShowBounty()
+ return true
+end
+
+function ChapterComp:isShowHeroFormation()
+ return true
+end
+
+function ChapterComp:getFightHpCost()
return DataManager.ChapterData:getFightCost()
end
diff --git a/lua/app/ui/main_city/component/daily_challenge_comp.lua b/lua/app/ui/main_city/component/daily_challenge_comp.lua
index 038c0a81..b144e7d1 100644
--- a/lua/app/ui/main_city/component/daily_challenge_comp.lua
+++ b/lua/app/ui/main_city/component/daily_challenge_comp.lua
@@ -9,23 +9,27 @@ function DailyChallengeComp:getEntranceName()
return I18N:getGlobalText(I18N.GlobalConst.DAILY_CHALLENGE)
end
-function DailyChallengeComp:getEntranceIcon()
- return GConst.ATLAS_PATH.MAIN,"main_dec_1"
-end
-
-function DailyChallengeComp:getEntranceBg()
- return GConst.ATLAS_PATH.MAIN,"main_btn_ligth"
-end
-
function DailyChallengeComp:getShowEntranceRedPoint()
return DataManager.DailyChallengeData:isMeetChallenge()
end
-function DailyChallengeComp:getHpCost()
+function DailyChallengeComp:isShowTopNode()
+ return true
+end
+
+function DailyChallengeComp:isShowSideBar()
+ return true
+end
+
+function DailyChallengeComp:isShowHeroFormation()
+ return true
+end
+
+function DailyChallengeComp:getFightHpCost()
return DataManager.DailyChallengeData:getChallengeHpCost()
end
-function DailyChallengeComp:getTodayRemainCount()
+function DailyChallengeComp:getFightTodayRemainCount()
return DataManager.DailyChallengeData:getTodayRemainLimitCount()
end
diff --git a/lua/app/ui/main_city/component/dungeon_comp.lua b/lua/app/ui/main_city/component/dungeon_comp.lua
index 847cb46e..7baa4c17 100644
--- a/lua/app/ui/main_city/component/dungeon_comp.lua
+++ b/lua/app/ui/main_city/component/dungeon_comp.lua
@@ -9,14 +9,6 @@ function DungeonComp:getEntranceName()
return I18N:getGlobalText(I18N.GlobalConst.DUNGEON_BTN)
end
-function DungeonComp:getEntranceIcon()
- return GConst.ATLAS_PATH.MAIN,"main_dec_2"
-end
-
-function DungeonComp:getEntranceBg()
- return GConst.ATLAS_PATH.MAIN,"main_btn_ringt"
-end
-
function DungeonComp:getShowEntranceRedPoint()
return DataManager.DungeonData:isCanChallengeAnyone()
end
diff --git a/lua/app/ui/main_city/component/main_comp.lua b/lua/app/ui/main_city/component/main_comp.lua
index 7074280a..064d5422 100644
--- a/lua/app/ui/main_city/component/main_comp.lua
+++ b/lua/app/ui/main_city/component/main_comp.lua
@@ -2,6 +2,7 @@ local MainComp = class("MainComp", LuaComponent)
local CHAPTER_COMP = "app/ui/main_city/component/chapter_comp"
local DAILY_CHALLENGE_COMP = "app/ui/main_city/component/daily_challenge_comp"
local DUNGEON_COMP = "app/ui/main_city/component/dungeon_comp"
+local ARENA_COMP = "app/ui/main_city/component/arena_comp"
local BOTTOM_HEIGHT = 120
@@ -30,12 +31,35 @@ function MainComp:refreshModule(selectModule)
self.dungeonComp = CellManager:addCellComp(dungeonComp, DUNGEON_COMP)
self.dungeonComp:initWithParentUI(self)
self.moduleMap[GConst.MainCityConst.MAIN_MODULE.DUNGEON] = self.dungeonComp
+ -- 竞技场
+ local arenaComp = self.uiMap["main_comp.arena_comp"]
+ self.arenaComp = CellManager:addCellComp(arenaComp, ARENA_COMP)
+ self.arenaComp:initWithParentUI(self)
+ self.moduleMap[GConst.MainCityConst.MAIN_MODULE.ARENA] = self.arenaComp
end
+ -- 左侧活动入口
+ if not self.leftEntrance then
+ self.uiMap["main_comp.left"]:setAnchoredPositionY(self.btnPosY)
+
+ self.leftEntrance = {}
+ self.leftEntrance[GConst.MainCityConst.MAIN_MODULE.CHAPTER] = self.uiMap["main_comp.left.chapter"]
+ self.leftEntrance[GConst.MainCityConst.MAIN_MODULE.ARENA] = self.uiMap["main_comp.left.arena"]
+ self.leftEntrance[GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE] = self.uiMap["main_comp.left.daily_challenge"]
+ end
+
+ -- 右侧活动入口
+ if not self.rightEntrance then
+ self.uiMap["main_comp.right"]:setAnchoredPositionY(self.btnPosY)
+
+ self.rightEntrance = {}
+ self.rightEntrance[GConst.MainCityConst.MAIN_MODULE.CHAPTER] = self.uiMap["main_comp.right.chapter"]
+ self.rightEntrance[GConst.MainCityConst.MAIN_MODULE.DUNGEON] = self.uiMap["main_comp.right.dungeon"]
+ end
+
if self.curModuleType ~= selectModule then
self.curModuleType = selectModule
ModuleManager.MaincityManager:setCurModule(self.curModuleType)
- self:setFormationVisible(true)
if self.curModuleType == GConst.MainCityConst.MAIN_MODULE.CHAPTER then
-- 切换到主线章节
@@ -46,8 +70,8 @@ function MainComp:refreshModule(selectModule)
end
elseif self.curModuleType == GConst.MainCityConst.MAIN_MODULE.DUNGEON then
-- 切换到活动副本
- self:setFormationVisible(false)
end
+ self:refreshHeroFormationVisible()
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CHANGE_MAIN_COMP_MODULE, self.curModuleType)
end
@@ -65,112 +89,197 @@ function MainComp:refreshBtns()
end
function MainComp:refreshFightBtn()
+ if self.fightBtn == nil then
+ self.fightBtn = self.uiMap["main_comp.fight_btn"]
+ -- 体力消耗
+ self.fightCost = self.uiMap["main_comp.fight_btn.cost"]
+ self.costTxDesc = self.uiMap["main_comp.fight_btn.cost.tx_desc"]
+ self.costTxCost = self.uiMap["main_comp.fight_btn.cost.tx_cost"]
+ -- 剩余次数
+ self.countTxNum = self.uiMap["main_comp.fight_btn.tx_count"]
+ -- 按钮文本
+ self.txFight = self.uiMap["main_comp.fight_btn.tx_desc"]
+ end
+
local moduleCell = self.moduleMap[self.curModuleType]
+ local isShowFight = false
- local cost = moduleCell:getHpCost()
+ -- 体力消耗
+ local cost = moduleCell:getFightHpCost()
if cost then
- self.uiMap["main_comp.fight_btn"]:setActive(true)
- self.uiMap["main_comp.fight_btn"]:addClickListener(moduleCell.onClickFight)
- self.uiMap["main_comp.fight_btn"]:setAnchoredPositionY(self.btnPosY)
- self.uiMap["main_comp.fight_btn.desc"]:setText(I18N:getGlobalText(I18N.GlobalConst.START_DESC))
- self.uiMap["main_comp.fight_btn.desc_2"]:setText(GFunc.getRewardNum(cost))
+ isShowFight = true
+ self.fightCost:setActive(true)
+ self.costTxDesc:setText(I18N:getGlobalText(I18N.GlobalConst.START_DESC))
+ self.costTxCost:setText(GFunc.getRewardNum(cost))
else
- self.uiMap["main_comp.fight_btn"]:setActive(false)
- return
+ self.fightCost:setActive(false)
end
- local remainCount = moduleCell:getTodayRemainCount()
+ -- 剩余次数
+ local remainCount = moduleCell:getFightTodayRemainCount()
if remainCount >= 0 then
- self.uiMap["main_comp.fight_btn.num_tx"]:setActive(true)
- self.uiMap["main_comp.fight_btn.num_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.TODAY_REMAIN_TIMES, remainCount))
+ isShowFight = true
+ self.countTxNum:setActive(true)
+ self.countTxNum:setText(I18N:getGlobalText(I18N.GlobalConst.TODAY_REMAIN_TIMES, remainCount))
else
- self.uiMap["main_comp.fight_btn.num_tx"]:setActive(false)
+ self.countTxNum:setActive(false)
+ end
+
+ -- 按钮描述
+ local fightDesc = moduleCell:getFightDesc()
+ if fightDesc then
+ isShowFight = true
+ self.txFight:setActive(true)
+ self.txFight:setText(fightDesc)
+ self.fightBtn:setSizeDelta(286, 119)
+ else
+ self.txFight:setActive(false)
+ self.fightBtn:setSizeDelta(334, 122)
+ end
+
+ if isShowFight then
+ self.fightBtn:setActive(true)
+ self.fightBtn:addClickListener(moduleCell.onClickFight)
+ self.fightBtn:setAnchoredPositionY(self.btnPosY)
+ else
+ self.fightBtn:setActive(false)
end
end
+-- 刷新左侧活动模块入口
function MainComp:refreshLeftBtn()
- if self.leftBtn == nil then
- self.leftBtn = self.uiMap["main_comp.left_btn"]
- end
- self.leftBtn:setActive(false)
- self.leftBtn:setAnchoredPositionY(self.btnPosY)
- local leftIdx = self:getCurLeftModuleIdx()
- if leftIdx == nil then
- return
- end
- local moduleCell = self.moduleMap[leftIdx]
- if not moduleCell:getIsOpen() then
- return
+ local showCount = 0
+ local leftIdxList = self:getCurLeftModuleIdxList()
+ for module, entrance in pairs(self.leftEntrance) do
+ if leftIdxList ~= nil and table.containValue(leftIdxList, module) then
+ local isShow = self:refreshModuleEntrance(entrance, module, true)
+ if isShow then
+ showCount = showCount + 1
+ end
+ else
+ entrance:setActive(false)
+ end
end
- self.leftBtn:setActive(true)
- local bgAtlas, bgName = moduleCell:getEntranceBg()
- self.uiMap["main_comp.left_btn.bg"]:setSprite(bgAtlas, bgName)
- local iconAtlas, iconName = moduleCell:getEntranceIcon()
- self.uiMap["main_comp.left_btn.desc"]:setText(moduleCell:getEntranceName())
- self.uiMap["main_comp.left_btn.icon"]:setSprite(iconAtlas, iconName, function()
- self.uiMap["main_comp.left_btn.icon"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):SetNativeSize()
- end)
- self.leftBtn:addClickListener(function()
- self:refreshModule(leftIdx)
- end)
- if moduleCell:getShowEntranceRedPoint() then
- self.leftBtn:addRedPoint(65, 35, 0.6)
+ if showCount >= 2 then
+ table.foreach(self.leftEntrance, function(idx, entrance)
+ entrance:setLocalScale(0.8,0.8)
+ end)
else
- self.leftBtn:removeRedPoint()
+ table.foreach(self.leftEntrance, function(idx, entrance)
+ entrance:setLocalScale(1,1)
+ end)
end
end
+-- 刷新右侧活动模块入口
function MainComp:refreshRightBtn()
- if self.rightBtn == nil then
- self.rightBtn = self.uiMap["main_comp.right_btn"]
- end
- self.rightBtn:setActive(false)
- self.rightBtn:setAnchoredPositionY(self.btnPosY)
- local rightIdx = self:getCurRightModuleIdx()
- if rightIdx == nil then
- return
- end
- local moduleCell = self.moduleMap[rightIdx]
- if not moduleCell:getIsOpen() then
- return
+ local showCount = 0
+ local rightIdxList = self:getCurRightModuleIdxList()
+ for module, entrance in pairs(self.rightEntrance) do
+ if rightIdxList ~= nil and table.containValue(rightIdxList, module) then
+ local isShow = self:refreshModuleEntrance(entrance, module, false)
+ if isShow then
+ showCount = showCount + 1
+ end
+ else
+ entrance:setActive(false)
+ end
end
- self.rightBtn:setActive(true)
- local bgAtlas, bgName = moduleCell:getEntranceBg()
- self.uiMap["main_comp.right_btn.bg"]:setSprite(bgAtlas, bgName)
- local iconAtlas, iconName = moduleCell:getEntranceIcon()
- self.uiMap["main_comp.right_btn.desc"]:setText(moduleCell:getEntranceName())
- self.uiMap["main_comp.right_btn.icon"]:setSprite(iconAtlas, iconName, function()
- self.uiMap["main_comp.right_btn.icon"]:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_IMAGE):SetNativeSize()
- end)
- self.rightBtn:addClickListener(function()
- self:refreshModule(rightIdx)
- end)
- if moduleCell:getShowEntranceRedPoint() then
- self.rightBtn:addRedPoint(-65, 35, 0.6)
+ if showCount >= 2 then
+ table.foreach(self.rightEntrance, function(idx, entrance)
+ entrance:setLocalScale(0.8,0.8)
+ end)
else
- self.rightBtn:removeRedPoint()
+ table.foreach(self.rightEntrance, function(idx, entrance)
+ entrance:setLocalScale(1,1)
+ end)
end
end
-function MainComp:getCurLeftModuleIdx()
- if self.curModuleType == 1 then
- return nil
+-- 刷新活动模块入口
+function MainComp:refreshModuleEntrance(entrance, moduleType, isLeft)
+ entrance:setActive(false)
+ local module = self.moduleMap[moduleType]
+ if moduleType == nil or module == nil then
+ return false
+ end
+ if not module:getIsOpen() then
+ return false
end
- return self.curModuleType - 1
+ entrance:setActive(true)
+ local uiMap = entrance:genAllChildren()
+ uiMap["desc"]:setText(module:getEntranceName())
+ -- 竞技场图标显示特殊处理
+ if moduleType == GConst.MainCityConst.MAIN_MODULE.ARENA then
+ local curId = DataManager.ArenaData:getGradingId()
+ uiMap["img_num"]:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getGradingNumName(curId))
+ uiMap["icon"]:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getGradingIconName(curId))
+ end
+
+ if module:getShowEntranceRedPoint() then
+ if isLeft then
+ entrance:addRedPoint(65, 35, 0.6)
+ else
+ entrance:addRedPoint(-65, 35, 0.6)
+ end
+ else
+ entrance:removeRedPoint()
+ end
+ entrance:addClickListener(function()
+ self:refreshModule(moduleType)
+ end)
+ return true
end
-function MainComp:getCurRightModuleIdx()
- local totalModuleNum = table.nums(GConst.MainCityConst.MAIN_MODULE)
- if self.curModuleType == totalModuleNum then
+-- 获取当前左侧活动type list
+function MainComp:getCurLeftModuleIdxList()
+ if self.curModuleType < GConst.MainCityConst.MAIN_MODULE.CHAPTER then
return nil
end
- return self.curModuleType + 1
+ local leftIdx = {}
+ if self.curModuleType == GConst.MainCityConst.MAIN_MODULE.CHAPTER then
+ for module, idx in pairs(GConst.MainCityConst.MAIN_MODULE) do
+ if idx < GConst.MainCityConst.MAIN_MODULE.CHAPTER then
+ table.insert(leftIdx, idx)
+ end
+ end
+ table.sort(leftIdx, function(a, b)
+ return math.abs(a) < math.abs(b)
+ end)
+ else
+ table.insert(leftIdx, GConst.MainCityConst.MAIN_MODULE.CHAPTER)
+ end
+
+ return leftIdx
+end
+
+-- 获取当前右侧活动type list
+function MainComp:getCurRightModuleIdxList()
+ if self.curModuleType > GConst.MainCityConst.MAIN_MODULE.CHAPTER then
+ return nil
+ end
+
+ local rightIdx = {}
+ if self.curModuleType == GConst.MainCityConst.MAIN_MODULE.CHAPTER then
+ for module, idx in pairs(GConst.MainCityConst.MAIN_MODULE) do
+ if idx > GConst.MainCityConst.MAIN_MODULE.CHAPTER then
+ table.insert(rightIdx, idx)
+ end
+ end
+ table.sort(rightIdx, function(a, b)
+ return math.abs(a) < math.abs(b)
+ end)
+ else
+ table.insert(rightIdx, GConst.MainCityConst.MAIN_MODULE.CHAPTER)
+ end
+
+ return rightIdx
end
function MainComp:initStageFormation()
@@ -182,8 +291,8 @@ function MainComp:initStageFormation()
self.btnPosY = (heroBgPosY + (BOTTOM_HEIGHT / 2 - hSHeight)) / 2
end
-function MainComp:setFormationVisible(visible)
- self.heroCells:setFormationVisible(visible)
+function MainComp:refreshHeroFormationVisible()
+ self.heroCells:setFormationActive(self.moduleMap[self.curModuleType]:isShowHeroFormation())
end
function MainComp:refresh()
@@ -196,6 +305,10 @@ function MainComp:getCurModuleType()
return self.curModuleType
end
+function MainComp:getCurModule()
+ return self.moduleMap[self.curModuleType]
+end
+
function MainComp:refreshChapter(force)
self.chapterComp:refreshChapter(force)
end
@@ -212,14 +325,23 @@ end
function MainComp:refreshStageFormaion()
self.heroCells:refresh()
+ self:refreshHeroFormationVisible()
end
function MainComp:getDailyChallengeIconPos()
- if self:getCurLeftModuleIdx() == GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE then
- return self.leftBtn:getPosition()
+ local idx = table.indexof(self:getCurLeftModuleIdxList(), GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE)
+ if idx and self.leftEntrance[idx] then
+ return self.leftEntrance[idx]:getPosition()
end
- if self:getCurRightModuleIdx() == GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE then
- return self.rightBtn:getPosition()
+ idx = table.indexof(self:getCurRightModuleIdxList(), GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE)
+ if idx and self.rightEntrance[idx] then
+ return self.rightEntrance[idx]:getPosition()
+ end
+end
+
+function MainComp:refreshArenaBounty()
+ if self.arenaComp then
+ self.arenaComp:refreshBounty()
end
end
diff --git a/lua/app/ui/main_city/component/main_comp_base_cell.lua b/lua/app/ui/main_city/component/main_comp_base_cell.lua
index 5ade76df..b319a207 100644
--- a/lua/app/ui/main_city/component/main_comp_base_cell.lua
+++ b/lua/app/ui/main_city/component/main_comp_base_cell.lua
@@ -11,26 +11,45 @@ function MainCompBaseCell:getEntranceName()
return ""
end
-function MainCompBaseCell:getEntranceIcon()
- return "",""
-end
-
-function MainCompBaseCell:getEntranceBg()
- return "",""
-end
-
function MainCompBaseCell:getShowEntranceRedPoint()
return false
end
-function MainCompBaseCell:getHpCost()
- return nil-- 默认不显示挑战按钮
+-- 是否展示顶部任务、设置按钮
+function MainCompBaseCell:isShowTopNode()
+ return false
end
-function MainCompBaseCell:getTodayRemainCount()
+-- 是否展示侧边栏
+function MainCompBaseCell:isShowSideBar()
+ return false
+end
+
+-- 是否展示战令入口
+function MainCompBaseCell:isShowBounty()
+ return false
+end
+
+-- 是否展示英雄编队
+function MainCompBaseCell:isShowHeroFormation()
+ return false
+end
+
+-- 中间按钮展示体力消耗
+function MainCompBaseCell:getFightHpCost()
+ return nil
+end
+
+-- 中间按钮展示剩余次数
+function MainCompBaseCell:getFightTodayRemainCount()
return -1
end
+-- 中间按钮展示描述
+function MainCompBaseCell:getFightDesc()
+ return nil
+end
+
function MainCompBaseCell:onClickFight()
end
diff --git a/lua/app/ui/main_city/main_city_ui.lua b/lua/app/ui/main_city/main_city_ui.lua
index 79c51e0b..91e35371 100644
--- a/lua/app/ui/main_city/main_city_ui.lua
+++ b/lua/app/ui/main_city/main_city_ui.lua
@@ -137,10 +137,12 @@ function MainCityUI:_addListeners()
ModuleManager.MailManager:getTriggeredTimeMail()
end, time)
end)
- self:addEventListener(EventManager.CUSTOM_EVENT.TUTORIAL_TASK_STOP, function()
- -- 引导完成时 检测主界面的弹窗是否要触发
- self:checkGift()
- end)
+ -- self:addEventListener(EventManager.CUSTOM_EVENT.TUTORIAL_TASK_STOP, function()
+ -- -- 引导完成时 检测主界面的弹窗是否要触发
+ -- if not self:checkTutorial(true) then
+ -- self:checkGift()
+ -- end
+ -- end)
self:addEventListener(EventManager.CUSTOM_EVENT.GO_SHOP, function(params)
if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.MALL, false) then
local page = params and params.page or GConst.ShopConst.PAGE_TYPE.MAIN -- 默认主要商品
@@ -188,14 +190,14 @@ function MainCityUI:_bind()
end, true)
self:bind(DataManager.FormationData, "dirty", function(binder, value)
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.HERO then
- self.subComps[self.selectedIndex]:refresh()
+ self.subComps[self.selectedIndex]:refresh(GConst.BattleConst.BATTLE_TYPE.STAGE)
end
end)
self:bind(DataManager.HeroData, "isDirty", function(binder, value)
if self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.HERO then
if self.subComps[self.selectedIndex] then
- self.subComps[self.selectedIndex]:refresh()
+ self.subComps[self.selectedIndex]:refresh(GConst.BattleConst.BATTLE_TYPE.STAGE)
end
self:refreshBottomRp()
elseif self.selectedIndex == GConst.MainCityConst.BOTTOM_PAGE.MAIN then
@@ -221,6 +223,9 @@ function MainCityUI:_bind()
self:bind(DataManager.BountyData, "dirty", function()
self:refreshBounty()
end)
+ self:bind(DataManager.ArenaBountyData, "dirty", function()
+ self:refreshArenaBounty()
+ end)
self:bind(DataManager.MailData, "redPoint", function()
self:refreshSettingBtn()
@@ -660,7 +665,7 @@ end
function MainCityUI:refreshBounty()
local isOpen = DataManager.BountyData:getIsOpen()
- if not isOpen or self.mainComp:getCurModuleType() == GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE or GFunc.isShenhe() then
+ if not isOpen or not self.mainComp:getCurModule():isShowBounty() or GFunc.isShenhe() then
self.bountyNode:setVisible(false)
self.bountyRewardSpine:getSkeletonGraphic().enabled = false
return
@@ -693,6 +698,12 @@ function MainCityUI:refreshBounty()
end
end
+function MainCityUI:refreshArenaBounty()
+ if self.mainComp then
+ self.mainComp:refreshArenaBounty()
+ end
+end
+
function MainCityUI:refreshTask()
local isOpen = DataManager.DailyTaskData:getIsOpen()
if not isOpen then
@@ -715,9 +726,13 @@ function MainCityUI:switchComp(index)
if i == index then
if index == GConst.MainCityConst.BOTTOM_PAGE.SHOP then
comp:clearPostFlag()
+ comp:refresh()
+ elseif index == GConst.MainCityConst.BOTTOM_PAGE.HERO then
+ comp:refresh(GConst.BattleConst.BATTLE_TYPE.STAGE)
+ else
+ comp:refresh()
end
- comp:refresh()
-
+
self:updateTime()
end
end
@@ -738,17 +753,10 @@ function MainCityUI:switchMainCompModule(moduleKey)
return
end
- if moduleKey == nil then
- moduleKey = self.subComps[self.selectedIndex]:getCurModuleType()
- end
-
- if moduleKey == GConst.MainCityConst.MAIN_MODULE.DUNGEON then
- -- 活动副本切换刷新
- self:setTopNodeVisible(false)
- self:setSideBarVisible(false)
- else
- self:setTopNodeVisible(true)
- self:setSideBarVisible(true)
+ local module = self.mainComp:getCurModule()
+ if module then
+ self:setTopNodeVisible(module:isShowTopNode())
+ self:setSideBarVisible(module:isShowSideBar())
self:refreshBounty()
end
end
@@ -971,39 +979,39 @@ function MainCityUI:checkMainPop()
end
-- 检查引导
-function MainCityUI:checkTutorial()
+function MainCityUI:checkTutorial(onlyCheck)
if DataManager.ChapterData:getMaxChapterId() == 1 then
- if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.PASS_ONE_CHAPTER) then
+ if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.PASS_ONE_CHAPTER, onlyCheck) then
return true
end
end
if DataManager.ChapterData:boxCanGet(2, 1) then
- if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.TWO_CHAPTER_BOX_CAN_GOT) then
+ if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.TWO_CHAPTER_BOX_CAN_GOT, onlyCheck) then
return true
end
end
if DataManager.ChapterData:getMaxChapterId() == 2 then
- if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.PASS_THREE_CHAPTER) then
+ if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.PASS_THREE_CHAPTER, onlyCheck) then
return true
end
end
if DataManager.DailyChallengeData:isOpen() then
- if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.UNLOCK_DAILY_CHALLENGE) then
+ if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.UNLOCK_DAILY_CHALLENGE, onlyCheck) then
return true
end
end
if DataManager.DungeonData:isOpenAnyone() then
- if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.UNLOCK_DUNGEON) then
+ if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.UNLOCK_DUNGEON, onlyCheck) then
return true
end
end
end
--- 检查礼包(首充/章节/新手/助力/成长/金币顺序)
+-- 检查礼包(首充(作废)/入门/章节/新手/助力/成长/金币顺序)
function MainCityUI:checkGift()
-- 审核模式不弹礼包
if GFunc.isShenhe() then
@@ -1023,6 +1031,7 @@ function MainCityUI:checkGift()
local beginnerGiftIds
local levelUpGiftIds
local firstRechargeIds
+ local introductGiftIds
local actPopUpGifts = DataManager.ShopData:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.ACT_GIFT)
if actPopUpGifts and #actPopUpGifts > 0 then
-- 先遍历找出符合弹出的类型
@@ -1050,6 +1059,13 @@ function MainCityUI:checkGift()
end
table.insert(firstRechargeIds, actId)
end
+ -- 入门礼包
+ if cfgInfo.type == PayManager.PURCHARSE_ACT_TYPE.INTRODUCTORY_GIFT then
+ if not introductGiftIds then
+ introductGiftIds = {}
+ end
+ table.insert(introductGiftIds, actId)
+ end
end
end
end
@@ -1057,8 +1073,13 @@ function MainCityUI:checkGift()
local growUpPopUpGifts = DataManager.ShopData:getPopUpGiftByType(PayManager.PURCHARSE_TYPE.GROW_UP_GIFT)
-- 按顺序弹出(首充/章节/新手/助力/成长/金币顺序)
-- 首充礼包
- if firstRechargeIds and #firstRechargeIds > 0 then
- ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, firstRechargeIds[1])
+ -- if firstRechargeIds and #firstRechargeIds > 0 then
+ -- ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, firstRechargeIds[1])
+ -- return true
+ -- end
+ -- 入门礼包
+ if introductGiftIds and #introductGiftIds > 0 then
+ ModuleManager.ShopManager:triggerGiftPopUI(PayManager.PURCHARSE_TYPE.ACT_GIFT, introductGiftIds[1])
return true
end
-- 章节礼包
diff --git a/lua/app/ui/shop/introduct_pop_ui.lua b/lua/app/ui/shop/introduct_pop_ui.lua
new file mode 100644
index 00000000..ac66fdd4
--- /dev/null
+++ b/lua/app/ui/shop/introduct_pop_ui.lua
@@ -0,0 +1,95 @@
+local IntroductPopUI = class("IntroductPopUI", BaseUI)
+local MAX_ITEM_NUM = 3
+
+function IntroductPopUI:ctor()
+end
+
+function IntroductPopUI:isFullScreen()
+ return false
+end
+
+function IntroductPopUI:getPrefabPath()
+ return "assets/prefabs/ui/shop/introduct_pop_ui.prefab"
+end
+
+function IntroductPopUI:onPressBackspace()
+ self:closeUI()
+end
+
+function IntroductPopUI:onLoadRootComplete()
+ self.uiMap = self.root:genAllChildren()
+ self.uiMap["introduct_pop_ui.close_btn"]:addClickListener(function()
+ self:closeUI()
+ end)
+
+ self.titleTx = self.uiMap["introduct_pop_ui.bg.title_bg.title"]
+ self.titleTx:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_38)) -- 入门礼包
+
+ self.rewardCellList = {}
+ for i = 1, MAX_ITEM_NUM do
+ table.insert(self.rewardCellList, CellManager:addCellComp(self.uiMap["introduct_pop_ui.bg.pop_reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.POP_REWARD_CELL))
+ end
+
+ self.descText = self.uiMap["introduct_pop_ui.bg.desc_text"]
+ self.descText:setText(I18N:getGlobalText(I18N.GlobalConst.SHOP_DESC_39)) -- 超值S级英雄,仅此一次!
+
+ self.buyBtn = self.uiMap["introduct_pop_ui.bg.buy_btn"]
+ self.buyText = self.uiMap["introduct_pop_ui.bg.buy_btn.text"]
+
+ self.buyBtn:addClickListener(function()
+ self:onClickFuncBtn()
+ end)
+ local cfgInfo = PayManager:getGiftConfigInfo(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.INTRODUCT_GIFT_ID)
+ local rechargeId = cfgInfo.recharge_id
+ self.buyText:setText(GFunc.getFormatPrice(rechargeId))
+
+ self.timeText = self.uiMap["introduct_pop_ui.bg.time_node.text"]
+
+ self:_bind()
+ self:scheduleGlobal(function()
+ self:updateTime()
+ end, 1)
+ self:refresh()
+
+ -- 上报
+ BIReport:postPayUIShow(BIReport.GIFT_TYPE.INTRODUCTORY_GIFT, GConst.ShopConst.INTRODUCT_GIFT_ID)
+end
+
+function IntroductPopUI:_bind()
+ self:bind(DataManager.ShopData, "isDirty", function()
+ self:refresh()
+ end)
+end
+
+function IntroductPopUI:refresh()
+ if DataManager.ShopData:getIntroductGiftRemainBuyCount() <= 0 or DataManager.ShopData:getIntroductGiftRemainTime() <= 0 then
+ self:closeUI()
+ end
+
+ local cfgInfo = PayManager:getGiftConfigInfo(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.INTRODUCT_GIFT_ID)
+ local rewards = cfgInfo.reward or {}
+ for i = 1, MAX_ITEM_NUM do
+ if i <= #rewards then
+ self.rewardCellList[i]:setVisible(true, 0.8)
+ self.rewardCellList[i]:refresh(rewards[i].id, rewards[i].num, false)
+ else
+ self.rewardCellList[i]:setVisible(false)
+ end
+ end
+ self:updateTime()
+end
+
+function IntroductPopUI:updateTime()
+ local remainTime = DataManager.ShopData:getIntroductGiftRemainTime()
+ if remainTime > 0 then
+ self.timeText:setText(Time:formatNumTime(remainTime))
+ else
+ self:closeUI()
+ end
+end
+
+function IntroductPopUI:onClickFuncBtn()
+ PayManager:purchasePackage(GConst.ShopConst.INTRODUCT_GIFT_ID, PayManager.PURCHARSE_TYPE.ACT_GIFT)
+end
+
+return IntroductPopUI
\ No newline at end of file
diff --git a/lua/app/ui/shop/introduct_pop_ui.lua.meta b/lua/app/ui/shop/introduct_pop_ui.lua.meta
new file mode 100644
index 00000000..88aa5bb4
--- /dev/null
+++ b/lua/app/ui/shop/introduct_pop_ui.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 250463b2c13ef8146bff1f4439207b9a
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/ui/tips/formation_tips.lua b/lua/app/ui/tips/formation_tips.lua
new file mode 100644
index 00000000..a06a6a68
--- /dev/null
+++ b/lua/app/ui/tips/formation_tips.lua
@@ -0,0 +1,63 @@
+local BaseTips = require "app/ui/tips/base_tips"
+local FormationTips = class("FormationTips", BaseTips)
+
+function FormationTips:ctor(params)
+ self.desc = (params.desc or GConst.EMPTY_STRING)
+ self.tarCornerScreenPos = params.tarCornerScreenPos
+ self.location = params.location
+end
+
+function FormationTips:getPrefabPath()
+ return "assets/prefabs/ui/tips/formation_tips.prefab"
+end
+
+function FormationTips:onPressBackspace()
+ self:closeUI()
+end
+
+function FormationTips:init()
+ local uiMap = self.root:genAllChildren()
+ self.bg = uiMap["item_tips.bg1.bg"]
+ self.bg1 = uiMap["item_tips.bg1"]
+ self.descTx = uiMap["item_tips.bg1.bg.desc_tx"]
+end
+
+function FormationTips:onLoadRootComplete()
+ self:init()
+ local tipsBgTransform = self.bg:getTransform()
+ self.originSizeDelta = tipsBgTransform.sizeDelta
+ self.originPivot = tipsBgTransform.pivot
+ self.originAnchoredPosition = tipsBgTransform.anchoredPosition
+ self.originLocalPosition = tipsBgTransform.localPosition
+end
+
+function FormationTips:onRefresh()
+ self.root:addClickListener(function ()
+ self:closeUI()
+ end)
+
+ self.descTx:setText(self.desc)
+ -- 这里原来是用preferredHeight,但是在中英文混合的时候这个值可能不准,只有改用renderedHeight
+ -- renderedHeight必须要先调用下ForceMeshUpdate强制刷新才有效
+ self.descTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO):ForceMeshUpdate()
+ local height = self.descTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).renderedHeight + 18
+ if height < 130 then
+ height = 130
+ end
+ self.bg:setSizeDeltaY(height)
+ if self.tarCornerScreenPos then
+ self:locate(self.location, self.originSizeDelta, self.bg, self.tarCornerScreenPos)
+ end
+end
+
+function FormationTips:onClose()
+ if self.originSizeDelta then
+ local tipsBgTransform = self.bg:getTransform()
+ tipsBgTransform.sizeDelta = self.originSizeDelta
+ tipsBgTransform.pivot = self.originPivot
+ tipsBgTransform.anchoredPosition = self.originAnchoredPosition
+ tipsBgTransform.localPosition = self.originLocalPosition
+ end
+end
+
+return FormationTips
\ No newline at end of file
diff --git a/lua/app/ui/tips/formation_tips.lua.meta b/lua/app/ui/tips/formation_tips.lua.meta
new file mode 100644
index 00000000..e5401488
--- /dev/null
+++ b/lua/app/ui/tips/formation_tips.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: dccb95716f55a5b48a055aaf89e8da17
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/userdata/arena/arena_bounty_data.lua b/lua/app/userdata/arena/arena_bounty_data.lua
index e4230396..0f6e3eec 100644
--- a/lua/app/userdata/arena/arena_bounty_data.lua
+++ b/lua/app/userdata/arena/arena_bounty_data.lua
@@ -12,6 +12,10 @@ function ArenaBountyData:clear()
end
function ArenaBountyData:init(data)
+ if EDITOR_MODE then
+ Logger.logHighlight("竞技场战令初始化")
+ Logger.printTable(data)
+ end
data = data or GConst.EMPTY_TABLE
self.season = data.season or 1
self.level = data.level or 1
@@ -161,7 +165,7 @@ function ArenaBountyData:getRepeatLevelInfo()
end
function ArenaBountyData:getIsOpen()
- if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.BOUNTY_OPEN, true) and self.endTime > Time:getServerTime() then
+ if ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.ARENA, true) and self.endTime > Time:getServerTime() then
return true
end
return false
@@ -324,7 +328,7 @@ function ArenaBountyData:getEndTime()
end
function ArenaBountyData:getExpItemIcon()
- local id = GConst.ItemConst.ITEM_ID_BOUNTY_EXP
+ local id = GConst.ItemConst.ITEM_ID_ARENA_BOUNTY_EXP
local info = ConfigManager:getConfig("item")[id]
if info == nil then
return GConst.EMPTY_STRING
@@ -347,7 +351,7 @@ function ArenaBountyData:markPopBought()
return
end
self.popBoughtTime = Time:getBeginningOfServerToday()
- LocalData:setBountyPopTime(self.popBoughtTime)
+ LocalData:setArenaBountyPopTime(self.popBoughtTime)
end
function ArenaBountyData:clearPopBought()
diff --git a/lua/app/userdata/arena/arena_data.lua b/lua/app/userdata/arena/arena_data.lua
new file mode 100644
index 00000000..3a9f124d
--- /dev/null
+++ b/lua/app/userdata/arena/arena_data.lua
@@ -0,0 +1,394 @@
+local ArenaData = class("ArenaData", BaseData)
+
+-- 竞技场
+
+function ArenaData:ctor()
+ self.data.isDirty = false
+end
+
+function ArenaData:clear()
+end
+
+function ArenaData:init(data)
+ data = data or GConst.EMPTY_TABLE
+
+ self.season = data.season_number
+ self.score = data.current_score
+ self.lastScore = data.last_score
+ self.lastChallengeCount = data.last_challenge_count-- 上赛季挑战次数
+ self.seasonRewardGot = data.settle_reward_season-- 最近领取过奖励的赛季
+ self.todayMatchCount = data.today_match_count
+ self.matchInfo = data.rival_info
+ self.matchSuccessTime = data.match_success_at // 1000-- 匹配成功时间,超过配置时间后,匹配对象过期,需要重新匹配
+ self.matchFreeCdEndTime = data.match_success_cd_end_at // 1000-- 免费匹配cd结束时间,<=0表示无cd,>0表示cd剩余时间
+ self.todayAdRematchCount = data.today_ad_count-- 今日看广告跳匹配cd次数
+ -- 初始化rank配置
+ self.cfgRank = self:getRankCfg(self.season)
+ -- 初始化time配置
+ self.cfgTime = self:getTimeCfg(self.season)
+
+ self.curGradingId = self:getGradingIdFromScore(self.score) -- 当前所在段位id
+ DataManager.FormationData:initArena(data.attack_array_heroes, data.defend_array_heroes)
+
+ self:setDirty()
+end
+
+function ArenaData:setDirty()
+ self.data.isDirty = not self.data.isDirty
+end
+
+-- 通用 ----------------------------------------------------------------------
+
+-- 获取赛季rank配置
+function ArenaData:getRankCfg(season)
+ local result = {}
+ for id, data in pairs(ConfigManager:getConfig("arena_rank")) do
+ if data.season == season then
+ result[id] = data
+ end
+ end
+ return result
+end
+
+-- 获取赛季time配置
+function ArenaData:getTimeCfg(season)
+ local result = table.find(ConfigManager:getConfig("arena_time"), function(value)
+ return value.season == season
+ end)
+ return result
+end
+
+-- 是否开启
+function ArenaData:isOpen()
+ if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.ARENA, true) then
+ return false
+ end
+ return true
+end
+
+-- 获取当前为第几赛季
+function ArenaData:getSeason()
+ return self.season
+end
+
+-- 获取帮助文案
+function ArenaData:getHelpDesc()
+ return nil
+end
+
+-- 获取当前赛季段位id列表
+function ArenaData:getGradingIdList()
+ return table.keys(self.cfgRank)
+end
+
+-- 获取赛季剩余时间(秒)
+function ArenaData:getRemainSeasonTime()
+ local endTime = Time:getCertainTimeByStr(self.cfgTime.end_time)
+ return endTime - Time:getServerTime()
+end
+
+-- 获取赛季结算的剩余时间(秒)
+function ArenaData:getRemainSeasonSettlementTime()
+ -- 赛季结束前30分钟结算
+ local lockTime = Time:getCertainTimeByStr(self.cfgTime.end_time) - 30 * 60
+ return lockTime - Time:getServerTime()
+end
+
+-- 获取赛季段位结算奖励信息
+function ArenaData:getGradingRewardInfo(id)
+ local cfg = ConfigManager:getConfig("arena_rank")
+ if cfg[id] == nil then
+ Logger.logError("未找到段位[%d]相关数据", id)
+ return nil
+ end
+ return cfg[id].season_reward
+end
+
+-- 获取积分所对应的段位id
+function ArenaData:getGradingIdFromScore(score, isLastSeason)
+ local seasonId,grading = nil
+ local cfg = self.cfgRank
+
+ if isLastSeason then
+ cfg = self:getRankCfg(self.season - 1)
+ end
+
+ for id, data in pairs(cfg) do
+ if score >= data.score and (grading == nil or grading.score < data.score) then
+ seasonId, grading = id, data
+ end
+ end
+
+ return seasonId
+end
+
+-- 获取段位图标名
+function ArenaData:getGradingIconName(id)
+ local cfg = ConfigManager:getConfig("arena_rank")
+ if cfg[id] == nil then
+ Logger.logError("未找到段位[%d]相关数据", id)
+ return nil
+ end
+ return "arena_dan_" .. cfg[id].rank_icon
+end
+
+-- 获取段位小段图标
+function ArenaData:getGradingNumName(id)
+ local cfg = ConfigManager:getConfig("arena_rank")
+ if cfg[id] == nil then
+ Logger.logError("未找到段位[%d]相关数据", id)
+ return nil
+ end
+ return "arena_num_" .. cfg[id].rank_show
+end
+
+-- 获取段位名称
+function ArenaData:getGradingName(id)
+ local cfg = ConfigManager:getConfig("arena_rank")
+ if cfg[id] == nil then
+ Logger.logError("未找到段位[%d]相关数据", id)
+ return nil
+ end
+ return I18N:getGlobalText(cfg[id].name_txt)
+end
+
+-- 获取重新刷新匹配时间(秒)
+function ArenaData:getRematchRefreshTime()
+ return GFunc.getConstIntValue("arena_refresh_time") * 60
+end
+
+-- 获取重新匹配每天最大广告次数
+function ArenaData:getRematchAdDailyMaxNum()
+ return GFunc.getConstIntValue("arena_refresh_ad_times")
+end
+
+-- 获取重新匹配钻石消耗
+function ArenaData:getRematchConstGem()
+ return GFunc.getConstIntValue("arena_refresh_cost")
+end
+
+-- 获取匹配信息最多存在时间(秒)
+function ArenaData:getMatchInfoMaxTime()
+ return GFunc.getConstIntValue("arena_info_time") * 60 * 60
+end
+
+-- 获取战斗消耗
+function ArenaData:getFightCostNum()
+ return GFunc.getRewardNum(GFunc.getConstReward("arena_fight_cost"))
+end
+
+-- 排行榜 ----------------------------------------------------------------------
+
+-- 排行榜玩家总数
+function ArenaData:getRankCount()
+ if self.rankList then
+ return #self.rankList
+ else
+ return 0
+ end
+end
+
+-- 获取排行榜第n名数据
+function ArenaData:getRankData(rank)
+ local info = table.find(self.rankList, function (value)
+ return value.rank == rank
+ end)
+
+ if info == nil then
+ Logger.logError("没有找到排行榜第%d名数据", rank)
+ end
+
+ return info
+end
+
+-- 本地是否有排行榜该玩家编队数据
+function ArenaData:hasRankFormation(id)
+ return self.rankFormation == nil or self.rankFormation[id] == nil
+end
+
+-- 获取排行榜玩家编队信息
+function ArenaData:getRankFormation(id)
+ return self.rankFormation[id]
+end
+
+-- 匹配 ----------------------------------------------------------------------
+
+-- 获取匹配玩家信息
+function ArenaData:getMatchInfo()
+ if Time:getServerTime() - self.matchSuccessTime > self:getMatchInfoMaxTime() then
+ -- 超过时间需要重新匹配
+ return nil
+ end
+ if self.matchInfo == nil then
+ return nil
+ end
+
+ return self.matchInfo
+end
+
+-- 个人 ----------------------------------------------------------------------
+
+-- 获取当前段位积分
+function ArenaData:getScore()
+ return self.score
+end
+
+-- 获取当前段位id
+function ArenaData:getGradingId()
+ return self.curGradingId
+end
+
+-- 获取所在段位的积分 cur - min
+function ArenaData:getGradingScore()
+ return self.score - self:getGradingMinScore(self.score)
+end
+
+-- 获取所在段位的最低积分
+function ArenaData:getGradingMinScore()
+ return self.cfgRank[self.curGradingId].score
+end
+
+-- 获取所在段位的最高积分 full
+function ArenaData:getGradingMaxScore()
+ local isNext = false
+ for id, data in pairs(self.cfgRank) do
+ if isNext then
+ return data.score
+ end
+ if id == self.curGradingId then
+ isNext = true
+ end
+ end
+end
+
+-- 获取所在段位的总积分
+function ArenaData:getGradingScoreTotal()
+ return self:getGradingMaxScore() - self:getGradingMinScore()
+end
+
+-- 获取自己的排名
+function ArenaData:getRank()
+ return self.rank
+end
+
+-- 获取最近战况
+function ArenaData:getRecentBattleByIdx(index)
+ if self.recentBattle == nil then
+ return nil
+ end
+ return self.recentBattle[index]
+end
+
+-- 获取免费重新匹配cd, 大于0代表在cd中,小于等于0代表cd冷却已好,可以免费Rematch
+function ArenaData:getFreeRematchCd()
+ if self.matchFreeCdEndTime <= 0 then
+ -- cd已经冷却
+ return self.matchFreeCdEndTime
+ end
+ return self.matchFreeCdEndTime - Time:getServerTime()
+end
+
+-- 今日是否能看视频重新匹配
+function ArenaData:canAdRematch()
+ return self.todayAdRematchCount < self:getRematchAdDailyMaxNum()
+end
+
+-- 获取上赛季段位id
+function ArenaData:getLastGradingId()
+ local lastRank = self:getRankCfg(self.season - 1)
+ local seasonId,grading = nil
+ for id, data in pairs(lastRank) do
+ if self.lastScore >= data.score and (grading == nil or grading.score < data.score) then
+ seasonId, grading = id, data
+ end
+ end
+ return seasonId
+end
+
+-- 是否有可领取的上赛季奖励
+function ArenaData:hasSeasonReward()
+ if self.lastChallengeCount <= 0 then
+ return false
+ end
+ if self.seasonRewardGot == self.season - 1 then
+ return false
+ end
+
+ return true
+end
+
+-- 是否有入口红点
+function ArenaData:hasEntranceRedDot()
+ return DataManager.BagData.ItemData:getItemNumById(GConst.ItemConst.ITEM_ID_ARENA_TICKET) > 0 or self:hasSeasonReward()
+end
+
+-- 事件处理 ----------------------------------------------------------------------
+
+-- 获取到排行榜数据
+function ArenaData:onRankDataReceived(rank, list)
+ self.rank = rank
+ self.rankList = list
+ self:setDirty()
+end
+
+-- 获取到排行榜编队信息
+function ArenaData:onRankFormationReceived(id, formation)
+ if self.rankFormation == nil then
+ self.rankFormation = {}
+ end
+ self.rankFormation[id] = formation
+ self:setDirty()
+end
+
+-- 获取到最近战况数据
+function ArenaData:onRecentBattleReceived(recentBattle)
+ table.sort(recentBattle, function(a, b)
+ -- 由新到旧
+ return a.occur_at > b.occur_at
+ end)
+ self.recentBattle = recentBattle
+ self:setDirty()
+end
+
+-- 获取到匹配数据
+function ArenaData:onMatchInfoReceived(match)
+ self.matchInfo = match
+ self.matchSuccessTime = Time:getServerTime()
+ self.matchFreeCdEndTime = Time:getServerTime() + self:getRematchRefreshTime()
+ self:setDirty()
+end
+
+-- 结算战斗数据
+function ArenaData:onBattleResultReceived(settlement)
+ -- 战斗记录改变
+ table.remove(self.recentBattle, #self.recentBattle)
+ table.insert(self.recentBattle, 1, settlement)
+ -- 积分改变
+ self.score = self.score + settlement.score
+ self.curGradingId = self:getGradingIdFromScore(self.score)
+
+ self:setDirty()
+end
+
+-- 已领取上赛季奖励
+function ArenaData:onLastSeasonRewardReceived()
+ self.seasonRewardGot = self.season - 1
+ self:setDirty()
+end
+
+-- 跳过匹配cd
+function ArenaData:onOverFreeRematchCD(isAd)
+ self.matchFreeCdEndTime = -1
+ if isAd then
+ self.todayAdRematchCount = self.todayAdRematchCount + 1
+ end
+ self:setDirty()
+end
+
+-- 赛季改变
+function ArenaData:onSeasonChanged()
+ self.matchInfo = nil
+ self:setDirty()
+end
+
+return ArenaData
\ No newline at end of file
diff --git a/lua/app/userdata/arena/arena_data.lua.meta b/lua/app/userdata/arena/arena_data.lua.meta
new file mode 100644
index 00000000..2f076ba9
--- /dev/null
+++ b/lua/app/userdata/arena/arena_data.lua.meta
@@ -0,0 +1,10 @@
+fileFormatVersion: 2
+guid: 385db71b1437e764eb063afef160fe87
+ScriptedImporter:
+ internalIDToNameTable: []
+ externalObjects: {}
+ serializedVersion: 2
+ userData:
+ assetBundleName:
+ assetBundleVariant:
+ script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
diff --git a/lua/app/userdata/bag/item_data.lua b/lua/app/userdata/bag/item_data.lua
index 1e1c2050..d6f49c51 100644
--- a/lua/app/userdata/bag/item_data.lua
+++ b/lua/app/userdata/bag/item_data.lua
@@ -32,6 +32,9 @@ function ItemData:init(data)
if info.id == GConst.ItemConst.ITEM_ID_VIT then
DataManager.PlayerData:setVit(info.count)
end
+ if info.id == GConst.ItemConst.ITEM_ID_ARENA_TICKET then
+ DataManager.PlayerData:setArenaTicket(info.count)
+ end
self:_add(info.id, info.count)
end
end
diff --git a/lua/app/userdata/formation/formation_data.lua b/lua/app/userdata/formation/formation_data.lua
index b3f2660e..076fed1d 100644
--- a/lua/app/userdata/formation/formation_data.lua
+++ b/lua/app/userdata/formation/formation_data.lua
@@ -5,21 +5,57 @@ function FormationData:ctor()
self.formations = {}
end
+-- 初始化主线阵容
function FormationData:init(data)
- self.data.dirty = false
- self.formations = {}
- -- 目前只有主线关卡的
+ if self.formations == nil then
+ self.formations = {}
+ end
+
if data and data.heroes then
local clientFormation = {}
for matchType, heroId in pairs(data.heroes) do
clientFormation[tonumber(matchType)] = heroId
end
- self.formations[GConst.BattleConst.BATTLE_TYPE.STAGE] = clientFormation
+ self.formations[GConst.BattleConst.FORMATION_TYPE.STAGE] = clientFormation
end
+ self:setDirty()
+end
+
+-- 初始化竞技场阵容
+function FormationData:initArena(attack, defend)
+ if self.formations == nil then
+ self.formations = {}
+ end
+
+ -- 位置顺序特殊处理
+ self.formations[GConst.BattleConst.FORMATION_TYPE.ARENA_ATTACK] = {0,0,0,0,0}
+ self.formations[GConst.BattleConst.FORMATION_TYPE.ARENA_DEFEND] = {0,0,0,0,0}
+
+ for idx, id in pairs(attack) do
+ if id and id ~= 0 then
+ local type = DataManager.HeroData:getHeroById(id):getMatchType()
+ self.formations[GConst.BattleConst.FORMATION_TYPE.ARENA_ATTACK][type] = id
+ end
+ end
+ for idx, id in pairs(defend) do
+ if id and id ~= 0 then
+ local type = DataManager.HeroData:getHeroById(id):getMatchType()
+ self.formations[GConst.BattleConst.FORMATION_TYPE.ARENA_DEFEND][type] = id
+ end
+ end
+ self:setDirty()
end
function FormationData:getStageFormation()
- return self:getFormation(GConst.BattleConst.BATTLE_TYPE.STAGE)
+ return self:getFormation(GConst.BattleConst.FORMATION_TYPE.STAGE)
+end
+
+function FormationData:getArenaAttackFormation()
+ return self:getFormation(GConst.BattleConst.FORMATION_TYPE.ARENA_ATTACK)
+end
+
+function FormationData:getArenaDefendFormation()
+ return self:getFormation(GConst.BattleConst.FORMATION_TYPE.ARENA_DEFEND)
end
function FormationData:getFormation(formationType)
@@ -54,6 +90,27 @@ function FormationData:heroInFormation(formationType, heroId)
return false
end
+function FormationData:formationIsFull(formationType)
+ local actvieMap = DataManager.HeroData:getMatchActiveHeroMap()
+ local formation = self:getFormation(formationType)
+ local count = 0
+ for matchtype = 1, GConst.BattleConst.ELEMENT_TYPE_COUNT do
+ if not formation[matchtype] or formation[matchtype] <= 0 then
+ if actvieMap[matchtype] and table.nums(actvieMap[matchtype]) > 0 then
+ return false
+ end
+ else
+ count = count + 1
+ end
+ end
+
+ if count <= 0 then
+ return false
+ end
+
+ return true
+end
+
function FormationData:setDirty()
self.data.dirty = not self.data.dirty
end
diff --git a/lua/app/userdata/hero/hero_data.lua b/lua/app/userdata/hero/hero_data.lua
index e3d91c24..89c59850 100644
--- a/lua/app/userdata/hero/hero_data.lua
+++ b/lua/app/userdata/hero/hero_data.lua
@@ -66,7 +66,7 @@ function HeroData:getEntity(cfgId, lv)
end
function HeroData:getHeroById(id)
- if not id then
+ if not id or id == 0 then
return
end
if not self.heroes[id] then
diff --git a/lua/app/userdata/player/player_data.lua b/lua/app/userdata/player/player_data.lua
index ced339f1..8c1cabf1 100644
--- a/lua/app/userdata/player/player_data.lua
+++ b/lua/app/userdata/player/player_data.lua
@@ -37,10 +37,16 @@ function PlayerData:init(data)
self.data.playInfo.unlockAvatar = data.bag.avatars
self.data.playInfo.unlockFrame = data.bag.avatar_frames
+ -- 体力购买情况初始化
local energyLimit = data.energy_limit or GConst.EMPTY_TABLE
self.data.vitGemCount = energyLimit.diamond_count or 0
self.data.vitADCount = energyLimit.ad_count or 0
+ -- 竞技场入场券购买情况初始化
+ local arenaTicketLimit = data.arena or GConst.EMPTY_TABLE
+ self.data.arenaTicketGemCount = arenaTicketLimit.today_ticket_buy_count or 0
+ self.data.arenaTicketADCount = arenaTicketLimit.today_ticket_ad_count or 0
+
self.lastLoginTime = basicInfo.lastLoginTime or Time:getBeginningOfServerToday()
DataManager:registerCrossDayFunc("PlayerData", function()
self:resetOnCrossDay()
@@ -486,4 +492,37 @@ function PlayerData:getShowFrameIds()
return table.addArray(unlockIds, lockIds)
end
+-- 竞技场战令
+
+function PlayerData:getArenaTicket()
+ return self.arenaTicket or 0
+end
+
+function PlayerData:getArenaTicketGemBuyCount()
+ return self.data.arenaTicketGemCount
+end
+
+function PlayerData:getArenaTicketAdBuyCount()
+ return self.data.arenaTicketADCount
+end
+
+function PlayerData:setArenaTicket(ticket)
+ self.arenaTicket = ticket
+end
+
+function PlayerData:getMaxArenaTicket()
+ if self.maxArenaTicket == nil then
+ self.maxArenaTicket = ConfigManager:getConfig("recovery")[GConst.ItemConst.ITEM_ID_ARENA_TICKET].limit
+ end
+ return self.maxArenaTicket
+end
+
+function PlayerData:addArenaTicketGemBuyCount()
+ self.data.arenaTicketGemCount = self.data.arenaTicketGemCount + 1
+end
+
+function PlayerData:addArenaTicketAdBuyCount()
+ self.data.arenaTicketADCount = self.data.arenaTicketADCount + 1
+end
+
return PlayerData
\ No newline at end of file
diff --git a/lua/app/userdata/shop/shop_data.lua b/lua/app/userdata/shop/shop_data.lua
index 70291379..248bcce5 100644
--- a/lua/app/userdata/shop/shop_data.lua
+++ b/lua/app/userdata/shop/shop_data.lua
@@ -116,6 +116,12 @@ function ShopData:markPopUpGift(actType, actId)
if not self.needPopUpGift[actType] then
self.needPopUpGift[actType] = {}
end
+ -- 如果已经有了 不作处理
+ for _, id in ipairs(self.needPopUpGift[actType]) do
+ if id == actId then
+ return
+ end
+ end
table.insert(self.needPopUpGift[actType], actId)
table.sort(self.needPopUpGift[actType])
end
@@ -142,6 +148,18 @@ function ShopData:getPopUpGiftByType(actType)
return self.needPopUpGift and self.needPopUpGift[actType]
end
+function ShopData:checkHasPopUpGift(actType, actId)
+ local gifts = self:getPopUpGiftByType(actType)
+ if gifts and #gifts > 0 then
+ for _, giftId in ipairs(gifts) do
+ if (giftId == actId) then
+ return true
+ end
+ end
+ end
+ return false
+end
+
-- 获取下一个需要弹出的同类型礼包数据,特别的,如果是主界面部分则多个不同类型的也要考虑进去
function ShopData:getNextPopGiftData(actType, actId)
if GConst.ShopConst.MAIN_UI_POP_TYPE[actType] then
@@ -765,60 +783,121 @@ end
-- 成长礼包结束 ----------------------------------------------------------------------------------------------
--- 首充 **********************************************************************************************
+-- 首充(作废) **********************************************************************************************
function ShopData:getIsFirstRechargeOpen()
- return ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.FIRST_RECHARGE, true)
+ return false -- ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.FIRST_RECHARGE, true)
end
-- 用于标记是否弹窗 要求等级不低于2 未领取该奖励
function ShopData:initFirstRecharge()
- local lv = DataManager.PlayerData:getLv()
- if lv > 1 and not self:getHasGotFirstRechargeReward() then
- self:markPopUpGift(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID)
- end
+ -- local lv = DataManager.PlayerData:getLv()
+ -- if lv > 1 and not self:getHasGotFirstRechargeReward() then
+ -- self:markPopUpGift(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID)
+ -- end
end
-- 是否有首充奖励 有支付且未领取
function ShopData:getHasFirstRechargeReward()
- local pay = DataManager.PlayerData:getTotalPayAmount()
- if pay > 0 and not self:getHasGotFirstRechargeReward() then
- return true
- else
- return false
- end
+ -- local pay = DataManager.PlayerData:getTotalPayAmount()
+ -- if pay > 0 and not self:getHasGotFirstRechargeReward() then
+ -- return true
+ -- else
+ -- return false
+ -- end
+ return false
end
-- 是否已领取首充奖励
function ShopData:getHasGotFirstRechargeReward()
-- 通用act礼包中是否有已购
- local boughtNum = self:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID)
- return boughtNum > 0
+ -- local boughtNum = self:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.FIRST_RECHARGE_ID)
+ -- return boughtNum > 0
+ return true
end
-- 侧边栏是否展示 要求功能开启 未领取该奖励
function ShopData:getShowFirstRechargeSideBar()
- if not self:getIsFirstRechargeOpen() then
- return false
- end
- if not self:getHasGotFirstRechargeReward() then
- return true
- else
- return false
- end
+ -- if not self:getIsFirstRechargeOpen() then
+ -- return false
+ -- end
+ -- if not self:getHasGotFirstRechargeReward() then
+ -- return true
+ -- else
+ -- return false
+ -- end
+ return false
end
-- 侧边栏红点
function ShopData:showFirstRechargeRp()
- if not self:getIsFirstRechargeOpen() then
- return false
- end
+ -- if not self:getIsFirstRechargeOpen() then
+ -- return false
+ -- end
- return self:getHasFirstRechargeReward()
+ -- return self:getHasFirstRechargeReward()
+ return false
end
-- 首充结束 ----------------------------------------------------------------------------------------------
+-- 入门礼包 ----------------------------------------------------------------------------------------------
+
+function ShopData:initIntroductGift(introductGift)
+ introductGift = introductGift or {}
+ self.introductGift = introductGift or {}
+ self.introductGiftTriggerTime = self.introductGift.trigger_at or 0
+
+ self:checkPopIntroductGift()
+end
+
+ -- 如果可购买则标记可弹窗
+function ShopData:checkPopIntroductGift()
+ if (self:getIntroductGiftRemainTime() > 0 and self:getIntroductGiftRemainBuyCount() > 0) then
+ self:markPopUpGift(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.INTRODUCT_GIFT_ID)
+ end
+end
+
+function ShopData:getIntroductGiftTriggerTime()
+ return self.introductGiftTriggerTime // 1000
+end
+
+function ShopData:setIntroductGiftTriggerTime(time)
+ self.introductGiftTriggerTime = time
+end
+
+-- 入门礼包剩余时间
+function ShopData:getIntroductGiftRemainTime()
+ local cfgInfo = self:getActGiftConfig()[GConst.ShopConst.INTRODUCT_GIFT_ID]
+ local triggerTime = self:getIntroductGiftTriggerTime()
+ local remainTime = triggerTime + (cfgInfo.limit_time or 0) * 3600 - Time:getServerTime()
+ return remainTime
+end
+
+-- 入门礼包剩余可购次数
+function ShopData:getIntroductGiftRemainBuyCount()
+ local cfgInfo = self:getActGiftConfig()[GConst.ShopConst.INTRODUCT_GIFT_ID]
+ local buyCount = self:getGiftBoughtNum(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.INTRODUCT_GIFT_ID)
+ return (cfgInfo.limit or 1) - buyCount
+end
+
+-- 触发入门礼包(如果已经触发则不会更新)
+function ShopData:onTriggerIntroductGift()
+
+ if self:getIntroductGiftTriggerTime() <= 0 then
+ self:initIntroductGift({trigger_at = Time:getServerTime() * 1000})
+ -- 标记弹窗
+ self:markPopUpGift(PayManager.PURCHARSE_TYPE.ACT_GIFT, GConst.ShopConst.INTRODUCT_GIFT_ID)
+ end
+end
+
+-- 侧边栏是否展示(时间次数均满足)
+function ShopData:getIntroductGiftShowSideBar()
+ return self:getIntroductGiftRemainBuyCount() > 0 and self:getIntroductGiftRemainTime() > 0
+end
+
+-- 入门礼包结束 --------------------------------------------------------------------------------------------
+
-- 底部栏是否有红点
function ShopData:getRp()
if not ModuleManager:getIsOpen(ModuleManager.MODULE_KEY.MALL, true) then