【战斗统计】第二版

dev_chengFeng
gaoxin 2021-01-16 16:21:44 +08:00
parent 6f386e1b52
commit ceb9e39b00
3 changed files with 89 additions and 1541 deletions

File diff suppressed because it is too large Load Diff

View File

@ -119,17 +119,20 @@ end
-- buff计算 -- buff计算
function BattleAnalysisManager:OnRecordBuff(castRole, targetRole, buff) function BattleAnalysisManager:OnRecordBuff(castRole, targetRole, buff)
local data = self:GetRecordData(castRole) local data = self:GetRecordData(castRole)
local id
if buff.type == BuffName.Control then -- 控制类
id = buff.type * 100 + buff.ctrlType
elseif buff.type == BuffName.Shield then -- 盾
id = buff.type * 100 + buff.shieldType
elseif buff.type == BuffName.Curse then -- 连接符
id = buff.type * 100 + 1
end
if not id then
return
end
if not data.buff then if not data.buff then
data.buff = {} data.buff = {}
end end
local id = buff.type * 100
if buff.type == BuffName.Control then -- 控制类
id = id + buff.ctrlType
elseif buff.type == BuffName.Shield then -- 盾
id = id + buff.shieldType
elseif buff.type == BuffName.Curse then -- 连接符
id = id + 1
end
if not data.buff[id] then if not data.buff[id] then
data.buff[id] = 0 data.buff[id] = 0
end end

View File

@ -102,19 +102,45 @@ function DamageResultPanel:OnOpen(result)
end end
-- tab节点管理 -- tab节点管理
if this.TabCtrl then if this.TabCtrl then
this.TabCtrl:ChangeTab(1) this.TabCtrl:Init(this.tabbox, _TabData)
end end
end end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写) --界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function DamageResultPanel:OnShow()end function DamageResultPanel:OnShow()end
function this.isTabShow(index)
if not this.battleRecord then
return false
end
local list
if index == 1 or index == 2 then
return true
elseif index == 3 then
list = this.battleRecord.data
elseif index == 4 then
list = this.battleRecord.mdata
end
--
if list and table.nums(list) ~= 0 then
for _, role in pairs(list) do
-- 还有除info, damage, treat之外的其他属性
if table.nums(role) > 3 then
return true
end
end
end
return false
end
-- tab节点显示自定义 -- tab节点显示自定义
function this.TabAdapter(tab, index, status) function this.TabAdapter(tab, index, status)
local tabLab = Util.GetGameObject(tab, "Text") local tabLab = Util.GetGameObject(tab, "Text")
Util.GetGameObject(tab,"Img"):GetComponent("Image").sprite = Util.LoadSprite(_TabData[index][status]) Util.GetGameObject(tab,"Img"):GetComponent("Image").sprite = Util.LoadSprite(_TabData[index][status])
tabLab:GetComponent("Text").text = _TabData[index].name tabLab:GetComponent("Text").text = _TabData[index].name
tabLab:GetComponent("Text").color = _TabFontColor[status] tabLab:GetComponent("Text").color = _TabFontColor[status]
tab.gameObject:SetActive(this.isTabShow(index))
end end
-- tab改变回调事件 -- tab改变回调事件
function this.OnTabChange(index, lastIndex) function this.OnTabChange(index, lastIndex)
@ -236,14 +262,19 @@ function this.ItemAdapter(item, data, showType)
local txt = "" local txt = ""
for key, value in pairs(data) do for key, value in pairs(data) do
local s = this.GetSpecialText(key, value) local s = this.GetSpecialText(key, value)
if s then if s and s ~= "" then
if txt ~= "" then if txt ~= "" then
txt = txt.."\n" txt = txt.."\n"
end end
txt = txt..s txt = txt..s
end end
end end
content.text = txt == "" and "" or txt -- 没有显示则不显示
if txt == "" then
item.gameObject:SetActive(false)
else
content.text = txt
end
end end
end end
@ -260,18 +291,22 @@ function this.GetSpecialText(key, value)
if s ~= "" then if s ~= "" then
s = s.."\n" s = s.."\n"
end end
s = s .. string.format("%s<color=%s>%s</color>次", config.Describe, "#ff0000", v) local color = UIColorStr.RED
if type == BuffName.Shield then
color = UIColorStr.GREEN
end
s = s .. string.format("%s<color=%s>%s</color>次", config.Describe, color, v)
end end
end end
return s return s
elseif key == "addRage" then elseif key == "addRage" then
return string.format("回怒:<color=%s>%s</color>点", "#ff0000", value) return string.format("回怒:<color=%s>%s</color>点", UIColorStr.GREEN, value)
elseif key == "subRage" then elseif key == "subRage" then
return string.format("减怒:<color=%s>%s</color>点", "#ff0000", value) return string.format("减怒:<color=%s>%s</color>点", UIColorStr.RED, value)
elseif key == "transRage" then elseif key == "transRage" then
return string.format("借怒:<color=%s>%s</color>点", "#ff0000", value) return string.format("借怒:<color=%s>%s</color>点", UIColorStr.GREEN, value)
elseif key == "secKill" then elseif key == "secKill" then
return string.format("斩杀:<color=%s>%s</color>次", "#ff0000", value) return string.format("斩杀:<color=%s>%s</color>次", UIColorStr.RED, value)
end end
end end
@ -286,11 +321,13 @@ function this.HeadAdapter(head, data)
local protoIcon = Util.GetGameObject(head, "prott/Image"):GetComponent("Image") local protoIcon = Util.GetGameObject(head, "prott/Image"):GetComponent("Image")
local lv = Util.GetGameObject(head, "lv") local lv = Util.GetGameObject(head, "lv")
local lvText = Util.GetGameObject(head, "lv/Text"):GetComponent("Text") local lvText = Util.GetGameObject(head, "lv/Text"):GetComponent("Text")
local starRoot = Util.GetGameObject(head, "star")
if data.type == BattleUnitType.Role then if data.type == BattleUnitType.Role then
local roleId = data.roleData.monsterId or data.roleData.roleId local roleId = data.roleData.monsterId or data.roleData.roleId
local roleLv = data:GetRoleData(RoleDataName.Level) local roleLv = data:GetRoleData(RoleDataName.Level)
local skinId = data.roleData.skinId local skinId = data.roleData.skinId
local star = data.star
local config = {} local config = {}
if roleId > 10100 then if roleId > 10100 then
@ -328,6 +365,8 @@ function this.HeadAdapter(head, data)
-- 等级 -- 等级
lv:SetActive(true) lv:SetActive(true)
lvText.text = config.lv lvText.text = config.lv
-- 星级
SetHeroStars(starRoot, star)
-- 职业 -- 职业
prefess:SetActive(false) prefess:SetActive(false)
-- 属性 -- 属性
@ -339,11 +378,17 @@ function this.HeadAdapter(head, data)
elseif data.type == BattleUnitType.Monster then elseif data.type == BattleUnitType.Monster then
local id = data.uid local id = data.uid
local roleLv = data:GetRoleData(RoleDataName.Level)
local star = data.star
prefess:SetActive(false) prefess:SetActive(false)
proto:SetActive(false) proto:SetActive(false)
lv:SetActive(false) -- 等级
lv:SetActive(true)
frame.sprite = Util.LoadSprite("r_zhandou_yiyaodi") lvText.text = roleLv
-- 星级
SetHeroStars(starRoot, star)
-- 头像
frame.sprite = Util.LoadSprite(GetHeroQuantityImageByquality(SpiritAnimal[id].Quality))
icon:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(SpiritAnimal[id].Icon)) icon:GetComponent("Image").sprite = Util.LoadSprite(GetResourcePath(SpiritAnimal[id].Icon))
end end