miduo_client/Assets/ManagedResources/~Lua/Modules/BecomeAGod/BecomeAGodPanel.lua

217 lines
8.0 KiB
Lua
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

require("Base/BasePanel")
BecomeAGodPanel = Inherit(BasePanel)
local this = BecomeAGodPanel
local BecomeAGodLevel = ConfigManager.GetConfig(ConfigName.BecomeAGodLevel)
--初始化组件用于子类重写RoleEquipChangePopup
function BecomeAGodPanel:InitComponent()
this.spLoader = SpriteLoader.New()
this.bg2 = Util.GetGameObject(self.transform, "bg2")
this.effect = Util.GetGameObject(self.transform, "bg2/Effect")
self.lsth = Util.GetGameObject(self.transform, "bg2/zqbg")
screenAdapte(this.bg2)
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft })
this.btnBack = Util.GetGameObject(self.transform, "btnBack/btnBack")
this.titleTxt = Util.GetGameObject(self.gameObject, "title"):GetComponent("Text")
this.btnTupoDes = Util.GetGameObject(this.bg2, "TupoDesBtn")
this.TupoDesPanel = Util.GetGameObject(self.transform, "TianfuDes")
--this.titleTxt.text = Language[10985]
this.titleTxt.text = "六道成神"
this.btnLvup = Util.GetGameObject(this.bg2, "Lvup")
this.btnGotoFight = Util.GetGameObject(this.bg2, "GotoFight")
this.LevelUpDes = Util.GetGameObject(this.bg2, "LevelUpDes"):GetComponent("Text")
this.force = Util.GetGameObject(self.transform, "powerBtn/value"):GetComponent("Text")
this.btn_help = Util.GetGameObject(self.gameObject, "btn_help")
this.godlist = {}
for i = 1, 6 do
this.godlist[i] = {}
this.godlist[i].gob = Util.GetGameObject(self.transform, "bg2/godlist/god_" .. i)
this.godlist[i].red = Util.GetGameObject(this.godlist[i].gob, "red")
this.godlist[i].effect = Util.GetGameObject(this.godlist[i].gob, "StarOpen")
--Util.AddParticleSortLayer(this.godlist[i].effect, this.sortingOrder)
end
end
--绑定事件(用于子类重写)
function BecomeAGodPanel:BindEvent()
Util.AddClick(this.btn_help, function()
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.BecomeAGod, 0, 0, function()
for i = 1, 6 do
this.godlist[i].effect.gameObject:SetActive(true)
end
this.effect.gameObject:SetActive(true)
end)
for i = 1, 6 do
this.godlist[i].effect.gameObject:SetActive(false)
end
this.effect.gameObject:SetActive(false)
end)
Util.AddClick(this.btnGotoFight, function()
if CheckFunctionOpen(FUNCTION_OPEN_TYPE.GodsWayTower_3) then
NetManager.RequestDuoduiInfoRequest(function()
UIManager.OpenPanel(UIName.GodsWayTowerPanel, 3)
end)
else
PopupTipPanel.ShowTip(ActTimeCtrlManager.SystemOpenTip(FUNCTION_OPEN_TYPE.GodsWayTower_3))
end
end)
Util.AddOnceClick(self.lsth, function()
JumpManager.GoJump(40093)
end)
Util.AddClick(this.btnBack, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
Util.AddClick(this.btnTupoDes, function()
this.TupoDesPanel:SetActive(true)
for i = 1, 6 do
this.godlist[i].effect.gameObject:SetActive(false)
end
this.effect.gameObject:SetActive(false)
end)
Util.AddClick(this.TupoDesPanel, function()
this.TupoDesPanel:SetActive(false)
for i = 1, 6 do
this.godlist[i].effect.gameObject:SetActive(true)
end
this.effect.gameObject:SetActive(true)
end)
for i = 1, #this.godlist do
--LogError("1===================点击了:" .. tostring(i))
Util.AddClick(this.godlist[i].gob, function()
--LogError("2===================点击了:" .. tostring(i))
UIManager.OpenPanel(UIName.BecomeAGodPropertyPanel, i)
end)
end
Util.AddClick(this.btnLvup, function()
if BecomeAGodManager.IsCouldUpgrade() then
NetManager.PlayerGodLevelUpRequest(function(msg)
PopupTipPanel.ShowTip(string.format("突破成功!"))
this.RefreshWindowData()
end)
else
end
end)
end
function this.ChangePowerValue()
local WarPower = 0
for k, v in pairs(this.teamHero) do
WarPower = WarPower + HeroPowerManager.GetHeroPower(k, FormationTypeDef.FORMATION_NORMAL)
end
WarPower = WarPower + PracticeManager.GetPracticeAddPower()
this.force.text = WarPower
end
--添加事件监听(用于子类重写)
function BecomeAGodPanel:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.Bag.BagGold, this.RefreshWindowData)
Game.GlobalEvent:AddEvent(GameEvent.Formation.OnFormationPowerChange, this.ChangePowerValue)
end
--移除事件监听(用于子类重写)
function BecomeAGodPanel:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.Bag.BagGold, this.RefreshWindowData)
Game.GlobalEvent:RemoveEvent(GameEvent.Formation.OnFormationPowerChange, this.ChangePowerValue)
end
--界面打开时调用(用于子类重写)
function BecomeAGodPanel:OnOpen(...)
local data = { ... }
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.BecomeAGod })
end
function BecomeAGodPanel:OnShow()
this.teamHero = FormationManager.GetAllMainFormationHeroId()
this.RefreshWindowData()
for i = 1, 6 do
Util.AddParticleSortLayer(this.godlist[i].effect, this.sortingOrder - 10)
end
Util.AddParticleSortLayer(this.effect, this.sortingOrder - 10)
Util.AddParticleSortLayer(this.TupoDesPanel, this.sortingOrder + 20)
end
function this:OnSortingOrderChange()
end
--右切换按钮点击
function this:RightBtnOnClick()
end
--左切换按钮点击
function this:LeftBtnOnClick()
end
function this.RefreshWindowData()
this.ChangePowerValue()
this.btnLvup.gameObject:SetActive(BecomeAGodManager.IsCouldUpgrade())
--local str = ""
if BecomeAGodManager.playerGodLevel == 0 then
this.LevelUpDes.text = ""
elseif BecomeAGodManager.playerGodLevel == 1 then
this.LevelUpDes.text = "半神"
elseif BecomeAGodManager.playerGodLevel == 2 then
this.LevelUpDes.text = ""
else
this.LevelUpDes.text = "神王"
end
for i = 1, 3 do
--[[
if i < BecomeAGodManager.playerGodLevel then
str = str .. "<color=#57c88a>" ..
BecomeAGodLevel[i].Describe .. "</color>\n"
elseif i == BecomeAGodManager.playerGodLevel and BecomeAGodManager.IsCouldUpgrade() then
str = str .. "<color=#57c88a>" ..
BecomeAGodLevel[i].Describe .. "</color>\n"
else
str = str ..
BecomeAGodLevel[i].Describe .. "\n"
end
this.TupoDesPanel = Util.GetGameObject(self.transform, "TianfuDes")
]]
local desText = Util.GetGameObject(this.TupoDesPanel, "Content/skillDesc (" .. i .. ")/Text (1)"):GetComponent(
"Text")
if i < BecomeAGodManager.playerGodLevel then
desText.text = "<color=#57c88a>" ..
BecomeAGodLevel[i].Describe .. "</color>"
else
desText.text = "<color=#ECE4CC>" ..
BecomeAGodLevel[i].Describe .. "</color>"
end
end
--this.LevelUpDes.text = str
if BecomeAGodLevel[BecomeAGodManager.playerGodLevel + 1] then
this.btnLvup.gameObject:SetActive(true)
--this.LevelUpDes.gameObject:SetActive(true)
if BecomeAGodManager.IsCouldUpgrade() then
Util.SetGray(this.btnLvup, false)
--this.LevelUpDes.text = "<color=#57c88a>" ..
--BecomeAGodLevel[BecomeAGodManager.playerGodLevel + 1].Describe .. "</color>"
else
Util.SetGray(this.btnLvup, true)
--this.LevelUpDes.text = BecomeAGodLevel[BecomeAGodManager.playerGodLevel + 1].Describe
end
else
this.btnLvup.gameObject:SetActive(false)
--this.LevelUpDes.gameObject:SetActive(true)
end
end
--界面关闭时调用(用于子类重写)
function BecomeAGodPanel:OnClose()
end
--界面销毁时调用(用于子类重写)
function BecomeAGodPanel:OnDestroy()
end
return BecomeAGodPanel