【周卡】

dev_chengFeng
ZhangBiao 2021-10-28 15:22:17 +08:00
parent 04fff0d79b
commit 695dd0459a
7 changed files with 3891 additions and 1 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: f210279015747384cb66b1ac7db6b706
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -497,4 +497,5 @@ SubUIConfig = {
[31] = {name = "RecruitPanelNew",assetName = "RecruitPanelNew",script = "Modules/Recruit/RecruitPanelNew"},--
[32] = {name = "ElementDrawCardPanelNew",assetName = "ElementDrawCardPanelNew",script = "Modules/Recruit/ElementDrawCardPanelNew"},--升星有礼
[33] = {name = "XunBaoMiZongPanel",assetName = "XunBaoMiZongPanel",script = "Modules/XunBaoMiZong/XunBaoMiZongPanel"},--寻宝迷踪
[34] = {name = "WeekCardPage",assetName = "WeekCardPage",script = "Modules/Operating/WeekCardPage"},
}

View File

@ -582,7 +582,7 @@ function this.DemonSlayerNewRedCheck()
end
end
end
return true
return false
end
return CommonActPageManager

View File

@ -170,4 +170,10 @@ function this.GetMonthCardIsOpen(type)
end
end
return false
end
--===============================新增周卡内容===================================
function this.WeekCardCheckRedPoint()
-- body
end

View File

@ -0,0 +1,184 @@
local WeekCardPage = {}
local cardData = {
[1] = { curState = 0 ,cardType = MONTH_CARD_TYPE.MONTHCARD},
[2] = { curState = 0 ,cardType = MONTH_CARD_TYPE.LUXURYMONTHCARD},
[3] = { curState = 0 ,cardType = MONTH_CARD_TYPE.GIFT}
}
local sortingOrder = 0
local addTimeNum = 30 * 24 * 60 * 60
local monthCardConFig = ConfigManager.GetConfig(ConfigName.MonthcardConfig)
function WeekCardPage:New(gameObject)
local b = {}
b.gameObject = gameObject
b.transform = gameObject.transform
setmetatable(b, { __index = WeekCardPage })
return b
end
local offSetX = {
[0] = Vector3.New(71.1,-7.34,0),
[1] = Vector3.New(188,-56,0),
[2] = Vector3.New(188,-56,0),
}
--初始化组件(用于子类重写)
function WeekCardPage:InitComponent()
self.spLoader = SpriteLoader.New()
self.grid = Util.GetGameObject(self.gameObject, "grid")
self.cardPres = {}
self.timerList = {}
for i= 1 ,self.grid.transform.childCount do
self.cardPres[i] = {}
self.cardPres[i].go = self.grid.transform:GetChild(i - 1).gameObject
self.cardPres[i].month = Util.GetGameObject(self.cardPres[i].go, "small")
self.cardPres[i].btnText = Util.GetGameObject(self.cardPres[i].month, "Text"):GetComponent("Text")
self.cardPres[i].monthRedPot = Util.GetGameObject(self.cardPres[i].month, "redPoint")
self.cardPres[i].progress = Util.GetGameObject(self.cardPres[i].go, "day/progress")
self.cardPres[i].time = Util.GetGameObject(self.cardPres[i].go, "day/time")
self.cardPres[i].day1 = Util.GetGameObject(self.cardPres[i].go, "day/Text1"):GetComponent("Text")
self.cardPres[i].day2 = Util.GetGameObject(self.cardPres[i].go, "day/Text2"):GetComponent("Text")
self.cardPres[i].icon = Util.GetGameObject(self.cardPres[i].go, "day/icon"):GetComponent("Image")
self.cardPres[i].dayRightUpText = Util.GetGameObject(self.cardPres[i].go, "Image/Text"):GetComponent("Text")
self.cardPres[i].dayRightUpIcon = Util.GetGameObject(self.cardPres[i].go, "Image/icon"):GetComponent("Image")
-- Util.GetGameObject(self.cardPres[i].go, "day/icon"):GetComponent("RectTransform").anchoredPosition = offSetX[GetCurLanguage()]
end
end
--绑定事件(用于子类重写)
function WeekCardPage:BindEvent()
for i = 1, #self.cardPres do
Util.AddOnceClick(self.cardPres[i].month,function()
if not cardData[i].curState then
JumpManager.GoJump(27001)
else
if self.curAllMonthCardData[cardData[i].cardType].state == 0 then
NetManager.MonthCardTakeDailyRequest(cardData[i].cardType, function(drop)
MonthCardManager.SetMonthCardGetStateData(cardData[i].cardType,1)
self.curAllMonthCardData = MonthCardManager.GetMonthCardData()
UIManager.OpenPanel(UIName.RewardItemPopup,drop,1,function()
self:SetCardShow(i)
end)
end)
end
end
end)
end
end
--添加事件监听(用于子类重写)
function WeekCardPage:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.BuySuccess)
end
--移除事件监听(用于子类重写)
function WeekCardPage:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.BuySuccess)
end
--界面打开时调用(用于子类重写)
function WeekCardPage:OnOpen(_activityConfig,_index,parent)
self.actConfig = _activityConfig
self.pageIndex = _index
self.parent = parent
end
function WeekCardPage:OnSortingOrderChange()
end
-- 打开,重新打开时回调
function WeekCardPage:OnShow(_sortingOrder)
self.gameObject:SetActive(true)
sortingOrder = _sortingOrder
MonthCardManager.RefreshMonthCardEnd()
self:RefreshStoneShow()
end
-- 妖晶数量显示
function WeekCardPage:RefreshStoneShow(index)
self.curAllMonthCardData = MonthCardManager.GetMonthCardData()
--月卡
for i = 1, #self.cardPres do
self:SetCardShow(i)
end
end
function WeekCardPage:SetCardShow(i)
cardData[i].curState = self.curAllMonthCardData[cardData[i].cardType] and self.curAllMonthCardData[cardData[i].cardType].endingTime ~= 0
self.cardPres[i].day1.text = Language[11377].. string.format(MoneyUtil.GetMoneyUnitName(),monthCardConFig[cardData[i].cardType].Price) ..Language[11378]--Language[11379]
self.cardPres[i].day2.text = Language[11380]..monthCardConFig[cardData[i].cardType].BaseReward[1][2] .."</color>"
self.cardPres[i].icon.sprite = self.spLoader:LoadSprite(GetResourcePath(ConfigManager.GetConfigData(ConfigName.ItemConfig,monthCardConFig[cardData[i].cardType].BaseReward[1][1]).ResourceID))
self.cardPres[i].progress:SetActive(not cardData[i].curState)
self.cardPres[i].progress:GetComponent("Text").text = "("..MonthCardManager.GetmonthSaveAmt(i).."/"..monthCardConFig[cardData[i].cardType].Price..")"
self.cardPres[i].dayRightUpText = monthCardConFig[cardData[i].cardType].ContiueDays * monthCardConFig[cardData[i].cardType].BaseReward[1][2]
self.cardPres[i].dayRightUpIcon = SetIcon(self.spLoader, monthCardConFig[cardData[i].cardType].BaseReward[1][1])
self.cardPres[i].monthRedPot:SetActive(MonthCardManager.RefreshMonthCardRedPoint(cardData[i].cardType))
self.cardPres[i].btnText = Language[11381]
if not cardData[i].curState then
self.cardPres[i].time:SetActive(false)
Util.SetGray(self.cardPres[i].month,false)
self.cardPres[i].month:GetComponent("Button").enabled = true
else
self.cardPres[i].time:SetActive(true)
local residueTimeNum = self.curAllMonthCardData[cardData[i].cardType].endingTime + addTimeNum - GetTimeStamp()
local dayNum = math.floor(residueTimeNum / (24 * 3600))
if dayNum > 0 then
self.cardPres[i].time:GetComponent("Text").text = Language[10480] .. dayNum ..Language[10017]
else
self:SetMonthCardTimes(residueTimeNum,self.cardPres[i].time,i)
end
if self.curAllMonthCardData[cardData[i].cardType].state == 0 then
Util.SetGray(self.cardPres[i].month,false)
self.cardPres[i].month:GetComponent("Button").enabled = true
Util.GetGameObject(self.cardPres[i].month, "Text"):GetComponent("Text").text = Language[11382]
elseif self.curAllMonthCardData[cardData[i].cardType].state == 1 then
Util.SetGray(self.cardPres[i].month,true)
self.cardPres[i].month:GetComponent("Button").enabled = false
Util.GetGameObject(self.cardPres[i].month, "Text"):GetComponent("Text").text = Language[10101]
end
end
-- 物品点击显示详情
Util.AddOnceClick(self.cardPres[i].icon.gameObject, function()
UIManager.OpenPanel(UIName.RewardItemSingleShowPopup, monthCardConFig[cardData[i].cardType].BaseReward[1][1],nil,true)
end)
end
function WeekCardPage:SetMonthCardTimes(timeNums,timeCom,index)
if self.timerList[index] then
self.timerList[index]:Stop()
self.timerList[index] = nil
end
timeCom:GetComponent("Text").text = Language[10023]..TimeStampToDateStr3(timeNums)
self.timerList[index] = Timer.New(function()
timeCom:GetComponent("Text").text = Language[10023]..TimeStampToDateStr3(timeNums)
if timeNums < 0 then
MonthCardManager.RefreshMonthCardEnd()
self.curAllMonthCardData = MonthCardManager.GetMonthCardData()
self:SetCardShow(index)
self.timerList[index]:Stop()
self.timerList[index] = nil
end
timeNums = timeNums - 1
end, 1, -1, true)
self.timerList[index]:Start()
end
--界面关闭时调用(用于子类重写)
function WeekCardPage:OnClose()
self.gameObject:SetActive(false)
end
--界面销毁时调用(用于子类重写)
function WeekCardPage:OnDestroy()
self.spLoader:Destroy()
self.cardPres = {}
for index = 1, #self.timerList do
if self.timerList[index] then
self.timerList[index]:Stop()
self.timerList[index] = nil
end
end
self.timerList = {}
end
return WeekCardPage

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 0200140f2b3941e46ab521d8ae33aec0
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant: