Update - 1.13.0.124

EN: 1.13.0.124
CN: 1.13.0.124
JP: 1.13.0.128
KR: 1.13.0.130
This commit is contained in:
SL1900
2026-07-21 12:30:00 +09:00
parent a12087abad
commit 8c4bd41668
1334 changed files with 873026 additions and 95164 deletions
+124 -4
View File
@@ -63,7 +63,9 @@ AllEnum.CoinItemId = {
NormalSingleTicket = 501,
LimitedSingleTicket = 502,
DailyQuestActive = 61,
WeeklyQuestActive = 63
WeeklyQuestActive = 63,
TraceHunt = 37,
SoldierCurrency = 40
}
AllEnum.QuestStatus = {Undone = false, Done = true}
AllEnum.CharHeadIconSurfix = {
@@ -410,6 +412,13 @@ AllEnum.AttachAttr = {
bPlayer = true
}
}
AllEnum.SoldierCharAttr = {
{sKey = "Energy"},
{
sKey = "InitialEnergy"
},
{sKey = "Recovery"}
}
AllEnum.CharConfigType = {
Attr = 1,
Char = 2,
@@ -476,7 +485,8 @@ AllEnum.WorldMapNodeType = {
Trial = 14,
JointDrill = 15,
ActivityLevels = 16,
ActivityStory = 17
ActivityStory = 17,
TraceHunt = 18
}
AllEnum.FrameColor_New = {
[0] = "0",
@@ -793,7 +803,8 @@ AllEnum.SideBaner = {
Achievement = 1,
DictionaryReward = 2,
DictionaryEntry = 3,
Favour = 4
Favour = 4,
Item = 5
}
AllEnum.RMBOrderType = {Mall = 1, BattlePass = 2}
AllEnum.AvgLogType = {
@@ -1090,6 +1101,7 @@ AllEnum.Star_Tag = {
[809] = {sLanguage = 809},
[810] = {sLanguage = 810},
[811] = {sLanguage = 811},
[817] = {sLanguage = 817},
[818] = {sLanguage = 818},
[823] = {sLanguage = 823}
}
@@ -1321,7 +1333,8 @@ AllEnum.RegionBossFormationType = {
JointDrill = 11,
ActivityLevels = 12,
ActivityStory = 13,
JointDrill_2 = 14
JointDrill_2 = 14,
TraceHunt = 15
}
AllEnum.EnergyPanelType = {
Main = 1,
@@ -1591,4 +1604,111 @@ AllEnum.GoldenSpyBuffType = {
UnactiveBuff = 3
}
AllEnum.GamepadIconSuffix = {Light = "", Dark = "_2"}
AllEnum.SoldierHandbookType = {
Character = 1,
Partner = 2,
StarterCard = 3,
StrategyCard = 4
}
AllEnum.SoliderNoteTypeCfg = {
[GameEnum.soldierNodeType.Event] = {
Icon = "SoldierNodeType_Event",
Language = "SoldierNodeType_Event"
},
[GameEnum.soldierNodeType.Battle] = {
Icon = "SoldierNodeType_Battle",
Language = "SoldierNodeType_Battle"
},
[GameEnum.soldierNodeType.MidBossBattle] = {
Icon = "SoldierNodeType_MidBossBattle",
Language = "SoldierNodeType_MidBossBattle"
},
[GameEnum.soldierNodeType.FinalBossBattle] = {
Icon = "SoldierNodeType_FinalBossBattle",
Language = "SoldierNodeType_FinalBossBattle"
}
}
AllEnum.SoldierChessIconSurfix = {
S = "_S",
M = "_M",
L = "_L",
XL = "_XL",
Fight = "_Fight",
Sup = "_Sup"
}
AllEnum.SoldierPartnerLevelIcon = {
[GameEnum.PartnerLevelQuality.None] = {
bg = "PartnerQuality_00",
levelIcon = "PartnerLevelQuality_00"
},
[GameEnum.PartnerLevelQuality.Copper] = {
bg = "PartnerQuality_01",
levelIcon = "PartnerLevelQuality_01"
},
[GameEnum.PartnerLevelQuality.Silver] = {
bg = "PartnerQuality_02",
levelIcon = "PartnerLevelQuality_02"
},
[GameEnum.PartnerLevelQuality.Gold] = {
bg = "PartnerQuality_03",
levelIcon = "PartnerLevelQuality_03"
},
[GameEnum.PartnerLevelQuality.Color] = {
bg = "PartnerQuality_04",
levelIcon = "PartnerLevelQuality_04"
}
}
AllEnum.SoldierChessRarityIcon = {
[GameEnum.ChessRarity.White] = "ChessQuality_01",
[GameEnum.ChessRarity.Green] = "ChessQuality_02",
[GameEnum.ChessRarity.Blue] = "ChessQuality_03",
[GameEnum.ChessRarity.Purple] = "ChessQuality_04",
[GameEnum.ChessRarity.Gold] = "ChessQuality_05",
[GameEnum.ChessRarity.Color] = "ChessQuality_05"
}
AllEnum.SoldierStrategyCardRarityIcon = {
[GameEnum.itemRarity.N] = "StrategyCardQuality_01",
[GameEnum.itemRarity.M] = "StrategyCardQuality_02",
[GameEnum.itemRarity.R] = "StrategyCardQuality_03"
}
AllEnum.SoldierItemRarityIcon = {
[GameEnum.itemRarity.N] = "SoldierItemQuality_01",
[GameEnum.itemRarity.M] = "SoldierItemQuality_02",
[GameEnum.itemRarity.R] = "SoldierItemQuality_03",
[GameEnum.itemRarity.SR] = "SoldierItemQuality_04",
[GameEnum.itemRarity.SSR] = "SoldierItemQuality_05"
}
AllEnum.SoldierPositionStr = {
[GameEnum.SoldierPositionType.FightPosition] = {
sLanguageId = "Soldier_Handbook_Vanguard",
sIcon = ""
},
[GameEnum.SoldierPositionType.SupportPosition] = {
sLanguageId = "Soldier_Handbook_Support",
sIcon = ""
}
}
AllEnum.SoldierResultType = {
NodeSuccess = 1,
NodeFail = 2,
ChallengeSuccess = 3,
ChallengeFail = 4
}
AllEnum.SoldierRewardSource = {
Apply = 1,
EventBattle = 2,
Battle = 3,
CardWipe = 4
}
AllEnum.SoldierCardType = {
UnknownCard = "Undefined",
StartedCard = "Starter",
StrategyCard = "Strategy"
}
AllEnum.SoldierPositionType = {
Fight = 1,
Support = 2,
Waiting = 3,
Other = 4
}
return AllEnum
@@ -3,7 +3,6 @@ local BreakOutData = class("BreakOutData", ActivityDataBase)
local LocalData = require("GameCore.Data.LocalData")
local RapidJson = require("rapidjson")
local RedDotManager = require("GameCore.RedDot.RedDotManager")
local ClientManager = CS.ClientManager.Instance
local BreakOutLevelData = require("GameCore.Data.DataClass.Activity.BreakOutLevelData")
function BreakOutData:Init()
self.allLevelData = {}
@@ -391,7 +390,7 @@ function BreakOutData:ShowActivityClosedAlert()
EventManager.Hit(EventId.OpenMessageBox, msg)
end
function BreakOutData:ForceExitOnFinishFail()
EventManager.Hit(EventId.ClosePanel, PanelId.BreakOutPlayPanelS2)
EventManager.Hit(EventId.ClosePanel, PanelId.BreakOutLevelDetailPanelS2)
EventManager.Hit(EventId.ClosePanel, PanelId.BreakOutPlayPanelS3)
EventManager.Hit(EventId.ClosePanel, PanelId.BreakOutLevelDetailPanelS3)
end
return BreakOutData
@@ -0,0 +1,83 @@
local ActivityDataBase = require("GameCore.Data.DataClass.Activity.ActivityDataBase")
local FollowSocialMediaData = class("FollowSocialMediaData", ActivityDataBase)
function FollowSocialMediaData:Init()
self.tbRewardData = {}
end
function FollowSocialMediaData:RefreshFollowSocialMediaActData(actId, msgData)
self:Init()
local tbData = UTILS.ParseByteString(msgData.State)
local tbActive = self:GetBitsAsBooleanArray(tbData)
for i, v in ipairs(tbActive) do
if v then
self.tbRewardData[i] = true
end
end
end
function FollowSocialMediaData:GetAllRewardData()
return self.tbRewardData
end
function FollowSocialMediaData:GetRewardData(nConfigId)
return self.tbRewardData[nConfigId] or false
end
function FollowSocialMediaData:SetRewardData(nConfigId, bGet)
self.tbRewardData[nConfigId] = bGet
end
function FollowSocialMediaData:SendRewardReceive(nConfigId, callback)
local backCallback = function(_, msgData)
self:SetRewardData(nConfigId, true)
if callback ~= nil then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.activity_share_reward_receive_req, {
ActivityId = self.nActId,
ChannelId = nConfigId
}, nil, backCallback)
end
function FollowSocialMediaData:GetBitsAsBooleanArray(byteArray)
local bits = {}
local totalBits = #byteArray * 8
for i = 1, totalBits do
bits[i] = false
end
for i = #byteArray, 1, -1 do
local value = byteArray[i]
local byteOffset = #byteArray - i
local baseBitIndex = byteOffset * 8
for bitPos = 0, 7 do
local mask = 2 ^ bitPos
bits[baseBitIndex + bitPos + 1] = value & mask ~= 0
end
end
return bits
end
function FollowSocialMediaData:CheckActShow()
if NovaAPI.IsReviewServerEnv() then
return false
end
if self.actCfg.PreLimit == GameEnum.activityPreLimit.WorldClass then
local nCurWorldClass = PlayerData.Base:GetWorldClass()
local nNeedWorldClass = tonumber(self.actCfg.LimitParam)
if nCurWorldClass < nNeedWorldClass then
return false
end
elseif self.actCfg.PreLimit == GameEnum.activityPreLimit.questLimit then
local nStoryId = tonumber(self.actCfg.LimitParam)
local bReaded = PlayerData.Avg:IsStoryReaded(nStoryId)
if not bReaded then
return false
end
end
if self.actCfg.EndType == GameEnum.activityEndType.NoLimit then
return not self.bBanner and self:CheckActivityOpen()
else
return self:CheckActivityOpen()
end
end
function FollowSocialMediaData:CheckShowBanner()
if NovaAPI.IsReviewServerEnv() then
return false
end
return self:CheckActPlay() and self.actCfg.BannerRes ~= "" and self.bBanner == false
end
return FollowSocialMediaData
@@ -0,0 +1,271 @@
local ActivityDataBase = require("GameCore.Data.DataClass.Activity.ActivityDataBase")
local IceCreamActData = class("IceCreamActData", ActivityDataBase)
local LocalData = require("GameCore.Data.LocalData")
local IceCreamLevelData = require("Game.UI.Play_IceCreamTruck.Play.IceCreamLevelData")
local ClientManager = CS.ClientManager.Instance
local RapidJson = require("rapidjson")
function IceCreamActData:Init()
self.mapLevelData = {}
self.tbLevelList = {}
self.tbLevelByType = {}
self.tbSkipNewLevel = {}
self.tbNewLevel = {}
self:ParseConfig()
self:AddListeners()
end
function IceCreamActData:AddListeners()
EventManager.Add("ClearAllIceLevels", self, self.OnEvent_GMClearAllIceLevels)
end
function IceCreamActData:ParseConfig()
local foreach_level = function(data)
if data.ActivityId ~= self.nActId then
return
end
table.insert(self.tbLevelList, {
nId = data.Id,
nLevelType = data.LevelType
})
local bucket = self.tbLevelByType[data.LevelType]
if bucket == nil then
bucket = {}
self.tbLevelByType[data.LevelType] = bucket
end
table.insert(bucket, data.Id)
end
ForEachTableLine(DataTable.ActivityIceCreamLevel, foreach_level)
table.sort(self.tbLevelList, function(a, b)
if a.nLevelType ~= b.nLevelType then
return a.nLevelType < b.nLevelType
end
return a.nId < b.nId
end)
for _, bucket in pairs(self.tbLevelByType) do
table.sort(bucket, function(a, b)
return a < b
end)
end
local sJson = LocalData.GetPlayerLocalData("IceCreamLevel")
local tb = decodeJson(sJson)
if type(tb) == "table" then
self.tbSkipNewLevel = tb
end
end
function IceCreamActData:RefreshIceCreamActData(nActId, msgData)
self.nActId = nActId
self:CacheLevelData(msgData)
end
function IceCreamActData:CacheLevelData(msgData)
local LeveList = self:GetLevelList()
for _, v in ipairs(LeveList) do
self.mapLevelData[v.nId] = {nScore = 0, bFirstComplete = false}
end
if msgData ~= nil then
tbLevel = msgData.Levels
for _, v in ipairs(tbLevel) do
self.mapLevelData[v.LevelId] = {
nScore = v.Score,
bFirstComplete = v.FirstComplete
}
end
end
self:RefreshLevelRedDot()
end
function IceCreamActData:CacheLevelData_GM(msgData)
local LeveList = self:GetLevelList()
for _, v in ipairs(LeveList) do
self.mapLevelData[v.nId] = {nScore = 0, bFirstComplete = false}
end
if msgData ~= nil then
tbLevel = msgData.levels
for _, v in ipairs(tbLevel) do
self.mapLevelData[v.LevelId] = {
nScore = v.Score,
bFirstComplete = v.FirstComplete
}
end
end
self:RefreshLevelRedDot()
end
function IceCreamActData:GetLevelList()
return self.tbLevelList
end
function IceCreamActData:GetLevelTypeTable()
return self.tbLevelByType
end
function IceCreamActData:GetLevelsByType(index)
if self.tbLevelByType then
return self.tbLevelByType[index]
end
return nil
end
function IceCreamActData:GetNextIslandIsLock(index)
if self.tbLevelByType then
local nLevelIds = self.tbLevelByType[index + 1]
if nLevelIds and nLevelIds[1] then
return self:CheckLevelIsLockByTime(nLevelIds[1])
end
end
return true
end
function IceCreamActData:CheckLevelLock(nLevelId)
local bLock = self:CheckLevelIsLockByTime(nLevelId)
if bLock then
return bLock
end
bLock = self:CheckLevelLockByPrev(nLevelId)
return bLock
end
function IceCreamActData:CheckLevelIsLockByTime(nLevelId)
local nRemain = self:GetLevelStartTime(nLevelId) - ClientManager.serverTimeStamp
local bLock = 0 < nRemain
return bLock, nRemain
end
function IceCreamActData:CheckLevelLockByPrev(nLevelId)
local mapCfg = ConfigTable.GetData("ActivityIceCreamLevel", nLevelId)
if not mapCfg then
return true
end
local nPrev = mapCfg.PreLevelId
if nPrev == 0 then
return false
end
return not self.mapLevelData[nPrev].bFirstComplete
end
function IceCreamActData:GetLevelData(nId)
return self.mapLevelData[nId] or {nScore = 0, bFirstComplete = false}
end
function IceCreamActData:GetLevelMapData(nLevelId)
local mapCfg = ConfigTable.GetData("ActivityIceCreamLevel", nLevelId)
if not mapCfg then
return nil
end
return mapCfg
end
function IceCreamActData:GetLevelStartTime(nLevelId)
local mapCfg = ConfigTable.GetData("ActivityIceCreamLevel", nLevelId)
if not mapCfg then
return 0
end
local openActDayNextTime = ClientManager:GetNextRefreshTime(self.nOpenTime)
local openTime = openActDayNextTime - 86400
return openTime + mapCfg.Duration * 86400
end
function IceCreamActData:EnterLevel(nLevelId)
self.IceCreamLevelData = IceCreamLevelData.new()
self.IceCreamLevelData:InitData(nLevelId, self.nActId)
end
function IceCreamActData:SetLevelMaxScore(nLevelId, nScore)
if self.mapLevelData[nLevelId] then
local nCurrentScore = self.mapLevelData[nLevelId].nScore
if nScore > nCurrentScore then
self.mapLevelData[nLevelId].nScore = nScore
end
end
end
function IceCreamActData:GetLevelMaxScore(nLevelId)
if self.mapLevelData[nLevelId].nScore then
return self.mapLevelData[nLevelId].nScore
end
return 0
end
function IceCreamActData:RefreshLevelRedDot()
self.tbNewLevel = {}
local foreachLevel = function(mapData)
if mapData.ActivityId == self.nActId then
local bNewState = self:GetLevelNewStateInternal(mapData.Id)
if bNewState then
table.insert(self.tbNewLevel, mapData.Id)
end
RedDotManager.SetValid(RedDotDefine.Activity_IceCreamTruck_NewLevel, {
self.nActId,
mapData.LevelType,
mapData.Id
}, bNewState)
end
end
ForEachTableLine(DataTable.ActivityIceCreamLevel, foreachLevel)
end
function IceCreamActData:GetLevelNewStateInternal(nLevelId)
local mapLevelCfgData = ConfigTable.GetData("ActivityIceCreamLevel", nLevelId)
if mapLevelCfgData == nil then
return false
end
if not self:CheckLevelLock(nLevelId) then
local sKey = tostring(self.nActId) .. tostring(nLevelId) .. "LevelNew"
local bIsFirst = LocalData.GetPlayerLocalData(sKey)
if bIsFirst == nil then
bIsFirst = true
else
bIsFirst = false
end
return bIsFirst
end
return false
end
function IceCreamActData:SetLevelNew(nLevelType, nLevelId)
local idx = table.indexof(self.tbNewLevel, nLevelId)
if 0 < idx then
table.remove(self.tbNewLevel, idx)
else
return
end
local sKey = tostring(self.nActId) .. tostring(nLevelId) .. "LevelNew"
LocalData.SetPlayerLocalData(sKey, false)
RedDotManager.SetValid(RedDotDefine.Activity_IceCreamTruck_NewLevel, {
self.nActId,
nLevelType,
nLevelId
}, false)
end
function IceCreamActData:SendActivityIceCreamLevelSettleReq(msgData, bResult, callback)
if self:IsActivityClosed() then
self:ShowActivityClosedAlert()
return
end
local ResultCallback = function(_, mapMainData)
if callback ~= nil then
callback(mapMainData)
if bResult then
self:UpdateLevelData({
Id = msgData.LevelId,
FirstComplete = mapMainData.Passed
})
end
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.activity_ice_cream_level_settle_req, msgData, nil, ResultCallback)
end
function IceCreamActData:UpdateLevelData(levelData)
if self.mapLevelData[levelData.Id] and not self.mapLevelData[levelData.Id].bFirstComplete then
self.mapLevelData[levelData.Id].bFirstComplete = levelData.FirstComplete
end
local nLevelType = self:GetLevelMapData(levelData.Id).LevelType
self:SetLevelNew(nLevelType, levelData.Id)
self:RefreshLevelRedDot()
end
function IceCreamActData:IsActivityClosed()
if self == nil or self.CheckActivityOpen == nil then
return false
end
return not self:CheckActivityOpen()
end
function IceCreamActData:ShowActivityClosedAlert()
local msg = {
nType = AllEnum.MessageBox.Alert,
sContent = ConfigTable.GetUIText("Activity_End_Notice"),
callbackConfirm = function()
self:ForceExitOnFinishFail()
end
}
EventManager.Hit(EventId.OpenMessageBox, msg)
end
function IceCreamActData:ForceExitOnFinishFail()
EventManager.Hit(EventId.ClosePanel, PanelId.IceCreamTruckGamePanel)
EventManager.Hit(EventId.ClosePanel, PanelId.IceCreamLevelsSelectPanel)
end
function IceCreamActData:OnEvent_GMClearAllIceLevels(mapMsgData)
if mapMsgData ~= nil then
self:CacheLevelData_GM(mapMsgData)
end
end
return IceCreamActData
@@ -2,11 +2,19 @@ local ActivityDataBase = require("GameCore.Data.DataClass.Activity.ActivityDataB
local JointDrillActData = class("JointDrillActData", ActivityDataBase)
local ClientManager = CS.ClientManager.Instance
local TimerManager = require("GameCore.Timer.TimerManager")
local LocalData = require("GameCore.Data.LocalData")
local sJointDrillDailyEnterKeyPrefix = "JointDrillDailyEnter_"
local GetDailyEnterLocalKey = function(nActId)
return sJointDrillDailyEnterKeyPrefix .. tostring(nActId)
end
function JointDrillActData:Init()
self.jointDrillActCfg = nil
self.nJointDrillType = 0
self.nActStatus = 0
self.actTimer = nil
self.bDailyEnterLoaded = false
self.nDailyEnterNextRefreshTime = nil
self.bDailyEnterRedDotValid = false
self.tbPassedLevels = {}
self.tbQuests = {}
self.nTotalScore = 0
@@ -54,6 +62,7 @@ function JointDrillActData:RefreshJointDrillActData(msgData)
self.tbQuests = msgData.Quests
end
self:RefreshJointDrillQuestRedDot()
self:RefreshDailyEnterRedDot()
self:StartActTimer()
end
function JointDrillActData:GetChallengeStartTime()
@@ -76,6 +85,44 @@ function JointDrillActData:RefreshJointDrillQuestRedDot()
end
RedDotManager.SetValid(RedDotDefine.JointDrillQuest, nil, bHasReward)
end
function JointDrillActData:CheckInChallengeTime()
local nChallengeStartTime = self:GetChallengeStartTime()
local nChallengeEndTime = self:GetChallengeEndTime()
if nChallengeStartTime == nil or nChallengeEndTime == nil then
return false
end
local nCurTime = ClientManager.serverTimeStamp
return nChallengeStartTime <= nCurTime and nChallengeEndTime > nCurTime
end
function JointDrillActData:CheckEnteredToday()
if not self.bDailyEnterLoaded then
local sData = LocalData.GetPlayerLocalData(GetDailyEnterLocalKey(self.nActId))
self.nDailyEnterNextRefreshTime = tonumber(sData)
self.bDailyEnterLoaded = true
end
local nCurTime = ClientManager.serverTimeStamp
return self.nDailyEnterNextRefreshTime ~= nil and nCurTime < self.nDailyEnterNextRefreshTime
end
function JointDrillActData:RefreshDailyEnterRedDot()
local bShowRedDot = self:CheckInChallengeTime() and not self:CheckEnteredToday()
if self.bDailyEnterRedDotValid == bShowRedDot then
return
end
self.bDailyEnterRedDotValid = bShowRedDot
RedDotManager.SetValid(RedDotDefine.JointDrillDailyEnter, self.nActId, bShowRedDot)
end
function JointDrillActData:MarkEnteredToday()
if not self:CheckInChallengeTime() then
self:RefreshDailyEnterRedDot()
return
end
local nNowTime = ClientManager.serverTimeStamp
local nNextRefreshTime = ClientManager:GetNextRefreshTime(nNowTime)
self.nDailyEnterNextRefreshTime = nNextRefreshTime
self.bDailyEnterLoaded = true
LocalData.SetPlayerLocalData(GetDailyEnterLocalKey(self.nActId), tostring(nNextRefreshTime))
self:RefreshDailyEnterRedDot()
end
function JointDrillActData:RefreshQuestData(questData)
local bHasData = false
for k, v in ipairs(self.tbQuests) do
@@ -141,6 +188,7 @@ function JointDrillActData:StartActTimer()
self.nActStatus = AllEnum.JointDrillActStatus.Closed
nRemainTime = 0
end
self:RefreshDailyEnterRedDot()
EventManager.Hit("RefreshJointDrillActTime", self.nActStatus, nRemainTime)
if nRemainTime <= 0 and self.actTimer ~= nil and self.nActStatus == AllEnum.JointDrillActStatus.Closed then
self.actTimer:Cancel()
@@ -33,12 +33,19 @@ end
function MiningGameData:CacheAllQuestData(questListData)
self.tbQuestDataList = {}
for _, v in pairs(questListData) do
local questData = {
nId = v.Id,
nStatus = self:QuestServer2Client(v.Status),
progress = v.Progress
}
table.insert(self.tbQuestDataList, questData)
local config = ConfigTable.GetData("MiningQuest", v.Id)
if config ~= nil then
local nGroupId = config.GroupId
local questData = {
nId = v.Id,
nStatus = self:QuestServer2Client(v.Status),
progress = v.Progress
}
if self.tbQuestDataList[nGroupId] == nil then
self.tbQuestDataList[nGroupId] = {}
end
table.insert(self.tbQuestDataList[nGroupId], questData)
end
end
self:RefreshQuestReddot()
end
@@ -48,43 +55,79 @@ end
function MiningGameData:GetQuestData(nQuestId)
local questData
for _, v in pairs(self.tbQuestDataList) do
if v.nId == nQuestId then
questData = v
for _, v2 in ipairs(v) do
if v2.nId == nQuestId then
questData = v2
break
end
end
end
return questData
end
function MiningGameData:GetCompleteCount()
function MiningGameData:GetAllReceivedCount()
local nCount = 0
for _, v in pairs(self.tbQuestDataList) do
if v.nStatus == AllEnum.ActQuestStatus.Complete or v.nStatus == AllEnum.ActQuestStatus.Received then
for _, v2 in ipairs(v) do
if v2.nStatus == AllEnum.ActQuestStatus.Received then
nCount = nCount + 1
end
end
end
return nCount
end
function MiningGameData:GetAllQuestCount()
local nCount = 0
for _, v in pairs(self.tbQuestDataList) do
nCount = nCount + #v
end
return nCount
end
function MiningGameData:GetAllGroupId()
local tbGroupId = {}
for k, _ in pairs(self.tbQuestDataList) do
table.insert(tbGroupId, k)
end
return tbGroupId
end
function MiningGameData:GetQuestbyGroupId(nGroupId)
return self.tbQuestDataList[nGroupId]
end
function MiningGameData:GetGroupQuestReceiveCount(nGroupId)
local nCount = 0
for _, v in pairs(self.tbQuestDataList[nGroupId]) do
if v.nStatus == AllEnum.ActQuestStatus.Received then
nCount = nCount + 1
end
end
return nCount
end
function MiningGameData:RefreshQuestData(questData)
for _, v in pairs(self.tbQuestDataList) do
for _, v2 in ipairs(v) do
if v2.nId == questData.Id then
v2.nStatus = self:QuestServer2Client(questData.Status)
v2.progress = questData.Progress
break
end
end
end
self:RefreshQuestReddot()
EventManager.Hit("MiningQuestUpdate")
end
function MiningGameData:RefreshQuestReddot()
local bTabReddot = false
if next(self.tbQuestDataList) ~= nil then
for _, v in pairs(self.tbQuestDataList) do
local bReddot = v.nStatus == AllEnum.ActQuestStatus.Complete
RedDotManager.SetValid(RedDotDefine.Activity_Mining_Quest, v.nId, bReddot)
for _, v in pairs(self.tbQuestDataList) do
for _, v2 in ipairs(v) do
local bReddot = v2.nStatus == AllEnum.ActQuestStatus.Complete
local nGroupId = ConfigTable.GetData("MiningQuest", v2.nId).GroupId
RedDotManager.SetValid(RedDotDefine.Activity_Mining_Quest, {
nGroupId,
v2.nId
}, bReddot)
bTabReddot = bTabReddot or bReddot
end
end
RedDotManager.SetValid(RedDotDefine.Activity_Tab, self.nActId, bTabReddot or self.bIsFirst)
end
function MiningGameData:HasFinishQuest(...)
local bHasFinish = false
for _, v in pairs(self.tbQuestDataList) do
if v.nStatus == AllEnum.ActQuestStatus.Complete then
bHasFinish = true
break
end
end
return bHasFinish
RedDotManager.SetValid(RedDotDefine.Activity_Mining_AllQuest, self.nActId, bTabReddot)
end
function MiningGameData:QuestServer2Client(nStatus)
if nStatus == 0 then
@@ -173,6 +216,7 @@ function MiningGameData:RefreshMiningGameActData(actId, msgData)
end
self:InitCurDicData()
self.nScore = msgData.Score
self:CacheAllQuestData(msgData.Quests)
end
function MiningGameData:GetIsFirstIn()
return self.bIsFirst
@@ -377,13 +421,15 @@ function MiningGameData:RequestFinishAvg(storyId, callback)
StoryId = storyId
}, nil, msgCallback)
end
function MiningGameData:SendQuestReceive(nQuestId)
function MiningGameData:SendQuestReceive(nQuestId, nGroupId)
local callback = function(_, msgData)
UTILS.OpenReceiveByChangeInfo(msgData.ChangeInfo, nil)
UTILS.OpenReceiveByChangeInfo(msgData, nil)
if nQuestId == 0 then
for _, v in pairs(self.tbQuestDataList) do
if v.nStatus == AllEnum.ActQuestStatus.Complete then
v.nStatus = AllEnum.ActQuestStatus.Received
if nGroupId ~= 0 then
for _, v in pairs(self.tbQuestDataList[nGroupId]) do
if v.nStatus == AllEnum.ActQuestStatus.Complete then
v.nStatus = AllEnum.ActQuestStatus.Received
end
end
end
else
@@ -393,11 +439,13 @@ function MiningGameData:SendQuestReceive(nQuestId)
end
end
EventManager.Hit("MiningQuestUpdate")
self:UpdateAxe()
self:RefreshQuestReddot()
end
HttpNetHandler.SendMsg(NetMsgId.Id.activity_mining_quest_reward_receive_req, {
ActivityId = self.nActId,
QuestId = nQuestId
QuestId = nQuestId,
GroupId = nGroupId
}, nil, callback)
end
return MiningGameData
@@ -1,7 +1,7 @@
local ActivityDataBase = require("GameCore.Data.DataClass.Activity.ActivityDataBase")
local PenguinCardActData = class("PenguinCardActData", ActivityDataBase)
local LocalData = require("GameCore.Data.LocalData")
local PenguinLevel = require("Game.UI.Play_PenguinCard.PenguinLevel")
local PenguinLevel = require("Game.UI.Play_PenguinCard.NormalMode.PenguinLevel_Normal")
local ClientManager = CS.ClientManager.Instance
local RapidJson = require("rapidjson")
function PenguinCardActData:Init()
@@ -28,11 +28,16 @@ local Postal_10106Data = require("GameCore.Data.DataClass.Activity.Postal_10106D
local Viewfinder_10107Data = require("GameCore.Data.DataClass.Activity.Viewfinder_10107Data")
local Tech_10108Data = require("GameCore.Data.DataClass.Activity.Tech_10108Data")
local GunStorm_10109Data = require("GameCore.Data.DataClass.Activity.GunStorm_10109Data")
local Summer_10110Data = require("GameCore.Data.DataClass.Activity.Summer_10110Data")
local PenguinCardActData = require("GameCore.Data.DataClass.Activity.PenguinCardActData")
local GoldenSpyData = require("GameCore.Data.DataClass.Activity.GoldenSpyData")
local Solodance_20102Data = require("GameCore.Data.DataClass.Activity.Solodance_20102Data")
local SwimTheme_11100Data = require("GameCore.Data.DataClass.Activity.SwimTheme_11100Data")
local DoubleDropsActData = require("GameCore.Data.DataClass.Activity.DoubleDropsActData")
local FollowSocialMediaData = require("GameCore.Data.DataClass.Activity.FollowSocialMediaData")
local Summer_20103Data = require("GameCore.Data.DataClass.Activity.Summer_20103Data")
local IceCreamActData = require("GameCore.Data.DataClass.Activity.IceCreamActData")
local SoldierActData = require("GameCore.Data.DataClass.Activity.SoldierActData")
function PlayerActivityData:Init()
self.bCacheActData = false
self.tbAllActivity = {}
@@ -146,6 +151,12 @@ function PlayerActivityData:CacheAllActivityData(mapNetMsg)
self:RefreshGoldenSpyActData(nActId, v.GDS)
elseif actCfg.ActivityType == GameEnum.activityType.Double then
self:RefreshDoubleDropsActData(nActId, v.Double)
elseif actCfg.ActivityType == GameEnum.activityType.FollowSocialMedia then
self:RefreshFollowSocialMediaActData(nActId, v.Share)
elseif actCfg.ActivityType == GameEnum.activityType.IceCream then
self:RefreshIceCreamActData(nActId, v.IceCream)
elseif actCfg.ActivityType == GameEnum.activityType.Soldier then
self:RefreshSoldierActData(nActId, v.Soldier)
end
end
end
@@ -245,6 +256,12 @@ function PlayerActivityData:CreateActivityIns(actData)
actIns = GoldenSpyData.new(actData)
elseif actCfg.ActivityType == GameEnum.activityType.Double then
actIns = DoubleDropsActData.new(actData)
elseif actCfg.ActivityType == GameEnum.activityType.FollowSocialMedia then
actIns = FollowSocialMediaData.new(actData)
elseif actCfg.ActivityType == GameEnum.activityType.IceCream then
actIns = IceCreamActData.new(actData)
elseif actCfg.ActivityType == GameEnum.activityType.Soldier then
actIns = SoldierActData.new(actData)
end
if actIns ~= nil then
self.tbAllActivity[actData.Id] = actIns
@@ -361,6 +378,10 @@ function PlayerActivityData:CreateActivityGroupIns(actData)
actIns = Tech_10108Data.new(actData)
elseif actCfg.ActivityThemeType == GameEnum.activityThemeType.GunStorm_10109 then
actIns = GunStorm_10109Data.new(actData)
elseif actCfg.ActivityThemeType == GameEnum.activityThemeType.Summer_10110 then
actIns = Summer_10110Data.new(actData)
elseif actCfg.ActivityThemeType == GameEnum.activityThemeType.Summer_20103 then
actIns = Summer_20103Data.new(actData)
end
self.tbAllActivityGroup[actData.Id] = actIns
PlayerData.ActivityAvg:RefreshAvgRedDot()
@@ -493,7 +514,11 @@ function PlayerActivityData:RefreshSingleQuest(questData)
if nil ~= self.tbAllActivity[questData.ActivityId] then
self.tbAllActivity[questData.ActivityId]:RefreshQuestData(questData)
end
elseif actCfg.ActivityType == GameEnum.activityType.Double and nil ~= self.tbAllActivity[questData.ActivityId] then
elseif actCfg.ActivityType == GameEnum.activityType.Double then
if nil ~= self.tbAllActivity[questData.ActivityId] then
self.tbAllActivity[questData.ActivityId]:RefreshQuestData(questData)
end
elseif actCfg.ActivityType == GameEnum.activityType.Soldier and nil ~= self.tbAllActivity[questData.ActivityId] then
self.tbAllActivity[questData.ActivityId]:RefreshQuestData(questData)
end
end
@@ -603,6 +628,21 @@ function PlayerActivityData:RefreshGoldenSpyActData(nActId, msgData)
self.tbAllActivity[nActId]:RefreshGoldenSpyActData(nActId, msgData)
end
end
function PlayerActivityData:RefreshFollowSocialMediaActData(nActId, msgData)
if nil ~= self.tbAllActivity[nActId] then
self.tbAllActivity[nActId]:RefreshFollowSocialMediaActData(nActId, msgData)
end
end
function PlayerActivityData:RefreshIceCreamActData(nActId, msgData)
if nil ~= self.tbAllActivity[nActId] then
self.tbAllActivity[nActId]:RefreshIceCreamActData(nActId, msgData)
end
end
function PlayerActivityData:RefreshSoldierActData(nActId, msgData)
if nil ~= self.tbAllActivity[nActId] then
self.tbAllActivity[nActId]:RefreshSoldierActData(nActId, msgData)
end
end
function PlayerActivityData:RefreshActivityLevelGameActData(nActId, msgData)
if nil ~= self.tbAllActivity[nActId] then
self.tbAllActivity[nActId]:RefreshActivityLevelGameActData(nActId, msgData)
@@ -0,0 +1,38 @@
local ActivityDataBase = require("GameCore.Data.DataClass.Activity.ActivityDataBase")
local SoldierActData = class("SoldierActData", ActivityDataBase)
local LocalData = require("GameCore.Data.LocalData")
local RedDotManager = require("GameCore.RedDot.RedDotManager")
function SoldierActData:Init()
self:InitData()
end
function SoldierActData:InitData()
self.bLevelNewKey = LocalData.GetPlayerLocalData("SoliderLevel_New")
if self.bLevelNewKey == nil then
self.bLevelNewKey = true
end
RedDotManager.SetValid(RedDotDefine.Solider_Level_New, nil, self.bLevelNewKey)
end
function SoldierActData:RefreshSoldierActData(nActId, msgData)
self:InitData()
self.nActId = nActId
PlayerData.SoldierData:SetCurGradeChallengeData(msgData.CurGradeChallengeId, msgData.Stage, msgData.NodeIndex)
PlayerData.SoldierData:SetHighestChallengeId(msgData.GradeChallengeId)
PlayerData.SoldierData:SetQuestDataList(msgData.Quests)
end
function SoldierActData:RefreshQuestData(questData)
PlayerData.SoldierData:SetQuestData(questData)
end
function SoldierActData:RefreshLevelNew()
self.bLevelNewKey = false
LocalData.SetPlayerLocalData("SoliderLevel_New", self.bLevelNewKey)
RedDotManager.SetValid(RedDotDefine.Solider_Level_New, nil, self.bLevelNewKey)
end
function SoldierActData:RefreshAllQuestData(callback)
local callFunc = function()
if callback ~= nil then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.activity_detail_req, {}, nil, callFunc)
end
return SoldierActData
@@ -0,0 +1,70 @@
local ActivityGroupDataBase = require("GameCore.Data.DataClass.Activity.ActivityGroupDataBase")
local Summer_10110Data = class("Summer_10110Data", ActivityGroupDataBase)
function Summer_10110Data:Init()
self.tbAllActivity = {}
self.nCGActivityId = 0
self.sCGPath = ""
self.bPlayedCG = false
self:ParseActivity()
end
function Summer_10110Data:ParseActivity()
if self.actGroupConfig == nil then
self.actGroupConfig = ConfigTable.GetData("ActivityGroup", self.nActGroupId)
end
if self.actGroupConfig == nil then
printError("ActivityGroup config not found for id: " .. tostring(self.nActGroupId))
return
end
local sJson = self.actGroupConfig.Enter
local tbJson = decodeJson(sJson)
if tbJson == nil then
printError("ActivityGroup Enter json is nil for id: " .. tostring(self.nActGroupId))
end
for _, activity in pairs(tbJson) do
local data = {
ActivityId = activity[1],
Index = activity[2],
PanelId = activity[3]
}
table.insert(self.tbAllActivity, data)
end
local sCgJson = self.actGroupConfig.CG
if sCgJson ~= nil then
local tbCGJson = decodeJson(sCgJson)
if tbCGJson and 2 <= #tbCGJson then
self.nCGActivityId = tonumber(tbCGJson[1])
self.sCGPath = tbCGJson[2]
end
end
end
function Summer_10110Data:GetActivityDataByIndex(nIndex)
for _, activity in pairs(self.tbAllActivity) do
if activity.Index == nIndex then
return activity
end
end
end
function Summer_10110Data:PlayCG()
self:SendMsg_CG_READ(self.nCGActivityId)
end
function Summer_10110Data:GetActivityGroupCGPlayed()
if self.bPlayedCG then
return true
end
return PlayerData.Activity:IsCGPlayed(self.nCGActivityId)
end
function Summer_10110Data:IsActivityInActivityGroup(nActivityId)
for _, activity in pairs(self.tbAllActivity) do
if activity.ActivityId == nActivityId then
return true, self.nActGroupId
end
end
return false
end
function Summer_10110Data:SendMsg_CG_READ(nActivityId)
local Callback = function()
self.bPlayedCG = true
end
HttpNetHandler.SendMsg(NetMsgId.Id.activity_cg_read_req, {nActivityId}, nil, Callback)
end
return Summer_10110Data
@@ -0,0 +1,61 @@
local ActivityGroupDataBase = require("GameCore.Data.DataClass.Activity.ActivityGroupDataBase")
local Summer_20103Data = class("Summer_20103Data", ActivityGroupDataBase)
function Summer_20103Data:Init()
self.tbAllActivity = {}
self.nCGActivityId = 0
self.sCGPath = ""
self.bPlayedCG = false
self:ParseActivity()
end
function Summer_20103Data:ParseActivity()
if self.actGroupConfig == nil then
self.actGroupConfig = ConfigTable.GetData("ActivityGroup", self.nActGroupId)
end
local sJson = self.actGroupConfig.Enter
local tbJson = decodeJson(sJson)
for _, activity in pairs(tbJson) do
local data = {
ActivityId = activity[1],
Index = activity[2],
PanelId = activity[3]
}
table.insert(self.tbAllActivity, data)
end
local sCgJson = self.actGroupConfig.CG
if sCgJson ~= nil then
local tbCGJson = decodeJson(sCgJson)
self.nCGActivityId = tonumber(tbCGJson[1])
self.sCGPath = tbCGJson[2]
end
end
function Summer_20103Data:GetActivityDataByIndex(nIndex)
for _, activity in pairs(self.tbAllActivity) do
if activity.Index == nIndex then
return activity
end
end
end
function Summer_20103Data:PlayCG()
self:SendMsg_CG_READ(self.nCGActivityId)
end
function Summer_20103Data:GetActivityGroupCGPlayed()
if self.bPlayedCG then
return true
end
return PlayerData.Activity:IsCGPlayed(self.nCGActivityId)
end
function Summer_20103Data:IsActivityInActivityGroup(nActivityId)
for _, activity in pairs(self.tbAllActivity) do
if activity.ActivityId == nActivityId then
return true, self.nActGroupId
end
end
return false
end
function Summer_20103Data:SendMsg_CG_READ(nActivityId)
local Callback = function()
self.bPlayedCG = true
end
HttpNetHandler.SendMsg(NetMsgId.Id.activity_cg_read_req, {nActivityId}, nil, Callback)
end
return Summer_20103Data
@@ -165,7 +165,7 @@ function TrekkerVersusData:GetCurFanData()
end
function TrekkerVersusData:GetDuelHistory()
table.sort(self.tbDuelHistory, function(a, b)
return a.SelfHotValue > b.SelfHotValue
return a.RivalHotValue > b.RivalHotValue
end)
return self.tbDuelHistory
end
@@ -426,7 +426,7 @@ function TrekkerVersusData:RequestReceiveScheduleReward(nActId, nScheduleType)
end
if nScheduleType == 1 then
local foreachHeatQuest = function(mapQuestData)
if mapQuestData.TargetValue <= self.nSelfHotValue and table.indexof(self.tbHotValueRewardIds, mapQuestData.Id) <= 0 then
if mapQuestData.GroupId == self.nActId and mapQuestData.TargetValue <= self.nSelfHotValue and table.indexof(self.tbHotValueRewardIds, mapQuestData.Id) <= 0 then
table.insert(self.tbHotValueRewardIds, mapQuestData.Id)
end
end
@@ -564,7 +564,7 @@ function TrekkerVersusData:RefreshQusetRedDot()
end
local bHeatQuestVisible = false
local foreachHeatReward = function(mapData)
if mapData.TargetValue <= self.nSelfHotValue and table.indexof(self.tbHotValueRewardIds, mapData.Id) <= 0 then
if mapData.GroupId == self.nActId and mapData.TargetValue <= self.nSelfHotValue and table.indexof(self.tbHotValueRewardIds, mapData.Id) <= 0 then
bHeatQuestVisible = true
end
end
@@ -576,6 +576,14 @@ function TrekkerVersusData:RefreshQusetRedDot()
}, bHeatQuestVisible)
end
end
function TrekkerVersusData:GetCanReceiveAllQuestReward()
for _, mapQuest in pairs(self.mapQuests) do
if mapQuest.Status == 1 then
return true
end
end
return false
end
function TrekkerVersusData:GetFirstIn()
local bFirst = self.bFirstIn
if self.bFirstIn == true then
+18 -1
View File
@@ -12,6 +12,17 @@ local OnEvent_NewDay = function()
EventManager.Hit("UpdateDispatchData")
end
local OnEvent_SettingsNotificationClose = function()
if tbAllDispatchData == nil then
return
end
for k, v in pairs(tbAllDispatchData) do
if v.State == AllEnum.DispatchState.Accepting then
NotificationManager.UnregisterNotification(20000000, v.Data.Id)
end
if LocalSettingData.GetLocalSettingData("Dispatch") then
NotificationManager.RegisterNotification(20000000, v.Data.Id, v.Data.StartTime + v.Data.ProcessTime * 60)
end
end
end
local Init = function()
EventManager.Add(EventId.IsNewDay, DispatchData, OnEvent_NewDay)
@@ -24,10 +35,12 @@ local CacheDispatchData = function(data)
return
end
for k, v in pairs(data.Infos) do
NotificationManager.UnregisterNotification(20000000, v.Id)
local state = AllEnum.DispatchState.Accepting
if v.ProcessTime * 60 + v.StartTime <= CS.ClientManager.Instance.serverTimeStamp then
state = AllEnum.DispatchState.Complete
else
elseif LocalSettingData.GetLocalSettingData("Dispatch") then
NotificationManager.RegisterNotification(20000000, v.Id, v.StartTime + v.ProcessTime * 60)
end
tbAllDispatchData[v.Id] = {Data = v, State = state}
end
@@ -347,6 +360,9 @@ local ReqApplyAgent = function(agentList, agentData, callback)
if callback ~= nil then
callback()
end
if LocalSettingData.GetLocalSettingData("Dispatch") then
NotificationManager.RegisterNotification(20000000, v.Id, v.BeginTime + agentData[v.Id].ProcessTime * 60)
end
end
EventManager.Hit(EventId.DispatchRefreshPanel, AllEnum.DispatchState.Accepting)
bReqApplyAgent = false
@@ -376,6 +392,7 @@ local ReqGiveUpAgent = function(dispatchId, callback)
callback()
end
EventManager.Hit(EventId.DispatchRefreshPanel)
NotificationManager.UnregisterNotification(20000000, dispatchId)
end
HttpNetHandler.SendMsg(NetMsgId.Id.agent_give_up_req, mapData, nil, func_callback)
end
@@ -172,6 +172,7 @@ function PlayerBaseData:CacheEnergyInfo(mapData)
self._nEnergyTime = mapData.Energy.IsPrimary == true and mapData.Energy.NextDuration + nServerTime or 0
self._nEnergyBatteryTime = mapData.Energy.IsPrimary == true and 0 or mapData.Energy.NextDuration + nServerTime
self._nBuyEnergyCount = mapData.Count
NotificationManager.UnregisterNotification(10000000, 0)
if self._mapEnergyTimer ~= nil then
self._mapEnergyTimer:Cancel(nil)
end
@@ -183,6 +184,11 @@ function PlayerBaseData:CacheEnergyInfo(mapData)
else
self._mapEnergyTimer = TimerManager.Add(1, mapData.Energy.NextDuration, self, self.HandleEnergyTimer, true, true, false)
end
if LocalSettingData.GetLocalSettingData("Energy") and self._nCurEnergy < ConfigTable.GetConfigNumber("EnergyMaxLimit") then
local nEmptyEnergy = ConfigTable.GetConfigNumber("EnergyMaxLimit") - self._nCurEnergy - 1
local nTime = ConfigTable.GetConfigNumber("EnergyGain") * 60 * nEmptyEnergy + self._nEnergyTime
NotificationManager.RegisterNotification(10000000, 0, nTime)
end
end
end
function PlayerBaseData:CacheTitleInfo(mapData)
@@ -416,6 +422,12 @@ function PlayerBaseData:ChangeEnergy(mapData)
end
EventManager.Hit(EventId.UpdateEnergyBattery)
EventManager.Hit(EventId.UpdateEnergy)
NotificationManager.UnregisterNotification(10000000, 0)
if LocalSettingData.GetLocalSettingData("Energy") and self._nCurEnergy < ConfigTable.GetConfigNumber("EnergyMaxLimit") then
local nEmptyEnergy = ConfigTable.GetConfigNumber("EnergyMaxLimit") - self._nCurEnergy - 1
local nTime = ConfigTable.GetConfigNumber("EnergyGain") * 60 * nEmptyEnergy + self._nEnergyTime
NotificationManager.RegisterNotification(10000000, 0, nTime)
end
end
end
function PlayerBaseData:ChangeTitle(mapData)
@@ -1311,5 +1323,11 @@ function PlayerBaseData:OnCS2LuaEvent_AppFocus(bFocus)
end
end
function PlayerBaseData:OnEvent_SettingsNotificationClose()
NotificationManager.UnregisterNotification(10000000, 0)
if LocalSettingData.GetLocalSettingData("Energy") and self._nCurEnergy < ConfigTable.GetConfigNumber("EnergyMaxLimit") then
local nEmptyEnergy = ConfigTable.GetConfigNumber("EnergyMaxLimit") - self._nCurEnergy - 1
local nTime = ConfigTable.GetConfigNumber("EnergyGain") * 60 * nEmptyEnergy + self._nEnergyTime
NotificationManager.RegisterNotification(10000000, 0, nTime)
end
end
return PlayerBaseData
@@ -92,6 +92,21 @@ end
function PlayerFriendData:GetEnergyCount()
return self._nEnergyCount
end
function PlayerFriendData:CacheFriendAddStranger(mapFriend)
self.mapStrangerFriend = mapFriend
end
function PlayerFriendData:TryOpenFriendAddStranger()
if not self.mapStrangerFriend then
return
end
local mapFriend = clone(self.mapStrangerFriend)
self.mapStrangerFriend = nil
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
EventManager.Hit(EventId.OpenPanel, PanelId.FriendAddStranger, mapFriend)
end
cs_coroutine.start(wait)
end
function PlayerFriendData:JudgeEnergyGetAble()
if not self._tbFriendList then
return false
@@ -108,7 +123,7 @@ function PlayerFriendData:JudgeEnergySendAble()
return false
end
for _, v in pairs(self._tbFriendList) do
if v.bSendEnergy == false then
if not v.bSendEnergy then
return true
end
end
@@ -57,11 +57,13 @@ function PlayerHandbookData:UpdateHandbook(msgData)
local curResult = UTILS.IsBitSet(tbData, nIndex)
if lastResult ~= curResult and nil ~= self.tbHandbookCfgData[msgData.Type] then
local id = self.tbHandbookCfgData[msgData.Type][nIndex]
if nil == self.tbHandbookData[id] then
local handbookData = self:CreateHandbook(msgData.Type, id, 1)
self.tbHandbookData[id] = handbookData
else
self.tbHandbookData[id]:UpdateUnlockState(1)
if id ~= nil then
if nil == self.tbHandbookData[id] then
local handbookData = self:CreateHandbook(msgData.Type, id, 1)
self.tbHandbookData[id] = handbookData
else
self.tbHandbookData[id]:UpdateUnlockState(1)
end
end
end
end
@@ -880,6 +880,14 @@ function PlayerItemData:ProcessRewardChangeInfo(mapChangeInfo)
end
end
end
if type(mapDecodeInfo["proto.TraceHuntItem"]) == "table" then
for _, mapData in ipairs(mapDecodeInfo["proto.TraceHuntItem"]) do
local itemInfo = ConfigTable.GetData_Item(mapData.Tid)
if itemInfo and 0 < mapData.ConvertQty + mapData.GrantQty then
add_reward(mapData.Tid, mapData.ConvertQty + mapData.GrantQty)
end
end
end
for nId, nCount in pairs(tbRewardById) do
if nCount <= 0 then
tbRewardById[nId] = nil
@@ -4,6 +4,7 @@ function PlayerSideBannerData:Init()
self.tbDictionaryEntry = {}
self.tbAchievement = {}
self.tbFavour = {}
self.tbItem = {}
EventManager.Add("DispatchMsgDone", self, self.OnEvent_TryOpenSideBanner)
end
function PlayerSideBannerData:UnInit()
@@ -79,12 +80,24 @@ function PlayerSideBannerData:TryOpenSideBanner(bLimit)
})
end
end
if next(self.tbItem) ~= nil then
for _, v in ipairs(self.tbItem) do
table.insert(mapData, {
nType = AllEnum.SideBaner.Item,
mapReward = {
id = v.nId,
count = v.nCount
}
})
end
end
if next(mapData) == nil then
return
end
self.tbDictionaryEntry = {}
self.tbAchievement = {}
self.tbFavour = {}
self.tbItem = {}
EventManager.Hit("OpenSideBanner", mapData)
end
function PlayerSideBannerData:AddDictionaryEntry(nId)
@@ -96,4 +109,7 @@ end
function PlayerSideBannerData:AddFavour(nId)
table.insert(self.tbFavour, nId)
end
function PlayerSideBannerData:AddItem(nId, nCount)
table.insert(self.tbItem, {nId = nId, nCount = nCount})
end
return PlayerSideBannerData
@@ -31,6 +31,7 @@ function PlayerStateData:CacheStateData(mapMsgData)
PlayerData.ScoreBoss:UpdateRedDot(mapMsgData.ScoreBoss)
PlayerData.Activity:UpdateActivityState(mapMsgData.Activities)
PlayerData.StorySet:UpdateStorySetState(mapMsgData.StorySet)
PlayerData.TraceHunt:UpdateBossRewardRedDot(mapMsgData.TraceHunt.BossRewardCanReceive)
self.nVampireId = mapMsgData.VampireSurvivorId
else
self.bMailState = false
@@ -0,0 +1,869 @@
local PlayerTraceHuntData = class("PlayerTraceHuntData")
local ClientManager = CS.ClientManager.Instance
local TimerManager = require("GameCore.Timer.TimerManager")
function PlayerTraceHuntData:Init()
self.timerControl = nil
self.timerHelp = nil
self.timerHunt = nil
self.bRefreshHelpCD = false
self.tbRecommend = {}
self.bNewControl = false
self.bHuntWarning = true
self.nMaxStar = 0
self.nControlId = 0
self.nBossId = 0
self.nTraceProgress = 0
self.nHuntProgress = 0
self.nBossCreateTime = 0
self.nSelfBossHuntCount = 0
self.tbTraceLog = {}
self.tbHuntLog = {}
self.tbBossCollection = {}
self.nLevel = 0
self.nExp = 0
self.mapHuntPermit = {
nEnergyOverflow = 0,
nConvertedCount = 0,
nGrantedCount = 0,
nDailyCount = 0
}
self.mapTraceRequest = {
nEnergyOverflow = 0,
nConvertedCount = 0,
nGrantedCount = 0,
nDailyCount = 0
}
self.nBuildId = 0
EventManager.Add(EventId.IsNewDay, self, self.OnEvent_NewDay)
self:ProcessTableData()
end
function PlayerTraceHuntData:ProcessTableData()
self.tbTraceHuntStar = {}
local func_ForEach_Star = function(mapData)
self.tbTraceHuntStar[mapData.Star] = mapData.ScoreNeed
end
ForEachTableLine(DataTable.TraceHuntStar, func_ForEach_Star)
self.tbHuntExtraCost = {}
local func_ForEach_ExtraCost = function(mapData)
self.tbHuntExtraCost[mapData.Times] = {
Tid = mapData.ExtraCost1Tid,
Qty = mapData.ExtraCost1Qty
}
end
ForEachTableLine(DataTable.TraceHuntSelfHuntExtraCost, func_ForEach_ExtraCost)
self:ProcessTableData_Level()
self:ProcessTableData_Config()
self:ProcessTableData_Log()
end
function PlayerTraceHuntData:ProcessTableData_Config()
self.nHuntPermitTid = ConfigTable.GetConfigNumber("TraceHuntPermitItemTid")
self.nTraceRequestTid = ConfigTable.GetConfigNumber("TraceHuntRequestItemTid")
self.tbPieceNeedTraceProgress = ConfigTable.GetConfigNumberArray("TraceHuntPieceNeedTraceProgress")
self.nBossHuntLimitTime = ConfigTable.GetConfigNumber("TraceHuntBossHuntLimitTime")
self.nRefreshHelpCD = ConfigTable.GetConfigNumber("TraceHuntRefreshHelpCD")
self.nMaxTraceProgress = ConfigTable.GetConfigNumber("TraceHuntMaxTraceProgress")
self.nMaxHuntProgress = ConfigTable.GetConfigNumber("TraceHuntMaxHuntProgress")
end
function PlayerTraceHuntData:ProcessTableData_Log()
self.mapLogTemplate = {}
local func_ForEach_Log = function(mapData)
if mapData.Type == GameEnum.TraceHuntLogType.TraceStart then
self.mapLogTemplate[GameEnum.TraceHuntLogType.TraceStart] = mapData.Id
elseif mapData.Type == GameEnum.TraceHuntLogType.TraceEnd then
self.mapLogTemplate[GameEnum.TraceHuntLogType.TraceEnd] = mapData.Id
elseif mapData.Type == GameEnum.TraceHuntLogType.TraceRestart then
self.mapLogTemplate[GameEnum.TraceHuntLogType.TraceRestart] = mapData.Id
elseif mapData.Type == GameEnum.TraceHuntLogType.HuntBeforeStart then
self.mapLogTemplate[GameEnum.TraceHuntLogType.HuntBeforeStart] = mapData.Id
elseif mapData.Type == GameEnum.TraceHuntLogType.HuntStart then
self.mapLogTemplate[GameEnum.TraceHuntLogType.HuntStart] = mapData.Id
elseif mapData.Type == GameEnum.TraceHuntLogType.HuntInterrupt then
self.mapLogTemplate[GameEnum.TraceHuntLogType.HuntInterrupt] = mapData.Id
elseif mapData.Type == GameEnum.TraceHuntLogType.HuntEnd then
self.mapLogTemplate[GameEnum.TraceHuntLogType.HuntEnd] = mapData.Id
elseif mapData.Type == GameEnum.TraceHuntLogType.Settlement then
self.mapLogTemplate[GameEnum.TraceHuntLogType.Settlement] = mapData.Id
end
end
ForEachTableLine(DataTable.TraceHuntLogEntryTemplate, func_ForEach_Log)
end
function PlayerTraceHuntData:ProcessTableData_Level()
self.tbTraceHuntLevel = {}
self.nMaxTraceHuntLevel = 0
local func_ForEach_Level = function(mapData)
self.tbTraceHuntLevel[mapData.Level] = {
Exp = mapData.Exp,
WorldClass = mapData.WorldClass,
MaxStar = mapData.MaxStar,
Level = mapData.Level,
DisplayMaxStar = mapData.DisplayMaxStar,
DisplayTokenRate = mapData.DisplayTokenRate,
DisplayLuckyRate = mapData.DisplayLuckyRate,
DisplayAddRate = mapData.DisplayAddRate,
DisplayFreeRate = mapData.DisplayFreeRate,
DisplayWorldClass = 0
}
if mapData.Level > self.nMaxTraceHuntLevel then
self.nMaxTraceHuntLevel = mapData.Level
end
end
ForEachTableLine(DataTable.TraceHuntLevel, func_ForEach_Level)
for i = 1, self.nMaxTraceHuntLevel do
local mapCurLevel = self.tbTraceHuntLevel[i]
local mapNextLevel = self.tbTraceHuntLevel[i + 1]
if mapNextLevel and mapNextLevel.WorldClass > mapCurLevel.WorldClass and self.tbTraceHuntLevel[i + 2] then
self.tbTraceHuntLevel[i + 2].DisplayWorldClass = mapNextLevel.WorldClass
end
end
end
function PlayerTraceHuntData:UnInit()
EventManager.Remove(EventId.IsNewDay, self, self.OnEvent_NewDay)
end
function PlayerTraceHuntData:OnEvent_NewDay()
self.mapHuntPermit.nDailyCount = 0
self.mapTraceRequest.nDailyCount = 0
end
function PlayerTraceHuntData:CacheItemInfo(mapHuntPermit, mapTraceRequest)
self.mapHuntPermit = {
nEnergyOverflow = mapHuntPermit.EnergyOverflow,
nConvertedCount = mapHuntPermit.ConvertedCount,
nGrantedCount = mapHuntPermit.GrantedCount,
nDailyCount = mapHuntPermit.DailyCount
}
self.mapTraceRequest = {
nEnergyOverflow = mapTraceRequest.EnergyOverflow,
nConvertedCount = mapTraceRequest.ConvertedCount,
nGrantedCount = mapTraceRequest.GrantedCount,
nDailyCount = mapTraceRequest.DailyCount
}
self:UpdateItemRedDot()
end
function PlayerTraceHuntData:ChangeItem(tbTraceHuntItem)
if tbTraceHuntItem == nil then
return
end
for _, mapTraceHuntItem in ipairs(tbTraceHuntItem) do
self:ChangeTraceHuntItem(mapTraceHuntItem)
end
self:UpdateItemRedDot()
EventManager.Hit("TraceHuntItemChange")
end
function PlayerTraceHuntData:ChangeItemNotify(mapTraceHuntItem)
if mapTraceHuntItem == nil then
return
end
self:ChangeTraceHuntItem(mapTraceHuntItem)
if mapTraceHuntItem.ConvertQty > 0 then
PlayerData.SideBanner:AddItem(mapTraceHuntItem.Tid, mapTraceHuntItem.ConvertQty)
end
self:UpdateItemRedDot()
EventManager.Hit("TraceHuntItemChange")
end
function PlayerTraceHuntData:ChangeTraceHuntItem(mapTraceHuntItem)
if mapTraceHuntItem.Tid == self.nHuntPermitTid then
self.mapHuntPermit.nEnergyOverflow = self.mapHuntPermit.nEnergyOverflow + mapTraceHuntItem.PointQty
self.mapHuntPermit.nConvertedCount = self.mapHuntPermit.nConvertedCount + mapTraceHuntItem.ConvertQty
self.mapHuntPermit.nGrantedCount = self.mapHuntPermit.nGrantedCount + mapTraceHuntItem.GrantQty
self.mapHuntPermit.nDailyCount = self.mapHuntPermit.nDailyCount + mapTraceHuntItem.DailyCount
elseif mapTraceHuntItem.Tid == self.nTraceRequestTid then
self.mapTraceRequest.nEnergyOverflow = self.mapTraceRequest.nEnergyOverflow + mapTraceHuntItem.PointQty
self.mapTraceRequest.nConvertedCount = self.mapTraceRequest.nConvertedCount + mapTraceHuntItem.ConvertQty
self.mapTraceRequest.nGrantedCount = self.mapTraceRequest.nGrantedCount + mapTraceHuntItem.GrantQty
self.mapTraceRequest.nDailyCount = self.mapTraceRequest.nDailyCount + mapTraceHuntItem.DailyCount
end
end
function PlayerTraceHuntData:CacheTraceHuntInfo(mapTraceHuntInfo)
self.nControlId = mapTraceHuntInfo.ControlID
self.nBossId = mapTraceHuntInfo.BossID
self.nTraceProgress = mapTraceHuntInfo.TraceProgress
self.nHuntProgress = mapTraceHuntInfo.HuntProgress
self.nBossCreateTime = mapTraceHuntInfo.BossCreateTime
if self.nBossCreateTime ~= 0 then
self:SetHuntTimer()
end
self.nSelfBossHuntCount = mapTraceHuntInfo.SelfHuntTimes
self.tbTraceLog = {}
self:AddTraceLog(mapTraceHuntInfo.TraceLog)
self.tbHuntLog = {}
self:AddHuntLog(mapTraceHuntInfo.HuntLog)
self.tbBossCollection = {}
for _, v in ipairs(mapTraceHuntInfo.BossCollections) do
self:UpdateBossCollection(v.Id, v.HuntCount, v.AssistHuntCount)
end
self:UpdateControlData()
self:UpdateLevel(mapTraceHuntInfo.Level, mapTraceHuntInfo.Exp)
self:SetSelBuildId(mapTraceHuntInfo.BuildID)
self:UpdateBossRewardRedDot(self.nHuntProgress >= self.nMaxHuntProgress)
if NovaAPI.IsEditorPlatform() then
printLog("TraceHunt 赛季id" .. " " .. mapTraceHuntInfo.ControlID)
printLog("TraceHunt Boss id" .. " " .. mapTraceHuntInfo.BossID)
printLog("TraceHunt 追踪进度:" .. " " .. mapTraceHuntInfo.TraceProgress)
printLog("TraceHunt 讨伐进度:" .. " " .. mapTraceHuntInfo.HuntProgress)
printLog("TraceHunt boss 创建时间:" .. " " .. mapTraceHuntInfo.BossCreateTime)
printLog("TraceHunt boss 自己讨伐的次数:" .. " " .. mapTraceHuntInfo.SelfHuntTimes)
end
end
function PlayerTraceHuntData:UpdateControlData()
if self.nControlId == 0 then
return
end
local mapCfg = ConfigTable.GetData("TraceHuntControl", self.nControlId)
if not mapCfg then
return
end
self.nEndTime = ClientManager:ISO8601StrToTimeStamp(mapCfg.EndTime)
self.nStartTime = ClientManager:ISO8601StrToTimeStamp(mapCfg.StartTime)
self.tbBossList = mapCfg.BossList
self.tbStarDropCount = mapCfg.StarDropCount
self:SetControlTimer()
end
function PlayerTraceHuntData:UpdateBossCollection(nId, nCompleteHuntCount, nAssistHuntCount)
if not self.tbBossCollection[nId] then
self.tbBossCollection[nId] = {
nId = nId,
nCompleteHuntCount = 0,
nAssistHuntCount = 0
}
end
self.tbBossCollection[nId].nCompleteHuntCount = self.tbBossCollection[nId].nCompleteHuntCount + nCompleteHuntCount
self.tbBossCollection[nId].nAssistHuntCount = self.tbBossCollection[nId].nAssistHuntCount + nAssistHuntCount
end
function PlayerTraceHuntData:UpdateLevel(nLevel, nExp)
self.nLevel = nLevel
self.nExp = nExp
local mapCfg = self.tbTraceHuntLevel[nLevel]
self.nMaxStar = mapCfg.MaxStar
end
function PlayerTraceHuntData:SetNewControl(bNew)
self.bNewControl = bNew
end
function PlayerTraceHuntData:GetNewControl()
return self.bNewControl
end
function PlayerTraceHuntData:GetAddExp(nLevel1, nExp1, nLevel2, nExp2)
if nLevel1 == nLevel2 then
return nExp2 - nExp1
elseif nLevel1 < nLevel2 then
local nAll = 0
for i = nLevel1, nLevel2 - 1 do
nAll = nAll + self.tbTraceHuntLevel[i].Exp
end
nAll = nAll + nExp2 - nExp1
return nAll
else
return 0
end
end
function PlayerTraceHuntData:GetCurControlId()
return self.nControlId
end
function PlayerTraceHuntData:GetHuntWarning()
return self.bHuntWarning
end
function PlayerTraceHuntData:SetHuntWarning(bAble)
self.bHuntWarning = bAble
end
function PlayerTraceHuntData:GetEndTime()
return self.nEndTime or 0
end
function PlayerTraceHuntData:GetStartTime()
return self.nStartTime or 0
end
function PlayerTraceHuntData:GetControlLeftTime()
if not self.nEndTime then
return 0
end
local nLeft = self.nEndTime - ClientManager.serverTimeStamp
if nLeft < 0 then
nLeft = 0
end
return nLeft
end
function PlayerTraceHuntData:GetHuntLeftTime()
if self.nBossCreateTime == 0 then
return 0
end
if self.nHuntProgress >= self.nMaxHuntProgress then
return 0
end
local nLeft = self.nBossCreateTime + self.nBossHuntLimitTime - ClientManager.serverTimeStamp
if nLeft < 0 then
nLeft = 0
end
return nLeft
end
function PlayerTraceHuntData:GetBossCreateTime()
return self.nBossCreateTime
end
function PlayerTraceHuntData:ClearCurBoss()
self.nBossId = 0
self.nTraceProgress = 0
self.nHuntProgress = 0
self.nBossCreateTime = 0
self.nSelfBossHuntCount = 0
self.tbTraceLog = {}
self.tbHuntLog = {}
end
function PlayerTraceHuntData:GetTraceHuntLevel()
return self.nLevel, self.nExp
end
function PlayerTraceHuntData:GetTraceHuntLevelData(nLevel)
return self.tbTraceHuntLevel[nLevel]
end
function PlayerTraceHuntData:GetTraceHuntMaxLevel()
return self.nMaxTraceHuntLevel
end
function PlayerTraceHuntData:GetBossId()
return self.nBossId
end
function PlayerTraceHuntData:CheckMaxTrace()
return self.nTraceProgress >= self.nMaxTraceProgress
end
function PlayerTraceHuntData:GetMaxStar()
return self.nMaxStar
end
function PlayerTraceHuntData:GetTraceProgress()
return self.nTraceProgress / self.nMaxTraceProgress * 100
end
function PlayerTraceHuntData:GetHuntProgress()
return self.nHuntProgress / self.nMaxHuntProgress * 100
end
function PlayerTraceHuntData:GetHuntRecommend()
return self.tbRecommend
end
function PlayerTraceHuntData:GetSelfHuntCount()
return self.nSelfBossHuntCount
end
function PlayerTraceHuntData:GetStarScore(nStar)
return self.tbTraceHuntStar[nStar] or 0
end
function PlayerTraceHuntData:GetHuntCostCount(bSelf)
if self.nControlId == 0 then
return 0
end
local mapCfg = ConfigTable.GetData("TraceHuntControl", self.nControlId)
if not mapCfg then
return 0
end
if bSelf then
local nNext = self.nSelfBossHuntCount
local nMax = #self.tbHuntExtraCost
if nNext >= nMax then
nNext = nMax
end
if nNext == 0 then
return mapCfg.SelfHuntCost1Qty
else
return mapCfg.SelfHuntCost1Qty + self.tbHuntExtraCost[nNext].Qty
end
else
return mapCfg.OtherHuntCost1Qty
end
end
function PlayerTraceHuntData:GetTraceCostCount()
if self.nControlId == 0 then
return 0
end
local mapCfg = ConfigTable.GetData("TraceHuntControl", self.nControlId)
if not mapCfg then
return 0
end
return mapCfg.TraceCost1Qty
end
function PlayerTraceHuntData:GetHuntRewardRange()
if self.nControlId == 0 then
return 0, 0
end
local mapCfg = ConfigTable.GetData("TraceHuntControl", self.nControlId)
if not mapCfg then
return 0, 0
end
local tbCount = mapCfg.StarDropCount
local nMin = tbCount[1]
local nMax = 0
for nStar, v in ipairs(tbCount) do
if nStar <= self.nMaxStar then
nMax = v
end
end
return nMin, nMax
end
function PlayerTraceHuntData:GetHuntTokenCount()
return self.mapHuntPermit.nConvertedCount + self.mapHuntPermit.nGrantedCount
end
function PlayerTraceHuntData:GetTraceTokenCount()
return self.mapTraceRequest.nConvertedCount + self.mapTraceRequest.nGrantedCount
end
function PlayerTraceHuntData:GetHuntTokenDailyCount()
return self.mapHuntPermit.nDailyCount
end
function PlayerTraceHuntData:GetTraceTokenDailyCount()
return self.mapTraceRequest.nDailyCount
end
function PlayerTraceHuntData:AddTraceLog(tbLog, bAdd)
if next(tbLog) == nil then
return
end
if next(self.tbTraceLog) == nil then
table.insert(self.tbTraceLog, {
nId = self.mapLogTemplate[GameEnum.TraceHuntLogType.TraceStart],
tbArgs = {},
nType = GameEnum.TraceHuntLogType.TraceStart
})
end
for _, v in ipairs(tbLog) do
local mapCfg = ConfigTable.GetData("TraceHuntLogEntryTemplate", v.Tid)
if mapCfg then
table.insert(self.tbTraceLog, {
nId = v.Tid,
tbArgs = v.args,
nType = mapCfg.Type
})
if mapCfg.Type == GameEnum.TraceHuntLogType.TraceBeforeEnd then
table.insert(self.tbTraceLog, {
nId = self.mapLogTemplate[GameEnum.TraceHuntLogType.TraceEnd],
tbArgs = {},
nType = GameEnum.TraceHuntLogType.TraceEnd
})
elseif mapCfg.Type == GameEnum.TraceHuntLogType.TraceInterrupt then
table.insert(self.tbTraceLog, {
nId = self.mapLogTemplate[GameEnum.TraceHuntLogType.TraceRestart],
tbArgs = {},
nType = GameEnum.TraceHuntLogType.TraceRestart
})
end
end
if bAdd and mapCfg and mapCfg.Type == GameEnum.TraceHuntLogType.Tracing then
self.nTraceProgress = self.nTraceProgress + tonumber(v.args[1])
if self.nTraceProgress >= self.nMaxTraceProgress then
self.nTraceProgress = self.nMaxTraceProgress
end
end
end
end
function PlayerTraceHuntData:GetTraceLog()
return clone(self.tbTraceLog)
end
function PlayerTraceHuntData:AddHuntLog(tbLog, bAdd)
if next(tbLog) == nil then
return
end
if next(self.tbHuntLog) == nil then
table.insert(self.tbHuntLog, {
nId = self.mapLogTemplate[GameEnum.TraceHuntLogType.HuntBeforeStart],
tbArgs = {},
nType = GameEnum.TraceHuntLogType.HuntBeforeStart
})
table.insert(self.tbHuntLog, {
nId = self.mapLogTemplate[GameEnum.TraceHuntLogType.HuntStart],
tbArgs = {},
nType = GameEnum.TraceHuntLogType.HuntStart
})
end
for _, v in ipairs(tbLog) do
local mapCfg = ConfigTable.GetData("TraceHuntLogEntryTemplate", v.Tid)
if mapCfg then
table.insert(self.tbHuntLog, {
nId = v.Tid,
tbArgs = v.args,
nType = mapCfg.Type
})
if mapCfg.Type == GameEnum.TraceHuntLogType.HuntPlayerFatal or mapCfg.Type == GameEnum.TraceHuntLogType.HuntNPCFatal then
table.insert(self.tbHuntLog, {
nId = self.mapLogTemplate[GameEnum.TraceHuntLogType.HuntEnd],
tbArgs = {},
nType = GameEnum.TraceHuntLogType.HuntEnd
})
end
end
if bAdd and mapCfg and (mapCfg.Type == GameEnum.TraceHuntLogType.HuntPlayer or mapCfg.Type == GameEnum.TraceHuntLogType.HuntNPC) then
local nIndex = 1
if mapCfg.Type == GameEnum.TraceHuntLogType.HuntPlayer then
nIndex = 2
elseif mapCfg.Type == GameEnum.TraceHuntLogType.HuntNPC then
nIndex = 1
end
self.nHuntProgress = self.nHuntProgress + tonumber(v.args[nIndex])
if self.nHuntProgress >= self.nMaxHuntProgress then
self.nHuntProgress = self.nMaxHuntProgress
end
end
end
if self:CheckHuntInterrupt() then
self:AddHuntLog_HuntInterrupt()
end
end
function PlayerTraceHuntData:AddHuntLog_HuntInterrupt()
local bHas = false
for _, v in ipairs(self.tbHuntLog) do
if v.nType == GameEnum.TraceHuntLogType.HuntInterrupt then
bHas = true
break
end
end
if bHas then
return
end
table.insert(self.tbHuntLog, {
nId = self.mapLogTemplate[GameEnum.TraceHuntLogType.HuntInterrupt],
tbArgs = {},
nType = GameEnum.TraceHuntLogType.HuntInterrupt
})
table.insert(self.tbHuntLog, {
nId = self.mapLogTemplate[GameEnum.TraceHuntLogType.HuntEnd],
tbArgs = {},
nType = GameEnum.TraceHuntLogType.HuntEnd
})
end
function PlayerTraceHuntData:AddHuntLog_Settlement(nExp)
table.insert(self.tbHuntLog, {
nId = self.mapLogTemplate[GameEnum.TraceHuntLogType.Settlement],
tbArgs = {nExp},
nType = GameEnum.TraceHuntLogType.Settlement
})
end
function PlayerTraceHuntData:CheckHuntInterrupt()
return self.nHuntProgress < self.nMaxHuntProgress and self.nBossCreateTime ~= 0 and 0 >= self:GetHuntLeftTime()
end
function PlayerTraceHuntData:CheckHuntComplete()
return self.nHuntProgress >= self.nMaxHuntProgress
end
function PlayerTraceHuntData:GetHuntLog()
return clone(self.tbHuntLog)
end
function PlayerTraceHuntData:GetBossCollection()
return self.tbBossCollection, self.tbBossList or {}
end
function PlayerTraceHuntData:GetStarDropCount()
return self.tbStarDropCount or {}
end
function PlayerTraceHuntData:SetControlTimer()
if self.timerControl ~= nil then
self.timerControl:Cancel(false)
self.timerControl = nil
end
local nLeft = self:GetControlLeftTime()
if 0 < nLeft then
self.timerControl = TimerManager.Add(1, nLeft, self, function()
local callback = function()
EventManager.Hit("TraceHuntNewControl")
end
self:SendTraceHuntInfoReq(callback)
end, true, true, false)
end
end
function PlayerTraceHuntData:SetHuntTimer()
if self.timerHunt ~= nil then
self.timerHunt:Cancel(false)
self.timerHunt = nil
end
local nLeft = self:GetHuntLeftTime()
if 0 < nLeft then
self.timerHunt = TimerManager.Add(1, nLeft, self, function()
if self:CheckHuntInterrupt() then
self:AddHuntLog_HuntInterrupt()
EventManager.Hit("TraceHuntCurBossExpired")
end
end, true, true, false)
end
end
function PlayerTraceHuntData:SetHelpTimer()
if self.timerHelp ~= nil then
self.timerHelp:Cancel(false)
self.timerHelp = nil
end
self.timerHelp = TimerManager.Add(1, self.nRefreshHelpCD, self, function()
self.bRefreshHelpCD = false
end, true, true, false)
end
function PlayerTraceHuntData:SendTraceHuntInfoReq(callback)
local successCallback = function(_, mapMainData)
self:CacheTraceHuntInfo(mapMainData)
if callback then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.trace_hunt_info_req, {}, nil, successCallback)
end
function PlayerTraceHuntData:SendTraceHuntApplyReq(nOwnerUID, nBossID, nBuildId, nBossCreateTime, mapFriend)
local msgData = {
OwnerUID = nOwnerUID,
BossID = nBossID,
BuildID = nBuildId,
BossCreateTime = nBossCreateTime
}
local successCallback = function(_, mapMainData)
self.CurHPLvScore = 0
self.HPLvScore = 0
self.CurHPDamage = 0
self.bSelfBoss = PlayerData.Base._nPlayerId == nOwnerUID
self:EnterTraceHunt(nBossID, nBuildId)
PlayerData.Friend:CacheFriendAddStranger(mapFriend)
end
HttpNetHandler.SendMsg(NetMsgId.Id.trace_hunt_apply_req, msgData, nil, successCallback)
end
function PlayerTraceHuntData:SendTraceHuntSettleReq(nBossId, callback)
local nStar = self:ScoreToStar()
local nScore = self:GetTotalScore()
local msgData = {
Score = nScore,
Star = nStar,
Events = {
List = PlayerData.Achievement:GetBattleAchievement(GameEnum.levelType.TraceHunt, true)
}
}
CS.AdventureModuleHelper.PauseLogic()
local successCallback = function(_, mapMainData)
local nExp = 0
local bUpgrade = false
local nBeforeMaxStar = self:GetMaxStar()
if 1 <= nStar then
nExp = self:GetAddExp(self.nLevel, self.nExp, mapMainData.Level, mapMainData.Exp)
bUpgrade = mapMainData.Level > self.nLevel
self:UpdateLevel(mapMainData.Level, mapMainData.Exp)
if self.bSelfBoss then
self.tbHuntLog = {}
self.nHuntProgress = 0
self:AddHuntLog(mapMainData.HuntLog, true)
self.nSelfBossHuntCount = mapMainData.SelfHuntTimes
if mapMainData.BossCreateTime ~= 0 then
self.nBossCreateTime = mapMainData.BossCreateTime
self:SetHuntTimer()
end
self:UpdateBossRewardRedDot(self.nHuntProgress >= self.nMaxHuntProgress)
else
self:UpdateBossCollection(nBossId, 0, 1)
self.bRefreshHelpCD = false
end
end
CS.AdventureModuleHelper.ResumeLogic()
EventManager.Hit("TraceHuntSettleSuccess", self.entryLevelId, nStar, nExp, self.bSelfBoss, mapMainData.ChangeInfo or {}, bUpgrade, nBeforeMaxStar)
self:LevelEnd()
if callback then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.trace_hunt_settle_req, msgData, nil, successCallback)
end
function PlayerTraceHuntData:ReceiveTraceHuntSettleFailed()
local nStar = 0
local nExp = 0
local bUpgrade = false
local nBeforeMaxStar = self:GetMaxStar()
CS.AdventureModuleHelper.ResumeLogic()
EventManager.Hit("TraceHuntSettleSuccess", self.entryLevelId, nStar, nExp, self.bSelfBoss, {}, bUpgrade, nBeforeMaxStar)
self:LevelEnd()
end
function PlayerTraceHuntData:SendTraceHuntRecommendReq(callback)
if self.bRefreshHelpCD then
if callback then
callback()
end
return
end
local successCallback = function(_, mapMainData)
self.bRefreshHelpCD = true
self:SetHelpTimer()
self.tbRecommend = {}
for _, v in ipairs(mapMainData.Recommendations) do
local mapData = {
nUID = v.OwnerUID,
nBossId = v.BossID,
nBossCreateTime = v.BossCreateTime,
bFriend = v.IsFriend,
bStar = v.IsStar,
mapFriend = {}
}
PlayerData.Friend:ParseFriendData(mapData.mapFriend, v.Info)
table.insert(self.tbRecommend, mapData)
table.sort(self.tbRecommend, function(a, b)
if a.bStar ~= b.bStar then
return a.bStar and not b.bStar
elseif a.bFriend ~= b.bFriend then
return a.bFriend and not b.bFriend
else
return a.nBossCreateTime < b.nBossCreateTime
end
end)
end
if callback then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.trace_hunt_recommend_req, {}, nil, successCallback)
end
function PlayerTraceHuntData:SendTraceHuntRewardReceiveReq(callback)
if self.nBossId == 0 then
return
end
local bComplete = PlayerData.TraceHunt:CheckHuntComplete()
local bInterrupt = PlayerData.TraceHunt:CheckHuntInterrupt()
if not bComplete and not bInterrupt then
return
end
local successCallback = function(_, mapMainData)
local mapBeforeLevel = {
nLevel = self.nLevel,
nExp = self.nExp,
nMaxLevel = self.nMaxTraceHuntLevel,
nMaxExp = self.tbTraceHuntLevel[self.nLevel].Exp
}
local mapAfterLevel = {
nLevel = mapMainData.Level,
nExp = mapMainData.Exp,
nMaxLevel = self.nMaxTraceHuntLevel,
nMaxExp = self.tbTraceHuntLevel[mapMainData.Level].Exp
}
self:UpdateBossRewardRedDot(false)
self:UpdateBossCollection(self.nBossId, 1, 0)
local nExp = self:GetAddExp(self.nLevel, self.nExp, mapMainData.Level, mapMainData.Exp)
self:UpdateLevel(mapMainData.Level, mapMainData.Exp)
self:AddHuntLog_Settlement(nExp)
if callback then
callback(mapBeforeLevel, mapAfterLevel, mapMainData.ChangeInfo)
end
self:ClearCurBoss()
end
HttpNetHandler.SendMsg(NetMsgId.Id.trace_hunt_boss_reward_receive_req, {}, nil, successCallback)
end
function PlayerTraceHuntData:SendTraceHuntTraceReq(nCount, callback)
local msgData = {Value = nCount}
local successCallback = function(_, mapMainData)
self:AddTraceLog(mapMainData.TraceLog, true)
if mapMainData.BossID ~= 0 then
self.nBossId = mapMainData.BossID
end
if callback then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.trace_hunt_trace_req, msgData, nil, successCallback)
end
function PlayerTraceHuntData:UpdateBossRewardRedDot(bAble)
RedDotManager.SetValid(RedDotDefine.TraceHunt_Reward_Boss, nil, bAble)
self:UpdateItemEntranceRedDot()
end
function PlayerTraceHuntData:UpdateItemRedDot()
self:UpdateHuntItemRedDot()
self:UpdateTraceItemRedDot()
self:UpdateItemEntranceRedDot()
end
function PlayerTraceHuntData:UpdateHuntItemRedDot()
local tbMax = ConfigTable.GetConfigNumberArray("TraceHuntPermitItem")
local nHasCoin = self:GetHuntTokenCount()
local bAble = nHasCoin >= tbMax[3]
RedDotManager.SetValid(RedDotDefine.TraceHunt_HuntItem, nil, bAble)
end
function PlayerTraceHuntData:UpdateTraceItemRedDot()
local tbMax = ConfigTable.GetConfigNumberArray("TraceHuntRequestItem")
local nHasCoin = self:GetTraceTokenCount()
local bAble = nHasCoin >= tbMax[3]
RedDotManager.SetValid(RedDotDefine.TraceHunt_TraceItem, nil, bAble)
end
function PlayerTraceHuntData:UpdateItemEntranceRedDot()
local bReward = RedDotManager.GetValid(RedDotDefine.TraceHunt_Reward_Boss)
local bHuntMax = RedDotManager.GetValid(RedDotDefine.TraceHunt_HuntItem)
local bTraceMax = RedDotManager.GetValid(RedDotDefine.TraceHunt_TraceItem)
RedDotManager.SetValid(RedDotDefine.TraceHunt_Item, nil, not bReward and (bHuntMax or bTraceMax))
end
function PlayerTraceHuntData:EnterTraceHunt(nLevelId, nBuildId)
self.entryLevelId = nLevelId
self.entryBuild = nBuildId
if self.curLevel == nil then
local luaClass = require("Game.Adventure.TraceHunt.TraceHuntLevel")
if luaClass == nil then
return
end
self.curLevel = luaClass
end
if type(self.curLevel.BindEvent) == "function" and not self.isGoAgain then
self.curLevel:BindEvent()
end
if type(self.curLevel.Init) == "function" then
self.curLevel:Init(self, nLevelId, nBuildId, self.isGoAgain)
end
self.isGoAgain = false
end
function PlayerTraceHuntData:LevelEnd()
if nil ~= self.curLevel and type(self.curLevel.UnBindEvent) == "function" then
self.curLevel:UnBindEvent()
end
self.curLevel = nil
end
function PlayerTraceHuntData:SetSelBuildId(nBuildId)
self.nCachedBuildId = nBuildId
end
function PlayerTraceHuntData:GetCachedBuild()
return self.nCachedBuildId or 0
end
function PlayerTraceHuntData:DamageToScore(damageValue, SwitchRate, battleLv)
self.CurHPDamage = damageValue
self.CurHPLvScore = math.floor(damageValue / SwitchRate)
EventManager.Hit("TraceHunt_Score_Change")
self:CheckMaxStar()
end
function PlayerTraceHuntData:HPLevelChanged()
self.HPLvScore = self.HPLvScore + self.CurHPLvScore
self.CurHPLvScore = 0
self.CurHPDamage = 0
EventManager.Hit("TraceHunt_Score_Change")
self:CheckMaxStar()
end
function PlayerTraceHuntData:CheckMaxStar()
local nStar = self:ScoreToStar()
if nStar >= self.nMaxStar then
NovaAPI.DispatchEventWithData("TraceHunt_MaxStar")
EventManager.Hit("TraceHunt_MaxStar")
end
end
function PlayerTraceHuntData:GetTotalScore()
local totalScore = self.HPLvScore + self.CurHPLvScore
return totalScore
end
function PlayerTraceHuntData:ScoreToStar()
local tmpStar = 0
local totalScore = self.HPLvScore + self.CurHPLvScore
for i, v in pairs(self.tbTraceHuntStar) do
if v <= totalScore and i > tmpStar then
tmpStar = i
end
end
if tmpStar >= self.nMaxStar then
tmpStar = self.nMaxStar
end
return tmpStar
end
function PlayerTraceHuntData:QuiteLevel()
self:LevelEnd()
local wait = function()
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
coroutine.yield(CS.UnityEngine.WaitForEndOfFrame())
CS.WwiseAudioManager.Instance:PostEvent("ui_loading_combatSFX_mute", nil, false)
end
cs_coroutine.start(wait)
CS.AdventureModuleHelper.ResumeLogic()
local function levelEndCallback()
EventManager.Remove("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
NovaAPI.EnterModule("MainMenuModuleScene", true)
end
EventManager.Add("ADVENTURE_LEVEL_UNLOAD_COMPLETE", self, levelEndCallback)
CS.AdventureModuleHelper.LevelStateChanged(true, 0, true)
end
function PlayerTraceHuntData:SendEnterLvAgain()
if self.curLevel ~= nil then
self.curLevel.isCanPause = false
end
self.isGoAgain = true
CS.AdventureModuleHelper.LevelStateChanged(false)
EventManager.Hit("BattleRestart")
end
function PlayerTraceHuntData:EntryLvAgain()
if self.isGoAgain then
self.CurHPLvScore = 0
self.HPLvScore = 0
self.CurHPDamage = 0
EventManager.Hit("TraceHunt_Restart_Again")
self:EnterTraceHunt(self.entryLevelId, self.entryBuild)
end
end
return PlayerTraceHuntData
@@ -339,7 +339,7 @@ function PlayerVoiceData:PlayBoardClickVoice()
end
end
end
function PlayerVoiceData:PlayBoardNPCClickVoice(nNpcId, nSkinId)
function PlayerVoiceData:PlayBoardNPCClickVoice(nNpcId, nSkinId, sClickVoiceKey)
self.bNpc = true
self.nNpcId = nNpcId
self.nNPCSkinId = nSkinId or 0
@@ -354,7 +354,11 @@ function PlayerVoiceData:PlayBoardNPCClickVoice(nNpcId, nSkinId)
table.insert(tbVoiceKey, "hfc_npc")
self:ResetBoardClickTimer()
else
table.insert(tbVoiceKey, "posterchat_npc")
local sKey = "posterchat_npc"
if sClickVoiceKey then
sKey = sClickVoiceKey
end
table.insert(tbVoiceKey, sKey)
end
self:PlayCharVoice(tbVoiceKey, curBoardCharId, self.nNPCSkinId, true)
end
@@ -0,0 +1,431 @@
local PlayerSoldierData = class("PlayerSoldierData")
local PlayerSoldierQuestData = require("GameCore.Data.DataClass.Soldier.PlayerSoldierQuestData")
local PlayerSoldierRecommendData = require("GameCore.Data.DataClass.Soldier.PlayerSoldierRecommendData")
function PlayerSoldierData:Init()
self.questData = PlayerSoldierQuestData.new()
self.recommendData = PlayerSoldierRecommendData.new()
self.questData:InitData()
self.recommendData:InitData()
self.nHighestChallengeId = 0
self.curChallengeData = {
nGradeChallengeId = 0,
nStage = 0,
nNodeIndex = 0
}
self.curLevel = nil
self:InitConfig()
end
function PlayerSoldierData:UnInit()
if self.curLevel ~= nil then
self.curLevel:Exit()
self.curLevel = nil
end
end
function PlayerSoldierData:InitConfig()
local func_ForEach_SoldierPartner = function(mapLine)
CacheTable.SetField("_SoldierPartner", mapLine.PartnerType, mapLine.Level, mapLine)
end
ForEachTableLine(ConfigTable.Get("SoldierPartner"), func_ForEach_SoldierPartner)
local func_ForEach_SoldierPositionEffect = function(mapLine)
CacheTable.SetField("_SoldierPositionEffect", mapLine.PositionType, mapLine.Index, mapLine)
end
ForEachTableLine(ConfigTable.Get("SoldierPositionEffect"), func_ForEach_SoldierPositionEffect)
local func_ForEach_SoldierPartnerGroup = function(mapLine)
CacheTable.SetData("_SoldierPartnerGroup", mapLine.PartnerType, mapLine)
end
ForEachTableLine(ConfigTable.Get("SoldierPartnerGroup"), func_ForEach_SoldierPartnerGroup)
local _mapSoldierNodePlan = {}
local func_ForEach_SoldierNodePlan = function(mapLine)
if _mapSoldierNodePlan[mapLine.NodeGroupId] == nil then
_mapSoldierNodePlan[mapLine.NodeGroupId] = {}
end
table.insert(_mapSoldierNodePlan[mapLine.NodeGroupId], mapLine)
end
ForEachTableLine(ConfigTable.Get("SoldierNodePlan"), func_ForEach_SoldierNodePlan)
for nGroupId, list in pairs(_mapSoldierNodePlan) do
table.sort(list, function(a, b)
return a.Index < b.Index
end)
CacheTable.SetData("_SoldierNodePlan", nGroupId, list)
end
local func_ForEach_SoldierChessType = function(mapLine)
CacheTable.SetData("_SoldierChessType", mapLine.ChessType, mapLine)
end
ForEachTableLine(ConfigTable.Get("SoldierChessType"), func_ForEach_SoldierChessType)
end
function PlayerSoldierData:GetCurLevelData()
return self.curLevel
end
function PlayerSoldierData:CheckInSoldierLevel()
return self:GetCurGradeChallengeId() ~= 0
end
function PlayerSoldierData:EnterSoldier(nSeasonId, nGradeChallengeId, callback)
if self:GetCurGradeChallengeId() == 0 then
self:SendApply(nSeasonId, nGradeChallengeId, callback)
else
self:SendInfo(callback)
end
end
function PlayerSoldierData:SoldierLevelEnd(bClear)
if self.curLevel ~= nil then
self.curLevel:Exit()
self.curLevel = nil
end
if bClear then
self:SetCurGradeChallengeData(0, 0, 0)
self:ClearInSoldierRecommendData()
end
end
function PlayerSoldierData:SendApply(nSeasonId, nGradeChallengeId, callback)
local netCallback = function(_, netMsg)
self:SetCurGradeChallengeData(nGradeChallengeId, 0, 0)
self:ClearInSoldierRecommendData()
if self.curLevel == nil then
self.curLevel = require("Game.Adventure.Soldier.SoldierLevelData").new()
end
self.curLevel:Init(self, netMsg.Info, netMsg.Chess, netMsg.CoinQty)
if callback ~= nil then
callback()
end
end
local sendMsg = {SeasonId = nSeasonId, GradeChallengeId = nGradeChallengeId}
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_apply_req, sendMsg, nil, netCallback)
end
function PlayerSoldierData:SendInfo(callback)
local netCallback = function(_, netMsg)
if self.curLevel == nil then
self.curLevel = require("Game.Adventure.Soldier.SoldierLevelData").new()
end
self.curLevel:Init(self, netMsg)
if callback ~= nil then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_info_req, {}, nil, netCallback)
end
function PlayerSoldierData:SendStepOut(tbMain, tbSup, tbWaiting, callback)
local tbDeploy = {}
tbDeploy.Master = {}
tbDeploy.Assist = {}
tbDeploy.Waiting = {}
for _, v in ipairs(tbMain) do
table.insert(tbDeploy.Master, {
Id = v.nId,
Qty = 1,
Star = v.nStar
})
end
for _, v in ipairs(tbSup) do
table.insert(tbDeploy.Assist, {
Id = v.nId,
Qty = 1,
Star = v.nStar
})
end
for _, v in ipairs(tbWaiting) do
table.insert(tbDeploy.Waiting, {
Id = v.nId,
Qty = 1,
Star = v.nStar
})
end
local netCallback = function(_, netMsg)
if self.curLevel ~= nil then
self.curLevel:StepOut()
end
if callback ~= nil then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_step_out_req, {Deploy = tbDeploy}, nil, netCallback)
end
function PlayerSoldierData:SendGiveUp(callback)
local netCallback = function(_, netMsg)
self:SetCurGradeChallengeData(0, 0, 0)
self:ClearInSoldierRecommendData()
if self.curLevel ~= nil then
self.curLevel:GiveUp(netMsg)
else
local mapData = {
nTotalScore = netMsg.TotalScore,
nRewardScore = netMsg.RewardScore
}
EventManager.Hit(EventId.OpenPanel, PanelId.SoldierBattleResult, AllEnum.SoldierResultType.ChallengeFail, mapData)
end
if callback then
callback()
end
end
HttpNetHandler.SendMsg(NetMsgId.Id.soldier_give_up_req, {}, nil, netCallback)
end
function PlayerSoldierData:SetQuestDataList(questDataList)
if questDataList == nil then
return
end
self.questData:SetQuestDataList(questDataList)
end
function PlayerSoldierData:SetQuestData(questData)
if questData == nil then
return
end
self.questData:SetQuestData(questData)
end
function PlayerSoldierData:GetAllQuestData()
if self.questData == nil then
return {}
end
return self.questData:GetAllQuestData()
end
function PlayerSoldierData:GetQuestData()
if self.questData == nil then
return {}
end
return self.questData:GetAllQuestData()
end
function PlayerSoldierData:GetQuestDataByGroupId(nGroupId)
if self.questData == nil then
return {}
end
return self.questData:GetQuestDataListByGroupId(nGroupId)
end
function PlayerSoldierData:IsViewedGroupId(nGroupId)
if self.questData == nil then
return false
end
return self.questData:IsViewedGroupId(nGroupId)
end
function PlayerSoldierData:SetViewedGroupId(nGroupId)
if self.questData == nil then
return
end
self.questData:SetViewedGroupId(nGroupId)
end
function PlayerSoldierData:IsGroupLock(nGroupId)
if self.questData == nil then
return false
end
return self.questData:IsGroupLock(nGroupId)
end
function PlayerSoldierData:GetAllQuestCount()
if self.questData == nil then
return 0
end
return self.questData:GetAllQuestCount()
end
function PlayerSoldierData:GetAllReceivedCount()
if self.questData == nil then
return 0
end
return self.questData:GetAllReceivedCount()
end
function PlayerSoldierData:ReceiveQuestReward(nGroupId, nId, callback)
if self.questData == nil then
return
end
self.questData:ReceiveQuestReward(nGroupId, nId, callback)
end
function PlayerSoldierData:SetHighestChallengeId(nHighestChallengeId)
self.nHighestChallengeId = math.max(self.nHighestChallengeId, nHighestChallengeId)
end
function PlayerSoldierData:GetHighestChallengeId()
return self.nHighestChallengeId
end
function PlayerSoldierData:SetCurGradeChallengeData(nGradeChallengeId, nStage, nNodeIndex)
self.curChallengeData = {
nGradeChallengeId = nGradeChallengeId,
nStage = nStage,
nNodeIndex = nNodeIndex
}
end
function PlayerSoldierData:GetCurChallengeData()
return self.curChallengeData
end
function PlayerSoldierData:GetCurGradeChallengeId()
return self.curChallengeData.nGradeChallengeId
end
function PlayerSoldierData:CheckChallengeUnlocked(nGradeChallengeId)
local config = ConfigTable.GetData("SoldierGradeChallenge", nGradeChallengeId)
if config == nil then
return false
end
if config.UnlockGradeLevel == 0 then
return true
end
if self.nHighestChallengeId == 0 then
return false
end
local highestChallengeConfig = ConfigTable.GetData("SoldierGradeChallenge", self.nHighestChallengeId)
if highestChallengeConfig == nil then
return true
end
return config.UnlockGradeLevel <= highestChallengeConfig.Id
end
function PlayerSoldierData:SetRecommendData(nRecommendId, bInSoldier)
self.recommendData:SetRecommendData(nRecommendId, bInSoldier)
end
function PlayerSoldierData:GetRecommendData(bInSoldier)
return self.recommendData:GetRecommendData(bInSoldier)
end
function PlayerSoldierData:GetAllRecommendData()
return self.recommendData:GetAllRecommendData()
end
function PlayerSoldierData:GetSoldierPositionEffectDataId(nIndex)
return self.recommendData:GetSoldierPositionEffectDataId(nIndex)
end
function PlayerSoldierData:ClearInSoldierRecommendData()
self.recommendData:ClearInSoldierRecommendData()
end
function PlayerSoldierData:CheckChessRecommendState(nChessId)
return self.recommendData:CheckChessRecommendState(nChessId)
end
function PlayerSoldierData:CheckStarterCardRecommendState(nStarterCardId)
return self.recommendData:CheckStarterCardRecommendState(nStarterCardId)
end
function PlayerSoldierData:CheckStrategyCardRecommendState(nStrategyCardId)
return self.recommendData:CheckStrategyCardRecommendState(nStrategyCardId)
end
function PlayerSoldierData:CheckPartnerRecommendState(nPartnerType)
return self.recommendData:CheckPartnerRecommendState(nPartnerType)
end
function PlayerSoldierData:GetCurChallengeState()
if self.curChallengeData == nil then
return 0, 0
end
if self.curChallengeData.nGradeChallengeId == 0 then
return 0, 0
end
local curChallengeCfg = ConfigTable.GetData("SoldierGradeChallenge", self.curChallengeData.nGradeChallengeId)
if not curChallengeCfg then
return 0, 0
end
local tbAllNodeList = {}
local func_ForEach_SoldierNodePlan = function(mapLine)
if curChallengeCfg.NodeGroupId == mapLine.NodeGroupId then
table.insert(tbAllNodeList, mapLine)
end
end
ForEachTableLine(DataTable.SoldierNodePlan, func_ForEach_SoldierNodePlan)
table.sort(tbAllNodeList, function(a, b)
return a.Index < b.Index
end)
local nNodexIndex = self.curChallengeData.nNodeIndex
local nStage = self.curChallengeData.nStage
if nStage == 0 then
return 1, 1
end
for i = 1, #tbAllNodeList do
local nodeCfg = tbAllNodeList[i]
if nStage > nodeCfg.Stage then
nNodexIndex = nNodexIndex - 1
end
end
return nStage, nNodexIndex
end
function PlayerSoldierData:CheckGMSkipNodeRefreshAllowed()
if self.curLevel == nil then
printWarn("[Soldier] receive sd_soldier_info_notify, but curLevel is nil")
return false
end
if self.curLevel.curBattle ~= nil then
printWarn("[Soldier] sdSkipNode is ignored during soldier battle")
return false
end
if not PanelManager.CheckPanelOpen(PanelId.SoldierSandtable) then
printWarn("[Soldier] sdSkipNode is ignored outside soldier sandtable")
return false
end
local tbBlockPanels = {
PanelId.SoldierBattlePanel,
PanelId.SoldierBattleEventPanel,
PanelId.SoldierSelectPolicy,
PanelId.SoldierBattleResult
}
for _, nPanelId in ipairs(tbBlockPanels) do
if PanelManager.CheckPanelOpen(nPanelId) then
printWarn("[Soldier] sdSkipNode is ignored because soldier flow panel is open: " .. tostring(nPanelId))
return false
end
end
return true
end
function PlayerSoldierData:OnSoldierInfoNotify(mapSoldierInfo)
if mapSoldierInfo == nil or mapSoldierInfo.Meta == nil or mapSoldierInfo.Node == nil then
printWarn("[Soldier] receive invalid sd_soldier_info_notify")
return
end
if not self:CheckGMSkipNodeRefreshAllowed() then
return
end
EventManager.Hit(EventId.ClosePanel, PanelId.SoldierPartnerTips)
EventManager.Hit(EventId.ClosePanel, PanelId.SoldierCharCardTips)
EventManager.Hit(EventId.ClosePanel, PanelId.SoldierCharSkillDetail)
EventManager.Hit(EventId.ClosePanel, PanelId.SoldierCharPontentialDetailPanel)
EventManager.Hit(EventId.ClosePanel, PanelId.SoldierShopProbabilityPanel)
EventManager.Hit(EventId.ClosePanel, PanelId.SoldierSandtable)
self.curLevel:Exit()
self.curLevel = require("Game.Adventure.Soldier.SoldierLevelData").new()
self.curLevel:Init(self, mapSoldierInfo)
end
function PlayerSoldierData:OnBuffCardAddNotify(mapCardData)
if mapCardData == nil then
return
end
if self.curLevel == nil then
printWarn("[Soldier] receive buff card add notify, but curLevel is nil")
return
end
self.curLevel:UpdateCardList(mapCardData)
EventManager.Hit("SoldierBuffCardChange")
end
function PlayerSoldierData:OnItemChangeNotify(mapChangeInfo)
if mapChangeInfo == nil then
return
end
if self.curLevel == nil then
printWarn("[Soldier] receive item change notify, but curLevel is nil")
return
end
local tbChange = {}
self.curLevel:UpdateChangeInfo(mapChangeInfo, tbChange)
if tbChange.tbChessChangeStep ~= nil and #tbChange.tbChessChangeStep > 0 then
EventManager.Hit("SoldierGMRefresh", tbChange.tbChessChangeStep)
end
end
function PlayerSoldierData:OnSoldierEffectNotify(mapMsgData)
if mapMsgData == nil then
return
end
if self.curLevel == nil then
printWarn("[Soldier] receive soldier effect notify, but curLevel is nil")
return
end
self.curLevel:UpdateSoldierEffectNotify(mapMsgData)
end
function PlayerSoldierData:OnShopDataNotify(mapShopData)
if mapShopData == nil then
return
end
if self.curLevel == nil then
printWarn("[Soldier] receive shop data notify, but curLevel is nil")
return
end
self.curLevel:UpdateShopDataNotify(mapShopData)
end
function PlayerSoldierData:ApplyGMSoldierHp(nHp)
if nHp == nil then
return
end
if self.curLevel == nil then
printWarn("[Soldier] apply gm soldier hp, but curLevel is nil")
return
end
self.curLevel:UpdateGMSoldierHp(nHp)
end
function PlayerSoldierData:GMEnterSoldier(tbDeploy)
if self.curLevel == nil then
self.curLevel = require("Game.Adventure.Soldier.SoldierLevelData").new()
end
self.curLevel:Init(self)
self.curLevel:GMEnterBattle(tbDeploy)
end
return PlayerSoldierData
@@ -0,0 +1,161 @@
local PlayerSoldierQuestData = class("PlayerSoldierQuestData")
local ClientManager = CS.ClientManager.Instance
local LocalData = require("GameCore.Data.LocalData")
local RapidJson = require("rapidjson")
function PlayerSoldierQuestData:ctor()
end
function PlayerSoldierQuestData:InitData()
self.tbAllQuestData = {}
self.tbEnterQuestGroupId = nil
self:InitConfig()
end
function PlayerSoldierQuestData:InitConfig()
end
function PlayerSoldierQuestData:GetEnterQuestGroupId()
if self.tbEnterQuestGroupId ~= nil then
return self.tbEnterQuestGroupId
end
local sJson = LocalData.GetPlayerLocalData("SoldierQuestGroupId")
local tb = decodeJson(sJson)
if type(tb) == "table" then
self.tbEnterQuestGroupId = tb
end
return self.tbEnterQuestGroupId or {}
end
function PlayerSoldierQuestData:SetQuestDataList(questDataList)
for _, questData in ipairs(questDataList) do
self:SetQuestData(questData)
end
end
function PlayerSoldierQuestData:SetQuestData(questData)
local questConfig = ConfigTable.GetData("SoldierQuest", questData.Id)
if questConfig == nil then
return
end
if self:IsGroupLock(questConfig.Group) then
return
end
if self.tbAllQuestData[questConfig.Group] == nil then
self.tbAllQuestData[questConfig.Group] = {}
end
local nState = self:QuestStateServer2Client(questData.Status)
self.tbAllQuestData[questConfig.Group][questData.Id] = {
nId = questData.Id,
nStatus = nState,
Progress = questData.Progress
}
RedDotManager.SetValid(RedDotDefine.Solider_Quest, {
questConfig.Group,
questData.Id
}, nState == AllEnum.ActQuestStatus.Complete)
if not self:IsViewedGroupId(questConfig.Group) then
RedDotManager.SetValid(RedDotDefine.Solider_Quest_New_Group, questConfig.Group, true)
end
end
function PlayerSoldierQuestData:QuestStateServer2Client(nStatus)
if nStatus == 0 then
return AllEnum.ActQuestStatus.UnComplete
elseif nStatus == 1 then
return AllEnum.ActQuestStatus.Complete
else
return AllEnum.ActQuestStatus.Received
end
end
function PlayerSoldierQuestData:GetAllQuestData()
return self.tbAllQuestData
end
function PlayerSoldierQuestData:GetQuestData(nGroupId, nId)
return self.tbAllQuestData[nGroupId][nId]
end
function PlayerSoldierQuestData:GetQuestDataListByGroupId(nGroupId)
return self.tbAllQuestData[nGroupId]
end
function PlayerSoldierQuestData:IsViewedGroupId(nGroupId)
local tbEnterQuestGroupId = self:GetEnterQuestGroupId()
return table.indexof(tbEnterQuestGroupId, nGroupId) > 0
end
function PlayerSoldierQuestData:SetViewedGroupId(nGroupId)
local tbEnterQuestGroupId = self:GetEnterQuestGroupId()
if table.indexof(tbEnterQuestGroupId, nGroupId) > 0 then
return
else
table.insert(tbEnterQuestGroupId, nGroupId)
RedDotManager.SetValid(RedDotDefine.Solider_Quest_New_Group, nGroupId, false)
end
LocalData.SetPlayerLocalData("SoldierQuestGroupId", RapidJson.encode(tbEnterQuestGroupId))
end
function PlayerSoldierQuestData:IsGroupLock(nGroupId)
return self:GetGroupStartTime(nGroupId) > ClientManager.serverTimeStamp
end
function PlayerSoldierQuestData:GetGroupStartTime(nGroupId)
local groupConfig = ConfigTable.GetData("SoldierQuestGroup", nGroupId)
if groupConfig == nil then
return 0
end
if 0 >= groupConfig.OpenDay then
return 0
end
local actData = PlayerData.Activity:GetActivityDataByType(GameEnum.activityType.Soldier)
if actData == nil then
return 0
end
return groupConfig.OpenDay * 86400 + actData.nOpenTime
end
function PlayerSoldierQuestData:GetAllQuestCount()
local nCount = 0
for _, v in pairs(self.tbAllQuestData) do
for _, v2 in pairs(v) do
nCount = nCount + 1
end
end
return nCount
end
function PlayerSoldierQuestData:GetAllReceivedCount()
local nCount = 0
for _, v in pairs(self.tbAllQuestData) do
for _, v2 in pairs(v) do
if v2.nStatus == AllEnum.ActQuestStatus.Received then
nCount = nCount + 1
end
end
end
return nCount
end
function PlayerSoldierQuestData:ReceiveQuestReward(nGroupId, nId, callback)
local msgCallback = function(_, msgData)
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(msgData)
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
UTILS.OpenReceiveByChangeInfo(msgData)
if nId ~= 0 then
self.tbAllQuestData[nGroupId][nId].nStatus = AllEnum.ActQuestStatus.Received
self.tbAllQuestData[nGroupId][nId].Progress[1].Cur = 0
self.tbAllQuestData[nGroupId][nId].Progress[1].Max = 0
RedDotManager.SetValid(RedDotDefine.Solider_Quest, {nGroupId, nId}, false)
else
for _, v in pairs(self.tbAllQuestData[nGroupId]) do
if v.nStatus == AllEnum.ActQuestStatus.Complete then
v.nStatus = AllEnum.ActQuestStatus.Received
v.Progress[1].Cur = 0
v.Progress[1].Max = 0
RedDotManager.SetValid(RedDotDefine.Solider_Quest, {
nGroupId,
v.nId
}, false)
end
end
end
if callback ~= nil then
callback()
end
end
local actData = PlayerData.Activity:GetActivityDataByType(GameEnum.activityType.Soldier)
if actData == nil then
return
end
HttpNetHandler.SendMsg(NetMsgId.Id.activity_soldier_quest_reward_receive_req, {
ActivityId = actData.nActId,
GroupId = nGroupId,
QuestId = nId
}, nil, msgCallback)
end
return PlayerSoldierQuestData
@@ -0,0 +1,230 @@
local PlayerSoldierRecommendData = class("PlayerSoldierRecommendData")
local ClientManager = CS.ClientManager.Instance
local LocalData = require("GameCore.Data.LocalData")
local SoldierAttrData = require("GameCore.Data.DataClass.Soldier.SoldierAttrData")
function PlayerSoldierRecommendData:ctor()
end
function PlayerSoldierRecommendData:InitData()
self.nRecommendId = nil
self.nInSoldierRecommendId = nil
self.bInSoldierChanged = nil
self.tbAllRecommendData = {}
self:InitConfig()
self.tbSoldierPositionEffectData = {}
local func_ForEach_SoldierPositionEffect = function(mapLineData)
if mapLineData.PositionType == GameEnum.SoldierPositionType.FightPosition then
self.tbSoldierPositionEffectData[mapLineData.Index] = mapLineData.Id
end
end
ForEachTableLine(DataTable.SoldierPositionEffect, func_ForEach_SoldierPositionEffect)
end
function PlayerSoldierRecommendData:InitConfig()
local func_ForEach_Recommend = function(mapLineData)
local RecommendData = {
nRecommendId = mapLineData.Id,
nCharId = mapLineData.CharacterId,
charList = {},
nStarterCardId = mapLineData.StarterCard,
tbStrategyCardId = mapLineData.StrategyCard,
tbPartner = {}
}
for i = 1, 3 do
local charData = mapLineData["Front" .. i]
if charData ~= nil then
table.insert(RecommendData.charList, {
nId = charData[1],
nStar = charData[2],
nPositionType = 1,
nPosIndex = charData[4]
})
end
end
local backCharJson = mapLineData.Back
local tbBackCharList = {}
if backCharJson ~= nil then
local tbBackChar = decodeJson(backCharJson)
if type(tbBackChar) == "table" then
for charId, star in pairs(tbBackChar) do
table.insert(tbBackCharList, {
nId = tonumber(charId),
nStar = tonumber(star),
nPositionType = 2,
nPosIndex = 0
})
end
end
end
table.sort(tbBackCharList, function(a, b)
local aConfig = ConfigTable.GetData("SoldierCharacter", a.nId)
local bConfig = ConfigTable.GetData("SoldierCharacter", b.nId)
if aConfig.Rarity ~= bConfig.Rarity then
return aConfig.Rarity > bConfig.Rarity
end
return a.nId < b.nId
end)
for _, charData in ipairs(tbBackCharList) do
table.insert(RecommendData.charList, charData)
end
local tbPartnerAdd = decodeJson(mapLineData.PartnerAdd)
local mapExtraPartner = {}
for k, v in pairs(tbPartnerAdd) do
mapExtraPartner[tonumber(k)] = tonumber(v)
end
local tbExPartner = {}
for partnerId, addLevel in pairs(mapExtraPartner) do
local partnerCfg = ConfigTable.GetData("SoldierPartner", partnerId)
if partnerCfg then
tbExPartner[partnerCfg.PartnerType] = addLevel
end
end
local _, tbUIData = SoldierAttrData.CalcActivePartners(RecommendData.charList, tbExPartner)
RecommendData.tbPartner = tbUIData
self.tbAllRecommendData[mapLineData.Id] = RecommendData
end
ForEachTableLine(DataTable.SoldierRecommendBuilds, func_ForEach_Recommend)
end
function PlayerSoldierRecommendData:SetRecommendData(nRecommendId, bInSoldier)
if bInSoldier then
self.nInSoldierRecommendId = nRecommendId
self.bInSoldierChanged = true
else
self.nRecommendId = nRecommendId
end
EventManager.Hit("SoldierRecommend_Update")
self:SaveData()
end
function PlayerSoldierRecommendData:GetRecommendData(bInSoldier)
local nRecommendId = self:GetRecommendId()
local nInSoldierRecommendId = self:GetInSoldierRecommendId()
if bInSoldier then
if self:GetInSoldierChanged() then
if nInSoldierRecommendId == 0 then
return nil
end
return self.tbAllRecommendData[nInSoldierRecommendId]
else
if nRecommendId == 0 then
return nil
end
return self.tbAllRecommendData[nRecommendId]
end
else
if nRecommendId == 0 then
return nil
end
return self.tbAllRecommendData[nRecommendId]
end
end
function PlayerSoldierRecommendData:SaveData()
LocalData.SetPlayerLocalData("SoldierRecommend_Id", tostring(self.nRecommendId))
LocalData.SetPlayerLocalData("SoldierInSoldierRecommend_Id", tostring(self.nInSoldierRecommendId))
LocalData.SetPlayerLocalData("SoldierInSoldierChanged", self.bInSoldierChanged)
end
function PlayerSoldierRecommendData:GetSoldierPositionEffectDataId(nIndex)
return self.tbSoldierPositionEffectData[nIndex]
end
function PlayerSoldierRecommendData:GetAllRecommendData()
return self.tbAllRecommendData
end
function PlayerSoldierRecommendData:ClearInSoldierRecommendData()
self.nInSoldierRecommendId = 0
self.bInSoldierChanged = false
self:SaveData()
end
function PlayerSoldierRecommendData:CheckChessRecommendState(nChessId)
local nRecommendId = 0
if self:GetInSoldierRecommendId() == 0 then
nRecommendId = self:GetRecommendId()
else
nRecommendId = self:GetInSoldierRecommendId()
end
local recommendData = self.tbAllRecommendData[nRecommendId]
if recommendData == nil then
return false
end
for _, charData in ipairs(recommendData.charList) do
if charData.nId == nChessId then
return true
end
end
return false
end
function PlayerSoldierRecommendData:CheckStarterCardRecommendState(nStarterCardId)
local nRecommendId = 0
if self:GetInSoldierRecommendId() == 0 then
nRecommendId = self:GetRecommendId()
else
nRecommendId = self:GetInSoldierRecommendId()
end
local recommendData = self.tbAllRecommendData[nRecommendId]
if recommendData == nil then
return false
end
if recommendData.nStarterCardId == nStarterCardId then
return true
end
return false
end
function PlayerSoldierRecommendData:CheckStrategyCardRecommendState(nStrategyCardId)
local nRecommendId = 0
if self:GetInSoldierRecommendId() == 0 then
nRecommendId = self:GetRecommendId()
else
nRecommendId = self:GetInSoldierRecommendId()
end
local recommendData = self.tbAllRecommendData[nRecommendId]
if recommendData == nil then
return false
end
for _, strategyCardId in ipairs(recommendData.tbStrategyCardId) do
if strategyCardId == nStrategyCardId then
return true
end
end
return false
end
function PlayerSoldierRecommendData:CheckPartnerRecommendState(nPartnerType)
local nRecommendId = 0
if self:GetInSoldierRecommendId() == 0 then
nRecommendId = self:GetRecommendId()
else
nRecommendId = self:GetInSoldierRecommendId()
end
local recommendData = self.tbAllRecommendData[nRecommendId]
if recommendData == nil then
return false
end
if recommendData.tbPartner == nil then
return false
end
for _, partnerData in ipairs(recommendData.tbPartner) do
if partnerData.nType == nPartnerType then
return true
end
end
return false
end
function PlayerSoldierRecommendData:GetRecommendId()
if self.nRecommendId == nil then
local sJson = LocalData.GetPlayerLocalData("SoldierRecommend_Id") or "0"
local nRecommendId = tonumber(decodeJson(sJson)) or 0
self.nRecommendId = nRecommendId
end
return self.nRecommendId
end
function PlayerSoldierRecommendData:GetInSoldierRecommendId()
if self.nInSoldierRecommendId == nil then
local sJson = LocalData.GetPlayerLocalData("SoldierInSoldierRecommend_Id") or "0"
local nInSoldierRecommendId = tonumber(decodeJson(sJson)) or 0
self.nInSoldierRecommendId = nInSoldierRecommendId
end
return self.nInSoldierRecommendId
end
function PlayerSoldierRecommendData:GetInSoldierChanged()
if self.bInSoldierChanged == nil then
local sJson = LocalData.GetPlayerLocalData("SoldierInSoldierChanged")
self.bInSoldierChanged = sJson == true
end
return self.bInSoldierChanged
end
return PlayerSoldierRecommendData
@@ -0,0 +1,846 @@
local ConfigData = require("GameCore.Data.ConfigData")
local SoldierAttrData = {}
local SoldierAttachAttr = {
{
sKey = "Hp",
sLanguageId = "Attr_Hp_Simple"
},
{
sKey = "Atk",
sLanguageId = "Attr_Atk_Simple"
},
{
sKey = "Def",
sLanguageId = "Attr_Def_Simple"
},
{
sKey = "CritRate",
bPercent = true,
bIntFloat = true
},
{
sKey = "CritResistance",
bPercent = true
},
{
sKey = "CritPower",
bPercent = true,
bIntFloat = true
},
{sKey = "HitRate", bPercent = true},
{sKey = "Evd", bPercent = true},
{sKey = "DefPierce"},
{
sKey = "DefIgnore",
bPercent = true,
bIntFloat = true
},
{
sKey = "Suppress",
bPercent = true,
bIntFloat = true
},
{sKey = "Energy", bSoldier = true},
{
sKey = "InitialEnergy",
bSoldier = true
},
{sKey = "Recovery", bSoldier = true},
{
sKey = "ATKSPD_P",
bSoldier = true,
bPercent = true,
bIntFloat = true
}
}
local _showAttrKey = {
Hp = 1,
Energy = 2,
InitialEnergy = 3,
Atk = 4,
Def = 5,
Recovery = 6,
CritRate = 7,
CritPower = 8,
ATKSPD_P = 9
}
local _InitAttrMapSlots = function(map)
for _, v in pairs(SoldierAttachAttr) do
map[v.sKey] = 0
map["_" .. v.sKey] = 0
map["_" .. v.sKey .. "PercentAmend"] = 0
map["_" .. v.sKey .. "Amend"] = 0
end
end
local _ReadBaseFromConfig = function(map, nId, nStar)
local cfgChess = ConfigTable.GetData("SoldierCharacter", nId)
if cfgChess == nil then
printError("SoldierAttrData: SoldierCharacter not found, nId=" .. tostring(nId))
return nil, nil
end
local cfgAdjust = ConfigTable.GetData("MonsterValueTempleteAdjust", cfgChess.Templete)
if cfgAdjust == nil then
printError("SoldierAttrData: MonsterValueTempleteAdjust not found, Templete=" .. tostring(cfgChess.Templete))
return cfgChess, nil
end
local nTmplAttrId = UTILS.GetSoldierTempleteAttrId(cfgAdjust.TemplateId, nStar)
local cfgTmpl = ConfigTable.GetData("MonsterValueTemplete", nTmplAttrId)
if cfgTmpl == nil then
printError("SoldierAttrData: MonsterValueTemplete not found, id=" .. tostring(nTmplAttrId))
return cfgChess, cfgAdjust
end
for _, v in ipairs(SoldierAttachAttr) do
local mapCfg
if v.bSoldier == true then
mapCfg = cfgChess
else
mapCfg = cfgTmpl
end
map["_" .. v.sKey] = mapCfg and mapCfg[v.sKey] or 0
local nRatio, nFix = 0, 0
if cfgAdjust[v.sKey .. "Ratio"] ~= nil then
nRatio = cfgAdjust[v.sKey .. "Ratio"]
end
if cfgAdjust[v.sKey .. "Fix"] ~= nil then
nFix = cfgAdjust[v.sKey .. "Fix"]
end
map["_" .. v.sKey] = map["_" .. v.sKey] * (1 + nRatio * ConfigData.IntFloatPrecision) + nFix
end
end
local _Finalize = function(map)
for _, v in pairs(SoldierAttachAttr) do
map[v.sKey] = map["_" .. v.sKey] * (1 + map["_" .. v.sKey .. "PercentAmend"] / 100) + map["_" .. v.sKey .. "Amend"]
map[v.sKey] = math.floor(map[v.sKey])
end
end
local _FillAttrForUI = function(map)
local attrSortList = {}
local attrList = {}
for _, v in ipairs(SoldierAttachAttr) do
if _showAttrKey[v.sKey] ~= nil then
local nValue = map[v.sKey] or 0
nValue = v.bIntFloat and nValue * ConfigData.IntFloatPrecision or nValue
table.insert(attrSortList, {
sKey = v.sKey,
nValue = nValue,
sLanguageId = v.sLanguageId,
nIndex = _showAttrKey[v.sKey]
})
attrList[v.sKey] = {
nValue = nValue,
sLanguageId = v.sLanguageId
}
end
end
table.sort(attrSortList, function(a, b)
return a.nIndex < b.nIndex
end)
return attrSortList, attrList
end
local _FillAttrForBattle = function(map)
local stSoldier = CS.SoldierLevelController.SoldierAttr()
stSoldier.Energy = map.Energy
stSoldier.InitialEnergy = map.InitialEnergy
stSoldier.Recovery = map.Recovery
stSoldier.ATKSPD_P = map.ATKSPD_P
stSoldier.Hp = map.Hp
stSoldier.HpMax = map.HpMax or map.Hp
stSoldier.Atk = map.Atk
stSoldier.Def = map.Def
stSoldier.CritRate = map.CritRate
stSoldier.CritResistance = map.CritResistance
stSoldier.CritPower = map.CritPower
stSoldier.HitRate = map.HitRate
stSoldier.Evd = map.Evd
stSoldier.DefPierce = map.DefPierce
stSoldier.DefIgnore = map.DefIgnore
stSoldier.Suppress = map.Suppress
return stSoldier
end
local _BuildAttrMap = function(nId, nStar)
local map = {}
map.DataId = nId
_InitAttrMapSlots(map)
_ReadBaseFromConfig(map, nId, nStar)
return map
end
local _BuildBuffCtx = function(tbDeployed, tbActivePartner)
local ctx = {
tbDeployed = tbDeployed or {},
tbActivePartner = {},
nDeployedCount = 0,
nActivePartnerCount = 0,
tbPartnerTagAdd = {}
}
ctx.nDeployedCount = #ctx.tbDeployed
if tbActivePartner then
for _, nId in pairs(tbActivePartner) do
local mapPartnerCfg = ConfigTable.GetData("SoldierPartner", nId)
if mapPartnerCfg ~= nil then
local nType = mapPartnerCfg.PartnerType
local nLevel = mapPartnerCfg.Level
if nType and 0 < nType then
ctx.tbActivePartner[nType] = {
nLevel = nLevel or 1
}
ctx.nActivePartnerCount = ctx.nActivePartnerCount + 1
end
end
end
end
return ctx
end
local _GetTopXByBaseAttr = function(ctx, sAttrKey, nTopX, tbCandidates)
local tbResult, tbSorted = {}, {}
local _collect = function(idx, chess)
local nTempFinalValue = 0
if chess.mapAttr then
nTempFinalValue = chess.mapAttr["_" .. sAttrKey] * (1 + chess.mapAttr["_" .. sAttrKey .. "PercentAmend"] / 100) + chess.mapAttr["_" .. sAttrKey .. "Amend"]
end
table.insert(tbSorted, {nIdx = idx, nValue = nTempFinalValue})
end
if tbCandidates then
for idx in pairs(tbCandidates) do
local chess = ctx.tbDeployed[idx]
if chess then
_collect(idx, chess)
end
end
else
for idx, chess in ipairs(ctx.tbDeployed) do
_collect(idx, chess)
end
end
table.sort(tbSorted, function(a, b)
return a.nValue > b.nValue
end)
for i = 1, math.min(nTopX, #tbSorted) do
tbResult[tbSorted[i].nIdx] = true
end
return tbResult
end
local _tbCondDescriptors = {}
local _RegisterCondition = function(eCondType, descriptor)
_tbCondDescriptors[eCondType] = descriptor
end
local _FilterChessByConditions = function(ctx, tbInputSet, tbConds)
local tbCurrent = {}
if tbInputSet then
for idx in pairs(tbInputSet) do
tbCurrent[idx] = true
end
end
for _, cond in ipairs(tbConds or {}) do
local d = _tbCondDescriptors[cond.eType]
if d and d.fnFilter then
tbCurrent = d.fnFilter(ctx, tbCurrent, cond.tbParam) or {}
end
end
return tbCurrent
end
local _tbEffectDescriptors = {}
local _RegisterEffect = function(eEffectType, descriptor)
_tbEffectDescriptors[eEffectType] = descriptor
end
local _ApplyOneClientEffect = function(ctx, chess, idxChess, eEffectType, tbParam)
local d = _tbEffectDescriptors[eEffectType]
if d and d.fnApply then
d.fnApply(ctx, chess, idxChess, tbParam)
end
end
local _tbTargetDescriptors = {}
local _RegisterTarget = function(eTargetType, descriptor)
_tbTargetDescriptors[eTargetType] = descriptor
end
local _SelectTargets = function(ctx, eTargetType, tbCandidates, tbParam)
local d = _tbTargetDescriptors[eTargetType] or _tbTargetDescriptors[GameEnum.SoldierClientEffectTarget.None]
if not d or not d.fnSelect then
return tbCandidates
end
return d.fnSelect(ctx, tbCandidates, tbParam) or {}
end
local _CondFilter_None = function(ctx, tbCurrent, tbParam)
return tbCurrent
end
local _CondFilter_Partner = function(ctx, tbCurrent, tbParam)
local nTarget = tbParam and tonumber(tbParam[1]) or 0
if nTarget == 0 then
return {}
end
local tbResult = {}
for idx in pairs(tbCurrent) do
local chess = ctx.tbDeployed[idx]
if chess and chess.tbPartnerType and 0 < table.indexof(chess.tbPartnerType, nTarget) then
tbResult[idx] = true
end
end
return tbResult
end
local _CondFilter_PositionType = function(ctx, tbCurrent, tbParam)
local nPos = tbParam and tonumber(tbParam[1])
local tbResult = {}
for idx in pairs(tbCurrent) do
local chess = ctx.tbDeployed[idx]
if chess and chess.nPositionType == nPos then
tbResult[idx] = true
end
end
return tbResult
end
local _CondFilter_SoldierCount = function(ctx, tbCurrent, tbParam)
local nRequired = tbParam and tonumber(tbParam[1]) or 0
local nCount = 0
for _ in pairs(tbCurrent) do
nCount = nCount + 1
end
if nCount == nRequired then
return tbCurrent
end
return {}
end
local _CondFilter_SoldierLevel = function(ctx, tbCurrent, tbParam)
local nMinLevel = tbParam and tonumber(tbParam[1]) or 0
local tbResult = {}
for idx in pairs(tbCurrent) do
local chess = ctx.tbDeployed[idx]
if chess and nMinLevel <= (chess.nStar or 0) then
tbResult[idx] = true
end
end
return tbResult
end
local _CondFilter_SoldierAttr = function(ctx, tbCurrent, tbParam)
if not tbParam or #tbParam ~= 2 then
return {}
end
local nTopX = tonumber(tbParam[1])
local sKey = tbParam[2]
if not sKey or nTopX <= 0 then
return {}
end
return _GetTopXByBaseAttr(ctx, sKey, nTopX, tbCurrent)
end
local _CondFilter_SoldierId = function(ctx, tbCurrent, tbParam)
local nId = tbParam and tonumber(tbParam[1])
local tbResult = {}
for idx in pairs(tbCurrent) do
local chess = ctx.tbDeployed[idx]
if chess and chess.nId == nId then
tbResult[idx] = true
end
end
return tbResult
end
local _CondFilter_PartnerCount = function(ctx, tbCurrent, tbParam)
local nRequired = tbParam and tonumber(tbParam[1]) or 0
if ctx.nActivePartnerCount == nRequired then
return tbCurrent
end
return {}
end
_RegisterCondition(GameEnum.SoldierClientCond.None, {fnFilter = _CondFilter_None})
_RegisterCondition(GameEnum.SoldierClientCond.Partner, {fnFilter = _CondFilter_Partner})
_RegisterCondition(GameEnum.SoldierClientCond.PositionType, {fnFilter = _CondFilter_PositionType})
_RegisterCondition(GameEnum.SoldierClientCond.SoldierCount, {fnFilter = _CondFilter_SoldierCount})
_RegisterCondition(GameEnum.SoldierClientCond.SoldierLevel, {fnFilter = _CondFilter_SoldierLevel})
_RegisterCondition(GameEnum.SoldierClientCond.SoldierAttr, {fnFilter = _CondFilter_SoldierAttr})
_RegisterCondition(GameEnum.SoldierClientCond.SoldierId, {fnFilter = _CondFilter_SoldierId})
_RegisterCondition(GameEnum.SoldierClientCond.PartnerCount, {fnFilter = _CondFilter_PartnerCount})
local _ApplyAmendToChess = function(chess, sKey, nValue)
if not (chess and chess.mapAttr) or not sKey then
return
end
local sAmendKey = "_" .. sKey .. "Amend"
if chess.mapAttr[sAmendKey] == nil then
return
end
chess.mapAttr[sAmendKey] = chess.mapAttr[sAmendKey] + (nValue or 0)
end
local _ApplyPercentAmendToChess = function(chess, sKey, nValue)
if not (chess and chess.mapAttr) or not sKey then
return
end
local sPctKey = "_" .. sKey .. "PercentAmend"
if chess.mapAttr[sPctKey] == nil then
return
end
chess.mapAttr[sPctKey] = chess.mapAttr[sPctKey] + (nValue or 0)
end
local _EffectApply_None = function()
end
local _EffectApply_AmendAttr = function(ctx, chess, idxChess, tbParam)
if not tbParam or #tbParam ~= 2 then
return
end
_ApplyAmendToChess(chess, tbParam[1], tonumber(tbParam[2]) or 0)
end
local _EffectApply_PercentAmendAttr = function(ctx, chess, idxChess, tbParam)
if not tbParam or #tbParam ~= 2 then
return
end
_ApplyPercentAmendToChess(chess, tbParam[1], tonumber(tbParam[2]) or 0)
end
local _EffectApply_PartnerTag = function(ctx, chess, idxChess, tbParam)
local nType = tbParam and tbParam[1]
if not nType or nType == 0 then
return
end
ctx.tbPartnerTagAdd[idxChess] = ctx.tbPartnerTagAdd[idxChess] or {}
table.insert(ctx.tbPartnerTagAdd[idxChess], nType)
end
local _EffectApply_BattleAttrHalve = function(ctx, chess, idxChess, tbParam)
local sKey = tbParam and tbParam[1]
if not sKey then
return
end
ctx.tbBattleAttrHalve = ctx.tbBattleAttrHalve or {}
ctx.tbBattleAttrHalve[idxChess] = ctx.tbBattleAttrHalve[idxChess] or {}
table.insert(ctx.tbBattleAttrHalve[idxChess], sKey)
end
_RegisterEffect(GameEnum.SoldierClientEffect.None, {fnApply = _EffectApply_None})
_RegisterEffect(GameEnum.SoldierClientEffect.AmendAttr, {fnApply = _EffectApply_AmendAttr})
_RegisterEffect(GameEnum.SoldierClientEffect.PercentAmendAttr, {fnApply = _EffectApply_PercentAmendAttr})
_RegisterEffect(GameEnum.SoldierClientEffect.PartnerTag, {fnApply = _EffectApply_PartnerTag})
_RegisterEffect(GameEnum.SoldierClientEffect.BattleAttrHalve, {fnApply = _EffectApply_BattleAttrHalve})
local _TargetSelect_None = function(ctx, tbCandidates, tbParam)
return tbCandidates
end
local _TargetSelect_All = function(ctx, tbCandidates, tbParam)
if not tbCandidates or next(tbCandidates) == nil then
return {}
end
local tbResult = {}
for idx = 1, #ctx.tbDeployed do
tbResult[idx] = true
end
return tbResult
end
local _TargetSelect_Partner = function(ctx, tbCandidates, tbParam)
local nType = tbParam and tonumber(tbParam[1]) or 0
if nType == 0 then
return {}
end
local tbResult = {}
for idx, _ in pairs(tbCandidates) do
local chess = ctx.tbDeployed[idx]
if chess and chess.tbPartnerType and 0 < table.indexof(chess.tbPartnerType, nType) then
tbResult[idx] = true
end
end
return tbResult
end
local _TargetSelect_SoldierId = function(ctx, tbCandidates, tbParam)
local nId = tbParam and tonumber(tbParam[1]) or 0
if nId == 0 then
return {}
end
local tbResult = {}
for idx, _ in pairs(tbCandidates) do
local chess = ctx.tbDeployed[idx]
if chess and chess.nId == nId then
tbResult[idx] = true
end
end
return tbResult
end
_RegisterTarget(GameEnum.SoldierClientEffectTarget.None, {fnSelect = _TargetSelect_None})
_RegisterTarget(GameEnum.SoldierClientEffectTarget.All, {fnSelect = _TargetSelect_All})
_RegisterTarget(GameEnum.SoldierClientEffectTarget.Partner, {fnSelect = _TargetSelect_Partner})
_RegisterTarget(GameEnum.SoldierClientEffectTarget.SoldierId, {fnSelect = _TargetSelect_SoldierId})
local _ParseBuffConfig = function(cfgBuff)
if not cfgBuff then
return nil
end
local tbConds, tbEffects = {}, {}
for i = 1, 3 do
local eType = cfgBuff["Cond" .. i]
if eType and eType ~= 0 then
table.insert(tbConds, {
eType = eType,
tbParam = cfgBuff["CondParams" .. i] or {}
})
end
end
for i = 1, 3 do
local eType = cfgBuff["Effect" .. i]
if eType and eType ~= 0 then
table.insert(tbEffects, {
eType = eType,
tbParam = cfgBuff["EffectParams" .. i] or {}
})
end
end
local eTargetType = cfgBuff.TargetType or GameEnum.SoldierClientEffectTarget.None
local tbTargetParam = cfgBuff.TargetParam or {}
return {
tbConds = tbConds,
tbEffects = tbEffects,
eTargetType = eTargetType,
tbTargetParam = tbTargetParam
}
end
local _AddBuffIdToChess = function(chess, nBuffId)
chess.tbClientBuffIds = chess.tbClientBuffIds or {}
table.insert(chess.tbClientBuffIds, nBuffId)
end
local _DispatchBuff = function(ctx, nBuffId, buff, tbCandidates)
if not (buff and tbCandidates) or next(tbCandidates) == nil then
return
end
local tbTargets = _SelectTargets(ctx, buff.eTargetType, tbCandidates, buff.tbTargetParam)
if not tbTargets then
return
end
for idx, _ in pairs(tbTargets) do
local chess = ctx.tbDeployed[idx]
if chess then
_AddBuffIdToChess(chess, nBuffId)
end
end
end
local _AddPositionBuffs = function(ctx)
for idx, chess in ipairs(ctx.tbDeployed) do
if chess.nPositionType and chess.nIndex then
local tbPosEffect = CacheTable.GetData("_SoldierPositionEffect", chess.nPositionType)
local mapLine = tbPosEffect and tbPosEffect[chess.nIndex]
local nBuffId = mapLine and mapLine.KeyEffectId or 0
if nBuffId ~= 0 then
local buff = _ParseBuffConfig(ConfigTable.GetData("SoldierClientBuff", nBuffId))
if buff then
local tbInputSet = {
[idx] = true
}
local tbCandidates = _FilterChessByConditions(ctx, tbInputSet, buff.tbConds)
_DispatchBuff(ctx, nBuffId, buff, tbCandidates)
end
end
end
end
end
local _AddPartnerBuffs = function(ctx)
local tbItems = {}
for nType, info in pairs(ctx.tbActivePartner) do
local mapByLevel = CacheTable.GetData("_SoldierPartner", nType)
local cfgActive = mapByLevel and mapByLevel[info.nLevel or 1]
if cfgActive then
for _, nEffId in ipairs(cfgActive.ClientEffect) do
if nEffId and nEffId ~= 0 then
table.insert(tbItems, {
nId = nEffId,
nOrder = cfgActive.Order or 0
})
end
end
end
end
table.sort(tbItems, function(a, b)
return a.nOrder < b.nOrder
end)
local tbInputSet = {}
for i = 1, #ctx.tbDeployed do
tbInputSet[i] = true
end
for _, item in ipairs(tbItems) do
local buff = _ParseBuffConfig(ConfigTable.GetData("SoldierClientBuff", item.nId))
if buff then
local tbCandidates = _FilterChessByConditions(ctx, tbInputSet, buff.tbConds)
_DispatchBuff(ctx, item.nId, buff, tbCandidates)
end
end
end
local _ApplyAllBuffEffects = function(ctx)
for idx, chess in ipairs(ctx.tbDeployed) do
if chess.tbClientBuffIds then
for _, nBuffId in ipairs(chess.tbClientBuffIds) do
local buff = _ParseBuffConfig(ConfigTable.GetData("SoldierClientBuff", nBuffId))
if buff then
for _, eff in ipairs(buff.tbEffects) do
_ApplyOneClientEffect(ctx, chess, idx, eff.eType, eff.tbParam)
end
end
end
end
end
end
local _FinalizeAll = function(ctx)
for _, chess in ipairs(ctx.tbDeployed) do
if chess.mapAttr then
_Finalize(chess.mapAttr)
end
end
end
local _ApplyBattleAttrHalve = function(ctx)
if not ctx.tbBattleAttrHalve then
return
end
for idx, tbKeys in pairs(ctx.tbBattleAttrHalve) do
local chess = ctx.tbDeployed[idx]
if chess and chess.mapAttr then
for _, sKey in ipairs(tbKeys) do
if chess.mapAttr[sKey] ~= nil then
chess.mapAttr[sKey] = math.floor(chess.mapAttr[sKey] * 0.5)
end
end
end
end
end
local _AddServerBuffs = function(ctx, tbServerBuff)
if not tbServerBuff then
return
end
local tbInputSet = {}
for i = 1, #ctx.tbDeployed do
tbInputSet[i] = true
end
for _, nBuffId in ipairs(tbServerBuff) do
local buff = _ParseBuffConfig(ConfigTable.GetData("SoldierClientBuff", nBuffId))
if buff then
local tbCandidates = _FilterChessByConditions(ctx, tbInputSet, buff.tbConds)
_DispatchBuff(ctx, nBuffId, buff, tbCandidates)
end
end
end
local _CalcAllDeployedAttrs = function(tbCharacter, tbActivePartner, tbServerBuff, bIsForBattle)
if not tbCharacter then
return nil, nil
end
local tbDeployed = {}
for _, chess in ipairs(tbCharacter) do
if chess.nId and chess.nId ~= 0 then
table.insert(tbDeployed, chess)
end
end
for _, chess in ipairs(tbDeployed) do
chess.mapAttr = _BuildAttrMap(chess.nId, chess.nStar)
if chess.tbPartnerType == nil then
chess.tbPartnerType = SoldierAttrData.GetPartnerGroupsByChessId(chess.nId)
end
end
local ctx = _BuildBuffCtx(tbDeployed, tbActivePartner)
_AddPositionBuffs(ctx)
_AddServerBuffs(ctx, tbServerBuff)
_AddPartnerBuffs(ctx)
_ApplyAllBuffEffects(ctx)
_FinalizeAll(ctx)
if bIsForBattle then
for _, chess in ipairs(tbDeployed) do
if chess.mapAttr then
chess.mapAttr.HpMax = chess.mapAttr.Hp
end
end
_ApplyBattleAttrHalve(ctx)
end
return ctx, tbDeployed
end
local _FindChessAttr = function(tbDeployed, nId, nStar)
if not tbDeployed then
return nil
end
for _, chess in ipairs(tbDeployed) do
if chess.nId == nId and (nStar == nil or chess.nStar == nStar) then
return chess.mapAttr
end
end
return nil
end
function SoldierAttrData.CalcCharacterAttr(nId, nStar, tbCharacter, tbPartner, tbServerBuff)
if tbCharacter then
local _, tbDeployed = _CalcAllDeployedAttrs(clone(tbCharacter), tbPartner, tbServerBuff)
local map = _FindChessAttr(tbDeployed, nId, nStar)
if map then
_Finalize(map)
return _FillAttrForUI(map)
end
end
local map = _BuildAttrMap(nId, nStar)
if not map then
return nil
end
_Finalize(map)
return _FillAttrForUI(map)
end
function SoldierAttrData.CalcExtraPartnerTags(tbCharacter, tbPartner, tbServerBuff)
local mapResult = {}
if not tbCharacter then
return mapResult
end
local ctx, tbDeployed = _CalcAllDeployedAttrs(clone(tbCharacter), tbPartner, tbServerBuff)
if not ctx or not tbDeployed then
return mapResult
end
for idx, tbTypes in pairs(ctx.tbPartnerTagAdd or {}) do
local chess = tbDeployed[idx]
if chess and chess.nId and chess.nId ~= 0 and tbTypes and 0 < #tbTypes then
mapResult[chess.nId] = {
tbTypes = tbTypes,
nPositionType = chess.nPositionType,
nIndex = chess.nIndex
}
end
end
return mapResult
end
function SoldierAttrData.CalcAttrForBattle(tbCharacter, tbPartner, tbServerBuff)
local mapCharAttr = {}
if tbCharacter then
local _, tbDeployed = _CalcAllDeployedAttrs(clone(tbCharacter), tbPartner, tbServerBuff, true)
for _, chess in ipairs(tbDeployed) do
local map = _FindChessAttr(tbDeployed, chess.nId, chess.nStar)
if map then
mapCharAttr[chess.nId] = _FillAttrForBattle(map)
end
end
end
return mapCharAttr
end
function SoldierAttrData.GetPartnerGroupsByChessId(nId)
local mapCharacter = ConfigTable.GetData("SoldierCharacter", nId)
if mapCharacter ~= nil then
return mapCharacter.PartnerType
end
return {}
end
local _IsPartnerLevelActivated = function(nCount, nNum, eNumType)
if not nNum or nNum <= 0 then
return false
end
if eNumType == GameEnum.SoldierPartnerNumType.EQ then
return nCount == nNum
elseif eNumType == GameEnum.SoldierPartnerNumType.GE then
return nNum <= nCount
end
return false
end
function SoldierAttrData.CalcActivePartners(tbChess, tbExtraLevel, tbExtraCount)
local tbActivePartnerIds = {}
local tbUIData = {}
local mapTypeCount = {}
if tbChess then
for _, chess in ipairs(tbChess) do
if chess.nId and chess.nId ~= 0 then
local tbPartnerTypes = SoldierAttrData.GetPartnerGroupsByChessId(chess.nId)
if tbPartnerTypes then
for _, nType in ipairs(tbPartnerTypes) do
if nType and 0 < nType then
local nCount = 1
if mapTypeCount[nType] ~= nil then
nCount = mapTypeCount[nType].nCount + 1
end
mapTypeCount[nType] = {nCount = nCount}
end
end
end
end
end
end
if tbExtraCount == nil and tbExtraLevel == nil then
local curLevel = PlayerData.SoldierData:GetCurLevelData()
if curLevel ~= nil then
local tbServerPartner = curLevel:GetServerPartner()
if tbServerPartner ~= nil and next(tbServerPartner) ~= nil then
tbExtraCount = tbServerPartner
end
end
end
if tbExtraLevel then
for nType, nLevel in pairs(tbExtraLevel) do
if mapTypeCount[nType] ~= nil then
mapTypeCount[nType].nExtraLevel = nLevel
else
mapTypeCount[nType] = {nCount = 0, nExtraLevel = nLevel}
end
end
end
if tbExtraCount then
for nType, nCount in pairs(tbExtraCount) do
if mapTypeCount[nType] ~= nil then
mapTypeCount[nType].nExtraCount = nCount
else
mapTypeCount[nType] = {nCount = 0, nExtraCount = nCount}
end
end
end
for nType, data in pairs(mapTypeCount) do
local nExtraCount = data.nExtraCount or 0
local nCount = data.nCount + nExtraCount
local nExtraLevel = data.nExtraLevel or 0
local mapByLevel = CacheTable.GetData("_SoldierPartner", nType)
if mapByLevel then
local tbLevels = {}
for _, cfg in pairs(mapByLevel) do
table.insert(tbLevels, cfg)
end
table.sort(tbLevels, function(a, b)
return (a.Level or 0) < (b.Level or 0)
end)
local nMaxLevel = 0
if 0 < #tbLevels then
nMaxLevel = tbLevels[#tbLevels].Level or 0
end
local tbNumList = {}
local nActiveLevel = 0
local nActiveNum = 0
local nQuality = 0
for _, cfg in ipairs(tbLevels) do
table.insert(tbNumList, cfg.Num or 0)
if _IsPartnerLevelActivated(nCount, cfg.Num, cfg.SoldierPartnerNumType) and nActiveLevel < (cfg.Level or 0) then
nActiveLevel = cfg.Level or 0
nActiveNum = cfg.Num or 0
end
end
nActiveLevel = nActiveLevel + nExtraLevel
if 0 < nMaxLevel and nMaxLevel < nActiveLevel then
nActiveLevel = nMaxLevel
end
if 0 < nActiveLevel then
local cfg = mapByLevel[nActiveLevel]
if cfg and cfg.Id then
nQuality = cfg.PartnerLevelQuality
table.insert(tbActivePartnerIds, cfg.Id)
end
end
table.insert(tbUIData, {
nType = nType,
nQuality = nQuality,
nCurNum = nCount,
tbNumList = tbNumList,
nActiveNum = nActiveNum,
nActiveLevel = nActiveLevel
})
end
end
table.sort(tbUIData, function(a, b)
local nActA = a.nActiveLevel > 0 and 1 or 0
local nActB = b.nActiveLevel > 0 and 1 or 0
if nActA == nActB then
if a.nQuality == b.nQuality then
if a.nActiveNum == b.nActiveNum then
return a.nType < b.nType
end
return a.nActiveNum < b.nActiveNum
end
return a.nQuality > b.nQuality
end
return nActA > nActB
end)
return tbActivePartnerIds, tbUIData
end
function SoldierAttrData.GetPartnerLevelsByType(nPartnerType)
local tbPartnerLevel = {}
local tbPartner = CacheTable.GetData("_SoldierPartner", nPartnerType)
if tbPartner ~= nil then
for nLevel, mapCfg in pairs(tbPartner) do
local sDesc = mapCfg.Desc
table.insert(tbPartnerLevel, {
nLevel = nLevel,
sDesc = sDesc,
nConfigId = mapCfg.Id
})
end
end
table.sort(tbPartnerLevel, function(a, b)
return a.nLevel < b.nLevel
end)
return tbPartnerLevel
end
return SoldierAttrData
+1
View File
@@ -51,6 +51,7 @@ local LoadBattleData = function()
end
end
local LoadNotificationData = function()
LocalSettingData.mapData.Notification = LoadLocalData("NotificationFirst", true)
LocalSettingData.mapData.Energy = LoadLocalData("Energy", true)
LocalSettingData.mapData.Dispatch = LoadLocalData("Dispatch", true)
end
+10
View File
@@ -131,6 +131,9 @@ function PlayerData.Init()
local PlayerScoreBossData = require("GameCore.Data.DataClass.PlayerScoreBossData")
PlayerData.ScoreBoss = PlayerScoreBossData.new()
PlayerData.ScoreBoss:Init()
local PlayerTraceHuntData = require("GameCore.Data.DataClass.PlayerTraceHuntData")
PlayerData.TraceHunt = PlayerTraceHuntData.new()
PlayerData.TraceHunt:Init()
local GameAnnouncementData = require("GameCore.Data.DataClass.GameAnnouncementData")
PlayerData.AnnouncementData = GameAnnouncementData.new()
PlayerData.AnnouncementData:Init()
@@ -164,6 +167,9 @@ function PlayerData.Init()
local PotentialPreselection = require("GameCore.Data.DataClass.PlayerPotentialPreselectionData")
PlayerData.PotentialPreselection = PotentialPreselection.new()
PlayerData.PotentialPreselection:Init()
local SoldierData = require("GameCore.Data.DataClass.Soldier.PlayerSoldierData")
PlayerData.SoldierData = SoldierData.new()
PlayerData.SoldierData:Init()
local foreachEnumDesc = function(mapData)
CacheTable.SetField("_EnumDesc", mapData.EnumName, mapData.Value, mapData.Key)
end
@@ -224,6 +230,8 @@ function PlayerData.UnInit()
PlayerData.SideBanner = nil
PlayerData.ScoreBoss:UnInit()
PlayerData.ScoreBoss = nil
PlayerData.TraceHunt:UnInit()
PlayerData.TraceHunt = nil
PlayerData.AnnouncementData = nil
PlayerData.JointDrill_1:UnInit()
PlayerData.JointDrill_1 = nil
@@ -232,5 +240,7 @@ function PlayerData.UnInit()
PlayerData.Trial = nil
PlayerData.StorySet = nil
PlayerData.Story = nil
PlayerData.SoldierData:UnInit()
PlayerData.SoldierData = nil
end
return PlayerData
+7
View File
@@ -175,6 +175,13 @@ local EventId = {
SettingsBattleClose = 510,
CharTalentUIVisible = 511,
SettingsNotificationClose = 512,
SoldierStartBuffConfirm = 602,
SoldierCharCardClicked = 603,
SoldierRefreshAddBuff = 604,
SoldierApplyResp = 605,
SoldierInfoResp = 606,
SoldierInteractResp = 607,
SoldierGiveUpResp = 608,
GMToolShow = 998,
GMToolClose = 998.1,
GMToolClosePanel = 998.2,
@@ -8,56 +8,8 @@ local OnApplicationFocus = function(_, bFocus)
bAppSuspended = not bFocus
end
function NotificationManager.RegisterNotification(nId, nSubkey, nTime)
if not SDKManager:IsSDKInit() then
return
end
if not NovaAPI.IsMobilePlatform() then
return
end
local configData = ConfigTable.GetData("NotificationConfig", nId)
if configData == nil then
printLog("NotificationManager 注册推送失败,配置表数据不存在")
return
end
local setTime = nTime - 5000
if setTime <= CS.ClientManager.Instance.serverTimeStamp then
return
end
local data = {
id = nId,
key = nId + nSubkey,
time = nTime,
timer = TimerManager.Add(1, setTime - CS.ClientManager.Instance.serverTimeStamp, nil, function()
if not bAppSuspended then
printLog("NotificationManager 由计时器触发的取消推送成功,id:", tostring(nId + nSubkey))
UnregisterNotification(nId, nSubkey)
end
end, true, true, false, nil)
}
table.insert(tbNotification, data)
local sContent = configData.Content
sContent = string.gsub(sContent, "==PLAYER_NAME==", PlayerData.Base:GetPlayerNickName())
SDKManager:BuildLocalNotification(nId + nSubkey, configData.Title, sContent, nTime)
printLog("NotificationManager 注册推送成功,id:", tostring(nId + nSubkey), "title:", configData.Title, "content:", sContent, "time:", tostring(setTime))
end
function NotificationManager.UnregisterNotification(nId, nSubkey)
if not SDKManager:IsSDKInit() then
return
end
if not NovaAPI.IsMobilePlatform() then
return
end
local tbRemove = {}
for i, data in ipairs(tbNotification) do
if data.id == nId and data.key == nId + nSubkey then
data.timer:_Stop()
table.remove(tbNotification, i)
table.insert(tbRemove, nId + nSubkey)
break
end
end
SDKManager:DeleteLocalNotification(tbRemove)
printLog("NotificationManager 取消推送成功,id:", tostring(nId + nSubkey))
end
local function Uninit()
EventManager.Remove(EventId.CSLuaManagerShutdown, NotificationManager, Uninit)
+29 -2
View File
@@ -91,6 +91,7 @@ local player_data_succeed_ack = function(mapMsgData)
PlayerData.Dating:CacheDatingCharIds(mapMsgData.DatingCharIds)
PlayerData.VampireSurvivor:CacheLevelData(mapMsgData.VampireSurvivorRecord)
PlayerData.SkillInstance:CacheSkillInstanceLevel(mapMsgData.SkillInstances)
PlayerData.TraceHunt:CacheItemInfo(mapMsgData.HuntPermit, mapMsgData.TraceRequest)
NovaAPI.SetRetryCount()
PlayerData.Base:SetNextRefreshTime(mapMsgData.ServerTs)
PlayerData.Dispatch.CacheDispatchData(mapMsgData.Agent)
@@ -763,7 +764,7 @@ local activity_mining_supplement_reward_notify = function(mapMsgData)
EventManager.Hit("Mining_Supplement_Reward", mapMsgData)
end
local activity_mining_quest_reward_receive_succeed_ack = function(mapMsgData)
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(mapMsgData.ChangeInfo)
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(mapMsgData)
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
end
local activity_mining_story_reward_receive_succeed_ack = function(mapMsgData)
@@ -1276,7 +1277,32 @@ local BindProcessFunction = function()
[NetMsgId.Id.clear_all_activity_golden_spy_levels_notify] = HttpNetHandlerPlus.clear_all_activity_golden_spy_levels_notify,
[NetMsgId.Id.activity_double_quest_reward_receive_succeed_ack] = HttpNetHandlerPlus.activity_double_quest_reward_receive_succeed_ack,
[NetMsgId.Id.activity_double_quest_reward_receive_failed_ack] = NOTHING_NEED_TO_BE_DONE,
[NetMsgId.Id.activity_double_reward_times_notify] = HttpNetHandlerPlus.activity_double_reward_times_notify
[NetMsgId.Id.activity_double_reward_times_notify] = HttpNetHandlerPlus.activity_double_reward_times_notify,
[NetMsgId.Id.activity_share_reward_receive_succeed_ack] = HttpNetHandlerPlus.activity_share_reward_receive_succeed_ack,
[NetMsgId.Id.activity_share_reward_receive_failed_ack] = NOTHING_NEED_TO_BE_DONE,
[NetMsgId.Id.trace_hunt_settle_succeed_ack] = HttpNetHandlerPlus.trace_hunt_settle_succeed_ack,
[NetMsgId.Id.trace_hunt_settle_failed_ack] = HttpNetHandlerPlus.trace_hunt_settle_failed_ack,
[NetMsgId.Id.trace_hunt_trace_succeed_ack] = HttpNetHandlerPlus.trace_hunt_trace_succeed_ack,
[NetMsgId.Id.trace_hunt_boss_reward_receive_succeed_ack] = HttpNetHandlerPlus.trace_hunt_boss_reward_receive_succeed_ack,
[NetMsgId.Id.trace_hunt_new_control_notify] = HttpNetHandlerPlus.trace_hunt_new_control_notify,
[NetMsgId.Id.trace_hunt_state_notify] = HttpNetHandlerPlus.trace_hunt_state_notify,
[NetMsgId.Id.trace_hunt_item_change_notify] = HttpNetHandlerPlus.trace_hunt_item_change_notify,
[NetMsgId.Id.activity_ice_cream_level_settle_succeed_ack] = HttpNetHandlerPlus.activity_ice_cream_level_settle_succeed_ack,
[NetMsgId.Id.activity_ice_cream_level_settle_failed_ack] = NOTHING_NEED_TO_BE_DONE,
[NetMsgId.Id.clear_all_activity_iceCream_levels_notify] = HttpNetHandlerPlus.clear_all_activity_iceCream_levels_notify,
[NetMsgId.Id.soldier_apply_succeed_ack] = HttpNetHandlerPlus.soldier_apply_succeed_ack,
[NetMsgId.Id.soldier_apply_failed_ack] = HttpNetHandlerPlus.soldier_apply_failed_ack,
[NetMsgId.Id.soldier_give_up_succeed_ack] = HttpNetHandlerPlus.soldier_give_up_succeed_ack,
[NetMsgId.Id.soldier_give_up_failed_ack] = HttpNetHandlerPlus.soldier_give_up_failed_ack,
[NetMsgId.Id.soldier_info_succeed_ack] = HttpNetHandlerPlus.soldier_info_succeed_ack,
[NetMsgId.Id.soldier_info_failed_ack] = HttpNetHandlerPlus.soldier_info_failed_ack,
[NetMsgId.Id.soldier_interact_succeed_ack] = HttpNetHandlerPlus.soldier_interact_succeed_ack,
[NetMsgId.Id.soldier_interact_failed_ack] = HttpNetHandlerPlus.soldier_interact_failed_ack,
[NetMsgId.Id.sd_soldier_info_notify] = HttpNetHandlerPlus.sd_soldier_info_notify,
[NetMsgId.Id.sd_soldier_effect_notify] = HttpNetHandlerPlus.sd_soldier_effect_notify,
[NetMsgId.Id.sd_shop_data_notify] = HttpNetHandlerPlus.sd_shop_data_notify,
[NetMsgId.Id.sd_item_change_notify] = HttpNetHandlerPlus.sd_item_change_notify,
[NetMsgId.Id.sd_buff_card_add_notify] = HttpNetHandlerPlus.sd_buff_card_add_notify
}
end
function HttpNetHandler.Init()
@@ -1472,5 +1498,6 @@ function HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
PlayerData.Disc:CreateNewDisc(mapDecodedChangeInfo["proto.Disc"])
PlayerData.Base:ChangeHonorTitle(mapDecodedChangeInfo["proto.Honor"])
PlayerData.HeadData:ChangePlayerHead(mapDecodedChangeInfo["proto.HeadIcon"])
PlayerData.TraceHunt:ChangeItem(mapDecodedChangeInfo["proto.TraceHuntItem"])
end
return HttpNetHandler
@@ -286,4 +286,71 @@ function HttpNetHandlerPlus.activity_double_reward_times_notify(mapMsgData)
EventManager.Hit("UpdateInstanceDoubleCount")
end
end
function HttpNetHandlerPlus.activity_share_reward_receive_succeed_ack(mapMsgData)
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(mapMsgData)
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
UTILS.OpenReceiveByChangeInfo(mapMsgData)
end
function HttpNetHandlerPlus.trace_hunt_settle_succeed_ack(mapMsgData)
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(mapMsgData.ChangeInfo)
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
end
function HttpNetHandlerPlus.trace_hunt_settle_failed_ack(mapMsgData)
PlayerData.TraceHunt:ReceiveTraceHuntSettleFailed()
end
function HttpNetHandlerPlus.trace_hunt_trace_succeed_ack(mapMsgData)
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(mapMsgData.ChangeInfo)
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
end
function HttpNetHandlerPlus.trace_hunt_boss_reward_receive_succeed_ack(mapMsgData)
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(mapMsgData.ChangeInfo)
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
end
function HttpNetHandlerPlus.trace_hunt_new_control_notify(mapMsgData)
PlayerData.TraceHunt:SetNewControl(true)
end
function HttpNetHandlerPlus.trace_hunt_state_notify(mapMsgData)
PlayerData.TraceHunt:UpdateBossRewardRedDot(true)
end
function HttpNetHandlerPlus.trace_hunt_item_change_notify(mapMsgData)
PlayerData.TraceHunt:ChangeItemNotify(mapMsgData)
end
function HttpNetHandlerPlus.activity_ice_cream_level_settle_succeed_ack(mapMsgData)
local mapDecodedChangeInfo = UTILS.DecodeChangeInfo(mapMsgData.Change)
HttpNetHandler.ProcChangeInfo(mapDecodedChangeInfo)
end
function HttpNetHandlerPlus.clear_all_activity_iceCream_levels_notify(mapMsgData)
EventManager.Hit("ClearAllIceLevels", mapMsgData)
end
function HttpNetHandlerPlus.soldier_interact_succeed_ack(mapMsgData)
end
function HttpNetHandlerPlus.soldier_interact_failed_ack(mapMsgData)
end
function HttpNetHandlerPlus.soldier_apply_succeed_ack(mapMsgData)
end
function HttpNetHandlerPlus.soldier_apply_failed_ack(mapMsgData)
end
function HttpNetHandlerPlus.soldier_give_up_succeed_ack(mapMsgData)
end
function HttpNetHandlerPlus.soldier_give_up_failed_ack(mapMsgData)
end
function HttpNetHandlerPlus.soldier_info_succeed_ack(mapMsgData)
end
function HttpNetHandlerPlus.soldier_info_failed_ack(mapMsgData)
end
function HttpNetHandlerPlus.sd_soldier_info_notify(mapMsgData)
PlayerData.SoldierData:OnSoldierInfoNotify(mapMsgData)
end
function HttpNetHandlerPlus.sd_soldier_effect_notify(mapMsgData)
PlayerData.SoldierData:OnSoldierEffectNotify(mapMsgData)
end
function HttpNetHandlerPlus.sd_shop_data_notify(mapMsgData)
PlayerData.SoldierData:OnShopDataNotify(mapMsgData)
end
function HttpNetHandlerPlus.sd_item_change_notify(mapMsgData)
PlayerData.SoldierData:OnItemChangeNotify(mapMsgData)
end
function HttpNetHandlerPlus.sd_buff_card_add_notify(mapMsgData)
PlayerData.SoldierData:OnBuffCardAddNotify(mapMsgData)
end
return HttpNetHandlerPlus
+108
View File
@@ -1,5 +1,11 @@
local NetMsgId = {}
NetMsgId.Id = {
clear_all_activity_iceCream_levels_notify = -10057,
sd_soldier_effect_notify = -10056,
sd_soldier_info_notify = -10055,
sd_shop_data_notify = -10054,
sd_item_change_notify = -10053,
sd_buff_card_add_notify = -10052,
clear_all_activity_golden_spy_levels_notify = -10051,
clear_all_activity_breakout_levels_notify = -10050,
clear_story_set_notify = -10049,
@@ -189,6 +195,9 @@ NetMsgId.Id = {
activity_gds_settle_req = 1501,
activity_gds_settle_succeed_ack = 1502,
activity_gds_settle_failed_ack = 1503,
activity_soldier_quest_reward_receive_req = 1601,
activity_soldier_quest_reward_receive_succeed_ack = 1602,
activity_soldier_quest_reward_receive_failed_ack = 1603,
player_formation_req = 2001,
player_formation_succeed_ack = 2002,
player_formation_failed_ack = 2003,
@@ -459,6 +468,42 @@ NetMsgId.Id = {
mall_shop_order_req = 5128,
mall_shop_order_succeed_ack = 5129,
mall_shop_order_failed_ack = 5130,
trace_hunt_info_req = 5201,
trace_hunt_info_succeed_ack = 5202,
trace_hunt_info_failed_ack = 5203,
trace_hunt_apply_req = 5204,
trace_hunt_apply_succeed_ack = 5205,
trace_hunt_apply_failed_ack = 5206,
trace_hunt_settle_req = 5207,
trace_hunt_settle_succeed_ack = 5208,
trace_hunt_settle_failed_ack = 5209,
trace_hunt_recommend_req = 5210,
trace_hunt_recommend_succeed_ack = 5211,
trace_hunt_recommend_failed_ack = 5212,
trace_hunt_boss_reward_receive_req = 5213,
trace_hunt_boss_reward_receive_succeed_ack = 5214,
trace_hunt_boss_reward_receive_failed_ack = 5215,
trace_hunt_trace_req = 5216,
trace_hunt_trace_succeed_ack = 5217,
trace_hunt_trace_failed_ack = 5218,
soldier_apply_req = 5301,
soldier_apply_succeed_ack = 5302,
soldier_apply_failed_ack = 5303,
soldier_info_req = 5304,
soldier_info_succeed_ack = 5305,
soldier_info_failed_ack = 5306,
soldier_interact_req = 5307,
soldier_interact_succeed_ack = 5308,
soldier_interact_failed_ack = 5309,
soldier_give_up_req = 5310,
soldier_give_up_succeed_ack = 5311,
soldier_give_up_failed_ack = 5312,
soldier_step_out_req = 5313,
soldier_step_out_succeed_ack = 5314,
soldier_step_out_failed_ack = 5315,
soldier_partner_trace_req = 5316,
soldier_partner_trace_succeed_ack = 5317,
soldier_partner_trace_failed_ack = 5318,
gacha_spin_req = 6001,
gacha_spin_succeed_ack = 6002,
gacha_spin_failed_ack = 6003,
@@ -700,6 +745,9 @@ NetMsgId.Id = {
activity_double_quest_reward_receive_req = 8407,
activity_double_quest_reward_receive_succeed_ack = 8408,
activity_double_quest_reward_receive_failed_ack = 8409,
activity_ice_cream_level_settle_req = 8411,
activity_ice_cream_level_settle_succeed_ack = 8412,
activity_ice_cream_level_settle_failed_ack = 8413,
mail_list_req = 9001,
mail_list_succeed_ack = 9002,
mail_list_failed_ack = 9003,
@@ -769,6 +817,9 @@ NetMsgId.Id = {
phone_contacts_top_req = 9207,
phone_contacts_top_succeed_ack = 9208,
phone_contacts_top_failed_ack = 9209,
activity_share_reward_receive_req = 9210,
activity_share_reward_receive_succeed_ack = 9211,
activity_share_reward_receive_failed_ack = 9212,
talent_unlock_req = 9301,
talent_unlock_succeed_ack = 9302,
talent_unlock_failed_ack = 9303,
@@ -883,6 +934,9 @@ NetMsgId.Id = {
item_expired_change_notify = 10054,
milkout_character_unlock_notify = 10055,
activity_double_reward_times_notify = 10056,
trace_hunt_new_control_notify = 10057,
trace_hunt_state_notify = 10058,
trace_hunt_item_change_notify = 10060,
activity_mining_apply_req = 11001,
activity_mining_apply_succeed_ack = 11002,
activity_mining_apply_failed_ack = 11003,
@@ -921,6 +975,12 @@ NetMsgId.Id = {
activity_cookie_quest_reward_receive_failed_ack = 11206
}
NetMsgId.MsgName = {
[-10057] = "proto.GmClearAllActivityIceCreamLevelsNotify",
[-10056] = "proto.SoldierEffectNtf",
[-10055] = "proto.SoldierInfo",
[-10054] = "proto.ShopCaseData",
[-10053] = "proto.ChangeInfo",
[-10052] = "proto.SoldierCard",
[-10051] = "proto.ActivityGDS",
[-10050] = "proto.Milkout",
[-10049] = "proto.StorySetInfoResp",
@@ -1110,6 +1170,9 @@ NetMsgId.MsgName = {
[1501] = "proto.ActivityGDSSettleReq",
[1502] = "proto.ChangeInfo",
[1503] = "proto.Error",
[1601] = "proto.ActivitySoldierQuestRewardReceiveReq",
[1602] = "proto.ChangeInfo",
[1603] = "proto.Error",
[2001] = "proto.PlayerFormationReq",
[2002] = "proto.Nil",
[2003] = "proto.Error",
@@ -1380,6 +1443,42 @@ NetMsgId.MsgName = {
[5128] = "proto.MallShopOrderReq",
[5129] = "proto.ChangeInfo",
[5130] = "proto.Error",
[5201] = "proto.Nil",
[5202] = "proto.TraceHuntInfo",
[5203] = "proto.Error",
[5204] = "proto.TraceHuntApplyReq",
[5205] = "proto.Nil",
[5206] = "proto.Error",
[5207] = "proto.TraceHuntSettleReq",
[5208] = "proto.TraceHuntSettleResp",
[5209] = "proto.Error",
[5210] = "proto.Nil",
[5211] = "proto.TraceHuntRecommendResp",
[5212] = "proto.Error",
[5213] = "proto.Nil",
[5214] = "proto.TraceHuntBossRewardReceiveResp",
[5215] = "proto.Error",
[5216] = "proto.I32",
[5217] = "proto.TraceHuntTraceResp",
[5218] = "proto.Error",
[5301] = "proto.SoldierApplyReq",
[5302] = "proto.SoldierApplyResp",
[5303] = "proto.Error",
[5304] = "proto.Nil",
[5305] = "proto.SoldierInfo",
[5306] = "proto.Error",
[5307] = "proto.SoldierInteractReq",
[5308] = "proto.SoldierInteractResp",
[5309] = "proto.Error",
[5310] = "proto.Nil",
[5311] = "proto.SoldierGiveUpResp",
[5312] = "proto.Error",
[5313] = "proto.SoldierStepOutReq",
[5314] = "proto.Nil",
[5315] = "proto.Error",
[5316] = "proto.SoldierPartnerTraceReq",
[5317] = "proto.Nil",
[5318] = "proto.Error",
[6001] = "proto.GachaSpinReq",
[6002] = "proto.GachaSpinResp",
[6003] = "proto.Error",
@@ -1621,6 +1720,9 @@ NetMsgId.MsgName = {
[8407] = "proto.ActivityDoubleQuestRewardReq",
[8408] = "proto.ChangeInfo",
[8409] = "proto.Error",
[8411] = "proto.ActivityIceCreamLevelSettleReq",
[8412] = "proto.ActivityIceCreamLevelSettleSucceed",
[8413] = "proto.Error",
[9001] = "proto.Nil",
[9002] = "proto.Mails",
[9003] = "proto.Error",
@@ -1690,6 +1792,9 @@ NetMsgId.MsgName = {
[9207] = "proto.UI32",
[9208] = "proto.Nil",
[9209] = "proto.Error",
[9210] = "proto.ActivityShareRewardReq",
[9211] = "proto.ChangeInfo",
[9212] = "proto.Error",
[9301] = "proto.UI32",
[9302] = "proto.TalentUnlockResp",
[9303] = "proto.Error",
@@ -1804,6 +1909,9 @@ NetMsgId.MsgName = {
[10054] = "proto.ItemTpl",
[10055] = "proto.MilkoutCharacterUnlockNotify",
[10056] = "proto.ActivityDoubleRewardTimesNotify",
[10057] = "proto.Nil",
[10058] = "proto.TraceHuntState",
[10060] = "proto.TraceHuntItem",
[11001] = "proto.ActivityMiningApplyReq",
[11002] = "proto.ActivityMiningApplyResp",
[11003] = "proto.Error",
+20 -3
View File
@@ -79,8 +79,9 @@ local RedDotDefine = {
Activity_Tab = "Activity.Tab.<param>",
Activity_Periodic_Quest_Group = "Activity.<param>.Periodic.<param>",
Activity_Periodic_Final_Reward = "Activity.<param>.Final",
Activity_Mining_Quest_Group = "Activity.MiningQuestGroup",
Activity_Mining_Quest = "Activity.MiningQuestGroup.<param>",
Activity_Mining_AllQuest = "Activity.Mining.Quest",
Activity_Mining_QuestGroup = "Activity.Mining.Quest.<param>",
Activity_Mining_Quest = "Activity.Mining.Quest.<param>.<param>",
Activity_TowerDefense_LevelTab = "Activity.TowerDefense.Level.<param>",
Activity_TowerDefense_Level = "Activity.TowerDefense.Level.<param>.<param>",
Activity_TowerDefense_AllStory = "Activity.TowerDefense.Story",
@@ -177,6 +178,7 @@ local RedDotDefine = {
VampireQuest_Season = "VampireQuest.Season",
VampireTalent = "VampireTalent",
JointDrillQuest = "JointDrillQuest",
JointDrillDailyEnter = "JointDrillDailyEnter.<param>",
TrekkerVersusQuest = "TrekkerVersusQuest",
TrekkerVersus = "Activity.Group.<param>.TrekkerVersus.<param>",
TrekkerVersusQuest_1 = "Activity.Group.<param>.TrekkerVersus.<param>.Quest",
@@ -186,6 +188,21 @@ local RedDotDefine = {
TrekkerVersusGiftQuest = "Activity.Group.<param>.TrekkerVersus.<param>.Quest.GiftQuest",
TrekkerVersusBattleQuest = "Activity.Group.<param>.TrekkerVersus.<param>.Quest.BattleQuest",
Activity_GoldenSpy = "Activity_Group_New.<param>.GoldenSpy",
Activity_GoldenSpy_Group = "Activity_Group_New.<param>.GoldenSpy.Group.<param>"
Activity_GoldenSpy_Group = "Activity_Group_New.<param>.GoldenSpy.Group.<param>",
Solider = "Solider.<param>",
Solider_AllQuest = "Solider.Quest",
Solider_Quest_Group = "Solider.Quest.<param>",
Solider_Quest = "Solider.Quest.<param>.<param>",
Solider_Quest_New = "SoliderQuest.New",
Solider_Quest_New_Group = "SoliderQuest.New.<param>",
Solider_Level_New = "SoliderLevel.New",
TraceHunt_Reward = "TraceHunt_Reward",
TraceHunt_Reward_Boss = "TraceHunt_Reward.Boss",
TraceHunt_Item = "TraceHunt_Item",
TraceHunt_TraceItem = "TraceHunt_TraceItem",
TraceHunt_HuntItem = "TraceHunt_HuntItem",
Activity_IceCreamTruck_New = "Activity_IceCreamTruck_New.<param>",
Activity_IceCreamTruck_NewType = "Activity_IceCreamTruck_New.<param>.LevelType.<param>",
Activity_IceCreamTruck_NewLevel = "Activity_IceCreamTruck_New.<param>.LevelType.<param>.Level<param>"
}
return RedDotDefine
+100 -8
View File
@@ -1,10 +1,12 @@
local ConfigData = require("GameCore.Data.ConfigData")
local TimerManager = require("GameCore.Timer.TimerManager")
local GameResourceLoader = require("Game.Common.Resource.GameResourceLoader")
local UIObjs = require("GameCore.UI.UIObjs")
local ResType = GameResourceLoader.ResType
local AdventureModuleHelper = CS.AdventureModuleHelper
local BaseCtrl = class("BaseCtrl")
local sRootPath = Settings.AB_ROOT_PATH
local InUnityEditor = NovaAPI.IsEditorPlatform()
local bDebugLog = false
local typeof = typeof
function BaseCtrl:ctor(goPrefabInstance, objPanel)
@@ -14,6 +16,13 @@ function BaseCtrl:ctor(goPrefabInstance, objPanel)
self._mapLoadAssets = {}
self._mapHandler = {}
self._mapNode = {}
local csUIObjs = goPrefabInstance:GetComponent("UIObjsReference")
if csUIObjs and not csUIObjs:IsNull() then
self._uiObjs = UIObjs.new(csUIObjs, self)
if not self._mapNodeConfig then
self._mapNodeConfig = {}
end
end
self:ParsePrefab(goPrefabInstance)
if type(self.Awake) == "function" then
self:Awake()
@@ -102,16 +111,83 @@ function BaseCtrl:_Destroy()
self._mapLoadAssets = nil
self._mapHandler = nil
self._mapNode = nil
self._uiObjs = nil
end
function BaseCtrl:_Release()
if self.gameObject ~= nil and self.gameObject:IsNull() == false and type(self.OnRelease) == "function" then
self:OnRelease()
end
end
function BaseCtrl:_FillMapNodeConfigByUIObjs(mapNodeConfig)
if self._uiObjs == nil or type(mapNodeConfig) ~= "table" then
return
end
local mapCoveredByCount = {}
local tbInject = {}
for sKey, mapConfig in pairs(mapNodeConfig) do
local nCount = mapConfig.nCount
if type(nCount) == "number" then
local sNodeName = mapConfig.sNodeName or sKey
if mapConfig.sNodeName == nil then
mapConfig.sNodeName = sNodeName
end
local _, sTypeName = self._uiObjs:Get(sNodeName .. "1")
if mapConfig.sComponentName == nil and mapConfig.sCtrlName == nil and sTypeName ~= nil then
mapConfig.sComponentName = sTypeName
end
if mapConfig.sCtrlName ~= nil and type(mapConfig.callback) == "string" and sTypeName ~= nil then
local sShadowKey = sKey .. "__BtnHandler"
if mapNodeConfig[sShadowKey] == nil and tbInject[sShadowKey] == nil then
tbInject[sShadowKey] = {
nCount = nCount,
sNodeName = sNodeName,
sComponentName = sTypeName,
callback = mapConfig.callback
}
end
end
for i = 1, nCount do
mapCoveredByCount[sNodeName .. tostring(i)] = true
end
else
local uiObj, sTypeName = self._uiObjs:Get(sKey)
if uiObj ~= nil then
if mapConfig.sNodeName == nil then
mapConfig.sNodeName = sKey
end
if mapConfig.sComponentName == nil and mapConfig.sCtrlName == nil then
mapConfig.sComponentName = sTypeName
end
if mapConfig.sCtrlName ~= nil and type(mapConfig.callback) == "string" then
local sShadowKey = sKey .. "__BtnHandler"
if mapNodeConfig[sShadowKey] == nil and tbInject[sShadowKey] == nil then
tbInject[sShadowKey] = {
sNodeName = mapConfig.sNodeName or sKey,
sComponentName = sTypeName,
callback = mapConfig.callback
}
end
end
end
end
end
for sShadowKey, shadowConfig in pairs(tbInject) do
mapNodeConfig[sShadowKey] = shadowConfig
end
for _, sKey in ipairs(self._uiObjs._keys) do
if mapNodeConfig[sKey] == nil and not mapCoveredByCount[sKey] then
local uiObj, sTypeName = self._uiObjs:Get(sKey)
if uiObj ~= nil and sTypeName ~= nil then
mapNodeConfig[sKey] = {sNodeName = sKey, sComponentName = sTypeName}
end
end
end
end
function BaseCtrl:_ParseNode(mapNodeConfig)
if self.gameObject ~= nil and type(mapNodeConfig) == "table" then
self:_FillMapNodeConfigByUIObjs(mapNodeConfig)
local trPrefabRoot = self.gameObject.transform
local mapNode = {}
local mapNode
local function func_MarkAllNode(trRoot)
local nChildCount = trRoot.childCount - 1
for i = 0, nChildCount do
@@ -122,7 +198,20 @@ function BaseCtrl:_ParseNode(mapNodeConfig)
end
end
end
func_MarkAllNode(trPrefabRoot)
local func_GetGoByName = function(sName)
if self._uiObjs ~= nil then
local uiObj = self._uiObjs[sName]
if uiObj ~= nil then
local uiType = self._uiObjs._objTypeMaps[sName]
return uiType == "GameObject" and uiObj or uiObj.gameObject
end
end
if mapNode == nil then
mapNode = {}
func_MarkAllNode(trPrefabRoot)
end
return mapNode[sName]
end
for sKey, mapConfig in pairs(mapNodeConfig) do
local sNodeName = mapConfig.sNodeName
local nCount = mapConfig.nCount
@@ -146,7 +235,7 @@ function BaseCtrl:_ParseNode(mapNodeConfig)
for nIndex, sName in ipairs(tbNodeName) do
local bComponentFound = true
local objNode
local goNode = mapNode[sName]
local goNode = func_GetGoByName(sName)
if goNode ~= nil then
if type(sCtrlName) == "string" then
local objCtrl
@@ -162,6 +251,10 @@ function BaseCtrl:_ParseNode(mapNodeConfig)
objCtrl = luaClass.new(goNode, self._panel)
objCtrl._nGoInstanceId = nGoInstanceId
table.insert(self._panel._tbObjChildCtrl, objCtrl)
if InUnityEditor and goNode and goNode.gameObject then
local sPanelName = objCtrl._panel.__cname
NovaAPI.AttachPrefabLuaInspector(goNode.gameObject, sCtrlName, sPanelName, nil)
end
end
objCtrl:ParsePrefab(goNode)
objNode = objCtrl
@@ -704,11 +797,6 @@ function BaseCtrl:OnEvent_AvgSpeedUp_Timer(nRate)
end
end
end
function BaseCtrl:SetAvgCharHeadIconByPrefab(img, sPrefabPath)
local sFullPath = sRootPath .. sPrefabPath
local prefab = GameResourceLoader.LoadAsset(ResType.Any, sFullPath, typeof(GameObject), "UI", self._panel._nPanelId)
NovaAPI.SetImageSpriteWithPrefab(img, prefab)
end
function BaseCtrl:AddTimer(nTargetCount, nInterval, sCallbackName, bAutoRun, bDestroyWhenComplete, nScaleType, tbParam)
local callback
if type(sCallbackName) == "function" then
@@ -816,6 +904,10 @@ function BaseCtrl:BindCtrlByNode(goNode, sCtrlName)
objCtrl = luaClass.new(goNode, self._panel)
table.insert(self._panel._tbObjDyncChildCtrl, objCtrl)
objCtrl:_Enter()
if InUnityEditor and goNode and goNode.gameObject then
local sPanelName = self._panel.__cname
NovaAPI.AttachPrefabLuaInspector(goNode.gameObject, sCtrlName, sPanelName, nil)
end
end
return objCtrl
end
+5 -1
View File
@@ -6,6 +6,7 @@ local sTopBarCtrlLua = "Game.UI.TopBarEx.TopBarCtrl"
local sSafeAreaRoot = "----SafeAreaRoot----"
local bDebugLog = false
local typeof = typeof
local InUnityEditor = NovaAPI.IsEditorPlatform()
function BasePanel:ctor(nIndex, nPanelId, tbParam)
self._nIndex = nIndex
self._nPanelId = nPanelId
@@ -114,7 +115,10 @@ function BasePanel:_PreEnter(callback, goSnapshot)
rt.anchoredPosition = Vector2.zero
end
end
NovaAPI.ProcResPathNote(goPrefabInstance, GameResourceLoader.MakeBundleGroup("UI", self._nPanelId))
if InUnityEditor then
local sPanelName = self.__cname
NovaAPI.AttachPrefabLuaInspector(goPrefabInstance, sLuaClassName, sPanelName, sPrefabFullPath)
end
if objCtrl == nil then
objCtrl = luaClassName.new(goPrefabInstance, self)
table.insert(self._tbObjCtrl, objCtrl)
+77 -27
View File
@@ -66,6 +66,7 @@ local PanelDefine = {
[PanelId.ReceivePropsNPC] = "Game.UI.ReceivePropsEx.ReceivePropsNPCPanel",
[PanelId.Friend] = "Game.UI.FriendEx.FriendPanel",
[PanelId.FriendCarte] = "Game.UI.FriendEx.FriendCartePanel",
[PanelId.FriendAddStranger] = "Game.UI.FriendEx.FriendAddStrangerPanel",
[PanelId.RoguelikeLevel] = "Game.UI.FixedRoguelikeLevelSelectEx.FixedRoguelikeLevelSelectPanel",
[PanelId.RogueBossLevel] = "Game.UI.FixedRoguelikeLevelSelectEx.RogueBossSelectPanel",
[PanelId.WorldClassUpgrade] = "Game.UI.WorldClassEx.WorldClassUpgradePanel",
@@ -91,6 +92,7 @@ local PanelDefine = {
[PanelId.SkillSucBar] = "Game.UI.SuccessBarEx.SkillSucBarPanel",
[PanelId.CharSucBar] = "Game.UI.SuccessBarEx.CharSucBarPanel",
[PanelId.EquipmentSucBar] = "Game.UI.SuccessBarEx.EquipmentSucBarPanel",
[PanelId.TraceHuntSucBar] = "Game.UI.SuccessBarEx.TraceHuntSucBarPanel",
[PanelId.ReceiveAutoTrans] = "Game.UI.SuccessBarEx.ReceiveAutoTransPanel",
[PanelId.CharacterSkinPanel] = "Game.UI.CharacterSkin.CharacterSkinPanel",
[PanelId.ReceiveSpecialReward] = "Game.UI.CharacterSkin.ReceiveSpecialRewardPanel",
@@ -104,7 +106,7 @@ local PanelDefine = {
[PanelId.FRQuestComplete] = "Game.UI.FixedRoguelikeEx.FixedRoguelikeQuestCompletePanel",
[PanelId.PopupSkillPanel] = "Game.UI.CommonTipsEx.PopupSkillPanel",
[PanelId.TravelerDuelLevelQuestPanel] = "Game.UI.TravelerDuelLevelSelect.TravelerDuelQuest.TravelerDuelQuestPanel",
[PanelId.TDBattleResultPanel] = "Game.UI.TrekkerVersus_600002.TDBattleResultPanel",
[PanelId.TDBattleResultPanel] = "Game.UI.TrekkerVersus_600003.TDBattleResultPanel",
[PanelId.TDLevelUpgrade] = "Game.UI.TravelerDuelLevelSelect.TDClassUpgradePanel",
[PanelId.CharacterRelation] = "Game.UI.CharacterInfoEx.CharacterPlotPanel",
[PanelId.ExChangePanel] = "Game.UI.ExChange.ExChangePanel",
@@ -190,6 +192,8 @@ local PanelDefine = {
[PanelId.CookieGamePanel_400006] = "Game.UI.Play_Cookie_400006.CookieGamePanel",
[PanelId.CookieBoardPanel_400010] = "Game.UI.Play_Cookie.400010.CookieBoardPanel",
[PanelId.CookieGamePanel_400010] = "Game.UI.Play_Cookie.400010.CookieGamePanel",
[PanelId.CookieBoardPanel_400016] = "Game.UI.Play_Cookie.400016.CookieBoardPanel",
[PanelId.CookieGamePanel_400016] = "Game.UI.Play_Cookie.400016.CookieGamePanel",
[PanelId.LampNoticePanel] = "Game.UI.LampNotice.LampNoticePanel",
[PanelId.TrialLevelSelect] = "Game.UI.TrialLevelSelect.TrialLevelSelectPanel",
[PanelId.TrialFormation] = "Game.UI.TrialLevelSelect.TrialFormationPanel",
@@ -197,15 +201,15 @@ local PanelDefine = {
[PanelId.TrialDepot] = "Game.UI.TrialBattle.TrialDepotPanel",
[PanelId.TrialResult] = "Game.UI.TrialBattle.TrialResultPanel",
[PanelId.NpcAffinityRewardPanel] = "Game.UI.StarTowerBook.Affinity.AffinityRewardPanel",
[PanelId.JointDrillLevelSelect_510001] = "Game.UI.JointDrill.JointDrill_1.JointDrillLevelSelectPanel_510001",
[PanelId.JointDrillBuildList_510001] = "Game.UI.JointDrill.JointDrill_1.JointDrillBuildListPanel_510001",
[PanelId.JointDrillLevelSelect_Mode1] = "Game.UI.JointDrill.JointDrill_1.JointDrillLevelSelectPanel",
[PanelId.JointDrillBuildList_Mode1] = "Game.UI.JointDrill.JointDrill_1.JointDrillBuildListPanel",
[PanelId.JointDrillBattlePanel] = "Game.UI.Battle.JointDrillBattlePanel",
[PanelId.JointDrillResult_510001] = "Game.UI.JointDrill.JointDrill_1.JointDrillResultPanel_510001",
[PanelId.JointDrillRankUp_510001] = "Game.UI.JointDrill.JointDrill_1.JointDrillRankUpPanel_510001",
[PanelId.JointDrillQuest_510001] = "Game.UI.JointDrill.JointDrill_1.JointDrillQuestPanel_510001",
[PanelId.JointDrillRanking_510001] = "Game.UI.JointDrill.JointDrill_1.JointDrillRankingPanel_510001",
[PanelId.JointDrillRankDetail_510001] = "Game.UI.JointDrill.JointDrill_1.JointDrillRankDetailPanel_510001",
[PanelId.JointDrillRaid_510001] = "Game.UI.JointDrill.JointDrill_1.JointDrillRaidPanel_510001",
[PanelId.JointDrillResult_Mode1] = "Game.UI.JointDrill.JointDrill_1.JointDrillResultPanel",
[PanelId.JointDrillRankUp_Mode1] = "Game.UI.JointDrill.JointDrill_1.JointDrillRankUpPanel",
[PanelId.JointDrillQuest_Mode1] = "Game.UI.JointDrill.JointDrill_1.JointDrillQuestPanel",
[PanelId.JointDrillRanking_Mode1] = "Game.UI.JointDrill.JointDrill_1.JointDrillRankingPanel",
[PanelId.JointDrillRankDetail_Mode1] = "Game.UI.JointDrill.JointDrill_1.JointDrillRankDetailPanel",
[PanelId.JointDrillRaid_Mode1] = "Game.UI.JointDrill.JointDrill_1.JointDrillRaidPanel",
[PanelId.TowerDefenseSelectPanel] = "Game.UI.TowerDefense.TowerDefenseSelectPanel",
[PanelId.TowerDefenseLevelDetailPanel] = "Game.UI.TowerDefense.TowerDefenseLevelDetailPanel",
[PanelId.NPCAffinityLevelUp] = "Game.UI.StarTower.NpcAffinityLevelUp.NPCFavorLevelUpPanel",
@@ -220,6 +224,12 @@ local PanelDefine = {
[PanelId.TowerDefenseQuest] = "Game.UI.TowerDefense.TowerDefenseQuestPanel",
[PanelId.TowerDefenseResultPanel] = "Game.UI.TowerDefense.TowerDefenseResultPanel",
[PanelId.ScoreBossRankingPanel] = "Game.UI.ScoreBoss.ScoreBossRanking.ScoreBossRankingPanel",
[PanelId.TraceHunt] = "Game.UI.TraceHunt.TraceHuntPanel",
[PanelId.TraceHuntLevel] = "Game.UI.TraceHunt.TraceHuntLevelPanel",
[PanelId.TraceHuntHelp] = "Game.UI.TraceHunt.TraceHuntHelpPanel",
[PanelId.TraceHuntHandBook] = "Game.UI.TraceHunt.TraceHuntHandBookPanel",
[PanelId.TraceHuntBattle] = "Game.UI.Battle.TraceHuntBattlePanel",
[PanelId.TraceHuntResult] = "Game.UI.TraceHunt.TraceHuntResultPanel",
[PanelId.TowerDefenseTipsPanel] = "Game.UI.TowerDefense.TowerDefTipsPanel",
[PanelId.ActivityLevelsBattlePanel] = "Game.UI.Battle.ActivityLevelsBattlePanel",
[PanelId.ActivityLevelsSelectPanel] = "Game.UI.ActivityTheme.Swim.ActivityLevels.ActivityLevelsSelectPanel",
@@ -258,7 +268,7 @@ local PanelDefine = {
[PanelId.QuestNewbie] = "Game.UI.QuestNewbie.QuestNewbiePanel",
[PanelId.TowerDefenseTestPanel] = "Game.Editor.TowerDefense.TowerDefenseTestPanel",
[PanelId.TowerDefenseTestResultPanel] = "Game.Editor.TowerDefense.TowerDefenseTestResultPanel",
[PanelId.TrekkerVersus] = "Game.UI.TrekkerVersus_600002.TrekkerVersusPanel",
[PanelId.TrekkerVersus] = "Game.UI.TrekkerVersus_600003.TrekkerVersusPanel",
[PanelId.ActivityLevelsSelectPanel_20101] = "Game.UI.ActivityTheme.20101.ActivityLevels.ActivityLevelsSelectPanel",
[PanelId.ChristmasThemePanel] = "Game.UI.ActivityTheme.20101.ChristmasThemePanel",
[PanelId.BreakOutLevelDetailPanel] = "Game.UI.Play_BreakOut_30101.BreakOutLevelDetailPanel",
@@ -278,23 +288,16 @@ local PanelDefine = {
[PanelId.ThrowGiftLevelPanel] = "Game.UI.Activity.ThrowGifts.ThrowGiftPanel",
[PanelId.ThrowGiftPanel_400009] = "Game.UI.Activity.ThrowGifts.ThrowGiftLevelSelectPanel_400009",
[PanelId.ThrowGiftLevelPanel_400009] = "Game.UI.Activity.ThrowGifts.ThrowGiftPanel_400009",
[PanelId.JointDrillLevelSelect_510003] = "Game.UI.JointDrill.JointDrill_2.JointDrillLevelSelectPanel_510003",
[PanelId.JointDrillBuildList_510003] = "Game.UI.JointDrill.JointDrill_2.JointDrillBuildListPanel_510003",
[PanelId.JointDrillResult_510003] = "Game.UI.JointDrill.JointDrill_2.JointDrillResultPanel_510003",
[PanelId.JointDrillRankUp_510003] = "Game.UI.JointDrill.JointDrill_2.JointDrillRankUpPanel_510003",
[PanelId.JointDrillQuest_510003] = "Game.UI.JointDrill.JointDrill_2.JointDrillQuestPanel_510003",
[PanelId.JointDrillRanking_510003] = "Game.UI.JointDrill.JointDrill_2.JointDrillRankingPanel_510003",
[PanelId.JointDrillRankDetail_510003] = "Game.UI.JointDrill.JointDrill_2.JointDrillRankDetailPanel_510003",
[PanelId.JointDrillRaid_510003] = "Game.UI.JointDrill.JointDrill_2.JointDrillRaidPanel_510003",
[PanelId.JointDrillLevelSelect_510005] = "Game.UI.JointDrill.JointDrill_2.JointDrillLevelSelectPanel_510005",
[PanelId.JointDrillBuildList_510005] = "Game.UI.JointDrill.JointDrill_2.JointDrillBuildListPanel_510005",
[PanelId.JointDrillResult_510005] = "Game.UI.JointDrill.JointDrill_2.JointDrillResultPanel_510005",
[PanelId.JointDrillRankUp_510005] = "Game.UI.JointDrill.JointDrill_2.JointDrillRankUpPanel_510005",
[PanelId.JointDrillQuest_510005] = "Game.UI.JointDrill.JointDrill_2.JointDrillQuestPanel_510005",
[PanelId.JointDrillRanking_510005] = "Game.UI.JointDrill.JointDrill_2.JointDrillRankingPanel_510005",
[PanelId.JointDrillRankDetail_510005] = "Game.UI.JointDrill.JointDrill_2.JointDrillRankDetailPanel_510005",
[PanelId.JointDrillRaid_510005] = "Game.UI.JointDrill.JointDrill_2.JointDrillRaidPanel_510005",
[PanelId.JointDrillLevelSelect_Mode2] = "Game.UI.JointDrill.JointDrill_2.JointDrillLevelSelectPanel",
[PanelId.JointDrillBuildList_Mode2] = "Game.UI.JointDrill.JointDrill_2.JointDrillBuildListPanel",
[PanelId.JointDrillResult_Mode2] = "Game.UI.JointDrill.JointDrill_2.JointDrillResultPanel",
[PanelId.JointDrillRankUp_Mode2] = "Game.UI.JointDrill.JointDrill_2.JointDrillRankUpPanel",
[PanelId.JointDrillQuest_Mode2] = "Game.UI.JointDrill.JointDrill_2.JointDrillQuestPanel",
[PanelId.JointDrillRanking_Mode2] = "Game.UI.JointDrill.JointDrill_2.JointDrillRankingPanel",
[PanelId.JointDrillRankDetail_Mode2] = "Game.UI.JointDrill.JointDrill_2.JointDrillRankDetailPanel",
[PanelId.JointDrillRaid_Mode2] = "Game.UI.JointDrill.JointDrill_2.JointDrillRaidPanel",
[PanelId.PenguinCard] = "Game.UI.Play_PenguinCard.PenguinCardPanel",
[PanelId.PenguinCardEndless] = "Game.UI.Play_PenguinCard.EndlessMode.PenguinCardPanel",
[PanelId.PenguinCardQuest] = "Game.UI.Play_PenguinCard.PenguinCardQuestPanel",
[PanelId.PenguinCardLevel] = "Game.UI.Play_PenguinCard.PenguinCardSelectPanel",
[PanelId.ActivityLevelsSelectPanel_10104] = "Game.UI.ActivityTheme.10104.ActivityLevels.ActivityLevelsSelectPanel",
@@ -360,7 +363,54 @@ local PanelDefine = {
[PanelId.GoldenSpyLevelSelectPanel_400012] = "Game.UI.Activity.GoldenSpy.400012.GoldenSpyLevelSelectPanel",
[PanelId.GoldenSpyBuffSelectPanel_400012] = "Game.UI.Activity.GoldenSpy.400012.GoldenSpyBuffSelectPanel",
[PanelId.GoldenSpyResultPanel_400012] = "Game.UI.Activity.GoldenSpy.400012.GoldenSpyResultPanel",
[PanelId.GoldenSpyBuffTipsPanel_400012] = "Game.UI.Activity.GoldenSpy.400012.GoldenSpyBuffTipsPanel"
[PanelId.GoldenSpyBuffTipsPanel_400012] = "Game.UI.Activity.GoldenSpy.400012.GoldenSpyBuffTipsPanel",
[PanelId.MiningGame_400014] = "Game.UI.Activity.Mining.400014.MiningGamePanel",
[PanelId.MiningGameGuidePanel_400014] = "Game.UI.Activity.Mining.400014.MiningGameGuidePanel",
[PanelId.MiningGameQuestPanel_400014] = "Game.UI.Activity.Mining.400014.MiningGameQuestPanel",
[PanelId.SoldierTestEnter] = "Game.UI.Soldier.SoldierTestEnterPanel",
[PanelId.SoldierBattlePanel] = "Game.UI.Soldier.Battle.SoldierBattlePanel",
[PanelId.SoldierBattleResult] = "Game.UI.Soldier.Battle.SoldierBattleResultPanel",
[PanelId.SoldierSelectPolicy] = "Game.UI.Soldier.SelectPolicy.SoldierSelectPolicyPanel",
[PanelId.SoldierMainViewPanel] = "Game.UI.Soldier.SoldierMainViewPanel",
[PanelId.SoldierLevelSelectPanel] = "Game.UI.Soldier.SoldierLevelSelectPanel",
[PanelId.SoldierHandbookPanel] = "Game.UI.Soldier.Handbook.SoldierHandbookPanel",
[PanelId.SoldierQuestPanel] = "Game.UI.Soldier.SoldierQuestPanel",
[PanelId.SoldierHandbookSelectPanel] = "Game.UI.Soldier.Handbook.SoldierHandbookSelectPanel",
[PanelId.SoldierSandtable] = "Game.UI.Soldier.Sandtable.SoldierSandtablePanel",
[PanelId.SoldierBuffTipsPanel] = "Game.UI.Soldier.Sandtable.Components.SoldierBuffTipsPanel",
[PanelId.SoldierHandbookPartnerDetailPanel] = "Game.UI.Soldier.Handbook.SoldierHandbookPartnerDetailPanel",
[PanelId.SoldierSelectStrategyCardItem] = "Game.UI.Soldier.Handbook.SoldierSelectStrategyCardItemPanel",
[PanelId.SoldierSelectStarterCardItem] = "Game.UI.Soldier.Handbook.SoldierSelectStarterCardItemPanel",
[PanelId.SoldierRecommendPanel] = "Game.UI.Soldier.Recommend.SoldierRecommendPanel",
[PanelId.SoldierRecommendDetailPanel] = "Game.UI.Soldier.Recommend.SoldierRecommendDetailPanel",
[PanelId.SoldierPartnerTips] = "Game.UI.Soldier.PartnerTipsPanel.SoldierPartnerTipsPanel",
[PanelId.SoldierGoldTips] = "Game.UI.Soldier.GoldTipsPanel.SoldierGoldTipsPanel",
[PanelId.SoldierCharAttriTips] = "Game.UI.Soldier.CharacterAttriTips.SoldierCharAttriTipsPanel",
[PanelId.SoldierCharCardTips] = "Game.UI.Soldier.CharacterTips.SoldierCharTipsPanel",
[PanelId.SoldierCharSkillPreview] = "Game.UI.Soldier.CharacterTips.SoldierCharSkillPreviewPanel",
[PanelId.SoldierCharSkillDetail] = "Game.UI.Soldier.CharacterTips.SoldierCharSkillDetailPanel",
[PanelId.SoldierCharPontentialDetailPanel] = "Game.UI.Soldier.CharacterTips.Components.SoldierCharTalentDetailPanel",
[PanelId.SoldierBattleEventPanel] = "Game.UI.Soldier.BattleEvent.SoldierBattleEventPanel",
[PanelId.SoldierResolveadisputePanel] = "Game.UI.Soldier.BattleEvent.SoldierResolveadisputePanel",
[PanelId.SoldierShopProbabilityPanel] = "Game.UI.Soldier.ShopProbability.SoldierShopProbabilityPanel",
[PanelId.Task_20103] = "Game.UI.ActivityTheme.20103.Task.SummerCheckinTaskPanel",
[PanelId.Shop_20103] = "Game.UI.ActivityTheme.20103.Shop.ActivityShopPanel",
[PanelId.Main_20103] = "Game.UI.ActivityTheme.20103.SummerCheckinThemePanel",
[PanelId.ActivityLevelsSelectPanel_20103] = "Game.UI.ActivityTheme.20103.ActivityLevels.ActivityLevelsSelectPanel",
[PanelId.SummerCheckinStory_20103] = "Game.UI.ActivityTheme.20103.Story.SummerCheckinStoryPanel",
[PanelId.IceCreamTruckGamePanel] = "Game.UI.Play_IceCreamTruck.Play.IceCreamTruckGamePanel",
[PanelId.IceCreamLevelsSelectPanel] = "Game.UI.Play_IceCreamTruck.IceCreamLevelsSelectPanel",
[PanelId.ActivityLevelsSelectPanel_10110] = "Game.UI.ActivityTheme.10110.ActivityLevels.ActivityLevelsSelectPanel",
[PanelId.Task_10110] = "Game.UI.ActivityTheme.10110.Task.SummerAdvTaskPanel",
[PanelId.Shop_10110] = "Game.UI.ActivityTheme.10110.Shop.ActivityShopPanel",
[PanelId.SummerAdvPanel] = "Game.UI.ActivityTheme.10110.SummerAdvPanel",
[PanelId.SummerAdvStory_10110] = "Game.UI.ActivityTheme.10110.Story.SummerAdvStoryPanel",
[PanelId.BreakOutThemePanel_S3] = "Game.UI.ActivityTheme.30103.BreakOutThemePanel",
[PanelId.Shop_30103] = "Game.UI.ActivityTheme.30103.Shop.ActivityShopPanel",
[PanelId.Task_30103] = "Game.UI.ActivityTheme.30103.Task.BreakOutTaskPanel",
[PanelId.BreakOutLevelDetailPanelS3] = "Game.UI.Play_BreakOut_30103.BreakOutLevelDetailPanel",
[PanelId.BreakOutResultPanelS3] = "Game.UI.Play_BreakOut_30103.BreakOutResultPanel",
[PanelId.BreakOutPlayPanelS3] = "Game.UI.Play_BreakOut_30103.BreakOutPlayPanel"
}
if NovaAPI.GetClientChannel() == AllEnum.ChannelName.BanShu then
end
+76 -24
View File
@@ -1,3 +1,4 @@
local SoldierBuffTipsPanel = require("Game.UI.Soldier.Sandtable.Components.SoldierBuffTipsPanel")
local PanelId = {
AvgEditorMultiLanTool = -6,
ExeEditor = -4,
@@ -19,6 +20,7 @@ local PanelId = {
CharList = 21,
GachaSpin = 22,
GachaGet = 23,
FriendAddStranger = 24,
CharacterSkinPanel = 26,
ShopPanel = 27,
ReceiveSpecialReward = 28,
@@ -90,6 +92,7 @@ local PanelId = {
DiscSucBar = 201,
SkillSucBar = 204,
CharSucBar = 205,
TraceHuntSucBar = 206,
CharBgPanel = 207,
CampingJoystick = 209,
BattleResultMask = 210,
@@ -106,8 +109,15 @@ local PanelId = {
CraftingTip = 232,
SubSkillDisplay = 225,
PenguinCard = 226,
PenguinCardEndless = 237,
PenguinCardQuest = 227,
PenguinCardLevel = 228,
TraceHunt = 229,
TraceHuntLevel = 230,
TraceHuntHelp = 233,
TraceHuntHandBook = 234,
TraceHuntBattle = 235,
TraceHuntResult = 236,
ActivityList = 241,
ActivityPopUp = 242,
ActivityInfinity = 243,
@@ -210,10 +220,10 @@ local PanelId = {
TowerDefenseCharacterDetailPanel = 137,
TowerDefenseHUD = 138,
TowerDefenseQuest = 139,
JointDrillLevelSelect_510001 = 140,
JointDrillBuildList_510001 = 141,
JointDrillLevelSelect_Mode1 = 140,
JointDrillBuildList_Mode1 = 141,
JointDrillBattlePanel = 142,
JointDrillResult_510001 = 144,
JointDrillResult_Mode1 = 144,
NPCAffinityLevelUp = 145,
StoryEntrance = 146,
BuildAttribute = 147,
@@ -221,17 +231,17 @@ local PanelId = {
SwimTheme = 149,
TutorialPanel = 280,
CreatePlayer = 150,
JointDrillRankUp_510001 = 151,
JointDrillQuest_510001 = 152,
JointDrillRankUp_Mode1 = 151,
JointDrillQuest_Mode1 = 152,
TowerDefenseResultPanel = 153,
ScoreBossRankingPanel = 154,
TowerDefenseTipsPanel = 155,
ActivityLevelsBattlePanel = 156,
ActivityLevelsSelectPanel = 157,
ActivityLevelsInstanceResultPanel = 158,
JointDrillRanking_510001 = 159,
JointDrillRankDetail_510001 = 160,
JointDrillRaid_510001 = 161,
JointDrillRanking_Mode1 = 159,
JointDrillRankDetail_Mode1 = 160,
JointDrillRaid_Mode1 = 161,
MiningGameGuidePanel = 162,
SwimThemeStory = 163,
BuildAttrPreview = 164,
@@ -298,14 +308,14 @@ local PanelId = {
CookieGamePanel_400004 = 384,
Main_10103 = 385,
ThrowGiftPanel = 386,
JointDrillLevelSelect_510003 = 387,
JointDrillBuildList_510003 = 388,
JointDrillResult_510003 = 389,
JointDrillRankUp_510003 = 390,
JointDrillQuest_510003 = 391,
JointDrillRanking_510003 = 392,
JointDrillRankDetail_510003 = 393,
JointDrillRaid_510003 = 394,
JointDrillLevelSelect_Mode2 = 387,
JointDrillBuildList_Mode2 = 388,
JointDrillResult_Mode2 = 389,
JointDrillRankUp_Mode2 = 390,
JointDrillQuest_Mode2 = 391,
JointDrillRanking_Mode2 = 392,
JointDrillRankDetail_Mode2 = 393,
JointDrillRaid_Mode2 = 394,
ActivityLevelsSelectPanel_10104 = 395,
Shop_10104 = 396,
Task_10104 = 397,
@@ -368,14 +378,6 @@ local PanelId = {
TechStory = 456,
CookieBoardPanel_400010 = 457,
CookieGamePanel_400010 = 458,
JointDrillLevelSelect_510005 = 459,
JointDrillBuildList_510005 = 460,
JointDrillResult_510005 = 461,
JointDrillRankUp_510005 = 462,
JointDrillQuest_510005 = 463,
JointDrillRanking_510005 = 464,
JointDrillRankDetail_510005 = 465,
JointDrillRaid_510005 = 466,
DoubleDropActQuestPanel_103001 = 467,
ActivityLevelsSelectPanel_10109 = 468,
GunStormPanel = 469,
@@ -387,6 +389,56 @@ local PanelId = {
GoldenSpyBuffSelectPanel_400012 = 475,
GoldenSpyResultPanel_400012 = 476,
GoldenSpyBuffTipsPanel_400012 = 477,
MiningGame_400014 = 478,
MiningGameGuidePanel_400014 = 479,
MiningGameQuestPanel_400014 = 480,
SoldierBattlePanel = 481,
SoldierBattleResult = 482,
SoldierMainViewPanel = 483,
SoldierLevelSelectPanel = 484,
SoldierHandbookPanel = 485,
SoldierQuestPanel = 486,
SoldierHandbookSelectPanel = 487,
SoldierHandbookPartnerDetailPanel = 496,
SoldierRecommendPanel = 497,
SoldierRecommendDetailPanel = 498,
SoldierSelectPolicy = 488,
SoldierSandtable = 489,
ActivityLevelsSelectPanel_20103 = 490,
Main_20103 = 491,
SummerCheckinStory_20103 = 492,
Task_20103 = 493,
Shop_20103 = 494,
SoldierNodeTips = 495,
SoldierPartnerTips = 499,
SoldierGoldTips = 5000,
SoldierCharAttriTips = 5001,
SoldierCharCardTips = 5002,
SoldierCharSkillPreview = 5003,
SoldierCharSkillDetail = 5004,
SoldierBuffTipsPanel = 5005,
SoldierCharPontentialDetailPanel = 5006,
SoldierSelectStrategyCardItem = 5007,
SoldierSelectStarterCardItem = 5008,
CookieBoardPanel_400016 = 500,
CookieGamePanel_400016 = 501,
IceCreamTruckGamePanel = 502,
IceCreamLevelsSelectPanel = 503,
SoldierBattleEventPanel = 504,
SoldierResolveadisputePanel = 505,
SoldierShopProbabilityPanel = 506,
ActivityLevelsSelectPanel_10110 = 507,
SummerAdvPanel = 508,
SummerAdvStory_10110 = 509,
Task_10110 = 510,
Shop_10110 = 511,
Shop_30103 = 512,
BreakOutThemePanel_S3 = 513,
Task_30103 = 514,
BreakOutLevelDetailPanelS3 = 515,
BreakOutResultPanelS3 = 516,
BreakOutPlayPanelS3 = 517,
SoldierTestEnter = 99998,
GmTools = 99999
}
return PanelId
+4
View File
@@ -456,6 +456,9 @@ local ResetTouchEffect = function()
NovaAPI.ResetTouchEffect(trNode:Find("TouchEffectUI/fxContainer"), objMain, objSlide)
end
end
local RegisterTextGetContentFun = function()
CS.TextMeshProWrap.GetTextFunc = ConfigTable.GetUIText
end
function PanelManager.Init()
local goUIRoot = GameObject.Find("==== UI ROOT ====")
if goUIRoot ~= nil then
@@ -482,6 +485,7 @@ function PanelManager.Init()
tbBackHistory = {}
tbDisposablePanel = {}
mapDefinePanel = require("GameCore.UI.PanelDefine")
RegisterTextGetContentFun()
AddEventCallback()
InitGuidePanel()
InitTransitionPanel()
+40
View File
@@ -0,0 +1,40 @@
local UIObjs = class("UIObjs")
local _instanceIndex = function(t, name)
local v = rawget(UIObjs, name)
if v ~= nil then
return v
end
if name == "_keys" then
local _keys = string.split(t._CSUIObjs.Keys, ",")
rawset(t, "_keys", _keys)
return _keys
end
local maps = t._objMaps
local cached = maps[name]
if cached ~= nil then
return cached
end
local obj = t._CSUIObjs:Get(name)
if obj == nil then
return nil
end
maps[name] = obj
local type_name = obj:GetType().Name
t._objTypeMaps[name] = type_name
return obj, type_name
end
function UIObjs:ctor(CSUIObjs, ctrl)
self._CSUIObjs = CSUIObjs
self._objMaps = {}
self._objTypeMaps = {}
self._ctrl = ctrl
setmetatable(self, {__index = _instanceIndex})
end
function UIObjs:Get(name)
local obj = self[name]
if obj == nil then
return nil, nil
end
return obj, self._objTypeMaps[name]
end
return UIObjs