删除无用代码
This commit is contained in:
parent
03d2625a0c
commit
8aaa2565cf
@ -15,14 +15,6 @@ function RewardBox:ctor(params)
|
|||||||
self.params.rewards = params.rewards or {}
|
self.params.rewards = params.rewards or {}
|
||||||
self.customTitleStr = params.customTitleStr
|
self.customTitleStr = params.customTitleStr
|
||||||
self.callback = params.callback
|
self.callback = params.callback
|
||||||
self.flyPos = {}
|
|
||||||
self.showFly = false
|
|
||||||
self.actionStatus = {}
|
|
||||||
if #self.params.rewards > 35 then
|
|
||||||
self.showAction = true
|
|
||||||
self.turnIdx = 7
|
|
||||||
self.maxIdx = math.ceil(#self.params.rewards / CELL_NUM)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function RewardBox:getPrefabPath()
|
function RewardBox:getPrefabPath()
|
||||||
@ -38,16 +30,11 @@ function RewardBox:onLoadRootComplete()
|
|||||||
end)
|
end)
|
||||||
self.scrollRect:addRefreshCallback(function(index, cell)
|
self.scrollRect:addRefreshCallback(function(index, cell)
|
||||||
cell:refresh(self.params.rewards[index])
|
cell:refresh(self.params.rewards[index])
|
||||||
self:playCellAction(cell, index)
|
|
||||||
end)
|
end)
|
||||||
self.scrollRect:clearCells()
|
self.scrollRect:clearCells()
|
||||||
|
|
||||||
self.root:addClickListener(function()
|
self.root:addClickListener(function()
|
||||||
self:closeUI()
|
self:closeUI()
|
||||||
if self.showFly then
|
|
||||||
local pos = clone(self.flyPos)
|
|
||||||
-- self:showCurrencyAction(pos)
|
|
||||||
end
|
|
||||||
if self.callback then
|
if self.callback then
|
||||||
self.callback()
|
self.callback()
|
||||||
end
|
end
|
||||||
@ -56,31 +43,12 @@ function RewardBox:onLoadRootComplete()
|
|||||||
self.titleTx = uiMap["reward_box.reward_title"]
|
self.titleTx = uiMap["reward_box.reward_title"]
|
||||||
self.titleTx:setText(self.customTitleStr or I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC))
|
self.titleTx:setText(self.customTitleStr or I18N:getGlobalText(I18N.GlobalConst.REWARD_DESC))
|
||||||
uiMap["reward_box.continue_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_CLOSE_DESC))
|
uiMap["reward_box.continue_tx"]:setText(I18N:getGlobalText(I18N.GlobalConst.CLICK_CLOSE_DESC))
|
||||||
-- AudioManager:playEffect(AudioManager.EFFECT_ID.REWARD)
|
|
||||||
|
|
||||||
self:_refreshScrollRect()
|
self:_refreshScrollRect()
|
||||||
uiMap["reward_box.effect_node.ui_spine_obj"]:playAnim("idle", false, false)
|
uiMap["reward_box.effect_node.ui_spine_obj"]:playAnim("idle", false, false)
|
||||||
end
|
end
|
||||||
|
|
||||||
function RewardBox:_refreshScrollRect(onlyRefresh)
|
function RewardBox:_refreshScrollRect()
|
||||||
for i,v in ipairs(self.params.rewards) do
|
|
||||||
if self.params.rewards[i].type == GConst.REWARD_TYPE.ITEM then
|
|
||||||
local id = self.params.rewards[i].item.id or self.params.rewards[i].item.id
|
|
||||||
if id == GConst.ItemConst.ITEM_ID_GOLD or
|
|
||||||
id == GConst.ItemConst.ITEM_ID_GEM or
|
|
||||||
id == GConst.ItemConst.ITEM_ID_VIT
|
|
||||||
then
|
|
||||||
self.showFly = true
|
|
||||||
local allPos = {}
|
|
||||||
for i = 1, 4 do
|
|
||||||
local posX, posY = GFunc.randomPos(i, {x = 0, y = 0})
|
|
||||||
allPos[i] = {x = posX, y = posY}
|
|
||||||
end
|
|
||||||
self.flyPos[id] = allPos
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if #self.params.rewards <= 5 then
|
if #self.params.rewards <= 5 then
|
||||||
self.scrollView:setSizeDelta(#self.params.rewards*CELL_WIDTH, MIN_SIZE_Y)
|
self.scrollView:setSizeDelta(#self.params.rewards*CELL_WIDTH, MIN_SIZE_Y)
|
||||||
self.scrollRect:setPerLineNum(#self.params.rewards)
|
self.scrollRect:setPerLineNum(#self.params.rewards)
|
||||||
@ -99,48 +67,4 @@ function RewardBox:_refreshScrollRect(onlyRefresh)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function RewardBox:getCellDelayTime(idx)
|
|
||||||
if idx <= 35 then
|
|
||||||
return idx*0.05
|
|
||||||
else
|
|
||||||
local re = (idx - 1)%5 + 1
|
|
||||||
return re*0.025
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function RewardBox:playCellAction(cell, idx)
|
|
||||||
if self.actionStatus[idx] then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local delayTime = self:getCellDelayTime(idx)
|
|
||||||
local canvasGroup = cell.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
|
||||||
if not canvasGroup then
|
|
||||||
canvasGroup = cell.baseObject:addComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
|
||||||
end
|
|
||||||
canvasGroup.alpha = 0
|
|
||||||
|
|
||||||
local seq = cell.baseObject:createBindTweenSequence()
|
|
||||||
seq:AppendInterval(delayTime)
|
|
||||||
local tween = canvasGroup:DOFade(1, 0.1)
|
|
||||||
tween:SetEase(CS.DG.Tweening.Ease.InOutSine)
|
|
||||||
seq:Append(tween)
|
|
||||||
seq:AppendCallback(function()
|
|
||||||
self.actionStatus[idx] = true
|
|
||||||
self:turnToNext(idx)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
function RewardBox: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
|
|
||||||
|
|
||||||
return RewardBox
|
return RewardBox
|
||||||
Loading…
x
Reference in New Issue
Block a user