战斗buff
This commit is contained in:
parent
a98cf98c58
commit
ae30c47881
@ -191,6 +191,22 @@ function BattleController:clearBuff(side)
|
|||||||
self.battleUI:clearBuff(side)
|
self.battleUI:clearBuff(side)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleController:showBuffTips(side)
|
||||||
|
if side == BattleConst.SIDE_ATK then
|
||||||
|
local buffList = self.atkTeam:getBuffList()
|
||||||
|
if #buffList <= 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.battleUI:showLeftBuffTips(buffList)
|
||||||
|
else
|
||||||
|
local buffList = self.defTeam:getBuffList()
|
||||||
|
if #buffList <= 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.battleUI:showRightBuffTips(buffList)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function BattleController:prepareFight()
|
function BattleController:prepareFight()
|
||||||
local count = 0
|
local count = 0
|
||||||
local totalCount = 3
|
local totalCount = 3
|
||||||
|
|||||||
@ -28,6 +28,10 @@ function BattleTeam:prepare()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleTeam:getBuffList()
|
||||||
|
return self.buffList
|
||||||
|
end
|
||||||
|
|
||||||
function BattleTeam:getMainUnit()
|
function BattleTeam:getMainUnit()
|
||||||
return self.mainUnit
|
return self.mainUnit
|
||||||
end
|
end
|
||||||
|
|||||||
@ -103,6 +103,7 @@ function BattleUI:initSkill()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function BattleUI:initBuff()
|
function BattleUI:initBuff()
|
||||||
|
-- buff icon
|
||||||
self.atkBuffIconList = {
|
self.atkBuffIconList = {
|
||||||
self.uiMap["battle_ui.top_node.buff_l.buff_1"],
|
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_2"],
|
||||||
@ -111,6 +112,9 @@ function BattleUI:initBuff()
|
|||||||
self.uiMap["battle_ui.top_node.buff_l.buff_5"],
|
self.uiMap["battle_ui.top_node.buff_l.buff_5"],
|
||||||
}
|
}
|
||||||
for k, v in ipairs(self.atkBuffIconList) do
|
for k, v in ipairs(self.atkBuffIconList) do
|
||||||
|
v:addClickListener(function()
|
||||||
|
self.battleController:showBuffTips(1)
|
||||||
|
end)
|
||||||
v:setLocalScale(0, 0, 0)
|
v:setLocalScale(0, 0, 0)
|
||||||
end
|
end
|
||||||
self.atkBuffTextList = {
|
self.atkBuffTextList = {
|
||||||
@ -131,6 +135,9 @@ function BattleUI:initBuff()
|
|||||||
self.uiMap["battle_ui.top_node.buff_r.buff_5"],
|
self.uiMap["battle_ui.top_node.buff_r.buff_5"],
|
||||||
}
|
}
|
||||||
for k, v in ipairs(self.atkBuffIconList) do
|
for k, v in ipairs(self.atkBuffIconList) do
|
||||||
|
v:addClickListener(function()
|
||||||
|
self.battleController:showBuffTips(2)
|
||||||
|
end)
|
||||||
v:setLocalScale(0, 0, 0)
|
v:setLocalScale(0, 0, 0)
|
||||||
end
|
end
|
||||||
self.defBuffTextList = {
|
self.defBuffTextList = {
|
||||||
@ -143,6 +150,15 @@ function BattleUI:initBuff()
|
|||||||
for k, v in ipairs(self.defBuffTextList) do
|
for k, v in ipairs(self.defBuffTextList) do
|
||||||
v:setText(GConst.EMPTY_STRING)
|
v:setText(GConst.EMPTY_STRING)
|
||||||
end
|
end
|
||||||
|
-- buff的tips
|
||||||
|
self.battleBuffTipsRoot = self.uiMap["battle_ui.battle_buff_tips"]
|
||||||
|
self.battleBuffTipsRoot:setLocalScale(0, 0, 0)
|
||||||
|
local battleBuffTipsMask = self.uiMap["battle_ui.battle_buff_tips.mask"]
|
||||||
|
battleBuffTipsMask:addClickListener(function()
|
||||||
|
self.battleBuffTipsRoot:setLocalScale(0, 0, 0)
|
||||||
|
end)
|
||||||
|
self.battleBuffTipsBg = self.uiMap["battle_ui.battle_buff_tips.bg"]
|
||||||
|
self.battleBuffTipsBuff = self.uiMap["battle_ui.battle_buff_tips.bg.buff"]
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUI:refreshBuff(side, buffList)
|
function BattleUI:refreshBuff(side, buffList)
|
||||||
@ -157,8 +173,13 @@ function BattleUI:refreshBuff(side, buffList)
|
|||||||
local icon = self.atkBuffIconList[index]
|
local icon = self.atkBuffIconList[index]
|
||||||
local text = self.atkBuffTextList[index]
|
local text = self.atkBuffTextList[index]
|
||||||
icon:setLocalScale(1, 1, 1)
|
icon:setLocalScale(1, 1, 1)
|
||||||
icon:setTexture(GConst.ATLAS_PATH.ICON_BUFF, buffObj.buff:getIcon())
|
icon:setSprite(GConst.ATLAS_PATH.ICON_BUFF, buffObj.buff:getIcon())
|
||||||
text:setText(buffObj.round)
|
local round = buffObj.round
|
||||||
|
if round <= 1 or round > 9 then
|
||||||
|
text:setText(GConst.EMPTY_STRING)
|
||||||
|
else
|
||||||
|
text:setText(tostring(round))
|
||||||
|
end
|
||||||
index = index + 1
|
index = index + 1
|
||||||
if index > buffIconCount then
|
if index > buffIconCount then
|
||||||
break
|
break
|
||||||
@ -180,8 +201,13 @@ function BattleUI:refreshBuff(side, buffList)
|
|||||||
local icon = self.defBuffIconList[index]
|
local icon = self.defBuffIconList[index]
|
||||||
local text = self.defBuffTextList[index]
|
local text = self.defBuffTextList[index]
|
||||||
icon:setLocalScale(1, 1, 1)
|
icon:setLocalScale(1, 1, 1)
|
||||||
icon:setTexture(GConst.ATLAS_PATH.ICON_BUFF, buffObj.buff:getIcon())
|
icon:setSprite(GConst.ATLAS_PATH.ICON_BUFF, buffObj.buff:getIcon())
|
||||||
text:setText(buffObj.round)
|
local round = buffObj.round
|
||||||
|
if round <= 1 or round > 9 then
|
||||||
|
text:setText(GConst.EMPTY_STRING)
|
||||||
|
else
|
||||||
|
text:setText(tostring(round))
|
||||||
|
end
|
||||||
index = index + 1
|
index = index + 1
|
||||||
if index > buffIconCount then
|
if index > buffIconCount then
|
||||||
break
|
break
|
||||||
@ -213,6 +239,18 @@ function BattleUI:clearBuff(side)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUI:showLeftBuffTips(buffList)
|
||||||
|
self:showBuffTips(buffList)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleUI:showLeftBuffTips(buffList)
|
||||||
|
self:showBuffTips(buffList)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleUI:showBuffTips(buffList)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
function BattleUI:initBattlefield()
|
function BattleUI:initBattlefield()
|
||||||
self.battleNode = self.uiMap["battle_ui.battle_node"]
|
self.battleNode = self.uiMap["battle_ui.battle_node"]
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user