diff --git a/lua/app/config/buff.lua b/lua/app/config/buff.lua index b4638235..a166c860 100644 --- a/lua/app/config/buff.lua +++ b/lua/app/config/buff.lua @@ -2,37 +2,43 @@ local buff = { [1]={ ["name"]="hurt", ["buff_type"]=3, - ["formula"]=1 + ["formula"]=1, + ["icon"]="dec_dmg_red_add" }, [2]={ ["name"]="hurt_red", ["buff_type"]=3, ["position"]=1, - ["formula"]=1 + ["formula"]=1, + ["icon"]="dec_dmg_red_add" }, [3]={ ["name"]="hurt_yellow", ["buff_type"]=3, ["position"]=2, - ["formula"]=1 + ["formula"]=1, + ["icon"]="dec_dmg_red_add" }, [4]={ ["name"]="hurt_green", ["buff_type"]=3, ["position"]=3, - ["formula"]=1 + ["formula"]=1, + ["icon"]="dec_dmg_red_add" }, [5]={ ["name"]="hurt_blue", ["buff_type"]=3, ["position"]=4, - ["formula"]=1 + ["formula"]=1, + ["icon"]="dec_dmg_red_add" }, [6]={ ["name"]="hurt_purple", ["buff_type"]=3, ["position"]=5, - ["formula"]=1 + ["formula"]=1, + ["icon"]="dec_dmg_red_add" }, [7]={ ["name"]="dec_dmg_red_add", @@ -107,70 +113,84 @@ local buff = { [19]={ ["name"]="dmg_addition_red_add", ["buff_type"]=1, - ["position"]=1 + ["position"]=1, + ["icon"]="dec_dmg_red_add" }, [20]={ ["name"]="dmg_addition_yellow_add", ["buff_type"]=1, - ["position"]=2 + ["position"]=2, + ["icon"]="dec_dmg_red_add" }, [21]={ ["name"]="dmg_addition_green_add", ["buff_type"]=1, - ["position"]=3 + ["position"]=3, + ["icon"]="dec_dmg_red_add" }, [22]={ ["name"]="dmg_addition_blue_add", ["buff_type"]=1, - ["position"]=4 + ["position"]=4, + ["icon"]="dec_dmg_red_add" }, [23]={ ["name"]="dmg_addition_purple_add", ["buff_type"]=1, - ["position"]=5 + ["position"]=5, + ["icon"]="dec_dmg_red_add" }, [24]={ ["name"]="dmg_addition_all_add", - ["buff_type"]=1 + ["buff_type"]=1, + ["icon"]="dec_dmg_red_add" }, [25]={ ["name"]="atkp_color_add", - ["buff_type"]=1 + ["buff_type"]=1, + ["icon"]="dec_dmg_red_add" }, [26]={ ["name"]="atkp_red_add", ["buff_type"]=1, - ["position"]=1 + ["position"]=1, + ["icon"]="dec_dmg_red_add" }, [27]={ ["name"]="atkp_yellow_add", ["buff_type"]=1, - ["position"]=2 + ["position"]=2, + ["icon"]="dec_dmg_red_add" }, [28]={ ["name"]="atkp_green_add", ["buff_type"]=1, - ["position"]=3 + ["position"]=3, + ["icon"]="dec_dmg_red_add" }, [29]={ ["name"]="atkp_blue_add", ["buff_type"]=1, - ["position"]=4 + ["position"]=4, + ["icon"]="dec_dmg_red_add" }, [30]={ ["name"]="atkp_purple_add", ["buff_type"]=1, - ["position"]=5 + ["position"]=5, + ["icon"]="dec_dmg_red_add" }, [31]={ ["name"]="wavehealp", ["buff_type"]=5, - ["formula"]=2 + ["formula"]=2, + ["icon"]="dec_dmg_red_add" }, [32]={ ["name"]="heal", ["buff_type"]=5, ["formula"]=3, + ["icon"]="dec_dmg_red_add", ["fx_take"]={ 4001 } @@ -193,7 +213,8 @@ local buff = { }, [35]={ ["name"]="atkp_add", - ["buff_type"]=1 + ["buff_type"]=1, + ["icon"]="dec_dmg_red_add" }, [36]={ ["name"]="normal_attack_dec", @@ -206,41 +227,50 @@ local buff = { [37]={ ["name"]="normal_attack_add", ["buff_type"]=1, + ["icon"]="dec_dmg_red_add", ["fx_continued"]={ 4001 } }, [38]={ ["name"]="block", - ["buff_type"]=1 + ["buff_type"]=1, + ["icon"]="dec_dmg_red_add" }, [39]={ ["name"]="hpp_add", - ["buff_type"]=1 + ["buff_type"]=1, + ["icon"]="dec_dmg_red_add" }, [40]={ ["name"]="crit_add", - ["buff_type"]=1 + ["buff_type"]=1, + ["icon"]="dec_dmg_red_add" }, [41]={ ["name"]="crit_time_add", - ["buff_type"]=1 + ["buff_type"]=1, + ["icon"]="dec_dmg_red_add" }, [42]={ ["name"]="exp_time_add", - ["buff_type"]=7 + ["buff_type"]=7, + ["icon"]="dec_dmg_red_add" }, [43]={ ["name"]="cured_add", - ["buff_type"]=1 + ["buff_type"]=1, + ["icon"]="dec_dmg_red_add" }, [44]={ ["name"]="add_skill", - ["buff_type"]=7 + ["buff_type"]=7, + ["icon"]="dec_dmg_red_add" }, [45]={ ["name"]="skill_fire_times", - ["buff_type"]=7 + ["buff_type"]=7, + ["icon"]="dec_dmg_red_add" } } local keys = { diff --git a/lua/app/config/strings/cn/buff.lua b/lua/app/config/strings/cn/buff.lua new file mode 100644 index 00000000..97620265 --- /dev/null +++ b/lua/app/config/strings/cn/buff.lua @@ -0,0 +1,87 @@ +local buff = { + [7]={ + ["desc"]="受到红色元素伤害降低", + ["name"]="dec_dmg_red_add" + }, + [8]={ + ["desc"]="受到黄色元素伤害降低", + ["name"]="dec_dmg_yellow_add" + }, + [9]={ + ["desc"]="受到绿色元素伤害降低", + ["name"]="dec_dmg_green_add" + }, + [10]={ + ["desc"]="受到蓝色元素伤害降低", + ["name"]="dec_dmg_blue_add" + }, + [11]={ + ["desc"]="受到紫色元素伤害降低", + ["name"]="dec_dmg_purple_add" + }, + [12]={ + ["desc"]="受到所有伤害降低", + ["name"]="dec_dmg_all_add" + }, + [13]={ + ["desc"]="受到红色元素伤害增加", + ["name"]="weakness_red_add" + }, + [14]={ + ["desc"]="受到黄色元素伤害增加", + ["name"]="weakness_yellow_add" + }, + [15]={ + ["desc"]="受到绿色元素伤害增加", + ["name"]="weakness_green_add" + }, + [16]={ + ["desc"]="受到蓝色元素伤害增加", + ["name"]="weakness_blue_add" + }, + [17]={ + ["desc"]="受到紫色元素伤害增加", + ["name"]="weakness_purple_add" + }, + [18]={ + ["desc"]="受到所有伤害伤害增加", + ["name"]="weakness_all_add" + }, + [33]={ + ["desc"]="眩晕效果,无法进行攻击", + ["name"]="stun" + }, + [34]={ + ["desc"]="护盾可抵挡一定的伤害", + ["name"]="shield" + }, + [36]={ + ["desc"]="普攻攻击次数减少", + ["name"]="normal_attack_dec" + } +} +local keys = { + name = { + ["dec_dmg_red_add"]=buff[7], + ["dec_dmg_yellow_add"]=buff[8], + ["dec_dmg_green_add"]=buff[9], + ["dec_dmg_blue_add"]=buff[10], + ["dec_dmg_purple_add"]=buff[11], + ["dec_dmg_all_add"]=buff[12], + ["weakness_red_add"]=buff[13], + ["weakness_yellow_add"]=buff[14], + ["weakness_green_add"]=buff[15], + ["weakness_blue_add"]=buff[16], + ["weakness_purple_add"]=buff[17], + ["weakness_all_add"]=buff[18], + ["stun"]=buff[33], + ["shield"]=buff[34], + ["normal_attack_dec"]=buff[36] + } +} +local config = { +data=buff, +keys=keys, +count=15 +} +return config \ No newline at end of file diff --git a/lua/app/config/strings/cn/buff.lua.meta b/lua/app/config/strings/cn/buff.lua.meta new file mode 100644 index 00000000..16c58292 --- /dev/null +++ b/lua/app/config/strings/cn/buff.lua.meta @@ -0,0 +1,10 @@ +fileFormatVersion: 2 +guid: 1fae34d49d03e1043bbf18d504fd3a93 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 11500000, guid: 3b8b241bab4a4ac9a22fcce9c64f1242, type: 3} diff --git a/lua/app/ui/battle/battle_ui.lua b/lua/app/ui/battle/battle_ui.lua index a5ee23ac..a30e583d 100644 --- a/lua/app/ui/battle/battle_ui.lua +++ b/lua/app/ui/battle/battle_ui.lua @@ -1,3 +1,5 @@ +local UIPrefabObject = require "app/bf/unity/uiprefab_object" + local BattleUI = class("BattleUI", BaseUI) local GRID_CELL = "app/ui/battle/cell/grid_cell" local GRID_CELL_PATH = "assets/prefabs/ui/battle/cell/grid_cell.prefab" @@ -134,7 +136,7 @@ function BattleUI:initBuff() 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 + for k, v in ipairs(self.defBuffIconList) do v:addClickListener(function() self.battleController:showBuffTips(2) end) @@ -159,6 +161,13 @@ function BattleUI:initBuff() 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 function BattleUI:refreshBuff(side, buffList) @@ -240,15 +249,73 @@ function BattleUI:clearBuff(side) 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:showLeftBuffTips(buffList) +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() diff --git a/lua/app/userdata/battle/skill/battle_buff_entity.lua b/lua/app/userdata/battle/skill/battle_buff_entity.lua index e6fcc344..eda27c73 100644 --- a/lua/app/userdata/battle/skill/battle_buff_entity.lua +++ b/lua/app/userdata/battle/skill/battle_buff_entity.lua @@ -22,6 +22,18 @@ function BattleBuffEntity:getName() return self.name 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() return self.buffType end