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