2022-04-22 18:24:33 +08:00
|
|
|
|
require("Base/BasePanel")
|
|
|
|
|
local IncarnationForcePanel = Inherit(BasePanel)
|
2022-04-24 16:50:24 +08:00
|
|
|
|
local this=IncarnationForcePanel
|
2022-04-22 18:24:33 +08:00
|
|
|
|
local propertyConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
|
|
|
|
|
|
|
|
|
function IncarnationForcePanel:InitComponent()
|
|
|
|
|
self.spLoader = SpriteLoader.New()
|
|
|
|
|
self.mask = Util.GetGameObject(self.gameObject,"Mask")
|
|
|
|
|
self.backBtn = Util.GetGameObject(self.gameObject,"Frame/backBtn")
|
|
|
|
|
self.helpBtn = Util.GetGameObject(self.gameObject,"Frame/helpBtn")
|
|
|
|
|
self.grid = Util.GetGameObject(self.gameObject,"Frame/Grid")
|
|
|
|
|
self.textPre = Util.GetGameObject(self.grid,"TextPre")
|
|
|
|
|
self.textPre:SetActive(false)
|
|
|
|
|
self.Tips = Util.GetGameObject(self.gameObject,"Frame/Tips"):GetComponent("Text")
|
|
|
|
|
self.title = Util.GetGameObject(self.gameObject,"Frame/Bg/title/Text"):GetComponent("Text")
|
|
|
|
|
|
|
|
|
|
self.Slide = Util.GetGameObject(self.gameObject,"Frame/Slide")
|
|
|
|
|
self.level = Util.GetGameObject(self.Slide,"level"):GetComponent("Text")
|
|
|
|
|
self.power = Util.GetGameObject(self.Slide,"powerBtn/value"):GetComponent("Text")
|
|
|
|
|
self.value = Util.GetGameObject(self.Slide,"Text"):GetComponent("Text")
|
|
|
|
|
self.fill = Util.GetGameObject(self.Slide,"fill")
|
|
|
|
|
self.upGradeBtn = Util.GetGameObject(self.Slide,"Button")
|
|
|
|
|
self.btnText = Util.GetGameObject(self.upGradeBtn,"Text"):GetComponent("Text")
|
|
|
|
|
self.btnRed = Util.GetGameObject(self.upGradeBtn,"RedPoint")
|
|
|
|
|
self.textPreList = {}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function IncarnationForcePanel:BindEvent()
|
|
|
|
|
--帮助按钮
|
|
|
|
|
Util.AddOnceClick(self.helpBtn, function()
|
|
|
|
|
UIManager.OpenPanel(UIName.GeneralInfoPopup, GENERALINFO_TYPE.Cultivation)
|
|
|
|
|
end)
|
|
|
|
|
Util.AddOnceClick(self.mask, function()
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
Util.AddOnceClick(self.backBtn, function()
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
Util.AddOnceClick(self.upGradeBtn, function()
|
2022-04-24 16:50:24 +08:00
|
|
|
|
if this.configData.Level>=50 then
|
|
|
|
|
PopupTipPanel.ShowTip("等级已达上限")
|
2022-04-22 18:24:33 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2022-04-24 16:50:24 +08:00
|
|
|
|
local curHaveItemNum=BagManager.GetItemCountById(this.configData.ExpCost[1])
|
|
|
|
|
local curCostItemNum=this.configData.ExpCost[2]
|
|
|
|
|
if curHaveItemNum <curCostItemNum then
|
2022-04-26 13:33:41 +08:00
|
|
|
|
PopupTipPanel.ShowTip("化身之力不足,无法升级")
|
2022-04-22 18:24:33 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2022-04-24 16:50:24 +08:00
|
|
|
|
NetManager.SendTransformationForceUpRequest(IncarnationManager.incarnationForceLv,function ()
|
2022-04-22 18:24:33 +08:00
|
|
|
|
self:OnShow()
|
2022-04-25 14:42:17 +08:00
|
|
|
|
CheckRedPointStatus(RedPointType.incarnation_force)
|
2022-04-22 18:24:33 +08:00
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
BindRedPointObject(RedPointType.Practice_Cultivation,self.btnRed)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function IncarnationForcePanel:AddListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function IncarnationForcePanel:RemoveListener()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function IncarnationForcePanel:OnSortingOrderChange()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function IncarnationForcePanel:OnOpen()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function IncarnationForcePanel:OnShow()
|
2022-04-24 16:50:24 +08:00
|
|
|
|
this.configData = ConfigManager.GetConfigData(ConfigName.ChangingForce,IncarnationManager.incarnationForceLv)
|
|
|
|
|
this.nextConfigData=nil
|
|
|
|
|
if this.configData.Level<50 then
|
|
|
|
|
this.nextConfigData = ConfigManager.GetConfigData(ConfigName.ChangingForce,IncarnationManager.incarnationForceLv+1)
|
|
|
|
|
end
|
2022-04-22 18:24:33 +08:00
|
|
|
|
--设置四个属性
|
2022-04-24 16:50:24 +08:00
|
|
|
|
for i = 1, #this.configData.PropList do
|
2022-04-22 18:24:33 +08:00
|
|
|
|
local go = self.textPreList[i]
|
|
|
|
|
if not go then
|
|
|
|
|
go = newObjToParent(self.textPre,self.grid)
|
|
|
|
|
go:SetActive(true)
|
|
|
|
|
self.textPreList[i] = go
|
|
|
|
|
end
|
2022-04-24 16:50:24 +08:00
|
|
|
|
self:SetSingleData(go,this.configData.PropList[i],i)
|
2022-04-22 18:24:33 +08:00
|
|
|
|
end
|
|
|
|
|
--设置等级
|
2022-04-25 18:42:19 +08:00
|
|
|
|
self.level.text = string.format("化身等级:%s级",this.configData.Level)
|
2022-04-24 16:50:24 +08:00
|
|
|
|
self.power.text = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
|
|
|
|
|
this.btnRed.gameObject:SetActive(false)
|
|
|
|
|
if this.configData.Level<50 then
|
2022-04-28 10:45:25 +08:00
|
|
|
|
local curHaveItemNum=BagManager.GetItemCountById(this.configData.ExpCost[1])
|
|
|
|
|
local curCostItemNum=this.configData.ExpCost[2]
|
2022-04-24 16:50:24 +08:00
|
|
|
|
self.value.text = string.format("%s/%s",curHaveItemNum,curCostItemNum)
|
|
|
|
|
if curHaveItemNum>curCostItemNum then
|
2022-04-22 18:24:33 +08:00
|
|
|
|
self.fill:GetComponent("RectTransform").sizeDelta = Vector3.New(445,26,0)
|
2022-04-24 16:50:24 +08:00
|
|
|
|
this.btnRed.gameObject:SetActive(true)
|
2022-04-22 18:24:33 +08:00
|
|
|
|
else
|
2022-04-24 16:50:24 +08:00
|
|
|
|
local size = curHaveItemNum/curCostItemNum
|
2022-04-22 18:24:33 +08:00
|
|
|
|
self.fill:GetComponent("RectTransform").sizeDelta = Vector3.New(445*size,26,0)
|
|
|
|
|
end
|
|
|
|
|
self.btnText.text = "升 级"
|
|
|
|
|
else
|
|
|
|
|
self.value.text = string.format("")
|
|
|
|
|
self.fill:GetComponent("RectTransform").sizeDelta = Vector3.New(445,26,0)
|
|
|
|
|
self.btnText.text = "已达上限"
|
2022-04-28 11:58:48 +08:00
|
|
|
|
self.btnText.fontSize=35
|
2022-04-22 18:24:33 +08:00
|
|
|
|
end
|
2022-04-24 16:50:24 +08:00
|
|
|
|
|
2022-04-22 18:24:33 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--设置单个数据
|
|
|
|
|
function IncarnationForcePanel:SetSingleData(_go,data,_index)
|
|
|
|
|
local proName = Util.GetGameObject(_go,"PropertyName"):GetComponent("Text")
|
|
|
|
|
local Calculate = Util.GetGameObject(_go,"Calculate"):GetComponent("Text")
|
|
|
|
|
|
2022-04-24 16:50:24 +08:00
|
|
|
|
if IncarnationManager.incarnationForceLv == 0 then
|
2022-04-28 11:58:48 +08:00
|
|
|
|
proName.text = string.format("%s:+0%%",propertyConfig[data[1]].Info)
|
2022-04-22 18:24:33 +08:00
|
|
|
|
else
|
2022-04-28 11:58:48 +08:00
|
|
|
|
proName.text = string.format("%s:+%s%%",propertyConfig[data[1]].Info,data[2]/100)
|
2022-04-24 16:50:24 +08:00
|
|
|
|
end
|
|
|
|
|
if this.nextConfigData then
|
|
|
|
|
local addProp=this.nextConfigData.PropList[_index][2]-data[2]
|
|
|
|
|
Calculate.text=string.format("(+%s%%)",addProp/100)
|
|
|
|
|
Calculate.gameObject:SetActive(true)
|
|
|
|
|
else
|
|
|
|
|
Calculate.gameObject:SetActive(false)
|
2022-04-22 18:24:33 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function IncarnationForcePanel:OnClose()
|
2022-08-18 17:02:35 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.CommonEvent.RefreshIncarnationPanelUp)
|
2022-04-22 18:24:33 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function IncarnationForcePanel:OnDestroy()
|
|
|
|
|
self.spLoader:Destroy()
|
|
|
|
|
self.textPreList = {}
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return IncarnationForcePanel
|