Merge branch 'dev' of http://git.juzugame.com/b6-client/b6-lua into dev
This commit is contained in:
commit
61b9ef3ae0
@ -173,6 +173,7 @@ GConst.TYPEOF_LUA_CLASS = {
|
||||
LARGE_HERO_CELL = "app/ui/common/cell/large_hero_cell",
|
||||
POP_HERO_CELL = "app/ui/shop/cell/pop_hero_cell",
|
||||
POP_REWARD_CELL = "app/ui/shop/cell/pop_reward_cell",
|
||||
GIFT_REWARD_CELL = "app/ui/shop/cell/gift_reward_cell",
|
||||
}
|
||||
|
||||
GConst.ATLAS_PATH = {
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
local BattleResultUI = class("BattleResultUI", BaseUI)
|
||||
|
||||
local UNIT_RESULT_RERPORT_CELL = "app/ui/battle/cell/unit_result_report_cell"
|
||||
local MAX_SCROLL_SHOW_COUNT = 10
|
||||
|
||||
function BattleResultUI:getPrefabPath()
|
||||
return "assets/prefabs/ui/battle/battle_result_ui.prefab"
|
||||
@ -24,6 +25,17 @@ function BattleResultUI:onClose()
|
||||
if self.sliderSequence then
|
||||
self.sliderSequence:Kill()
|
||||
end
|
||||
if self.animUnit then
|
||||
self.animUnit:Kill()
|
||||
end
|
||||
if self.animPig then
|
||||
self.animPig:Kill()
|
||||
end
|
||||
if self.animRewards then
|
||||
for idx, anim in pairs(self.animRewards) do
|
||||
anim:Kill()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleResultUI:onLoadRootComplete()
|
||||
@ -119,18 +131,16 @@ function BattleResultUI:refreshUnitNodeAnim(parent)
|
||||
uiMap["battle_result_ui.unit_node"]:setParent(parent, true)
|
||||
local canvasNodeUnit = parent:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
||||
|
||||
if self.animUnit == nil then
|
||||
self.animUnit = self.root:createBindTweenSequence()
|
||||
self.animUnit:Insert(0, canvasNodeUnit:DOFade(0, 0))
|
||||
self.animUnit:Insert(0.1, canvasNodeUnit:DOFade(1, 0))
|
||||
self.animUnit:Insert(0, parent:getTransform():DOScale(0, 0))
|
||||
self.animUnit:Insert(0.1, parent:getTransform():DOScale(0.35, 0))
|
||||
self.animUnit:Insert(0.13, parent:getTransform():DOScale(1.1, 0.16))
|
||||
self.animUnit:Insert(0.26, parent:getTransform():DOScale(1, 0.14))
|
||||
self.animUnit:SetAutoKill(false)
|
||||
else
|
||||
self.animUnit:Restart()
|
||||
end
|
||||
self.animUnit = self.root:createBindTweenSequence()
|
||||
self.animUnit:Insert(0, canvasNodeUnit:DOFade(0, 0))
|
||||
self.animUnit:Insert(0.1, canvasNodeUnit:DOFade(1, 0))
|
||||
self.animUnit:Insert(0, parent:getTransform():DOScale(0, 0))
|
||||
self.animUnit:Insert(0.1, parent:getTransform():DOScale(0.35, 0))
|
||||
self.animUnit:Insert(0.13, parent:getTransform():DOScale(1.1, 0.16))
|
||||
self.animUnit:Insert(0.26, parent:getTransform():DOScale(1, 0.14))
|
||||
self.animUnit:OnComplete(function()
|
||||
self.animUnit = nil
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleResultUI:refreshRewards()
|
||||
@ -139,6 +149,7 @@ function BattleResultUI:refreshRewards()
|
||||
return
|
||||
end
|
||||
|
||||
self.animRewards = {}
|
||||
local uiMap = self.root:genAllChildren()
|
||||
self.rewardNode = uiMap["battle_result_ui.reward_node"]
|
||||
self.rewardNode:setVisible(true)
|
||||
@ -149,13 +160,15 @@ function BattleResultUI:refreshRewards()
|
||||
end)
|
||||
self.scrollRectComp:addRefreshCallback(function(index, cell)
|
||||
cell:refresh(self.rewards[index])
|
||||
cell:showAppearAnim(index)
|
||||
if index <= MAX_SCROLL_SHOW_COUNT and self.animRewards[index] == nil then
|
||||
self.animRewards[index] = self:showRewardAppearAnim(index, cell)
|
||||
end
|
||||
cell:showRightUpIcon(index <= self.mysteryBoxIdx, GConst.ATLAS_PATH.COMMON, "common_chest_1")
|
||||
end)
|
||||
self.scrollRectComp:setFadeArgs(0.05, 0.3)
|
||||
self.scrollRectComp:clearCells()
|
||||
local rewardCount = #self.rewards
|
||||
if rewardCount > 10 then
|
||||
if rewardCount > MAX_SCROLL_SHOW_COUNT then
|
||||
local comp = scrollRect:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_SCROLL_RECT)
|
||||
comp.movementType = CS.UnityEngine.UI.ScrollRect.MovementType.Elastic
|
||||
self.scrollRectComp:setPerLineNum(5)
|
||||
@ -224,17 +237,19 @@ function BattleResultUI:tryShowGoldPig()
|
||||
if lastGemCount > currGemCount then
|
||||
lastGemCount = currGemCount
|
||||
end
|
||||
if self.animPig == nil then
|
||||
self.animPig = self.root:createBindTweenSequence()
|
||||
self.animPig:Insert(0, self.canvasGroupPigGem:DOFade(0, 0))
|
||||
self.animPig:Insert(1.5, self.canvasGroupPigGem:DOFade(1, 0.3))
|
||||
self.animPig:SetAutoKill(false)
|
||||
else
|
||||
self.animPig:Restart()
|
||||
end
|
||||
|
||||
self.animPig = self.root:createBindTweenSequence()
|
||||
self.animPig:Insert(0, self.canvasGroupPigGem:DOFade(0, 0))
|
||||
self.animPig:Insert(1.5, self.canvasGroupPigGem:DOFade(1, 0.3))
|
||||
self.animPig:SetAutoKill(false)
|
||||
self.animPig:OnComplete(function()
|
||||
self.animPig = nil
|
||||
end)
|
||||
|
||||
self.goldPigSpine:playAnimComplete("idle1", false, false, function()
|
||||
self.goldPigSpine:playAnim("idle2", true, false)
|
||||
end)
|
||||
|
||||
self.goldPigGemTx:setText("+" .. currGemCount - lastGemCount)
|
||||
GFunc.centerImgAndTx(self.goldPigGemImg, self.goldPigGemTx, 0, -4)
|
||||
if currGemCount > lastGemCount then
|
||||
@ -266,4 +281,23 @@ function BattleResultUI:tryShowGoldPig()
|
||||
return true
|
||||
end
|
||||
|
||||
-- 展示结算奖励的出现动画
|
||||
function BattleResultUI:showRewardAppearAnim(idx, cell)
|
||||
local canvasGroup = cell.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
||||
local selfObj = cell.baseObject
|
||||
local delay = (idx - 1) * 0.05
|
||||
local scaleX = selfObj:fastGetLocalScale()
|
||||
|
||||
local animRewardAppear = selfObj:createBindTweenSequence()
|
||||
animRewardAppear:Insert(0, canvasGroup:DOFade(0, 0))
|
||||
animRewardAppear:Insert(0, selfObj:getTransform():DOScale(scaleX * 0.6, 0))
|
||||
animRewardAppear:Insert(0.3 + delay, selfObj:getTransform():DOScale(scaleX * 1.1, 0.1))
|
||||
animRewardAppear:Insert(0.3 + delay, canvasGroup:DOFade(1, 0.1))
|
||||
animRewardAppear:Insert(0.4 + delay, selfObj:getTransform():DOScale(scaleX * 1, 0.13))
|
||||
animRewardAppear:OnComplete(function()
|
||||
animRewardAppear = nil
|
||||
end)
|
||||
return animRewardAppear
|
||||
end
|
||||
|
||||
return BattleResultUI
|
||||
@ -20,7 +20,6 @@ function RewardCell:init()
|
||||
ModuleManager.TipsManager:showRewardTips(self.rewardId, self.rewardType, self.baseObject)
|
||||
end
|
||||
end)
|
||||
self.canvasGroup = self.baseObject:getComponent(GConst.TYPEOF_UNITY_CLASS.CANVAS_GROUP)
|
||||
end
|
||||
|
||||
function RewardCell:refresh(reward)
|
||||
@ -156,24 +155,4 @@ function RewardCell:showRightUpIcon(show, atlas, iconName)
|
||||
self.rightUpIcon:setSprite(atlas, iconName)
|
||||
end
|
||||
|
||||
-- 展示结算奖励的出现动画
|
||||
function RewardCell:showAppearAnim(idx)
|
||||
local selfObj = self.baseObject
|
||||
local delay = (idx - 1) * 0.05
|
||||
local scaleX = self.baseObject:fastGetLocalScale()
|
||||
|
||||
if self.animAppear == nil then
|
||||
self.animAppear = selfObj:createBindTweenSequence()
|
||||
self.animAppear:Insert(0, self.canvasGroup:DOFade(0, 0))
|
||||
self.animAppear:Insert(0, selfObj:getTransform():DOScale(scaleX * 0.6, 0))
|
||||
self.animAppear:Insert(0.3 + delay, selfObj:getTransform():DOScale(scaleX * 1.1, 0.1))
|
||||
self.animAppear:Insert(0.3 + delay, self.canvasGroup:DOFade(1, 0.1))
|
||||
self.animAppear:Insert(0.4 + delay, selfObj:getTransform():DOScale(scaleX * 1, 0.13))
|
||||
self.animAppear:SetAutoKill(false)
|
||||
else
|
||||
self.animAppear:Restart()
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return RewardCell
|
||||
@ -35,7 +35,7 @@ function MainComp:refreshModule(selectModule)
|
||||
elseif self.curModuleType == GConst.MainCityConst.MAIN_MODULE.DAILY_CHALLENGE then
|
||||
-- 切换到每日挑战
|
||||
EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.GO_DAILY_CHALLENGE)
|
||||
if DataManager.DailyChallengeData:getIsPopTask() then
|
||||
if not Datamanager.TutorialData:getIsInTutorial() and DataManager.DailyChallengeData:getIsPopTask() then
|
||||
ModuleManager.DailyChallengeManager:showBattleTaskUI()
|
||||
end
|
||||
end
|
||||
|
||||
@ -9,9 +9,13 @@ function ModuleUnlockUI:isFullScreen()
|
||||
end
|
||||
|
||||
function ModuleUnlockUI:onClose()
|
||||
if self.unlockAnimationSeq then
|
||||
self.unlockAnimationSeq:Kill()
|
||||
self.unlockAnimationSeq = nil
|
||||
if self.animAppear then
|
||||
self.animAppear:Kill()
|
||||
self.animAppear = nil
|
||||
end
|
||||
if self.animVanish then
|
||||
self.animVanish:Kill()
|
||||
self.animVanish = nil
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ function BeginnerSellCell:init()
|
||||
if not self.rewardCellList then
|
||||
self.rewardCellList = {}
|
||||
for i = 1, MAX_REWARD_COUNT do
|
||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ function ChapterCell:init()
|
||||
if not self.rewardCellList then
|
||||
self.rewardCellList = {}
|
||||
for i = 1, MAX_REWARD_COUNT do
|
||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ function CoinSellCell:init()
|
||||
if not self.rewardCellList then
|
||||
self.rewardCellList = {}
|
||||
for i = 1, MAX_REWARD_COUNT do
|
||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
|
||||
end
|
||||
end
|
||||
self.priceText = uiMap["gift_cell.bg.price"]
|
||||
|
||||
47
lua/app/ui/shop/cell/gift_reward_cell.lua
Normal file
47
lua/app/ui/shop/cell/gift_reward_cell.lua
Normal file
@ -0,0 +1,47 @@
|
||||
local GiftRewardCell = class("GiftRewardCell", BaseCell)
|
||||
|
||||
function GiftRewardCell:init()
|
||||
local uiMap = self.baseObject:genAllChildren()
|
||||
self.bg = uiMap["gift_reward_cell.bg"]
|
||||
self.icon = uiMap["gift_reward_cell.icon"]
|
||||
self.fragmenImg = uiMap["gift_reward_cell.fragment"]
|
||||
self.numTx = uiMap["gift_reward_cell.num"]
|
||||
|
||||
self.baseObject:addClickListener(function()
|
||||
if self.clickCallback then
|
||||
self.clickCallback()
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function GiftRewardCell:refreshByConfig(reward)
|
||||
local id = reward.id
|
||||
local num = reward.num
|
||||
local heroCfgInfo = ConfigManager:getConfig("hero")[id]
|
||||
if heroCfgInfo then
|
||||
local qlt = heroCfgInfo.qlt
|
||||
self.bg:setSprite(GConst.ATLAS_PATH.SHOP, "shop_gift_bg_" .. qlt)
|
||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_HERO, tostring(heroCfgInfo.icon))
|
||||
self.fragmenImg:setVisible(true)
|
||||
self.numTx:setText("X" .. tostring(num))
|
||||
else
|
||||
local itemCfgInfo = ConfigManager:getConfig("item")[id]
|
||||
self.bg:setSprite(GConst.ATLAS_PATH.SHOP, "shop_gift_bg")
|
||||
self.icon:setSprite(GConst.ATLAS_PATH.ICON_ITEM, tostring(itemCfgInfo.icon))
|
||||
self.fragmenImg:setVisible(false)
|
||||
self.numTx:setText(num)
|
||||
end
|
||||
self:addClickListener(function()
|
||||
ModuleManager.TipsManager:showRewardTips(reward.id, reward.type, self.baseObject)
|
||||
end)
|
||||
end
|
||||
|
||||
function GiftRewardCell:addClickListener(callback)
|
||||
self.clickCallback = callback
|
||||
end
|
||||
|
||||
function GiftRewardCell:setVisible(visible, scale)
|
||||
self.baseObject:setVisible(visible, scale)
|
||||
end
|
||||
|
||||
return GiftRewardCell
|
||||
10
lua/app/ui/shop/cell/gift_reward_cell.lua.meta
Normal file
10
lua/app/ui/shop/cell/gift_reward_cell.lua.meta
Normal file
@ -0,0 +1,10 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 88089f781c49b0c4d8a41180459d2f3e
|
||||
ScriptedImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3}
|
||||
@ -21,7 +21,7 @@ function GrowCell:init()
|
||||
if not self.rewardCellList then
|
||||
self.rewardCellList = {}
|
||||
for i = 1, MAX_REWARD_COUNT do
|
||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -21,7 +21,7 @@ function LevelCell:init()
|
||||
if not self.rewardCellList then
|
||||
self.rewardCellList = {}
|
||||
for i = 1, MAX_REWARD_COUNT do
|
||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.REWARD_CELL)
|
||||
self.rewardCellList[i] = CellManager:addCellComp(uiMap["gift_cell.bg.reward_node.reward_cell_" .. i], GConst.TYPEOF_LUA_CLASS.GIFT_REWARD_CELL)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user