Initial version - 1.2.0.60

EN: 1.2.0.60
CN: 1.2.0.61
JP: 1.2.0.63
KR: 1.2.0.67
This commit is contained in:
SL1900
2025-12-03 01:00:00 +09:00
commit 5e0d58cfad
3595 changed files with 9373562 additions and 0 deletions
@@ -0,0 +1,78 @@
local MainlineAvgLevel = class("MainlineAvgLevel")
local mapEventConfig = {
LevelStateChanged = "OnEvent_SendMsgFinishBattle"
}
function MainlineAvgLevel:Init(parent, nMainlineId)
self._nSelectId = nMainlineId
self.parent = parent
self.bSettle = false
self:BindEvent()
local mapMainline = ConfigTable.GetData_Mainline(nMainlineId)
if mapMainline == nil then
self.parent:LevelEnd()
return
end
if mapMainline.AvgId == nil or mapMainline.AvgId == "" then
self.parent:LevelEnd()
return
end
self.parent = parent
local mapData = {
nType = AllEnum.StoryAvgType.PureAvg,
sAvgId = mapMainline.AvgId,
nNodeId = nMainlineId,
callback = nil
}
EventManager.Hit(EventId.OpenPanel, PanelId.PureAvgStory, mapData)
end
function MainlineAvgLevel:BindEvent()
if type(mapEventConfig) ~= "table" then
return
end
for nEventId, sCallbackName in pairs(mapEventConfig) do
local callback = self[sCallbackName]
if type(callback) == "function" then
EventManager.Add(nEventId, self, callback)
end
end
end
function MainlineAvgLevel:UnBindEvent()
if type(mapEventConfig) ~= "table" then
return
end
for nEventId, sCallbackName in pairs(mapEventConfig) do
local callback = self[sCallbackName]
if type(callback) == "function" then
EventManager.Remove(nEventId, self, callback)
end
end
end
function MainlineAvgLevel:OnEvent_SendMsgFinishBattle()
if self.bSettle == true then
print("已在结算流程中!")
return
end
self.bSettle = true
print("OnEvent_SendMsgFinishBattle")
local nStar = 7
local func_cbFinishSucc = function(_, mapMainData)
self.parent:UpdateMainlineStar(self._nSelectId, nStar)
EventManager.Hit(EventId.CloesCurPanel)
local close = function()
PlayerData.Base:OnBackToMainMenuModule()
end
if mapMainData.FirstRewardItems and #mapMainData.FirstRewardItems > 0 then
UTILS.OpenReceiveByDisplayItem(mapMainData.FirstRewardItems, mapMainData.Change, close)
else
close()
end
self:UnBindEvent()
self.parent:LevelEnd()
end
local mapSendMsg = {}
mapSendMsg.Ok = true
mapSendMsg.MinChests = {}
mapSendMsg.MaxChests = {}
HttpNetHandler.SendMsg(NetMsgId.Id.mainline_settle_req, mapSendMsg, nil, func_cbFinishSucc)
end
return MainlineAvgLevel
@@ -0,0 +1,503 @@
local MainlineBattleLevel = class("MainlineBattleLevel")
local RapidJson = require("rapidjson")
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local mapEventConfig = {
LevelStateChanged = "OnEvent_SendMsgFinishBattle",
[EventId.AbandonBattle] = "OnEvent_AbandonBattle",
InteractiveBoxGet = "OnEvent_OpenChest",
LoadLevelRefresh = "OnEvent_LoadLevelRefresh",
Mainline_Time_CountUp = "OnEvent_Time",
BattlePause = "OnEvnet_Pause",
AdventureModuleEnter = "OnEvent_AdventureModuleEnter"
}
function MainlineBattleLevel:Init(parent, nSelectId, nTeamIdx, tbChestS, tbChestL)
self.bSettle = false
self.parent = parent
self.nMainLineTime = 0
self:BindEvent()
self._nSelectId = nSelectId
self.curFloorIdx = 1
self.nLargeTotalCount = 0
self.nSmallTotalCount = 0
self.curSmallCount = 0
self.curLargeCount = 0
self.bNewSmall = false
self.bNewLarge = false
self._tbBoxS = nil
self._tbBoxL = nil
self.mapCharacterTempData = {}
self._tbOpendChestS = {}
self._tbOpendChestL = {}
local mapMainline = ConfigTable.GetData_Mainline(nSelectId)
self:PrePorcessChestData(self._nSelectId)
self.nSmallTotalCount = #self._tbBoxS
self.nLargeTotalCount = #self._tbBoxL
self.bTrialLevel = mapMainline.TrialCharacter ~= nil and 0 < #mapMainline.TrialCharacter
if self.bTrialLevel then
self.nCurTeamIndex = 1
self.tbChar = {}
self.tbTrialId = {}
for _, nTrialId in pairs(mapMainline.TrialCharacter) do
if 0 < nTrialId then
local mapTrialChar = PlayerData.Char:GetTrialCharById(nTrialId)
table.insert(self.tbChar, mapTrialChar.nId)
table.insert(self.tbTrialId, nTrialId)
end
end
else
self.nCurTeamIndex = nTeamIdx
self.tbChar = PlayerData.Team:GetTeamCharId(nTeamIdx)
end
self.tbOpenedChestId = {}
for _, idx in ipairs(tbChestS) do
table.insert(self.tbOpenedChestId, self._tbBoxS[idx])
end
for _, idx in ipairs(tbChestL) do
table.insert(self.tbOpenedChestId, self._tbBoxL[idx])
end
if self.bTrialLevel then
for _, nTrialId in ipairs(self.tbTrialId) do
if 0 < nTrialId then
local mapTrialChar = PlayerData.Char:GetTrialCharById(nTrialId)
local stActorInfo = self.CalCharFixedEffectTrial(nTrialId)
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, mapTrialChar.nId, stActorInfo)
end
end
else
for idx, nCharId in ipairs(self.tbChar) do
local stActorInfo = self.CalCharFixedEffect(nCharId, idx == 1)
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, nCharId, stActorInfo)
end
end
PlayerData.nCurGameType = AllEnum.WorldMapNodeType.Mainline
CS.AdventureModuleHelper.EnterMainlineMap(mapMainline.FloorId[1], self.tbChar, self.tbOpenedChestId)
self.curSmallCount = #tbChestS
self.curLargeCount = #tbChestL
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
end
function MainlineBattleLevel:BindEvent()
if type(mapEventConfig) ~= "table" then
return
end
for nEventId, sCallbackName in pairs(mapEventConfig) do
local callback = self[sCallbackName]
if type(callback) == "function" then
EventManager.Add(nEventId, self, callback)
end
end
end
function MainlineBattleLevel:UnBindEvent()
if type(mapEventConfig) ~= "table" then
return
end
for nEventId, sCallbackName in pairs(mapEventConfig) do
local callback = self[sCallbackName]
if type(callback) == "function" then
EventManager.Remove(nEventId, self, callback)
end
end
end
function MainlineBattleLevel.CalCharFixedEffect(nCharId, bMainChar)
local tbstInfo = {}
local tbEffectId = {}
PlayerData.Char:CalcAffinityEffect(nCharId, tbstInfo, tbEffectId)
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
local nHeartStoneLevel = PlayerData.Char:CalCharacterAttrBattle(nCharId, tbstInfo, stActorInfo, bMainChar)
return tbstInfo, stActorInfo, nHeartStoneLevel
end
function MainlineBattleLevel.CalCharFixedEffectTrial(nTrialId)
local tbstInfo = {}
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
local nHeartStoneLevel = PlayerData.Char:CalCharacterTrialAttrBattle(nTrialId, tbstInfo, stActorInfo)
return stActorInfo, nHeartStoneLevel
end
function MainlineBattleLevel:PrePorcessChestData(nMainlineId)
if ConfigTable.GetData_Mainline(nMainlineId) == nil then
printError("no level data" .. nMainlineId)
end
local tbChestS = decodeJson(ConfigTable.GetData_Mainline(nMainlineId).MinChestReward)
local tbChestL = decodeJson(ConfigTable.GetData_Mainline(nMainlineId).MaxChestReward)
self._tbBoxS = tbChestS
self._tbBoxL = tbChestL
end
function MainlineBattleLevel:PlaySuccessPerform(GenerRewardItems, FirstRewardItems, ChestRewardItems, nExp, nStar, FadeTime, mapChangeInfo)
local func_SettlementFinish = function(bSuccess)
end
local tbChar = self.tbChar
local function levelEndCallback()
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
local nFloorCount, nMapId
if PlayerData.Mainline.bUseOldMainline then
nFloorCount = #ConfigTable.GetData_Mainline(self._nSelectId).FloorId
nMapId = ConfigTable.GetData_Mainline(self._nSelectId).FloorId[nFloorCount]
else
nFloorCount = #ConfigTable.GetData_Story(self._nSelectId).FloorId
nMapId = ConfigTable.GetData_Story(self._nSelectId).FloorId[nFloorCount]
end
local nType = ConfigTable.GetData("MainlineFloor", nMapId).Theme
local sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
local tbSkin = {}
for _, nCharId in ipairs(tbChar) do
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
table.insert(tbSkin, nSkinId)
end
CS.AdventureModuleHelper.PlaySettlementPerform(sName, "", tbSkin, func_SettlementFinish)
end
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
local function openBattleResultPanel()
EventManager.Remove("SettlementPerformLoadFinish", self, openBattleResultPanel)
local sLarge, sSmall = self:CalChestInfo()
EventManager.Hit(EventId.OpenPanel, PanelId.BattleResult, true, nStar or 3, GenerRewardItems or {}, FirstRewardItems or {}, ChestRewardItems or {}, nExp or 0, false, sLarge, sSmall, self._nSelectId, self.tbChar, mapChangeInfo)
self.bSettle = false
self:UnBindEvent()
if PlayerData.Mainline.bUseOldMainline then
self.parent:LevelEnd()
end
end
EventManager.Add("SettlementPerformLoadFinish", self, openBattleResultPanel)
CS.AdventureModuleHelper.LevelStateChanged(true, FadeTime or 0.5)
EventManager.Hit(EventId.OpenPanel, PanelId.BattleResultMask)
end
function MainlineBattleLevel:OnEvent_OpenChest(nId)
print("OpenBox:" .. nId)
local mapChest = ConfigTable.GetData("Chest", nId)
if mapChest == nil then
printError("宝箱id不存在" .. nId)
return
end
local nType = mapChest.Label
if nType == 1 then
local nIndex = table.indexof(self._tbBoxS, nId)
if self._tbBoxS == nil then
return
end
if nIndex < 1 then
return
end
mapChest = ConfigTable.GetData("Chest", nId)
table.insert(self._tbOpendChestS, nIndex)
self.curSmallCount = self.curSmallCount + 1
self.bNewSmall = true
else
local nIndex = table.indexof(self._tbBoxL, nId)
if self._tbBoxL == nil then
return
end
if nIndex < 1 then
return
end
mapChest = ConfigTable.GetData("Chest", nId)
table.insert(self._tbOpendChestL, nIndex)
self.curLargeCount = self.curLargeCount + 1
self.bNewLarge = true
end
local ShowTips = function(nTid, nCount)
if nTid == 0 or nCount == 0 then
return
end
EventManager.Hit(EventId.ShowRoguelikeDrop, nTid, nCount)
end
ShowTips(mapChest.Item1, mapChest.Number1)
ShowTips(mapChest.Item2, mapChest.Number2)
ShowTips(mapChest.Item3, mapChest.Number3)
ShowTips(mapChest.Item4, mapChest.Number4)
end
function MainlineBattleLevel:OnEvent_LoadLevelRefresh()
self:ResetCharacter()
end
function MainlineBattleLevel:CacheTempData()
local FP = CS.TrueSync.FP
self.mapCharacterTempData = {}
local AdventureModuleHelper = CS.AdventureModuleHelper
local id = AdventureModuleHelper.GetCurrentActivePlayer()
self.mapCharacterTempData.curCharId = CS.AdventureModuleHelper.GetCharacterId(id)
self.mapCharacterTempData.skillInfo = {}
self.mapCharacterTempData.effectInfo = {}
self.mapCharacterTempData.buffInfo = {}
self.mapCharacterTempData.hpInfo = {}
self.mapCharacterTempData.stateInfo = {}
local playerids = AdventureModuleHelper.GetCurrentGroupPlayers()
local Count = playerids.Count - 1
for i = 0, Count do
local charTid = AdventureModuleHelper.GetCharacterId(playerids[i])
local clsSkillId = AdventureModuleHelper.GetPlayerSkillCd(playerids[i])
local nStatus = AdventureModuleHelper.GetPlayerActorStatus(playerids[i])
local nStatusTime = AdventureModuleHelper.GetPlayerActorSpecialStatusTime(playerids[i])
self.mapCharacterTempData.hpInfo[charTid] = AdventureModuleHelper.GetEntityHp(playerids[i])
if clsSkillId ~= nil then
local tbSkillInfos = clsSkillId.skillInfos
local nSkillCount = tbSkillInfos.Count - 1
for j = 0, nSkillCount do
local clsSkillInfo = tbSkillInfos[j]
local mapSkill = ConfigTable.GetData_Skill(clsSkillInfo.skillId)
if mapSkill.Type == GameEnum.skillType.ULTIMATE then
table.insert(self.mapCharacterTempData.skillInfo, {
nCharId = charTid,
nSkillId = clsSkillInfo.skillId,
nCd = clsSkillInfo.currentUseInterval.RawValue,
nSectionAmount = clsSkillInfo.currentSectionAmount,
nSectionResumeTime = clsSkillInfo.currentResumeTime.RawValue,
nUseTimeHint = clsSkillInfo.currentUseTimeHint.RawValue,
nEnergy = clsSkillInfo.currentEnergy.RawValue
})
end
end
self.mapCharacterTempData.effectInfo[charTid] = {
mapEffect = {}
}
local tbClsEfts = AdventureModuleHelper.GetEffectList(playerids[i])
if tbClsEfts ~= nil then
local nEftCount = tbClsEfts.Count - 1
for k = 0, nEftCount do
local eftInfo = tbClsEfts[k]
local mapEft = ConfigTable.GetData_Effect(eftInfo.effectConfig.Id)
local nCd = eftInfo.CD.RawValue
if mapEft.Remove and 0 < nCd then
self.mapCharacterTempData.effectInfo[charTid].mapEffect[eftInfo.effectConfig.Id] = {nCount = 0, nCd = nCd}
end
end
end
local tbBuffInfo = AdventureModuleHelper.GetEntityBuffList(playerids[i])
self.mapCharacterTempData.buffInfo[charTid] = {
mapBuff = {}
}
if tbBuffInfo ~= nil then
local nBuffCount = tbBuffInfo.Count - 1
for l = 0, nBuffCount do
local eftInfo = tbBuffInfo[l]
local mapBuff = ConfigTable.GetData_Buff(eftInfo.buffConfig.Id)
if mapBuff.NotRemove then
table.insert(self.mapCharacterTempData.buffInfo[charTid].mapBuff, {
Id = eftInfo.buffConfig.Id,
CD = eftInfo:GetBuffLeftTime().RawValue,
nNum = eftInfo:GetBuffNum()
})
end
end
end
end
self.mapCharacterTempData.stateInfo[charTid] = {nState = nStatus, nStateTime = nStatusTime}
end
end
function MainlineBattleLevel:ResetCharacter()
if self.mapCharacterTempData.hpInfo ~= nil then
local tbActorInfo = {}
for nTid, nHp in pairs(self.mapCharacterTempData.hpInfo) do
local stCharInfo = CS.Lua2CSharpInfo_ActorAttribute()
stCharInfo.actorID = nTid
stCharInfo.curHP = nHp
table.insert(tbActorInfo, stCharInfo)
end
safe_call_cs_func(CS.AdventureModuleHelper.ResetActorAttributes, tbActorInfo)
end
if self.mapCharacterTempData.skillInfo ~= nil then
local tbSkillInfos = {}
for _, skillInfo in ipairs(self.mapCharacterTempData.skillInfo) do
local stSkillInfo = CS.Lua2CSharpInfo_ResetSkillInfo()
stSkillInfo.skillId = skillInfo.nSkillId
stSkillInfo.currentSectionAmount = skillInfo.nSectionAmount
stSkillInfo.cd = skillInfo.nCd
stSkillInfo.currentResumeTime = skillInfo.nSectionResumeTime
stSkillInfo.currentUseTimeHint = skillInfo.nUseTimeHint
stSkillInfo.energy = skillInfo.nEnergy
if tbSkillInfos[skillInfo.nCharId] == nil then
tbSkillInfos[skillInfo.nCharId] = {}
end
table.insert(tbSkillInfos[skillInfo.nCharId], stSkillInfo)
end
safe_call_cs_func(CS.AdventureModuleHelper.ResetActorSkillInfo, tbSkillInfos)
end
if self.mapCharacterTempData.buffInfo ~= nil then
local tbBuffinfo = {}
for nCharId, mapBuff in pairs(self.mapCharacterTempData.buffInfo) do
if mapBuff.mapBuff ~= nil then
for _, mapBuffInfo in pairs(mapBuff.mapBuff) do
local stBuffInfo = CS.Lua2CSharpInfo_ResetBuffInfo()
stBuffInfo.Id = mapBuffInfo.Id
stBuffInfo.Cd = mapBuffInfo.CD
stBuffInfo.buffNum = mapBuffInfo.nNum
if tbBuffinfo[nCharId] == nil then
tbBuffinfo[nCharId] = {}
end
table.insert(tbBuffinfo[nCharId], stBuffInfo)
end
end
end
safe_call_cs_func(CS.AdventureModuleHelper.ResetBuff, tbBuffinfo)
end
end
function MainlineBattleLevel:OnEvent_SendMsgFinishBattle(LevelResult, _doorIdx, FadeTime)
if self.bSettle == true then
print("已在结算流程中!")
return
end
self.bSettle = true
print("OnEvent_SendMsgFinishBattle")
local fadeT = 0
if FadeTime ~= nil then
fadeT = FadeTime
end
if LevelResult == AllEnum.LevelResult.Failed then
self:OnEvent_AbandonBattle()
return
end
local mapMainline
if PlayerData.Mainline.bUseOldMainline then
mapMainline = ConfigTable.GetData_Mainline(self._nSelectId)
else
mapMainline = ConfigTable.GetData_Story(self._nSelectId)
end
if self.curFloorIdx < #mapMainline.FloorId then
self:ChangeFloor()
return
end
local nStar = 1
local nMainlineId = self._nSelectId
if PlayerData.Mainline.bUseOldMainline then
if #self._tbBoxS == self.curSmallCount then
nStar = nStar | 2
end
if #self._tbBoxL == self.curLargeCount then
nStar = nStar | 4
end
end
local func_cbFinishSucc = function(_, mapMainData)
local nLevelStar = 0
if PlayerData.Mainline.bUseOldMainline then
self.parent:UpdateMainlineStar(self._nSelectId, nStar)
nLevelStar = self.parent:GetMianlineLevelStar(nMainlineId)
end
local function func_AvgEnd()
EventManager.Remove("StoryDialog_DialogEnd", self, func_AvgEnd)
local sLarge, sSmall = self:CalChestInfo()
EventManager.Hit(EventId.OpenPanel, PanelId.BattleResult, true, nLevelStar, mapMainData.GenerRewardItems or {}, mapMainData.FirstRewardItems or {}, mapMainData.ChestRewardItems or {}, mapMainData.Exp or 0, false, sLarge, sSmall, nMainlineId, self.tbChar, mapMainData.Change)
self:UnBindEvent()
self.parent:LevelEnd()
end
local sAvgId = PlayerData.Mainline:GetAfterBattleAvg()
if sAvgId then
EventManager.Add("StoryDialog_DialogEnd", self, func_AvgEnd)
EventManager.Hit("StoryDialog_DialogStart", sAvgId)
elseif PlayerData.Mainline.bUseOldMainline then
self:PlaySuccessPerform(mapMainData.GenerRewardItems, mapMainData.FirstRewardItems, mapMainData.ChestRewardItems, mapMainData.Exp, nLevelStar, fadeT, mapMainData.Change)
else
self:PlaySuccessPerform()
end
end
local Events = PlayerData.Achievement:GetBattleAchievement(GameEnum.levelType.Mainline, true)
local mapSendMsg = {}
mapSendMsg.Ok = true
mapSendMsg.MinChests = self._tbOpendChestS
mapSendMsg.MaxChests = self._tbOpendChestL
if 0 < #Events then
mapSendMsg.Events = {
List = {}
}
mapSendMsg.Events.List = Events
end
print("====== 当前通关主线关卡ID" .. self._nSelectId .. " ======")
if PlayerData.Mainline.bUseOldMainline then
HttpNetHandler.SendMsg(NetMsgId.Id.mainline_settle_req, mapSendMsg, nil, func_cbFinishSucc)
else
PlayerData.Avg:SendMsg_STORY_DONE(func_cbFinishSucc)
end
end
function MainlineBattleLevel:OnEvent_AbandonBattle()
if self._nSelectId > 0 then
local nStar = PlayerData.Mainline:GetMianlineLevelStar(self._nSelectId)
if 0 < nStar then
if #self._tbBoxS == self.curSmallCount then
nStar = 3
end
if #self._tbBoxL == self.curLargeCount then
nStar = nStar | 4
end
end
local func_cbExitSucc = function(_, mapMainData)
local nMainlineId = self._nSelectId
local sLarge, sSmall = self:CalChestInfo()
self.parent:UpdateMainlineStar(self._nSelectId, nStar)
EventManager.Hit(EventId.OpenPanel, PanelId.BattleResult, false, 0, mapMainData.GenerRewardItems or {}, mapMainData.FirstRewardItems or {}, mapMainData.ChestRewardItems or {}, mapMainData.Exp or 0, false, sLarge, sSmall, nMainlineId, self.tbChar, mapMainData.Change)
self:UnBindEvent()
self.parent:LevelEnd()
end
local mapSendMsg = {}
mapSendMsg.MinChests = self._tbOpendChestS
mapSendMsg.MaxChests = self._tbOpendChestL
HttpNetHandler.SendMsg(NetMsgId.Id.mainline_exit_req, mapSendMsg, nil, func_cbExitSucc)
end
end
function MainlineBattleLevel:CalChestInfo()
local sSmall, sLarge
if self.bNewSmall then
sSmall = string.format("<color=#4ee5d1>%d</color>/%d", self.curSmallCount, self.nSmallTotalCount)
else
sSmall = string.format("%d/%d", self.curSmallCount, self.nSmallTotalCount)
end
if self.bNewLarge then
sLarge = string.format("<color=#4ee5d1>%d</color>/%d", self.curLargeCount, self.nLargeTotalCount)
else
sLarge = string.format("%d/%d", self.curLargeCount, self.nLargeTotalCount)
end
if self.nSmallTotalCount == 0 then
sSmall = ""
end
if self.nLargeTotalCount == 0 then
sLarge = ""
end
return sLarge, sSmall
end
function MainlineBattleLevel:ChangeFloor()
self:CacheTempData()
local mapMainline = ConfigTable.GetData_Mainline(self._nSelectId)
self.curFloorIdx = self.curFloorIdx + 1
local function levelUnloadCallback()
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelUnloadCallback)
if self.bTrialLevel then
for _, nTrialId in ipairs(self.tbTrialId) do
if 0 < nTrialId then
local mapTrialChar = PlayerData.Char:GetTrialCharById(nTrialId)
local stActorInfo, nHeartStoneLevel = self.CalCharFixedEffectTrial(nTrialId)
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, mapTrialChar.nId, stActorInfo)
end
end
else
for idx, nCharId in ipairs(self.tbChar) do
local stActorInfo, nHeartStoneLevel = self.CalCharFixedEffect(nCharId, idx == 1)
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, nCharId, stActorInfo)
end
end
self:SetCharStatus()
end
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelUnloadCallback)
CS.AdventureModuleHelper.EnterMainlineMap(mapMainline.FloorId[self.curFloorIdx], self.tbChar, self.tbOpenedChestId)
CS.AdventureModuleHelper.LevelStateChanged(false)
self.bSettle = false
end
function MainlineBattleLevel:SetCharStatus()
local nStatus = 0
local nStatusTime = 0
local tbActorInfo = {}
for _, nTid in pairs(self.tbChar) do
local stCharInfo = CS.Lua2CSharpInfo_ActorStatus()
if self.mapCharacterTempData.stateInfo ~= nil and self.mapCharacterTempData.stateInfo[nTid] ~= nil then
nStatus = self.mapCharacterTempData.stateInfo[nTid].nState
nStatusTime = self.mapCharacterTempData.stateInfo[nTid].nStateTime
end
stCharInfo.actorID = nTid
stCharInfo.status = nStatus
stCharInfo.specialStatusTime = nStatusTime
table.insert(tbActorInfo, stCharInfo)
end
safe_call_cs_func(CS.AdventureModuleHelper.SetActorStatus, tbActorInfo)
end
function MainlineBattleLevel:OnEvent_Time(nTime)
self.nMainLineTime = nTime
end
function MainlineBattleLevel:OnEvnet_Pause()
EventManager.Hit(EventId.OpenPanel, PanelId.MainBattlePause, self.nMainLineTime or 0)
end
function MainlineBattleLevel:OnEvent_AdventureModuleEnter()
EventManager.Hit(EventId.OpenPanel, PanelId.Adventure, self.tbChar)
end
return MainlineBattleLevel
@@ -0,0 +1,470 @@
local MainlinePrologueLevel = class("MainlinePrologueLevel")
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local LocalData = require("GameCore.Data.LocalData")
local RapidJson = require("rapidjson")
local mapFloor = {
[1] = "Game.Adventure.MainlineLevel.PrologueFloor.DesertFloor",
[2] = "Game.Adventure.MainlineLevel.PrologueFloor.BattleFloor"
}
local mapEventConfig = {
LevelStateChanged = "OnEvent_LevelStateChanged",
LoadLevelRefresh = "OnEvent_LoadLevelRefresh",
ExitModule = "OnEvent_ExitModule",
AfterEnterModule = "OnEvent_AfterEnterModule",
PrologueBattleReload = "OnEvent_PrologueBattleReload",
PrologueBattleArchive = "OnEvent_PrologueBattleArchive",
AdventureModuleEnter = "OnEvent_AdventureModuleEnter",
EnterModule = "OnEvent_EnterModule"
}
local enterFloorForTest = 0
local PrologueSceneId = 1200103
local tbAfterDesertFloor = {1200104, 1200106}
local tbTrialCharacter = {
{
1200201,
1200203,
1200202
},
{
1200201,
1200203,
1200202
}
}
local tbSelectPerks = {
{
500501,
500801,
500101
}
}
local mapBoxReward = {
[1] = {
500501,
500801,
500101
}
}
local tbTheme = {
GameEnum.rglTheme.ChainLightning,
GameEnum.rglTheme.WindBlade,
GameEnum.rglTheme.FireRing
}
function MainlinePrologueLevel:Init(parent)
self.curFloor = nil
self.sAfterBattleAvg = "ST1001"
local lastAccount = LocalData.GetLocalData("LoginUIData", "LastUserName_All")
local sJson = LocalData.GetLocalData(lastAccount, "MainlinePrologueLevel")
if sJson ~= nil then
local tb = decodeJson(sJson)
self.isThreePlayer = tb.isThreePlayer
self.revivalPoint = Vector3(tb.revivalPoint[1], tb.revivalPoint[2], tb.revivalPoint[3])
self.btnNames = tb.btnNames
self.tbSelectPerks = tb.tbSelectPerks
self.curFloorIdx = tb.curFloorIdx
self.bDesertComplete = tb.bDesertComplete
self.nCurAvgCmdIdx = tb.nCurAvgCmdIdx
self.bBattleEnd = tb.bBattleEnd
self.curCharId = tb.curCharId
self.curNpcRewardIdx = tb.curNpcRewardIdx
self.nBoxId = tb.nBoxId
else
self.isThreePlayer = false
self.revivalPoint = Vector3.zero
self.btnNames = nil
self.tbSelectPerks = {}
self.curFloorIdx = 1
self.bDesertComplete = false
self.nCurAvgCmdIdx = 0
self.bBattleEnd = false
self.curCharId = 0
self.curNpcRewardIdx = 1
self.nBoxId = 0
end
EventManager.Hit("MainlinePrologueLevelNextModule", self)
self:BindEvent()
self.parent = parent
self.bSettle = false
self.tbTrialId = {}
self.tbChar = {}
if not self.bDesertComplete then
CS.AdventureModuleHelper.EnterProloguelMap(PrologueSceneId)
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
elseif self.bBattleEnd then
self:OnEvent_LevelStateChanged()
else
if #tbTrialCharacter[self.curFloorIdx] > 0 then
PlayerData.Char:CreateTrialChar(tbTrialCharacter[self.curFloorIdx])
for _, nTrialId in pairs(tbTrialCharacter[self.curFloorIdx]) do
if 0 < nTrialId then
local mapTrialChar = PlayerData.Char:GetTrialCharById(nTrialId)
table.insert(self.tbChar, mapTrialChar.nId)
table.insert(self.tbTrialId, nTrialId)
end
end
end
for _, nTrialId in ipairs(self.tbTrialId) do
if 0 < nTrialId then
local mapTrialChar = PlayerData.Char:GetTrialCharById(nTrialId)
local tbstInfo, stActorInfo, nHeartStoneLevel = self.CalCharFixedEffectTrial(nTrialId)
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, mapTrialChar.nId, stActorInfo)
end
end
self:SetFloor(2)
CS.AdventureModuleHelper.EnterProloguelBattleMap(tbAfterDesertFloor[self.curFloorIdx], self.tbChar, {}, self.isThreePlayer, self.revivalPoint, self.btnNames)
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
end
end
function MainlinePrologueLevel:SetLocalData()
local mapLocalData = {
isThreePlayer = self.isThreePlayer,
revivalPoint = {
self.revivalPoint.x,
self.revivalPoint.y,
self.revivalPoint.z
},
btnNames = self.btnNames,
tbSelectPerks = self.tbSelectPerks,
curFloorIdx = self.curFloorIdx,
bDesertComplete = self.bDesertComplete,
nCurAvgCmdIdx = self.nCurAvgCmdIdx,
bBattleEnd = self.bBattleEnd,
curCharId = self.curCharId,
curNpcRewardIdx = self.curNpcRewardIdx,
nBoxId = self.nBoxId
}
local sJson = RapidJson.encode(mapLocalData)
local lastAccount = LocalData.GetLocalData("LoginUIData", "LastUserName_All")
LocalData.SetLocalData(lastAccount, "MainlinePrologueLevel", sJson)
end
function MainlinePrologueLevel:SetFloor(nType)
if self.curFloor ~= nil then
self.curFloor:Exit()
end
self.curFloor = nil
local luaPath = mapFloor[nType]
if luaPath == nil then
printError("no exist type:" .. nType)
luaPath = mapFloor[1]
end
local luaFile = require(luaPath)
local luaClass = luaFile.new(self)
luaClass:Enter()
self.curFloor = luaClass
end
function MainlinePrologueLevel:UnsetFloor()
if self.curFloor ~= nil then
self.curFloor:Exit()
end
self.curFloor = nil
end
function MainlinePrologueLevel:BindEvent()
if type(mapEventConfig) ~= "table" then
return
end
for nEventId, sCallbackName in pairs(mapEventConfig) do
local callback = self[sCallbackName]
if type(callback) == "function" then
EventManager.Add(nEventId, self, callback)
end
end
end
function MainlinePrologueLevel:UnBindEvent()
if type(mapEventConfig) ~= "table" then
return
end
for nEventId, sCallbackName in pairs(mapEventConfig) do
local callback = self[sCallbackName]
if type(callback) == "function" then
EventManager.Remove(nEventId, self, callback)
end
end
end
function MainlinePrologueLevel.CalCharFixedEffectTrial(nTrialId)
local tbstInfo = {}
local tbEffectId = {}
local mapTrialChar = PlayerData.Char:GetTrialCharById(nTrialId)
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
local nHeartStoneLevel = PlayerData.Char:CalCharacterTrialAttrBattle(nTrialId, tbstInfo, stActorInfo)
return tbstInfo, stActorInfo, nHeartStoneLevel
end
function MainlinePrologueLevel:SetTheme()
safe_call_cs_func(CS.AdventureModuleHelper.SetRglTheme, tbTheme)
end
function MainlinePrologueLevel:SetThemePerk()
local tbThemePerkInfo = {}
local stPerkInfo = CS.Lua2CSharpInfo_TPPerkInfo()
for _, nPerkId in ipairs(self.tbSelectPerks) do
stPerkInfo.perkId = nPerkId
stPerkInfo.nCount = 1
table.insert(tbThemePerkInfo, stPerkInfo)
end
if 0 < #tbThemePerkInfo then
safe_call_cs_func(CS.AdventureModuleHelper.ChangeThemePerkIds, tbThemePerkInfo)
end
end
function MainlinePrologueLevel:GetRewardNpc(nNpcId, nNpcUid)
local function SelectPerkCallBack(_, tbResult)
EventManager.Remove(EventId.SelectPerk, self, SelectPerkCallBack)
self.curNpcRewardIdx = self.curNpcRewardIdx + 1
table.insert(self.tbSelectPerks, tbResult[1])
local tbThemePerkInfo = {}
local stPerkInfo = CS.Lua2CSharpInfo_TPPerkInfo()
stPerkInfo.perkId = tbResult[1]
stPerkInfo.nCount = 1
table.insert(tbThemePerkInfo, stPerkInfo)
safe_call_cs_func(CS.AdventureModuleHelper.ChangeThemePerkIds, tbThemePerkInfo)
local mapNpc = ConfigTable.GetData("NPC", nNpcId)
if mapNpc.completeDestroy then
safe_call_cs_func(CS.InteractiveManager.Instance.setInteractiveNpcState, CS.InteractiveManager.Instance, nNpcUid)
end
NovaAPI.DispatchEventWithData("PROLOGUELEVEL_SELECTPERK")
end
if tbSelectPerks[self.curNpcRewardIdx] == nil then
printError(string.format("没有第%d个奖励", self.curNpcRewardIdx))
return
end
local tbPerks = {}
for _, nPerkId in ipairs(tbSelectPerks[self.curNpcRewardIdx]) do
table.insert(tbPerks, {
Id = nPerkId,
Level = 1,
nMaxLevel = 3
})
end
local mapBag = {
mapPerk = {},
mapItem = {},
mapSlotPerk = {
[1] = {
nPerkId = 0,
nQty = 0,
nMaxLevel = 0
},
[2] = {
nPerkId = 0,
nQty = 0,
nMaxLevel = 0
},
[3] = {
nPerkId = 0,
nQty = 0,
nMaxLevel = 0
},
[4] = {
nPerkId = 0,
nQty = 0,
nMaxLevel = 0
}
}
}
EventManager.Add(EventId.SelectPerk, self, SelectPerkCallBack)
EventManager.Hit(EventId.OpenPanel, PanelId.FRThemePerkSelect, {
{Perks = tbPerks, Theme = 0}
}, 0, mapBag, {}, true, true)
end
function MainlinePrologueLevel:GetRewardBox(nBoxId)
local function SelectPerkCallBack(_, tbResult)
EventManager.Remove(EventId.SelectPerk, self, SelectPerkCallBack)
self.curNpcRewardIdx = self.curNpcRewardIdx + 1
table.insert(self.tbSelectPerks, tbResult[1])
local tbThemePerkInfo = {}
local stPerkInfo = CS.Lua2CSharpInfo_TPPerkInfo()
stPerkInfo.perkId = tbResult[1]
stPerkInfo.nCount = 1
table.insert(tbThemePerkInfo, stPerkInfo)
safe_call_cs_func(CS.AdventureModuleHelper.ChangeThemePerkIds, tbThemePerkInfo)
local mapNpc = ConfigTable.GetData("NPC", nNpcId)
if mapNpc.completeDestroy then
safe_call_cs_func(CS.InteractiveManager.Instance.setInteractiveNpcState, CS.InteractiveManager.Instance, nNpcUid)
end
NovaAPI.DispatchEventWithData("PROLOGUELEVEL_SELECTPERK")
end
if mapBoxReward[self.nBoxId] == nil then
printError(string.format("没有配置宝箱id为%d的奖励", self.nBoxId))
return
end
local tbPerks = {}
for _, nPerkId in ipairs(mapBoxReward[self.nBoxId]) do
table.insert(tbPerks, {
Id = nPerkId,
Level = 1,
nMaxLevel = 3
})
end
local mapBag = {
mapPerk = {},
mapItem = {},
mapSlotPerk = {
[1] = {
nPerkId = 0,
nQty = 0,
nMaxLevel = 0
},
[2] = {
nPerkId = 0,
nQty = 0,
nMaxLevel = 0
},
[3] = {
nPerkId = 0,
nQty = 0,
nMaxLevel = 0
},
[4] = {
nPerkId = 0,
nQty = 0,
nMaxLevel = 0
}
}
}
EventManager.Add(EventId.SelectPerk, self, SelectPerkCallBack)
EventManager.Hit(EventId.OpenPanel, PanelId.FRThemePerkSelect, {
{Perks = tbPerks, Theme = 0}
}, 0, mapBag, {}, true, true)
end
function MainlinePrologueLevel:OnEvent_LevelStateChanged()
self.bDesertComplete = true
if 0 < #tbAfterDesertFloor and #tbAfterDesertFloor > self.curFloorIdx and not self.bBattleEnd then
self:ChangeFloor()
return
end
local function func_AvgEnd()
EventManager.Remove("StoryDialog_DialogEnd", self, func_AvgEnd)
NovaAPI.EnterModule("MainMenuModuleScene", true)
self.parent:LevelEnd()
end
local function UnloadCallback()
CS.GameCameraStackManager.Instance:CloseMainCamera(0.1)
CS.ClientManager.Instance:CloseLoadingView(nil)
PlayerData.Char:DeleteTrialChar()
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, UnloadCallback)
local ModuleManager = require("GameCore.Module.ModuleManager")
if ModuleManager.GetIsAdventure() then
NovaAPI.InputDisable()
end
if self.sAfterBattleAvg ~= "" then
self.bBattleEnd = true
self:SetLocalData()
EventManager.Add("StoryDialog_DialogEnd", self, func_AvgEnd)
EventManager.Hit("StoryDialog_DialogStart", self.sAfterBattleAvg, nil, self.nCurAvgCmdIdx)
else
func_AvgEnd()
end
end
self:UnsetFloor()
local ModuleManager = require("GameCore.Module.ModuleManager")
if ModuleManager.GetIsAdventure() then
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, UnloadCallback)
CS.AdventureModuleHelper.LevelStateChanged(true)
NovaAPI.InputDisable()
else
UnloadCallback()
end
end
function MainlinePrologueLevel:OnEvent_ExitModule(_, sEnterModuleName)
end
function MainlinePrologueLevel:OnEvent_AfterEnterModule(sEnterModuleName)
if sEnterModuleName == "EmptyModuleScene" then
local wait = function()
self.bDesertComplete = true
self:SetLocalData()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
self.tbChar = {}
self.tbTrialId = {}
if #tbTrialCharacter[self.curFloorIdx] > 0 then
PlayerData.Char:CreateTrialChar(tbTrialCharacter[self.curFloorIdx])
for _, nTrialId in pairs(tbTrialCharacter[self.curFloorIdx]) do
if 0 < nTrialId then
local mapTrialChar = PlayerData.Char:GetTrialCharById(nTrialId)
table.insert(self.tbChar, mapTrialChar.nId)
table.insert(self.tbTrialId, nTrialId)
end
end
end
for _, nTrialId in ipairs(self.tbTrialId) do
if 0 < nTrialId then
local mapTrialChar = PlayerData.Char:GetTrialCharById(nTrialId)
local tbstInfo, stActorInfo, nHeartStoneLevel = self.CalCharFixedEffectTrial(nTrialId)
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, mapTrialChar.nId, stActorInfo)
end
end
self:SetFloor(2)
CS.AdventureModuleHelper.EnterProloguelBattleMap(tbAfterDesertFloor[self.curFloorIdx], self.tbChar, {}, self.isThreePlayer, self.revivalPoint, self.btnNames)
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
end
cs_coroutine.start(wait)
EventManager.Hit(EventId.CloesCurPanel)
end
end
function MainlinePrologueLevel:OnEvent_PrologueBattleReload()
local function levelUnloadCallback()
NovaAPI.EnterModule("EmptyModuleScene", true)
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelUnloadCallback)
end
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelUnloadCallback)
CS.AdventureModuleHelper.LevelStateChanged(true)
end
function MainlinePrologueLevel:ChangeFloor()
local function levelUnloadCallback()
PlayerData.Char:DeleteTrialChar()
self.curFloorIdx = self.curFloorIdx + 1
NovaAPI.EnterModule("EmptyModuleScene", true)
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelUnloadCallback)
self.btnNames = {}
self.revivalPoint = Vector3.zero
self:SetLocalData()
end
local id = CS.AdventureModuleHelper.GetCurrentActivePlayer()
self.curCharId = CS.AdventureModuleHelper.GetCharacterId(id)
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelUnloadCallback)
self:UnsetFloor()
CS.AdventureModuleHelper.LevelStateChanged(true)
end
function MainlinePrologueLevel:OnEvent_LoadLevelRefresh()
if self.curFloorIdx > 0 then
for _, nTrialId in ipairs(self.tbTrialId) do
if 0 < nTrialId then
local tbstInfo, stActorInfo, nHeartStoneLevel = self.CalCharFixedEffectTrial(nTrialId)
end
end
end
end
function MainlinePrologueLevel:OnEvent_PrologueBattleArchive(isThreePlayer, revivalPoint, btnNames, nCmdId, nBoxId)
if nCmdId == -1 then
local lastAccount = LocalData.GetLocalData("LoginUIData", "LastUserName_All")
LocalData.SetLocalData(lastAccount, "MainlinePrologueLevel", "")
end
self.nBoxId = nBoxId
if isThreePlayer == nil then
end
self.isThreePlayer = isThreePlayer
self.revivalPoint = revivalPoint == nil and Vector3.zero or revivalPoint
btnNames = btnNames == nil and {
[0] = "",
Count = 1
} or btnNames
self.nCurAvgCmdIdx = nCmdId
local tbNames = {}
local nCount = btnNames.Count - 1
for i = 0, nCount do
table.insert(tbNames, btnNames[i])
end
self.btnNames = tbNames
self:SetLocalData()
end
function MainlinePrologueLevel:OnEvent_AdventureModuleEnter()
if self.bDesertComplete then
self:SetTheme()
self:SetThemePerk()
EventManager.Hit(EventId.OpenPanel, PanelId.Hud)
end
end
function MainlinePrologueLevel:OnEvent_EnterModule()
if not self.bDesertComplete then
EventManager.Hit(EventId.OpenPanel, PanelId.Prologue, self.tbChar)
else
EventManager.Hit(EventId.OpenPanel, PanelId.PrologueAdventurePanel, self.tbChar)
end
end
return MainlinePrologueLevel
@@ -0,0 +1,164 @@
local PreviewLevel = class("PreviewLevel")
local Actor2DManager = require("Game.Actor2D.Actor2DManager")
local mapEventConfig = {
LoadLevelRefresh = "OnEvent_LoadLevelRefresh",
BattlePause = "OnEvent_AbandonBattle",
LevelStateChanged = "OnEvent_LevelResult",
AdventureModuleEnter = "OnEvent_AdventureModuleEnter"
}
function PreviewLevel:Init(nLevelType, nLevelId, bView, nStarTowerFloorSetId, nPrefabID, nPrefabExtension, nPlayType, nSceneMir, parent)
self.parent = parent
self.tbCharId = PlayerData.Team:GetTeamCharId(1)
self.nLevelType = nLevelType
self.nLevelId = nLevelId
self:BindEvent()
CS.AdventureModuleHelper.EnterViewSceneLevel(nLevelType, nLevelId, self.tbCharId, bView, nStarTowerFloorSetId, nPrefabID, nPrefabExtension, nPlayType, nSceneMir)
NovaAPI.EnterModule("AdventureModuleScene", true, 17)
end
function PreviewLevel:OnEvent_LoadLevelRefresh()
end
function PreviewLevel:OnEvent_LevelResult(nState)
self:PlaySuccessPerform({}, {}, 3)
end
function PreviewLevel:OnEvent_AbandonBattle()
self:OnEvent_LevelResult(true, 0)
end
function PreviewLevel:OnEvent_AdventureModuleEnter()
EventManager.Hit(EventId.OpenPanel, PanelId.Adventure, self.tbCharId)
self:SetTheme()
for _, value in ipairs(self.tbCharId) do
self:SetTempActorAttribute(value)
end
end
function PreviewLevel:BindEvent()
if type(mapEventConfig) ~= "table" then
return
end
for nEventId, sCallbackName in pairs(mapEventConfig) do
local callback = self[sCallbackName]
if type(callback) == "function" then
EventManager.Add(nEventId, self, callback)
end
end
end
function PreviewLevel:UnBindEvent()
if type(mapEventConfig) ~= "table" then
return
end
for nEventId, sCallbackName in pairs(mapEventConfig) do
local callback = self[sCallbackName]
if type(callback) == "function" then
EventManager.Remove(nEventId, self, callback)
end
end
end
function PreviewLevel:PlaySuccessPerform()
local func_OpenResult = function(bSuccess)
end
local tbChar = self.tbCharId
local function levelEndCallback()
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
local sName = ""
if self.nLevelType == GameEnum.worldLevelType.Mainline then
local nType = ConfigTable.GetData("MainlineFloor", self.nLevelId).Theme
sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
elseif self.nLevelType == GameEnum.worldLevelType.RegionBoss then
local nType = ConfigTable.GetData("RegionBossFloor", self.nLevelId).Theme
sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
elseif self.nLevelType == GameEnum.worldLevelType.TravelerDuel then
local nType = ConfigTable.GetData("TravelerDuelFloor", self.nLevelId).Theme
sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
elseif self.nLevelType == GameEnum.worldLevelType.DailyInstance then
local nType = ConfigTable.GetData("DailyInstanceFloor", self.nLevelId).Theme
sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
else
local nType = ConfigTable.GetData("StarTowerMap", self.nLevelId).Theme
sName = ConfigTable.GetData("EndSceneType", nType).EndSceneName
end
local jumpPerform = function()
NovaAPI.DispatchEventWithData("SKIP_SETTLEMENT_PERFORM")
end
EventManager.Hit(EventId.OpenPanel, PanelId.BtnTips, jumpPerform)
local function openBattleResultPanel()
EventManager.Remove("SettlementPerformLoadFinish", self, openBattleResultPanel)
local sLarge, sSmall = "", ""
EventManager.Hit(EventId.OpenPanel, PanelId.BattleResult, true, 3, {}, {}, {}, 0, false, sLarge, sSmall, 13001, self.tbCharId)
self.bSettle = false
self.parent:LevelEnd()
end
EventManager.Add("SettlementPerformLoadFinish", self, openBattleResultPanel)
local tbSkin = {}
for _, nCharId in ipairs(tbChar) do
local nSkinId = PlayerData.Char:GetCharSkinId(nCharId)
table.insert(tbSkin, nSkinId)
end
CS.AdventureModuleHelper.PlaySettlementPerform(sName, "", tbSkin, func_OpenResult)
end
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
CS.AdventureModuleHelper.LevelStateChanged(true)
end
function PreviewLevel:SetTempActorAttribute(nCharId)
local mapChar = {nLevel = 1, nAdvance = 0}
local nLevel = mapChar.nLevel
local nAdvance = mapChar.nAdvance
local nAttrId = UTILS.GetCharacterAttributeId(nCharId, nAdvance, nLevel)
local mapCharAttr = ConfigTable.GetData_Attribute(tostring(nAttrId))
if mapCharAttr == nil then
printError("属性配置不存在:" .. nAttrId)
return {}
end
local stActorInfo = CS.Lua2CSharpInfo_CharAttribute()
stActorInfo.Atk = mapCharAttr.Atk
stActorInfo.Def = mapCharAttr.Def
stActorInfo.MDef = mapCharAttr.Mdef
stActorInfo.ShieldBonus = mapCharAttr.ShieldBonus
stActorInfo.IncomingShieldBonus = mapCharAttr.IncomingShieldBonus
stActorInfo.Evd = mapCharAttr.Evd
stActorInfo.CritRate = mapCharAttr.CritRate
stActorInfo.CritResistance = mapCharAttr.CritResistance
stActorInfo.CritPower = mapCharAttr.CritPower
stActorInfo.HitRate = mapCharAttr.HitRate
stActorInfo.DefPierce = mapCharAttr.DefPierce
stActorInfo.WEE = mapCharAttr.WEE
stActorInfo.FEE = mapCharAttr.FEE
stActorInfo.SEE = mapCharAttr.SEE
stActorInfo.AEE = mapCharAttr.AEE
stActorInfo.LEE = mapCharAttr.LEE
stActorInfo.DEE = mapCharAttr.DEE
stActorInfo.WEP = mapCharAttr.WEP
stActorInfo.FEP = mapCharAttr.FEP
stActorInfo.AEP = mapCharAttr.AEP
stActorInfo.SEP = mapCharAttr.SEP
stActorInfo.LEP = mapCharAttr.LEP
stActorInfo.DEP = mapCharAttr.DEP
stActorInfo.WER = mapCharAttr.WER
stActorInfo.FER = mapCharAttr.FER
stActorInfo.AER = mapCharAttr.AER
stActorInfo.SER = mapCharAttr.SER
stActorInfo.LER = mapCharAttr.LER
stActorInfo.DER = mapCharAttr.DER
stActorInfo.Hp = mapCharAttr.Hp
stActorInfo.Suppress = mapCharAttr.Suppress
stActorInfo.SkillLevel = {
1,
1,
1
}
stActorInfo.skinId = PlayerData.Char:GetCharSkinId(nCharId)
stActorInfo.attrId = mapCharAttr.sAttrId
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, nCharId, stActorInfo)
end
function PreviewLevel:SetCharFixedAttribute()
for nCharId, mapInfo in pairs(self.mapActorInfo) do
safe_call_cs_func(CS.AdventureModuleHelper.SetActorAttribute, nCharId, mapInfo.stActorInfo)
end
end
function PreviewLevel.CalCharFixedEffect(nCharId, bMainChar)
local tbstInfo = {}
local stActorInfo = {}
local nHeartStoneLevel = 1
return tbstInfo, stActorInfo, nHeartStoneLevel
end
function PreviewLevel:SetTheme()
end
return PreviewLevel
@@ -0,0 +1,33 @@
local BasePrologueFloor = class("BasePrologueFloor")
function BasePrologueFloor:ctor(parentData)
self.parent = parentData
end
function BasePrologueFloor:Enter()
self:_BindEventCallback()
end
function BasePrologueFloor:_BindEventCallback()
if type(self._mapEventConfig) ~= "table" then
return
end
for nEventId, sCallbackName in pairs(self._mapEventConfig) do
local callback = self[sCallbackName]
if type(callback) == "function" then
EventManager.Add(nEventId, self, callback)
end
end
end
function BasePrologueFloor:_UnbindEventCallback()
if type(self._mapEventConfig) ~= "table" then
return
end
for nEventId, sCallbackName in pairs(self._mapEventConfig) do
local callback = self[sCallbackName]
if type(callback) == "function" then
EventManager.Remove(nEventId, self, callback)
end
end
end
function BasePrologueFloor:Exit()
self:_UnbindEventCallback()
end
return BasePrologueFloor
@@ -0,0 +1,21 @@
local BaseFloor = require("Game.Adventure.MainlineLevel.PrologueFloor.BasePrologueFloor")
local BattleFloor = class("BattleFloor", BaseFloor)
BattleFloor._mapEventConfig = {
InteractiveNpc = "OnEvent_InteractiveNpc",
InteractiveBoxGet = "OnEvent_InteractiveBoxGet"
}
function BattleFloor:OnEvent_InteractiveNpc(nNpcId, nNpcUid)
local mapNpc = ConfigTable.GetData("NPC", nNpcId)
if mapNpc == nil then
print("NPC不存在" .. nNpcId)
return
end
if mapNpc.type ~= GameEnum.npcType.PrologueReward then
return
end
self.parent:GetRewardNpc(nNpcId, nNpcUid)
end
function BattleFloor:OnEvent_InteractiveBox(nBoxId, _, _, _)
self.parent:GetRewardBox(nBoxId)
end
return BattleFloor
@@ -0,0 +1,4 @@
local BaseFloor = require("Game.Adventure.MainlineLevel.PrologueFloor.BasePrologueFloor")
local DesertFloor = class("DesertFloor", BaseFloor)
DesertFloor._mapEventConfig = {}
return DesertFloor