Merge branch 'dev' of git.juzugame.com:b6-client/b6-lua into dev

This commit is contained in:
chenxi 2023-04-21 16:27:27 +08:00
commit c6ea40de7e
34 changed files with 1081 additions and 925 deletions

View File

@ -11,6 +11,7 @@ function DataManager:init()
self:initManager("BagData", "app/userdata/bag/bag_data")
self:initManager("BattleData", "app/userdata/battle/battle_data")
self:initManager("FormationData", "app/userdata/formation/formation_data")
self:initManager("TutorialData", "app/userdata/tutorial/tutorial_data")
end
function DataManager:initManager(name, path)
@ -87,6 +88,7 @@ function DataManager:initWithServerData(data)
self.HeroData:init(data.HeroData)
self.BagData:init(data.BagData)
self.FormationData:init(data.FormationData)
self.TutorialData:init(data.TutorialData)
self:scheduleGlobal()
self:checkDataBind()

View File

@ -19,6 +19,9 @@ EventManager.CUSTOM_EVENT = {
TUTORIAL_TASK_REWARD = "TUTORIAL_TASK_REWARD",
ATK_TRAIN_TUTORIAL_OVER = "ATK_TRAIN_TUTORIAL_OVER",
TUTORIAL_TASK_STOP = "TUTORIAL_TASK_STOP",
ELIMINATION_OVER = "ELIMINATION_OVER",
SHOW_ELIMINATION_TUTORAIL = "SHOW_ELIMINATION_TUTORAIL",
BOARD_FILL_OVER = "BOARD_FILL_OVER",
-- BORAD_TOUCH_BEGIN = "BORAD_TOUCH_BEGIN",
-- BORAD_TOUCH_OVER = "BORAD_TOUCH_OVER"
}

View File

@ -3,181 +3,181 @@ local battle_exp = {
["exp"]=10000
},
[2]={
["exp"]=20000
["exp"]=10000
},
[3]={
["exp"]=30000
["exp"]=10000
},
[4]={
["exp"]=40000
["exp"]=10000
},
[5]={
["exp"]=50000
["exp"]=10000
},
[6]={
["exp"]=60000
["exp"]=10000
},
[7]={
["exp"]=70000
["exp"]=10000
},
[8]={
["exp"]=80000
["exp"]=10000
},
[9]={
["exp"]=90000
["exp"]=10000
},
[10]={
["exp"]=100000
["exp"]=10000
},
[11]={
["exp"]=110000
["exp"]=10000
},
[12]={
["exp"]=120000
["exp"]=10000
},
[13]={
["exp"]=130000
["exp"]=10000
},
[14]={
["exp"]=140000
["exp"]=10000
},
[15]={
["exp"]=150000
["exp"]=10000
},
[16]={
["exp"]=160000
["exp"]=10000
},
[17]={
["exp"]=170000
["exp"]=10000
},
[18]={
["exp"]=180000
["exp"]=10000
},
[19]={
["exp"]=190000
["exp"]=10000
},
[20]={
["exp"]=200000
["exp"]=10000
},
[21]={
["exp"]=210000
["exp"]=10000
},
[22]={
["exp"]=220000
["exp"]=10000
},
[23]={
["exp"]=230000
["exp"]=10000
},
[24]={
["exp"]=240000
["exp"]=10000
},
[25]={
["exp"]=250000
["exp"]=10000
},
[26]={
["exp"]=260000
["exp"]=10000
},
[27]={
["exp"]=270000
["exp"]=10000
},
[28]={
["exp"]=280000
["exp"]=10000
},
[29]={
["exp"]=290000
["exp"]=10000
},
[30]={
["exp"]=300000
["exp"]=10000
},
[31]={
["exp"]=310000
["exp"]=10000
},
[32]={
["exp"]=320000
["exp"]=10000
},
[33]={
["exp"]=330000
["exp"]=10000
},
[34]={
["exp"]=340000
["exp"]=10000
},
[35]={
["exp"]=350000
["exp"]=10000
},
[36]={
["exp"]=360000
["exp"]=10000
},
[37]={
["exp"]=370000
["exp"]=10000
},
[38]={
["exp"]=380000
["exp"]=10000
},
[39]={
["exp"]=390000
["exp"]=10000
},
[40]={
["exp"]=400000
["exp"]=10000
},
[41]={
["exp"]=410000
["exp"]=10000
},
[42]={
["exp"]=420000
["exp"]=10000
},
[43]={
["exp"]=430000
["exp"]=10000
},
[44]={
["exp"]=440000
["exp"]=10000
},
[45]={
["exp"]=450000
["exp"]=10000
},
[46]={
["exp"]=460000
["exp"]=10000
},
[47]={
["exp"]=470000
["exp"]=10000
},
[48]={
["exp"]=480000
["exp"]=10000
},
[49]={
["exp"]=490000
["exp"]=10000
},
[50]={
["exp"]=500000
["exp"]=10000
},
[51]={
["exp"]=510000
["exp"]=10000
},
[52]={
["exp"]=520000
["exp"]=10000
},
[53]={
["exp"]=530000
["exp"]=10000
},
[54]={
["exp"]=540000
["exp"]=10000
},
[55]={
["exp"]=550000
["exp"]=10000
},
[56]={
["exp"]=560000
["exp"]=10000
},
[57]={
["exp"]=570000
["exp"]=10000
},
[58]={
["exp"]=580000
["exp"]=10000
},
[59]={
["exp"]=590000
["exp"]=10000
},
[60]={
["exp"]=600000
["exp"]=10000
}
}
local config = {

View File

@ -206,11 +206,11 @@ local chapter_board = {
2,
2,
2,
4,
2,
2,
2,
3
2,
2
}
},
[2]={
@ -220,36 +220,12 @@ local chapter_board = {
0
},
{
1,
0
},
{
1,
0
0,
1
},
{
0,
4
},
{
1,
0
},
{
1,
0
},
{
1,
0
},
{
1,
0
},
{
1,
0
3
},
{
0,
@ -277,7 +253,7 @@ local chapter_board = {
},
{
0,
3
1
},
{
0,
@ -287,14 +263,6 @@ local chapter_board = {
0,
1
},
{
0,
1
},
{
0,
3
},
{
1,
0
@ -304,12 +272,8 @@ local chapter_board = {
0
},
{
0,
2
},
{
0,
3
1,
0
},
{
0,
@ -319,22 +283,6 @@ local chapter_board = {
0,
3
},
{
0,
4
},
{
1,
0
},
{
1,
0
},
{
0,
1
},
{
0,
1
@ -347,10 +295,6 @@ local chapter_board = {
0,
4
},
{
0,
2
},
{
1,
0
@ -365,7 +309,7 @@ local chapter_board = {
},
{
0,
4
3
},
{
0,
@ -373,11 +317,7 @@ local chapter_board = {
},
{
0,
2
},
{
1,
0
3
},
{
1,
@ -397,7 +337,67 @@ local chapter_board = {
},
{
0,
4
1
},
{
1,
0
},
{
0,
1
},
{
1,
0
},
{
1,
0
},
{
1,
0
},
{
1,
0
},
{
1,
0
},
{
1,
0
},
{
1,
0
},
{
1,
0
},
{
1,
0
},
{
1,
0
},
{
1,
0
},
{
1,
0
},
{
1,
0
},
{
1,
@ -411,13 +411,6 @@ local chapter_board = {
1,
0
}
},
["control_element"]={
4,
3,
4,
1,
4
}
},
[3]={

362
lua/app/config/fx.lua Normal file
View File

@ -0,0 +1,362 @@
local fx = {
[100000]={
["res"]="sfx_m10001_b01_01",
["bind"]="root"
},
[100001]={
["res"]="sfx_m10001_b01_02",
["bind"]="root"
},
[100002]={
["res"]="sfx_m10001_b01_03",
["bind"]="root"
},
[100003]={
["res"]="sfx_m10006_b01",
["bind"]="root"
},
[100004]={
["res"]="sfx_m10006_b02",
["bind"]="root"
},
[100005]={
["res"]="sfx_m10006_b03",
["bind"]="root"
},
[100006]={
["res"]="sfx_m10010_b01",
["bind"]="root"
},
[100007]={
["res"]="sfx_m10010_b02",
["bind"]="root"
},
[100008]={
["res"]="sfx_m10010_b03",
["bind"]="root"
},
[100009]={
["res"]="sfx_m10011_b01",
["bind"]="root"
},
[100010]={
["res"]="sfx_m10011_b03",
["bind"]="root"
},
[100011]={
["res"]="sfx_m10012_b01",
["bind"]="root"
},
[100012]={
["res"]="sfx_m10012_b02",
["bind"]="root"
},
[100013]={
["res"]="sfx_m10016_b01",
["bind"]="root"
},
[100014]={
["res"]="sfx_m10016_b02",
["bind"]="root"
},
[100015]={
["res"]="sfx_m10016_b03",
["bind"]="root"
},
[200000]={
["res"]="sfx_m20001_b01",
["bind"]="root"
},
[200001]={
["res"]="sfx_m20001_b02",
["bind"]="root"
},
[200002]={
["res"]="sfx_m20001_b03",
["bind"]="root"
},
[200003]={
["res"]="sfx_m20002_b01",
["bind"]="root"
},
[200004]={
["res"]="sfx_m20002_b02",
["bind"]="root"
},
[200005]={
["res"]="sfx_m20002_b03",
["bind"]="root"
},
[200006]={
["res"]="sfx_m20003_b01",
["bind"]="root"
},
[200007]={
["res"]="sfx_m20003_b02",
["bind"]="root"
},
[200008]={
["res"]="sfx_m20003_b03",
["bind"]="root"
},
[200009]={
["res"]="sfx_m20003_b04",
["bind"]="root"
},
[200010]={
["res"]="sfx_m20004_b01",
["bind"]="root"
},
[200011]={
["res"]="sfx_m20004_b02",
["bind"]="root"
},
[200012]={
["res"]="sfx_m20005_b01",
["bind"]="root"
},
[200013]={
["res"]="sfx_m20005_b02",
["bind"]="root"
},
[200014]={
["res"]="sfx_m20005_b03",
["bind"]="root"
},
[200015]={
["res"]="sfx_m20005_b04",
["bind"]="root"
},
[200016]={
["res"]="sfx_m20006_b01",
["bind"]="root"
},
[200017]={
["res"]="sfx_m20006_b02",
["bind"]="root"
},
[200018]={
["res"]="sfx_m20006_b03",
["bind"]="root"
},
[200019]={
["res"]="sfx_m20006_b04",
["bind"]="root"
},
[200020]={
["res"]="sfx_m20007_b01",
["bind"]="root"
},
[200021]={
["res"]="sfx_m20007_b02",
["bind"]="root"
},
[200022]={
["res"]="sfx_m20007_b03",
["bind"]="root"
},
[200023]={
["res"]="sfx_m20007_b04",
["bind"]="root"
},
[200024]={
["res"]="sfx_m20008_b01",
["bind"]="root"
},
[200025]={
["res"]="sfx_m20008_b02",
["bind"]="root"
},
[200026]={
["res"]="sfx_m20008_b03",
["bind"]="root"
},
[200027]={
["res"]="sfx_m20008_b04",
["bind"]="root"
},
[200028]={
["res"]="sfx_m20009_b01",
["bind"]="root"
},
[200029]={
["res"]="sfx_m20009_b02",
["bind"]="root"
},
[200030]={
["res"]="sfx_m20009_b03",
["bind"]="root"
},
[200031]={
["res"]="sfx_m20010_b01",
["bind"]="root"
},
[200032]={
["res"]="sfx_m20010_b03",
["bind"]="root"
},
[200033]={
["res"]="sfx_m20011_b01",
["bind"]="root"
},
[200034]={
["res"]="sfx_m20011_b02",
["bind"]="root"
},
[200035]={
["res"]="sfx_m20011_b03",
["bind"]="root"
},
[200036]={
["res"]="sfx_m20012_b01",
["bind"]="root"
},
[200037]={
["res"]="sfx_m20012_b02",
["bind"]="root"
},
[200038]={
["res"]="sfx_m20012_b03",
["bind"]="root"
},
[200039]={
["res"]="sfx_m20012_b04",
["bind"]="root"
},
[300000]={
["res"]="sfx_p0001_b01",
["bind"]="root"
},
[300001]={
["res"]="sfx_p0001_b02",
["bind"]="root"
},
[300002]={
["res"]="sfx_p0001_b03",
["bind"]="root"
},
[300003]={
["res"]="sfx_p0001_b04",
["bind"]="root"
},
[300004]={
["res"]="sfx_p0002_b01",
["bind"]="root"
},
[300005]={
["res"]="sfx_p0002_b02",
["bind"]="root"
},
[300006]={
["res"]="sfx_p0002_b03",
["bind"]="root"
},
[300007]={
["res"]="sfx_p0002_b04",
["bind"]="root"
},
[300008]={
["res"]="sfx_p0002_b05",
["bind"]="root"
},
[300009]={
["res"]="sfx_p0003_b01",
["bind"]="root"
},
[300010]={
["res"]="sfx_p0003_b02",
["bind"]="root"
},
[300011]={
["res"]="sfx_p0003_b03",
["bind"]="root"
},
[300012]={
["res"]="sfx_p0003_b04",
["bind"]="root"
},
[300013]={
["res"]="sfx_p0004_b01",
["bind"]="root"
},
[300014]={
["res"]="sfx_p0004_b03",
["bind"]="root"
},
[300015]={
["res"]="sfx_p0004_b04",
["bind"]="root"
},
[300016]={
["res"]="sfx_p0004_b05",
["bind"]="root"
},
[300017]={
["res"]="sfx_p0005_b01",
["bind"]="root"
},
[300018]={
["res"]="sfx_p0005_b02",
["bind"]="root"
},
[300019]={
["res"]="sfx_p0005_b03",
["bind"]="root"
},
[300020]={
["res"]="sfx_p0005_b04",
["bind"]="root"
},
[300021]={
["res"]="sfx_p0006_b01",
["bind"]="root"
},
[300022]={
["res"]="sfx_p0006_b02",
["bind"]="root"
},
[300023]={
["res"]="sfx_p0006_b03",
["bind"]="root"
},
[300024]={
["res"]="sfx_p0006_b04",
["bind"]="root"
},
[300025]={
["res"]="sfx_p0006_b05",
["bind"]="root"
},
[300026]={
["res"]="sfx_p0007_b01",
["bind"]="root"
},
[300027]={
["res"]="sfx_p0007_b02",
["bind"]="root"
},
[300028]={
["res"]="sfx_p0007_b03",
["bind"]="root"
},
[300029]={
["res"]="sfx_p0007_b04",
["bind"]="root"
},
[300030]={
["res"]="sfx_p0008_b01",
["bind"]="root"
},
[300031]={
["res"]="sfx_p0008_b05",
["bind"]="root"
},
[300032]={
["res"]="sfx_p0008_b06",
["bind"]="root"
}
}
local config = {
data=fx,count=89
}
return config

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 1fa9da99f3507cd4688b77793381a636
guid: 3d15f668fda6e404dbee3fe8789124e6
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@ -40,7 +40,6 @@ local LocalizationGlobalConst =
HERO_DESC_9 = "HERO_DESC_9",
HERO_DESC_10 = "HERO_DESC_10",
BATTLE_DESC_8 = "BATTLE_DESC_8",
HERO_DESC_11 = "HERO_DESC_11",
}
return LocalizationGlobalConst

File diff suppressed because it is too large Load Diff

View File

@ -292,7 +292,7 @@ local skill = {
["effect"]={
{
["type"]="hurt_yellow",
["num"]=20000,
["num"]=30000,
["ratio"]=10000,
["round"]=0
}
@ -336,7 +336,7 @@ local skill = {
["effect"]={
{
["type"]="hurt_yellow",
["num"]=20000,
["num"]=30000,
["ratio"]=10000,
["round"]=0
}
@ -481,7 +481,7 @@ local skill = {
["effect"]={
{
["type"]="heal",
["num"]=2000,
["num"]=8000,
["ratio"]=10000,
["round"]=1
}
@ -771,7 +771,7 @@ local skill = {
["effect"]={
{
["type"]="hurt",
["num"]=20000,
["num"]=40000,
["ratio"]=10000,
["round"]=0
}
@ -903,7 +903,7 @@ local skill = {
["effect"]={
{
["type"]="hurt",
["num"]=20000,
["num"]=25000,
["ratio"]=10000,
["round"]=0
}
@ -1118,7 +1118,7 @@ local skill = {
["effect"]={
{
["type"]="hurt",
["num"]=20000,
["num"]=25000,
["ratio"]=10000,
["round"]=0
}

View File

@ -38,11 +38,8 @@ local localization_global =
["REWARD_PREVIEW_DESC"] = "奖励预览",
["HERO_DESC_8"] = "使用",
["HERO_DESC_9"] = "信息",
["HERO_DESC_10"] = "通关章节{0}解锁",
["BATTLE_DESC_8"] = "还有可上阵英雄",
["HERO_DESC_11"] = "已解锁",
}
return localization_global

View File

@ -24,35 +24,35 @@ local item = {
["desc"]="可以获得史诗英雄。"
},
[12001]={
["name"]="洛克西",
["name"]="洛克西英雄碎片",
["desc"]="凑齐可解锁或升级。"
},
[22001]={
["name"]="卡拉",
["name"]="卡拉英雄碎片",
["desc"]="凑齐可解锁或升级。"
},
[23001]={
["name"]="巨剑罗伯特",
["name"]="巨剑罗伯特英雄碎片",
["desc"]="凑齐可解锁或升级。"
},
[32001]={
["name"]="阿斯克",
["name"]="阿斯克英雄碎片",
["desc"]="凑齐可解锁或升级。"
},
[33001]={
["name"]="艾芙琳",
["name"]="艾芙琳英雄碎片",
["desc"]="凑齐可解锁或升级。"
},
[42001]={
["name"]="莉莉丝",
["name"]="莉莉丝英雄碎片",
["desc"]="凑齐可解锁或升级。"
},
[43001]={
["name"]="白发凯瑟琳",
["name"]="白发凯瑟琳英雄碎片",
["desc"]="凑齐可解锁或升级。"
},
[52001]={
["name"]="艾伦",
["name"]="艾伦英雄碎片",
["desc"]="凑齐可解锁或升级。"
}
}

View File

@ -2,6 +2,7 @@ local tutorial = {
[10000]={
["next_id"]=10010,
["type"]=6,
["finish"]=4,
["target_element"]={
53,
44,
@ -32,6 +33,7 @@ local tutorial = {
[10040]={
["next_id"]=10050,
["type"]=6,
["finish"]=4,
["target_element"]={
33,
23,
@ -53,6 +55,7 @@ local tutorial = {
},
[10060]={
["type"]=6,
["finish"]=4,
["target_element"]={
23,
13,

View File

@ -654,7 +654,6 @@ function GFunc.addRewards(rewards, itemGetType)
local newRewards = {}
GFunc.mergeRewards2(rewards, newRewards)
local runeList = {}
-- 根据类型type来添加奖励
for k, v in ipairs(newRewards) do
if v.type == GConst.REWARD_TYPE.ITEM then
@ -663,8 +662,6 @@ function GFunc.addRewards(rewards, itemGetType)
DataManager.BagData.EquipData:addEquipCountById(v.equip.id, v.equip.count, itemGetType)
end
end
ModuleManager.TaskManager:addTaskProgress(GConst.TaskConst.TASK_TYPE.X_RUNE_GOT, {runeList = runeList})
end
function GFunc.addCosts(costs, itemGetType)

View File

@ -15,7 +15,7 @@ function BattleManager:showPauseUI()
end
function BattleManager:showSelectSkillUI(skillList)
UIManager:showUI("app/ui/battle/battle_skill_select_ui", {skillList = skillList})
UIManager:showUI(UIManager.UI_PATH.ROGUE_SKILL_UI, {skillList = skillList})
end
function BattleManager:showBattleResultUI(rewards, combatReport)

View File

@ -512,110 +512,65 @@ function BattleController:onTouchEvent(eventType, posId)
end
if eventType == ELIMINATION_TOUCH_EVENT.DOWN then
if #self.battleData:getGridSequence() > 0 then
self.battleData:clearGridSequence()
end
self.battleData:insertGridSequence(posId, self:snapshotBoard())
local skillEntity = self.battleData:getSkillEntityBySkillId(entity:getSkillId())
local maskElementType = entity:getElementType(skillEntity)
self.battleUI:showBoardMask(maskElementType)
self:findSkillInfluenceGrids()
self:onLinkChange()
self:onLinkStart(entity, posId)
elseif eventType == ELIMINATION_TOUCH_EVENT.ENTER then
local sequence = self.battleData:getGridSequence()
local info = sequence[#sequence]
local lastPosId = info and info.posId
if not lastPosId then
return
end
local outLineMap = BattleConst.GRID_OUT_LINE_POS_ID[lastPosId]
if not outLineMap or not outLineMap[posId] then
return
end
if self.battleData:alreadyInsertSequence(posId) then
local info = sequence[#sequence - 1]
local beforePosId = info and info.posId
if not beforePosId then
return
end
if beforePosId == posId then -- 进入的是倒数第二个,则移除倒数第一个
local snapshot = self.battleData:removeGridSequence(lastPosId)
if snapshot then -- 如果有快照,则恢复一次
for posId, info in pairs(snapshot) do
local entity = self.battleData:getGridEntity(posId)
if entity then
entity:setInfoBySnapshop(info)
end
end
end
local lastEntity = self.battleData:getGridEntity(beforePosId)
local lastSkillEntity = self.battleData:getSkillEntityBySkillId(lastEntity:getSkillId())
local maskElementType = lastEntity:getElementType(lastSkillEntity)
self.battleUI:showBoardMask(maskElementType)
self:findSkillInfluenceGrids()
self:onLinkChange()
return
end
end
local skillId = entity:getSkillId()
local skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
local elementType = entity:getElementType(skillEntity)
local lastEntity = self.battleData:getGridEntity(lastPosId)
local lastSkillId = lastEntity:getSkillId()
local lastSkillEntity = self.battleData:getSkillEntityBySkillId(lastSkillId)
local lastElementType = lastEntity:getElementType(lastSkillEntity)
if skillEntity and self.battleData:getSequenceHadSkill() then
return
end
if not elementType or not lastElementType then
else
if lastElementType ~= elementType then
return
end
end
local maskElementType = elementType or lastElementType
self.battleUI:showBoardMask(maskElementType)
self.battleData:insertGridSequence(posId, self:snapshotBoard())
if lastEntity:getNeedChangePos() and not entity:getNeedChangePos() then -- 需要移动到队列末尾
local lastSkillId = lastEntity:getSkillId()
local skillId = entity:getSkillId()
self:setGridSkillId(lastPosId, skillId)
self:setGridSkillId(posId, lastSkillId)
end
local newElementType = elementType or lastElementType
if newElementType then
entity:setElementType(newElementType)
lastEntity:setElementType(newElementType)
end
entity:addLinkSkillCount()
self:findSkillInfluenceGrids()
self:onLinkChange()
self:onLinkEnter(entity, posId)
elseif eventType == ELIMINATION_TOUCH_EVENT.EXIT then
else -- 取消和抬起
self.battleUI:showBoardMask(nil)
local sequence = self.battleData:getGridSequence()
local count = #sequence
if count < self:getMinEliminationCount() then
if count <= 0 then
self.battleData:clearGridSequence()
self:onLinkChange()
self:onLinkCancelOrUp(entity, posId)
end
end
function BattleController:onLinkStart(entity, posId)
if DataManager.TutorialData:getIsInTutorial() then
local elementList = DataManager.TutorialData:getTargetElement()
if elementList then
local find = false
for _, curPosId in ipairs(elementList) do
if curPosId == posId then
find = true
break
end
end
if not find then
return
end
end
end
local snapshot = self.battleData:getFirstSequenceSnapshot()
self.battleUI:showTutorialFinger()
if #self.battleData:getGridSequence() > 0 then
self.battleData:clearGridSequence()
end
self.battleData:insertGridSequence(posId, self:snapshotBoard())
local skillEntity = self.battleData:getSkillEntityBySkillId(entity:getSkillId())
local maskElementType = entity:getElementType(skillEntity)
self.battleUI:showBoardMask(maskElementType)
self:findSkillInfluenceGrids()
self:onLinkChange()
end
function BattleController:onLinkEnter(entity, posId)
local sequence = self.battleData:getGridSequence()
local info = sequence[#sequence]
local lastPosId = info and info.posId
if not lastPosId then
return
end
local outLineMap = BattleConst.GRID_OUT_LINE_POS_ID[lastPosId]
if not outLineMap or not outLineMap[posId] then
return
end
if self.battleData:alreadyInsertSequence(posId) then
local info = sequence[#sequence - 1]
local beforePosId = info and info.posId
if not beforePosId then
return
end
if beforePosId == posId then -- 进入的是倒数第二个,则移除倒数第一个
local snapshot = self.battleData:removeGridSequence(lastPosId)
if snapshot then -- 如果有快照,则恢复一次
for posId, info in pairs(snapshot) do
local entity = self.battleData:getGridEntity(posId)
@ -625,15 +580,112 @@ function BattleController:onTouchEvent(eventType, posId)
end
end
self.battleData:clearGridSequence()
local lastEntity = self.battleData:getGridEntity(beforePosId)
local lastSkillEntity = self.battleData:getSkillEntityBySkillId(lastEntity:getSkillId())
local maskElementType = lastEntity:getElementType(lastSkillEntity)
self.battleUI:showBoardMask(maskElementType)
self:findSkillInfluenceGrids()
self:onLinkChange()
return
end
end
local skillId = entity:getSkillId()
local skillEntity = self.battleData:getSkillEntityBySkillId(skillId)
local elementType = entity:getElementType(skillEntity)
local lastEntity = self.battleData:getGridEntity(lastPosId)
local lastSkillId = lastEntity:getSkillId()
local lastSkillEntity = self.battleData:getSkillEntityBySkillId(lastSkillId)
local lastElementType = lastEntity:getElementType(lastSkillEntity)
if skillEntity and self.battleData:getSequenceHadSkill() then
return
end
if not elementType or not lastElementType then
else
if lastElementType ~= elementType then
return
end
end
local maskElementType = elementType or lastElementType
self.battleUI:showBoardMask(maskElementType)
self.battleData:insertGridSequence(posId, self:snapshotBoard())
if lastEntity:getNeedChangePos() and not entity:getNeedChangePos() then -- 需要移动到队列末尾
local lastSkillId = lastEntity:getSkillId()
local skillId = entity:getSkillId()
self:setGridSkillId(lastPosId, skillId)
self:setGridSkillId(posId, lastSkillId)
end
local newElementType = elementType or lastElementType
if newElementType then
entity:setElementType(newElementType)
lastEntity:setElementType(newElementType)
end
entity:addLinkSkillCount()
self:findSkillInfluenceGrids()
self:onLinkChange()
end
function BattleController:onLinkCancelOrUp(entity, posId)
local tutorialElementList
if DataManager.TutorialData:getIsInTutorial() then
tutorialElementList = DataManager.TutorialData:getTargetElement()
end
self.battleUI:showBoardMask(nil)
local sequence = self.battleData:getGridSequence()
local count = #sequence
if count < self:getMinEliminationCount() then
self:clearGridSequence()
if tutorialElementList then
self.battleUI:showTutorialFinger(tutorialElementList)
end
return
end
if tutorialElementList then
local posIdmap = {}
for _, info in ipairs(sequence) do
posIdmap[info.posId] = true
end
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.ELIMINATION_OVER, posIdmap)
else
self:onLinkOver()
end
end
function BattleController:clearGridSequence()
local sequence = self.battleData:getGridSequence()
local count = #sequence
if count <= 0 then
self.battleData:clearGridSequence()
self:onLinkChange()
return
end
local snapshot = self.battleData:getFirstSequenceSnapshot()
if snapshot then -- 如果有快照,则恢复一次
for posId, info in pairs(snapshot) do
local entity = self.battleData:getGridEntity(posId)
if entity then
entity:setInfoBySnapshop(info)
end
end
end
self.battleData:clearGridSequence()
self:onLinkChange()
end
function BattleController:onLinkOver()
self.battleUI:hideAllSfxLine()
local sequence = self.battleData:getGridSequence()
@ -807,6 +859,8 @@ function BattleController:fillBoard()
end
function BattleController:onFillBoardOver()
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.BOARD_FILL_OVER)
self:generateSkill(function()
self.battleUI:refreshSkill()
local defTeam = self.battleData:getDefTeam()

View File

@ -6,10 +6,14 @@ end
-- 从登录界面第一次进入主城
function MaincityManager:firstEnterMainCity()
self:showMainCityUI(true)
-- ModuleManager.BattleManager:playBattle(ModuleManager.BattleManager.BATTLE_TYPE.STAGE)
-- SDKManager:doUncompletePay()
-- BIReport:postFightBegin(ModuleManager.BattleManager.BATTLE_TYPE.STAGE, DataManager.ChapterData:getCurChapterId(), DataManager.ChapterData:getHistoryChapterId())
if ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.START_TUTORIAL, true) then
DataManager.ChapterData:setChapterId(DataManager.ChapterData.MIN_CHAPTER_ID)
ModuleManager.BattleManager:playBattle(GConst.BattleConst.BATTLE_TYPE.STAGE)
else
self:showMainCityUI(true)
-- SDKManager:doUncompletePay()
-- BIReport:postFightBegin(ModuleManager.BattleManager.BATTLE_TYPE.STAGE, DataManager.ChapterData:getCurChapterId(), DataManager.ChapterData:getHistoryChapterId())
end
end
return MaincityManager

View File

@ -33,7 +33,7 @@ function TipsManager:showRewardTips(id, type, tarPrefabObj, alignType, params)
end
function TipsManager:showRewardsBox(params)
UIManager:showUI("app/ui/tips/reward_box", params)
UIManager:showUI(UIManager.UI_PATH.REWARD_BOX, params)
end
function TipsManager:showItemTips(id, tarPrefabObj, alignType)

View File

@ -63,12 +63,19 @@ local function _tutorialEmptyCancelBlock(tutorialId)
ModuleManager.TutorialManager:checkAndNextTutorial(tutorialId)
end
local function _tutorialToElimination(tutorialId)
ModuleManager.TutorialManager:setBlockTouchEnabled(false)
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SHOW_ELIMINATION_TUTORAIL, DataManager.TutorialData:getTargetElement())
ModuleManager.TutorialManager:checkAndNextTutorial(tutorialId)
end
TutorialAction._doTutorial = {
[TutorialConst.TUTORIAL_TYPE.CLICK] = _tutorialClick,
[TutorialConst.TUTORIAL_TYPE.CLICK_BTN] = _tutorialClickBtn,
[TutorialConst.TUTORIAL_TYPE.TALK] = _tutorialTalk,
[TutorialConst.TUTORIAL_TYPE.DO_NOTHING] = _tutorialEmpty,
[TutorialConst.TUTORIAL_TYPE.EMPTY_CANCEL_BLOCK] = _tutorialEmptyCancelBlock,
[TutorialConst.TUTORIAL_TYPE.TO_ELIMINATION] = _tutorialToElimination,
}
-- 此步引导结束的时候

View File

@ -3,39 +3,38 @@ local TutorialConst = {}
TutorialConst.FINGER_MOVE_SPEED = 200
TutorialConst.DEFAULT_RADIUS = 100
TutorialConst.START_TUTORIAL = 1
TutorialConst.PASS_ONE_CHAPTER = 2
TutorialConst.TWO_CHAPTER_BOX_CAN_GOT = 3
TutorialConst.PASS_THREE_CHAPTER = 4
TutorialConst.TUTORIAL_TYPE = {
CLICK = 1, -- 点击任意区域
CLICK_BTN = 2, -- 点击指定按钮
TALK = 3, -- 文本对话
DO_NOTHING = 4, -- 什么也不做,等待条件完成
EMPTY_CANCEL_BLOCK = 5, -- 什么也不做, 解除屏蔽,等待条件完成
TO_ELIMINATION = 6, -- 引导消除元素
}
TutorialConst.FINISH_TYPE = {
ON_UI_SHOW = 1, -- 当XX界面显示
ON_UI_CLOSE = 2, -- 当XX界面关闭
ON_TASK_COMPLETE = 3, -- 当主线任务完成
ON_ATK_LEVEL = 4, -- 当攻击力升至x级时
ON_TO_ARENA = 5, -- 界面移动到竞技场位置
ON_BOARD_CAN_ELIMINATION = 3, -- 当棋盘可以消除
ON_ELIMINATION_OVER = 4,-- 等待棋盘消除完成
}
TutorialConst.UI_TYPE = {
WEAPON_SUMMON_UI = 1,
PROTECTIVE_SUMMON_UI = 2,
LEGACY_SUMMON_UI = 3,
HERO_ALL_UP_UI = 4,
ROGUE_SKILL_UI = 1,
REWARD_BOX = 2,
-- PROTECTIVE_SUMMON_UI = 2,
-- LEGACY_SUMMON_UI = 3,
-- HERO_ALL_UP_UI = 4,
}
TutorialConst.UI_PATH = {
[TutorialConst.UI_TYPE.WEAPON_SUMMON_UI] = UIManager.UI_PATH.WEAPON_SUMMON_UI,
[TutorialConst.UI_TYPE.PROTECTIVE_SUMMON_UI] = UIManager.UI_PATH.PROTECTIVE_SUMMON_UI,
[TutorialConst.UI_TYPE.LEGACY_SUMMON_UI] = UIManager.UI_PATH.LEGACY_SUMMON_UI,
[TutorialConst.UI_TYPE.HERO_ALL_UP_UI] = UIManager.UI_PATH.HERO_ALL_UP_UI,
}
TutorialConst.FUNC_TUTORIAL_ID = {
BATTLE_AUTO = 4, -- 引导自动战斗
[TutorialConst.UI_TYPE.ROGUE_SKILL_UI] = UIManager.UI_PATH.ROGUE_SKILL_UI,
[TutorialConst.UI_TYPE.REWARD_BOX] = UIManager.UI_PATH.REWARD_BOX,
}
return TutorialConst

View File

@ -66,22 +66,36 @@ local function _listenerOnUIClose(tutorialId)
return false
end
local function _listenerOnTaskCompete(tutorialId)
local function _listenerOnCanElimination(tutorialId)
ModuleManager.TutorialManager:addEventListener(EventManager.CUSTOM_EVENT.BOARD_FILL_OVER, function(index)
ModuleManager.TutorialManager:finishAndNextTutorial(tutorialId)
end)
return false
end
local function _listenerOnAtkLevel(tutorialId)
local params = DataManager.TutorialData:getFinishTypeParams()
if params == nil then -- 打开界面的完成条件必须要有参数
local function _listenerOnEliminationOver(tutorialId)
local elementPosList = DataManager.TutorialData:getTargetElement()
if not elementPosList then
return false
end
if DataManager.ChapterData:getTrainAtkLv() >= params then
return true
end
ModuleManager.TutorialManager:addEventListener(EventManager.CUSTOM_EVENT.ATK_TRAIN_LEVEL_UP, function(index)
if DataManager.ChapterData:getTrainAtkLv() >= params then
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.ATK_TRAIN_TUTORIAL_OVER)
ModuleManager.TutorialManager:addEventListener(EventManager.CUSTOM_EVENT.ELIMINATION_OVER, function(posIdmap)
local over = true
for _, posId in ipairs(elementPosList) do
if not posIdmap[posId] then
over = false
end
end
if over then
if ModuleManager.BattleManager.battleController then
ModuleManager.BattleManager.battleController:onLinkOver()
end
ModuleManager.TutorialManager:finishAndNextTutorial(tutorialId)
else
if ModuleManager.BattleManager.battleController then
ModuleManager.BattleManager.battleController:clearGridSequence()
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.SHOW_ELIMINATION_TUTORAIL, elementPosList)
end
end
end)
return false
@ -90,8 +104,8 @@ end
TutorialFinishListener._addListener = {
[TutorialConst.FINISH_TYPE.ON_UI_SHOW] = _listenerOnUIShow,
[TutorialConst.FINISH_TYPE.ON_UI_CLOSE] = _listenerOnUIClose,
[TutorialConst.FINISH_TYPE.ON_TASK_COMPLETE] = _listenerOnTaskCompete,
[TutorialConst.FINISH_TYPE.ON_ATK_LEVEL] = _listenerOnAtkLevel,
[TutorialConst.FINISH_TYPE.ON_BOARD_CAN_ELIMINATION] = _listenerOnCanElimination,
[TutorialConst.FINISH_TYPE.ON_ELIMINATION_OVER] = _listenerOnEliminationOver,
}
return TutorialFinishListener

View File

@ -2,8 +2,6 @@ local TutorialConst = require "app/module/tutorial/tutorial_const"
local TutorialManager = class("TutorialManager", BaseModule)
TutorialManager.FUNC_TUTORIAL_ID = TutorialConst.FUNC_TUTORIAL_ID
function TutorialManager:checkAndPlayForceTutorial()
if DataManager.TutorialData:getIsInTutorial() then
return
@ -22,14 +20,18 @@ function TutorialManager:sendTutorialId(id, callback)
local args = {
id = id
}
self:sendMessage(ProtoMsgType.FromMsgEnum.MarkGuideReq, args, {}, self.sendTutorialIdFinish)
self.sendTutorialIdCallback = callback
ServerDataManager:dataOperate(GConst.ServerDataConst.DATA_OP_BEHAVIOR.MARK_GUIDE, args, function(result)
self:sendTutorialIdFinish(result)
end)
end
function TutorialManager:sendTutorialIdFinish(result)
if result.status == 0 then
if result.id then
BIReport:postTutorialStep(result.id)
-- BIReport:postTutorialStep(result.id)
-- DataManager.TutorialData:markFuncTutorialFinish(result.id)
end
@ -73,15 +75,10 @@ end
function TutorialManager:startTutorial()
local tutorialId = DataManager.TutorialData:getTutorialId()
-- 上报引导每一步
BIReport:postTutorialStep(tutorialId)
-- BIReport:postTutorialStep(tutorialId)
Logger.log("开始引导:%s", tutorialId)
DataManager.TutorialData:markFuncTutorialFinish(tutorialId)
if DataManager.TutorialData:getTutorialStopFight() then
ModuleManager.BattleManager:pauseFightByTutorial()
else
ModuleManager.BattleManager:resumeFightByTutorial()
end
-- 如果这一步引导已经完成了就进入下一步,没有完成则如果有监听就添加监听
local over = self.tutorialFinishListener:checkAndAddListener(tutorialId)
@ -99,8 +96,6 @@ function TutorialManager:stopTutorial()
if DataManager.TutorialData then
Logger.log("停止引导:%s", DataManager.TutorialData:getTutorialId())
end
ModuleManager.BattleManager:resumeFightByTutorial()
if self.tutorialFinishListener then
self.tutorialFinishListener:clear()
end
@ -134,28 +129,12 @@ function TutorialManager:finishAndNextTutorial(tutorialId)
-- 此步引导完成时需要处理的东西
self.tutorialAction:doStepOver(tutorialId)
local haveNext, newStopId = DataManager.TutorialData:nextTutorial()
local haveNext = DataManager.TutorialData:nextTutorial()
if haveNext then
local delay = DataManager.TutorialData:getDelayStartTime()
if newStopId then -- 中断步骤变了要跟服务器同步
self:sendTutorialId(DataManager.TutorialData:getTutorialId(), function(success)
if success then
if delay > 0 then
self:performWithDelayGlobal(function()
self:startTutorial()
end, delay)
else
self:startTutorial()
end
else
self:stopTutorial()
end
end)
else
self:performWithDelayGlobal(function()
self:startTutorial()
end, delay)
end
self:performWithDelayGlobal(function()
self:startTutorial()
end, delay)
else
self:performWithDelayGlobal(function()
self:stopTutorial()

View File

@ -1,29 +0,0 @@
local TutorialTaskManager = class("TutorialTaskManager", BaseModule)
function TutorialTaskManager:claimTask()
if DataManager.TutorialTaskData:getTaskCollect() then
return
end
ModuleManager.TaskManager:dealTaskType(DataManager.TutorialTaskData:getTaskType(), function()
self:sendMessage(ProtoMsgType.FromMsgEnum.TaskTutorRewardReq, {}, {}, self.claimTaskFinish, BIReport.ITEM_GET_TYPE.TUTORIAL_TASK)
end)
end
function TutorialTaskManager:claimTaskFinish(result)
if result.status == 0 then
local taskId = DataManager.TutorialTaskData:getCurTutorialId()
DataManager.TutorialTaskData:init(result.task)
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.TUTORIAL_TASK_REWARD, result.rewards)
local tutorialId = DataManager.TutorialTaskData:getTaskTutorialId()
if not tutorialId then
tutorialId = DataManager.TutorialData:getTaskOpenTutorial(taskId)
end
if tutorialId then
ModuleManager.TutorialManager:checkFuncTutorial(tutorialId)
end
end
end
return TutorialTaskManager

View File

@ -0,0 +1,19 @@
local ServerTutorialData = class("ServerTutorialData", ServerBaseData)
function ServerTutorialData:init(data)
if data then
self.data.markedGuide = data.markedGuide or {}
else
self.data.markedGuide = {}
end
end
function ServerTutorialData:markGuide(id)
id = tostring(id)
if not id then
return
end
self.data.markedGuide[id] = true
end
return ServerTutorialData

View File

@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 0dd4f32fe399df647a2e9d5375711196
guid: 8482be101c0b05347b61cef1d8925dac
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}

View File

@ -0,0 +1,24 @@
local ServerChapterManager = {}
function ServerChapterManager:markGuide(params, callback)
local result = {
status = 1
}
if params == nil or not params.id then
if callback then
callback(result)
end
return
end
local ServerGameData = ServerDataManager:getServerGameData()
ServerGameData.TutorialData:markGuide(params.id)
result.id = params.id
result.status = 0
if callback then
callback(result)
end
end
return ServerChapterManager

View File

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

View File

@ -12,6 +12,7 @@ ServerDataConst.DATA_OP_BEHAVIOR = {
UPGRADE_HERO = "UPGRADE_HERO",
END_FIGHT = "END_FIGHT",
OPEN_CHAPTER_BOX = "OPEN_CHAPTER_BOX",
MARK_GUIDE = "MARK_GUIDE",
}
return ServerDataConst

View File

@ -6,6 +6,7 @@ function ServerDataManager:init()
self.ServerFormationManager = require("app/server/manager/server_formation_manager")
self.ServerHeroManager = require("app/server/manager/server_hero_manager")
self.ServerChapterManager = require("app/server/manager/server_chapter_manager")
self.ServerTutorialManager = require("app/server/manager/server_tutorial_manager")
end
function ServerDataManager:saveData()
@ -67,6 +68,7 @@ ServerDataManager.OP_FUNC = {
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.UPGRADE_HERO] = function (...) ServerDataManager.ServerHeroManager:onUpgradeHero(...) end,
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.END_FIGHT] = function(...) ServerDataManager.ServerChapterManager:endFight(...) end,
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.OPEN_CHAPTER_BOX] = function(...) ServerDataManager.ServerChapterManager:openBox(...) end,
[GConst.ServerDataConst.DATA_OP_BEHAVIOR.MARK_GUIDE] = function(...) ServerDataManager.ServerTutorialManager:markGuide(...) end,
}
function ServerDataManager:dealGM(params, callback)

View File

@ -18,6 +18,7 @@ function ServerGameData:init()
self:initServerData("HeroData", "app/server/data/server_hero_data")
self:initServerData("ChapterData", "app/server/data/server_chapter_data")
self:initServerData("FormationData", "app/server/data/server_formation_data")
self:initServerData("TutorialData", "app/server/data/server_tutorial_data")
end
function ServerGameData:initData()

View File

@ -46,6 +46,7 @@ function BattleUI:_display()
self:initHpNode()
self:initFxNode()
self:hideGenerateSkillGridCells()
self:initTutorialNode()
end
function BattleUI:_addListeners()
@ -53,6 +54,10 @@ function BattleUI:_addListeners()
uiMap["battle_ui.top_node.close_btn"]:addClickListener(function()
ModuleManager.BattleManager:showPauseUI()
end)
self:addEventListener(EventManager.CUSTOM_EVENT.SHOW_ELIMINATION_TUTORAIL, function(posIdList)
self:showTutorialFinger(posIdList)
end)
end
function BattleUI:_bind()
@ -625,6 +630,9 @@ function BattleUI:onInitGridCellOver()
entity:setCell(cell)
end
end
---- 检查引导
ModuleManager.TutorialManager:checkFuncTutorial(GConst.TutorialConst.START_TUTORIAL)
end
function BattleUI:switchBoard(downCallback, callback, isFirst)
@ -1115,6 +1123,49 @@ function BattleUI:hideAllSfxGridBreak()
end
end
function BattleUI:initTutorialNode()
local uiMap = self.root:genAllChildren()
self.tutorialNode = uiMap["battle_ui.tutorial_node"]
self.tutorialFinger = uiMap["battle_ui.tutorial_node.board_node.finger"]
self:showTutorialFinger()
end
function BattleUI:showTutorialFinger(posIdList)
if self.showTutorialFingerSeq then
self.showTutorialFingerSeq:Kill()
self.showTutorialFingerSeq = nil
end
if not self.tutorialFinger then
return
end
local show = false
if posIdList and posIdList[1] then
show = true
end
self.tutorialNode:setVisible(show)
if not show then
return
end
self.showTutorialFingerSeq = self.root:createBindTweenSequence()
local path = {}
local count = 0
for index, posId in ipairs(posIdList) do
local curPos = ModuleManager.BattleManager:getPosInfo(posId)
if index == 1 then
self.tutorialFinger:setAnchoredPosition(curPos.x, curPos.y)
else
table.insert(path, curPos)
count = count + 1
end
end
self.showTutorialFingerSeq:Append(self.tutorialFinger:getTransform():DOLocalPath(path, count))
self.showTutorialFingerSeq:SetLoops(-1)
end
function BattleUI:clear()
if self.alreadyClear then
return

View File

@ -20,12 +20,9 @@ UIManager.MESSAGE_BOX_TAG = {
UIManager.UI_PATH = {
GM_TOO_UI = "app/ui/gm/gm_tool_ui",
MAINCITY_UI = "app/ui/main_city/main_city_ui",
WEAPON_SUMMON_UI = "app/ui/summon_pop/summon_rewards_ui",
PROTECTIVE_SUMMON_UI = "app/ui/summon_pop/summon_rewards_ui",
LEGACY_SUMMON_UI = "app/ui/summon_pop/summon_rewards_ui",
HERO_ALL_UP_UI = "app/ui/hero/hero_all_up_ui",
BATTLE_BLACK_UI = "app/ui/battle/battle_black_ui",
BATTLE_UI = "app/ui/battle/battle_ui",
ROGUE_SKILL_UI = "app/ui/battle/battle_skill_select_ui",
REWARD_BOX = "app/ui/tips/reward_box",
}
-- 动画类型

View File

@ -1,6 +1,7 @@
local ChapterData = class("ChapterData", BaseData)
local MIN_CHAPTER_ID = 1
ChapterData.MIN_CHAPTER_ID = 1
local MIN_CHAPTER_ID = ChapterData.MIN_CHAPTER_ID
function ChapterData:ctor()
self.data.chapterId = MIN_CHAPTER_ID

View File

@ -8,30 +8,26 @@ local TutorialData = class("TutorialData", BaseData)
function TutorialData:ctor()
self.inTutorial = false
self.data.tutorialId = 0 -- 强制引导步骤
self.data.stopId = 0 -- 中断步骤
self.isFuncTutorial = false
end
function TutorialData:clear()
self.inTutorial = false
self.data.tutorialId = 0
self.data.stopId = 0
self.isFuncTutorial = false
end
function TutorialData:init(data)
data = data or {}
self.inTutorial = false
-- 强制引导步骤
self.data.tutorialId = data.id or 0
if self.data.tutorialId > 0 then
self.tutorialInfo = TUTORIAL_CFG[self.data.tutorialId]
end
-- 功能开启引导列表
self.funcTutorialMap = {}
if data.func then
for k,v in pairs(data.func) do
self.funcTutorialMap[k] = v
if data.markedGuide then
for k,v in pairs(data.markedGuide) do
local id = tonumber(k)
if id then
self.funcTutorialMap[id] = v
end
end
end
end
@ -53,25 +49,16 @@ function TutorialData:getIsInFirstStep()
return self.data.tutorialId == 10010
end
-- 是否有下一步,中断步骤是否改变
-- 是否有下一步
function TutorialData:nextTutorial()
local id = self.tutorialInfo.next_id
local tutorialInfo = TUTORIAL_CFG[id]
if tutorialInfo == nil then
return false, false
return false
end
self.data.tutorialId = id
self.tutorialInfo = tutorialInfo
local stopId = self.tutorialInfo and self.tutorialInfo.stop_id or 0
if stopId ~= self.data.stopId then -- 中断步骤发生了改变
self.data.stopId = stopId
return true, true
end
return true, false
end
function TutorialData:getStopId()
return self.data.stopId
return true
end
function TutorialData:stopTutorial()
@ -168,6 +155,10 @@ function TutorialData:getTypeParameter()
return self.tutorialInfo.type_parameter
end
function TutorialData:getTargetElement()
return self.tutorialInfo.target_element
end
function TutorialData:getIsHaveTutorialText()
if self.tutorialInfo.txt and self.tutorialInfo.txt ~= "" then
return true
@ -215,7 +206,6 @@ function TutorialData:getIsHaveFuncTutorial(tutorialId, tutorialInfo)
self.tutorialInfo = tutorialInfo
self.data.tutorialId = tutorialId
self.data.stopId = 0
self.isFuncTutorial = true
return true
end
@ -261,48 +251,4 @@ function TutorialData:getTutorialId2UIPath(id)
return self.tutorialId2UIPath[id]
end
function TutorialData:getFuncTutorialId(uiPath)
self:getTutorialIdList()
local list = self.funcTutorialUImap[uiPath]
if list then
for _, id in ipairs(list) do
local info = TUTORIAL_STARTCFG[id]
local tId = info.start_id
if tId then
if not self:getIsFuncTutorialFinished(tId) then
return id
end
end
end
end
end
function TutorialData:getTaskOpenTutorial(taskId)
if not self.taskOpenTutorialMap then
self.taskOpenTutorialMap = {}
local cfg = ConfigManager:getConfig("func_open")
for id, info in pairs(cfg) do
if info.task and info.tutorial_id then
self.taskOpenTutorialMap[info.task] = info.tutorial_id
end
end
end
return self.taskOpenTutorialMap[taskId]
end
function TutorialData:getStageOpenTutorial(stageId)
if not self.stageOpenTutorialMap then
self.stageOpenTutorialMap = {}
local cfg = ConfigManager:getConfig("func_open")
for id, info in pairs(cfg) do
if info.stage and info.tutorial_id then
self.stageOpenTutorialMap[info.stage] = info.tutorial_id
end
end
end
return self.stageOpenTutorialMap[stageId]
end
return TutorialData

View File

@ -1,280 +0,0 @@
local TutorialTaskData = class("TutorialTaskData", BaseData)
local TUTORIAL_TASK_CFG = ConfigManager:getConfig("tutorialtask")
function TutorialTaskData:ctor()
self:clear()
end
function TutorialTaskData:clear()
self.data.isDirty = false
self.finished = false
self.progress = 0
self.curTaskId = 1
ModuleManager.TaskManager:unRegisterAllModuleTask("TutorialTaskData")
end
function TutorialTaskData:init(data, isInit)
data = data or {}
self.finished = data.finished or false
self.progress = data.progress or 0
self.curTaskId = data.id or 1
if isInit then
self:initTaskListener()
end
self:setDirty()
end
function TutorialTaskData:setDirty()
self.data.isDirty = not self.data.isDirty
end
function TutorialTaskData:getCurTutorialId()
return self.curTaskId
end
function TutorialTaskData:getTaskCollect(id)
if id then
return id < self.curTaskId
end
return self.finished
end
function TutorialTaskData:getTaskDesc(taskId, noProgress)
taskId = taskId or self.curTaskId
if TUTORIAL_TASK_CFG[taskId] then
local progress = self:getTaskCount(taskId)
if noProgress then
progress = nil
end
return ModuleManager.TaskManager:getTaskTutorialDesc(TUTORIAL_TASK_CFG[taskId].type, progress, self:getTaskTotalCount(taskId))
end
return GConst.EMPTY_STRING
end
function TutorialTaskData:getTaskCount()
return self.progress
end
function TutorialTaskData:getTaskTotalCount(taskId)
taskId = taskId or self.curTaskId
if TUTORIAL_TASK_CFG[taskId] then
return TUTORIAL_TASK_CFG[taskId].parameter
end
return 1
end
function TutorialTaskData:getTaskReward(taskId)
taskId = taskId or self.curTaskId
if TUTORIAL_TASK_CFG[taskId] then
return TUTORIAL_TASK_CFG[taskId].reward
end
return
end
function TutorialTaskData:getTaskTutorialId(taskId)
taskId = taskId or self.curTaskId
if TUTORIAL_TASK_CFG[taskId] then
return TUTORIAL_TASK_CFG[taskId].tutorial_id
end
return
end
function TutorialTaskData:getTaskType(taskId)
taskId = taskId or self.curTaskId
if TUTORIAL_TASK_CFG[taskId] then
return TUTORIAL_TASK_CFG[taskId].type
end
return 1
end
function TutorialTaskData:getTaskNext(taskId)
taskId = taskId or self.curTaskId
if TUTORIAL_TASK_CFG[taskId] then
return TUTORIAL_TASK_CFG[taskId].next
end
return
end
function TutorialTaskData:canClaimTask()
if not TUTORIAL_TASK_CFG[self.curTaskId] or self:getTaskCollect() then
return false
end
return self:getTaskCount() >= self:getTaskTotalCount()
end
function TutorialTaskData:getMaxShowFingerTask()
if not self.maxShowFingerTaskId then
self.maxShowFingerTaskId = GFunc.getConstIntValue("tutorialtask_tutorialmax")
end
return self.maxShowFingerTaskId
end
---- 如果需要显示指引则返回类型nil为不指引
function TutorialTaskData:showFinger(taskId)
if DataManager.TutorialData:getIsInTutorial() then -- 强引导
return false
end
taskId = taskId or self.curTaskId
if taskId > self:getMaxShowFingerTask() then
return false
end
if not TUTORIAL_TASK_CFG[taskId] then
return
end
if self:canClaimTask() then
return false
end
local taskType = TUTORIAL_TASK_CFG[taskId].type
if taskType == GConst.TaskConst.TASK_TYPE.X_TRAIN_ATK or
taskType == GConst.TaskConst.TASK_TYPE.X_TRAIN_HP then
return taskType
end
return
end
function TutorialTaskData:showMaskFinger(taskId)
if DataManager.TutorialData:getIsInTutorial() then -- 强引导
return false
end
taskId = taskId or self.curTaskId
if not TUTORIAL_TASK_CFG[taskId] or not TUTORIAL_TASK_CFG[taskId].must_tutorial then
return false
end
return self:canClaimTask()
end
function TutorialTaskData:getIsThisTypeTask(taskType)
local cfg = TUTORIAL_TASK_CFG[self.curTaskId]
if cfg and cfg.type == taskType then
return true
end
end
function TutorialTaskData:addTaskProgress(count)
if not count then
return
end
self.progress = self.progress + count
self:setDirty()
if self:showMaskFinger() and not DataManager.TutorialData:getIsInTutorial() then
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.CHANGE_MAIN_CITY_PAGE, {page = 0})
end
end
function TutorialTaskData:setTaskProgress(count)
if not count then
return
end
if self.progress > count then
return
end
self.progress = count
self:setDirty()
end
function TutorialTaskData:initTaskListener()
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.X_KILL_MONSTER, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.X_KILL_MONSTER) then
self:addTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.PASS_CHAPTER, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.PASS_CHAPTER) then
self:setTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.X_WEAPON_SUMMON, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.X_WEAPON_SUMMON) then
self:addTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.X_PROTECTIVE_SUMMON, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.X_PROTECTIVE_SUMMON) then
self:addTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.X_LEGACY_SUMMON, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.X_LEGACY_SUMMON) then
self:addTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.COMPLETED_JEWELRY_BATTLE, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.COMPLETED_JEWELRY_BATTLE) then
self:setTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.COMPLETED_GOLD_BATTLE, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.COMPLETED_GOLD_BATTLE) then
self:setTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.COMPLETED_MITHRIL_BATTLE, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.COMPLETED_MITHRIL_BATTLE) then
self:setTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.ARENA_TIER_ON, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.ARENA_TIER_ON) then
self:addTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.X_MINE_DISTANCE, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.X_MINE_DISTANCE) then
self:setTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.X_TRAIN_ATK, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.X_TRAIN_ATK) then
self:setTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.X_TRAIN_HP, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.X_TRAIN_HP) then
self:setTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.X_WATCH_AD, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.X_WATCH_AD) then
self:addTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.X_HOE_USE, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.X_HOE_USE) then
self:addTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.X_RESEARCH_USE, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.X_RESEARCH_USE) then
self:addTaskProgress(count)
end
end)
ModuleManager.TaskManager:registerTask("TutorialTaskData", GConst.TaskConst.TASK_TYPE.X_MINE_GRID, function(count)
if self:getIsThisTypeTask(GConst.TaskConst.TASK_TYPE.X_MINE_GRID) then
self:addTaskProgress(count)
end
end)
end
return TutorialTaskData