2021-09-06 17:21:53 +08:00
|
|
|
QiJieShiLianManager = {}
|
|
|
|
local this = QiJieShiLianManager
|
|
|
|
local QijieHolyConfig = ConfigManager.GetConfig(ConfigName.QijieHolyConfig)
|
|
|
|
local QijieRanking = ConfigManager.GetConfig(ConfigName.QijieRanking)
|
|
|
|
local QijieStage = ConfigManager.GetConfig(ConfigName.QijieStage)
|
|
|
|
local QijieStageBuff = ConfigManager.GetConfig(ConfigName.QijieStageBuff)
|
|
|
|
local QijieTreasure = ConfigManager.GetConfig(ConfigName.QijieTreasure)
|
|
|
|
local QijieUpgrade = ConfigManager.GetConfig(ConfigName.QijieUpgrade)
|
2021-09-07 18:09:33 +08:00
|
|
|
local HeroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
2021-09-06 17:21:53 +08:00
|
|
|
|
|
|
|
function this.Initialize()
|
2021-09-07 18:09:33 +08:00
|
|
|
this.curLevelId = 3004
|
|
|
|
this.curRank = 999
|
|
|
|
this.curScore = 1
|
|
|
|
this.curStageId = 1
|
2021-09-08 16:26:40 +08:00
|
|
|
this.curProgress = 0
|
|
|
|
|
|
|
|
this.treasureList = {}
|
|
|
|
this.InitTreasureData()
|
|
|
|
end
|
|
|
|
|
|
|
|
function this.InitTreasureData()
|
|
|
|
for _, configInfo in ConfigPairs(QijieHolyConfig) do
|
|
|
|
if configInfo.Id ~= 0 then
|
|
|
|
local data = {}
|
|
|
|
data.Id = configInfo.Id
|
|
|
|
data.Name = configInfo.Name
|
|
|
|
data.Quality = configInfo.Quality
|
|
|
|
data.Icon = configInfo.Icon
|
|
|
|
data.Position = configInfo.Position
|
|
|
|
data.Attri = configInfo.Attri
|
|
|
|
data.Cost = configInfo.Cost
|
|
|
|
data.Addition = configInfo.Addition
|
|
|
|
this.treasureList[data.Id] = data
|
|
|
|
end
|
|
|
|
end
|
2021-09-06 17:21:53 +08:00
|
|
|
end
|
|
|
|
|
2021-09-07 18:09:33 +08:00
|
|
|
--界面获取信息
|
|
|
|
function this.GetQiJieData()
|
|
|
|
--上阵列表赋值
|
|
|
|
local curFormation = FormationManager.GetFormationByID(FormationTypeDef.FORMATION_NORMAL)
|
|
|
|
this.formationList ={}
|
|
|
|
for j = 1, #curFormation.teamHeroInfos do
|
|
|
|
if curFormation.teamHeroInfos[j] then
|
|
|
|
table.insert(this.formationList,HeroManager.GetSingleHeroData(curFormation.teamHeroInfos[j].heroId).heroConfig)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
--界面信息
|
|
|
|
local data = {}
|
|
|
|
data.curLevelId = this.curLevelId
|
|
|
|
data.curRank = this.curRank
|
|
|
|
data.curScore = this.curScore
|
2021-09-08 16:26:40 +08:00
|
|
|
data.curProgress = this.curProgress
|
2021-09-07 18:09:33 +08:00
|
|
|
data.curStageData = QijieStage[this.curLevelId]
|
|
|
|
return data
|
2021-09-06 17:21:53 +08:00
|
|
|
end
|
|
|
|
|
2021-09-07 18:09:33 +08:00
|
|
|
--进入界面前 获取服务器信息
|
|
|
|
function this.GetEnterDataFromServer(func)
|
|
|
|
NetManager.EnterQiJieShiLianRequest(function (msg)
|
|
|
|
this.RefreshDataFromServer(msg,func)
|
|
|
|
end)
|
|
|
|
end
|
|
|
|
|
|
|
|
--从服务器获取信息
|
|
|
|
function this.RefreshDataFromServer(msg,func)
|
|
|
|
this.curLevelId = msg.curLevelId
|
|
|
|
this.curRank = msg.curRank
|
|
|
|
this.curScore = msg.curScore
|
2021-09-08 16:26:40 +08:00
|
|
|
this.curProgress = msg.progress
|
2021-09-07 18:09:33 +08:00
|
|
|
if func then
|
|
|
|
func()
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
--获取下方滑动条数据
|
|
|
|
function this.GetTabList()
|
|
|
|
local tabList = {}
|
|
|
|
for _, configInfo in ConfigPairs(QijieStage) do
|
|
|
|
if not tabList[configInfo.QijieType] then
|
|
|
|
tabList[configInfo.QijieType] = configInfo
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return tabList
|
|
|
|
end
|
|
|
|
|
|
|
|
--检测该条目是否达成
|
|
|
|
function this.CheckGoalIsFinish(_dataId,_obj)
|
|
|
|
local goalData = QijieUpgrade[_dataId]
|
|
|
|
local tempList = {}
|
|
|
|
local final = true
|
|
|
|
for i = 1, #this.formationList do
|
|
|
|
table.insert(tempList,this.formationList[i])
|
|
|
|
end
|
|
|
|
-- LogGreen("Id:"..tostring(goalData.Id).." Describe:"..tostring(goalData.Describe).." PropertyName:"..tostring(goalData.PropertyName).." Profession:"..tostring(goalData.Profession).." Min:"..tostring(goalData.Min).." Max:"..tostring(goalData.Max))
|
|
|
|
if goalData.PropertyName and goalData.PropertyName > 0 then
|
|
|
|
for i = #tempList, 1,-1 do
|
|
|
|
if goalData.PropertyName ~= tempList[i].PropertyName then
|
|
|
|
table.remove(tempList,i)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if goalData.Profession and goalData.Profession > 0 then
|
|
|
|
for i = #tempList, 1,-1 do
|
|
|
|
if goalData.Profession ~= tempList[i].Profession then
|
|
|
|
table.remove(tempList,i)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if #tempList > 0 and goalData.Min and goalData.Min >= 0 then
|
|
|
|
if #tempList < goalData.Min then
|
|
|
|
final = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
if #tempList > 0 and goalData.Max and goalData.Max >= 0 then
|
|
|
|
if #tempList > goalData.Max then
|
|
|
|
final = false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
_obj.text = string.format( "<color=#BAAF98>%s</color>",goalData.Describe)
|
|
|
|
if final then
|
|
|
|
_obj.text = string.format( "<color=#27DD65>%s</color>",goalData.Describe)
|
|
|
|
end
|
|
|
|
return final
|
|
|
|
end
|
|
|
|
|
2021-09-08 16:26:40 +08:00
|
|
|
function this.MixTreasureServerAndLocalData(func)
|
|
|
|
-- NetManager.requestTreasure()
|
|
|
|
if func then
|
|
|
|
func()
|
|
|
|
end
|
|
|
|
end
|
2021-09-07 18:09:33 +08:00
|
|
|
|
2021-09-08 16:26:40 +08:00
|
|
|
function this.FormatTreasureData()
|
|
|
|
local num = math.ceil( LengthOfTable(this.treasureList)/4 )
|
|
|
|
local dataList = {}
|
|
|
|
for i = 1, num do
|
|
|
|
dataList[i] = {}
|
|
|
|
for j = 1, 4 do
|
|
|
|
if this.treasureList[(i-1)*4+j] then
|
|
|
|
dataList[i][j] = this.treasureList[(i-1)*4+j]
|
|
|
|
-- LogRed("Id:"..tostring(this.treasureList[(i-1)*4+j].Id))
|
|
|
|
else
|
|
|
|
return dataList
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
return dataList
|
|
|
|
end
|
2021-09-07 18:09:33 +08:00
|
|
|
|
2021-09-06 17:21:53 +08:00
|
|
|
return QiJieShiLianManager
|