2020-11-27 17:59:25 +08:00
|
|
|
|
HarmonyManager = {}
|
|
|
|
|
local this = HarmonyManager
|
2020-12-15 11:03:34 +08:00
|
|
|
|
--
|
|
|
|
|
-- 第一阶段 鸿蒙阵数据
|
2020-11-27 17:59:25 +08:00
|
|
|
|
this.hongmengGuards = {}
|
|
|
|
|
this.hongmengHeroInfos = {}
|
|
|
|
|
this.hongmengTablet = 0
|
|
|
|
|
this.hongmengAdditions = {}
|
|
|
|
|
|
2020-12-15 11:03:34 +08:00
|
|
|
|
this.GuardList = {}
|
|
|
|
|
local SelectId = nil
|
|
|
|
|
|
|
|
|
|
HarmonyManager.GongMingBox = 0;
|
|
|
|
|
HarmonyManager.UnLoadGongMing = 0
|
|
|
|
|
--判断是否鸿蒙共享数据
|
|
|
|
|
local equipConfig = ConfigManager.GetConfig(ConfigName.EquipConfig)
|
|
|
|
|
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
|
|
|
|
|
|
|
|
|
HarmonyManager.equipCount = 0
|
|
|
|
|
this.hongmengGongMingList = {}
|
|
|
|
|
this.ChooseDataList = {}
|
|
|
|
|
|
|
|
|
|
-- 第二阶段 鸿蒙塔 数据
|
|
|
|
|
HarmonyManager.EnvoyList = {} --330 鸿蒙使者 数据
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-- 鸿蒙塔升级数据表
|
|
|
|
|
local HongmengUp = ConfigManager.GetConfig(ConfigName.HongmengUp)
|
|
|
|
|
|
2020-11-27 17:59:25 +08:00
|
|
|
|
function this:InitHongMengData(hongmengGuards, hongmengHeroInfos, hongmengTablet, hongmengAdditions)
|
|
|
|
|
-- body
|
|
|
|
|
this.hongmengGuards = hongmengGuards
|
2020-12-15 11:03:34 +08:00
|
|
|
|
--LogGreen(#this.hongmengGuards)
|
2020-11-27 17:59:25 +08:00
|
|
|
|
this.hongmengHeroInfos = hongmengHeroInfos
|
2020-12-15 11:03:34 +08:00
|
|
|
|
--LogGreen(#this.hongmengHeroInfos)
|
|
|
|
|
|
|
|
|
|
--LogBlue("hongmengTablet "..hongmengTablet)
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
this.hongmengHeroInfos[i].time = this.hongmengHeroInfos[i].time + GetTimeStamp()
|
|
|
|
|
end
|
2020-11-27 17:59:25 +08:00
|
|
|
|
this.hongmengTablet = hongmengTablet
|
|
|
|
|
this.hongmengAdditions = hongmengAdditions
|
2020-12-15 11:03:34 +08:00
|
|
|
|
for i = 1, #this.hongmengAdditions do
|
|
|
|
|
if this.hongmengAdditions[i].additionType == HarmonyAddType.AddEquip then
|
|
|
|
|
if this.hongmengAdditions[i].value ~= -1 then
|
|
|
|
|
local curEquipIdList = {}
|
|
|
|
|
local curEquipConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.EquipConfig,"Star",this.hongmengAdditions[i].value)
|
|
|
|
|
for i = 1, #curEquipConfigs do
|
|
|
|
|
|
|
|
|
|
table.insert(curEquipIdList,curEquipConfigs[i].Id)
|
|
|
|
|
end
|
|
|
|
|
this.HarmonyUpdateEquipData(curEquipIdList, "")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-11-27 17:59:25 +08:00
|
|
|
|
|
2020-12-15 11:03:34 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--初始化共鸣列表数据
|
|
|
|
|
function this:InitGongMingDataList()
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
local data = HeroManager.GetSingleHeroData(this.hongmengHeroInfos[i].heroId)
|
|
|
|
|
|
|
|
|
|
if data then
|
|
|
|
|
|
|
|
|
|
this.hongmengGongMingList[i] = data
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
this.hongmengGongMingList[i] = nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
--鸿蒙塔上限
|
|
|
|
|
function this:HongMengTowerUpLimit()
|
|
|
|
|
local list = HeroManager.GetAllHeroDatas(330)
|
|
|
|
|
local temp_list = {}
|
|
|
|
|
for i = 1, #list do
|
|
|
|
|
-- body
|
|
|
|
|
table.insert(temp_list,list[i])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for k1, v1 in ipairs(list) do
|
|
|
|
|
for k2, v2 in ipairs(temp_list) do
|
|
|
|
|
--同种英雄同一星级的移除
|
|
|
|
|
if v1.dynamicId ~= v2.dynamicId and v1.value == v2.value and v1.name == v2.name then
|
|
|
|
|
table.remove(list, k1)
|
|
|
|
|
table.remove(temp_list, k1)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return #temp_list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.IsInfo(did)
|
|
|
|
|
if did ~= "" then
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
if did == this.hongmengHeroInfos[i].heroId and this.hongmengHeroInfos[i].heroId ~= "" then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
function this.IsChangeColor(did)
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
if did == this.hongmengHeroInfos[i].heroId then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:IsGongMing(did)
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
-- body
|
|
|
|
|
if did == this.hongmengHeroInfos[i].heroId then
|
|
|
|
|
PopupTipPanel.ShowTip("共鸣ing")
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
-- body
|
|
|
|
|
end
|
|
|
|
|
function this:SetInitList()
|
|
|
|
|
local heroDataList = HeroManager.GetAllHeroDatas(1)
|
|
|
|
|
local list = {}
|
|
|
|
|
local count = 0;
|
|
|
|
|
--LogBlue("this.GuardList长度:"..LengthOfTable(this.GuardList))
|
|
|
|
|
for key, value in pairs(this.GuardList) do
|
|
|
|
|
table.insert(list,value)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
if this.hongmengHeroInfos[i].heroId ~= "" then
|
|
|
|
|
-- LogYellow("是否有数据:"..i)
|
|
|
|
|
local data = HeroManager.GetSingleHeroData(this.hongmengHeroInfos[i].heroId)
|
|
|
|
|
table.insert(list,data)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
table.sort(list,function(a,b)
|
|
|
|
|
return a.dynamicId < b.dynamicId
|
|
|
|
|
end)
|
|
|
|
|
--LogBlue("#list长度:"..#list)
|
|
|
|
|
local newList = {}
|
|
|
|
|
local index = 0
|
|
|
|
|
local flag = true
|
|
|
|
|
|
|
|
|
|
local tempTable = {}
|
|
|
|
|
for i = 1, #heroDataList do
|
|
|
|
|
table.insert(tempTable,heroDataList[i])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for i = #heroDataList, 1,-1 do
|
|
|
|
|
for k2, v2 in pairs(list) do
|
|
|
|
|
if v2.dynamicId == heroDataList[i].dynamicId then
|
|
|
|
|
--LogPink("第几个:"..i.." k2"..k2)
|
|
|
|
|
table.remove(tempTable,i)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
this.ChooseDataList = tempTable
|
|
|
|
|
|
|
|
|
|
-- LogBlue("#this.ChooseDataList长度:"..#this.ChooseDataList)
|
|
|
|
|
end
|
|
|
|
|
--初始化 鸿蒙塔的数据
|
|
|
|
|
function this:SetTowerInit()
|
|
|
|
|
|
|
|
|
|
local heroDataList = HeroManager.GetAllHeroDatas(1)
|
|
|
|
|
local list = {}
|
|
|
|
|
local count = 0;
|
|
|
|
|
this.GuardList = HeroManager.GetAllHeroDatas(330)
|
|
|
|
|
-- LogBlue("this.GuardList长度:"..LengthOfTable(this.GuardList))
|
|
|
|
|
for key, value in pairs(this.GuardList) do
|
|
|
|
|
table.insert(list,value)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--LogBlue("#this.hongmengHeroInfos"..#this.hongmengHeroInfos)
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
if this.hongmengHeroInfos[i].heroId ~= "" then
|
|
|
|
|
--LogYellow("是否有数据:"..i)
|
|
|
|
|
local data = HeroManager.GetSingleHeroData(this.hongmengHeroInfos[i].heroId)
|
|
|
|
|
table.insert(list,data)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
table.sort(list,function(a,b)
|
|
|
|
|
return a.dynamicId < b.dynamicId
|
|
|
|
|
end)
|
|
|
|
|
--LogBlue("#list长度:"..#list)
|
|
|
|
|
local newList = {}
|
|
|
|
|
local index = 0
|
|
|
|
|
local flag = true
|
|
|
|
|
|
|
|
|
|
local tempTable = {}
|
|
|
|
|
for i = 1, #heroDataList do
|
|
|
|
|
table.insert(tempTable,heroDataList[i])
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
for i = #heroDataList, 1,-1 do
|
|
|
|
|
for k2, v2 in pairs(list) do
|
|
|
|
|
if v2.dynamicId == heroDataList[i].dynamicId then
|
|
|
|
|
-- LogPink("第几个:"..i.." k2"..k2)
|
|
|
|
|
table.remove(tempTable,i)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
this.ChooseDataList = tempTable
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- function this:IsEnvoy(did)
|
|
|
|
|
-- -- body
|
|
|
|
|
-- for i = 1, #this.hongmengGuards do
|
2020-11-27 17:59:25 +08:00
|
|
|
|
-- -- body
|
2020-12-15 11:03:34 +08:00
|
|
|
|
-- if did==this.hongmengGuards[i] then
|
|
|
|
|
-- -- body
|
|
|
|
|
-- return true
|
|
|
|
|
-- end
|
|
|
|
|
|
2020-11-27 17:59:25 +08:00
|
|
|
|
-- end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
-- return false
|
|
|
|
|
-- end
|
|
|
|
|
|
|
|
|
|
--初始化鸿蒙使者的数据
|
|
|
|
|
function this:InitEnvoyList()
|
|
|
|
|
for i = 1, #this.hongmengGuards do
|
|
|
|
|
-- body
|
|
|
|
|
local data = HeroManager.GetSingleHeroData(this.hongmengGuards[i])
|
|
|
|
|
if data then
|
|
|
|
|
this.EnvoyList[i] = data
|
|
|
|
|
else
|
|
|
|
|
this.EnvoyList[i] = nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
--是否是鸿蒙使者
|
|
|
|
|
function this:IsEnvoy(did)
|
|
|
|
|
if this.EnvoyList then
|
|
|
|
|
-- body
|
|
|
|
|
for i = 1, #this.EnvoyList do
|
|
|
|
|
-- body
|
|
|
|
|
if this.EnvoyList[i] then
|
|
|
|
|
-- body
|
|
|
|
|
if this.EnvoyList[i].dynamicId == did then
|
|
|
|
|
-- body
|
|
|
|
|
-- print(did)
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
-- 设置、获取鸿蒙守卫的列表
|
|
|
|
|
function this:SetGuardList(list,count)
|
|
|
|
|
for key, value in pairs(list) do
|
|
|
|
|
if key<=count then
|
|
|
|
|
-- body
|
|
|
|
|
this.GuardList[value.dynamicId] = value
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
function this:GetGuardList()
|
|
|
|
|
return this.GuardList
|
|
|
|
|
-- body
|
2020-11-27 17:59:25 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-12-15 11:03:34 +08:00
|
|
|
|
function this:SetGongMingList(Id)
|
|
|
|
|
local data = HeroManager.GetSingleHeroData(Id)
|
|
|
|
|
table.insert(this.hongmengGongMingList,data)
|
2020-11-27 17:59:25 +08:00
|
|
|
|
|
2020-12-15 11:03:34 +08:00
|
|
|
|
end
|
2020-11-27 17:59:25 +08:00
|
|
|
|
|
2020-12-15 11:03:34 +08:00
|
|
|
|
function this:RemoveGongMingList(Id)
|
|
|
|
|
local data = HeroManager.GetSingleHeroData(Id)
|
|
|
|
|
for key, value in pairs(this.hongmengGongMingList) do
|
|
|
|
|
if value then
|
|
|
|
|
-- body
|
|
|
|
|
if value==data then
|
|
|
|
|
-- body
|
|
|
|
|
value = nil
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:GetGongMingListSingle(Id)
|
|
|
|
|
local data = HeroManager.GetSingleHeroData(Id)
|
|
|
|
|
--return data
|
|
|
|
|
--print(data.dynamicId,"~~~",Id)
|
|
|
|
|
for key, value in pairs(this.hongmengGongMingList) do
|
|
|
|
|
|
|
|
|
|
if value.dynamicId==data.dynamicId then
|
|
|
|
|
|
|
|
|
|
return value
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
function this:SetChooseId(id)
|
|
|
|
|
SelectId = id
|
|
|
|
|
end
|
|
|
|
|
-- 设置、获取卸载的数据
|
|
|
|
|
function this:SetMingListIndexData(index)
|
|
|
|
|
SelectId = HeroManager.GetSingleHeroData(this.hongmengHeroInfos[index].heroId).dynamicId
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function this:GetUnLoadData()
|
|
|
|
|
-- body
|
|
|
|
|
return SelectId
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--获取加成
|
|
|
|
|
function this:GetAdditions()
|
|
|
|
|
|
|
|
|
|
return this.hongmengAdditions
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetSingleAdditions(type)
|
|
|
|
|
for i = 1, #this.hongmengAdditions do
|
|
|
|
|
if this.hongmengAdditions[i].additionType == type then
|
|
|
|
|
return this.hongmengAdditions[i].value
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return 0
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this:GetHongMengUpData()
|
|
|
|
|
|
|
|
|
|
for key, value in ConfigPairs(HongmengUp) do
|
|
|
|
|
-- body
|
|
|
|
|
if value.HongmengLevel == this.hongmengTablet+1 then
|
|
|
|
|
-- body
|
|
|
|
|
return ConfigManager.TryGetConfigData(ConfigName.HongmengUp,key)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--鸿蒙共享装备临时数据
|
|
|
|
|
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
|
local equipStarsConfig = ConfigManager.GetConfig(ConfigName.EquipStarsConfig)
|
|
|
|
|
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
|
|
|
|
function this.InitUpdateEquipData(id, upHeroDid)
|
|
|
|
|
if not this.equipDatas then
|
|
|
|
|
this.equipDatas = {}
|
|
|
|
|
end
|
|
|
|
|
id = tonumber(id)
|
|
|
|
|
if this.equipDatas[id] then
|
|
|
|
|
if not this.equipDatas[id].upHeroDidList then
|
|
|
|
|
this.equipDatas[id].upHeroDidList = {}
|
|
|
|
|
end
|
|
|
|
|
if upHeroDid and upHeroDid ~= "0" then
|
|
|
|
|
this.equipDatas[id].upHeroDidList[upHeroDid] = upHeroDid
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
local equipdata = {}
|
|
|
|
|
equipdata.equipConfig = equipConfig[id]
|
|
|
|
|
equipdata.itemConfig = itemConfig[id]
|
|
|
|
|
equipdata.id = id
|
|
|
|
|
if itemConfig[equipdata.id] then
|
|
|
|
|
equipdata.icon = GetResourcePath(itemConfig[equipdata.id].ResourceID)
|
|
|
|
|
else
|
|
|
|
|
Log(Language[10483] .. equipdata.id)
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
equipdata.frame = GetQuantityImageByquality(equipdata.equipConfig.Quality)
|
|
|
|
|
equipdata.quality = equipdata.equipConfig.Quality
|
|
|
|
|
equipdata.position = equipdata.equipConfig.Position
|
|
|
|
|
|
|
|
|
|
equipdata.mainAttribute = this.GetMainProList(equipdata.equipConfig)
|
|
|
|
|
|
|
|
|
|
equipdata.backData = equipdata
|
|
|
|
|
equipdata.star = equipStarsConfig[equipdata.equipConfig.Star].Stars
|
|
|
|
|
this.equipDatas[id] = equipdata
|
|
|
|
|
if not this.equipDatas[id].upHeroDidList then
|
|
|
|
|
this.equipDatas[id].upHeroDidList = {}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if upHeroDid and upHeroDid ~= "0" and not this.equipDatas[id].upHeroDidList[upHeroDid] then
|
|
|
|
|
this.equipDatas[id].upHeroDidList[upHeroDid] = upHeroDid
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.HarmonyUpdateEquipData(idlist, heroDid)
|
|
|
|
|
for i = 1, #idlist do
|
|
|
|
|
this.InitUpdateEquipData(idlist[i], heroDid, false)
|
|
|
|
|
end
|
|
|
|
|
|
2020-11-27 17:59:25 +08:00
|
|
|
|
end
|
2020-12-15 11:03:34 +08:00
|
|
|
|
--判断神将的装备是否共鸣
|
|
|
|
|
function this:IsShowGongMingEqiup(id)
|
|
|
|
|
for i = 1, #this.hongmengHeroInfos do
|
|
|
|
|
-- body
|
|
|
|
|
if id == this.hongmengHeroInfos[i].heroId then
|
|
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
else
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-11-27 17:59:25 +08:00
|
|
|
|
|
2020-12-15 11:03:34 +08:00
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetMainProList(equipConfig)
|
|
|
|
|
local propList = {}
|
|
|
|
|
for index, prop in ipairs(equipConfig.Property) do
|
|
|
|
|
propList[index] = {}
|
|
|
|
|
propList[index].propertyId = prop[1]
|
|
|
|
|
propList[index].propertyValue = prop[2]
|
|
|
|
|
propList[index].PropertyConfig = propertyConfig[prop[1]]
|
|
|
|
|
end
|
|
|
|
|
return propList
|
|
|
|
|
end
|
2020-11-27 17:59:25 +08:00
|
|
|
|
return HarmonyManager
|