diff --git a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua index 5a7c9b24f5..7f28df2f9e 100644 --- a/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Battle/View/BattlePanel.lua @@ -50,7 +50,7 @@ function this:InitComponent() this.damageText = Util.GetGameObject(this.damagePanel, "progress/Text"):GetComponent("Text") this.dmg2 = Util.GetGameObject(this.UpRoot, "dmg2")--新将来袭的血条 - for i = 1, 5 do + for i = 1, 7 do boxList[i] = Util.GetGameObject(this.dmg2, "box"..i) boxList[i]:SetActive(false) local effect = Util.GetGameObject(boxList[i], "effect") @@ -621,9 +621,12 @@ function this.RefreshMyDamageShow(data) for i = 1, #boxs do if curPercent >= (boxs[i][1]/boxs[#boxs][1])*100 then - boxList[i+1]:SetActive(true) + if boxList[i+1] then + boxList[i+1]:SetActive(true) + end boxList[i].transform:SetParent(this.bar.transform) - boxList[i].transform:DOLocalMove(Vector3.New(0,-329+(i-1)*118,0), 1.5) + local t = i%5 == 0 and 5 or i%5 + boxList[i].transform:DOLocalMove(Vector3.New(math.floor(i/6)*-120,-329+t*100,0), 1.5) Util.GetGameObject(boxList[i], "effect"):SetActive(true) end end