修改法宝抽卡,奖励预览的点击事件

onepiece_demo_arena
xiejun 2023-12-05 02:37:42 +08:00
parent 4ed73e1057
commit c45292555a
1 changed files with 68 additions and 7 deletions

View File

@ -34,10 +34,15 @@ function HeroPreviewNewPanel:InitComponent()
this.elementScroll=Util.GetGameObject(self.transform, "bg/elementScroll")
this.sevenGrid=Util.GetGameObject(self.transform, "bg/heroScroll/grid/sevenGrid")
this.sevenStarNum=Util.GetGameObject(self.transform, "bg/heroScroll/grid/sevenStarNum")
this.sixGrid=Util.GetGameObject(self.transform, "bg/heroScroll/grid/sixGrid")
this.sixStarNum=Util.GetGameObject(self.transform, "bg/heroScroll/grid/sixStarNum")
this.fiveGrid=Util.GetGameObject(self.transform, "bg/heroScroll/grid/fiveGrid")
this.fiveStarNum=Util.GetGameObject(self.transform, "bg/heroScroll/grid/fiveStarNum")
this.fourGrid=Util.GetGameObject(self.transform, "bg/heroScroll/grid/fourGrid")
this.fourStarNum=Util.GetGameObject(self.transform, "bg/heroScroll/grid/fourStarNum")
this.threeGrid=Util.GetGameObject(self.transform, "bg/heroScroll/grid/threeGrid")
this.threeStarNum=Util.GetGameObject(self.transform, "bg/heroScroll/grid/threeStarNum")
this.twoGrid=Util.GetGameObject(self.transform, "bg/heroScroll/grid/twoGrid")
this.twoStarNum=Util.GetGameObject(self.transform, "bg/heroScroll/grid/twoStarNum")
this.oneGrid=Util.GetGameObject(self.transform, "bg/heroScroll/grid/oneGrid")
@ -225,9 +230,16 @@ function this.SwitchView(index)
this.List1[i]:OnOpen(false, {oneData[i].Reward[1], oneData[i].Reward[2]}, 1.1, true)
this.List1[i].name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f", (oneData[i].WeightShow/100000)*100) .."%</color>"
this.List1[i].gameObject:SetActive(true)
end
end
if #oneData==0 then
this.oneStarNum:SetActive(false)
this.oneGrid:SetActive(false)
else
this.oneStarNum:SetActive(true)
this.oneGrid:SetActive(true)
end
if index == 2 or index ==3 then
for i = 1, #twoData do
if not this.List2[i] then
@ -236,11 +248,20 @@ function this.SwitchView(index)
this.List2[i]:OnOpen(false, {twoData[i].Reward[1], twoData[i].Reward[2]}, 1.1, true)
this.List2[i].name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f", (twoData[i].WeightShow/100000)*100) .."%</color>"
this.List2[i].gameObject:SetActive(true)
end
end
if #twoData==0 then
this.twoStarNum:SetActive(false)
this.twoGrid:SetActive(false)
else
this.twoStarNum:SetActive(true)
this.twoGrid:SetActive(true)
end
for i = 1, #this.List3 do
if this.List3[i] then
this.List3[i].gameObject:SetActive(false)
end
end
for i = 1, #threeData do
@ -251,10 +272,19 @@ function this.SwitchView(index)
this.List3[i]:OnOpen(false, {threeData[i].Reward[1], threeData[i].Reward[2]}, 1.1, true)
this.List3[i].name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f", (threeData[i].WeightShow/100000)*100) .."%</color>"
this.List3[i].gameObject:SetActive(true)
end
if #threeData==0 then
this.threeStarNum:SetActive(false)
this.threeGrid:SetActive(false)
else
this.threeStarNum:SetActive(true)
this.threeGrid:SetActive(true)
end
for i = 1, #this.List4 do
if this.List4[i] then
this.List4[i].gameObject:SetActive(false)
end
end
for i = 1, #fourData do
@ -265,10 +295,19 @@ function this.SwitchView(index)
this.List4[i]:OnOpen(false, {fourData[i].Reward[1], fourData[i].Reward[2]}, 1.1, true)
this.List4[i].name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f", (fourData[i].WeightShow/100000)*100) .."%</color>"
this.List4[i].gameObject:SetActive(true)
end
if #fourData==0 then
this.fourStarNum:SetActive(false)
this.fourGrid:SetActive(false)
else
this.fourStarNum:SetActive(true)
this.fourGrid:SetActive(true)
end
for i = 1, #this.List5 do
if this.List5[i] then
this.List5[i].gameObject:SetActive(false)
this.List5[i].gameObject.transform.parent.gameObject:SetActive(false)
end
end
for i = 1, #fiveData do
@ -279,11 +318,19 @@ function this.SwitchView(index)
this.List5[i]:OnOpen(false, {fiveData[i].Reward[1], fiveData[i].Reward[2]}, 1.1, true)
this.List5[i].name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f", (fiveData[i].WeightShow/100000)*100) .."%</color>"
this.List5[i].gameObject:SetActive(true)
this.List5[i].gameObject.transform.parent.gameObject:SetActive(true)
end
if #fiveData==0 then
this.fiveStarNum:SetActive(false)
this.fiveGrid:SetActive(false)
else
this.fiveStarNum:SetActive(true)
this.fiveGrid:SetActive(true)
end
for i = 1, #this.List6 do
if this.List6[i] then
this.List6[i].gameObject:SetActive(false)
this.List6[i].gameObject.transform.parent.gameObject:SetActive(false)
end
end
for i = 1, #sixData do
@ -294,8 +341,15 @@ function this.SwitchView(index)
this.List6[i]:OnOpen(false, {sixData[i].Reward[1], sixData[i].Reward[2]}, 1.1, true)
this.List6[i].name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f", (sixData[i].WeightShow/100000)*100) .."%</color>"
this.List6[i].gameObject:SetActive(true)
this.List6[i].gameObject.transform.parent.gameObject:SetActive(true)
end
if #sixData==0 then
this.sixStarNum:SetActive(false)
this.sixGrid:SetActive(false)
else
this.sixStarNum:SetActive(true)
this.sixGrid:SetActive(true)
end
-- for i = 1, #sixData do
-- if not this.List6[i] then
-- this.List6[i] = SubUIManager.Open(SubUIConfig.ItemView,this.sixGrid.transform)
@ -307,7 +361,7 @@ function this.SwitchView(index)
-- end
for i = 1, #this.List7 do
if this.List7[i] then
this.List7[i].gameObject:SetActive(false)
this.List7[i].gameObject:SetActive(false)
end
end
for i = 1, #sevenData do
@ -317,7 +371,14 @@ function this.SwitchView(index)
end
this.List7[i]:OnOpen(false, {sevenData[i].Reward[1], sevenData[i].Reward[2]}, 1.1, true)
this.List7[i].name:GetComponent("Text").text="<color=#EDB64C>"..string.format("%.2f", (sevenData[i].WeightShow/100000)*100) .."%</color>"
this.List7[i].gameObject:SetActive(true)
this.List7[i].gameObject:SetActive(true)
end
if #sevenData==0 then
this.sevenStarNum:SetActive(false)
this.sevenGrid:SetActive(false)
else
this.sevenStarNum:SetActive(true)
this.sevenGrid:SetActive(true)
end
this.starGridSwitch(index)
end
@ -331,8 +392,8 @@ function this.starGridSwitch(index)
elseif index == 2 then
this.oneStarNum:SetActive(false)
this.oneGrid:SetActive(false)
this.twoStarNum:SetActive(true)
this.twoGrid:SetActive(true)
this.twoStarNum:SetActive(false)
this.twoGrid:SetActive(false)
else
this.oneStarNum:SetActive(true)
this.oneGrid:SetActive(true)