【四元阵】修改概率基数的计算方式
parent
9291351094
commit
244db76135
|
@ -4253,4 +4253,34 @@ function this.CalculatePvpBonusForShow(data)
|
|||
return data
|
||||
end
|
||||
|
||||
-- 判断英雄是否进入版本
|
||||
function this.InVersion(heroTid)
|
||||
if not heroTid then
|
||||
return
|
||||
end
|
||||
local con = heroConfig[heroTid]
|
||||
if not con or not con.Version then
|
||||
return
|
||||
end
|
||||
local serverOpenTime = PlayerManager.GetServerOpenTime()
|
||||
local openDay = math.max(0, GetTimeStamp() - serverOpenTime)/(60*60*24)--当前是开服第几天
|
||||
if openDay >= con.Version then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
||||
-- 英雄碎片id转英雄id
|
||||
function this.ChipIdToHeroId(chipId)
|
||||
local item = itemConfig[chipId]
|
||||
if not item then
|
||||
return
|
||||
end
|
||||
local reward = rewardGroup[item.RewardGroup[1]]
|
||||
if not reward or not reward.ShowItem or not reward.ShowItem[1] then
|
||||
return
|
||||
end
|
||||
local heroId = reward.ShowItem[1][1]
|
||||
return heroId
|
||||
end
|
||||
|
||||
return this
|
|
@ -84,6 +84,7 @@ end
|
|||
--第一个参数是否是英雄或元素
|
||||
--第二个参数是否显示tab 如果没有,则显示,如果有,则根据第二个参数
|
||||
function HeroPreviewPanel:OnOpen(...)
|
||||
this.AllWeightTemp = {}
|
||||
this.heroGrid.transform.anchoredPosition = Vector2.New(0,0)
|
||||
this.elementGrid.transform.anchoredPosition = Vector2.New(0,0)
|
||||
local temp={...}
|
||||
|
@ -107,23 +108,27 @@ function HeroPreviewPanel:OnOpen(...)
|
|||
if RecruitManager.isFirstEnterElementScroll then --元素
|
||||
RecruitManager.isFirstEnterElementScroll=false
|
||||
for i,v in pairs(RecruitManager.previewElementData) do
|
||||
Log(v.Pool)
|
||||
if(v.Pool==11) then
|
||||
local view = SubUIManager.Open(SubUIConfig.ItemView,this.waterGrid.transform)
|
||||
view:OnOpen(false, {v.Reward[1], v.Reward[2] },1.1,true)
|
||||
view.name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f",(v.WeightShow/100000)*100) .."%</color>"
|
||||
elseif(v.Pool==12) then
|
||||
local view = SubUIManager.Open(SubUIConfig.ItemView,this.fireGrid.transform)
|
||||
view:OnOpen(false, {v.Reward[1], v.Reward[2] },1.1,true)
|
||||
view.name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f",(v.WeightShow/100000)*100) .."%</color>"
|
||||
elseif(v.Pool==13) then
|
||||
local view = SubUIManager.Open(SubUIConfig.ItemView,this.windyGrid.transform)
|
||||
view:OnOpen(false, {v.Reward[1], v.Reward[2] },1.1,true)
|
||||
view.name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f",(v.WeightShow/100000)*100) .."%</color>"
|
||||
elseif(v.Pool==14) then
|
||||
local view = SubUIManager.Open(SubUIConfig.ItemView,this.groundGrid.transform)
|
||||
view:OnOpen(false, {v.Reward[1], v.Reward[2] },1.1,true)
|
||||
view.name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f",(v.WeightShow/100000)*100) .."%</color>"
|
||||
local chipId = v.Reward[1]
|
||||
local heroId = HeroManager.ChipIdToHeroId(chipId)
|
||||
if not heroId or HeroManager.InVersion(heroId) then
|
||||
local allWeight = this.GetAllWeight(v.Pool)
|
||||
if(v.Pool==11) then
|
||||
local view = SubUIManager.Open(SubUIConfig.ItemView,this.waterGrid.transform)
|
||||
view:OnOpen(false, {v.Reward[1], v.Reward[2] },1.1,true)
|
||||
view.name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f",(v.WeightShow/allWeight)*100) .."%</color>"
|
||||
elseif(v.Pool==12) then
|
||||
local view = SubUIManager.Open(SubUIConfig.ItemView,this.fireGrid.transform)
|
||||
view:OnOpen(false, {v.Reward[1], v.Reward[2] },1.1,true)
|
||||
view.name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f",(v.WeightShow/allWeight)*100) .."%</color>"
|
||||
elseif(v.Pool==13) then
|
||||
local view = SubUIManager.Open(SubUIConfig.ItemView,this.windyGrid.transform)
|
||||
view:OnOpen(false, {v.Reward[1], v.Reward[2] },1.1,true)
|
||||
view.name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f",(v.WeightShow/allWeight)*100) .."%</color>"
|
||||
elseif(v.Pool==14) then
|
||||
local view = SubUIManager.Open(SubUIConfig.ItemView,this.groundGrid.transform)
|
||||
view:OnOpen(false, {v.Reward[1], v.Reward[2] },1.1,true)
|
||||
view.name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f",(v.WeightShow/allWeight)*100) .."%</color>"
|
||||
end
|
||||
end
|
||||
end
|
||||
this.elementScroll:SetActive(true)
|
||||
|
@ -132,6 +137,13 @@ function HeroPreviewPanel:OnOpen(...)
|
|||
end
|
||||
end
|
||||
|
||||
function this.GetAllWeight(pool)
|
||||
if not this.AllWeightTemp[pool] then
|
||||
this.AllWeightTemp[pool] = RecruitManager.GetAllWeightByPool(pool)
|
||||
end
|
||||
return this.AllWeightTemp[pool]
|
||||
end
|
||||
|
||||
function HeroPreviewPanel:OnShow()
|
||||
|
||||
end
|
||||
|
|
|
@ -650,4 +650,24 @@ function this.GetRecruitData()
|
|||
return dicData
|
||||
end
|
||||
|
||||
-- 获取某个奖池的总权重
|
||||
function this.GetAllWeightByPool(pool)
|
||||
local all = 0
|
||||
for i, v in ConfigPairs(lotteryRewardConfig) do
|
||||
if v.Pool == pool then
|
||||
-- 四元阵需要判断是否进入版本
|
||||
local weight = v.WeightShow
|
||||
if v.Pool==11 or v.Pool==12 or v.Pool==13 or v.Pool==14 then
|
||||
local chipId = v.Reward[1]
|
||||
local heroId = HeroManager.ChipIdToHeroId(chipId)
|
||||
if heroId and not HeroManager.InVersion(heroId) then
|
||||
weight = 0
|
||||
end
|
||||
end
|
||||
all = all + weight
|
||||
end
|
||||
end
|
||||
return all
|
||||
end
|
||||
|
||||
return this
|
Loading…
Reference in New Issue