From 6c738a5641aa2b2d75953f1f68b4838c51fa2ad9 Mon Sep 17 00:00:00 2001 From: chenxi Date: Mon, 5 Jun 2023 16:52:40 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A5=96=E5=8A=B1=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/tips/reward_box.lua | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) diff --git a/lua/app/ui/tips/reward_box.lua b/lua/app/ui/tips/reward_box.lua index 767dea8e..e4495001 100644 --- a/lua/app/ui/tips/reward_box.lua +++ b/lua/app/ui/tips/reward_box.lua @@ -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