好感度优化提交

dev_chengFeng
jiaoyangna 2021-10-08 18:53:06 +08:00
parent 6700723aaa
commit 7b88415339
2 changed files with 31 additions and 11 deletions

View File

@ -25,6 +25,7 @@ function LikeabilityPopup:InitComponent()
self.proContent = Util.GetGameObject(self.pro, "content")
self.proGrid1 = Util.GetGameObject(self.transform, "scroll/proScrollgrid1")
self.proGrid2 = Util.GetGameObject(self.transform, "scroll/proScroll/proScrollgrid2")
self.proGrid2Pos = self.proGrid2:GetComponent("RectTransform").anchoredPosition
self.proList = {}
self.back = Util.GetGameObject(self.transform, "BG/BackBtn")
@ -84,24 +85,20 @@ function LikeabilityPopup:UpDataProList(lv)
self.proList[i].go.gameObject:SetActive(false)
end
self:UpDataProSingleList(pro1,1,self.proGrid1)
self:UpDataProSingleList(pro2,2,self.proGrid2)
self:UpDataProSingleList(pro2,2,self.proGrid2,lv)
end
function LikeabilityPopup:UpDataProSingleList(data,index,parent)
function LikeabilityPopup:UpDataProSingleList(data,index,parent,lv)
if not self.proList[index] then
self.proList[index] = {}
self.proList[index].go = newObjToParent(self.pro,parent.transform)
self.proList[index].title = Util.GetGameObject(self.proList[index].go, "title"):GetComponent("Text")
self.proList[index].fenge = Util.GetGameObject(self.proList[index].go, "Image")
self.proList[index].fengePre = Util.GetGameObject(self.proList[index].go, "fenge")
if index == 1 then
self.proList[index].fenge.gameObject:SetActive(false)
else
self.proList[index].fenge.gameObject:SetActive(true)
end
end
self.proList[index].go.gameObject:SetActive(true)
self.proList[index].title.text = data.content
local curIndex = 0
for i = 1,math.max(#self.proList[index],#data.prolist) do
if not data.prolist[i] then
self.proList[index][i].go.gameObject:SetActive(false)
@ -118,14 +115,26 @@ function LikeabilityPopup:UpDataProSingleList(data,index,parent)
self.proList[index][i].go.gameObject:SetActive(true)
self.proList[index][i].goText.text = data.prolist[i]
end
LogGreen("i:"..i)
if i%3 == 0 then
self.proList[index][i].fenge.gameObject:SetActive(true)
if lv > math.ceil(i/3) then
curIndex = math.ceil(i/3) * 4
end
else
self.proList[index][i].fenge.gameObject:SetActive(false)
end
end
end
if index == 1 then
self.proList[index].fenge.gameObject:SetActive(false)
else
self.proList[index].fenge.gameObject:SetActive(true)
if curIndex ~= 0 then
local pos = self.proGrid2:GetComponent("RectTransform").anchoredPosition
pos.y = self.proGrid2Pos.y + 41 + curIndex*35 + (lv - 1)*10
self.proGrid2:GetComponent("RectTransform").anchoredPosition = pos
end
end
end
function LikeabilityPopup:OnClose()
@ -136,5 +145,6 @@ end
function LikeabilityPopup:OnDestroy()
self.spLoader:Destroy()
self.proList = {}
self.proGrid2:GetComponent("RectTransform").anchoredPosition = self.proGrid2Pos
end
return LikeabilityPopup

View File

@ -17,6 +17,7 @@ function RoleLikeabilityPopup:InitComponent()
self.proContent = Util.GetGameObject(self.pro, "content")
self.fenge = Util.GetGameObject(self.pro, "fenge")
self.proGrid = Util.GetGameObject(self.transform, "scroll/proScroll/proScrollGrid")
self.proGrid2Pos = self.proGrid:GetComponent("RectTransform").anchoredPosition
self.pos = Util.GetGameObject(self.transform, "scroll/pos")
self.proList = {}
@ -77,10 +78,10 @@ function RoleLikeabilityPopup:UpDataProList(lv)
for i = 1,#self.proList do
self.proList[i].go.gameObject:SetActive(false)
end
self:UpDataProSingleList(pro2,1)
self:UpDataProSingleList(pro2,1,lv)
end
function RoleLikeabilityPopup:UpDataProSingleList(data,index)
function RoleLikeabilityPopup:UpDataProSingleList(data,index,lv)
if not self.proList[index] then
self.proList[index] = {}
self.proList[index].go = newObjToParent(self.pro,self.proGrid)
@ -93,7 +94,7 @@ function RoleLikeabilityPopup:UpDataProSingleList(data,index)
self.proList[index].title.gameObject:SetActive(true)
self.proList[index].title.text = data.content
end
local curIndex = 0
for i = 1,math.max(#self.proList[index],#data.prolist) do
if not data.prolist[i] then
self.proList[index][i].go.gameObject:SetActive(false)
@ -112,11 +113,19 @@ function RoleLikeabilityPopup:UpDataProSingleList(data,index)
end
if i%3 == 0 then
self.proList[index][i].fenge.gameObject:SetActive(true)
if lv > math.ceil(i/3) then
curIndex = math.ceil(i/3) * 3
end
else
self.proList[index][i].fenge.gameObject:SetActive(false)
end
end
end
if curIndex ~= 0 then
local pos = self.proGrid:GetComponent("RectTransform").anchoredPosition
pos.y = self.proGrid2Pos.y + 41 + curIndex*35 + (lv - 1)*11
self.proGrid:GetComponent("RectTransform").anchoredPosition = pos
end
end
function RoleLikeabilityPopup:OnClose()
@ -129,5 +138,6 @@ function RoleLikeabilityPopup:OnDestroy()
self.proList = {}
SubUIManager.Close(self.itemview)
self.itemview = nil
self.proGrid:GetComponent("RectTransform").anchoredPosition = self.proGrid2Pos
end
return RoleLikeabilityPopup