奖励界面

This commit is contained in:
chenxi 2023-06-05 16:52:40 +08:00
parent 6e20c37abf
commit 6c738a5641

View File

@ -1,14 +1,8 @@
local BaseTips = require "app/ui/tips/base_tips"
local RewardBox = class("RewardBox", BaseTips)
local CELL_WIDTH = 151
local CELL_WIDTH = 130
local CELL_NUM = 5
local MIN_SIZE_Y = 426
local MAX_SIZE_Y = 966
local MAX_SIZE_X = 690
local MIN_TITLE_POS_Y = 264
local MAX_TITLE_POS_Y = 540
function RewardBox:ctor(params)
self.params = params or {}
@ -50,20 +44,13 @@ end
function RewardBox:_refreshScrollRect()
if #self.params.rewards <= 5 then
self.scrollView:setSizeDelta(#self.params.rewards*CELL_WIDTH, MIN_SIZE_Y)
self.scrollView:setSizeDeltaX(#self.params.rewards*CELL_WIDTH)
self.scrollRect:setPerLineNum(#self.params.rewards)
self.scrollRect:refillCells(#self.params.rewards, true)
self.titleTx:setAnchoredPositionY(MIN_TITLE_POS_Y)
elseif #self.params.rewards <= 15 then
self.scrollView:setSizeDelta(MAX_SIZE_X, MIN_SIZE_Y)
else
self.scrollView:setSizeDeltaX(CELL_WIDTH*5)
self.scrollRect:setPerLineNum(CELL_NUM)
self.scrollRect:refillCells(#self.params.rewards, true)
self.titleTx:setAnchoredPositionY(MIN_TITLE_POS_Y)
else
self.scrollView:setSizeDelta(MAX_SIZE_X, MAX_SIZE_Y)
self.scrollRect:setPerLineNum(CELL_NUM)
self.scrollRect:refillCells(#self.params.rewards)
self.titleTx:setAnchoredPositionY(MAX_TITLE_POS_Y)
end
end