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

180 lines
7.0 KiB
Lua
Raw Normal View History


local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)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
local ProGoList
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)")
if not ProGoList then
-- 构建数据
local ProDataList = {}
for _, propConfig in ConfigPairs(propertyConfig) do
2023-11-24 18:30:31 +08:00
--不显示主角属性
if propConfig.PropertyId<114 then
if propConfig.IfShow == 1 or propConfig.IfShow == 2 then
table.insert(ProDataList, propConfig)
--LogError("propConfig.Id============="..propConfig.Id)
end
end
2023-11-24 18:30:31 +08:00
end
table.sort(ProDataList, function (a,b)return a.SortId < b.SortId end)
-- 构建显示节点
ProGoList = {}
local FirstIndex = 0
local SecondIndex = 0
local curFirstPre, curSecondPre
for _, propConfig in ipairs(ProDataList) do
local propId = propConfig.PropertyId
if propConfig.IfShow == 1 then
if FirstIndex == 0 then
curFirstPre = newObjToParent(this.proPre1, this.fristGrid)
Util.GetGameObject(curFirstPre, "pro1"):SetActive(false)
Util.GetGameObject(curFirstPre, "pro2"):SetActive(false)
end
local pro = Util.GetGameObject(curFirstPre, "pro"..FirstIndex+1)
pro:SetActive(true)
ProGoList[propId] = {
propName = Util.GetGameObject(pro, "proName"):GetComponent("Text"),
propValue = Util.GetGameObject(pro, "proVale"):GetComponent("Text")
}
FirstIndex = (FirstIndex + 1) % 2
elseif propConfig.IfShow == 2 then
if SecondIndex == 0 then
curSecondPre = newObjToParent(this.proPre1, this.secondGrid)
Util.GetGameObject(curSecondPre, "pro1"):SetActive(false)
Util.GetGameObject(curSecondPre, "pro2"):SetActive(false)
end
local pro = Util.GetGameObject(curSecondPre, "pro"..SecondIndex+1)
pro:SetActive(true)
ProGoList[propId] = {
propName = Util.GetGameObject(pro, "proName"):GetComponent("Text"),
propValue = Util.GetGameObject(pro, "proVale"):GetComponent("Text")
}
SecondIndex = (SecondIndex + 1) % 2
end
end
-- 公会数据节点
this.guildPre = newObjToParent(this.proPre2, this.thirdlyGrid)
this.jumpBtn = Util.GetGameObject(this.guildPre, "jumpBtn")
this.jumpBtn:SetActive(false)
this.guildProName = Util.GetGameObject(this.guildPre, "proName"):GetComponent("Text")
this.guildProValue = Util.GetGameObject(this.guildPre, "proVale"):GetComponent("Text")
end
2020-05-09 13:31:21 +08:00
end
--绑定事件(用于子类重写)
function RoleProInfoPopup:BindEvent()
Util.AddClick(this.btnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
2021-05-12 10:35:58 +08:00
Util.AddOnceClick(this.jumpBtn, function()
JumpManager.GoJump(73001)
2021-05-26 18:32:03 +08:00
end)
end
2020-05-09 13:31:21 +08:00
-- 设置属性显示
function RoleProInfoPopup.SetProShow(go, id, value)
go.propName.text = GetLanguageStrById(propertyConfig[id].Info)..":"
value = value or 0
if propertyConfig[id].Style == 1 then
go.propValue.text = GetPropertyFormatStr(propertyConfig[id].Style, value)
elseif propertyConfig[id].Style == 2 then
go.propValue.text = GetPropertyFormatStr(propertyConfig[id].Style, value*100)
2020-06-13 11:47:13 +08:00
end
end
2021-05-26 18:32:03 +08:00
--界面打开时调用(用于子类重写)
function RoleProInfoPopup:OnOpen(_allAddProVal,_configData,_isShowGuild,_guildSkill)
-- 设置属性显示
for _proId, go in pairs(ProGoList) do
this.SetProShow(go, _proId, _allAddProVal[_proId])
2021-05-12 10:35:58 +08:00
end
--屏蔽公会技能显示
_isShowGuild=false
this.thirdlyGridP:SetActive(_isShowGuild)
if not _configData then
return
end
if _isShowGuild then
--加公会技能特殊属性
local allLv = _isShowGuild and GuildSkillManager.GetAllGuildSkillLv(_configData.Profession) or 0
if _guildSkill then allLv = _guildSkill end
this.guildProName.text = Language[11061]..GuildSkillType[_configData.Profession]
this.guildProValue.text = allLv
-- 跳转按钮如果设置的公会技能等级,说明是别人,就不显示跳转
2023-09-06 15:11:01 +08:00
this.jumpBtn:SetActive(_guildSkill == nil)
2020-05-09 13:31:21 +08:00
end
2021-10-12 14:54:12 +08:00
2021-09-26 21:32:04 +08:00
if not this.specialPro then
this.specialPro = {}
end
for k,v in pairs(this.specialPro) do
2021-10-12 12:17:33 +08:00
v.go.gameObject:SetActive(false)
2021-09-26 21:32:04 +08:00
end
2021-10-12 14:54:12 +08:00
local index = 1
2021-10-12 15:32:07 +08:00
local totalCurNum,totalLv,totalNum = LikabilityManager.GetTotalHeroLikeLv(_configData.Id)
if totalLv > 0 then
2021-10-12 14:54:12 +08:00
if not this.specialPro[index] then
this.specialPro[index] = {}
this.specialPro[index].go = newObjToParent(this.proPre2,this.thirdlyGrid)
this.specialPro[index].jumpBtn = Util.GetGameObject(this.specialPro[index].go, "jumpBtn")
this.specialPro[index].guildProName = Util.GetGameObject(this.specialPro[index].go, "proName"):GetComponent("Text")
this.specialPro[index].guildProValue = Util.GetGameObject(this.specialPro[index].go, "proVale"):GetComponent("Text")
2021-09-26 21:32:04 +08:00
end
2021-10-12 14:54:12 +08:00
this.specialPro[index].go.gameObject:SetActive(true)
2021-10-12 15:32:07 +08:00
this.specialPro[index].guildProName.text = "好感度"
this.specialPro[index].guildProValue.text = totalLv
2021-10-12 14:54:12 +08:00
Util.AddOnceClick(this.specialPro[index].jumpBtn, function()
JumpManager.GoJump(40033)
end)
2021-09-26 21:32:04 +08:00
end
2021-10-12 14:54:12 +08:00
index = index + 1
2020-05-09 13:31:21 +08:00
end
--界面关闭时调用(用于子类重写)
function RoleProInfoPopup:OnClose()
end
--界面销毁时调用(用于子类重写)
function RoleProInfoPopup:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2021-09-26 21:32:04 +08:00
this.specialPro = {}
ProGoList = nil
2020-05-09 13:31:21 +08:00
end
2020-06-23 18:36:24 +08:00
return RoleProInfoPopup