From 859fb30001d972e35ee18450f532e41459d88b5d Mon Sep 17 00:00:00 2001 From: CloudJ Date: Thu, 1 Jun 2023 14:34:50 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=8A=BD=E5=8D=A1=E8=A1=A8=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/shop/box_reward_ui.lua | 75 ++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 27 deletions(-) diff --git a/lua/app/ui/shop/box_reward_ui.lua b/lua/app/ui/shop/box_reward_ui.lua index 255be1af..b3f98445 100644 --- a/lua/app/ui/shop/box_reward_ui.lua +++ b/lua/app/ui/shop/box_reward_ui.lua @@ -3,20 +3,32 @@ local BOX_HERO_CELL = "app/ui/shop/cell/box_hero_cell" local CELL_NUM = 4 local QLT_DELAY_TIME = { - [1] = 0.25, - [2] = 0.25, - [3] = 0.5, - [4] = 0.5, - [5] = 0.75, - [6] = 1 + [1] = 0.3, -- 预留 + [2] = 0.3, -- 绿 + [3] = 0.3, -- 蓝 + [4] = 0.5, -- 紫 + [5] = 0.5, -- 预留 } local FADE_TIME = 0.5 +local MAX_SCREEN_CELL_COUNT = 12 -- 同屏界面能展示的最大数量 function BoxRewardUI:ctor(params) self.params = params or {} self.rewards = params.rewards or {} - self.actionStatus = {} + self.actionStatus = {} -- 表现状态 + self.cellDelayTime = {} -- {idx,time} + -- if #self.params.rewards > MAX_SCREEN_CELL_COUNT then + -- self.showAction = true + -- self.turnIdx = MAX_SCREEN_CELL_COUNT // CELL_NUM + -- self.maxIdx = math.ceil(#self.params.rewards / CELL_NUM) + -- end + if #self.params.rewards > MAX_SCREEN_CELL_COUNT then + for i = MAX_SCREEN_CELL_COUNT + 1, #self.params.rewards do + self.actionStatus[i] = true + end + end + -- 前端用展示奖励 self.fragmentRewards = {} self.coinNum = 0 local fragmentMap = {} @@ -107,31 +119,40 @@ function BoxRewardUI:playCellAction(cell, idx) seq:Append(tween) seq:AppendCallback(function() self.actionStatus[idx] = true - self:turnToNext(idx) + -- self:turnToNext(idx) -- 去掉滑动 end) end -function BoxRewardUI:turnToNext(idx) - if not self.showAction or idx ~= self.turnIdx * CELL_NUM then - return - end - self:performWithDelayGlobal(function() - self.scrollRect:moveToIndex((self.turnIdx - 6)*CELL_NUM + 1) - self.turnIdx = self.turnIdx + 1 - if self.turnIdx >= self.maxIdx then - self.showAction = false - end - end, 0.025) -end +-- function BoxRewardUI:turnToNext(idx) +-- if not self.showAction or idx ~= self.turnIdx * CELL_NUM then +-- return +-- end +-- self:performWithDelayGlobal(function() +-- self.scrollRect:moveToIndex((self.turnIdx - (MAX_SCREEN_CELL_COUNT // CELL_NUM))*CELL_NUM + 1) +-- self.turnIdx = self.turnIdx + 1 +-- if self.turnIdx >= self.maxIdx then +-- self.showAction = false +-- end +-- end, 0.025) +-- end function BoxRewardUI:getCellDelayTime(idx) - -- 品质对应时间 - if idx <= 35 then - return idx* 0.2 -- 0.05 - else - local re = (idx - 1)%5 + 1 - return re* 0.1 -- 0.025 - end + if not self.cellDelayTime[idx] then + local reward = self.fragmentRewards[idx] + local id = reward.id + local qlt = 2 -- 默认品质 + local heroCfgInfo = ConfigManager:getConfig("hero")[id] + if heroCfgInfo then + qlt = heroCfgInfo.qlt + end + local cellDelayTime = QLT_DELAY_TIME[qlt] -- 这个cell的延迟时间 + if idx == 1 then + self.cellDelayTime[idx] = cellDelayTime + else + self.cellDelayTime[idx] = cellDelayTime + self:getCellDelayTime(idx - 1) + end + end + return self.cellDelayTime[idx] end return BoxRewardUI \ No newline at end of file From 83143a093342e9b9481057cf5992d806ca7365df Mon Sep 17 00:00:00 2001 From: Fang Date: Thu, 1 Jun 2023 14:38:05 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E6=8A=A5=E9=94=99fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/ui/main_city/cell/side_bar_base_cell.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/app/ui/main_city/cell/side_bar_base_cell.lua b/lua/app/ui/main_city/cell/side_bar_base_cell.lua index 538bff18..9328691d 100644 --- a/lua/app/ui/main_city/cell/side_bar_base_cell.lua +++ b/lua/app/ui/main_city/cell/side_bar_base_cell.lua @@ -68,10 +68,10 @@ function SideBarBaseCellComp:refreshSpine(isShow) if isShow then if not self.isInitSpine then + self.isInitSpine = true self.spine:loadAssetAsync(self:getSpineName(), function() self.spine:playAnim("idle", true, true, true) self.spine:setActive(true) - self.isInitSpine = true end, false) else self.spine:playAnim("idle", true, true, true)