2021-07-01 20:13:47 +08:00
|
|
|
|
require("Base/BasePanel")
|
|
|
|
|
JourneyWithWindPanel = Inherit(BasePanel)
|
|
|
|
|
local this = JourneyWithWindPanel
|
|
|
|
|
local JourneyWithWind = ConfigManager.GetConfig(ConfigName.JourneyWithWind)
|
2021-07-03 19:23:15 +08:00
|
|
|
|
local mainlevleConfig = ConfigManager.GetConfig(ConfigName.MainLevelConfig)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
this.timer = Timer.New()
|
|
|
|
|
local sorting = 0
|
|
|
|
|
local itemList = {}--item list 重复利用 和 修改层级时会用到
|
|
|
|
|
local curDayIndex = 0--当前天数索引
|
|
|
|
|
local curBtnConFigData = {}--当前daybtn ActivityRewardConfig数据
|
|
|
|
|
local allBtnsConFigData = {}--上方所有daybtn ActivityRewardConfig数据
|
|
|
|
|
local curDayAllTaskGos = {}--当前天所有任务go
|
|
|
|
|
local curDay
|
|
|
|
|
local activityData
|
2021-07-03 12:37:56 +08:00
|
|
|
|
local isGetState
|
2021-07-03 16:49:13 +08:00
|
|
|
|
local curRewardTaskData--奖励后端数据
|
|
|
|
|
local isOpenLock
|
2021-07-03 12:37:56 +08:00
|
|
|
|
-- this.UpView = nil
|
2021-07-01 20:13:47 +08:00
|
|
|
|
--初始化组件(用于子类重写)
|
|
|
|
|
function JourneyWithWindPanel:InitComponent()
|
|
|
|
|
this.spLoader = SpriteLoader.New()
|
|
|
|
|
--子模块脚本
|
|
|
|
|
this.BtnBack = Util.GetGameObject(self.gameObject, "btnBack")
|
|
|
|
|
this.helpBtn = Util.GetGameObject(self.gameObject, "helpBtn")
|
2021-07-03 12:37:56 +08:00
|
|
|
|
this.helpPosition = this.helpBtn:GetComponent("RectTransform").localPosition
|
2021-07-01 20:13:47 +08:00
|
|
|
|
|
|
|
|
|
curDayAllTaskGos = {}
|
2021-07-03 12:37:56 +08:00
|
|
|
|
for i = 1, (5+2) do
|
2021-07-01 20:13:47 +08:00
|
|
|
|
curDayAllTaskGos[i] = Util.GetGameObject(self.gameObject, "taskList/MissionPre (".. i ..")")
|
|
|
|
|
end
|
|
|
|
|
this.curDayTip = Util.GetGameObject(self.transform, "curDayTip"):GetComponent("Text")
|
2021-07-03 12:37:56 +08:00
|
|
|
|
this.selected = Util.GetGameObject(self.transform, "selected")
|
2021-07-01 20:13:47 +08:00
|
|
|
|
|
|
|
|
|
this.dayPre = Util.GetGameObject(self.gameObject, "dayPre")
|
|
|
|
|
local v2 = Util.GetGameObject(self.gameObject, "rect"):GetComponent("RectTransform").rect
|
2021-07-03 12:37:56 +08:00
|
|
|
|
this.titleScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, Util.GetGameObject(self.gameObject, "rect").transform,
|
|
|
|
|
this.dayPre, nil, Vector2.New(-v2.x*2, -v2.y*2), 2, 1, Vector2.New(0,0))
|
|
|
|
|
this.titleScrollView.moveTween.MomentumAmount = 1
|
|
|
|
|
this.titleScrollView.moveTween.Strength = 1
|
|
|
|
|
-- this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform, { showType = UpViewOpenType.ShowLeft })
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--绑定事件(用于子类重写)
|
|
|
|
|
function JourneyWithWindPanel:BindEvent()
|
|
|
|
|
|
|
|
|
|
Util.AddClick(this.BtnBack, function()
|
|
|
|
|
self:ClosePanel()
|
|
|
|
|
end)
|
|
|
|
|
--帮助按钮
|
|
|
|
|
Util.AddClick(this.helpBtn, function()
|
2021-07-03 19:23:15 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.JourneyWithWind,this.helpPosition.x,this.helpPosition.y)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--添加事件监听(用于子类重写)
|
|
|
|
|
function JourneyWithWindPanel:AddListener()
|
2021-07-03 12:37:56 +08:00
|
|
|
|
Game.GlobalEvent:AddEvent(GameEvent.Activity.OnActivityOpenOrClose, this.AutoClose)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--移除事件监听(用于子类重写)
|
|
|
|
|
function JourneyWithWindPanel:RemoveListener()
|
2021-07-03 12:37:56 +08:00
|
|
|
|
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityOpenOrClose, this.AutoClose)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
|
|
|
function JourneyWithWindPanel:OnOpen(_curDayIndex)
|
2021-07-03 12:37:56 +08:00
|
|
|
|
|
|
|
|
|
allBtnsConFigData = ActivityGiftManager.GetJourneyWithWindAllDayConFigData()
|
|
|
|
|
local curServerDay = math.ceil((CalculateSecondsNowTo_N_OClock(0) + GetTimeStamp() - PlayerManager.userCreateTime)/86400)
|
|
|
|
|
|
|
|
|
|
for i = 1, #allBtnsConFigData do
|
|
|
|
|
if curServerDay >= allBtnsConFigData[i].Values[1][2] then
|
|
|
|
|
curDay = allBtnsConFigData[i].Values[1][2]
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-07-03 20:02:13 +08:00
|
|
|
|
local aaa,joConFig = ActivityGiftManager.JourneyWithWindRewardNoGet()
|
|
|
|
|
if aaa then
|
|
|
|
|
if joConFig.Values[1][2] < curDay then
|
|
|
|
|
curDay = joConFig.Values[1][2]
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-07-01 20:13:47 +08:00
|
|
|
|
curDayIndex = _curDayIndex or curDay
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
|
|
|
|
function JourneyWithWindPanel:OnShow()
|
|
|
|
|
activityData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.JourneyWithWind)
|
|
|
|
|
this.ShowDayBtnsData()
|
|
|
|
|
this.ShowDayData(curDayIndex)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function JourneyWithWindPanel:OnSortingOrderChange()
|
|
|
|
|
for i, v in pairs(itemList) do
|
|
|
|
|
for j = 1, #v do
|
|
|
|
|
v[j]:SetEffectLayer(self.sortingOrder)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
sorting=self.sortingOrder
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--显示上方所有天的按钮 及 当前可领取的主要奖励
|
|
|
|
|
function this.ShowDayBtnsData()
|
|
|
|
|
this.titleScrollView:SetData(allBtnsConFigData, function (index, go)
|
2021-07-03 12:37:56 +08:00
|
|
|
|
this.SingleDayBtnDataShow(go, allBtnsConFigData[index],index)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end,true,true)
|
|
|
|
|
this.titleScrollView:SetIndex(curDayIndex)
|
|
|
|
|
end
|
2021-07-03 12:37:56 +08:00
|
|
|
|
function this.SingleDayBtnDataShow(_go,data,index)
|
|
|
|
|
local go = Util.GetGameObject(_go, "dayPre")
|
2021-07-03 16:49:13 +08:00
|
|
|
|
Util.GetGameObject(go, "dayBg/Text"):GetComponent("Text").text = string.format(Language[10528],data.Values[1][2])
|
2021-07-01 20:13:47 +08:00
|
|
|
|
local iconItemId = ConfigManager.GetConfigData(ConfigName.ItemConfig,data.Reward[1][1])
|
2021-07-03 12:37:56 +08:00
|
|
|
|
Util.GetGameObject(go, "icon"):GetComponent("Image").sprite = this.spLoader:LoadSprite(GetResourcePath(iconItemId.ResourceID))
|
2021-07-01 20:13:47 +08:00
|
|
|
|
local redPoint = Util.GetGameObject(go, "redPoint")
|
|
|
|
|
local redState = false
|
2021-07-03 16:49:13 +08:00
|
|
|
|
if curDay >= data.Values[1][2] then
|
|
|
|
|
Util.SetGray(Util.GetGameObject(go, "dayBg"),false)
|
|
|
|
|
else
|
|
|
|
|
Util.SetGray(Util.GetGameObject(go, "dayBg"),true)
|
|
|
|
|
end
|
2021-07-01 20:13:47 +08:00
|
|
|
|
if activityData then
|
|
|
|
|
for j = 1, #activityData.mission do
|
|
|
|
|
if activityData.mission[j].missionId == data.Id then
|
|
|
|
|
redState = ActivityGiftManager.SingleJourneyWithWindRewardNoGet(activityData.mission[j])
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-07-03 16:49:13 +08:00
|
|
|
|
if not redState then
|
2021-07-03 17:46:44 +08:00
|
|
|
|
redState = ActivityGiftManager.GetJourneyWithWindPlayerPrefs(data.Values[1][2]) == 0
|
2021-07-03 16:49:13 +08:00
|
|
|
|
end
|
2021-07-01 20:13:47 +08:00
|
|
|
|
redPoint:SetActive(redState)
|
2021-07-03 12:37:56 +08:00
|
|
|
|
|
|
|
|
|
if index%2 == 0 then
|
|
|
|
|
go.transform.anchoredPosition = Vector3.New(3.05,23,0)
|
|
|
|
|
else
|
|
|
|
|
go.transform.anchoredPosition = Vector3.New(3.05,176.09,0)
|
|
|
|
|
end
|
2021-07-03 17:46:44 +08:00
|
|
|
|
if data.Values[1][2] == curDayIndex then
|
|
|
|
|
this.selected.transform:SetParent(Util.GetGameObject(go, "selectedParent").transform)
|
|
|
|
|
this.selected.transform.anchoredPosition = Vector3.New(4.3,9.4,0)
|
|
|
|
|
end
|
2021-07-01 20:13:47 +08:00
|
|
|
|
Util.AddOnceClick(go, function()
|
|
|
|
|
this.ShowDayData(data.Values[1][2])
|
2021-07-03 12:37:56 +08:00
|
|
|
|
this.selected.transform:SetParent(Util.GetGameObject(go, "selectedParent").transform)
|
|
|
|
|
this.selected.transform.anchoredPosition = Vector3.New(4.3,9.4,0)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--当前天的具体任务显示
|
|
|
|
|
function this.ShowDayData(_curDayIndex)
|
|
|
|
|
curDayIndex = _curDayIndex
|
|
|
|
|
ActivityGiftManager.SetJourneyWithWindPlayerPrefs(curDayIndex,1)
|
2021-07-03 12:37:56 +08:00
|
|
|
|
this.curDayTip.text = string.format(Language[10528],NumToChinese[curDayIndex])
|
2021-07-01 20:13:47 +08:00
|
|
|
|
for i = 1, #allBtnsConFigData do
|
|
|
|
|
if curDayIndex == allBtnsConFigData[i].Values[1][2] then
|
|
|
|
|
curBtnConFigData = allBtnsConFigData[i]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--组当前所有任务的表数据
|
|
|
|
|
local curDayAllTaskConFigData = {}
|
|
|
|
|
for key, configInfo in ConfigPairs(JourneyWithWind) do
|
|
|
|
|
if configInfo.DayNum == curDayIndex then
|
|
|
|
|
table.insert(curDayAllTaskConFigData,configInfo)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
--组当前所有任务的后端数据
|
|
|
|
|
local AllTaskData = TaskManager.GetTypeTaskList(TaskTypeDef.JourneyWithWind)
|
2021-07-03 12:37:56 +08:00
|
|
|
|
for i = 1, #curDayAllTaskGos-2 do
|
2021-07-01 20:13:47 +08:00
|
|
|
|
if curDayAllTaskConFigData[i] then
|
|
|
|
|
curDayAllTaskGos[i]:SetActive(true)
|
2021-07-03 12:37:56 +08:00
|
|
|
|
Util.GetGameObject(curDayAllTaskGos[i], "pre1"):SetActive(true)
|
|
|
|
|
Util.GetGameObject(curDayAllTaskGos[i], "pre2"):SetActive(false)
|
|
|
|
|
Util.GetGameObject(curDayAllTaskGos[i], "pre1/name"):GetComponent("Text").text = "目标"
|
|
|
|
|
Util.GetGameObject(curDayAllTaskGos[i], "pre1/condition"):GetComponent("Text").text = curDayAllTaskConFigData[i].Show
|
|
|
|
|
local btnJump = Util.GetGameObject(curDayAllTaskGos[i], "pre1/btnJump")
|
|
|
|
|
local btnFinish = Util.GetGameObject(curDayAllTaskGos[i], "pre1/btnFinish")
|
2021-07-03 16:49:13 +08:00
|
|
|
|
local btnJumpText = Util.GetGameObject(btnJump, "get"):GetComponent("Text")
|
2021-07-03 12:37:56 +08:00
|
|
|
|
local buyInfo = Util.GetGameObject(curDayAllTaskGos[i], "buyInfo"):GetComponent("Text")
|
2021-07-03 20:02:13 +08:00
|
|
|
|
local headName = Util.GetGameObject(curDayAllTaskGos[i], "headImage/name")
|
|
|
|
|
headName:GetComponent("Text").text = curDayAllTaskConFigData[i].HeadName
|
|
|
|
|
local size = headName:GetComponent("RectTransform").sizeDelta
|
|
|
|
|
if string.len(curDayAllTaskConFigData[i].HeadName) >= 15 then
|
|
|
|
|
size.x = 130.3
|
|
|
|
|
headName.transform.sizeDelta = size
|
|
|
|
|
else
|
|
|
|
|
size.x = 108.3
|
|
|
|
|
headName.transform.sizeDelta = size
|
|
|
|
|
end
|
2021-07-03 16:49:13 +08:00
|
|
|
|
btnFinish:SetActive(false)
|
|
|
|
|
btnJump:SetActive(false)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
buyInfo.text = ""
|
|
|
|
|
local curMissionData
|
|
|
|
|
for j = 1, #AllTaskData do
|
|
|
|
|
if AllTaskData[j].missionId == curDayAllTaskConFigData[i].Id then
|
|
|
|
|
curMissionData = AllTaskData[j]
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-07-03 12:37:56 +08:00
|
|
|
|
if curMissionData then
|
2021-07-03 20:02:13 +08:00
|
|
|
|
local isOpen = false
|
|
|
|
|
if curDayAllTaskConFigData[i].SystemId == FUNCTION_OPEN_TYPE.EXPEDITION then
|
|
|
|
|
if ActTimeCtrlManager.SingleFuncState(curDayAllTaskConFigData[i].SystemId) then
|
|
|
|
|
isOpen = true
|
|
|
|
|
else
|
|
|
|
|
if ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.EXPEDITION) then
|
|
|
|
|
isOpen = true
|
|
|
|
|
else
|
|
|
|
|
isOpen = false
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
isOpen = (curDayAllTaskConFigData[i].SystemId and curDayAllTaskConFigData[i].SystemId > 0 and ActTimeCtrlManager.SingleFuncState(curDayAllTaskConFigData[i].SystemId))
|
|
|
|
|
end
|
2021-07-01 20:13:47 +08:00
|
|
|
|
local progress = curMissionData.progress--任务进度
|
|
|
|
|
local state = curMissionData.state--任务状态 0:未完成 1:完成未领取 2:已达成(已领取)
|
2021-07-03 16:49:13 +08:00
|
|
|
|
isOpenLock = curDay >= curDayIndex
|
|
|
|
|
Util.SetGray(btnJump,false)
|
|
|
|
|
if isOpenLock then--到天数
|
|
|
|
|
Util.SetGray(btnJump,false)
|
|
|
|
|
btnJumpText.text = "前往"
|
|
|
|
|
btnJump:GetComponent("Button").enabled = true
|
|
|
|
|
if isOpen then--功能是否开启
|
|
|
|
|
if state == 1 or state == 2 then--是否已达成
|
|
|
|
|
btnFinish:SetActive(true)
|
|
|
|
|
elseif state == 0 then
|
|
|
|
|
btnJump:SetActive(true)
|
|
|
|
|
btnJump:GetComponent("Button").enabled = true
|
2021-07-03 19:23:15 +08:00
|
|
|
|
buyInfo.text = string.format("%s/%s",progress,curDayAllTaskConFigData[i].TaskValue[2][1])
|
2021-07-03 16:49:13 +08:00
|
|
|
|
Util.AddOnceClick(btnJump, function()
|
2021-07-03 17:46:44 +08:00
|
|
|
|
if curDayAllTaskConFigData[i].SystemId == FUNCTION_OPEN_TYPE.EXPEDITION then
|
|
|
|
|
if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.EXPEDITION) then
|
|
|
|
|
if #ExpeditionManager.nodeInfo <= 0 then
|
|
|
|
|
if ExpeditionManager.expeditionLeve == -1 then
|
|
|
|
|
NetManager.GetExpeditionRequest(2,function()
|
|
|
|
|
JumpManager.GoJump(curDayAllTaskConFigData[i].Jump[1])
|
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
NetManager.GetExpeditionRequest(
|
|
|
|
|
ExpeditionManager.expeditionLeve,function()
|
|
|
|
|
JumpManager.GoJump(curDayAllTaskConFigData[i].Jump[1])
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
JumpManager.GoJump(curDayAllTaskConFigData[i].Jump[1])
|
|
|
|
|
end
|
|
|
|
|
NetManager.TreasureOfHeavenScoreRequest()
|
|
|
|
|
PlayerPrefs.SetInt(PlayerManager.uid.."ExpeditionRed",ActTimeCtrlManager.GetSerDataByTypeId(FUNCTION_OPEN_TYPE.EXPEDITION).endTime)
|
|
|
|
|
CheckRedPointStatus(RedPointType.OrdinaryExplore)
|
|
|
|
|
else
|
|
|
|
|
if ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.EXPEDITION) then
|
|
|
|
|
PopupTipPanel.ShowTip(Language[12183])
|
|
|
|
|
else
|
|
|
|
|
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(FUNCTION_OPEN_TYPE.EXPEDITION))
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
JumpManager.GoJump(curDayAllTaskConFigData[i].Jump[1])
|
|
|
|
|
end
|
|
|
|
|
|
2021-07-03 16:49:13 +08:00
|
|
|
|
end)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end
|
|
|
|
|
else
|
2021-07-03 16:49:13 +08:00
|
|
|
|
btnJump:SetActive(true)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
Util.SetGray(btnJump,true)
|
2021-07-03 12:37:56 +08:00
|
|
|
|
btnJump:GetComponent("Button").enabled = false
|
|
|
|
|
if curDayAllTaskConFigData[i].TaskType ~= 14 then
|
|
|
|
|
buyInfo.text = string.format(Language[11903],ConfigManager.GetConfigData(ConfigName.GlobalSystemConfig,curDayAllTaskConFigData[i].SystemId).OpenRules[2])
|
|
|
|
|
end
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end
|
2021-07-03 16:49:13 +08:00
|
|
|
|
else--未到天数
|
|
|
|
|
btnJump:SetActive(true)
|
|
|
|
|
Util.SetGray(btnJump,true)
|
|
|
|
|
btnJumpText.text = "未开启"
|
|
|
|
|
btnJump:GetComponent("Button").enabled = false
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
curDayAllTaskGos[i]:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-07-03 12:37:56 +08:00
|
|
|
|
this.ShowDayDataActivityReward()--位置1 不变
|
|
|
|
|
this.ShowDayDataGiftBag()--位置2 不变
|
|
|
|
|
CheckRedPointStatus(RedPointType.JourneyWithWind)
|
|
|
|
|
end
|
2021-07-01 20:13:47 +08:00
|
|
|
|
|
2021-07-03 12:37:56 +08:00
|
|
|
|
--奖励任务
|
|
|
|
|
function this.ShowDayDataActivityReward()
|
|
|
|
|
local go = curDayAllTaskGos[6]
|
|
|
|
|
if go and curBtnConFigData and activityData then
|
|
|
|
|
Util.GetGameObject(go, "pre1"):SetActive(false)
|
|
|
|
|
Util.GetGameObject(go, "pre2"):SetActive(true)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
for i = 1, #activityData.mission do
|
|
|
|
|
if activityData.mission[i].missionId == curBtnConFigData.Id then
|
|
|
|
|
curRewardTaskData = activityData.mission[i]
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
if curRewardTaskData then
|
|
|
|
|
if not itemList[go.name] then
|
|
|
|
|
itemList[go.name] = {}
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #itemList[go.name] do
|
|
|
|
|
itemList[go.name][i].gameObject:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #curBtnConFigData.Reward do
|
|
|
|
|
if itemList[go.name][i] then
|
2021-07-03 19:23:15 +08:00
|
|
|
|
itemList[go.name][i]:OnOpen(false, curBtnConFigData.Reward[i], 0.9,false,false,false,sorting)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
else
|
2021-07-03 12:37:56 +08:00
|
|
|
|
itemList[go.name][i] = SubUIManager.Open(SubUIConfig.ItemView, Util.GetGameObject(go, "pre2/itemContent").transform)
|
2021-07-03 19:23:15 +08:00
|
|
|
|
itemList[go.name][i]:OnOpen(false, curBtnConFigData.Reward[i], 0.9,false,false,false,sorting)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end
|
|
|
|
|
itemList[go.name][i].gameObject:SetActive(true)
|
|
|
|
|
end
|
2021-07-03 16:49:13 +08:00
|
|
|
|
local getBtn = Util.GetGameObject(go, "pre2/getBtn")
|
|
|
|
|
local btnText = Util.GetGameObject(getBtn, "get"):GetComponent("Text")
|
|
|
|
|
local redPoint = Util.GetGameObject(getBtn, "redPoint")
|
2021-07-03 12:37:56 +08:00
|
|
|
|
isGetState = ActivityGiftManager.SingleJourneyWithWindRewardNoGet(curRewardTaskData)
|
2021-07-03 16:49:13 +08:00
|
|
|
|
isOpenLock = curDay >= curDayIndex
|
2021-07-01 20:13:47 +08:00
|
|
|
|
local imageStr = isGetState and "s_slbz_1anniuongse" or "s_slbz_1anniuhuise"
|
2021-07-03 12:37:56 +08:00
|
|
|
|
getBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite(imageStr)
|
2021-07-03 16:49:13 +08:00
|
|
|
|
redPoint:SetActive(isGetState)
|
2021-07-03 20:02:13 +08:00
|
|
|
|
local headName = Util.GetGameObject(go, "headImage/name")
|
|
|
|
|
headName:GetComponent("Text").text = "奖励"
|
|
|
|
|
local size = headName:GetComponent("RectTransform").sizeDelta
|
|
|
|
|
size.x = 108.3
|
|
|
|
|
headName.transform.sizeDelta = size
|
2021-07-01 20:13:47 +08:00
|
|
|
|
btnText.text = "领取"
|
2021-07-03 16:49:13 +08:00
|
|
|
|
if isOpenLock then
|
|
|
|
|
Util.SetGray(getBtn,false)
|
|
|
|
|
getBtn:GetComponent("Button").enabled = true
|
|
|
|
|
if curRewardTaskData.state == 1 then
|
|
|
|
|
btnText.text = "已领取"
|
|
|
|
|
getBtn:GetComponent("Button").enabled = false
|
|
|
|
|
Util.SetGray(getBtn,true)
|
2021-07-03 12:37:56 +08:00
|
|
|
|
else
|
2021-07-03 16:49:13 +08:00
|
|
|
|
Util.AddOnceClick(getBtn, function()
|
|
|
|
|
if isGetState then
|
|
|
|
|
NetManager.GetActivityRewardRequest(curRewardTaskData.missionId, activityData.activityId, function(drop)
|
|
|
|
|
UIManager.OpenPanel(UIName.RewardItemPopup,drop,1,function()
|
|
|
|
|
btnText.text = "已领取"
|
|
|
|
|
getBtn:GetComponent("Button").enabled = false
|
|
|
|
|
Util.SetGray(getBtn,true)
|
|
|
|
|
redPoint:SetActive(false)
|
|
|
|
|
CheckRedPointStatus(RedPointType.JourneyWithWind)
|
2021-07-03 17:46:44 +08:00
|
|
|
|
this.ShowDayBtnsData()
|
2021-07-03 16:49:13 +08:00
|
|
|
|
end)
|
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
if curRewardTaskData.state == 0 then
|
|
|
|
|
PopupTipPanel.ShowTip("完成当日所有目标才可领取!")
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end)
|
2021-07-03 12:37:56 +08:00
|
|
|
|
end
|
2021-07-03 16:49:13 +08:00
|
|
|
|
else
|
|
|
|
|
Util.SetGray(getBtn,true)
|
|
|
|
|
btnText.text = "未开启"
|
|
|
|
|
getBtn:GetComponent("Button").enabled = false
|
|
|
|
|
end
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2021-07-03 12:37:56 +08:00
|
|
|
|
end
|
|
|
|
|
-- 礼包
|
|
|
|
|
function this.ShowDayDataGiftBag()
|
|
|
|
|
local go = curDayAllTaskGos[7]
|
2021-07-01 20:13:47 +08:00
|
|
|
|
local rechargecommodityData = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig,curBtnConFigData.Values[2][1])
|
2021-07-03 12:37:56 +08:00
|
|
|
|
if go and rechargecommodityData then
|
|
|
|
|
Util.GetGameObject(go, "pre1"):SetActive(false)
|
|
|
|
|
Util.GetGameObject(go, "pre2"):SetActive(true)
|
|
|
|
|
if not itemList[go.name] then
|
|
|
|
|
itemList[go.name] = {}
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #itemList[go.name] do
|
|
|
|
|
itemList[go.name][i].gameObject:SetActive(false)
|
|
|
|
|
end
|
|
|
|
|
for i = 1, #rechargecommodityData.RewardShow do
|
|
|
|
|
if itemList[go.name][i] then
|
2021-07-03 19:23:15 +08:00
|
|
|
|
itemList[go.name][i]:OnOpen(false, rechargecommodityData.RewardShow[i], 0.9,false,false,false,sorting)
|
2021-07-03 12:37:56 +08:00
|
|
|
|
else
|
|
|
|
|
itemList[go.name][i] = SubUIManager.Open(SubUIConfig.ItemView, Util.GetGameObject(go, "pre2/itemContent").transform)
|
2021-07-03 19:23:15 +08:00
|
|
|
|
itemList[go.name][i]:OnOpen(false, rechargecommodityData.RewardShow[i], 0.9,false,false,false,sorting)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end
|
2021-07-03 12:37:56 +08:00
|
|
|
|
itemList[go.name][i].gameObject:SetActive(true)
|
|
|
|
|
end
|
|
|
|
|
local rechargeData = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.DirectPurchaseGift, rechargecommodityData.Id)
|
|
|
|
|
local getBtn = Util.GetGameObject(go, "pre2/getBtn")
|
|
|
|
|
local btnText = Util.GetGameObject(getBtn, "get"):GetComponent("Text")
|
|
|
|
|
local btnFinish = Util.GetGameObject(go, "pre2/btnFinish")
|
2021-07-03 16:49:13 +08:00
|
|
|
|
btnFinish:SetActive(false)
|
2021-07-03 20:02:13 +08:00
|
|
|
|
local headName = Util.GetGameObject(go, "headImage/name")
|
|
|
|
|
headName:GetComponent("Text").text = "额外礼包"
|
|
|
|
|
local size = headName:GetComponent("RectTransform").sizeDelta
|
|
|
|
|
size.x = 108.3
|
|
|
|
|
headName.transform.sizeDelta = size
|
2021-07-03 16:49:13 +08:00
|
|
|
|
local isCurGetState = false
|
|
|
|
|
if curRewardTaskData then
|
|
|
|
|
local dayNumConFig = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig,curRewardTaskData.missionId)
|
|
|
|
|
local list = ActivityGiftManager.GetJourneyWithWindDayAmount()
|
|
|
|
|
if dayNumConFig and curRewardTaskData.progress >= list[dayNumConFig.Values[1][2]] then
|
|
|
|
|
isCurGetState = true
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
local freetimes = rechargeData.dynamicBuyTimes - rechargeData.buyTimes
|
|
|
|
|
local imageStr = (freetimes > 0 and isCurGetState) and "s_slbz_1anniuongse" or "s_slbz_1anniuhuise"
|
|
|
|
|
getBtn:GetComponent("Image").sprite = this.spLoader:LoadSprite(imageStr)
|
2021-07-03 19:23:15 +08:00
|
|
|
|
btnText.text = string.format(Language[10383],rechargecommodityData.Price)
|
2021-07-03 16:49:13 +08:00
|
|
|
|
if isOpenLock then--是否到天数
|
|
|
|
|
Util.SetGray(getBtn,false)
|
|
|
|
|
getBtn:GetComponent("Button").enabled = true
|
|
|
|
|
if freetimes > 0 and isCurGetState then
|
2021-07-03 19:23:15 +08:00
|
|
|
|
btnText.text = string.format(Language[10383],rechargecommodityData.Price)
|
2021-07-03 16:49:13 +08:00
|
|
|
|
elseif freetimes <= 0 then
|
|
|
|
|
btnText.text = "已购买"
|
|
|
|
|
getBtn:GetComponent("Button").enabled = false
|
|
|
|
|
Util.SetGray(getBtn,true)
|
|
|
|
|
end
|
|
|
|
|
Util.AddOnceClick(getBtn, function()
|
|
|
|
|
if freetimes > 0 and isCurGetState then
|
2021-07-01 20:13:47 +08:00
|
|
|
|
PayManager.Pay(rechargecommodityData.Id, function(id)
|
|
|
|
|
FirstRechargeManager.RefreshAccumRechargeValue(rechargecommodityData.Id)
|
2021-07-03 16:49:13 +08:00
|
|
|
|
btnText.text = "已购买"
|
|
|
|
|
getBtn:GetComponent("Button").enabled = false
|
|
|
|
|
Util.SetGray(getBtn,true)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end)
|
2021-07-03 16:49:13 +08:00
|
|
|
|
else
|
2021-07-01 20:13:47 +08:00
|
|
|
|
PopupTipPanel.ShowTip("完成当日所有目标才可购买!")
|
2021-07-03 16:49:13 +08:00
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
Util.SetGray(getBtn,true)
|
|
|
|
|
btnText.text = "未开启"
|
|
|
|
|
getBtn:GetComponent("Button").enabled = false
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
2021-07-03 12:37:56 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
--活动到期自动关闭
|
|
|
|
|
function this.AutoClose()
|
2021-07-03 16:49:13 +08:00
|
|
|
|
LogYellow("sssssssssssssssssssssssssss")
|
2021-07-03 12:37:56 +08:00
|
|
|
|
if this.timer then
|
|
|
|
|
this.timer:Stop()
|
|
|
|
|
this.timer = nil
|
|
|
|
|
end
|
|
|
|
|
self:ClosePanel()
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end
|
2021-07-03 12:37:56 +08:00
|
|
|
|
|
2021-07-01 20:13:47 +08:00
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
|
|
|
function JourneyWithWindPanel:OnClose()
|
|
|
|
|
if this.timer then
|
|
|
|
|
this.timer:Stop()
|
|
|
|
|
this.timer = nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
|
|
|
function JourneyWithWindPanel:OnDestroy()
|
|
|
|
|
this.spLoader:Destroy()
|
|
|
|
|
if this.timer then
|
|
|
|
|
this.timer:Stop()
|
|
|
|
|
this.timer = nil
|
|
|
|
|
end
|
|
|
|
|
itemList = {}
|
2021-07-03 12:37:56 +08:00
|
|
|
|
-- SubUIManager.Close(this.UpView)
|
2021-07-01 20:13:47 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
return JourneyWithWindPanel
|