[变身卡]======开启添加等级限制

dev_chengFeng
wangzhenxing 2022-08-18 17:02:35 +08:00
parent 02f455f185
commit 7ec1580c3e
4 changed files with 749 additions and 482 deletions

View File

@ -557,5 +557,6 @@ GameEvent = {
--通用消息
CommonEvent = {
RefreshIncarnationPanel = "RefreshIncarnationPanel",
RefreshIncarnationPanelUp = "RefreshIncarnationPanelUp",
},
}

View File

@ -128,6 +128,7 @@ function IncarnationForcePanel:SetSingleData(_go,data,_index)
end
function IncarnationForcePanel:OnClose()
Game.GlobalEvent:DispatchEvent(GameEvent.CommonEvent.RefreshIncarnationPanelUp)
end
function IncarnationForcePanel:OnDestroy()

View File

@ -2,6 +2,9 @@
IncarnationPanel = Inherit(BasePanel)
local heroConfig = ConfigManager.GetConfig(ConfigName.HeroConfig)
local artResourcesConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local specialConfig = ConfigManager.GetConfigData(ConfigName.SpecialConfig,155).Value
local curLevel = ConfigManager.GetConfigData(ConfigName.ChangingForce,IncarnationManager.incarnationForceLv).Level
local limits=string.split(specialConfig,"#")
local tabs = {}
local tabsRedpoints = {}
local tabsImg = {"r_hero_huo 1_zh", "r_hero_feng 1_zh", "r_hero_shui 1_zh", "r_hero_dadi 1_zh"}
@ -37,6 +40,7 @@ function IncarnationPanel:InitComponent()
self.upLayoutItemList[i].btn = Util.GetGameObject(self.upLayoutItemList[i].go,"unLoadBtn")
self.upLayoutItemList[i].pos = Util.GetGameObject(self.upLayoutItemList[i].go,"cardPre")
self.upLayoutItemList[i].getBtn = Util.GetGameObject(self.upLayoutItemList[i].pos,"getBtn")
self.upLayoutItemList[i].lv = Util.GetGameObject(self.upLayoutItemList[i].go,"lvText"):GetComponent("Text")
end
self.empty = Util.GetGameObject(self.gameObject,"bg/NoneImage")
@ -44,6 +48,8 @@ function IncarnationPanel:InitComponent()
self.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
end
function IncarnationPanel:BindEvent()
for i = 1,4 do
Util.AddClick(tabs[i], function()
@ -125,12 +131,20 @@ function IncarnationPanel:SetSelectBtn()
self.selectBtn.transform:SetParent(tabs[proId].transform)
self.selectBtn:GetComponent("RectTransform").localPosition = Vector3.zero
end
function IncarnationPanel:RefreshUpLimitLevel()
curLevel = ConfigManager.GetConfigData(ConfigName.ChangingForce,IncarnationManager.incarnationForceLv).Level
for i = 1,3 do
self.upLayoutItemList[i].lv.gameObject:SetActive(curLevel<tonumber(limits[i]))
end
end
function IncarnationPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.CommonEvent.RefreshIncarnationPanel,function()
self:RefreshUpList()
self:RefreshList(true,true)
end)
Game.GlobalEvent:AddEvent(GameEvent.CommonEvent.RefreshIncarnationPanelUp,function()
self:RefreshUpLimitLevel()
end)
end
function IncarnationPanel:RemoveListener()
@ -138,6 +152,9 @@ function IncarnationPanel:RemoveListener()
self:RefreshUpList()
self:RefreshList(true,true)
end)
Game.GlobalEvent:RemoveEvent(GameEvent.CommonEvent.RefreshIncarnationPanelUp,function()
self:RefreshUpLimitLevel()
end)
end
function IncarnationPanel:OnOpen(_proId)
@ -158,6 +175,8 @@ function IncarnationPanel:RefreshUpList()
for i = 1,3 do
self.upLayoutItemList[i].pos.gameObject:SetActive(false)
self.upLayoutItemList[i].btn.gameObject:SetActive(false)
self.upLayoutItemList[i].lv.gameObject:SetActive(curLevel<tonumber(limits[i]))
self.upLayoutItemList[i].lv.text="化身之力"..limits[i].."级解锁"
end
for k,v in pairs(self.upLayoutData) do
self:RefreshSingleCardPre(self.upLayoutItemList[k].pos,v,false,k)
@ -165,6 +184,7 @@ function IncarnationPanel:RefreshUpList()
end
end
function IncarnationPanel:RefreshSingleCardPre(cardPre,data,isJump,index)
if not self.cardList[cardPre] then
self.cardList[cardPre] = {}
@ -305,6 +325,11 @@ function IncarnationPanel:SetSingleData(go,data,index)
break
end
end
if curLevel<tonumber(limits[pos]) then
PopupTipPanel.ShowTip("化身之力"..limits[pos].."级解锁")
return
end
if pos > 0 then
NetManager.UpOrDownTransformationRequest(data.id,pos,2,function()
data.state = 2