parent
cd30e96c7d
commit
ec7e8a6a17
|
@ -3,83 +3,87 @@ local this = {}
|
||||||
--传入父脚本模块
|
--传入父脚本模块
|
||||||
local parent
|
local parent
|
||||||
--传入特效层级
|
--传入特效层级
|
||||||
local sortingOrder=0
|
local sortingOrder = 0
|
||||||
|
|
||||||
local curScore = 0--当前分数
|
local curScore = 0 --当前分数
|
||||||
local treasureState = 0
|
local treasureState = 0
|
||||||
local itemsList={}
|
local itemsList = {}
|
||||||
local maskList={}
|
local maskList = {}
|
||||||
local isPlayAnim = true
|
local isPlayAnim = true
|
||||||
local curId=0
|
local curId = 0
|
||||||
function this:InitComponent(gameObject)
|
function this:InitComponent(gameObject)
|
||||||
this.spLoader = SpriteLoader.New()
|
this.spLoader = SpriteLoader.New()
|
||||||
--topBar/btnBack
|
--topBar/btnBack
|
||||||
this.gameObject = gameObject
|
this.gameObject = gameObject
|
||||||
this.quesBtn = Util.GetGameObject(this.gameObject, "bg/quesBtn")
|
this.quesBtn = Util.GetGameObject(this.gameObject, "bg/quesBtn")
|
||||||
this.helpPosition= this.quesBtn:GetComponent("RectTransform").localPosition
|
this.helpPosition = this.quesBtn:GetComponent("RectTransform").localPosition
|
||||||
this.time = Util.GetGameObject(this.gameObject, "bg/topBar/time"):GetComponent("Text")
|
this.time = Util.GetGameObject(this.gameObject, "bg/topBar/time"):GetComponent("Text")
|
||||||
|
|
||||||
this.buyBtn = Util.GetGameObject(this.gameObject, "bg/topBar/button/buyBtn")
|
this.buyBtn = Util.GetGameObject(this.gameObject, "bg/topBar/button/buyBtn")
|
||||||
this.buyBtnText = Util.GetGameObject(this.buyBtn, "Text"):GetComponent("Text")
|
this.buyBtnText = Util.GetGameObject(this.buyBtn, "Text"):GetComponent("Text")
|
||||||
this.jiesuoBtn = Util.GetGameObject(this.gameObject, "bg/topBar/button/jiesuoBtn")
|
this.jiesuoBtn = Util.GetGameObject(this.gameObject, "bg/topBar/button/jiesuoBtn")
|
||||||
this.jiesuoBtnText = Util.GetGameObject(this.jiesuoBtn, "Text"):GetComponent("Text")
|
this.jiesuoBtnText = Util.GetGameObject(this.jiesuoBtn, "Text"):GetComponent("Text")
|
||||||
|
|
||||||
this.lv = Util.GetGameObject(this.gameObject, "bg/topBar/Image/lv"):GetComponent("Text")
|
this.lv = Util.GetGameObject(this.gameObject, "bg/topBar/Image/lv"):GetComponent("Text")
|
||||||
|
|
||||||
--Content
|
--Content
|
||||||
this.progress = Util.GetGameObject(this.gameObject, "bg/topBar/progress/Image"):GetComponent("Image")
|
this.progress = Util.GetGameObject(this.gameObject, "bg/topBar/progress/Image"):GetComponent("Image")
|
||||||
this.scoreText = Util.GetGameObject(this.gameObject, "bg/topBar/progress/Text"):GetComponent("Text")
|
this.scoreText = Util.GetGameObject(this.gameObject, "bg/topBar/progress/Text"):GetComponent("Text")
|
||||||
this.remainTimeObj = Util.GetGameObject(this.gameObject, "bg/topBar/remainTime")
|
this.remainTimeObj = Util.GetGameObject(this.gameObject, "bg/topBar/remainTime")
|
||||||
--屏蔽青龍密保時間顯示
|
--屏蔽青龍密保時間顯示
|
||||||
this.remainTimeObj:SetActive(false)
|
this.remainTimeObj:SetActive(false)
|
||||||
this.remainTime = Util.GetGameObject(this.gameObject, "bg/topBar/remainTime/Text"):GetComponent("Text")
|
this.remainTime = Util.GetGameObject(this.gameObject, "bg/topBar/remainTime/Text"):GetComponent("Text")
|
||||||
this.box = Util.GetGameObject(this.gameObject, "topBar/box")
|
this.box = Util.GetGameObject(this.gameObject, "topBar/box")
|
||||||
this.extra = Util.GetGameObject(this.gameObject, "topBar/extraBox")
|
this.box.gameObject:SetActive(false)
|
||||||
this.canOpenExtra = Util.GetGameObject(this.gameObject, "topBar/UI_Effect_BaoXiang_KeKaiQi")
|
this.extra = Util.GetGameObject(this.gameObject, "topBar/extraBox")
|
||||||
this.canOpenExtra.gameObject:SetActive(false)
|
this.canOpenExtra = Util.GetGameObject(this.gameObject, "topBar/UI_Effect_BaoXiang_KeKaiQi")
|
||||||
this.openExtra = Util.GetGameObject(this.gameObject, "topBar/UI_Effect_BaoXiang_KaiQi")
|
this.canOpenExtra.gameObject:SetActive(false)
|
||||||
this.openExtra.gameObject:SetActive(false)
|
this.openExtra = Util.GetGameObject(this.gameObject, "topBar/UI_Effect_BaoXiang_KaiQi")
|
||||||
this.btn_qmfl=Util.GetGameObject(this.gameObject, "topBar/btn_qmfl")
|
this.openExtra.gameObject:SetActive(false)
|
||||||
this.btn_qmfl:GetComponent("Image").sprite=this.spLoader:LoadSprite("GM_qmfl_botton_zh")
|
this.extra.gameObject:SetActive(false)
|
||||||
this.treasureList = Util.GetGameObject(this.gameObject, "bg/pageContent/treasureList")
|
this.btn_qmfl = Util.GetGameObject(this.gameObject, "topBar/btn_qmfl")
|
||||||
local v2 = this.treasureList:GetComponent("RectTransform").sizeDelta
|
this.btn_qmfl:GetComponent("Image").sprite = this.spLoader:LoadSprite("GM_qmfl_botton_zh")
|
||||||
this.itemPre = Util.GetGameObject(this.treasureList, "itemPro")
|
this.treasureList = Util.GetGameObject(this.gameObject, "bg/pageContent/treasureList")
|
||||||
|
local v2 = this.treasureList:GetComponent("RectTransform").sizeDelta
|
||||||
|
this.itemPre = Util.GetGameObject(this.treasureList, "itemPro")
|
||||||
|
|
||||||
--设置滚动条
|
--设置滚动条
|
||||||
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView,this.treasureList.transform,
|
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.treasureList.transform,
|
||||||
this.itemPre,nil,Vector2.New(v2.x, v2.y),1,1,Vector2.New(100,3.5))
|
this.itemPre, nil, Vector2.New(v2.x, v2.y), 1, 1, Vector2.New(100, 3.5))
|
||||||
this.ScrollView.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, 0)
|
this.ScrollView.gameObject:GetComponent("RectTransform").anchoredPosition = Vector2.New(0, 0)
|
||||||
this.ScrollView.gameObject:GetComponent("RectTransform").anchorMin = Vector2.New(0.5, 0.5)
|
this.ScrollView.gameObject:GetComponent("RectTransform").anchorMin = Vector2.New(0.5, 0.5)
|
||||||
this.ScrollView.gameObject:GetComponent("RectTransform").anchorMax = Vector2.New(0.5, 0.5)
|
this.ScrollView.gameObject:GetComponent("RectTransform").anchorMax = Vector2.New(0.5, 0.5)
|
||||||
this.ScrollView.gameObject:GetComponent("RectTransform").pivot = Vector2.New(0.5, 0.5)
|
this.ScrollView.gameObject:GetComponent("RectTransform").pivot = Vector2.New(0.5, 0.5)
|
||||||
this.ScrollView.moveTween.MomentumAmount = 1
|
this.ScrollView.moveTween.MomentumAmount = 1
|
||||||
this.ScrollView.moveTween.Strength = 2
|
this.ScrollView.moveTween.Strength = 2
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:BindEvent()
|
function this:BindEvent()
|
||||||
Util.AddClick(this.quesBtn,function()
|
Util.AddClick(this.quesBtn, function()
|
||||||
--LogGreen(this.helpPosition.x.."+"..this.helpPosition.y)
|
--LogGreen(this.helpPosition.x.."+"..this.helpPosition.y)
|
||||||
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.QingLongSerectTreasure,this.helpPosition.x,this.helpPosition.y)
|
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.QingLongSerectTreasure, this.helpPosition.x, this.helpPosition.y)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
Util.AddClick(this.btn_qmfl,function()
|
Util.AddClick(this.btn_qmfl, function()
|
||||||
--LogGreen(this.helpPosition.x.."+"..this.helpPosition.y)
|
--LogGreen(this.helpPosition.x.."+"..this.helpPosition.y)
|
||||||
UIManager.OpenPanel(UIName.QuanMinFLPanel,curId)
|
UIManager.OpenPanel(UIName.QuanMinFLPanel, curId)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:AddListener()
|
function this:AddListener()
|
||||||
Game.GlobalEvent:AddEvent(GameEvent.TreasureOfHeaven.BuyQinglongSerectLevelSuccess, this.refresh)
|
Game.GlobalEvent:AddEvent(GameEvent.TreasureOfHeaven.BuyQinglongSerectLevelSuccess, this.refresh)
|
||||||
Game.GlobalEvent:AddEvent(GameEvent.TreasureOfHeaven.RechargeQinglongSerectSuccess, this.refresh)
|
Game.GlobalEvent:AddEvent(GameEvent.TreasureOfHeaven.RechargeQinglongSerectSuccess, this.refresh)
|
||||||
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityOpenOrClose,this.Closefunction)
|
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityOpenOrClose, this.Closefunction)
|
||||||
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.refresh)
|
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.refresh)
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:RemoveListener()
|
function this:RemoveListener()
|
||||||
Game.GlobalEvent:RemoveEvent(GameEvent.TreasureOfHeaven.BuyQinglongSerectLevelSuccess, this.refresh)
|
Game.GlobalEvent:RemoveEvent(GameEvent.TreasureOfHeaven.BuyQinglongSerectLevelSuccess, this.refresh)
|
||||||
Game.GlobalEvent:RemoveEvent(GameEvent.TreasureOfHeaven.RechargeQinglongSerectSuccess, this.refresh)
|
Game.GlobalEvent:RemoveEvent(GameEvent.TreasureOfHeaven.RechargeQinglongSerectSuccess, this.refresh)
|
||||||
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityOpenOrClose,this.Closefunction)
|
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityOpenOrClose, this.Closefunction)
|
||||||
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.refresh)
|
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.refresh)
|
||||||
end
|
end
|
||||||
|
|
||||||
this.Closefunction = function()
|
this.Closefunction = function()
|
||||||
isPlayAnim = true
|
isPlayAnim = true
|
||||||
Timer.New(function()
|
Timer.New(function()
|
||||||
|
@ -90,31 +94,32 @@ this.Closefunction = function()
|
||||||
end
|
end
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
this.refresh(false,false)
|
this.refresh(false, false)
|
||||||
end
|
end
|
||||||
end,1):Start()
|
end, 1):Start()
|
||||||
end
|
end
|
||||||
function this:OnShow(_parent,...)
|
function this:OnShow(_parent, ...)
|
||||||
isPlayAnim = true
|
isPlayAnim = true
|
||||||
parent=_parent
|
parent = _parent
|
||||||
sortingOrder = _parent.sortingOrder
|
sortingOrder = _parent.sortingOrder
|
||||||
if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureOfSomeBody) then
|
if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureOfSomeBody) then
|
||||||
parent:ClosePanel()
|
parent:ClosePanel()
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
curId=ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.TreasureOfSomeBody)
|
curId = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.TreasureOfSomeBody)
|
||||||
this.btn_qmfl:SetActive(ActivityGiftManager.GetActivityInfoByType(10502)~=nil and ActivityGiftManager.CheckIsHaveHaveQMFL(ActivityTypeDef.TreasureOfSomeBody,curId))
|
this.btn_qmfl:SetActive(ActivityGiftManager.GetActivityInfoByType(10502) ~= nil and
|
||||||
local startTime,endTime,endTimeScale = QinglongSerectTreasureManager.GetTimeStartToEnd()
|
ActivityGiftManager.CheckIsHaveHaveQMFL(ActivityTypeDef.TreasureOfSomeBody, curId))
|
||||||
|
local startTime, endTime, endTimeScale = QinglongSerectTreasureManager.GetTimeStartToEnd()
|
||||||
-- this.timeTxt.text = "活动时间:"
|
-- this.timeTxt.text = "活动时间:"
|
||||||
-- this.time.text = startTime.."-"..endTime
|
-- this.time.text = startTime.."-"..endTime
|
||||||
this.time.text = string.format(Language[10022].." %s-%s",startTime,endTime)
|
this.time.text = string.format(Language[10022] .. " %s-%s", startTime, endTime)
|
||||||
--屏蔽青龙密保活动时间倒计时显示
|
--屏蔽青龙密保活动时间倒计时显示
|
||||||
this.time.gameObject:SetActive(false)
|
this.time.gameObject:SetActive(false)
|
||||||
--this.remainTime.text = "剩余时间:"..TimeToDHMS(tonumber(endTimeScale) - GetTimeStamp())
|
--this.remainTime.text = "剩余时间:"..TimeToDHMS(tonumber(endTimeScale) - GetTimeStamp())
|
||||||
--this:ShowTime(endTimeScale)
|
--this:ShowTime(endTimeScale)
|
||||||
this.refresh(true,true)
|
this.refresh(true, true)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:OnSortingOrderChange(sortingOrder)
|
function this:OnSortingOrderChange(sortingOrder)
|
||||||
for i, v in pairs(itemsList) do
|
for i, v in pairs(itemsList) do
|
||||||
for j = 1, #itemsList[i] do
|
for j = 1, #itemsList[i] do
|
||||||
|
@ -128,29 +133,30 @@ function this:OnSortingOrderChange(sortingOrder)
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:OnClose()
|
function this:OnClose()
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:OnDestroy()
|
function this:OnDestroy()
|
||||||
this.spLoader:Destroy()
|
this.spLoader:Destroy()
|
||||||
itemsList={}
|
itemsList = {}
|
||||||
maskList={}
|
maskList = {}
|
||||||
if self.timer then
|
if self.timer then
|
||||||
self.timer :Stop()
|
self.timer:Stop()
|
||||||
self.timer = nil
|
self.timer = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
this.refresh = function(isTop,isAni)
|
this.refresh = function(isTop, isAni)
|
||||||
QinglongSerectTreasureManager.UpdateTreasureState2()
|
QinglongSerectTreasureManager.UpdateTreasureState2()
|
||||||
this:topBar()
|
this:topBar()
|
||||||
this:showTaskList(isTop,isAni)
|
this:showTaskList(isTop, isAni)
|
||||||
CheckRedPointStatus(RedPointType.QinglongSerectTreasure)
|
CheckRedPointStatus(RedPointType.QinglongSerectTreasure)
|
||||||
end
|
end
|
||||||
|
|
||||||
--topBar按钮状态
|
--topBar按钮状态
|
||||||
function this:topBar()
|
function this:topBar()
|
||||||
--设置礼包购买按钮状态
|
--设置礼包购买按钮状态
|
||||||
treasureState = QinglongSerectTreasureManager.GetTreasureState()--秘宝礼包状态 false:可购买 true:已购买
|
treasureState = QinglongSerectTreasureManager.GetTreasureState() --秘宝礼包状态 false:可购买 true:已购买
|
||||||
curScore = QinglongSerectTreasureManager.GetScore()
|
curScore = QinglongSerectTreasureManager.GetScore()
|
||||||
local lv = QinglongSerectTreasureManager.GetLevel()
|
local lv = QinglongSerectTreasureManager.GetLevel()
|
||||||
this.lv.text = lv
|
this.lv.text = lv
|
||||||
|
@ -167,12 +173,12 @@ function this:topBar()
|
||||||
needScore = 0
|
needScore = 0
|
||||||
end
|
end
|
||||||
if rewardData.needScore and rewardData.needScore ~= 0 then
|
if rewardData.needScore and rewardData.needScore ~= 0 then
|
||||||
this.scoreText.text = curScore .."/"..rewardData.needScore - needScore
|
this.scoreText.text = curScore .. "/" .. rewardData.needScore - needScore
|
||||||
this.progress.fillAmount = curScore/(rewardData.needScore - needScore)
|
this.progress.fillAmount = curScore / (rewardData.needScore - needScore)
|
||||||
this.buyBtn:GetComponent("Button").enabled = true
|
this.buyBtn:GetComponent("Button").enabled = true
|
||||||
this.buyBtnText.text = Language[11867]
|
this.buyBtnText.text = Language[11867]
|
||||||
Util.AddOnceClick(this.buyBtn,function()
|
Util.AddOnceClick(this.buyBtn, function()
|
||||||
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.QinglongSerectTreasureBuyLevel)
|
UIManager.OpenPanel(UIName.GeneralPopup, GENERAL_POPUP_TYPE.QinglongSerectTreasureBuyLevel)
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
this.scoreText.text = Language[11868]
|
this.scoreText.text = Language[11868]
|
||||||
|
@ -181,31 +187,32 @@ function this:topBar()
|
||||||
this.buyBtnText.text = Language[11868]
|
this.buyBtnText.text = Language[11868]
|
||||||
end
|
end
|
||||||
this.jiesuoBtn:GetComponent("Button").enabled = (not treasureState)
|
this.jiesuoBtn:GetComponent("Button").enabled = (not treasureState)
|
||||||
local config = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig,5001)
|
local config = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, 5001)
|
||||||
this.jiesuoBtnText.text = ((not treasureState) and MoneyUtil.GetMoneyUnitNameWithMoney(config.Price) or Language[11870])
|
this.jiesuoBtnText.text = ((not treasureState) and MoneyUtil.GetMoneyUnitNameWithMoney(config.Price) or Language[11870])
|
||||||
|
|
||||||
-- this.dealBtnText.text = MoneyUtil.GetMoneyUnitNameWithMoney(config.Price)
|
|
||||||
Util.AddOnceClick(this.jiesuoBtn,function()
|
|
||||||
PayManager.Pay(5001, function(id)
|
|
||||||
--this.RechargeSuccessFunc()
|
|
||||||
this.jiesuoBtnText.text = Language[11870]
|
|
||||||
Game.GlobalEvent:DispatchEvent(GameEvent.TreasureOfHeaven.RechargeQinglongSerectSuccess,false,false)
|
|
||||||
|
|
||||||
end)
|
-- this.dealBtnText.text = MoneyUtil.GetMoneyUnitNameWithMoney(config.Price)
|
||||||
|
Util.AddOnceClick(this.jiesuoBtn, function()
|
||||||
|
PayManager.Pay(5001, function(id)
|
||||||
|
--this.RechargeSuccessFunc()
|
||||||
|
this.jiesuoBtnText.text = Language[11870]
|
||||||
|
Game.GlobalEvent:DispatchEvent(GameEvent.TreasureOfHeaven.RechargeQinglongSerectSuccess, false, false)
|
||||||
|
end)
|
||||||
--UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.HeavenUnlockExtraRewardPanel,2)
|
--UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.HeavenUnlockExtraRewardPanel,2)
|
||||||
end)
|
end)
|
||||||
local times = PrivilegeManager.GetPrivilegeRemainValue(1007)
|
--关闭包厢
|
||||||
|
--[[
|
||||||
|
local times = PrivilegeManager.GetPrivilegeRemainValue(1007)
|
||||||
this.box :GetComponent("Image").enabled = (not treasureState)
|
this.box :GetComponent("Image").enabled = (not treasureState)
|
||||||
this.extra:GetComponent("Button").enabled = ((treasureState) and (times > 0))
|
this.extra:GetComponent("Button").enabled = ((treasureState) and (times > 0))
|
||||||
this.canOpenExtra.gameObject:SetActive((treasureState) and (times > 0))
|
this.canOpenExtra.gameObject:SetActive((treasureState) and (times > 0))
|
||||||
this.openExtra:GetComponent("Animator").enabled = false
|
this.openExtra:GetComponent("Animator").enabled = false
|
||||||
this.openExtra.gameObject:SetActive((treasureState) and (times <= 0))
|
this.openExtra.gameObject:SetActive((treasureState) and (times <= 0))
|
||||||
Util.GetGameObject(this.openExtra,"MeiKaiQi"):SetActive(false)
|
Util.GetGameObject(this.openExtra,"MeiKaiQi"):SetActive(false)
|
||||||
Util.GetGameObject(this.openExtra,"KaiQi"):SetActive(true)
|
Util.GetGameObject(this.openExtra,"KaiQi"):SetActive(true)
|
||||||
Util.AddOnceClick(this.extra,function()
|
Util.AddOnceClick(this.extra,function()
|
||||||
this.extra:GetComponent("Button").enabled = false
|
this.extra:GetComponent("Button").enabled = false
|
||||||
this.canOpenExtra.gameObject:SetActive(false)
|
this.canOpenExtra.gameObject:SetActive(false)
|
||||||
this.openExtra.gameObject:SetActive(true)
|
this.openExtra.gameObject:SetActive(true)
|
||||||
Util.GetGameObject(this.openExtra,"KaiQi"):SetActive(false)
|
Util.GetGameObject(this.openExtra,"KaiQi"):SetActive(false)
|
||||||
Util.GetGameObject(this.openExtra,"MeiKaiQi"):SetActive(true)
|
Util.GetGameObject(this.openExtra,"MeiKaiQi"):SetActive(true)
|
||||||
this.openExtra:GetComponent("Animator").enabled = true
|
this.openExtra:GetComponent("Animator").enabled = true
|
||||||
|
@ -218,29 +225,30 @@ function this:topBar()
|
||||||
LogBlue("level:"..QinglongSerectTreasureManager.GetLevel())
|
LogBlue("level:"..QinglongSerectTreasureManager.GetLevel())
|
||||||
this.refresh(false,false)
|
this.refresh(false,false)
|
||||||
end,1):Start()
|
end,1):Start()
|
||||||
end)
|
end)
|
||||||
end,1.5):Start()
|
end,1.5):Start()
|
||||||
end)
|
end)
|
||||||
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
--任务列表
|
--任务列表
|
||||||
function this:showTaskList(isTop,isAni)
|
function this:showTaskList(isTop, isAni)
|
||||||
local rewardData = QinglongSerectTreasureManager.GetAllRewardData()
|
local rewardData = QinglongSerectTreasureManager.GetAllRewardData()
|
||||||
this.ScrollView:SetData(rewardData,function(index, rewardItem)
|
this.ScrollView:SetData(rewardData, function(index, rewardItem)
|
||||||
this:SingleTask(rewardItem, rewardData[index])
|
this:SingleTask(rewardItem, rewardData[index])
|
||||||
end,not isTop,not isAni)
|
end, not isTop, not isAni)
|
||||||
local index = 0
|
local index = 0
|
||||||
if QinglongSerectTreasureManager.GetLevel() == 1 then
|
if QinglongSerectTreasureManager.GetLevel() == 1 then
|
||||||
index = 1
|
index = 1
|
||||||
else
|
else
|
||||||
for k,v in ipairs(rewardData) do
|
for k, v in ipairs(rewardData) do
|
||||||
if v.state == 1 and treasureState then
|
if v.state == 1 and treasureState then
|
||||||
index = k
|
index = k
|
||||||
break
|
break
|
||||||
elseif v.state == 0 and treasureState then
|
elseif v.state == 0 and treasureState then
|
||||||
index = k
|
index = k
|
||||||
break
|
break
|
||||||
elseif v.state == 0 and (not treasureState) and (k < 35) then
|
elseif v.state == 0 and (not treasureState) and (k < 35) then
|
||||||
index = k
|
index = k
|
||||||
break
|
break
|
||||||
elseif v.state == 0 and (not treasureState) and (k >= 35) then
|
elseif v.state == 0 and (not treasureState) and (k >= 35) then
|
||||||
|
@ -249,7 +257,7 @@ function this:showTaskList(isTop,isAni)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if index == 0 then
|
if index == 0 then
|
||||||
for i = #rewardData , 1 , -1 do
|
for i = #rewardData, 1, -1 do
|
||||||
if (rewardData[i].state == -1) or (rewardData[i].state == 1 and not treasureState) then
|
if (rewardData[i].state == -1) or (rewardData[i].state == 1 and not treasureState) then
|
||||||
index = i
|
index = i
|
||||||
break
|
break
|
||||||
|
@ -258,13 +266,12 @@ function this:showTaskList(isTop,isAni)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
this.ScrollView:SetIndex(index)
|
this.ScrollView:SetIndex(index)
|
||||||
-- if isPlayAnim then
|
-- if isPlayAnim then
|
||||||
-- SecTorPlayAnimByScroll(this.ScrollView)
|
-- SecTorPlayAnimByScroll(this.ScrollView)
|
||||||
-- isPlayAnim = false
|
-- isPlayAnim = false
|
||||||
-- end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--单个任务
|
--单个任务
|
||||||
function this:SingleTask(rewardItem, rewardSingleData)
|
function this:SingleTask(rewardItem, rewardSingleData)
|
||||||
-- if isPlayAnim then
|
-- if isPlayAnim then
|
||||||
|
@ -280,7 +287,7 @@ function this:SingleTask(rewardItem, rewardSingleData)
|
||||||
if not itemsList[rewardItem] then
|
if not itemsList[rewardItem] then
|
||||||
itemsList[rewardItem] = {}
|
itemsList[rewardItem] = {}
|
||||||
maskList[rewardItem] = {}
|
maskList[rewardItem] = {}
|
||||||
end
|
end
|
||||||
for i = 1, #itemsList[rewardItem] do
|
for i = 1, #itemsList[rewardItem] do
|
||||||
itemsList[rewardItem][i].gameObject:SetActive(false)
|
itemsList[rewardItem][i].gameObject:SetActive(false)
|
||||||
maskList[rewardItem][i].gameObject:SetActive(false)
|
maskList[rewardItem][i].gameObject:SetActive(false)
|
||||||
|
@ -289,7 +296,7 @@ function this:SingleTask(rewardItem, rewardSingleData)
|
||||||
scoreLevel.text = rewardSingleData.level
|
scoreLevel.text = rewardSingleData.level
|
||||||
|
|
||||||
|
|
||||||
local SetMask = function (item,i,type)
|
local SetMask = function(item, i, type)
|
||||||
maskList[rewardItem][i].gameObject:SetActive(false)
|
maskList[rewardItem][i].gameObject:SetActive(false)
|
||||||
if type == 1 then
|
if type == 1 then
|
||||||
if rewardSingleData.state == 1 or rewardSingleData.state == -1 then
|
if rewardSingleData.state == 1 or rewardSingleData.state == -1 then
|
||||||
|
@ -303,12 +310,12 @@ function this:SingleTask(rewardItem, rewardSingleData)
|
||||||
end
|
end
|
||||||
for i = 1, #rewardSingleData.Reward do
|
for i = 1, #rewardSingleData.Reward do
|
||||||
if not itemsList[rewardItem][i] then
|
if not itemsList[rewardItem][i] then
|
||||||
itemsList[rewardItem][i] = SubUIManager.Open(SubUIConfig.ItemView,box1.transform)
|
itemsList[rewardItem][i] = SubUIManager.Open(SubUIConfig.ItemView, box1.transform)
|
||||||
itemsList[rewardItem][i].gameObject:SetActive(false)
|
itemsList[rewardItem][i].gameObject:SetActive(false)
|
||||||
maskList[rewardItem][i] = newObjToParent(mask, itemsList[rewardItem][i])
|
maskList[rewardItem][i] = newObjToParent(mask, itemsList[rewardItem][i])
|
||||||
maskList[rewardItem][i].transform:DOAnchorPos(Vector3(0.7,-3,0),0)
|
maskList[rewardItem][i].transform:DOAnchorPos(Vector3(0.7, -3, 0), 0)
|
||||||
end
|
end
|
||||||
if rewardSingleData.Reward[i] and rewardSingleData.Reward[i].item[1] and rewardSingleData.Reward[i].item[1]~=0 then
|
if rewardSingleData.Reward[i] and rewardSingleData.Reward[i].item[1] and rewardSingleData.Reward[i].item[1] ~= 0 then
|
||||||
if rewardSingleData.Reward[i].type == 1 then
|
if rewardSingleData.Reward[i].type == 1 then
|
||||||
itemsList[rewardItem][i].gameObject.transform:SetParent(box1.transform)
|
itemsList[rewardItem][i].gameObject.transform:SetParent(box1.transform)
|
||||||
else
|
else
|
||||||
|
@ -316,8 +323,9 @@ function this:SingleTask(rewardItem, rewardSingleData)
|
||||||
end
|
end
|
||||||
itemsList[rewardItem][i].gameObject:GetComponent("RectTransform").localPosition = Vector3.zero
|
itemsList[rewardItem][i].gameObject:GetComponent("RectTransform").localPosition = Vector3.zero
|
||||||
itemsList[rewardItem][i].gameObject:SetActive(true)
|
itemsList[rewardItem][i].gameObject:SetActive(true)
|
||||||
itemsList[rewardItem][i]:OnOpen(false, rewardSingleData.Reward[i].item, 0.8,false,false,false,sortingOrder)
|
itemsList[rewardItem][i]:OnOpen(false, rewardSingleData.Reward[i].item, 0.8, false, false, false,
|
||||||
SetMask(rewardItem,i,rewardSingleData.Reward[i].type)
|
sortingOrder)
|
||||||
|
SetMask(rewardItem, i, rewardSingleData.Reward[i].type)
|
||||||
else
|
else
|
||||||
itemsList[rewardItem][i].gameObject:SetActive(false)
|
itemsList[rewardItem][i].gameObject:SetActive(false)
|
||||||
end
|
end
|
||||||
|
@ -326,58 +334,58 @@ function this:SingleTask(rewardItem, rewardSingleData)
|
||||||
--初始化按钮状态
|
--初始化按钮状态
|
||||||
this:InitButtonState(rewardItem, rewardSingleData)
|
this:InitButtonState(rewardItem, rewardSingleData)
|
||||||
end
|
end
|
||||||
local type={
|
|
||||||
[-2]={sprite = "s_slbz_1anniuhuise",text = Language[10341]},
|
local type = {
|
||||||
[-1]={sprite = "s_slbz_1anniuhuise",text = Language[10025]},
|
[-2] = { sprite = "s_slbz_1anniuhuise", text = Language[10341] },
|
||||||
[0]={sprite = "s_slbz_1anniuongse",text = Language[10018]},
|
[-1] = { sprite = "s_slbz_1anniuhuise", text = Language[10025] },
|
||||||
[1]={sprite = "s_slbz_1anniuhuangse",text = Language[11872]}
|
[0] = { sprite = "s_slbz_1anniuongse", text = Language[10018] },
|
||||||
|
[1] = { sprite = "s_slbz_1anniuhuangse", text = Language[11872] }
|
||||||
}
|
}
|
||||||
--初始化按钮状态
|
--初始化按钮状态
|
||||||
function this:InitButtonState(rewardItem, rewardSingleData)
|
function this:InitButtonState(rewardItem, rewardSingleData)
|
||||||
|
|
||||||
local btnDeal = Util.GetGameObject(rewardItem, "btnDeal")
|
local btnDeal = Util.GetGameObject(rewardItem, "btnDeal")
|
||||||
|
|
||||||
local get = Util.GetGameObject(rewardItem, "btnDeal/get"):GetComponent("Image")
|
local get = Util.GetGameObject(rewardItem, "btnDeal/get"):GetComponent("Image")
|
||||||
local text = Util.GetGameObject(get.gameObject, "Text"):GetComponent("Text")
|
local text = Util.GetGameObject(get.gameObject, "Text"):GetComponent("Text")
|
||||||
local redPoint = Util.GetGameObject(rewardItem, "btnDeal/redPoint")
|
local redPoint = Util.GetGameObject(rewardItem, "btnDeal/redPoint")
|
||||||
--当前任务领取情况
|
--当前任务领取情况
|
||||||
local state = rewardSingleData.state
|
local state = rewardSingleData.state
|
||||||
Util.GetGameObject(get.gameObject, "Image"):SetActive(false)--state == -1)
|
Util.GetGameObject(get.gameObject, "Image"):SetActive(false) --state == -1)
|
||||||
redPoint:SetActive(state == 0 or (state == 1 and treasureState))
|
redPoint:SetActive(state == 0 or (state == 1 and treasureState))
|
||||||
get.sprite = this.spLoader:LoadSprite(type[state].sprite)
|
get.sprite = this.spLoader:LoadSprite(type[state].sprite)
|
||||||
get.enabled = true
|
get.enabled = true
|
||||||
text.text = type[state].text
|
text.text = type[state].text
|
||||||
-- if state == -1 then
|
-- if state == -1 then
|
||||||
-- btnDeal:GetComponent("Button").enabled = false
|
-- btnDeal:GetComponent("Button").enabled = false
|
||||||
-- get.enabled = false
|
-- get.enabled = false
|
||||||
-- else
|
-- else
|
||||||
-- btnDeal:GetComponent("Button").enabled = true
|
-- btnDeal:GetComponent("Button").enabled = true
|
||||||
Util.AddOnceClick(btnDeal,function()
|
Util.AddOnceClick(btnDeal, function()
|
||||||
this:OnBtnDealClicked(rewardItem,rewardSingleData)
|
this:OnBtnDealClicked(rewardItem, rewardSingleData)
|
||||||
end)
|
end)
|
||||||
-- end
|
-- end
|
||||||
end
|
end
|
||||||
|
|
||||||
--按钮事件
|
--按钮事件
|
||||||
function this:OnBtnDealClicked(rewardItem,rewardSingleData)
|
function this:OnBtnDealClicked(rewardItem, rewardSingleData)
|
||||||
if rewardSingleData.state ~= -2 then--分数达到要求
|
if rewardSingleData.state ~= -2 then --分数达到要求
|
||||||
if (rewardSingleData.state == 0) or--任务未领取
|
if (rewardSingleData.state == 0) or --任务未领取
|
||||||
(rewardSingleData.state == 1 and treasureState) then--任务未领取+礼包已购买
|
(rewardSingleData.state == 1 and treasureState) then --任务未领取+礼包已购买
|
||||||
local id = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.TreasureOfSomeBody)
|
local id = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.TreasureOfSomeBody)
|
||||||
NetManager.GetActivityRewardRequest(rewardSingleData.level,id,function(msg)
|
NetManager.GetActivityRewardRequest(rewardSingleData.level, id, function(msg)
|
||||||
UIManager.OpenPanel(UIName.RewardItemPopup,msg,1)
|
UIManager.OpenPanel(UIName.RewardItemPopup, msg, 1)
|
||||||
--需要刷新界面
|
--需要刷新界面
|
||||||
if not treasureState then--判断是否已经购买了礼包
|
if not treasureState then --判断是否已经购买了礼包
|
||||||
QinglongSerectTreasureManager.SetSingleRewardState(rewardSingleData.level,1)
|
QinglongSerectTreasureManager.SetSingleRewardState(rewardSingleData.level, 1)
|
||||||
else
|
else
|
||||||
QinglongSerectTreasureManager.SetSingleRewardState(rewardSingleData.level,-1)
|
QinglongSerectTreasureManager.SetSingleRewardState(rewardSingleData.level, -1)
|
||||||
end
|
end
|
||||||
this.refresh(false,false)--刷新界面
|
this.refresh(false, false) --刷新界面
|
||||||
end)
|
end)
|
||||||
elseif rewardSingleData.state == 1 and (not treasureState) then----任务已领取+礼包未购买(弹出购买界面)
|
elseif rewardSingleData.state == 1 and (not treasureState) then ----任务已领取+礼包未购买(弹出购买界面)
|
||||||
UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.HeavenUnlockExtraRewardPanel,2)
|
UIManager.OpenPanel(UIName.GeneralPopup, GENERAL_POPUP_TYPE.HeavenUnlockExtraRewardPanel, 2)
|
||||||
end
|
end
|
||||||
else--分数未达到要求
|
else --分数未达到要求
|
||||||
PopupTipPanel.ShowTip(Language[11040])
|
PopupTipPanel.ShowTip(Language[11040])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -386,19 +394,20 @@ function this:ShowTime(endtime)
|
||||||
if self.timer then
|
if self.timer then
|
||||||
self.timer:Stop()
|
self.timer:Stop()
|
||||||
self.timer = nil
|
self.timer = nil
|
||||||
end
|
end
|
||||||
local timeDown= endtime - GetTimeStamp()
|
local timeDown = endtime - GetTimeStamp()
|
||||||
this.remainTime.text = Language[10570]..TimeToDHMS(timeDown)
|
this.remainTime.text = Language[10570] .. TimeToDHMS(timeDown)
|
||||||
self.timer = Timer.New(function()
|
self.timer = Timer.New(function()
|
||||||
if timeDown < 1 then
|
if timeDown < 1 then
|
||||||
this.remainTime.text = Language[10570]..TimeToDHMS(0)
|
this.remainTime.text = Language[10570] .. TimeToDHMS(0)
|
||||||
self.timer:Stop()
|
self.timer:Stop()
|
||||||
self.timer = nil
|
self.timer = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
timeDown = timeDown - 1
|
timeDown = timeDown - 1
|
||||||
this.remainTime.text = Language[10570]..TimeToDHMS(timeDown)
|
this.remainTime.text = Language[10570] .. TimeToDHMS(timeDown)
|
||||||
end, 1, -1, true)
|
end, 1, -1, true)
|
||||||
self.timer:Start()
|
self.timer:Start()
|
||||||
end
|
end
|
||||||
return this
|
|
||||||
|
return this
|
||||||
|
|
|
@ -25,12 +25,13 @@ function this:InitComponent(gameObject)
|
||||||
local v2 = this.treasureList:GetComponent("RectTransform").sizeDelta
|
local v2 = this.treasureList:GetComponent("RectTransform").sizeDelta
|
||||||
this.itemPre = Util.GetGameObject(this.gameObject, "rewardPre")
|
this.itemPre = Util.GetGameObject(this.gameObject, "rewardPre")
|
||||||
this.box = Util.GetGameObject(this.gameObject, "topBar/box")
|
this.box = Util.GetGameObject(this.gameObject, "topBar/box")
|
||||||
|
this.box.gameObject:SetActive(false)
|
||||||
this.extra = Util.GetGameObject(this.gameObject, "topBar/extraBox")
|
this.extra = Util.GetGameObject(this.gameObject, "topBar/extraBox")
|
||||||
this.canOpenExtra = Util.GetGameObject(this.gameObject, "topBar/UI_Effect_BaoXiang_KeKaiQi")
|
this.canOpenExtra = Util.GetGameObject(this.gameObject, "topBar/UI_Effect_BaoXiang_KeKaiQi")
|
||||||
this.canOpenExtra.gameObject:SetActive(false)
|
this.canOpenExtra.gameObject:SetActive(false)
|
||||||
this.openExtra = Util.GetGameObject(this.gameObject, "topBar/UI_Effect_BaoXiang_KaiQi")
|
this.openExtra = Util.GetGameObject(this.gameObject, "topBar/UI_Effect_BaoXiang_KaiQi")
|
||||||
this.openExtra.gameObject:SetActive(false)
|
this.openExtra.gameObject:SetActive(false)
|
||||||
|
this.extra.gameObject:SetActive(false)
|
||||||
--设置滚动条
|
--设置滚动条
|
||||||
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.treasureList.transform,
|
this.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.treasureList.transform,
|
||||||
this.itemPre, nil, Vector2.New(v2.x, v2.y), 1, 1, Vector2.New(100, 0))
|
this.itemPre, nil, Vector2.New(v2.x, v2.y), 1, 1, Vector2.New(100, 0))
|
||||||
|
@ -116,18 +117,18 @@ end
|
||||||
function this:SetTopBar()
|
function this:SetTopBar()
|
||||||
treasureState = QinglongSerectTreasureManager.GetTreasureState() --秘宝礼包状态 0:可购买 1:已购买
|
treasureState = QinglongSerectTreasureManager.GetTreasureState() --秘宝礼包状态 0:可购买 1:已购买
|
||||||
this.jiesuoBtn:GetComponent("Button").enabled = (not treasureState)
|
this.jiesuoBtn:GetComponent("Button").enabled = (not treasureState)
|
||||||
local config = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig,5001)
|
local config = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, 5001)
|
||||||
this.jiesuoBtnText.text = ((not treasureState) and MoneyUtil.GetMoneyUnitNameWithMoney(config.Price) or Language[11870])
|
this.jiesuoBtnText.text = ((not treasureState) and MoneyUtil.GetMoneyUnitNameWithMoney(config.Price) or Language[11870])
|
||||||
--this.jiesuoBtnText.text = ((not treasureState) and Language[11869] or Language[11870])
|
--this.jiesuoBtnText.text = ((not treasureState) and Language[11869] or Language[11870])
|
||||||
Util.AddOnceClick(this.jiesuoBtn, function()
|
Util.AddOnceClick(this.jiesuoBtn, function()
|
||||||
--UIManager.OpenPanel(UIName.GeneralPopup, GENERAL_POPUP_TYPE.HeavenUnlockExtraRewardPanel, 2)
|
--UIManager.OpenPanel(UIName.GeneralPopup, GENERAL_POPUP_TYPE.HeavenUnlockExtraRewardPanel, 2)
|
||||||
PayManager.Pay(5001, function(id)
|
PayManager.Pay(5001, function(id)
|
||||||
--this.RechargeSuccessFunc()
|
--this.RechargeSuccessFunc()
|
||||||
this.jiesuoBtnText.text = Language[11870]
|
this.jiesuoBtnText.text = Language[11870]
|
||||||
Game.GlobalEvent:DispatchEvent(GameEvent.TreasureOfHeaven.RechargeQinglongSerectSuccess,false,false)
|
Game.GlobalEvent:DispatchEvent(GameEvent.TreasureOfHeaven.RechargeQinglongSerectSuccess, false, false)
|
||||||
|
end)
|
||||||
end)
|
|
||||||
end)
|
end)
|
||||||
|
--[[
|
||||||
local times = PrivilegeManager.GetPrivilegeRemainValue(1007)
|
local times = PrivilegeManager.GetPrivilegeRemainValue(1007)
|
||||||
this.box:GetComponent("Image").enabled = (not treasureState)
|
this.box:GetComponent("Image").enabled = (not treasureState)
|
||||||
this.extra:GetComponent("Button").enabled = (treasureState and (times > 0))
|
this.extra:GetComponent("Button").enabled = (treasureState and (times > 0))
|
||||||
|
@ -152,11 +153,12 @@ function this:SetTopBar()
|
||||||
end)
|
end)
|
||||||
end, 1.5):Start()
|
end, 1.5):Start()
|
||||||
end)
|
end)
|
||||||
|
]]
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:OnSortingOrderChange(sortingOrder)
|
function this:OnSortingOrderChange(sortingOrder)
|
||||||
Util.SetParticleSortLayer(this.canOpenExtra, sortingOrder)
|
--Util.SetParticleSortLayer(this.canOpenExtra, sortingOrder)
|
||||||
Util.SetParticleSortLayer(this.openExtra, sortingOrder)
|
--Util.SetParticleSortLayer(this.openExtra, sortingOrder)
|
||||||
end
|
end
|
||||||
|
|
||||||
function this:OnClose()
|
function this:OnClose()
|
||||||
|
|
Loading…
Reference in New Issue