lingshou zhaohuan tijiao

jiaoyangna 2020-11-05 03:03:08 +08:00
parent a39bc32ef6
commit da88485b4c
8 changed files with 235681 additions and 17034 deletions

View File

@ -200,6 +200,7 @@ RectTransform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 133871731866382050}
- {fileID: 7357582473762033002}
- {fileID: 5402362866070119408}
- {fileID: 6817404965073036329}
@ -209,7 +210,6 @@ RectTransform:
- {fileID: 6076006563234951857}
- {fileID: 3252162807217255882}
- {fileID: 4393464194978702593}
- {fileID: 133871731866382050}
- {fileID: 6958190212726748315}
- {fileID: 4586412814992109867}
m_Father: {fileID: 0}
@ -325,7 +325,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5693075236157895772}
m_RootOrder: 2
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -404,7 +404,7 @@ RectTransform:
- {fileID: 8140004460555323162}
- {fileID: 5792920245874615388}
m_Father: {fileID: 5693075236157895772}
m_RootOrder: 8
m_RootOrder: 9
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -1366,7 +1366,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5693075236157895772}
m_RootOrder: 5
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -1487,7 +1487,7 @@ RectTransform:
- {fileID: 8042624082910741880}
- {fileID: 5344970607808354557}
m_Father: {fileID: 5693075236157895772}
m_RootOrder: 7
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -1593,7 +1593,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5693075236157895772}
m_RootOrder: 6
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -1668,7 +1668,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5693075236157895772}
m_RootOrder: 4
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -1784,7 +1784,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5693075236157895772}
m_RootOrder: 1
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -1863,7 +1863,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5693075236157895772}
m_RootOrder: 0
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -1938,7 +1938,7 @@ RectTransform:
m_Children:
- {fileID: 4930053279089642074}
m_Father: {fileID: 5693075236157895772}
m_RootOrder: 3
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
@ -2261,13 +2261,13 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 5693075236157895772}
m_RootOrder: 9
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -437.47, y: -858.85944}
m_SizeDelta: {x: 143.3, y: 122.65}
m_Pivot: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 97}
m_SizeDelta: {x: 140, y: 121}
m_Pivot: {x: 0, y: 0.5}
--- !u!222 &5022890421189793496
CanvasRenderer:
m_ObjectHideFlags: 0

View File

@ -1851,6 +1851,9 @@ RecruitType = {
NormalTen=25, --普通招募 多次
NormalSingle=26, --普通招募 单次
RecruitBox=27,--仙缘招募
LingShowSingle = 42, --零售单抽
LingShowTen = 43, --零售十连
-- FindFairySingle=13, --东海寻仙单抽
-- FindFairyTen=14, --东海寻仙十连
}

View File

@ -1,68 +1,75 @@
require("Base/BasePanel")
PokemonSummonOneResultPanel = Inherit(BasePanel)
local this=PokemonSummonOneResultPanel
local ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local gameSetting=ConfigManager.GetConfig(ConfigName.GameSetting)
local lotterySetting = ConfigManager.GetConfig(ConfigName.LotterySetting)
local iconsData = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotteryRewardConfig,"Pool",4401)
local artConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local privilegeConfig=ConfigManager.GetConfig(ConfigName.PrivilegeTypeConfig)
local heroConfigData = ConfigManager.GetConfig(ConfigName.SpiritAnimal)
local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
local artResourcesConfig =ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local itemNum=0 --抽卡小号道具数量
local isFree=false
--活动抽卡类型(动态的数据)
local drawtType={
FindFairySingle=0,
}
local privilegeConfig=ConfigManager.GetConfig(ConfigName.PrivilegeTypeConfig)
local passiveSkillConfig=ConfigManager.GetConfig(ConfigName.SpiritAnimalSkill)
local isFirst = true--是否为第一次进入界面
local timeNum--第一个特效等待播放的时间
local timeNum2--第二个特效等待播放的时间
local timeNum3--第三个特效等待播放的时间
local heroData--展示界面需要的单个英雄数据
local type --抽卡类型
local state --1单抽 2多抽
local index=0 --十连抽索引
local orginLayer
local heroStaticData
local testLiveGO
local maxTimesId--特权id上限今日召唤上限
local _heroTable={} --符合4、5星的英雄容器
--初始化组件(用于子类重写)
function PokemonSummonOneResultPanel:InitComponent()
orginLayer = 10
self.bg = Util.GetGameObject(self.gameObject, "effect")
this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft, panelType = PanelType.ElementDrawCard })
screenAdapte(self.bg)
this.btnBack=Util.GetGameObject(self.gameObject, "bottom/backButton")
this.content=Util.GetGameObject(self.gameObject, "content")
this.openOneAgainButton=Util.GetGameObject(self.gameObject, "bottom/openOneAgainButton")
this.detailImage=Util.GetGameObject(self.gameObject, "Tip")
this.detailText = Util.GetGameObject(this.detailImage, "Text"):GetComponent("Text")
this.content1=Util.GetGameObject(self.gameObject,"bottom/openOneAgainButton/Content1")
this.itemIcon1=Util.GetGameObject(this.content1, "Icon"):GetComponent("Image")
this.detailImage1=Util.GetGameObject(this.content1, "Tip")
this.detailText1 = Util.GetGameObject(this.detailImage1, "contentDetailText"):GetComponent("Text")
this.content3=Util.GetGameObject(self.gameObject,"bottom/openOneAgainButton/Content3")
this.itemIcon3=Util.GetGameObject(this.content3, "icon"):GetComponent("Image")
this.itemNum3=Util.GetGameObject(this.content3, "num"):GetComponent("Text")
this.itemInfo3=Util.GetGameObject(this.content3, "info"):GetComponent("Text")
this.content2=Util.GetGameObject(self.gameObject,"bottom/openOneAgainButton/Content2")
this.itemIcon2=Util.GetGameObject(this.content2, "Icon"):GetComponent("Image")
this.itemNum2=Util.GetGameObject(this.content2,"Num"):GetComponent("Text")
-- 关于抽卡的LotterySetting数据
local curActivityId=ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.QianKunBox)
drawtType.FindFairySingle=ConfigManager.GetConfigDataByDoubleKey(ConfigName.LotterySetting,"PerCount",1,"ActivityId",curActivityId).Id
orginLayer = 0
this.bg = Util.GetGameObject(self.gameObject, "bg")
screenAdapte(this.bg)
this.rolePanel = Util.GetGameObject(self.transform, "rolePanel")
this.live2dRoot = Util.GetGameObject(this.rolePanel, "live2dRoot")
this.heroName = Util.GetGameObject(this.rolePanel, "rolePanel1/Panel/name"):GetComponent("Text")
this.Title = Util.GetGameObject(this.rolePanel, "rolePanel1/Panel/Title"):GetComponent("Text")
this.icon = Util.GetGameObject(this.rolePanel, "rolePanel1/Panel/info/frame/icon"):GetComponent("Image")
this.content = Util.GetGameObject(this.rolePanel, "rolePanel1/Panel/info/content"):GetComponent("Text")
this.goBtn=Util.GetGameObject(this.rolePanel,"rolePanel2/goBtn")
this.sureBtn = Util.GetGameObject(this.rolePanel, "rolePanel2/sureBtn")
this.againBtn = Util.GetGameObject(this.rolePanel, "rolePanel2/againBtn")
this.againIcon=Util.GetGameObject(self.againBtn,"Tip/juan"):GetComponent("Image")
this.againNum=Util.GetGameObject(self.againBtn,"Tip/Text"):GetComponent("Text")
this.UI_Effect_open = Util.GetGameObject(self.transform, "bg/UI_Effect_open") --开门特效
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")
end
--绑定事件(用于子类重写)
function PokemonSummonOneResultPanel:BindEvent()
Util.AddClick(this.btnBack, function ()
Util.AddClick(self.sureBtn, function()
isFirst=true
self:ClosePanel()
end)
Util.AddClick(this.openOneAgainButton, function ()
local maxtimesId=lotterySetting[this.recruitType].MaxTimes
local freeTimesId=lotterySetting[this.recruitType].FreeTimes
if(isFree or BagManager.GetItemCountById(1204)>=1 or BagManager.GetItemCountById(16)>=itemNum) then
self:ClosePanel()
RecruitManager.RecruitRequest(this.recruitType, function(msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(maxtimesId,1)--记录抽卡次数
UIManager.OpenPanel(UIName.PokemonSummonOneResultPanel,msg.drop,this.recruitType)
CheckRedPointStatus(RedPointType.QianKunBox)
end,freeTimesId)
else
--UIManager.OpenPanel(UIName.QuickPurchasePanel, { type = UpViewRechargeType.DemonCrystal })--应跳到充值界面,现在是用之前的货币换取妖晶
PopupTipPanel.ShowTip(Language[11139])
self:ClosePanel()
Util.AddClick(self.againBtn, function()
end)
--确定按钮
Util.AddClick(self.goBtn,function()
if state==1 then
this.goBtn:SetActive(false)
this.againBtn:SetActive(true)
this.sureBtn:SetActive(true)
elseif state==2 then
if index>=LengthOfTable(_heroTable) then
isFirst=true
self:ClosePanel()
UIManager.OpenPanel(UIName.TenRecruitPanel,heroData,type)
else
self:TenOpenPanel(heroData)
end
end
end)
end
@ -78,95 +85,175 @@ function PokemonSummonOneResultPanel:RemoveListener()
end
function PokemonSummonOneResultPanel:OnSortingOrderChange()
Util.AddParticleSortLayer(self.bg, self.sortingOrder - orginLayer)
Util.AddParticleSortLayer(this.bg, self.sortingOrder - orginLayer)
this.rolePanel:GetComponent("Canvas").sortingOrder = self.sortingOrder + 5
orginLayer = self.sortingOrder
if this.view then
this.view:OnOpen(true,this.itemDataList[1],1.4,true,false,false,self.sortingOrder)
end
end
--界面打开时调用(用于子类重写)
function PokemonSummonOneResultPanel:OnOpen(...)
this.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.LingShou})
this.UI_Effect_open:SetActive(true)
SoundManager.PlaySound(SoundConfig.Sound_Recruit1)
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)
local args = { ... }
this.drop=args[1]
this.recruitType = args[2]
this.detailImage:SetActive(true)
this.content1:SetActive(false)
this.content2:SetActive(false)
this.content3:SetActive(true)
local itemId=0
local d
d = RecruitManager.GetExpendData(this.recruitType)
itemId=d[1]
itemNum=d[2]
this.itemIcon3.sprite=Util.LoadSprite(artResourcesConfig[ItemConfig[itemId].ResourceID].Name)
--是否激活特权
local isActive = PrivilegeManager.GetPrivilegeOpenStatusById(3004)
if itemNum>10 and isActive then
itemNum=itemNum*(1+currPrivilege.Condition[1][2]/10000)
end
--获取免费次数
local currLottery= ConfigManager.GetConfigData(ConfigName.LotterySetting,42)
local freeTimesId=currLottery.FreeTimes
local freeTime=0
if freeTimesId>0 then
freeTime= PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
RecruitManager.freeUseTimeList[freeTimesId]=freeTime
end
isFree=freeTime and freeTime >= 1
if isFree then
this.itemNum3.gameObject:SetActive(false)
this.itemIcon3.gameObject:SetActive(false)
this.itemInfo3.text=Language[12399]
else
this.itemNum3.gameObject:SetActive(true)
this.itemIcon3.gameObject:SetActive(true)
this.itemInfo3.text=Language[12418]
end
this.itemNum3.text= tostring(itemNum)
Util.ClearChild(Util.GetTransform(this.content, "itemContent1"))
this.itemDataList={}
this.itemDataList=BagManager.GetTableByBackDropData(this.drop)
--抽奖赠送物品
local tenConfig=lotterySetting[42]
local id=0
local num=0
local ishave=false
if tenConfig then
id=tenConfig.TenTimesMustGetItem[1][1]
num=tenConfig.TenTimesMustGetItem[1][2]
end
for key, value in pairs(this.itemDataList) do
if ishave==false and value.sId==id and value.num==num then
table.removebyvalue(this.itemDataList,value)
ishave=true
end
end
this.detailText.text = string.format("赠送%s个%s",num,ItemConfig[id].Name)
this.view = SubUIManager.Open(SubUIConfig.ItemView,Util.GetTransform(this.content, "itemContent1"))
this.view:OnOpen(true,this.itemDataList[1],1.4,true,false,false,self.sortingOrder)
this.openOneAgainButton:GetComponent("Button").enabled=false
local time = Timer.New(function ()
this.openOneAgainButton:GetComponent("Button").enabled=true
local itemDataList=BagManager.GetTableByBackDropData(this.drop)
if itemDataList and #itemDataList>0 then
local singleItemConfigData=itemDataList[1].configData
if singleItemConfigData and singleItemConfigData.ItemType==4 and singleItemConfigData.Quantity>=gameSetting[1].IfVersion then
UIManager.OpenPanel(UIName.SecretBoxShowPokemonPanel,singleItemConfigData.Id)
heroData = args[1]
type = args[2]
state = args[3]
end
function PokemonSummonOneResultPanel:OnShow()
maxTimesId = lotterySetting[type].MaxTimes --特权上限ID
index=0
if state==1 then --单抽
self:TenOpenPanel()
elseif state == 2 then
isFirst=true
_heroTable={}
--将符合条件的英雄插入容器中
for k, v in ipairs(heroData) do
if heroConfigData[v.heroId].Star==4 or heroConfigData[v.heroId].Star==5 then
-- LogBlue(heroConfigData[v.heroId].ReadingName)
table.insert(_heroTable,v)
end
end
end, 0.5)
time:Start()
-- LogGreen("符合条件的英雄数量"..LengthOfTable(_heroTable))
self:TenOpenPanel()
end
end
--界面关闭时调用(用于子类重写)
local time--十连抽每次展示特效time
function PokemonSummonOneResultPanel:TenOpenPanel()
if isFirst then --第一次进来
this.UI_Effect_open:SetActive(true)
index=1
timeNum3=0
timeNum=1.3
timeNum2=4.3
else--以后每次进来
this.UI_Effect_open:SetActive(false)
index=index+1
timeNum3=2
timeNum=0
timeNum2=0
end
--当单抽 或者是 十连抽第一次的时候
if state==1 or isFirst then
this.rolePanel:SetActive(false)
local time = Timer.New(function ()
this.UI_Effect_choukaSSR:SetActive(false)
this.UI_Effect_choukaSR:SetActive(false)
this.UI_Effect_choukaR:SetActive(false)
this.UI_Effect_appear:SetActive(true)
SoundManager.PlaySound(SoundConfig.Sound_Recruit2)
end, timeNum)
time:Start()
local time3 = Timer.New(function ()
this.UI_Effect_open:SetActive(false)
end, 4)
time3:Start()
elseif state==2 then-- 十连抽
-- timeNum2=0
--this.UI_Effect_choukaSSR:SetActive(false)
--this.UI_Effect_choukaSR:SetActive(false)
--this.UI_Effect_choukaR:SetActive(false)
end
local time2 = Timer.New(function ()
if state==1 then
self:UpdataPanelData(heroData)
else
if LengthOfTable(_heroTable)>0 then
self:UpdataPanelData(_heroTable[index])
else
self:ClosePanel()
UIManager.OpenPanel(UIName.TenRecruitPanel,heroData,type)
end
end
end, timeNum2)
time2:Start()
end
function PokemonSummonOneResultPanel:UpdataPanelData(_heroData)
--赋值展示界面数据
-- local time2 = Timer.New(function ()
this.UI_Effect_appear:SetActive(false)
SoundManager.PlaySound(SoundConfig.Sound_Recruit3)
if heroStaticData and testLiveGO then
poolManager:UnLoadLive(GetResourcePath(heroStaticData.Live), testLiveGO)
heroStaticData, testLiveGO = nil, nil
end
heroStaticData = heroConfigData[_heroData.pokemonId]
LogBlue("heroStaticData.Live:"..heroStaticData.Live)
--不同星级开启不同特效
this.UI_Effect_choukaSSR:SetActive(true)
--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)
this.heroName.text = heroStaticData.Name
this.Title = heroStaticData.Description
this.icon.sprite=Util.LoadSprite(artResourcesConfig(heroStaticData.Icon))
this.content.text = passiveSkillConfig[heroStaticData.SkillArray[1][2]].Desc
local d = RecruitManager.GetExpendData(type)
--如果当前是用妖晶抽卡 and 激活了特权
local isActive = PrivilegeManager.GetPrivilegeOpenStatusById(3004)
local itemNum = d[2]
if d[1] == 16 and isActive then
local currPrivilege = privilegeConfig[3004]
if currPrivilege then
itemNum = itemNum * (1 + currPrivilege.Condition[1][2]/10000)
end
end
self.againIcon.sprite=Util.LoadSprite(artResourcesConfig[itemConfig[d[1]].ResourceID].Name)
self.againNum.text="×"..d[2]
this.rolePanel:SetActive(true)
PlayUIAnim(self.transform)
isFirst=false
--10连
if state == 2 then
-- self:TenOpenPanel(heroData)
Util.GetGameObject(self.transform, "rolePanel/rolePanel2"):SetActive(true)
this.sureBtn:SetActive(false)
this.againBtn:SetActive(false)
this.goBtn:SetActive(true)
else
this.goBtn:SetActive(true)
this.sureBtn:SetActive(false)
this.againBtn:SetActive(false)
Util.GetGameObject(self.transform, "rolePanel/rolePanel2"):SetActive(true)
end
end
function PokemonSummonOneResultPanel:OnClose()
_heroTable={}
index=0
if time ~= nil then
time:Stop()
time = nil
end
if heroStaticData then
poolManager:UnLoadLive(GetResourcePath(heroStaticData.Live), testLiveGO)
end
heroStaticData, testLiveGO = nil, nil
end
--界面销毁时调用(用于子类重写)
function PokemonSummonOneResultPanel:OnDestroy()
SubUIManager.Close(this.UpView)
this.view = nil
end
return PokemonSummonOneResultPanel

View File

@ -7,38 +7,38 @@ local bType={
}
--type与lotterySetting表中的id对应
local btns={ [bType.Btn1]={name="Btn1",isInfo=Language[10644]}, [bType.Btn10]={name="Btn10",isInfo=Language[12182]}}
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local artConfig = ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
local privilegeConfig=ConfigManager.GetConfig(ConfigName.PrivilegeTypeConfig)
local artResourcesConfig =ConfigManager.GetConfig(ConfigName.ArtResourcesConfig)
local lotterySpecialConfig = ConfigManager.GetConfig(ConfigName.LotterySpecialConfig)
local freeTime= 0 --免费抽取次数
local isActive=false --是否激活特权
local leftTime=0 --特权剩余时间
function PokemonSummonPanel:InitComponent(gameObject)
self.btn_back=Util.GetGameObject(self.transform, "btn_back")
self.buffImg=Util.GetGameObject(self.transform, "tokenImg"):GetComponent("Image")
self.leftTimeObj=Util.GetGameObject(self.transform, "leftTimeObj")
self.upView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft})
self.leftTimeTxt=Util.GetGameObject(self.transform,"leftTimeObj/leftTimeTxt"):GetComponent("Text")
self.infoTxt=Util.GetGameObject(self.transform,"hint"):GetComponent("Text")
self.leftTimeObj=Util.GetGameObject(self.transform, "leftTimeObj")
self.leftTimeTxt=Util.GetGameObject(self.transform,"leftTimeObj/leftTimeTxt"):GetComponent("Text")
self.btn_shop=Util.GetGameObject(self.transform,"btn_shop")
self.btn_reward=Util.GetGameObject(self.transform,"btn_rewardPool")
self.btn_one=Util.GetGameObject(self.transform,"Btn1")
self.oneHintTxt=Util.GetGameObject(self.btn_one,"Tip"):GetComponent("Text")
self.btn_ten=Util.GetGameObject(self.transform,"Btn10")
self.tenHintTxt=Util.GetGameObject(self.btn_ten,"Tip"):GetComponent("Text")
self.btn_activate=Util.GetGameObject(self.transform,"btn_activate")
Util.GetGameObject(self.btn_activate,"Text"):GetComponent("Text").text=Language[12411]
self.btn_reward=Util.GetGameObject(self.transform,"btn_rewardPool")
self.btn_one=Util.GetGameObject(self.transform,"Btn1")
self.btn_ten=Util.GetGameObject(self.transform,"Btn10")
self.limitTxt=Util.GetGameObject(self.transform,"limit"):GetComponent("Text")
self.oneTxt=Util.GetGameObject(self.transform,"Btn1/Content/Info"):GetComponent("Text")
self.oneImg=Util.GetGameObject(self.transform,"Btn1/Content/Icon"):GetComponent("Image")
self.oneNumTxt=Util.GetGameObject(self.transform,"Btn1/Content/Num"):GetComponent("Text")
self.oneHintTxt=Util.GetGameObject(self.transform,"Btn1/Tip"):GetComponent("Text")
self.oneRedPoint=Util.GetGameObject(self.transform,"Btn1/RedPoint")
self.tenTxt=Util.GetGameObject(self.transform,"Btn10/Content/Info"):GetComponent("Text")
self.tenImg=Util.GetGameObject(self.transform,"Btn10/Content/Icon"):GetComponent("Image")
self.tenNumTxt=Util.GetGameObject(self.transform,"Btn10/Content/Num"):GetComponent("Text")
self.tenHintTxt=Util.GetGameObject(self.transform,"Btn10/Tip"):GetComponent("Text")
self.limitTxt=Util.GetGameObject(self.transform,"limit"):GetComponent("Text")
self.upView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform, { showType = UpViewOpenType.ShowLeft})
end
function PokemonSummonPanel:BindEvent()
@ -58,7 +58,7 @@ function PokemonSummonPanel:BindEvent()
end)
Util.AddClick(self.btn_back,function()
UIManager.ClosePanel(UIName.PokemonSummonPanel)
self:ClosePanel()
end)
Util.AddClick(self.btn_activate,function()
--激活特权
@ -66,10 +66,9 @@ function PokemonSummonPanel:BindEvent()
end)
end
function PokemonSummonPanel:OnShow(sortingOrder,_parent)
parent = _parent
orginLayer = sortingOrder
function PokemonSummonPanel:OnShow()
self.upView:OnOpen({showType = UpViewOpenType.ShowLeft, panelType = PanelType.LingShou})
self.infoTxt.text=Language[12415]
--是否显示特权
isActive = PrivilegeManager.GetPrivilegeOpenStatusById(3004)
@ -84,117 +83,140 @@ function PokemonSummonPanel:OnShow(sortingOrder,_parent)
self.leftTimeObj.gameObject:SetActive(false)
self.btn_activate.gameObject:SetActive(true)
end
self:refreshMagicNum()
self:refreshBtnShow()--刷新按钮显示
self:timeCountDown()--时间
end
function PokemonSummonPanel:refreshBtnShow()
--显示
local array = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySetting,"LotteryType",9)
singleRecruit = array[1]
tenRecruit = array[2]
local currLottery= ConfigManager.GetConfigData(ConfigName.LotterySetting,42)
local freeTimesId=currLottery.FreeTimes
local maxtimesId=currLottery.MaxTimes --lotterySetting表中的MaxTimes对应privilegeConfig表中的id
local curTimes=PrivilegeManager.GetPrivilegeUsedTimes(maxtimesId)
self.tenHintTxt.text=string.format("妖晶召唤次数:%s/%s",0, privilegeConfig[2006].Condition[1][2])
local currLottery = ConfigManager.GetConfigData(ConfigName.LotterySetting,RecruitType.LingShowSingle)
local freeTimesId = currLottery.FreeTimes
local maxtimesId = currLottery.MaxTimes --lotterySetting表中的MaxTimes对应privilegeConfig表中的id
local curTimes = PrivilegeManager.GetPrivilegeUsedTimes(maxtimesId)
self.tenHintTxt.text=string.format("妖晶召唤次数:%s/%s",PrivilegeManager.GetPrivilegeUsedTimes(2006), privilegeConfig[2006].Condition[1][2])
self.limitTxt.text = Language[12225]..curTimes.."/"..privilegeConfig[maxtimesId].Condition[1][2]
if freeTimesId>0 then
freeTime= PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
RecruitManager.freeUseTimeList[freeTimesId]=freeTime
if freeTimesId > 0 then
freeTime = PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
RecruitManager.freeUseTimeList[freeTimesId] = freeTime
end
--按钮赋值
for n, m in ipairs(btns) do
local btn=Util.GetGameObject(self.gameObject,m.name)
local redPot=Util.GetGameObject(btn.gameObject,"RedPoint")
local info=Util.GetGameObject(btn.gameObject,"Content/Info"):GetComponent("Text")
local icon=Util.GetGameObject(btn.gameObject,"Content/Icon"):GetComponent("Image")
local num=Util.GetGameObject(btn.gameObject,"Content/Num"):GetComponent("Text")
local tip=Util.GetGameObject(btn.gameObject,"Tip"):GetComponent("Text")
local btn = Util.GetGameObject(self.gameObject,m.name)
local redPot = Util.GetGameObject(btn.gameObject,"RedPoint")
local info = Util.GetGameObject(btn.gameObject,"Content/Info"):GetComponent("Text")
local icon = Util.GetGameObject(btn.gameObject,"Content/Icon"):GetComponent("Image")
local num = Util.GetGameObject(btn.gameObject,"Content/Num"):GetComponent("Text")
local tip = Util.GetGameObject(btn.gameObject,"Tip"):GetComponent("Text")
--存在免费次数 并且 免费>=1 并且是1按钮
local isFree=freeTime and freeTime >= 1 and n==bType.Btn1
local isFree = freeTime and freeTime >= 1 and n == bType.Btn1
redPot.gameObject:SetActive(isFree)
icon.gameObject:SetActive(not isFree)
num.gameObject:SetActive(not isFree)
local itemId=0
local itemNum=0
local type = 0
if n==bType.Btn1 then
type = singleRecruit.Id
if n == bType.Btn1 then
type = currLottery.Id
else
type = tenRecruit.Id
type = ConfigManager.GetConfigData(ConfigName.LotterySetting,RecruitType.LingShowTen).Id
end
local d=RecruitManager.GetExpendData(type)
local d = RecruitManager.GetExpendData(type)
if isFree then
info.text=Language[11759]
else
itemId=d[1]
itemNum=d[2]
itemId = d[1]
itemNum = d[2]
--如果当前是用妖晶抽卡 and 激活了特权
if itemNum>10 and isActive then
local currPrivilege=privilegeConfig[3004]
if currPrivilege then
itemNum=itemNum*(1+currPrivilege.Condition[1][2]/10000)
end
if itemId == 16 and isActive then
local currPrivilege = privilegeConfig[3004]
if currPrivilege then
itemNum = itemNum * (1 + currPrivilege.Condition[1][2]/10000)
end
end
icon.sprite=Util.LoadSprite(artResourcesConfig[itemConfig[itemId].ResourceID].Name)
info.text=m.isInfo
num.text= tostring(itemNum)
icon.sprite = Util.LoadSprite(artResourcesConfig[itemConfig[itemId].ResourceID].Name)
info.text = m.isInfo
num.text = tostring(itemNum)
end
Util.AddOnceClick(btn,function()
if not isFree then
if BagManager.GetItemCountById(itemId)<d[2] then
PopupTipPanel.ShowTip(itemConfig[itemId].Name..Language[10492])
return
end
end
local state = PlayerPrefs.GetInt(PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.QianKunBoxTen)
if n==bType.Btn1 then
if PrivilegeManager.GetPrivilegeUsedTimes(maxtimesId)+1>privilegeConfig[maxtimesId].Condition[1][2] then
PopupTipPanel.ShowTip(Language[11760])
return
end
local recruitOne = function()
RecruitManager.RecruitRequest(singleRecruit.Id, function(msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(maxtimesId,1)--记录抽卡次数
UIManager.OpenPanel(UIName.PokemonSummonOneResultPanel, msg.drop,singleRecruit.Id)
CheckRedPointStatus(RedPointType.QianKunBox)
end,freeTimesId)
end
if state==0 and d[1] ==16 and not isFree then
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.RecruitConfirm,singleRecruit.Id,recruitOne)
local state = PlayerPrefs.GetInt(PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.LingShowTen)
if n == bType.Btn1 then
if isFree then
self:Recruit(RecruitType.LingShowSingle,maxtimesId,0,0,state,freeTimesId)
else
recruitOne()
self:Recruit(RecruitType.LingShowSingle,maxtimesId,itemId,itemNum,state,freeTimesId)
end
elseif n==bType.Btn10 then
if PrivilegeManager.GetPrivilegeUsedTimes(maxtimesId)+10>privilegeConfig[maxtimesId].Condition[1][2] then
PopupTipPanel.ShowTip(Language[11760])
return
end
local recruitTen = function()
RecruitManager.RecruitRequest(tenRecruit.Id, function(msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(maxtimesId,10)--记录抽卡次数
UIManager.OpenPanel(UIName.PokemonSummonTenResultPanel, msg.drop,tenRecruit.Id)
CheckRedPointStatus(RedPointType.QianKunBox)
end,freeTimesId)
end
if state==0 and d[1] ==16 and not isFree then
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.RecruitConfirm,tenRecruit.Id,recruitTen)
else
recruitTen()
end
self:Recruit(RecruitType.LingShowTen,maxtimesId,itemId,itemNum,state,freeTimesId)
end
end)
end
end
function PokemonSummonPanel:Recruit(id,RecruitMaxtimesId,itemId,itemNum,state,freeTimesId)
local num = 0
if id == RecruitType.LingShowSingle then
num = 1
else
num = 10
end
--是否超过每日最大上限
if PrivilegeManager.GetPrivilegeUsedTimes(RecruitMaxtimesId) + num > privilegeConfig[RecruitMaxtimesId].Condition[1][2] then
PopupTipPanel.ShowTip(Language[11760])
return
end
--是否妖晶,是否超过每日妖晶最大上限
if itemId == 16 then
if PrivilegeManager.GetPrivilegeUsedTimes(2006) + num > privilegeConfig[2006].Condition[1][2] then
PopupTipPanel.ShowTip("今日妖晶召唤次数不足!")
return
end
end
if itemId ~= 0 then
if BagManager.GetItemCountById(itemId) < itemNum then
PopupTipPanel.ShowTip(itemConfig[itemId].Name..Language[10492])
return
end
end
if itemId == 16 and state == 0 then
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.RecruitConfirm,id,
function()
RecruitManager.RecruitRequest(id,
function(msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(RecruitMaxtimesId,num)--记录抽卡次数
PrivilegeManager.RefreshPrivilegeUsedTimes(2006,num)--记录妖晶抽卡次数
if num == 1 then
UIManager.OpenPanel(UIName.PokemonSummonOneResultPanel, msg.drop.pokemon[1],id,1)
else
UIManager.OpenPanel(UIName.PokemonSummonTenResultPanel, msg.drop.pokemon,id,2)
end
--CheckRedPointStatus(RedPointType.QianKunBox)
end,
freeTimesId,itemId,itemNum)
end,
itemNum)
else
RecruitManager.RecruitRequest(id, function(msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(RecruitMaxtimesId,num)--记录抽卡次数
if itemId == 16 then
PrivilegeManager.RefreshPrivilegeUsedTimes(2006,num)--记录妖晶抽卡次数
end
if num == 1 then
UIManager.OpenPanel(UIName.PokemonSummonOneResultPanel, msg.drop.pokemon[1],id,1)
else
UIManager.OpenPanel(UIName.PokemonSummonTenResultPanel, msg.drop.pokemon,id,2)
end
--CheckRedPointStatus(RedPointType.QianKunBox)
end,freeTimesId,itemId,itemNum)
end
end
--商店
function PokemonSummonPanel:storeShow()
if not self.shopView then
self.shopView = SubUIManager.Open(SubUIConfig.ShopView, self.content.transform)
end
self.shopView:ShowShop(SHOP_TYPE.QIANKUNBOX_SHOP,orginLayer)
self.shopView:ShowShop(SHOP_TYPE.QIANKUNBOX_SHOP)
end
--时间
@ -202,8 +224,7 @@ function PokemonSummonPanel:timeCountDown()
if freeTime>0 then
self.oneHintTxt.text=string.format(Language[12400],freeTime)
else
local timeDown=CalculateSecondsNowTo_N_OClock(5)--领取按钮的倒计时
local timeDown = CalculateSecondsNowTo_N_OClock(5)--领取按钮的倒计时
self.oneHintTxt.text =string.format(Language[12412],TimeToHMS(timeDown))
--免费次数刷新倒计时
self.timer = Timer.New(function()
@ -247,13 +268,6 @@ function PokemonSummonPanel:TimeToDHMS(second)
end
end
function PokemonSummonPanel:refreshMagicNum()
local actData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.QianKunBox)
-- local d = ConfigManager.GetAllConfigsDataByKey(ConfigName.LotterySpecialConfig,"Type",singleRecruit.MergePool)
--self.leftUptips1.text = d[1].Count-math.floor(actData.value/1000)
-- self.oneHintTxt.text = tostring(d[2].Count-actData.value%1000)..Language[12264]
end
function PokemonSummonPanel:OnSortingOrderChange(_sortingOrder)
orginLayer = _sortingOrder
end

View File

@ -52,11 +52,14 @@ function this:OnShow(_parent,...)
var=PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.Ten
local d=RecruitManager.GetExpendData(RecruitType.Ten)
this.rootText.text = string.format(Language[12376],d[2])
elseif _args[1] == RecruitType.LingShowSingle then
var=PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.LingShowTen
this.rootText.text = string.format("确认花费%s妖晶进行1次灵兽召唤",_args[3])
elseif _args[1] == RecruitType.LingShowTen then
var = PlayerManager.uid.."GeneralPopup_RecruitConfirm"..RecruitType.LingShowTen
this.rootText.text = string.format("确认花费%s妖晶进行10次灵兽召唤",_args[3])
else
LogBlue("_args[1]:".._args[1])
local data = ConfigManager.GetConfigData(ConfigName.LotterySetting,_args[1])
LogBlue("data.PerCount:"..data.PerCount)
LogBlue("data.ActivityId:"..data.ActivityId)
local activityData
if data.LotteryType == 3 then
activityData = ConfigManager.GetConfigData(ConfigName.GlobalActivity,data.ActivityId)

View File

@ -25,15 +25,23 @@ function this.Initialize()
this.InitPreData()
end
--请求抽卡 1抽卡类型 2回调 3特权id
function this.RecruitRequest(recruitType, func, privilegeId)
local data=this.GetExpendData(recruitType)
local itemId,itemNum=data[1],data[2] --默认
function this.RecruitRequest(recruitType, func, privilegeId,_itemId,_itemNum)
local itemId = 0
local itemNum = 0
local freeTimesId = ConfigManager.GetConfigData(ConfigName.LotterySetting,RecruitType.LingShowSingle).FreeTimes
if privilegeId == freeTimesId then
itemId = _itemId
itemNum = _itemNum
else
local data=this.GetExpendData(recruitType)
itemId,itemNum=data[1],data[2] --默认
end
--Log("BagManager.GetItemCountById(itemId) ".. BagManager.GetItemCountById(itemId).." itemNum "..itemNum)
--Log(tostring(this.freeUseTimeList[privilegeId]))
if BagManager.GetItemCountById(itemId) >= itemNum or (this.freeUseTimeList[privilegeId] and this.freeUseTimeList[privilegeId] >= 1) or isFindFairyFree then
if BagManager.GetItemCountById(itemId) >= itemNum or (this.freeUseTimeList[privilegeId] and this.freeUseTimeList[privilegeId] >= 1) then
NetManager.RecruitRequest(recruitType, function(msg)
local data = ConfigManager.GetConfigData(ConfigName.LotterySetting,recruitType)
if (RecruitType.Single == recruitType or RecruitType.NormalSingle==recruitType or (data.LotteryType == 3 and data.PerCount == 1) or(data.LotteryType == 9 and data.PerCount == 1) ) then --若某抽卡类型有免费次数
if (RecruitType.Single == recruitType or RecruitType.NormalSingle==recruitType or (data.LotteryType == 3 and data.PerCount == 1) or(data.LotteryType == 9 and data.PerCount == 1) or RecruitType.LingShowSingle==recruitType ) then --若某抽卡类型有免费次数
if this.freeUseTimeList[privilegeId] and this.freeUseTimeList[privilegeId] >= 1 then
PrivilegeManager.RefreshPrivilegeUsedTimes(privilegeId, 1)
this.freeUseTimeList[privilegeId] = PrivilegeManager.GetPrivilegeRemainValue(privilegeId)

View File

@ -39,6 +39,7 @@ function SingleRecruitPanel:InitComponent()
self.againNum=Util.GetGameObject(self.againBtn,"Tip/Text"):GetComponent("Text")
self.dragView = SubUIManager.Open(SubUIConfig.DragView, self.gameObject.transform)
self.dragView.transform:SetSiblingIndex(1)
this.rolePanel = Util.GetGameObject(self.transform, "rolePanel")
this.UI_Effect_open = Util.GetGameObject(self.transform, "bg/UI_Effect_open") --开门特效
this.UI_Effect_appear = Util.GetGameObject(self.transform, "bg/UI_Effect_appear")