diff --git a/lua/app/ui/common/mop_up_ui.lua b/lua/app/ui/common/mop_up_ui.lua index eeb02ab9..c1d463b9 100644 --- a/lua/app/ui/common/mop_up_ui.lua +++ b/lua/app/ui/common/mop_up_ui.lua @@ -1,4 +1,5 @@ local MopUpUI = class("MopUpUI", BaseUI) +local MAX_SCROLL_SHOW_COUNT = 10 function MopUpUI:isFullScreen() return false @@ -8,6 +9,16 @@ function MopUpUI:getPrefabPath() return "assets/prefabs/ui/common/mop_up_ui.prefab" end +function MopUpUI:onClose() + if self.animRewards then + for idx, anim in pairs(self.animRewards) do + if anim then + anim:Kill() + end + end + end +end + function MopUpUI:ctor(params) self.customtitleTx = params.customtitleTx self.rewards = params.rewards @@ -56,6 +67,7 @@ function MopUpUI:_addListeners() end function MopUpUI:refreshScrollrect() + self.animRewards = {} if not self.scrollRect then local uiMap = self.root:genAllChildren() self.scrollRect = uiMap["mop_up_ui.bg.scroll_rect"]:addLuaComponent(GConst.TYPEOF_LUA_CLASS.SCROLL_RECT_BASE) @@ -63,6 +75,9 @@ function MopUpUI:refreshScrollrect() return GConst.TYPEOF_LUA_CLASS.REWARD_CELL end) self.scrollRect:addRefreshCallback(function(index, cell) + if index <= MAX_SCROLL_SHOW_COUNT and self.animRewards[index] == nil then + self.animRewards[index] = self:showRewardAppearAnim(index, cell) + end cell:refresh(self.rewards[index]) end) end @@ -102,4 +117,25 @@ function MopUpUI:refreshTarget() uiMap["mop_up_ui.bg.item_node.progress_slider"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_SLIDER).value = curProgress / self.target.value end + +-- 展示结算奖励的出现动画 +function MopUpUI: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 MopUpUI \ No newline at end of file diff --git a/lua/app/ui/hero/weapon_info_comp.lua b/lua/app/ui/hero/weapon_info_comp.lua index 405a0a51..6ab305e8 100644 --- a/lua/app/ui/hero/weapon_info_comp.lua +++ b/lua/app/ui/hero/weapon_info_comp.lua @@ -48,10 +48,10 @@ function WeaponInfoComp:refresh() self.attrContent:setAnchoredPosition(0, 0) -- 基础属性 - local diffAtk = (nextWeaponEntity:getAttack() - self.weaponEntity:getAttack()) // DEFAULT_FACTOR + local diffAtk = (nextWeaponEntity:getBaseAttack() - self.weaponEntity:getBaseAttack()) // DEFAULT_FACTOR local diffNormalHurt = (nextWeaponEntity:getNormalHurt() - self.weaponEntity:getNormalHurt()) // DEFAULT_FACTOR local diffSkillHurt = (nextWeaponEntity:getSkillHurt() - self.weaponEntity:getSkillHurt()) // DEFAULT_FACTOR - local diffHp = (nextWeaponEntity:getHp() - self.weaponEntity:getHp()) // DEFAULT_FACTOR + local diffHp = (nextWeaponEntity:getBaseHp() - self.weaponEntity:getBaseHp()) // DEFAULT_FACTOR local showAttrType = {} for index, obj in ipairs(self.attr) do local map = obj:genAllChildren()