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