miduo_client/Assets/ManagedResources/~Lua/Modules/RoleInfo/RoleProInfoPopup.lua

209 lines
9.0 KiB
Lua
Raw Normal View History

2021-04-21 13:12:04 +08:00
require("Base/BasePanel")
2020-05-09 13:31:21 +08:00
RoleProInfoPopup = Inherit(BasePanel)
local this=RoleProInfoPopup
2020-06-13 11:47:13 +08:00
local sDataTable = {
2021-03-02 16:53:12 +08:00
[1] = {name = Language[11432],showType = 1},
[2] = {name = Language[11822],showType = 2},
[3] = {name = Language[11823],showType = 3},
2020-06-13 11:47:13 +08:00
}
local allPro = {}--所有属性 三维数组
2020-05-09 13:31:21 +08:00
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
2020-06-13 11:47:13 +08:00
local fristProGoList = {}
local secondProGoList = {}
local thirdlyProGoList = {}
2021-05-12 10:35:58 +08:00
local allAddProVal
2020-05-09 13:31:21 +08:00
local heroSConFig
2020-06-18 20:39:29 +08:00
local isShowGuild = true
2020-05-09 13:31:21 +08:00
--初始化组件(用于子类重写)
function RoleProInfoPopup:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2020-05-09 13:31:21 +08:00
this.btnBack=Util.GetGameObject(self.transform, "btnBack")
2020-06-13 11:47:13 +08:00
this.proPre1=Util.GetGameObject(self.gameObject, "proPre1")
this.proPre2=Util.GetGameObject(self.gameObject, "proPre2")
this.fristGrid=Util.GetGameObject(self.gameObject, "grid/ver/recordPer (1)/Mask")
this.secondGrid=Util.GetGameObject(self.gameObject, "grid/ver/recordPer (2)/Mask")
this.thirdlyGrid=Util.GetGameObject(self.gameObject, "grid/ver/recordPer (3)/Mask")
2021-05-12 10:35:58 +08:00
this.thirdlyGridP=Util.GetGameObject(self.gameObject, "grid/ver/recordPer (3)")
2020-05-09 13:31:21 +08:00
end
--绑定事件(用于子类重写)
function RoleProInfoPopup:BindEvent()
Util.AddClick(this.btnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
end
2020-06-18 20:39:29 +08:00
local guildSkill = nil
2020-05-09 13:31:21 +08:00
--界面打开时调用(用于子类重写)
2021-05-12 17:40:38 +08:00
function RoleProInfoPopup:OnOpen(_allAddProVal,_configData,_isShowGuild,_guildSkill)
2021-05-12 10:35:58 +08:00
2021-05-26 18:32:03 +08:00
local allAddProVal = {}
for _proId, _val in pairs(_allAddProVal) do
if propertyConfig[_proId] and propertyConfig[_proId].SortId > 0 then
local data = {}
data.proId = _proId
data.val = _val
data.sort = propertyConfig[_proId].SortId
table.insert(allAddProVal,data)
end
end
table.sort(allAddProVal,function (a,b)
return propertyConfig[a.proId].SortId < propertyConfig[b.proId].SortId
end)
2021-05-12 10:35:58 +08:00
heroSConFig = _configData
isShowGuild = _isShowGuild--图鉴不显示公会技能等级特殊操作
guildSkill = _guildSkill and _guildSkill or nil--其他玩家公会技能等级特殊操作
2020-05-09 13:31:21 +08:00
2020-06-13 11:47:13 +08:00
for i = 1, #sDataTable do
allPro[i] = {}
end
--加基础 和 辅助属性
2021-05-26 18:32:03 +08:00
for index, value in ipairs(allAddProVal) do
if propertyConfig[value.proId] then
if propertyConfig[value.proId].IfShow ~= 0 then
local curLength = #allPro[propertyConfig[value.proId].IfShow] > 0 and #allPro[propertyConfig[value.proId].IfShow] or 1
if not allPro[propertyConfig[value.proId].IfShow][curLength] then
allPro[propertyConfig[value.proId].IfShow][curLength] = {}
table.insert(allPro[propertyConfig[value.proId].IfShow][curLength],{proId = value.proId,proVal = value.val})
elseif allPro[propertyConfig[value.proId].IfShow][curLength] and #allPro[propertyConfig[value.proId].IfShow][curLength] < 2 then
table.insert(allPro[propertyConfig[value.proId].IfShow][curLength],{proId = value.proId,proVal = value.val})
elseif allPro[propertyConfig[value.proId].IfShow][curLength] and #allPro[propertyConfig[value.proId].IfShow][curLength] >= 2 then
allPro[propertyConfig[value.proId].IfShow][curLength + 1] = {}
table.insert(allPro[propertyConfig[value.proId].IfShow][curLength + 1],{proId = value.proId,proVal = value.val})
2020-06-13 11:47:13 +08:00
end
end
end
end
2021-05-26 18:32:03 +08:00
2021-05-12 10:35:58 +08:00
if isShowGuild then
--加公会技能特殊属性
allPro[3][1] = {}
local allLv = isShowGuild and GuildSkillManager.GetAllGuildSkillLv(heroSConFig.Profession) or 0
if guildSkill then allLv = guildSkill end
table.insert(allPro[3][1],{proId = Language[11061]..GuildSkillType[heroSConFig.Profession],proVal = allLv})
--for i = 1, #allPro do
-- for j = 1, #allPro[i] do
-- for k = 1, #allPro[i][j] do
-- --LogGreen("allPro[i][j][k] "..allPro[i][j][k].proId.." "..allPro[i][j][k].proVal)
-- end
-- end
--end
end
2020-06-13 11:47:13 +08:00
this.ShowPanelData()
end
function this.ShowPanelData()
this.GridShowData(1,allPro[1],fristProGoList, this.proPre1,this.fristGrid)
this.GridShowData(2,allPro[2],secondProGoList, this.proPre1,this.secondGrid)
2021-05-12 10:35:58 +08:00
if isShowGuild then
this.GridShowData(3,allPro[3],thirdlyProGoList, this.proPre2,this.thirdlyGrid)
end
this.thirdlyGridP:SetActive(isShowGuild)
2020-05-09 13:31:21 +08:00
end
2020-06-13 11:47:13 +08:00
function this.GridShowData(type,curAllPro,curProGoList,curPre,curGrid)
for i = 1, math.max(#curAllPro, #curProGoList) do
local go = curProGoList[i]
if not go then
go = newObject(curPre)
go.transform:SetParent(curGrid.transform)
go.transform.localScale = Vector3.one
go.transform.localPosition = Vector3.zero
curProGoList[i] = go
2020-05-09 13:31:21 +08:00
end
2020-06-13 11:47:13 +08:00
go.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
end
2020-06-13 11:47:13 +08:00
for i = 1, #curAllPro do
this.SingleProShowData(type,curAllPro[i],curProGoList[i])
2020-05-09 13:31:21 +08:00
end
2020-06-13 11:47:13 +08:00
end
function this.SingleProShowData(type,data,go)
go:SetActive(true)
if type == 3 then
Util.GetGameObject(go, "proName"):GetComponent("Text").text = data[1].proId..":"
Util.GetGameObject(go, "proVale"):GetComponent("Text").text = data[1].proVal
2020-06-18 20:39:29 +08:00
if guildSkill then
Util.GetGameObject(go, "jumpBtn"):SetActive(false)
else
Util.GetGameObject(go, "jumpBtn"):SetActive(true)
end
2020-06-13 11:47:13 +08:00
Util.AddOnceClick(Util.GetGameObject(go, "jumpBtn"), function()
JumpManager.GoJump(73001)
end)
else
for i = 1, 2 do
local curGo =go .transform:GetChild(i-1).gameObject
if #data > 1 then
curGo:SetActive(true)
--LogGreen("data.proId "..data[i].proId.." "..data[i].proVal)
2021-01-26 17:08:39 +08:00
Util.GetGameObject(curGo, "proName"):GetComponent("Text").text = GetLanguageStrById(propertyConfig[data[i].proId].Info)..":"
2020-06-13 11:47:13 +08:00
local proVale = Util.GetGameObject(curGo, "proVale"):GetComponent("Text")
if propertyConfig[data[i].proId].Style==1 then--绝对值
proVale.text = GetPropertyFormatStr(propertyConfig[data[i].proId].Style, data[i].proVal)
elseif propertyConfig[data[i].proId].Style==2 then--百分百
proVale.text = GetPropertyFormatStr(propertyConfig[data[i].proId].Style, data[i].proVal*100)
end
else
curGo:SetActive(false)
end
end
2020-05-09 13:31:21 +08:00
end
end
2020-06-13 11:47:13 +08:00
--function this.ShowProValPanelData()
-- local allProKeys={}
-- for k, v in pairs(allPro) do
-- if k~=1000 and (propertyConfig[k].IfShow==0) then
-- local singleProData={}
-- singleProData.id=k
-- singleProData.val=v
-- table.insert(allProKeys,singleProData)
-- end
-- end
-- table.sort(allProKeys, function (a,b)return a.id<b.id end)
-- for i = 1, #allProKeys do
-- local id = allProKeys[i].id
-- local val = allProKeys[i].val
-- local go = allProGoList[i]
-- if not go then
-- go = newObject(this.proPre)
-- go.transform:SetParent(this.proValRect.transform)
-- go.transform.localScale = Vector3.one
-- go.transform.localPosition = Vector3.zero
-- go:SetActive(true)
-- allProGoList[i] = go
-- end
-- go:GetComponent("Text").text = propertyConfig[id].Info
-- if propertyConfig[id].Style==1 then--绝对值
-- Util.GetGameObject(go.transform, "proVal"):GetComponent("Text").text = GetPropertyFormatStr(propertyConfig[id].Style, val)
-- elseif propertyConfig[id].Style==2 then--百分百
-- Util.GetGameObject(go.transform, "proVal"):GetComponent("Text").text = GetPropertyFormatStr(propertyConfig[id].Style, val*100)
-- end
-- end
-- --加公会技能加成显示
-- local go = allProGoList[#allProKeys + 1]
-- if not go then
-- go = newObject(this.proPre)
-- go.transform:SetParent(this.proValRect.transform)
-- go.transform.localScale = Vector3.one
-- go.transform.localPosition = Vector3.zero
-- go:SetActive(true)
-- allProGoList[#allProKeys + 1] = go
-- end
-- go:GetComponent("Text").text = "公会技能-"..GuildSkillType[heroSConFig.Profession]
-- local allLv,isEqualityLv = GuildSkillManager.GetAllGuildSkillLv(heroSConFig.Profession)
-- Util.GetGameObject(go.transform, "proVal"):GetComponent("Text").text = allLv
--end
2020-05-09 13:31:21 +08:00
--界面关闭时调用(用于子类重写)
function RoleProInfoPopup:OnClose()
end
--界面销毁时调用(用于子类重写)
function RoleProInfoPopup:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2020-06-18 20:39:29 +08:00
fristProGoList = {}
secondProGoList = {}
thirdlyProGoList = {}
2020-05-09 13:31:21 +08:00
end
2020-06-23 18:36:24 +08:00
return RoleProInfoPopup