Merge branch 'dev' of http://git.juzugame.com/b6-client/b6-lua into dev
# Conflicts: # lua/app/config/strings/cn/buff.lua.meta
This commit is contained in:
commit
3c896cf339
@ -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
|
||||||
|
|||||||
@ -1,3 +1,5 @@
|
|||||||
|
local UIPrefabObject = require "app/bf/unity/uiprefab_object"
|
||||||
|
|
||||||
local BattleUI = class("BattleUI", BaseUI)
|
local BattleUI = class("BattleUI", BaseUI)
|
||||||
local GRID_CELL = "app/ui/battle/cell/grid_cell"
|
local GRID_CELL = "app/ui/battle/cell/grid_cell"
|
||||||
local GRID_CELL_PATH = "assets/prefabs/ui/battle/cell/grid_cell.prefab"
|
local GRID_CELL_PATH = "assets/prefabs/ui/battle/cell/grid_cell.prefab"
|
||||||
@ -103,6 +105,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 +114,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 = {
|
||||||
@ -130,7 +136,10 @@ function BattleUI:initBuff()
|
|||||||
self.uiMap["battle_ui.top_node.buff_r.buff_4"],
|
self.uiMap["battle_ui.top_node.buff_r.buff_4"],
|
||||||
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.defBuffIconList) 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 +152,22 @@ 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"]
|
||||||
|
self.battleBuffTipsBuffList = {}
|
||||||
|
local children = self.battleBuffTipsBg:getChildList()
|
||||||
|
if children then
|
||||||
|
for k, v in ipairs(children) do
|
||||||
|
table.insert(self.battleBuffTipsBuffList, v)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BattleUI:refreshBuff(side, buffList)
|
function BattleUI:refreshBuff(side, buffList)
|
||||||
@ -157,8 +182,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 +210,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 +248,76 @@ function BattleUI:clearBuff(side)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleUI:showLeftBuffTips(buffList)
|
||||||
|
local x = self.battleBuffTipsBg:fastGetAnchoredPosition()
|
||||||
|
if x > 0 then
|
||||||
|
self.battleBuffTipsBg:setAnchoredPositionX(-x)
|
||||||
|
end
|
||||||
|
self:showBuffTips(buffList)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleUI:showRightBuffTips(buffList)
|
||||||
|
local x = self.battleBuffTipsBg:fastGetAnchoredPosition()
|
||||||
|
if x < 0 then
|
||||||
|
self.battleBuffTipsBg:setAnchoredPositionX(-x)
|
||||||
|
end
|
||||||
|
self:showBuffTips(buffList)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleUI:showBuffTips(buffList)
|
||||||
|
if #buffList <= 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self.battleBuffTipsRoot:setLocalScale(1, 1, 1)
|
||||||
|
local buffObj = nil
|
||||||
|
local count = #buffList
|
||||||
|
local index = 1
|
||||||
|
local addY = 0
|
||||||
|
for i = 1, count do
|
||||||
|
buffObj = buffList[i]
|
||||||
|
if buffObj and buffObj.buff:getIcon() then
|
||||||
|
local buffTipsObj = self:getBattleBuffTipsObj(index)
|
||||||
|
buffTipsObj:setLocalScale(1, 1, 1)
|
||||||
|
buffTipsObj:setAnchoredPositionY(-addY)
|
||||||
|
local buffTipsObjMap = buffTipsObj:genAllChildren()
|
||||||
|
buffTipsObjMap["buff.icon"]:setSprite(GConst.ATLAS_PATH.ICON_BUFF, buffObj.buff:getIcon())
|
||||||
|
local round = buffObj.round
|
||||||
|
if round <= 1 or round > 9 then
|
||||||
|
buffTipsObjMap["buff.round"]:setText(GConst.EMPTY_STRING)
|
||||||
|
else
|
||||||
|
buffTipsObjMap["buff.round"]:setText(tostring(round))
|
||||||
|
end
|
||||||
|
local descTx = buffTipsObjMap["buff.desc"]
|
||||||
|
descTx:setText(buffObj.buff:getDesc())
|
||||||
|
descTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO):ForceMeshUpdate()
|
||||||
|
local height = descTx:getComponent(GConst.TYPEOF_UNITY_CLASS.UI_TEXT_MESH_PRO).renderedHeight
|
||||||
|
if height > 30 then
|
||||||
|
addY = addY + 46 + height - 30
|
||||||
|
else
|
||||||
|
addY = addY + 46
|
||||||
|
end
|
||||||
|
index = index + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
for i = index, #self.battleBuffTipsBuffList do
|
||||||
|
self.battleBuffTipsBuffList[i]:setLocalScale(0, 0, 0)
|
||||||
|
end
|
||||||
|
self.battleBuffTipsBg:setSizeDeltaY(addY + 20)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BattleUI:getBattleBuffTipsObj(index)
|
||||||
|
if self.battleBuffTipsBuffList[index] then
|
||||||
|
return self.battleBuffTipsBuffList[index]
|
||||||
|
end
|
||||||
|
local prefab = CS.UnityEngine.Object.Instantiate(self.battleBuffTipsBuff:getGameObject())
|
||||||
|
local prefabObject = UIPrefabObject:create()
|
||||||
|
prefabObject:initWithPrefab(self.battleBuffTipsBuff:getAssetPath(), prefab)
|
||||||
|
prefabObject:initPrefabHelper()
|
||||||
|
prefabObject:setParent(self.battleBuffTipsBg, false)
|
||||||
|
table.insert(self.battleBuffTipsBuffList, prefabObject)
|
||||||
|
return prefabObject
|
||||||
|
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
|
||||||
|
|||||||
@ -22,6 +22,18 @@ function BattleBuffEntity:getName()
|
|||||||
return self.name
|
return self.name
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function BattleBuffEntity:getDesc()
|
||||||
|
if self.desc == nil then
|
||||||
|
local buff18NInfo = I18N:getConfigWithOtherKey("buff", "name")[self.name]
|
||||||
|
if buff18NInfo then
|
||||||
|
self.desc = buff18NInfo.desc or GConst.EMPTY_STRING
|
||||||
|
else
|
||||||
|
self.desc = GConst.EMPTY_STRING
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return self.desc
|
||||||
|
end
|
||||||
|
|
||||||
function BattleBuffEntity:getBuffType()
|
function BattleBuffEntity:getBuffType()
|
||||||
return self.buffType
|
return self.buffType
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user