2021-04-21 13:12:04 +08:00
|
|
|
|
require("Base/BasePanel")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
SingleRecruitPanel = Inherit(BasePanel)
|
|
|
|
|
local this=SingleRecruitPanel
|
|
|
|
|
local heroConfigData = ConfigManager.GetConfig(ConfigName.HeroConfig)
|
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 passiveSkillConfig=ConfigManager.GetConfig(ConfigName.PassiveSkillConfig)
|
|
|
|
|
local passiveSkillLogicConfig=ConfigManager.GetConfig(ConfigName.PassiveSkillLogicConfig)
|
|
|
|
|
local heroRankupConfig=ConfigManager.GetConfig(ConfigName.HeroRankupConfig)
|
2021-05-28 10:36:55 +08:00
|
|
|
|
local wishSettingConfig=ConfigManager.GetConfig(ConfigName.WishActivitySetting)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local isFirst=true--是否为第一次进入界面
|
|
|
|
|
local timeNum--第一个特效等待播放的时间
|
|
|
|
|
local timeNum2--第二个特效等待播放的时间
|
|
|
|
|
local timeNum3--第三个特效等待播放的时间
|
|
|
|
|
local heroData--展示界面需要的单个英雄数据
|
2020-05-25 19:16:23 +08:00
|
|
|
|
local type--抽卡类型
|
2020-12-29 14:24:45 +08:00
|
|
|
|
local recruitType={}--前端显示用 抽卡类型
|
2020-05-25 19:16:23 +08:00
|
|
|
|
local state --1单抽 2多抽
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local index=0 --十连抽索引
|
|
|
|
|
local orginLayer
|
|
|
|
|
local heroStaticData
|
|
|
|
|
local testLiveGO
|
2020-05-25 19:16:23 +08:00
|
|
|
|
local maxTimesId--特权id上限(今日召唤上限)
|
|
|
|
|
local _heroTable={} --符合4、5星的英雄容器
|
2021-05-28 10:36:55 +08:00
|
|
|
|
local func=nil
|
2021-01-26 18:52:03 +08:00
|
|
|
|
this.time = Timer.New()
|
|
|
|
|
this.time2 = Timer.New()
|
|
|
|
|
this.time3 = Timer.New()
|
2021-06-01 11:16:37 +08:00
|
|
|
|
local Sound_Recruit2
|
|
|
|
|
local Sound_Recruit3
|
|
|
|
|
local Sound_Recruit4
|
2021-06-08 20:27:00 +08:00
|
|
|
|
local isJump = 0
|
2021-06-01 11:16:37 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function SingleRecruitPanel:InitComponent()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader = SpriteLoader.New()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
orginLayer = 0
|
|
|
|
|
self.live2dRoot = Util.GetGameObject(self.gameObject, "rolePanel/live2dRoot")
|
|
|
|
|
self.bg = Util.GetGameObject(self.gameObject, "bg")
|
|
|
|
|
screenAdapte(self.bg)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
self.heroName = Util.GetGameObject(self.transform, "rolePanel/rolePanel1/Panel/name/heroName"):GetComponent("Text")
|
|
|
|
|
self.proImage = Util.GetGameObject(self.transform, "rolePanel/rolePanel1/Panel/name/proImage/proImage/proImage"):GetComponent("Image")
|
|
|
|
|
self.starGrid = Util.GetGameObject(self.transform, "rolePanel/rolePanel1/Panel/star")
|
|
|
|
|
|
|
|
|
|
self.goBtn=Util.GetGameObject(self.transform,"rolePanel/rolePanel2/goBtn")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
self.sureBtn = Util.GetGameObject(self.transform, "rolePanel/rolePanel2/sureBtn")
|
|
|
|
|
self.againBtn = Util.GetGameObject(self.transform, "rolePanel/rolePanel2/againBtn")
|
2020-05-25 19:16:23 +08:00
|
|
|
|
self.againIcon=Util.GetGameObject(self.againBtn,"Tip/juan"):GetComponent("Image")
|
|
|
|
|
self.againNum=Util.GetGameObject(self.againBtn,"Tip/Text"):GetComponent("Text")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
self.dragView = SubUIManager.Open(SubUIConfig.DragView, self.gameObject.transform)
|
|
|
|
|
self.dragView.transform:SetSiblingIndex(1)
|
2021-01-26 17:08:39 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.rolePanel = Util.GetGameObject(self.transform, "rolePanel")
|
2021-01-26 18:52:03 +08:00
|
|
|
|
this.jumpPanel = Util.GetGameObject(self.transform, "jumpPanel")
|
2020-05-25 19:16:23 +08:00
|
|
|
|
this.UI_Effect_open = Util.GetGameObject(self.transform, "bg/UI_Effect_open") --开门特效
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.UI_Effect_appear = Util.GetGameObject(self.transform, "bg/UI_Effect_appear")
|
|
|
|
|
this.UI_Effect_choukaSSR = Util.GetGameObject(self.transform, "bg/UI_Effect_chouka_SSR")
|
|
|
|
|
this.UI_Effect_choukaSR = Util.GetGameObject(self.transform, "bg/UI_Effect_chouka_SR")
|
|
|
|
|
this.UI_Effect_choukaR = Util.GetGameObject(self.transform, "bg/UI_Effect_chouka_R")
|
2021-01-26 18:52:03 +08:00
|
|
|
|
this.jumpBtn = Util.GetGameObject(this.jumpPanel.transform, "btnContinue/jumpBtn")
|
2021-01-27 17:19:27 +08:00
|
|
|
|
this.jumpBtnGo = Util.GetGameObject(this.jumpPanel.transform, "btnContinue")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
self.posImage=Util.GetGameObject(self.transform,"Pos/PosImage"):GetComponent("Image")
|
|
|
|
|
self.posText=Util.GetGameObject(self.transform,"Pos/PosText"):GetComponent("Text")
|
2020-05-25 19:16:23 +08:00
|
|
|
|
|
|
|
|
|
this.info=Util.GetGameObject(self.gameObject,"rolePanel/rolePanel1/Panel/Info")
|
|
|
|
|
this.infoTitleBg=Util.GetGameObject(this.info,"TitleBg")
|
|
|
|
|
this.infoTitle=Util.GetGameObject(this.infoTitleBg,"Title"):GetComponent("Text")
|
2020-12-26 17:19:50 +08:00
|
|
|
|
this.infoBody=Util.GetGameObject(this.info,"BodyBg/Viewport/Body"):GetComponent("Text")
|
|
|
|
|
this.infoBodyGo=Util.GetGameObject(this.info,"BodyBg")
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function SingleRecruitPanel:BindEvent()
|
|
|
|
|
Util.AddClick(self.sureBtn, function()
|
2020-12-29 14:51:30 +08:00
|
|
|
|
isFirst=true
|
2021-05-28 10:36:55 +08:00
|
|
|
|
if lotterySetting[type] and lotterySetting[type].LotteryType == 11 then
|
2020-12-29 14:51:30 +08:00
|
|
|
|
isFirst=false
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
self:ClosePanel()
|
2020-12-24 13:52:28 +08:00
|
|
|
|
if PlayerManager.IsGetFiveStarHero then--and OperatingManager.IsShowFiveStarPatch then
|
2020-12-23 14:54:53 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.PatFaceSend, FacePanelType.GrowGift, 5)
|
|
|
|
|
PlayerManager.IsGetFiveStarHero = false
|
|
|
|
|
end
|
|
|
|
|
end)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Util.AddClick(self.againBtn, function()
|
2021-05-28 10:36:55 +08:00
|
|
|
|
if recruitType and recruitType[1]==RecruitType.PrayerSingle then
|
|
|
|
|
if func then
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
func()
|
|
|
|
|
end
|
|
|
|
|
return
|
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
local d=RecruitManager.GetExpendData(type)
|
|
|
|
|
if BagManager.GetItemCountById(d[1])<d[2] then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(GetLanguageStrById(itemConfig[d[1]].Name)..Language[10486])
|
2020-05-09 13:31:21 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
if PrivilegeManager.GetPrivilegeUsedTimes(maxTimesId)+1>privilegeConfig[maxTimesId].Condition[1][2] then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[10485])
|
2020-05-25 19:16:23 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
2020-12-23 10:34:47 +08:00
|
|
|
|
if d[1] == 16 then
|
2020-12-23 17:45:16 +08:00
|
|
|
|
if lotterySetting[type].MoneyTimes and lotterySetting[type].MoneyTimes > 0 and PrivilegeManager.GetPrivilegeRemainValue(lotterySetting[type].MoneyTimes) < 1 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
PopupTipPanel.ShowTip(Language[11423])
|
2020-12-23 10:34:47 +08:00
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-12-28 15:46:22 +08:00
|
|
|
|
local recruitOne = function()
|
|
|
|
|
RecruitManager.RecruitRequest(type,function(msg)
|
|
|
|
|
if d[1] == 16 and lotterySetting[type].MoneyTimes and lotterySetting[type].MoneyTimes > 0 then
|
|
|
|
|
PrivilegeManager.RefreshPrivilegeUsedTimes(lotterySetting[type].MoneyTimes,1)--记录妖晶限购抽卡次数
|
|
|
|
|
end
|
|
|
|
|
PrivilegeManager.RefreshPrivilegeUsedTimes(maxTimesId,1)--记录抽卡次数
|
|
|
|
|
for i=1, #msg.drop.Hero do
|
|
|
|
|
heroData = msg.drop.Hero[i]
|
|
|
|
|
self:UpdataPanelData(heroData)
|
|
|
|
|
end
|
|
|
|
|
end,maxTimesId)
|
|
|
|
|
end
|
2020-12-29 14:24:45 +08:00
|
|
|
|
local state = PlayerPrefs.GetInt(PlayerManager.uid.."GeneralPopup_RecruitConfirm"..recruitType[2])
|
2020-12-28 15:46:22 +08:00
|
|
|
|
if state==0 and d[1] == 16 then
|
2020-12-29 14:24:45 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.RecruitConfirm,type,recruitOne)
|
2020-12-28 15:46:22 +08:00
|
|
|
|
else
|
|
|
|
|
recruitOne()
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
Util.AddClick(this.dragView.gameObject, function ()
|
2021-08-25 20:59:26 +08:00
|
|
|
|
if not IsNull(testLiveGO) then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local SkeletonGraphic = testLiveGO:GetComponent("SkeletonGraphic")
|
|
|
|
|
SkeletonGraphic.AnimationState:SetAnimation(0, "touch", false)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
--十连跳过按钮 直接打开十连抽展示界面
|
2021-01-26 18:52:03 +08:00
|
|
|
|
Util.AddClick(this.jumpBtn, function()
|
2021-06-08 20:27:00 +08:00
|
|
|
|
isJump = 1
|
2021-04-16 14:09:36 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.UI.OnBtnClicked, self.uiConfig.id,this.jumpBtn.name)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
isFirst=true
|
2021-01-26 18:52:03 +08:00
|
|
|
|
this.CloseAllTimer()
|
|
|
|
|
if state==1 then --单抽
|
|
|
|
|
this.UI_Effect_open:SetActive(false)
|
|
|
|
|
self:UpdataPanelData(heroData)
|
2021-04-16 14:09:36 +08:00
|
|
|
|
--如果不是在强制引导,就,,, by:王振兴 2021/04/15 适配新手引导跳过
|
|
|
|
|
if not GuideManager.IsInMainGuide() then
|
|
|
|
|
this.goBtn:SetActive(false)
|
|
|
|
|
this.againBtn:SetActive(true)
|
|
|
|
|
this.sureBtn:SetActive(true)
|
|
|
|
|
this.info:SetActive(false)
|
|
|
|
|
end
|
2021-01-26 18:52:03 +08:00
|
|
|
|
else
|
2021-06-08 20:27:00 +08:00
|
|
|
|
-- if lotterySetting[type].LotteryType == 11 then
|
|
|
|
|
-- isFirst=false
|
|
|
|
|
-- end
|
|
|
|
|
isFirst=false
|
|
|
|
|
local tempHeroTable = {}
|
|
|
|
|
for i = index,#_heroTable do
|
|
|
|
|
if heroConfigData[_heroTable[i].heroId].Star == 5 then
|
|
|
|
|
table.insert(tempHeroTable,_heroTable[i])
|
|
|
|
|
end
|
2021-01-26 18:52:03 +08:00
|
|
|
|
end
|
2021-06-08 20:27:00 +08:00
|
|
|
|
_heroTable = tempHeroTable
|
|
|
|
|
index = 0
|
|
|
|
|
if LengthOfTable(_heroTable)>0 then
|
|
|
|
|
this.CloseAllTimer()
|
|
|
|
|
self:TenOpenPanel()
|
|
|
|
|
else
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
UIManager.OpenPanel(UIName.TenRecruitPanel,heroData,type,recruitType)
|
|
|
|
|
end
|
|
|
|
|
-- self:ClosePanel()
|
|
|
|
|
-- UIManager.OpenPanel(UIName.TenRecruitPanel,heroData,type,recruitType)
|
2020-12-29 14:51:30 +08:00
|
|
|
|
end
|
2021-07-10 18:12:50 +08:00
|
|
|
|
this.jumpPanel:SetActive(false)
|
2021-06-01 11:16:37 +08:00
|
|
|
|
this.StopPanelSound()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
end)
|
|
|
|
|
--确定按钮
|
|
|
|
|
Util.AddClick(self.goBtn,function()
|
2021-05-29 18:27:03 +08:00
|
|
|
|
if recruitType and recruitType[1]==RecruitType.PrayerSingle then
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
return
|
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
if state==1 then
|
|
|
|
|
this.goBtn:SetActive(false)
|
|
|
|
|
this.againBtn:SetActive(true)
|
2021-05-29 15:35:52 +08:00
|
|
|
|
if recruitType and recruitType[1]==RecruitType.PrayerSingle then
|
|
|
|
|
this.againBtn:SetActive(false)
|
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
this.sureBtn:SetActive(true)
|
|
|
|
|
this.info:SetActive(false)
|
|
|
|
|
elseif state==2 then
|
|
|
|
|
if index>=LengthOfTable(_heroTable) then
|
|
|
|
|
isFirst=true
|
2021-05-28 10:36:55 +08:00
|
|
|
|
if lotterySetting[type] and lotterySetting[type].LotteryType == 11 then
|
2020-12-29 14:51:30 +08:00
|
|
|
|
isFirst=false
|
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
self:ClosePanel()
|
2020-12-29 14:24:45 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.TenRecruitPanel,heroData,type,recruitType)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
else
|
|
|
|
|
self:TenOpenPanel(heroData)
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function SingleRecruitPanel:AddListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function SingleRecruitPanel:RemoveListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function SingleRecruitPanel:OnSortingOrderChange()
|
|
|
|
|
Util.AddParticleSortLayer(self.bg, self.sortingOrder - orginLayer)
|
|
|
|
|
this.rolePanel:GetComponent("Canvas").sortingOrder = self.sortingOrder + 5
|
2021-01-26 18:52:03 +08:00
|
|
|
|
this.jumpPanel:GetComponent("Canvas").sortingOrder = self.sortingOrder + 10
|
2020-05-09 13:31:21 +08:00
|
|
|
|
orginLayer = self.sortingOrder
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function SingleRecruitPanel:OnOpen(...)
|
2021-06-08 20:27:00 +08:00
|
|
|
|
isJump = 0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.UI_Effect_open:SetActive(true)
|
2021-06-01 11:16:37 +08:00
|
|
|
|
Sound_Recruit4 = SoundManager.PlaySound(SoundConfig.Sound_Recruit4)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.UI_Effect_choukaSSR:SetActive(false)
|
|
|
|
|
this.UI_Effect_choukaSR:SetActive(false)
|
|
|
|
|
this.UI_Effect_choukaR:SetActive(false)
|
|
|
|
|
this.UI_Effect_appear:SetActive(false)
|
|
|
|
|
this.rolePanel:SetActive(false)
|
2021-07-10 18:12:50 +08:00
|
|
|
|
this.jumpPanel:SetActive(false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
local data={...}
|
|
|
|
|
heroData=data[1]
|
|
|
|
|
type=data[2]
|
2020-05-25 19:16:23 +08:00
|
|
|
|
state=data[3]
|
2020-12-29 14:24:45 +08:00
|
|
|
|
recruitType=data[4]
|
2021-05-28 10:36:55 +08:00
|
|
|
|
if not func then
|
|
|
|
|
func=data[5]
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
function SingleRecruitPanel:OnShow()
|
2020-12-29 14:51:30 +08:00
|
|
|
|
isFirst=true
|
2021-05-28 10:36:55 +08:00
|
|
|
|
|
|
|
|
|
if lotterySetting[type] then
|
|
|
|
|
maxTimesId=lotterySetting[type].MaxTimes --特权上限ID
|
|
|
|
|
else
|
|
|
|
|
local wishConfig=ConfigManager.GetConfigData(ConfigName.WishActivitySetting,1)
|
|
|
|
|
if wishConfig then
|
|
|
|
|
maxTimesId=wishConfig.MaxTimes
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
index=0
|
2021-01-28 14:00:35 +08:00
|
|
|
|
if recruitType[1] == RecruitType.XiangYaoSingle or recruitType[1] == RecruitType.XiangYaoTen then
|
2021-07-10 18:12:50 +08:00
|
|
|
|
this.jumpPanel:SetActive(false)
|
2021-01-28 14:00:35 +08:00
|
|
|
|
else
|
2021-07-10 18:12:50 +08:00
|
|
|
|
this.jumpPanel:SetActive(true)
|
2021-01-28 14:00:35 +08:00
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
if state==1 then --单抽
|
2021-05-28 10:36:55 +08:00
|
|
|
|
if lotterySetting[type] and lotterySetting[type].LotteryType == 11 then
|
2020-12-29 14:51:30 +08:00
|
|
|
|
isFirst=false
|
2021-05-28 10:36:55 +08:00
|
|
|
|
else
|
|
|
|
|
local config=ConfigManager.TryGetConfigDataByKey(ConfigName.WishActivityUp,"ActivityId",type)
|
|
|
|
|
if config then
|
|
|
|
|
isFirst=false
|
|
|
|
|
end
|
2020-12-29 14:51:30 +08:00
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
self:TenOpenPanel()
|
|
|
|
|
elseif state==2 then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
isFirst=true
|
2021-05-28 10:36:55 +08:00
|
|
|
|
if lotterySetting[type] and lotterySetting[type].LotteryType == 11 then
|
2020-12-29 14:51:30 +08:00
|
|
|
|
isFirst=false
|
2021-05-28 10:36:55 +08:00
|
|
|
|
else
|
|
|
|
|
local config=ConfigManager.TryGetConfigDataByKey(ConfigName.WishActivityUp,"ActivityId",type)
|
|
|
|
|
if config then
|
|
|
|
|
isFirst=false
|
|
|
|
|
end
|
2020-12-29 14:51:30 +08:00
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
_heroTable={}
|
|
|
|
|
--将符合条件的英雄插入容器中
|
|
|
|
|
for k, v in ipairs(heroData) do
|
|
|
|
|
if heroConfigData[v.heroId].Star==4 or heroConfigData[v.heroId].Star==5 then
|
2020-06-03 19:09:01 +08:00
|
|
|
|
-- LogBlue(heroConfigData[v.heroId].ReadingName)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
table.insert(_heroTable,v)
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-04-21 16:36:12 +08:00
|
|
|
|
-- --LogGreen("符合条件的英雄数量"..LengthOfTable(_heroTable))
|
2020-05-25 19:16:23 +08:00
|
|
|
|
self:TenOpenPanel()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
|
|
|
|
|
local time--十连抽每次展示特效time
|
|
|
|
|
function SingleRecruitPanel:TenOpenPanel()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if isFirst then --第一次进来
|
|
|
|
|
this.UI_Effect_open:SetActive(true)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
index=1
|
|
|
|
|
timeNum3=0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
timeNum=1.3
|
|
|
|
|
timeNum2=4.3
|
|
|
|
|
else--以后每次进来
|
|
|
|
|
this.UI_Effect_open:SetActive(false)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
index=index+1
|
|
|
|
|
timeNum3=2
|
2020-05-09 13:31:21 +08:00
|
|
|
|
timeNum=0
|
2020-05-25 19:16:23 +08:00
|
|
|
|
timeNum2=0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2021-01-26 18:52:03 +08:00
|
|
|
|
this.CloseAllTimer()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--当单抽 或者是 十连抽第一次的时候
|
2020-05-25 19:16:23 +08:00
|
|
|
|
if state==1 or isFirst then
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.rolePanel:SetActive(false)
|
2021-01-26 18:52:03 +08:00
|
|
|
|
this.time = Timer.New(function ()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.UI_Effect_choukaSSR:SetActive(false)
|
|
|
|
|
this.UI_Effect_choukaSR:SetActive(false)
|
|
|
|
|
this.UI_Effect_choukaR:SetActive(false)
|
|
|
|
|
this.UI_Effect_appear:SetActive(true)
|
2021-06-01 11:16:37 +08:00
|
|
|
|
Sound_Recruit2 = SoundManager.PlaySound(SoundConfig.Sound_Recruit2)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end, timeNum)
|
2021-01-26 18:52:03 +08:00
|
|
|
|
this.time:Start()
|
|
|
|
|
this.time3 = Timer.New(function ()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.UI_Effect_open:SetActive(false)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
end, 4)
|
2021-01-26 18:52:03 +08:00
|
|
|
|
this.time3:Start()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
elseif state==2 then-- 十连抽
|
2021-06-08 20:27:00 +08:00
|
|
|
|
timeNum2=0
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--this.UI_Effect_choukaSSR:SetActive(false)
|
|
|
|
|
--this.UI_Effect_choukaSR:SetActive(false)
|
|
|
|
|
--this.UI_Effect_choukaR:SetActive(false)
|
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
|
2021-01-26 18:52:03 +08:00
|
|
|
|
this.time2 = Timer.New(function ()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
if state==1 then
|
|
|
|
|
self:UpdataPanelData(heroData)
|
|
|
|
|
else
|
|
|
|
|
if LengthOfTable(_heroTable)>0 then
|
|
|
|
|
self:UpdataPanelData(_heroTable[index])
|
|
|
|
|
else
|
|
|
|
|
self:ClosePanel()
|
2021-01-06 13:58:25 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.TenRecruitPanel,heroData,type,recruitType)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end, timeNum2)
|
2021-01-26 18:52:03 +08:00
|
|
|
|
this.time2:Start()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function SingleRecruitPanel:UpdataPanelData(_heroData)
|
|
|
|
|
--赋值展示界面数据
|
2021-01-26 18:52:03 +08:00
|
|
|
|
-- local time2 = Timer.New(function ()
|
|
|
|
|
this.CloseAllTimer()
|
2021-04-16 14:09:36 +08:00
|
|
|
|
Game.GlobalEvent:DispatchEvent(GameEvent.UI.OnUpdateData, self.uiConfig.id)
|
2021-07-10 18:12:50 +08:00
|
|
|
|
this.jumpPanel:SetActive(false)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.UI_Effect_appear:SetActive(false)
|
2021-06-01 11:16:37 +08:00
|
|
|
|
Sound_Recruit3 = SoundManager.PlaySound(SoundConfig.Sound_Recruit3)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
|
|
|
|
if heroStaticData and testLiveGO then
|
|
|
|
|
poolManager:UnLoadLive(GetResourcePath(heroStaticData.Live), testLiveGO)
|
|
|
|
|
heroStaticData, testLiveGO = nil, nil
|
|
|
|
|
end
|
|
|
|
|
heroStaticData = heroConfigData[_heroData.heroId]
|
2020-05-25 19:16:23 +08:00
|
|
|
|
-- Log("heroStaticData.Live:"..heroStaticData.Live)
|
|
|
|
|
--不同星级开启不同特效
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.UI_Effect_choukaSSR:SetActive(heroStaticData.Star == 5)
|
|
|
|
|
this.UI_Effect_choukaSR:SetActive(heroStaticData.Star == 4)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
this.UI_Effect_choukaR:SetActive(heroStaticData.Star == 3 or heroStaticData.Star == 2 or heroStaticData.Star == 1)
|
|
|
|
|
--指定星级开启info
|
|
|
|
|
this.info:SetActive(heroStaticData.Star == 5 or heroStaticData.Star == 4)
|
2020-12-26 17:19:50 +08:00
|
|
|
|
this.infoBodyGo:SetActive(heroStaticData.Star == 5)
|
2021-01-26 17:08:39 +08:00
|
|
|
|
this.infoTitle.text=GetLanguageStrById(heroStaticData.HeroLocationDesc1)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
if heroStaticData.Star == 5 then
|
|
|
|
|
local t={}
|
|
|
|
|
local upStarSkillDataList={} --数据容器
|
|
|
|
|
--获取几星激活数据
|
|
|
|
|
for i = 1, #heroStaticData.OpenPassiveSkillRules do
|
|
|
|
|
if heroStaticData.OpenPassiveSkillRules[i][1] == 2 then
|
2020-12-26 17:19:50 +08:00
|
|
|
|
local passiveSkillConfig = passiveSkillConfig[heroStaticData.OpenPassiveSkillRules[i][3]]
|
|
|
|
|
if passiveSkillConfig and passiveSkillLogicConfig[passiveSkillConfig.Id].Judge == 1 and string.len(passiveSkillConfig.Desc) > 1 then
|
|
|
|
|
local d = {}
|
|
|
|
|
d.passiveSkillConfig = passiveSkillConfig
|
|
|
|
|
d.OpenPassiveSkillRules = heroStaticData.OpenPassiveSkillRules[i]
|
2021-03-02 16:53:12 +08:00
|
|
|
|
d.titleStr = "<size=34><color=#5AC383>"..NumToSimplenessFont[heroRankupConfig[heroStaticData.OpenPassiveSkillRules[i][2]].Phase[2]] .. Language[11718]
|
2020-12-26 17:19:50 +08:00
|
|
|
|
table.insert(upStarSkillDataList,d)
|
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--数据插入t
|
|
|
|
|
for j = 1, #upStarSkillDataList do
|
|
|
|
|
if passiveSkillLogicConfig[upStarSkillDataList[j].passiveSkillConfig.Id].Judge == 1 then
|
2021-01-26 17:08:39 +08:00
|
|
|
|
table.insert(t,upStarSkillDataList[j].titleStr..GetLanguageStrById(upStarSkillDataList[j].passiveSkillConfig.Desc).."\n")
|
2020-05-25 19:16:23 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--获取法宝数据
|
|
|
|
|
local dTalis = ConfigManager.GetConfigData(ConfigName.HeroConfig,heroStaticData.Id).EquipTalismana--当前法宝数据 data[1]星级 data[2]法宝ID
|
|
|
|
|
local dowerAllData= ConfigManager.GetAllConfigsDataByKey(ConfigName.EquipTalismana,"TalismanaId",dTalis[2])--当前法宝全部天赋数据(天赋可能为空)
|
|
|
|
|
local dowerData={}--当前法宝全部技能数据(天赋不为空)
|
|
|
|
|
for k=1,#dowerAllData do
|
|
|
|
|
if dowerAllData[k].OpenSkillRules then
|
|
|
|
|
table.insert(dowerData, dowerAllData[k])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--数据插入t,保证在星数据后
|
|
|
|
|
for n=1,#dowerData do
|
|
|
|
|
if dowerData[n].Level==25 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
table.insert(t,Language[11719]..GetLanguageStrById(passiveSkillConfig[dowerData[n].OpenSkillRules[1]].Desc).."\n")
|
2020-05-25 19:16:23 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local s=table.concat(t)--将表里字符串拼接
|
|
|
|
|
--看这下面 是全角空格哦~
|
2021-01-26 17:08:39 +08:00
|
|
|
|
-- this.infoBody.text=string.sub(string.gsub(s," "," "),1,-2)--去除最后\n
|
|
|
|
|
this.infoBody.text=string.sub(s,1,-2)--去除最后\n
|
2020-05-25 19:16:23 +08:00
|
|
|
|
end
|
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
--TODO:动态加载立绘
|
|
|
|
|
testLiveGO = poolManager:LoadLive(GetResourcePath(heroStaticData.Live), self.live2dRoot.transform,
|
|
|
|
|
Vector3.one * heroStaticData.Scale, Vector3.New(heroStaticData.Position[1],heroStaticData.Position[2],0))
|
|
|
|
|
local SkeletonGraphic = testLiveGO:GetComponent("SkeletonGraphic")
|
|
|
|
|
local idle = function() SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true) end
|
|
|
|
|
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete + idle
|
|
|
|
|
poolManager:SetLiveClearCall(GetResourcePath(heroStaticData.Live), testLiveGO, function ()
|
|
|
|
|
SkeletonGraphic.AnimationState.Complete = SkeletonGraphic.AnimationState.Complete - idle
|
|
|
|
|
end)
|
|
|
|
|
self.dragView:SetDragGO(testLiveGO)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
SetHeroStars(this.spLoader, self.starGrid, _heroData.star,1,Vector2.New(52,52),-2,Vector2.New(0.5,0.5))
|
|
|
|
|
-- self.profession.sprite = this.spLoader:LoadSprite(GetJobSpriteStrByJobNum(heroStaticData.Profession))
|
|
|
|
|
self.proImage.sprite =this.spLoader:LoadSprite(GetProStrImageByProNum(heroStaticData.PropertyName))
|
2021-01-26 17:08:39 +08:00
|
|
|
|
self.heroName.text =GetLanguageStrById(heroStaticData.ReadingName) --string.format("lv.%s", heroData.lv)
|
2021-04-21 13:12:04 +08:00
|
|
|
|
Util.GetGameObject(self.transform,"Pos"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetHeroPosBgStr(heroStaticData.Profession))
|
|
|
|
|
self.posImage.sprite=this.spLoader:LoadSprite(GetHeroPosStr(heroStaticData.Profession))
|
2021-01-26 17:08:39 +08:00
|
|
|
|
self.posText.text=GetLanguageStrById(heroStaticData.HeroLocation)
|
|
|
|
|
SetTextVerTial(self.posText.gameObject,Vector3.New(63.76,1.5,0),"MiddleLeft")
|
2021-05-28 10:36:55 +08:00
|
|
|
|
local d=nil
|
|
|
|
|
if recruitType and recruitType[1]==RecruitType.PrayerSingle then
|
2021-05-29 15:35:52 +08:00
|
|
|
|
local num=PrivilegeManager.GetPrivilegeRemainValue(wishSettingConfig[1].DiamondMaxTimes)
|
|
|
|
|
d=RecruitManager.GetExpendDataByCostItem(wishSettingConfig[1].CostItemSingle,1,num)
|
2021-05-28 10:36:55 +08:00
|
|
|
|
else
|
|
|
|
|
d=RecruitManager.GetExpendData(type)
|
|
|
|
|
end
|
2021-04-21 13:12:04 +08:00
|
|
|
|
self.againIcon.sprite=this.spLoader:LoadSprite(artResourcesConfig[itemConfig[d[1]].ResourceID].Name)
|
2020-05-25 19:16:23 +08:00
|
|
|
|
self.againNum.text="×"..d[2]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
this.rolePanel:SetActive(true)
|
|
|
|
|
PlayUIAnim(self.transform)
|
|
|
|
|
isFirst=false
|
|
|
|
|
|
2020-05-25 19:16:23 +08:00
|
|
|
|
--10连
|
|
|
|
|
if state == 2 then
|
|
|
|
|
Util.GetGameObject(self.transform, "rolePanel/rolePanel2"):SetActive(true)
|
|
|
|
|
this.sureBtn:SetActive(false)
|
|
|
|
|
this.againBtn:SetActive(false)
|
|
|
|
|
this.goBtn:SetActive(true)
|
2020-05-09 13:31:21 +08:00
|
|
|
|
else
|
2020-05-25 19:16:23 +08:00
|
|
|
|
this.goBtn:SetActive(heroStaticData.Star == 5 or heroStaticData.Star == 4)
|
|
|
|
|
this.sureBtn:SetActive(heroStaticData.Star ~= 5 and heroStaticData.Star ~= 4)
|
|
|
|
|
this.againBtn:SetActive(heroStaticData.Star ~= 5 and heroStaticData.Star ~= 4)
|
2021-05-29 15:35:52 +08:00
|
|
|
|
if recruitType and recruitType[1]==RecruitType.PrayerSingle then
|
|
|
|
|
this.againBtn:SetActive(false)
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
Util.GetGameObject(self.transform, "rolePanel/rolePanel2"):SetActive(true)
|
|
|
|
|
if heroStaticData.Quality == 5 and heroStaticData.Natural >= 13 then
|
|
|
|
|
HeroManager.DetectionOpenFiveStarActivity(heroStaticData.Star)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function SingleRecruitPanel:OnClose()
|
2020-05-25 19:16:23 +08:00
|
|
|
|
_heroTable={}
|
|
|
|
|
index=0
|
2021-01-26 18:52:03 +08:00
|
|
|
|
this.CloseAllTimer()
|
2020-05-09 13:31:21 +08:00
|
|
|
|
if heroStaticData then
|
|
|
|
|
poolManager:UnLoadLive(GetResourcePath(heroStaticData.Live), testLiveGO)
|
|
|
|
|
end
|
|
|
|
|
heroStaticData, testLiveGO = nil, nil
|
2021-06-01 11:16:37 +08:00
|
|
|
|
this.StopPanelSound()
|
|
|
|
|
end
|
|
|
|
|
function this.StopPanelSound()
|
|
|
|
|
if Sound_Recruit2 then
|
|
|
|
|
SoundManager.StopSound(Sound_Recruit2)
|
|
|
|
|
Sound_Recruit2 = nil
|
|
|
|
|
end
|
|
|
|
|
if Sound_Recruit3 then
|
|
|
|
|
SoundManager.StopSound(Sound_Recruit3)
|
|
|
|
|
Sound_Recruit3 = nil
|
|
|
|
|
end
|
|
|
|
|
if Sound_Recruit4 then
|
|
|
|
|
SoundManager.StopSound(Sound_Recruit4)
|
|
|
|
|
Sound_Recruit4 = nil
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
function SingleRecruitPanel:GetProStr(index)
|
|
|
|
|
local proStr=""
|
|
|
|
|
if index==1 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
proStr=Language[11720]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif index==2 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
proStr=Language[11721]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif index==3 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
proStr=Language[11722]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif index==4 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
proStr=Language[11723]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif index==5 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
proStr=Language[11724]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
elseif index==6 then
|
2021-03-02 16:53:12 +08:00
|
|
|
|
proStr=Language[11725]
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
|
|
|
|
return proStr
|
|
|
|
|
end
|
2020-05-25 19:16:23 +08:00
|
|
|
|
|
2020-05-09 13:31:21 +08:00
|
|
|
|
function SingleRecruitPanel:OnDestroy()
|
2021-04-21 13:12:04 +08:00
|
|
|
|
this.spLoader:Destroy()
|
2021-05-28 10:36:55 +08:00
|
|
|
|
if func then
|
|
|
|
|
func=nil
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
end
|
2021-01-26 18:52:03 +08:00
|
|
|
|
function this.CloseAllTimer()
|
|
|
|
|
if this.time then
|
|
|
|
|
this.time:Stop()
|
|
|
|
|
this.time = nil
|
|
|
|
|
end
|
|
|
|
|
if this.time2 then
|
|
|
|
|
this.time2:Stop()
|
|
|
|
|
this.time2 = nil
|
|
|
|
|
end
|
|
|
|
|
if this.time3 then
|
|
|
|
|
this.time3:Stop()
|
|
|
|
|
this.time3 = nil
|
|
|
|
|
end
|
|
|
|
|
end
|
2020-05-09 13:31:21 +08:00
|
|
|
|
|
2021-04-21 13:12:04 +08:00
|
|
|
|
return SingleRecruitPanel
|
|
|
|
|
|