节日提交

dev_chengFeng
jiaoyangna 2022-01-22 13:27:25 +08:00
parent 5cea36a143
commit ec7be4c020
2 changed files with 28 additions and 14 deletions

View File

@ -10990,7 +10990,7 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -21.9, y: 33.37}
m_AnchoredPosition: {x: -17.5, y: 33.37}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3606722773367142593

View File

@ -11,8 +11,10 @@ function FestevalPanel:InitComponent()
self.tipDi = Util.GetGameObject(self.closePanel,"tipDi"):GetComponent("Image")
self.tip = Util.GetGameObject(self.tipDi.transform,"tip"):GetComponent("Text")
self.grid = Util.GetGameObject(self.gameObject,"content/grid")
self.contentHeight = Util.GetGameObject(self.gameObject,"content"):GetComponent("RectTransform").rect.height
self.singleLinePre = Util.GetGameObject(self.gameObject,"singleLinePre")
self.singleLinePreHeight = self.singleLinePre:GetComponent("RectTransform").rect.height
self.gridLayoutCom = self.grid:GetComponent("VerticalLayoutGroup")
self.lineList = {}
self.time = Util.GetGameObject(self.gameObject,"timeDi/time"):GetComponent("Text")
@ -80,17 +82,8 @@ function FestevalPanel:OnShow()
end
self.curDay = math.ceil((CalculateSecondsNowTo_N_OClock(0) + GetTimeStamp() - self.actData.startTime)/86400)
self:RefreshData()
self:SetSelect()
self:RemainTimeDown()
local row,cum = self:Getrow(self.curDay)
local h = (row - 2) * self.singleLinePreHeight
if h < 0 then
self.gridPos.y = 0
elseif h > (#self.lineList - 2) * self.singleLinePreHeight then
self.gridPos.y = (#self.lineList - 2) * self.singleLinePreHeight
else
self.gridPos.y = h
end
self.grid:GetComponent("RectTransform").anchoredPosition = self.gridPos
end
function FestevalPanel:RefreshData()
@ -147,8 +140,28 @@ function FestevalPanel:Getrow(index)
return row,cum
end
function FestevalPanel:SetSelect(parent)
function FestevalPanel:SetSelect()
self.gridHeight = GetPreferredHeight(self.grid.transform)
local day = self.curDay
for i = 1, #self.actData.mission do
local config = ActivityRewardConfig[self.actData.mission[i].missionId]
if self.actData.mission[i].state == 0 and self.curDay >= config.Values[1][1] then
day = config.Values[1][1]
break
end
end
local row,cum = self:Getrow(day)
--local h = -((row - 0.5) * self.singleLinePreHeight + (row - 1) * self.gridLayoutCom.spacing - 14)
local h = (row - 1) * self.singleLinePreHeight + (row - 1) * self.gridLayoutCom.spacing
if h < 0 then
self.gridPos.y = 0
elseif h > self.gridHeight - self.contentHeight then
self.gridPos.y = self.gridHeight - self.contentHeight
else
self.gridPos.y = h
end
self.grid:GetComponent("RectTransform").anchoredPosition = self.gridPos
end
function FestevalPanel:RefreshSingleData(obj,data)
@ -165,10 +178,11 @@ function FestevalPanel:RefreshSingleData(obj,data)
if obj.data.state == 0 then
if self.curDay >= config.Values[1][1] then
obj.redpoint.gameObject:SetActive(true)
end
if self.curDay == config.Values[1][1] then
obj.select.gameObject:SetActive(true)
end
-- if self.curDay == config.Values[1][1] then
-- obj.select.gameObject:SetActive(true)
-- end
else
obj.gray.gameObject:SetActive(true)
obj.get.gameObject:SetActive(true)