Merge branch 'dev' of http://git.juzugame.com/b6-client/b6-lua into dev
This commit is contained in:
commit
2f28925a71
@ -7,18 +7,10 @@ local GAME_RES_WHITE_LIST = {
|
||||
GConst.ATLAS_PATH.COMMON,
|
||||
-- icon
|
||||
GConst.ATLAS_PATH.ICON_SKILL,
|
||||
GConst.ATLAS_PATH.ICON_SKILL_ROGUE,
|
||||
GConst.ATLAS_PATH.ICON_ITEM,
|
||||
GConst.ATLAS_PATH.ICON_EQUIP,
|
||||
GConst.ATLAS_PATH.ICON_AVATAR,
|
||||
GConst.ATLAS_PATH.ICON_RUNE,
|
||||
GConst.ATLAS_PATH.ICON_LEGACY,
|
||||
-- hero
|
||||
GConst.SPINE_ASSET_PATH.P0001,
|
||||
GConst.SPINE_ASSET_PATH.P0002,
|
||||
GConst.SPINE_ASSET_PATH.P0003,
|
||||
GConst.SPINE_ASSET_PATH.P0004,
|
||||
-- 战斗伤害字体
|
||||
"assets/arts/fonts/tmpfonts/battle/font_battle_sdf.asset",
|
||||
GConst.ATLAS_PATH.ICON_HERO,
|
||||
GConst.ATLAS_PATH.ICON_BUFF,
|
||||
}
|
||||
|
||||
---- 预加载游戏资源
|
||||
|
||||
@ -175,6 +175,7 @@ GConst.ATLAS_PATH = {
|
||||
ICON_SKILL = "assets/arts/atlas/icon/skill.asset",
|
||||
ICON_HERO = "assets/arts/atlas/icon/hero.asset",
|
||||
ICON_SKILL_ROGUE = "assets/arts/atlas/icon/skill_rogue.asset",
|
||||
ICON_BUFF = "assets/arts/atlas/icon/buff.asset",
|
||||
}
|
||||
|
||||
GConst.TOUCH_EVENT = {
|
||||
|
||||
@ -252,9 +252,14 @@ function BattleUnitComp:useAssistingSkill(count, delay, callback)
|
||||
callback()
|
||||
return
|
||||
end
|
||||
self.assistingDmgAddition = count
|
||||
local attrName = GConst.MATCH_ATTACK_NAME[self:getMatchType()]
|
||||
self.assistingDmgAddCount = self.unitEntity:addAttr(attrName, count*DEFAULT_FACTOR, true)
|
||||
self.assistingDmgAddition = count - 1
|
||||
if self.assistingDmgAddition <= 0 then
|
||||
self.assistingDmgAddition = 0
|
||||
self.assistingDmgAddCount = 0
|
||||
else
|
||||
self.assistingDmgAddCount = self.unitEntity:addAttr(attrName, self.assistingDmgAddition*DEFAULT_FACTOR, true)
|
||||
end
|
||||
self.actionOverCallback = callback
|
||||
if delay > 0 then
|
||||
self.waitTime = delay
|
||||
@ -472,6 +477,7 @@ function BattleUnitComp:exitDeadState()
|
||||
end
|
||||
|
||||
function BattleUnitComp:enterDeadState()
|
||||
self:removeAllBuff()
|
||||
local aniName = SPINE_ANIMATION_NAME.DEAD
|
||||
self.deadTime = self:getAnimationDuration(aniName) + 0.1
|
||||
self:playAnimation(aniName, false, false)
|
||||
@ -514,6 +520,8 @@ function BattleUnitComp:enterEnterBattlefieldState()
|
||||
self.targetX = BattleConst.INIT_POS_X
|
||||
self.moveDirection = -1
|
||||
end
|
||||
local time = math.abs(self.targetX - self.positionX)/BattleConst.MOVE_SPEED
|
||||
self.battleController:moveBattlefield(time)
|
||||
else
|
||||
self:playAnimation(SPINE_ANIMATION_NAME.BORN, false, false)
|
||||
self.waitTime = self:getAnimationDuration(SPINE_ANIMATION_NAME.BORN)
|
||||
@ -908,6 +916,10 @@ function BattleUnitComp:updateBuffState(buff, num)
|
||||
self.team:updateBuffState(buff, num)
|
||||
end
|
||||
|
||||
function BattleUnitComp:removeAllBuff()
|
||||
self.team:removeAllBuff()
|
||||
end
|
||||
|
||||
function BattleUnitComp:onSkillTakeEffect(skill)
|
||||
skill:endUse()
|
||||
local effectList = skill:getEffectList()
|
||||
|
||||
@ -179,6 +179,18 @@ function BattleController:setIsPauseHpProgress(value)
|
||||
self.battleUI:setIsPauseHpProgress(value)
|
||||
end
|
||||
|
||||
function BattleController:moveBattlefield(time)
|
||||
self.battleUI:moveBattlefield(time)
|
||||
end
|
||||
|
||||
function BattleController:refreshBuff(side, buffList)
|
||||
self.battleUI:refreshBuff(side, buffList)
|
||||
end
|
||||
|
||||
function BattleController:clearBuff(side)
|
||||
self.battleUI:clearBuff(side)
|
||||
end
|
||||
|
||||
function BattleController:prepareFight()
|
||||
local count = 0
|
||||
local totalCount = 3
|
||||
|
||||
@ -156,6 +156,7 @@ function BattleTeam:handleShield(reduceShield, unit)
|
||||
return
|
||||
end
|
||||
|
||||
local needReedRefreshBuff = false
|
||||
local shieldNum = 0
|
||||
local currShieldBuff = self.shieldBuffList[1]
|
||||
while currShieldBuff do
|
||||
@ -170,6 +171,9 @@ function BattleTeam:handleShield(reduceShield, unit)
|
||||
currShieldBuff.result = 0
|
||||
for k, v in ipairs(self.buffList) do
|
||||
if v == currShieldBuff then
|
||||
if not needReedRefreshBuff and currShieldBuff.buff:getIcon() then
|
||||
needReedRefreshBuff = true
|
||||
end
|
||||
self:updateBuffState(currShieldBuff.buff, -1)
|
||||
BattleBuffHandle.removeBuff(unit, currShieldBuff)
|
||||
currShieldBuff = nil
|
||||
@ -182,11 +186,31 @@ function BattleTeam:handleShield(reduceShield, unit)
|
||||
end
|
||||
currShieldBuff = self.shieldBuffList[1]
|
||||
end
|
||||
if needReedRefreshBuff then
|
||||
self.battleController:refreshBuff(self.side, self.buffList)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleTeam:addBuff(buffEffect)
|
||||
table.insert(self.buffList, buffEffect)
|
||||
self:updateBuffState(buffEffect.buff, 1)
|
||||
if buffEffect.buff:getIcon() then
|
||||
self.battleController:refreshBuff(self.side, self.buffList)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleTeam:removeAllBuff()
|
||||
local buffEffect = nil
|
||||
local count = #self.buffList
|
||||
for i = count, 1, -1 do
|
||||
buffEffect = self.buffList[i]
|
||||
if buffEffect then
|
||||
self:updateBuffState(buffEffect.buff, -1)
|
||||
table.remove(self.buffList, i)
|
||||
BattleBuffHandle.removeBuff(self, buffEffect)
|
||||
end
|
||||
end
|
||||
self.battleController:clearBuff(self.side)
|
||||
end
|
||||
|
||||
function BattleTeam:doBuffWork()
|
||||
@ -205,6 +229,7 @@ function BattleTeam:doBuffWork()
|
||||
BattleBuffHandle.removeBuff(self.mainUnit, buffEffect)
|
||||
end
|
||||
end
|
||||
self.battleController:refreshBuff(self.side, self.buffList)
|
||||
end
|
||||
|
||||
function BattleTeam:updateBuffState(buff, num)
|
||||
|
||||
@ -34,6 +34,7 @@ function BattleUI:_display()
|
||||
self.boardCacheBox = uiMap["battle_ui.bg_2.board_cache_node.skill_box"]
|
||||
self:initBg()
|
||||
self:initSkill()
|
||||
self:initBuff()
|
||||
self:initBattlefield()
|
||||
self:initNumberNode()
|
||||
self:initHpNode()
|
||||
@ -66,6 +67,19 @@ function BattleUI:loadBg(bgName)
|
||||
end)
|
||||
end
|
||||
|
||||
function BattleUI:moveBattlefield(time)
|
||||
local width = self.bg:fastGetSizeDelta()
|
||||
self.bg:setAnchoredPositionX(width/4)
|
||||
if self.bgMoveTween == nil then
|
||||
self.bgMoveTween = self.bg:getTransform():DOAnchorPosX(-width/4, time)
|
||||
self.bgMoveTween:SetIntId(GConst.DOTWEEN_IDS.BATTLE)
|
||||
self.bgMoveTween:SetAutoKill(false)
|
||||
else
|
||||
self.bgMoveTween:ChangeEndValue(width*3/4, time, true)
|
||||
self.bgMoveTween:Restart()
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUI:initSkill()
|
||||
if self.skillNodeCells then
|
||||
return
|
||||
@ -88,6 +102,117 @@ function BattleUI:initSkill()
|
||||
uiMap["battle_ui.bg_2.skill_node"]:getComponent(GConst.TYPEOF_UNITY_CLASS.BF_HORIZONTAL_OR_VERTICAL_LAYOUT):RefreshLayout()
|
||||
end
|
||||
|
||||
function BattleUI:initBuff()
|
||||
self.atkBuffIconList = {
|
||||
self.uiMap["battle_ui.top_node.buff_l.buff_1"],
|
||||
self.uiMap["battle_ui.top_node.buff_l.buff_2"],
|
||||
self.uiMap["battle_ui.top_node.buff_l.buff_3"],
|
||||
self.uiMap["battle_ui.top_node.buff_l.buff_4"],
|
||||
self.uiMap["battle_ui.top_node.buff_l.buff_5"],
|
||||
}
|
||||
for k, v in ipairs(self.atkBuffIconList) do
|
||||
v:setLocalScale(0, 0, 0)
|
||||
end
|
||||
self.atkBuffTextList = {
|
||||
self.uiMap["battle_ui.top_node.buff_l.text_1"],
|
||||
self.uiMap["battle_ui.top_node.buff_l.text_2"],
|
||||
self.uiMap["battle_ui.top_node.buff_l.text_3"],
|
||||
self.uiMap["battle_ui.top_node.buff_l.text_4"],
|
||||
self.uiMap["battle_ui.top_node.buff_l.text_5"],
|
||||
}
|
||||
for k, v in ipairs(self.atkBuffTextList) do
|
||||
v:setText(GConst.EMPTY_STRING)
|
||||
end
|
||||
self.defBuffIconList = {
|
||||
self.uiMap["battle_ui.top_node.buff_r.buff_1"],
|
||||
self.uiMap["battle_ui.top_node.buff_r.buff_2"],
|
||||
self.uiMap["battle_ui.top_node.buff_r.buff_3"],
|
||||
self.uiMap["battle_ui.top_node.buff_r.buff_4"],
|
||||
self.uiMap["battle_ui.top_node.buff_r.buff_5"],
|
||||
}
|
||||
for k, v in ipairs(self.atkBuffIconList) do
|
||||
v:setLocalScale(0, 0, 0)
|
||||
end
|
||||
self.defBuffTextList = {
|
||||
self.uiMap["battle_ui.top_node.buff_r.text_1"],
|
||||
self.uiMap["battle_ui.top_node.buff_r.text_2"],
|
||||
self.uiMap["battle_ui.top_node.buff_r.text_3"],
|
||||
self.uiMap["battle_ui.top_node.buff_r.text_4"],
|
||||
self.uiMap["battle_ui.top_node.buff_r.text_5"],
|
||||
}
|
||||
for k, v in ipairs(self.defBuffTextList) do
|
||||
v:setText(GConst.EMPTY_STRING)
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUI:refreshBuff(side, buffList)
|
||||
if side == GConst.BattleConst.SIDE_ATK then
|
||||
local buffObj = nil
|
||||
local count = #buffList
|
||||
local buffIconCount = #self.atkBuffIconList
|
||||
local index = 1
|
||||
for i = 1, count do
|
||||
buffObj = buffList[i]
|
||||
if buffObj and buffObj.buff:getIcon() then
|
||||
local icon = self.atkBuffIconList[index]
|
||||
local text = self.atkBuffTextList[index]
|
||||
icon:setLocalScale(1, 1, 1)
|
||||
icon:setTexture(GConst.ATLAS_PATH.ICON_BUFF, buffObj.buff:getIcon())
|
||||
text:setText(buffObj.round)
|
||||
index = index + 1
|
||||
if index > buffIconCount then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
for i = index, buffIconCount do
|
||||
self.atkBuffIconList[i]:setLocalScale(0, 0, 0)
|
||||
self.atkBuffTextList[i]:setText(GConst.EMPTY_STRING)
|
||||
end
|
||||
else
|
||||
local buffObj = nil
|
||||
local count = #buffList
|
||||
local buffIconCount = #self.defBuffIconList
|
||||
local index = 1
|
||||
for i = 1, count do
|
||||
buffObj = buffList[i]
|
||||
if buffObj and buffObj.buff:getIcon() then
|
||||
local icon = self.defBuffIconList[index]
|
||||
local text = self.defBuffTextList[index]
|
||||
icon:setLocalScale(1, 1, 1)
|
||||
icon:setTexture(GConst.ATLAS_PATH.ICON_BUFF, buffObj.buff:getIcon())
|
||||
text:setText(buffObj.round)
|
||||
index = index + 1
|
||||
if index > buffIconCount then
|
||||
break
|
||||
end
|
||||
end
|
||||
end
|
||||
for i = index, buffIconCount do
|
||||
self.defBuffIconList[i]:setLocalScale(0, 0, 0)
|
||||
self.defBuffTextList[i]:setText(GConst.EMPTY_STRING)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUI:clearBuff(side)
|
||||
if side == GConst.BattleConst.SIDE_ATK then
|
||||
for k, v in ipairs(self.atkBuffIconList) do
|
||||
v:setLocalScale(0, 0, 0)
|
||||
end
|
||||
for k, v in ipairs(self.atkBuffTextList) do
|
||||
v:setText(GConst.EMPTY_STRING)
|
||||
end
|
||||
else
|
||||
for k, v in ipairs(self.defBuffIconList) do
|
||||
v:setLocalScale(0, 0, 0)
|
||||
end
|
||||
for k, v in ipairs(self.defBuffTextList) do
|
||||
v:setText(GConst.EMPTY_STRING)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function BattleUI:initBattlefield()
|
||||
self.battleNode = self.uiMap["battle_ui.battle_node"]
|
||||
end
|
||||
@ -756,6 +881,10 @@ function BattleUI:clear()
|
||||
self.hpProgressYellowRightTween:Kill()
|
||||
self.hpProgressYellowRightTween = nil
|
||||
end
|
||||
if self.bgMoveTween then
|
||||
self.bgMoveTween:Kill()
|
||||
self.bgMoveTween = nil
|
||||
end
|
||||
if self.battleNumberNode then
|
||||
self.battleNumberNode:removeAllChildren()
|
||||
end
|
||||
|
||||
@ -66,4 +66,8 @@ function BattleBuffEntity:setTargetSide(side)
|
||||
self.targetSide = side
|
||||
end
|
||||
|
||||
function BattleBuffEntity:getIcon()
|
||||
return self.buffInfo.icon
|
||||
end
|
||||
|
||||
return BattleBuffEntity
|
||||
Loading…
x
Reference in New Issue
Block a user