2021-09-14 14:45:22 +08:00
|
|
|
|
LikabilityManager = {}
|
|
|
|
|
local this = LikabilityManager
|
2021-09-22 20:47:13 +08:00
|
|
|
|
local PropertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
|
|
|
|
local PrivilegeTypeConfig = ConfigManager.GetConfig(ConfigName.PrivilegeTypeConfig)
|
2021-09-26 09:54:58 +08:00
|
|
|
|
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
|
|
|
|
local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
2021-09-22 20:47:13 +08:00
|
|
|
|
this.heroDatas = {}
|
2021-09-26 09:54:58 +08:00
|
|
|
|
|
2021-09-14 14:45:22 +08:00
|
|
|
|
function this.Initialize()
|
|
|
|
|
this.AllHeroDataLikAbility = {}
|
|
|
|
|
this.HeroLvList = {}
|
|
|
|
|
this.TotalLvList = {}
|
2021-09-26 09:54:58 +08:00
|
|
|
|
this.ItemList = {}
|
|
|
|
|
this.InitializeTableData()
|
2021-09-14 14:45:22 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-09-26 20:23:08 +08:00
|
|
|
|
|
2021-09-14 14:45:22 +08:00
|
|
|
|
function this.InitializeTableData()
|
2021-09-22 20:47:13 +08:00
|
|
|
|
for k,v in ConfigPairs(ConfigManager.GetConfig(ConfigName.LikeAbility)) do
|
|
|
|
|
local data = {}
|
|
|
|
|
data.Id = v.Id
|
|
|
|
|
data.Type = v.Type
|
|
|
|
|
data.lv = v.Level
|
2021-09-26 13:55:57 +08:00
|
|
|
|
data.value = this.GetTotalValue(data.lv,v.Type)
|
2021-09-26 10:18:51 +08:00
|
|
|
|
data.Property = v.Property
|
2021-09-22 20:47:13 +08:00
|
|
|
|
data.priPro = v.PrivilegeProperty
|
|
|
|
|
if v.Type == 1 then
|
|
|
|
|
table.insert(this.TotalLvList,data)
|
|
|
|
|
else
|
|
|
|
|
table.insert(this.HeroLvList,data)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
table.sort(this.TotalLvList,function(a,b)
|
|
|
|
|
return a.lv < b.lv
|
|
|
|
|
end)
|
|
|
|
|
table.sort(this.HeroLvList,function(a,b)
|
|
|
|
|
return a.lv < b.lv
|
|
|
|
|
end)
|
2021-09-26 09:54:58 +08:00
|
|
|
|
|
|
|
|
|
local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ItemConfig,"ItemType",ItemType.likeabilityItem)
|
|
|
|
|
for i = 1,#configs do
|
|
|
|
|
if not this.ItemList[configs[i].Id] then
|
|
|
|
|
this.ItemList[configs[i].Id] = {}
|
|
|
|
|
end
|
|
|
|
|
local str = string.split(configs[i].ResolveReward,"|")
|
|
|
|
|
for j = 1,#str do
|
|
|
|
|
local str1 = string.split(str[j],"#")
|
|
|
|
|
if not this.ItemList[configs[i].Id][tonumber(str1[1])] then
|
|
|
|
|
this.ItemList[configs[i].Id][tonumber(str1[1])] = tonumber(str1[2])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-09-26 13:55:57 +08:00
|
|
|
|
function this.GetTotalValue(lv,indexType)
|
|
|
|
|
local configs = ConfigManager.GetAllConfigsDataByKey(ConfigName.LikeAbility,"Type",indexType)
|
|
|
|
|
local num = 0
|
|
|
|
|
if lv == 0 then
|
|
|
|
|
return num
|
|
|
|
|
end
|
|
|
|
|
for i = 1,lv do
|
|
|
|
|
if configs[i].FavorDegree and configs[i].FavorDegree > 0 then
|
|
|
|
|
num = num + configs[i].FavorDegree
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return num
|
|
|
|
|
end
|
|
|
|
|
|
2021-09-26 20:23:08 +08:00
|
|
|
|
-- -1 判断总好感度等级是否最大 其他 神将
|
2021-09-26 09:54:58 +08:00
|
|
|
|
function this.CheckIsMaxLv(heroId)
|
|
|
|
|
local totalCurNum,totalLv,totalNum = this.GetTotalHeroLikeLv(heroId)
|
2021-09-26 20:23:08 +08:00
|
|
|
|
if heroId < 0 then
|
|
|
|
|
if totalLv >= this.TotalLvList[#this.TotalLvList].lv then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
if totalLv >= this.HeroLvList[#this.HeroLvList].lv then
|
|
|
|
|
return true
|
|
|
|
|
end
|
2021-09-26 09:54:58 +08:00
|
|
|
|
end
|
2021-09-26 20:23:08 +08:00
|
|
|
|
|
2021-09-26 09:54:58 +08:00
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetAllItemsData()
|
|
|
|
|
local list = {}
|
|
|
|
|
for k,v in pairs(this.ItemList) do
|
|
|
|
|
local data = {}
|
|
|
|
|
data.num = BagManager.GetItemCountById(k)
|
|
|
|
|
data.id = k
|
|
|
|
|
data.property = ItemConfig[k].PropertyName
|
|
|
|
|
table.insert(list,data)
|
|
|
|
|
end
|
|
|
|
|
table.sort(list,function(a,b)
|
|
|
|
|
if a.property == b.property then
|
|
|
|
|
return a.id < b.id
|
|
|
|
|
end
|
|
|
|
|
return a.property < b.property
|
|
|
|
|
end)
|
|
|
|
|
return list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.SetRemainTimes(times,indextype)
|
|
|
|
|
if indextype < 0 then
|
|
|
|
|
this.remainTimes = this.remainTimes - times
|
|
|
|
|
elseif indextype > 0 then
|
|
|
|
|
this.remainTimes = this.remainTimes + times
|
|
|
|
|
else
|
|
|
|
|
this.remainTimes = times
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetRemainTimes()
|
|
|
|
|
return this.remainTimes
|
2021-09-14 14:45:22 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.UpdateAllBackData(msg)
|
2021-09-26 09:54:58 +08:00
|
|
|
|
this.SetRemainTimes(msg.likableRemainTime,0)
|
|
|
|
|
for i = 1,#msg.infoList do
|
|
|
|
|
this.UpdatelBackData(msg.infoList[i].heroStaticid,msg.infoList[i].likableNum)
|
2021-09-14 14:45:22 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-09-26 09:54:58 +08:00
|
|
|
|
function this.UpdatelBackData(heroId,value,isAdd)
|
2021-09-14 14:45:22 +08:00
|
|
|
|
if not this.AllHeroDataLikAbility[heroId] then
|
|
|
|
|
this.AllHeroDataLikAbility[heroId] = {}
|
2021-09-26 09:54:58 +08:00
|
|
|
|
this.AllHeroDataLikAbility[heroId].value = 0
|
|
|
|
|
this.AllHeroDataLikAbility[heroId].likeLv = 0
|
|
|
|
|
end
|
|
|
|
|
if not isAdd or isAdd == 0 then
|
|
|
|
|
this.AllHeroDataLikAbility[heroId].value = value
|
|
|
|
|
else
|
|
|
|
|
this.AllHeroDataLikAbility[heroId].value = this.AllHeroDataLikAbility[heroId].value + value
|
2021-09-14 14:45:22 +08:00
|
|
|
|
end
|
2021-09-26 09:54:58 +08:00
|
|
|
|
this.AllHeroDataLikAbility[heroId].likeLv = this.GetTotalHeroLikeLv(value)
|
2021-09-26 15:23:33 +08:00
|
|
|
|
local herodata = HeroManager.GetAllHeroList()
|
|
|
|
|
for k,v in pairs(herodata) do
|
|
|
|
|
HeroPropManager.SetFuncPropDirty(Func_Prop_Type.LikeAbility)
|
|
|
|
|
if v.id == heroId then
|
|
|
|
|
HeroPropManager.SetDirtyByType(v.id, Hero_Prop_Type.LikeAbility)
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-26 09:54:58 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.UpdatelSingleHeroData(heroId,itemId,itemNum)
|
|
|
|
|
local value = 0
|
|
|
|
|
local tempheroConfig = heroConfig[heroId]
|
|
|
|
|
value = this.ItemList[itemId][tempheroConfig.PropertyName]*itemNum
|
|
|
|
|
this.UpdatelBackData(heroId,value,1)
|
2021-09-14 14:45:22 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-09-22 20:47:13 +08:00
|
|
|
|
-- -1 总好感度 其他是神将id
|
|
|
|
|
function this.GetTotalHeroLikeLv(index)
|
|
|
|
|
local totalCurNum,totalLv,totalNum = 0,0,0
|
|
|
|
|
if index < 0 then
|
|
|
|
|
for k,v in pairs(this.AllHeroDataLikAbility) do
|
|
|
|
|
totalCurNum = totalCurNum + v.value
|
|
|
|
|
end
|
|
|
|
|
totalLv,totalNum = this.GetLv(1,totalCurNum)
|
|
|
|
|
else
|
2021-09-26 09:54:58 +08:00
|
|
|
|
totalCurNum = this.AllHeroDataLikAbility[index] and this.AllHeroDataLikAbility[index].value or 0
|
2021-09-22 20:47:13 +08:00
|
|
|
|
totalLv,totalNum = this.GetLv(2,totalCurNum)
|
2021-09-14 14:45:22 +08:00
|
|
|
|
end
|
|
|
|
|
return totalCurNum,totalLv,totalNum
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--indexType 1: 获取总好感度等级 2:获取单个神将好感度等级
|
|
|
|
|
function this.GetLv(indexType,value)
|
|
|
|
|
local list = {}
|
|
|
|
|
if indexType == 1 then
|
|
|
|
|
list = this.TotalLvList
|
|
|
|
|
else
|
|
|
|
|
list = this.HeroLvList
|
|
|
|
|
end
|
|
|
|
|
for i = 1,#list do
|
2021-09-26 13:55:57 +08:00
|
|
|
|
if value < list[i].value then
|
|
|
|
|
return list[i].lv - 1,list[i].value
|
2021-09-14 14:45:22 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--indexType 1: 获取总好感度属性 2:获取单个神将好感度属性
|
|
|
|
|
--index -1 获取累加的好感度属性 其他 获取某级的好感度属性
|
|
|
|
|
--lv 累加到某级
|
|
|
|
|
function this.GetProData(indexType,index,lv)
|
|
|
|
|
local list = {}
|
|
|
|
|
if indexType == 1 then
|
|
|
|
|
list = this.TotalLvList
|
|
|
|
|
else
|
|
|
|
|
list = this.HeroLvList
|
|
|
|
|
end
|
2021-09-22 20:47:13 +08:00
|
|
|
|
local allPro = {}
|
|
|
|
|
if index >= 0 then
|
|
|
|
|
for _,n in ipairs(list) do
|
2021-09-26 14:21:22 +08:00
|
|
|
|
if indexType == n.Type and lv == n.lv then
|
2021-09-26 13:55:57 +08:00
|
|
|
|
if n.Property and #n.Property > 0 then
|
|
|
|
|
for i = 1,#n.Property do
|
|
|
|
|
if not allPro[n.Property[i][1]] then
|
|
|
|
|
allPro[n.Property[i][1]] = 0
|
|
|
|
|
end
|
|
|
|
|
allPro[n.Property[i][1]] = allPro[n.Property[i][1]] + n.Property[i][2]
|
2021-09-22 20:47:13 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
for _,n in ipairs(list) do
|
2021-09-26 15:23:33 +08:00
|
|
|
|
if n.Property and #n.Property > 0 and lv >= n.lv then
|
2021-09-26 13:55:57 +08:00
|
|
|
|
if n.Property and #n.Property > 0 then
|
|
|
|
|
for i = 1,#n.Property do
|
|
|
|
|
if not allPro[n.Property[i][1]] then
|
|
|
|
|
allPro[n.Property[i][1]] = 0
|
|
|
|
|
end
|
|
|
|
|
allPro[n.Property[i][1]] = allPro[n.Property[i][1]] + n.Property[i][2]
|
2021-09-22 20:47:13 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return allPro
|
|
|
|
|
end
|
|
|
|
|
--获取权益属性加成
|
|
|
|
|
function this.GetPrivilageProData(indexType,index,lv)
|
|
|
|
|
local list = {}
|
|
|
|
|
if indexType == 1 then
|
|
|
|
|
list = this.TotalLvList
|
|
|
|
|
else
|
|
|
|
|
list = this.HeroLvList
|
|
|
|
|
end
|
|
|
|
|
local allPro = {}
|
|
|
|
|
if index >= 0 then
|
|
|
|
|
for _,n in ipairs(list) do
|
2021-09-26 20:23:08 +08:00
|
|
|
|
if indexType == n.Type and lv == n.lv then
|
2021-09-26 13:55:57 +08:00
|
|
|
|
if n.priPro and #n.priPro > 0 then
|
|
|
|
|
for i = 1,#n.priPro do
|
|
|
|
|
if not allPro[n.priPro[i][1]] then
|
|
|
|
|
allPro[n.priPro[i][1]] = 0
|
|
|
|
|
end
|
|
|
|
|
allPro[n.priPro[i][1]] = allPro[n.priPro[i][1]] + n.priPro[i][2]
|
|
|
|
|
end
|
2021-09-22 20:47:13 +08:00
|
|
|
|
end
|
|
|
|
|
break
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
for _,n in ipairs(list) do
|
2021-09-26 15:23:33 +08:00
|
|
|
|
if n.priPro and #n.priPro > 0 and lv >= n.lv then
|
2021-09-26 13:55:57 +08:00
|
|
|
|
if n.priPro and #n.priPro > 0 then
|
|
|
|
|
for i = 1,#n.priPro do
|
|
|
|
|
if not allPro[n.priPro[i][1]] then
|
|
|
|
|
allPro[n.priPro[i][1]] = 0
|
|
|
|
|
end
|
|
|
|
|
allPro[n.priPro[i][1]] = allPro[n.priPro[i][1]] + n.priPro[i][2]
|
2021-09-22 20:47:13 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-14 14:45:22 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-22 20:47:13 +08:00
|
|
|
|
return allPro
|
2021-09-14 14:45:22 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetTotalForce(heroData)
|
|
|
|
|
local SingleProVal = {}
|
|
|
|
|
local AllHeroProVal = {}
|
|
|
|
|
local lv,totalNum = 0,0
|
2021-09-26 09:54:58 +08:00
|
|
|
|
if heroData then
|
2021-09-26 15:23:33 +08:00
|
|
|
|
if this.AllHeroDataLikAbility[heroData.tId] then
|
|
|
|
|
lv,totalNum = this.GetLv(2,this.AllHeroDataLikAbility[heroData.tId].value)
|
2021-09-26 09:54:58 +08:00
|
|
|
|
SingleProVal = this.GetProData(2,-1,lv)
|
|
|
|
|
end
|
2021-09-14 14:45:22 +08:00
|
|
|
|
end
|
2021-09-22 20:47:13 +08:00
|
|
|
|
local totalCurNum,totalLv,totalNum = this.GetTotalHeroLikeLv(-1)
|
|
|
|
|
AllHeroProVal = this.GetProData(1,-1,totalLv)
|
2021-09-26 15:23:33 +08:00
|
|
|
|
-- for k,v in pairs(SingleProVal) do
|
|
|
|
|
-- LogGreen("SingleProVal k:"..k.." v:"..v)
|
|
|
|
|
-- end
|
|
|
|
|
-- for k,v in pairs(AllHeroProVal) do
|
|
|
|
|
-- LogGreen("AllHeroProVal k:"..k.." v:"..v)
|
|
|
|
|
-- end
|
2021-09-22 20:47:13 +08:00
|
|
|
|
return SingleProVal, AllHeroProVal
|
2021-09-14 14:45:22 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.CheckRedPot()
|
2021-09-22 20:47:13 +08:00
|
|
|
|
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.LikeAbility) then
|
2021-09-26 09:54:58 +08:00
|
|
|
|
if this.remainTimes > 0 then
|
|
|
|
|
for k,v in pairs(this.ItemList) do
|
|
|
|
|
local num = BagManager.GetItemCountById(k)
|
|
|
|
|
if num > 0 then
|
|
|
|
|
return true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-09-22 20:47:13 +08:00
|
|
|
|
end
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.GetCurSortHeroListData(proId)
|
|
|
|
|
local list = {}
|
|
|
|
|
--计算玩家拥有的英雄中对应星级的英雄的数量
|
|
|
|
|
for i, v in pairs(PlayerManager.heroHandBook) do
|
|
|
|
|
local conFig = ConfigManager.GetConfigData(ConfigName.HeroConfig,i)
|
|
|
|
|
if conFig then
|
|
|
|
|
if conFig.Star == 5 and (proId == 0 or conFig.PropertyName == proId) then
|
|
|
|
|
table.insert(list,conFig)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
this.SortHerosData(list)
|
|
|
|
|
this.heroDatas = list
|
|
|
|
|
return list
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.SortHerosData(heroData)
|
2021-09-26 21:49:05 +08:00
|
|
|
|
table.sort(heroData,function(a,b)
|
|
|
|
|
return a.Sort < b.Sort
|
2021-09-22 20:47:13 +08:00
|
|
|
|
end)
|
|
|
|
|
return heroData
|
|
|
|
|
end
|
|
|
|
|
|
2021-09-26 09:54:58 +08:00
|
|
|
|
--type 1是标题 界面显示用 2是内容
|
|
|
|
|
--content 内容
|
|
|
|
|
function this.CreatSingleProData(type,content)
|
|
|
|
|
local data = {}
|
|
|
|
|
data.type = type
|
|
|
|
|
data.content = content
|
|
|
|
|
data.prolist = {}
|
|
|
|
|
return data
|
|
|
|
|
end
|
2021-09-22 20:47:13 +08:00
|
|
|
|
--indexType 1总好感度 2:神将
|
|
|
|
|
--add -1 是累加 其他是不累加
|
|
|
|
|
--等级
|
2021-09-26 09:54:58 +08:00
|
|
|
|
--title1标题
|
|
|
|
|
--title2子标题
|
|
|
|
|
--subtitle1普通属性内容
|
|
|
|
|
--subtitle2特权属性内容
|
|
|
|
|
--nextLv: 下一等级
|
|
|
|
|
--all 所有的
|
2021-09-26 20:23:08 +08:00
|
|
|
|
|
|
|
|
|
local isall
|
2021-09-26 09:54:58 +08:00
|
|
|
|
function this.GetViewProData(indexType,add,lv,title1,title2,subtitle1,subtitle2,nextLv,all)
|
2021-09-26 20:23:08 +08:00
|
|
|
|
isall = all
|
2021-09-26 09:54:58 +08:00
|
|
|
|
local data = this.CreatSingleProData(1,title1)
|
|
|
|
|
local list = {}
|
|
|
|
|
if indexType == 1 then
|
|
|
|
|
list = this.TotalLvList
|
|
|
|
|
else
|
|
|
|
|
list = this.HeroLvList
|
|
|
|
|
end
|
2021-09-26 20:23:08 +08:00
|
|
|
|
local num,lv2,totalNum = LikabilityManager.GetTotalHeroLikeLv(indexType)
|
2021-09-26 09:54:58 +08:00
|
|
|
|
if all then
|
|
|
|
|
for i = 1,#list do
|
2021-09-26 14:21:22 +08:00
|
|
|
|
if list[i].lv ~= 0 then
|
|
|
|
|
local color = ""
|
|
|
|
|
if lv >= list[i].lv then
|
|
|
|
|
color = "5dc446"
|
|
|
|
|
else
|
|
|
|
|
color = "fdf5e5"
|
|
|
|
|
end
|
|
|
|
|
if title2 and title2 ~= "" then
|
|
|
|
|
table.insert(data.prolist,string.format(title2,color,list[i].lv,num,list[i].value))
|
|
|
|
|
end
|
|
|
|
|
local str1,str2 = this.GetViewProDatas(indexType,add,list[i].lv,subtitle1,subtitle2,nextLv,color)
|
|
|
|
|
table.insert(data.prolist,str1)
|
|
|
|
|
table.insert(data.prolist,str2)
|
2021-09-26 09:54:58 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
local color = "5dc446"
|
|
|
|
|
if title2 and title2 ~= "" then
|
|
|
|
|
table.insert(data.prolist,string.format(title2,color,lv,num,totalNum))
|
|
|
|
|
end
|
2021-09-26 13:55:57 +08:00
|
|
|
|
local str1,str2 = this.GetViewProDatas(indexType,add,lv,subtitle1,subtitle2,nextLv,color)
|
|
|
|
|
table.insert(data.prolist,str1)
|
|
|
|
|
table.insert(data.prolist,str2)
|
2021-09-26 09:54:58 +08:00
|
|
|
|
end
|
|
|
|
|
return data
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--indexType 1总好感度 2:神将
|
|
|
|
|
--add -1 是累加 其他是不累加
|
|
|
|
|
--等级
|
|
|
|
|
--title1标题
|
|
|
|
|
--title2子标题
|
|
|
|
|
--subtitle1普通属性内容
|
|
|
|
|
--subtitle2特权属性内容
|
|
|
|
|
--nextLv: 下一等级
|
2021-09-26 13:55:57 +08:00
|
|
|
|
function this.GetViewProDatas(indexType,add,lv,subtitle1,subtitle2,nextLv,color)
|
2021-09-22 20:47:13 +08:00
|
|
|
|
local num = 0
|
2021-09-26 13:55:57 +08:00
|
|
|
|
if indexType > 1 then
|
|
|
|
|
indexType = 2
|
|
|
|
|
end
|
|
|
|
|
local str1,str2 = "",""
|
2021-09-22 20:47:13 +08:00
|
|
|
|
local pro1 = LikabilityManager.GetProData(indexType,add,lv)
|
2021-09-26 13:55:57 +08:00
|
|
|
|
if LengthOfTable(pro1) > 0 then
|
|
|
|
|
str1 = this.SetProvalue(pro1,1,subtitle1,nextLv,indexType,color)
|
|
|
|
|
end
|
2021-09-22 20:47:13 +08:00
|
|
|
|
local pro2 = LikabilityManager.GetPrivilageProData(indexType,add,lv)
|
2021-09-26 13:55:57 +08:00
|
|
|
|
if LengthOfTable(pro2) > 0 then
|
|
|
|
|
str2 = this.SetProvalue(pro2,2,subtitle2,nextLv,indexType,color)
|
|
|
|
|
end
|
|
|
|
|
return str1,str2
|
2021-09-22 20:47:13 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--属性列表 ,1属性 2特权, 标签,
|
2021-09-26 20:23:08 +08:00
|
|
|
|
function this.SetProvalue(prolist,proType,tag,nextLv,indexType,_color)
|
2021-09-22 20:47:13 +08:00
|
|
|
|
local list = {}
|
2021-09-26 20:23:08 +08:00
|
|
|
|
local color1 = _color
|
2021-09-22 20:47:13 +08:00
|
|
|
|
if indexType == 1 then
|
|
|
|
|
list = this.TotalLvList
|
|
|
|
|
else
|
|
|
|
|
list = this.HeroLvList
|
|
|
|
|
end
|
2021-09-26 20:23:08 +08:00
|
|
|
|
if indexType == 1 and not isall then
|
|
|
|
|
color1 = "fdf5e5"
|
|
|
|
|
end
|
2021-09-22 20:47:13 +08:00
|
|
|
|
local newProList = {}
|
|
|
|
|
local str = ""
|
|
|
|
|
for k,v in pairs(prolist) do
|
|
|
|
|
local str1 = ""
|
|
|
|
|
if proType == 1 then
|
2021-09-26 20:23:08 +08:00
|
|
|
|
str1 = PropertyConfig[k].Info..string.format("<color=#%s>+%s</color>",_color,GetPropertyFormatStrOne(PropertyConfig[k].Style, v) )
|
2021-09-22 20:47:13 +08:00
|
|
|
|
if nextLv and list[nextLv] then
|
|
|
|
|
local pro1 = LikabilityManager.GetProData(indexType,-1,nextLv)
|
|
|
|
|
if pro1[k] and pro1[k] > 0 then
|
2021-09-26 20:23:08 +08:00
|
|
|
|
str1 = str1.." "..string.format("<color=#%s>(下级额外 +%s)</color>",color1,pro1[k])
|
2021-09-22 20:47:13 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
2021-09-27 10:41:32 +08:00
|
|
|
|
local config = ConfigManager.TryGetConfigDataByKey(ConfigName.PrivilegeTypeConfig,"PrivilegeType",k)
|
|
|
|
|
if config then
|
|
|
|
|
str1 = string.format(config.Name,string.format("<color=#%s>+%s</color>",_color,GetPropertyFormatStrOne(config.IfFloat, v)))
|
|
|
|
|
end
|
2021-09-22 20:47:13 +08:00
|
|
|
|
end
|
|
|
|
|
table.insert(newProList,str1)
|
|
|
|
|
end
|
2021-09-26 20:23:08 +08:00
|
|
|
|
str = string.format(tag,color1,(newProList[1] or ""),(newProList[2] or ""))
|
2021-09-26 13:55:57 +08:00
|
|
|
|
return str
|
2021-09-14 14:45:22 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return this
|