miduo_client/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_RecruitBox.lua

93 lines
3.6 KiB
Lua

----- 点将台抽卡 宝箱弹窗 -----
local this = {}
--传入父脚本模块
local parent
--传入特效层级
local sortingOrder = 0
local lotterySetting = ConfigManager.GetConfig(ConfigName.LotterySetting)
local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local _CostItem --s1 消耗道具 s2消耗数量
local _Con_Recharge --充值数
local _Con_Star --充值数
function this:InitComponent(gameObject)
this.spLoader = SpriteLoader.New()
this.titleText = Util.GetGameObject(gameObject, "TitleText"):GetComponent("Text")
this.text1 = Util.GetGameObject(gameObject, "Body/Text1"):GetComponent("Text")
this.text2 = Util.GetGameObject(gameObject, "Body/Text2"):GetComponent("Text")
this.text3 = Util.GetGameObject(gameObject, "Body/Text3"):GetComponent("Text")
this.curNum = Util.GetGameObject(gameObject, "Body/CurNum/Text"):GetComponent("Text")
this.okBtn = Util.GetGameObject(gameObject, "OkBtn")
this.okBtnTxt = Util.GetGameObject(gameObject, "OkBtn/Text"):GetComponent("Text")
this.okBtnTxt.text = Language[10024]
this.anim = Util.GetGameObject(gameObject, "Body/boxIcon"):GetComponent("Animator")
this.boxBtn = Util.GetGameObject(gameObject, "Body/boxIcon")
end
function this:BindEvent()
Util.AddClick(this.okBtn, function()
if BagManager.GetItemCountById(94) < tonumber(_CostItem) then
-- PopupTipPanel.ShowTip("仙缘积分不足!")
JumpManager.GoJump(36008)
return
end
RecruitManager.RecruitRequest(RecruitType.RecruitBox, function(msg)
--UIManager.OpenPanel(UIName.SingleRecruitPanel, msg.drop.Hero[1],RecruitType.RecruitBox,1,{RecruitType.RecruitBox,RecruitType.RecruitBox})
this.curNum.text = string.format(Language[12358], BagManager.GetItemCountById(94))
parent:ClosePanel()
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1, function()
UIManager.OpenPanel(UIName.RecruitMainPanel)
end)
--this:ShowInfo()
end)
end)
Util.AddClick(this.boxBtn, function()
UIManager.OpenPanel(UIName.RewardBoxPanel, nil, 81182)
end)
end
function this:AddListener()
end
function this:RemoveListener()
end
function this:OnShow(_parent, ...)
parent = _parent
sortingOrder = _parent.sortingOrder
local args = { ... }
this:ShowInfo()
end
function this:ShowInfo()
_CostItem = lotterySetting[RecruitType.RecruitBox].CostItem[1][2]
local con = string.split(specialConfig[49].Value, "#")
_Con_Recharge = tonumber(con[1])
_Con_Star = tonumber(con[2])
this.titleText.text = Language[12359]
this.text1.text = string.format(Language[12360], _CostItem)
this.text2.text = "" --Language[12361] --后续改成读表
this.text3.text = string.format(Language[12362], string.format(MoneyUtil.GetMoneyUnitName(), _Con_Recharge),
_Con_Star)
--"需要充值"..string.format(MoneyUtil.GetMoneyUnitName(),_Con_Recharge).."以上才可打开"
local isUnlock = VipManager.GetChargedNum() >= _Con_Recharge or FightLevelManager.GetAllChapterStars() >= _Con_Star
this.curNum.text = string.format(Language[12363], BagManager.GetItemCountById(94), _CostItem)
Util.SetGray(this.okBtn, not isUnlock)
this.okBtn:GetComponent("Button").interactable = isUnlock
this.text3.gameObject:SetActive(not isUnlock)
this.anim.enabled = BagManager.GetItemCountById(94) >= tonumber(_CostItem)
end
function this:OnClose()
end
function this:OnDestroy()
this.spLoader:Destroy()
end
return this