2020-08-25 15:46:38 +08:00
|
|
|
|
require("Base/BasePanel")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
TenRecruitPanel = Inherit(BasePanel)
|
|
|
|
|
local this = TenRecruitPanel
|
|
|
|
|
local cardList = {}
|
|
|
|
|
local orginLayer
|
|
|
|
|
local gameSetting=ConfigManager.GetConfig(ConfigName.GameSetting)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
|
|
|
|
|
local itemConfig=ConfigManager.GetConfig(ConfigName.ItemConfig)
|
|
|
|
|
local artResourcesConfig =ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
|
|
|
|
|
local privilegeConfig=ConfigManager.GetConfig(ConfigName.PrivilegeTypeConfig)
|
|
|
|
|
local type --抽卡类型
|
|
|
|
|
local maxTimesId--特权id上限(今日召唤上限)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function TenRecruitPanel:InitComponent()
|
|
|
|
|
orginLayer = 0
|
|
|
|
|
this.sureBtn = Util.GetGameObject(self.transform, "sureBtn")
|
|
|
|
|
this.againBtn = Util.GetGameObject(self.transform, "againBtn")
|
2020-05-25 19:16:23 +08:00
|
|
|
|
this.againIcon=Util.GetGameObject(self.transform,"Tip/juan"):GetComponent("Image")
|
|
|
|
|
this.againNum=Util.GetGameObject(self.transform,"Tip/Text"):GetComponent("Text")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.cardPre = Util.GetGameObject(self.transform, "card")
|
|
|
|
|
this.grid = Util.GetGameObject(self.transform, "scroll/grid")
|
|
|
|
|
self.effect = Util.GetGameObject(self.gameObject, "bg/effect")
|
|
|
|
|
for i = 1, 10 do
|
|
|
|
|
cardList[i] = SubUIManager.Open(SubUIConfig.RoleItemView, this.grid.transform)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function TenRecruitPanel:BindEvent()
|
|
|
|
|
|
|
|
|
|
Util.AddClick(self.sureBtn, function()
|
|
|
|
|
-- UIManager.OpenPanel(UIName.RecruitPanel)
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(self.againBtn, function()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
local d=RecruitManager.GetExpendData(type)
|
|
|
|
|
if BagManager.GetItemCountById(d[1])<d[2] then
|
2020-06-23 18:36:24 +08:00
|
|
|
|
PopupTipPanel.ShowTip(itemConfig[d[1]].Name..Language[10492])
|
2020-05-25 19:16:23 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if PrivilegeManager.GetPrivilegeUsedTimes(maxTimesId)+1>privilegeConfig[maxTimesId].Condition[1][2] then
|
2020-06-23 18:36:24 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[11760])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
RecruitManager.RecruitRequest(type, function(msg)
|
2020-06-03 19:09:01 +08:00
|
|
|
|
PrivilegeManager.RefreshPrivilegeUsedTimes(maxTimesId,10)--记录抽卡次数
|
2020-05-25 19:16:23 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.SingleRecruitPanel, msg.drop.Hero, type,2)
|
2020-06-28 17:48:49 +08:00
|
|
|
|
end,maxTimesId)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function TenRecruitPanel:AddListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function TenRecruitPanel:RemoveListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
function TenRecruitPanel:OnSortingOrderChange()
|
|
|
|
|
Util.AddParticleSortLayer(self.effect, self.sortingOrder - orginLayer)
|
2020-07-28 15:06:47 +08:00
|
|
|
|
for i = 1, this.grid.transform.childCount do
|
|
|
|
|
Util.AddParticleSortLayer(this.grid.transform:GetChild(i-1).gameObject, self.sortingOrder - orginLayer)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-28 15:06:47 +08:00
|
|
|
|
orginLayer = self.sortingOrder
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2020-07-28 15:06:47 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function TenRecruitPanel:OnOpen(...)
|
|
|
|
|
local data = { ... }
|
|
|
|
|
local _roleDatas = data[1]
|
2020-05-25 19:16:23 +08:00
|
|
|
|
type=data[2]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
for i = 1, #_roleDatas do
|
|
|
|
|
cardList[i]:OnOpen(_roleDatas[i].id,false,false,-1,self.sortingOrder)
|
|
|
|
|
local heorConfig = ConfigManager.GetConfigData(ConfigName.HeroConfig,_roleDatas[i].heroId)
|
2020-08-22 19:40:14 +08:00
|
|
|
|
LogBlue("heorConfig.Star:"..heorConfig.Star)
|
|
|
|
|
if heorConfig and heorConfig.Star >= 5 then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
HeroManager.DetectionOpenFiveStarActivity(heorConfig.Star)
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
local d=RecruitManager.GetExpendData(type)
|
|
|
|
|
this.againIcon.sprite=Util.LoadSprite(artResourcesConfig[itemConfig[d[1]].ResourceID].Name)
|
|
|
|
|
this.againNum.text="×"..d[2]
|
2020-06-28 17:48:49 +08:00
|
|
|
|
maxTimesId=lotterySetting[type].MaxTimes --特权上限ID
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function TenRecruitPanel:OnClose()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function TenRecruitPanel:OnDestroy()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
2020-06-23 18:36:24 +08:00
|
|
|
|
return TenRecruitPanel
|