2022-09-23 15:24:10 +08:00
|
|
|
|
|
2022-11-03 10:57:45 +08:00
|
|
|
|
require("Base/BasePanel")
|
|
|
|
|
GMShuaChongTeQuan = Inherit(BasePanel)
|
|
|
|
|
-- local GMShuaChongTeQuan = {}
|
2022-09-23 15:24:10 +08:00
|
|
|
|
self=GMShuaChongTeQuan
|
|
|
|
|
local sortingOrder = 0
|
|
|
|
|
local TabBox = require("Modules/Common/TabBox")
|
2023-06-07 16:36:08 +08:00
|
|
|
|
local _TabData={
|
|
|
|
|
--[1] = { default = "r_hero_xuanze_002", select = "r_hero_xuanze_001", name = "刷充GM",img = "gm_shuachong_scGM_01_zh",id=2201,scale=0,all=0 },
|
2023-11-09 16:00:42 +08:00
|
|
|
|
[1] = { default = "UI_hz_gonghui_31", select = "UI_hz_gonghui_31", name = "超级特权" ,img = "gm_shuachong_cjGM_01_zh",id=2202,scale=6,all=128},
|
|
|
|
|
[2] = { default = "UI_hz_gonghui_32", select = "UI_hz_gonghui_32", name = "神级特权" ,img = "gm_shuachong_sjGM_01_zh",id=2203,scale=5,all=400 },
|
|
|
|
|
[3] = { default = "UI_hz_gonghui_33", select = "UI_hz_gonghui_33", name = "无上特权",img = "gm_shuachong_wsGM_01_zh",id=2204,scale=2,all=3500 },
|
2022-09-23 15:24:10 +08:00
|
|
|
|
}
|
|
|
|
|
|
2022-11-03 10:57:45 +08:00
|
|
|
|
-- function GMShuaChongTeQuan:New(gameObject)
|
|
|
|
|
-- local b = {}
|
|
|
|
|
-- b.gameObject = gameObject
|
|
|
|
|
-- b.transform = gameObject.transform
|
|
|
|
|
-- setmetatable(b, { __index = GMShuaChongTeQuan })
|
|
|
|
|
-- return b
|
|
|
|
|
-- end
|
2022-09-23 15:24:10 +08:00
|
|
|
|
local TabAdapter=nil
|
|
|
|
|
local SwitchView=nil
|
|
|
|
|
local infoList={}
|
|
|
|
|
local rewardList={}
|
|
|
|
|
local dayList={}
|
2022-12-30 15:08:22 +08:00
|
|
|
|
local redList={}
|
2022-09-23 15:24:10 +08:00
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function GMShuaChongTeQuan:InitComponent()
|
|
|
|
|
self.spLoader = SpriteLoader.New()
|
2022-11-03 10:57:45 +08:00
|
|
|
|
self.btnBack = Util.GetGameObject(self.transform, "backBtn")
|
2022-09-23 15:24:10 +08:00
|
|
|
|
self.grid = Util.GetGameObject(self.gameObject, "grid")
|
|
|
|
|
self.titleImg=Util.GetGameObject(self.gameObject, "bg1/shenzuntequanName"):GetComponent("Image")
|
|
|
|
|
self.btn_buy=Util.GetGameObject(self.gameObject, "bg1/bg2/btn_buy")
|
2022-11-03 15:46:21 +08:00
|
|
|
|
self.hintTxt=Util.GetGameObject(self.gameObject, "bg1/bg2/hintTxt"):GetComponent("Text")
|
2022-11-23 15:34:41 +08:00
|
|
|
|
self.hintTxt3=Util.GetGameObject(self.gameObject, "bg1/bg2/btn_buy/hint2Txt")
|
2022-09-23 15:24:10 +08:00
|
|
|
|
self.tabBox = Util.GetGameObject(self.gameObject, "TabBox")
|
|
|
|
|
self.infoGrid=Util.GetGameObject(self.gameObject, "bg1/bg2/info/tequan")
|
|
|
|
|
self.infoPre=Util.GetGameObject(self.gameObject, "bg1/bg2/tequanText")
|
|
|
|
|
self.rewardGrid=Util.GetGameObject(self.gameObject, "bg1/bg2/Reward")
|
|
|
|
|
self.dayGrid=Util.GetGameObject(self.gameObject, "bg1/bg2/dayReward")
|
2022-12-01 17:04:21 +08:00
|
|
|
|
self.Scrollbar=Util.GetGameObject(self.gameObject, "bg1/bg2/Scrollbar"):GetComponent("Scrollbar")
|
2022-09-23 15:24:10 +08:00
|
|
|
|
self.payTxt=Util.GetGameObject(self.gameObject, "bg1/bg2/btn_buy/Text"):GetComponent("Text")
|
2022-11-23 15:34:41 +08:00
|
|
|
|
self.scaleImg=Util.GetGameObject(self.gameObject, "bg1/bg2/btn_buy/Image")
|
2022-11-04 15:40:41 +08:00
|
|
|
|
self.hint2Txt=Util.GetGameObject(self.gameObject, "bg1/bg2/Rewardbg/Text"):GetComponent("Text")
|
2022-11-23 15:34:41 +08:00
|
|
|
|
self.scaleTxt=Util.GetGameObject(self.gameObject, "bg1/bg2/btn_buy/scaleTxt"):GetComponent("Text")
|
2022-11-04 15:40:41 +08:00
|
|
|
|
self.oldPriceTxt=Util.GetGameObject(self.gameObject, "bg1/bg2/btn_buy/old_buy"):GetComponent("Text")
|
2023-11-09 16:00:42 +08:00
|
|
|
|
self.titleTxt=Util.GetGameObject(self.gameObject, "bg1/Image (1)/Text"):GetComponent("Text")
|
2022-09-23 15:24:10 +08:00
|
|
|
|
local rootHight = self.infoGrid.transform.rect.height
|
|
|
|
|
local width = self.infoGrid.transform.rect.width
|
2022-12-01 17:04:21 +08:00
|
|
|
|
self.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.infoGrid.transform,self.infoPre, self.Scrollbar, Vector2.New(width, rootHight), 1, 1, Vector2.New(0,0))
|
2022-09-23 15:24:10 +08:00
|
|
|
|
self.ScrollView.moveTween.MomentumAmount = 1
|
|
|
|
|
self.ScrollView.moveTween.Strength = 2
|
|
|
|
|
self.ScrollView.elastic = false
|
|
|
|
|
TabAdapter=function(tab, index, status)
|
|
|
|
|
local tabLab = Util.GetGameObject(tab, "Text")
|
|
|
|
|
Util.GetGameObject(tab,"Image"):GetComponent("Image").sprite = self.spLoader:LoadSprite(_TabData[index][status])
|
|
|
|
|
tabLab:GetComponent("Text").text = _TabData[index].name
|
2023-11-09 16:00:42 +08:00
|
|
|
|
Util.GetGameObject(tab,"select"):SetActive(status=="select")
|
2022-12-30 15:08:22 +08:00
|
|
|
|
local red=Util.GetGameObject(tab,"Redpot")
|
|
|
|
|
red:SetActive(ActivityGiftManager.GetActivityInfo(ActivityTypeDef.shuaChongTeQuan,_TabData[index].id).state==1)
|
|
|
|
|
redList[_TabData[index].id]=red
|
2022-09-23 15:24:10 +08:00
|
|
|
|
end
|
|
|
|
|
--切换视图
|
|
|
|
|
SwitchView=function(_index)
|
|
|
|
|
self.titleImg.sprite=self.spLoader:LoadSprite(_TabData[_index].img)
|
|
|
|
|
local activityId=_TabData[_index].id
|
|
|
|
|
local recharge=ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig,activityId)
|
|
|
|
|
local len= #recharge.OpenPrivilege
|
2023-08-29 17:58:24 +08:00
|
|
|
|
local lv=_index --recharge.BTVIPlevel[1][2]
|
2022-09-23 15:24:10 +08:00
|
|
|
|
local len=#recharge.OpenPrivilege
|
|
|
|
|
local mission=ActivityGiftManager.GetActivityInfo(ActivityTypeDef.shuaChongTeQuan,activityId)
|
|
|
|
|
local state=mission.state
|
2023-11-09 16:00:42 +08:00
|
|
|
|
self.titleTxt.text=_TabData[_index].name
|
2023-08-29 17:58:24 +08:00
|
|
|
|
|
2022-09-23 15:24:10 +08:00
|
|
|
|
if state==0 then
|
|
|
|
|
self.payTxt.text=recharge.Price.."元"
|
2022-11-04 15:40:41 +08:00
|
|
|
|
self.hint2Txt.gameObject:SetActive(true)
|
2022-11-23 15:34:41 +08:00
|
|
|
|
self.hintTxt3:SetActive(true)
|
|
|
|
|
self.scaleTxt.gameObject:SetActive(true)
|
|
|
|
|
self.oldPriceTxt.gameObject:SetActive(true)
|
|
|
|
|
self.scaleImg:SetActive(true)
|
2022-11-04 15:40:41 +08:00
|
|
|
|
self.hint2Txt.text="已累计"..mission.progress.."天奖励,奖励最多累计30天"
|
2022-09-23 15:24:10 +08:00
|
|
|
|
elseif state==1 then
|
|
|
|
|
self.payTxt.text="领取"
|
2022-11-23 15:34:41 +08:00
|
|
|
|
self.hintTxt3:SetActive(false)
|
2022-11-04 15:40:41 +08:00
|
|
|
|
self.hint2Txt.gameObject:SetActive(false)
|
2022-11-23 15:34:41 +08:00
|
|
|
|
self.scaleTxt.gameObject:SetActive(false)
|
|
|
|
|
self.scaleImg:SetActive(false)
|
|
|
|
|
self.oldPriceTxt.gameObject:SetActive(false)
|
2022-09-23 15:24:10 +08:00
|
|
|
|
elseif state==2 then
|
|
|
|
|
self.payTxt.text="已领取"
|
2022-11-04 15:40:41 +08:00
|
|
|
|
self.hint2Txt.gameObject:SetActive(false)
|
2022-11-23 15:34:41 +08:00
|
|
|
|
self.scaleTxt.gameObject:SetActive(false)
|
|
|
|
|
self.scaleImg:SetActive(false)
|
|
|
|
|
self.hintTxt3:SetActive(false)
|
|
|
|
|
self.oldPriceTxt.gameObject:SetActive(false)
|
2022-09-23 15:24:10 +08:00
|
|
|
|
end
|
2022-11-23 15:34:41 +08:00
|
|
|
|
self.oldPriceTxt.text=_TabData[_index].all .."元"
|
|
|
|
|
self.scaleTxt.text=_TabData[_index].scale.."折"
|
2022-11-03 15:46:21 +08:00
|
|
|
|
if _index>1 then
|
|
|
|
|
local lastId=_TabData[_index-1].id
|
|
|
|
|
local lastmiss=ActivityGiftManager.GetActivityInfo(ActivityTypeDef.shuaChongTeQuan,lastId)
|
|
|
|
|
local lastState=lastmiss.state
|
|
|
|
|
if lastState==0 then
|
|
|
|
|
self.btn_buy:SetActive(false)
|
|
|
|
|
self.hintTxt.gameObject:SetActive(true)
|
|
|
|
|
self.hintTxt.text="开通".._TabData[_index-1].name.."解锁购买"
|
|
|
|
|
else
|
|
|
|
|
self.btn_buy:SetActive(true)
|
|
|
|
|
self.hintTxt.gameObject:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
self.hintTxt.gameObject:SetActive(false)
|
2022-11-03 16:29:37 +08:00
|
|
|
|
self.btn_buy:SetActive(true)
|
2022-11-03 15:46:21 +08:00
|
|
|
|
end
|
2022-09-23 15:24:10 +08:00
|
|
|
|
Util.AddOnceClick(self.btn_buy,function()
|
|
|
|
|
if state==0 then
|
|
|
|
|
PayManager.Pay(recharge.Id, function()
|
|
|
|
|
-- self.curAllMonthCardData = MonthCardManager.GetMonthCardData()
|
|
|
|
|
self.payTxt.text="领取"
|
2022-11-23 15:34:41 +08:00
|
|
|
|
self.hintTxt3:SetActive(false)
|
|
|
|
|
self.hint2Txt.gameObject:SetActive(false)
|
|
|
|
|
self.scaleTxt.gameObject:SetActive(false)
|
|
|
|
|
self.scaleImg:SetActive(false)
|
|
|
|
|
self.oldPriceTxt.gameObject:SetActive(false)
|
2022-12-30 15:08:22 +08:00
|
|
|
|
redList[activityId]:SetActive(true)
|
2022-09-23 15:24:10 +08:00
|
|
|
|
state=1
|
|
|
|
|
end)
|
|
|
|
|
elseif state==1 then
|
|
|
|
|
NetManager.GetActivityRewardRequest(activityId,ActivityTypeDef.shuaChongTeQuan, function(_drop)
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup, _drop, 1)
|
|
|
|
|
self.payTxt.text="已领取"
|
2022-12-30 15:08:22 +08:00
|
|
|
|
redList[activityId]:SetActive(false)
|
2022-09-23 15:24:10 +08:00
|
|
|
|
state=2
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
end)
|
2022-11-03 13:44:15 +08:00
|
|
|
|
local list=recharge.PrivilegeInfor
|
2022-10-28 15:45:53 +08:00
|
|
|
|
local newList={}
|
|
|
|
|
for i = 1, #list do
|
|
|
|
|
local config=ConfigManager.GetConfigData(ConfigName.PrivilegeTypeConfig,list[i])
|
|
|
|
|
if config.isShowName==1 then
|
|
|
|
|
table.insert(newList,list[i])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
self.ScrollView:SetData(newList, function (index, go)
|
|
|
|
|
self:SingleDataShow(go,newList[index],lv)
|
2022-09-23 15:24:10 +08:00
|
|
|
|
end,false)
|
|
|
|
|
for i = 1, #rewardList do
|
|
|
|
|
rewardList[i].gameObject:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
if recharge.BaseReward then
|
|
|
|
|
for j = 1, #recharge.BaseReward do
|
|
|
|
|
if rewardList and rewardList[j] then
|
|
|
|
|
rewardList[j]:OnOpen(false, recharge.BaseReward[j], 0.8)
|
|
|
|
|
rewardList[j].gameObject:SetActive(true)
|
|
|
|
|
else
|
|
|
|
|
local itemInfo = SubUIManager.Open(SubUIConfig.ItemView,self.rewardGrid.transform)
|
|
|
|
|
itemInfo:OnOpen(false, recharge.BaseReward[j],0.8)
|
|
|
|
|
table.insert(rewardList,itemInfo)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #dayList do
|
|
|
|
|
dayList[i].gameObject:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
for j = 1, #recharge.ExtraReward do
|
|
|
|
|
if dayList and dayList[j] then
|
|
|
|
|
dayList[j]:OnOpen(false, recharge.ExtraReward[j],0.8)
|
|
|
|
|
dayList[j].gameObject:SetActive(true)
|
|
|
|
|
else
|
|
|
|
|
local itemInfo = SubUIManager.Open(SubUIConfig.ItemView, self.dayGrid.transform)
|
|
|
|
|
itemInfo:OnOpen(false, recharge.ExtraReward[j], 0.8)
|
|
|
|
|
table.insert(dayList,itemInfo)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
self.TabCtrl = TabBox.New()
|
|
|
|
|
self.TabCtrl:SetTabAdapter(TabAdapter)
|
|
|
|
|
self.TabCtrl:SetChangeTabCallBack(SwitchView)
|
|
|
|
|
self.TabCtrl:Init(self.tabBox, _TabData, 1)
|
2023-12-04 19:01:38 +08:00
|
|
|
|
self.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform)
|
2022-09-23 15:24:10 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function GMShuaChongTeQuan:SingleDataShow(item,data,lv)
|
|
|
|
|
local privilege=ConfigManager.GetConfigData(ConfigName.PrivilegeTypeConfig,data)
|
|
|
|
|
local num=""
|
2023-08-29 17:58:24 +08:00
|
|
|
|
local num2=0
|
2022-09-23 15:24:10 +08:00
|
|
|
|
if privilege.Condition[lv+1] then
|
|
|
|
|
num=privilege.Condition[lv+1][2]
|
|
|
|
|
if num==-1 then
|
|
|
|
|
num="无限"
|
|
|
|
|
end
|
2023-08-29 17:58:24 +08:00
|
|
|
|
if privilege.Condition[lv+1][3] then
|
|
|
|
|
num2=privilege.Condition[lv+1][3]
|
|
|
|
|
end
|
2022-09-23 15:24:10 +08:00
|
|
|
|
end
|
|
|
|
|
if privilege.IfFloat==2 then
|
2022-11-03 16:29:37 +08:00
|
|
|
|
num=num/100 .."%"
|
2022-09-23 15:24:10 +08:00
|
|
|
|
end
|
2022-11-03 16:29:37 +08:00
|
|
|
|
|
2022-09-23 15:24:10 +08:00
|
|
|
|
if privilege.Type==1 then
|
2023-08-29 17:58:24 +08:00
|
|
|
|
item:GetComponent("Text").text =string.format(privilege.Name,num,num2)
|
2022-09-23 15:24:10 +08:00
|
|
|
|
else
|
|
|
|
|
item:GetComponent("Text").text =privilege.Name
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function GMShuaChongTeQuan:BindEvent()
|
2022-11-03 10:57:45 +08:00
|
|
|
|
Util.AddClick(self.btnBack, function()
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
2022-09-23 15:24:10 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function GMShuaChongTeQuan:AddListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function GMShuaChongTeQuan:RemoveListener()
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function GMShuaChongTeQuan:OnOpen(_activityConfig,_index,parent)
|
2023-12-04 19:01:38 +08:00
|
|
|
|
self.UpView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main })
|
2022-09-23 15:24:10 +08:00
|
|
|
|
self.actConfig = _activityConfig
|
|
|
|
|
self.pageIndex = _index
|
|
|
|
|
self.parent = parent
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function GMShuaChongTeQuan:OnSortingOrderChange()
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
-- 打开,重新打开时回调
|
|
|
|
|
function GMShuaChongTeQuan:OnShow(_sortingOrder)
|
2022-11-03 10:57:45 +08:00
|
|
|
|
-- self.gameObject:SetActive(true)
|
2022-09-23 15:24:10 +08:00
|
|
|
|
sortingOrder = _sortingOrder
|
|
|
|
|
|
|
|
|
|
end
|
|
|
|
|
local gifts={}
|
|
|
|
|
local activityData={}
|
|
|
|
|
-- 妖晶数量显示
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function GMShuaChongTeQuan:OnClose()
|
2022-11-03 10:57:45 +08:00
|
|
|
|
-- self.gameObject:SetActive(false)
|
2022-12-30 15:08:22 +08:00
|
|
|
|
CheckRedPointStatus(RedPointType.ImGM)
|
2022-09-23 15:24:10 +08:00
|
|
|
|
end
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function GMShuaChongTeQuan:OnDestroy()
|
|
|
|
|
self.spLoader:Destroy()
|
|
|
|
|
SubUIManager.Close(self.ScrollView)
|
2023-12-04 19:01:38 +08:00
|
|
|
|
SubUIManager.Close(self.UpView)
|
|
|
|
|
self.UpView = nil
|
2022-09-23 15:24:10 +08:00
|
|
|
|
rewardList={}
|
|
|
|
|
dayList={}
|
|
|
|
|
end
|
|
|
|
|
return GMShuaChongTeQuan
|
|
|
|
|
|