竞技场

This commit is contained in:
Fang 2023-06-20 15:10:04 +08:00
parent f17eeb8e68
commit cd09e79bca
58 changed files with 15137 additions and 7308 deletions

View File

@ -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",
@ -119,6 +121,7 @@ BIReport.ADS_CLICK_TYPE = {
TASK_DAILY_REFRESH = "TaskDailyRefresh",
TASK_DAILY_TASK = "TaskDailyTask",
IDLE_QUICK_DROP = "IdleQuickDrop",
ARENA_TICKET = "ArenaTicket",
MALL_DAILY = "MallDaily",
MALL_DAILY_RESET = "MallDailyReset",

View File

@ -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()
@ -156,6 +158,7 @@ function DataManager:initWithServerData(data)
self.TaskData:init()
self:scheduleGlobal()
self:checkDataBind()
ModuleManager.ArenaManager:reqArenaInfo()
-- 写在最后防止某些数据还未初始化就被bi访问报错
self.initWithServer = true

View File

@ -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,7 @@ ModuleManager.MODULE_KEY = {
MAIL = "mail_open", -- 邮件
DUNGEON_SHARDS = "dungeon_shards_open", -- 碎片副本
DUNGEON_GOLD = "dungeon_gold_open", -- 金币副本
ARENA = "arena", -- 竞技场
}
local _moduleMgrs = {}

View File

@ -512,9 +512,214 @@ local act_gift = {
["recharge_id"]=14,
["time_type"]=3,
["value"]=2000
},
[30102]={
["type"]=3,
["recharge_id"]=3,
["reward"]={
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=2,
["id_for_nothing"]="VA==",
["num"]=30,
["num_for_nothing"]="VQg="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=1,
["id_for_nothing"]="Vw==",
["num"]=500,
["num_for_nothing"]="Uwhc"
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=34001,
["id_for_nothing"]="VQxcA2Q=",
["num"]=3,
["num_for_nothing"]="VQ=="
}
},
["time_type"]=1,
["limit_time"]=72,
["limit"]=1
},
[90102]={
["type"]=9,
["recharge_id"]=13,
["reward"]={
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=1,
["id_for_nothing"]="Vw==",
["num"]=1000,
["num_for_nothing"]="VwhcAw=="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=4,
["id_for_nothing"]="Ug==",
["num"]=100,
["num_for_nothing"]="Vwhc"
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=5,
["id_for_nothing"]="Uw==",
["num"]=50,
["num_for_nothing"]="Uwg="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=6,
["id_for_nothing"]="UA==",
["num"]=1,
["num_for_nothing"]="Vw=="
}
},
["time_type"]=1,
["limit_time"]=24,
["cd"]=48,
["limit"]=1,
["value"]=200
},
[90202]={
["type"]=9,
["recharge_id"]=12,
["reward"]={
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=1,
["id_for_nothing"]="Vw==",
["num"]=1000,
["num_for_nothing"]="VwhcAw=="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=4,
["id_for_nothing"]="Ug==",
["num"]=100,
["num_for_nothing"]="Vwhc"
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=5,
["id_for_nothing"]="Uw==",
["num"]=50,
["num_for_nothing"]="Uwg="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=6,
["id_for_nothing"]="UA==",
["num"]=1,
["num_for_nothing"]="Vw=="
}
},
["time_type"]=1,
["limit_time"]=24,
["cd"]=48,
["limit"]=1,
["value"]=260
},
[90302]={
["type"]=9,
["recharge_id"]=10,
["reward"]={
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=1,
["id_for_nothing"]="Vw==",
["num"]=1000,
["num_for_nothing"]="VwhcAw=="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=4,
["id_for_nothing"]="Ug==",
["num"]=100,
["num_for_nothing"]="Vwhc"
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=5,
["id_for_nothing"]="Uw==",
["num"]=50,
["num_for_nothing"]="Uwg="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=6,
["id_for_nothing"]="UA==",
["num"]=1,
["num_for_nothing"]="Vw=="
}
},
["time_type"]=1,
["limit_time"]=24,
["cd"]=48,
["limit"]=1,
["value"]=400
},
[90402]={
["type"]=9,
["recharge_id"]=5,
["reward"]={
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=1,
["id_for_nothing"]="Vw==",
["num"]=1000,
["num_for_nothing"]="VwhcAw=="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=4,
["id_for_nothing"]="Ug==",
["num"]=100,
["num_for_nothing"]="Vwhc"
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=5,
["id_for_nothing"]="Uw==",
["num"]=50,
["num_for_nothing"]="Uwg="
},
{
["type"]=1,
["type_for_nothing"]="Vw==",
["id"]=6,
["id_for_nothing"]="UA==",
["num"]=1,
["num_for_nothing"]="Vw=="
}
},
["time_type"]=1,
["limit_time"]=24,
["cd"]=48,
["limit"]=1,
["value"]=800
}
}
local config = {
data=act_gift,count=22
data=act_gift,count=27
}
return config

File diff suppressed because it is too large Load Diff

View File

@ -71,7 +71,8 @@ local arena_rank = {
["rank_icon"]="1",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_1"
},
[102]={
["season"]=1,
@ -153,7 +154,8 @@ local arena_rank = {
["rank_icon"]="2",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_2"
},
[103]={
["season"]=1,
@ -235,7 +237,8 @@ local arena_rank = {
["rank_icon"]="3",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_3"
},
[104]={
["season"]=1,
@ -325,7 +328,8 @@ local arena_rank = {
["rank_icon"]="4",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_4"
},
[105]={
["season"]=1,
@ -415,7 +419,8 @@ local arena_rank = {
["rank_icon"]="5",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_5"
},
[106]={
["season"]=1,
@ -505,7 +510,8 @@ local arena_rank = {
["rank_icon"]="6",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_6"
},
[107]={
["season"]=1,
@ -595,7 +601,8 @@ local arena_rank = {
["rank_icon"]="7",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_7"
},
[108]={
["season"]=1,
@ -685,7 +692,8 @@ local arena_rank = {
["rank_icon"]="8",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_8"
},
[109]={
["season"]=1,
@ -775,7 +783,8 @@ local arena_rank = {
["rank_icon"]="9",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_9"
},
[110]={
["season"]=1,
@ -865,7 +874,8 @@ local arena_rank = {
["rank_icon"]="10",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_10"
},
[111]={
["season"]=1,
@ -955,7 +965,8 @@ local arena_rank = {
["rank_icon"]="11",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_11"
},
[112]={
["season"]=1,
@ -1045,7 +1056,8 @@ local arena_rank = {
["rank_icon"]="12",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_12"
},
[201]={
["season"]=2,
@ -1117,7 +1129,8 @@ local arena_rank = {
["rank_icon"]="1",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_1"
},
[202]={
["season"]=2,
@ -1197,7 +1210,8 @@ local arena_rank = {
["rank_icon"]="2",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_2"
},
[203]={
["season"]=2,
@ -1277,7 +1291,8 @@ local arena_rank = {
["rank_icon"]="3",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_3"
},
[204]={
["season"]=2,
@ -1365,7 +1380,8 @@ local arena_rank = {
["rank_icon"]="4",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_4"
},
[205]={
["season"]=2,
@ -1453,7 +1469,8 @@ local arena_rank = {
["rank_icon"]="5",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_5"
},
[206]={
["season"]=2,
@ -1541,7 +1558,8 @@ local arena_rank = {
["rank_icon"]="6",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_6"
},
[207]={
["season"]=2,
@ -1629,7 +1647,8 @@ local arena_rank = {
["rank_icon"]="7",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_7"
},
[208]={
["season"]=2,
@ -1717,7 +1736,8 @@ local arena_rank = {
["rank_icon"]="8",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_8"
},
[209]={
["season"]=2,
@ -1805,7 +1825,8 @@ local arena_rank = {
["rank_icon"]="9",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_9"
},
[210]={
["season"]=2,
@ -1893,7 +1914,8 @@ local arena_rank = {
["rank_icon"]="10",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_10"
},
[211]={
["season"]=2,
@ -1981,7 +2003,8 @@ local arena_rank = {
["rank_icon"]="11",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_11"
},
[212]={
["season"]=2,
@ -2069,7 +2092,8 @@ local arena_rank = {
["rank_icon"]="12",
["scene"]="bg_1",
["block_icon"]="battle_hinder_2",
["chess_board"]="chessboard_1"
["chess_board"]="chessboard_1",
["name_txt"]="ARENA_RANKNAME_12"
}
}
local config = {

View File

@ -313,9 +313,12 @@ local const = {
},
["arena_bounty_senior_rise"]={
["value"]=10
},
["arena_matching_limit_number"]={
["value"]=5
}
}
local config = {
data=const,count=63
data=const,count=64
}
return config

View File

@ -70,9 +70,13 @@ local func_open = {
["arena_open"]={
["stage"]=10,
["pop_ups"]=1
},
["act_arena_gift"]={
["stage"]=10,
["pop_ups"]=1
}
}
local config = {
data=func_open,count=18
data=func_open,count=19
}
return config

View File

@ -258,6 +258,40 @@ local LocalizationGlobalConst =
NOTICE_TITLE = "NOTICE_TITLE",
MAINTENANCE_NOTICE_DEFAULT = "MAINTENANCE_NOTICE_DEFAULT",
CANNOT_RENAME_DESC_5 = "CANNOT_RENAME_DESC_5",
ARENA_DESC_1 = "ARENA_DESC_1",
ARENA_DESC_2 = "ARENA_DESC_2",
ARENA_DESC_3 = "ARENA_DESC_3",
ARENA_DESC_4 = "ARENA_DESC_4",
ARENA_DESC_5 = "ARENA_DESC_5",
ARENA_DESC_6 = "ARENA_DESC_6",
ARENA_DESC_7 = "ARENA_DESC_7",
ARENA_DESC_8 = "ARENA_DESC_8",
ARENA_DESC_9 = "ARENA_DESC_9",
ARENA_DESC_10 = "ARENA_DESC_10",
ARENA_DESC_11 = "ARENA_DESC_11",
ARENA_DESC_12 = "ARENA_DESC_12",
ARENA_DESC_13 = "ARENA_DESC_13",
ARENA_DESC_14 = "ARENA_DESC_14",
ARENA_DESC_15 = "ARENA_DESC_15",
ARENA_DESC_16 = "ARENA_DESC_16",
ARENA_DESC_17 = "ARENA_DESC_17",
ARENA_DESC_18 = "ARENA_DESC_18",
ARENA_DESC_19 = "ARENA_DESC_19",
ARENA_DESC_20 = "ARENA_DESC_20",
ARENA_RANKNAME_1 = "ARENA_RANKNAME_1",
ARENA_RANKNAME_2 = "ARENA_RANKNAME_2",
ARENA_RANKNAME_3 = "ARENA_RANKNAME_3",
ARENA_RANKNAME_4 = "ARENA_RANKNAME_4",
ARENA_RANKNAME_5 = "ARENA_RANKNAME_5",
ARENA_RANKNAME_6 = "ARENA_RANKNAME_6",
ARENA_RANKNAME_7 = "ARENA_RANKNAME_7",
ARENA_RANKNAME_8 = "ARENA_RANKNAME_8",
ARENA_RANKNAME_9 = "ARENA_RANKNAME_9",
ARENA_RANKNAME_10 = "ARENA_RANKNAME_10",
ARENA_RANKNAME_11 = "ARENA_RANKNAME_11",
ARENA_RANKNAME_12 = "ARENA_RANKNAME_12",
SHOP_DESC_38 = "SHOP_DESC_38",
SHOP_DESC_39 = "SHOP_DESC_39",
}
return LocalizationGlobalConst

File diff suppressed because it is too large Load Diff

View File

@ -258,6 +258,40 @@ local localization_global =
["NOTICE_TITLE"] = "公告",
["MAINTENANCE_NOTICE_DEFAULT"] = "服务器正在加紧链接中,目前元素较多,请稍后重试进入。",
["CANNOT_RENAME_DESC_5"] = "与当前昵称一致,无需更改",
["ARENA_DESC_1"] = "竞技场",
["ARENA_DESC_2"] = "匹配",
["ARENA_DESC_3"] = "第{0}赛季",
["ARENA_DESC_4"] = "军团竞技场",
["ARENA_DESC_5"] = "排行榜",
["ARENA_DESC_6"] = "竞技场战令",
["ARENA_DESC_7"] = "战报",
["ARENA_DESC_8"] = "暂时没有战报",
["ARENA_DESC_9"] = "防守阵容",
["ARENA_DESC_10"] = "进攻阵容",
["ARENA_DESC_11"] = "结算奖励",
["ARENA_DESC_12"] = "S{0}赛季结算时抵达相应段位可在下一赛季时来此领取奖励。",
["ARENA_DESC_13"] = "你在S{0}赛季时的段位",
["ARENA_DESC_14"] = "战况",
["ARENA_DESC_15"] = "对手",
["ARENA_DESC_16"] = "积分",
["ARENA_DESC_17"] = "防守胜利",
["ARENA_DESC_18"] = "防守失败",
["ARENA_DESC_19"] = "进攻胜利",
["ARENA_DESC_20"] = "进攻失败",
["ARENA_RANKNAME_1"] = "青铜骑士Ⅲ",
["ARENA_RANKNAME_2"] = "青铜骑士Ⅱ",
["ARENA_RANKNAME_3"] = "青铜骑士Ⅰ",
["ARENA_RANKNAME_4"] = "白银骑士Ⅳ",
["ARENA_RANKNAME_5"] = "白银骑士Ⅲ",
["ARENA_RANKNAME_6"] = "白银骑士Ⅱ",
["ARENA_RANKNAME_7"] = "白银骑士Ⅰ",
["ARENA_RANKNAME_8"] = "黄金龙骑Ⅴ",
["ARENA_RANKNAME_9"] = "黄金龙骑Ⅳ",
["ARENA_RANKNAME_10"] = "黄金龙骑Ⅲ",
["ARENA_RANKNAME_11"] = "黄金龙骑Ⅱ",
["ARENA_RANKNAME_12"] = "黄金龙骑Ⅰ",
["SHOP_DESC_38"] = "入门礼包",
["SHOP_DESC_39"] = "超值S级英雄,仅此一次!",
}
return localization_global

View File

@ -455,7 +455,7 @@ local tutorial = {
[50000]={
["next_id"]=50010,
["type"]=2,
["target_name"]="main_ui(Clone)/sub_ui_node/main_comp/left_btn",
["target_name"]="main_ui(Clone)/sub_ui_node/main_comp/left/daily_challenge",
["arrow_direction"]=2,
["arrow_offset"]={
0,
@ -489,7 +489,7 @@ local tutorial = {
0,
180
},
["target_name"]="main_ui(Clone)/sub_ui_node/main_comp/right_btn",
["target_name"]="main_ui(Clone)/sub_ui_node/main_comp/right/dungeon",
["arrow_direction"]=1,
["arrow_offset"]={
0,

View File

@ -188,6 +188,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",

View File

@ -0,0 +1,119 @@
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)
-- 展示结算界面
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

View File

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

View File

@ -85,6 +85,13 @@ BattleConst.BATTLE_TYPE = {
ARENA = "5",
}
-- 编队
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",

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,

View File

@ -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 = {

View File

@ -37,6 +37,8 @@ local ProtoMsgType = {
[904224593] = "ArenaBountyLevelUnlockRsp",
[1008447203] = "DeleteReq",
[1008449036] = "DeleteRsp",
[1067411524] = "BuyTicketReq",
[1067413357] = "BuyTicketRsp",
[1068769299] = "ReconnectReq",
[1068771132] = "ReconnectRsp",
[1070841461] = "LoginReq",
@ -198,6 +200,8 @@ local ProtoMsgType = {
ArenaBountyLevelUnlockRsp = 904224593,
DeleteReq = 1008447203,
DeleteRsp = 1008449036,
BuyTicketReq = 1067411524,
BuyTicketRsp = 1067413357,
ReconnectReq = 1068769299,
ReconnectRsp = 1068771132,
LoginReq = 1070841461,
@ -359,6 +363,8 @@ local ProtoMsgType = {
ArenaBountyLevelUnlockRsp = "ArenaBountyLevelUnlockRsp",
DeleteReq = "DeleteReq",
DeleteRsp = "DeleteRsp",
BuyTicketReq = "BuyTicketReq",
BuyTicketRsp = "BuyTicketRsp",
ReconnectReq = "ReconnectReq",
ReconnectRsp = "ReconnectRsp",
LoginReq = "LoginReq",

View File

@ -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

View File

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

View File

@ -0,0 +1,51 @@
-- 竞技场:调整阵容
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()
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.BUY_ENERGY))
uiMap["arena_formation_ui.banner.btn_ok"]:addClickListener(function()
ModuleManager.FormationManager:reqArenaFormation()
self:closeUI()
end)
local heroUI = uiMap["arena_formation_ui.hero_ui"]
heroUI:initPrefabHelper()
heroUI:genAllChildren()
self.heroComp = heroUI:addLuaComponent("app/ui/hero/hero_comp")
end
function ArenaFormationUI:onRefresh()
self.heroComp:refresh(GConst.BattleConst.FORMATION_TYPE.ARENA_ATTACK)
end
return ArenaFormationUI

View File

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

View File

@ -0,0 +1,181 @@
-- 竞技场:匹配
local ArenaMatchUI = class("ArenaMatchUI", BaseUI)
function ArenaMatchUI:isFullScreen()
return false
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()
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.spineLoading = uiMap["arena_match_ui.match_loading.spine_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.matchImgGrading = uiMap["arena_match_ui.match_result.match_info.img_grading"]
self.matchTxGrading = uiMap["arena_match_ui.match_result.match_info.img_grading.tx_grading"]
-- 对手编队
self.txMatchFormation = uiMap["arena_match_ui.match_result.match_formation.tx_match_formation"]
self.matchHeroFormationComp = uiMap["arena_match_ui.match_result.match_formation.hero_formation_comp"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_FORMATION_COMP)
-- 自己编队
self.txMyFormation = uiMap["arena_match_ui.match_result.my_formation.tx_my_formation"]
self.selfHeroFormationComp = uiMap["arena_match_ui.match_result.my_formation.hero_formation_comp"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.HERO_FORMATION_COMP)
-- 功能按钮
self.btnStart = uiMap["arena_match_ui.match_result.btn_start"]
self.imgConst = uiMap["arena_match_ui.match_result.btn_start.img_const"]
self.txStart = uiMap["arena_match_ui.match_result.btn_start.tx_start"]
self.txConst = uiMap["arena_match_ui.match_result.btn_start.tx_const"]
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()
-- todo 判断重新匹配状态
self:closeUI()
end)
self.btnFormation:addClickListener(function()
UIManager:showUI("app/ui/arena/arena_formation_ui")
self:closeUI()
end)
self:bind(DataManager.ArenaData, "isDirty", function()
self:onRefresh()
end)
end
function ArenaMatchUI:onRefresh()
self.matchInfo = DataManager.ArenaData:getMatchInfo()
if self.matchInfo == nil then
ModuleManager.ArenaManager:reqMatch()
self:showMatchLoading()
else
self:showMatchResult()
end
end
-- 展示匹配等待页
function ArenaMatchUI:showMatchLoading()
self.matchLoading:setActive(true)
self.matchResult:setActive(false)
self.txSeason:setText()
self.txLoading:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5))
self.txCancel:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5))
self.spineLoading:playAnimComplete("idle1", false, true, function()
self.spineLoading:playAnim("idle2", true, true)
end)
-- 等待
if self.waitSid == nil then
self.waitSid = self.matchLoading:scheduleGlobal(function()
self.matchInfo = DataManager.ArenaData:getMatchInfo()
if self.matchInfo ~= nil then
self:showMatchResult()
else
-- 居然还没获取到数据,继续等待,基本不会走到这
self:showMatchLoading()
end
end, 1.5)
end
end
-- 展示匹配结果页
function ArenaMatchUI:showMatchResult()
self.matchLoading:setActive(true)
self.matchResult:setActive(false)
self.txMatchFormation:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5))
self.txMyFormation:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5))
self.txStart:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5))
self.txConst:setText(0)
self.txRematch:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5))
self.txFormation:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5))
self.txFreeCountdown:setText(I18N:getGlobalText(I18N.GlobalConst.BATTLE_DESC_5))
local matchGradingId = DataManager.ArenaData:getGradingIdFromScore(self.matchInfo.score)
self.matchAvatar:refresh(self.matchInfo.avatar, self.matchInfo.avatar_frame)
self.matchTxName:setText(self.matchInfo.name)
self.matchTxLevel:setText(I18N:getGlobalText(I18N.GlobalConst.HERO_DESC_1, self.matchInfo.level))
self.matchImgGrading:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getGradingIconName(matchGradingId))
self.matchTxGrading:setText(DataManager.ArenaData:getGradingName(matchGradingId))
self.matchHeroFormationComp:refreshWithOtherHero(self.matchInfo.array_heroes)
self.selfHeroFormationComp:refresh()
self.freeRematchCD = DataManager.ArenaData:getFreeRematchCd()
if self.countdownSid then
ModuleManager.BattleManager:unscheduleGlobal(self.countdownSid)
end
self.countdownSid = self.txFreeCountdown:scheduleGlobal(function()
self:refreshCountdown()
end, 1)
end
function ArenaMatchUI:refreshCountdown()
self.freeRematchCD = self.freeRematchCD - 1
if self.freeRematchCD <= 0 then
-- 冷却已好
self.txFreeCountdown:setText("")
ModuleManager.BattleManager:unscheduleGlobal(self.countdownSid)
else
-- 冷却未好
self.txFreeCountdown:setText(GFunc.getTimeStrWithHMS(self.freeRematchCD))
end
end
return ArenaMatchUI

View File

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

View File

@ -0,0 +1,29 @@
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.imgGrading = uiMap["arena_rank_cell.img_grading"]
self.txGrading = uiMap["arena_rank_cell.img_grading.tx_grading"]
self.btnFormation = uiMap["arena_rank_cell.btn_formation"]
self.btnFormation:addClickListener(function()
-- 展示编队信息
end)
end
function ArenaRankCell:refresh(rank)
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)
local gradingId = DataManager.ArenaData:getGradingIdFromScore(self.rankInfo.score)
self.imgGrading:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getGradingIconName(gradingId))
self.txGrading:setText(DataManager.ArenaData:getGradingName(gradingId))
end
return ArenaRankCell

View File

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

View File

@ -0,0 +1,75 @@
-- 竞技场:排行榜
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.imgGrading = uiMap["arena_rank_ui.bg.my_rank.img_grading"]
self.txGrading = uiMap["arena_rank_ui.bg.my_rank.img_grading.tx_grading"]
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())
local gradingId = DataManager.ArenaData:getGradingId()
self.imgGrading:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getGradingIconName(gradingId))
self.txGrading:setText(DataManager.ArenaData:getGradingName(gradingId))
self.playerHeadCell:refresh()
self.scrollRectComp:addInitCallback(function()
return "app/ui/arena/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())
Logger.logHighlight("排行榜玩家总数")
Logger.logHighlight(DataManager.ArenaData:getRankCount())
end
return ArenaRankUI

View File

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

View File

@ -0,0 +1,108 @@
-- 竞技场:最近战报
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
Logger.logHighlight(showCount)
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("<color=#2BFF35>"..info.incr_score.."</color>")
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("<color=#FF5454>"..info.incr_score.."</color>")
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

View File

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

View File

@ -0,0 +1,27 @@
local ArenaSeasonRewardCell = class("ArenaSeasonRewardCell", BaseCell)
function ArenaSeasonRewardCell:init()
local uiMap = self:getUIMap()
self.imgGrading = uiMap["arena_reward_cell.img_grading"]
self.txGrading = uiMap["arena_reward_cell.img_grading.tx_grading"]
self.scrollRectComp = uiMap["arena_reward_cell.rewards"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE)
end
function ArenaSeasonRewardCell:refresh(id)
local rewards = DataManager.ArenaData:getGradingRewardInfo(id)
self.scrollRectComp:addInitCallback(function()
return GConst.TYPEOF_LUA_CLASS.REWARD_CELL
end)
self.scrollRectComp:addRefreshCallback(function(index, cell)
cell:refreshByConfig(rewards[index])
end)
self.scrollRectComp:clearCells()
self.scrollRectComp:refillCells(#rewards)
local lastGradingId = DataManager.ArenaData:getLastGradingId()
self.imgGrading:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getGradingIconName(id))
self.txGrading:setText(DataManager.ArenaData:getGradingName(id))
end
return ArenaSeasonRewardCell

View File

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

View File

@ -0,0 +1,122 @@
-- 竞技场:赛季奖励
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)
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/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:getLastSeasonRewardInfo(lastId)
self.txSeason:setText(I18N:getGlobalText(I18N.GlobalConst.ARENA_DESC_13, DataManager.ArenaData:getSeason() - 1))
self.imgGrading:setSprite(GConst.ATLAS_PATH.ARENA, DataManager.ArenaData:getLastGradingIconName(lastId))
self.txGrading:setText(DataManager.ArenaData:getLastGradingName(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

View File

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

View File

@ -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:refreshWithOtherHero(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)

View File

@ -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)

View File

@ -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:setFormationVisible(true)
end
function HeroFormationComp:refresh()
-- todo 传参控制显示对手还是自己的编队
-- 显示自己英雄阵容
local formation = DataManager.FormationData:getStageFormation()
for i, heroCell in ipairs(self.heroCells) do
if formation[i] then
@ -36,7 +35,20 @@ function HeroFormationComp:refresh()
end
end
function HeroFormationComp:refreshWithOtherHero(formation)
-- 显示他人英雄阵容
for i, heroCell in ipairs(self.heroCells) do
if formation[i] then
heroCell:setVisible(true, 1)
heroCell:refreshWithOtherHero(formation[i].id, formation[i].level)
else
heroCell:setVisible(false)
end
end
end
function HeroFormationComp:setFormationVisible(visible)
self.baseObject:setActive(true)
self.baseObject:setVisible(visible)
end

View File

@ -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)

View File

@ -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)
@ -50,7 +50,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 +62,63 @@ 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.uiMap["hero_ui.top_bg.title_bg_img.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.MAIN_BTN_2))
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.uiMap["hero_ui.top_bg.title_bg_img.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.MAIN_BTN_1))
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.uiMap["hero_ui.top_bg.title_bg_img.title_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.QLT_DESC_1))
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 +127,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 +146,7 @@ function HeroComp:refreshStageFormation()
end
end
end
end
function HeroComp:refreshScrollRect()
self:sortHeroList()
self.allHeroCount = #self.heroList
self.unlockCount = DataManager.HeroData:getUnlockHeroCount()
@ -164,14 +204,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)

View File

@ -0,0 +1,93 @@
local MainCompBaseCell = require "app/ui/main_city/component/main_comp_base_cell"
local ArenaComp = class("ArenaComp", MainCompBaseCell)
function ArenaComp:getIsOpen()
return true
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:getShowEntranceRedPoint()
return true
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")
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:refreshShow()
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.seasonChangeCD = DataManager.ArenaData:getRemainSeasonTime()
if self.seasonChangeSid then
ModuleManager.BattleManager:unscheduleGlobal(self.seasonChangeSid)
end
self.seasonChangeSid = self.txCountdown:scheduleGlobal(function()
self:refreshCountdown()
end, 1)
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

View File

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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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,188 @@ 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)
else
self.txFight:setActive(false)
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 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 +282,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:setFormationVisible(self.moduleMap[self.curModuleType]:isShowHeroFormation())
end
function MainComp:refresh()
@ -196,6 +296,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 +316,17 @@ 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

View File

@ -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

View File

@ -188,14 +188,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
@ -660,7 +660,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
@ -715,9 +715,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 +742,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

View File

@ -0,0 +1,384 @@
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-- 匹配成功时间,超过配置时间后,匹配对象过期,需要重新匹配
self.matchFreeCdEndTime = data.match_success_cd_end_at-- 免费匹配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 = table.removeEx(ConfigManager:getConfig("arena_rank"), function(key, value)
if value.season == season then
return false, true
else
return true, true
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)
return self.cfgRank[id].season_reward
end
-- 获取上赛季奖励信息
function ArenaData:getLastSeasonRewardInfo(id)
if self.season == 1 then
return nil
end
return self:getRankCfg(self.season - 1)[id].season_reward
end
-- 获取积分所对应的段位id
function ArenaData:getGradingIdFromScore(score)
local seasonId,grading = nil
for id, data in pairs(self.cfgRank) 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)
if self.cfgRank[id] == nil then
Logger.logError("未找到段位[%d]相关数据", id)
return nil
end
return "arena_dan_" .. self.cfgRank[id].rank_icon
end
-- 获取上赛季段位图标名
function ArenaData:getLastGradingIconName(id)
return "arena_dan_" .. self:getRankCfg(self.season - 1)[id].rank_icon
end
-- 获取段位名称
function ArenaData:getGradingName(id)
return I18N:getGlobalText(self.cfgRank[id].name_txt)
end
-- 获取上赛季段位名称
function ArenaData:getLastGradingName(id)
return I18N:getGlobalText(self:getRankCfg(self.season - 1)[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:getFightCost()
return 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 id == self.curGradingId then
isNext = true
end
if isNext then
return data.score
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 self:getTicketNum() > 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
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
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

View File

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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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