【新将来袭】战斗血条

dev_chengFeng
ZhangBiao 2020-12-03 15:11:24 +08:00
parent 86d190572a
commit b2e53f8ae5
3 changed files with 49402 additions and 135 deletions

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,7 @@ local endFunc
local isBack = false --是否为战斗回放
local fightType -- 1关卡 2副本 3限时怪, 5兽潮, 6新关卡, 7公会boss
local orginLayer
local boxList={}--新将来袭奖励盒子
-- 显示跳过战斗使用
local hadCounted = 0
@ -40,15 +41,21 @@ function this:InitComponent()
this.DefResult = Util.GetGameObject(this.UpRoot, "result")
this.AtkResult = Util.GetGameObject(this.DownRoot, "result")
this.damagePanel = Util.GetGameObject(this.UpRoot, "damage")
this.damagePanel = Util.GetGameObject(this.UpRoot, "damage")--公会boss的血条
this.damageBoxBg = Util.GetGameObject(this.damagePanel, "bg")
this.damageBoxIcon = Util.GetGameObject(this.damagePanel, "bg/iconRoot/icon"):GetComponent("Image")
this.damageBoxLevel = Util.GetGameObject(this.damagePanel, "lv"):GetComponent("Text")
this.damageProgress = Util.GetGameObject(this.damagePanel, "progress/Fill")
this.damageText = Util.GetGameObject(this.damagePanel, "progress/Text"):GetComponent("Text")
this.dmg2 = Util.GetGameObject(this.UpRoot, "dmg2")--新将来袭的血条
for i = 1, 5 do
boxList[i] = Util.GetGameObject(this.dmg2, "box"..i)
boxList[i]:SetActive(false)
end
this.dmg2Progress = Util.GetGameObject(this.dmg2, "progress/Fill"):GetComponent("Image")
this.dmg2Text = Util.GetGameObject(this.dmg2, "progress/Text"):GetComponent("Text")
end
--绑定事件(用于子类重写)
@ -260,6 +267,7 @@ end
-- 初始化
function this.InitPanelData()
this.dmg2:SetActive(fightType == BATTLE_TYPE.XINJIANG)
if fightType == BATTLE_TYPE.GUILD_BOSS and fightType == BATTLE_TYPE.GUILD_CAR_DELAY then
this.myDamage = 0
this.myDamageLevel = 0
@ -272,9 +280,20 @@ function this.InitPanelData()
this.RefreshMyDamageShow()
end)
end
end
if fightType== BATTLE_TYPE.XINJIANG then
PopupTipPanel.ShowTip("这是新将战斗")
elseif fightType == BATTLE_TYPE.XINJIANG then
this.myDamage = 0
this.myDamageLevel = 0
this.dmg2Text.text = "0%"
this.dmg2Progress.fillAmount = 0
this.RefreshMyDamageShow()
local list = RoleManager.Query(function (r) return r.camp == 1 end)
if list[1] then
list[1].Event:AddEvent(BattleEventName.RoleBeDamaged, function (atkRole, damage, bCrit, finalDmg, damageType, dotType)
--Log("damage:"..damage)
this.myDamage = this.myDamage + damage
this.RefreshMyDamageShow(list[1].data)
end)
end
end
this.InitOption()
@ -375,6 +394,10 @@ function this.BattleEnd(result)
this:ClosePanel()
ExpeditionManager.RefreshPanelShowByState()
end
elseif fightType == BATTLE_TYPE.XINJIANG then--新将来袭
Timer.New(function ()
this:ClosePanel()
end,1.3):Start()
else
-- 判断是否需要进行结果检测
if this.fightResult then
@ -523,7 +546,7 @@ function this.OnUpdate()
end
-- 刷新我的伤害显示
function this.RefreshMyDamageShow()
function this.RefreshMyDamageShow(data)
if fightType == 7 or fightType == 10 then
local myDamage = this.myDamage-- *10
local bossRewardConfig = ConfigManager.GetConfig(ConfigName.GuildBossRewardConfig)
@ -550,7 +573,7 @@ function this.RefreshMyDamageShow()
this.damageBoxLevel.text = curLevel or 0
this.damageBoxIcon.sprite = GuildBossManager.GetBoxSpriteByLevel(curLevel or 0)
-- this.damageText.text = myDamage.."/"..nextLevelData.Damage -- 显示总伤害
local curLevelDamage = not curLevelData and 0 or curLevelData.Damage
local deltaDamage = nextLevelData.Damage - curLevelDamage
local myDeltaDamage = myDamage - curLevelDamage
@ -559,6 +582,30 @@ function this.RefreshMyDamageShow()
this.damageProgress.transform.localScale = Vector3.New(rate, 1, 1)
elseif fightType == BATTLE_TYPE.XINJIANG and data then
local myDamage = this.myDamage-- *10
local boxs={}
local newHeroConfig = ConfigManager.GetConfig(ConfigName.NewHeroConfig)
local bossData = data
local curBossHp = data:GetData(RoleDataName.Hp)
local maxBossHp = data:GetData(RoleDataName.MaxHp)
local curPercent = (maxBossHp-curBossHp)*100/maxBossHp
this.dmg2Text.text = string.format("%.2f",curPercent).."%"
local num = 0
local d = ConfigManager.GetConfigDataByKey(ConfigName.NewHeroConfig,"HeroId",10012)--data.roleId)
boxs = d.BoxList
for i = 1, #boxs do
local ex = boxs[i-1] and boxs[i-1][1] or 0
if (boxs[i][1]/boxs[#boxs][1])*100 > curPercent and (ex/boxs[#boxs][1])*100 < curPercent then
num = (curPercent*100-ex)/(boxs[i][1]-ex)
break
end
end
this.dmg2Progress.fillAmount = num
end
end

View File

@ -43,6 +43,7 @@ function XinJiangLaiXi:BindEvent()
end)
Util.AddClick(this.addBtn, function()
--购买特权
if allData.buyTime > 0 then
local costId, finalNum, oriCostNum = ShopManager.calculateBuyCost(SHOP_TYPE.FUNCTION_SHOP,10036, 1)
local itemName = ConfigManager.GetConfigData(ConfigName.ItemConfig,costId).Name
@ -60,17 +61,19 @@ function XinJiangLaiXi:BindEvent()
end)
Util.AddClick(this.fightBtn,function()
--开始战斗
if allData.fightTime > 0 then
NetManager.NewGeneralAttackRequest(allData.activityId,2012,function(msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(2012, 1)--更新特权
local fightData = BattleManager.GetBattleServerData(msg,0)
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.XINJIANG,function ()
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1,function ()
this:Refresh()
end)
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1,function ()
this:Refresh()
end)
end)
end)
else
--购买特权
if allData.buyTime > 0 then
local costId, finalNum, oriCostNum = ShopManager.calculateBuyCost(SHOP_TYPE.FUNCTION_SHOP,10036, 1)
local itemName = ConfigManager.GetConfigData(ConfigName.ItemConfig,costId).Name