From b7cd64f97754a675b5bcd21f4a98247c3ab033f0 Mon Sep 17 00:00:00 2001 From: JieLing Date: Mon, 28 Sep 2020 14:11:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E6=9C=8D=E7=8B=82=E6=AC=A2=E4=B8=8D?= =?UTF-8?q?=E5=8F=AF=E5=AE=8C=E6=88=90=E5=A5=96=E5=8A=B1=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E6=97=A5=E5=B8=B8=E4=BB=BB=E5=8A=A1=E5=BC=B9=E6=B4=BB?= =?UTF-8?q?=E5=8A=A8=E5=85=B3=E9=97=AD=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Modules/Carbon/XuanYuanMirrorPanel.lua | 2 +- ...ssionDailyPanel_QingLongSecretTreasure.lua | 85 +++++++++++-------- .../MissionDailyPanel_SecretTreasureTrail.lua | 35 ++++---- .../Mission/QinglongSerectTreasureManager.lua | 13 +-- .../SevenDayCarnivalPanelV2.lua | 19 ++++- 5 files changed, 91 insertions(+), 63 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Modules/Carbon/XuanYuanMirrorPanel.lua b/Assets/ManagedResources/~Lua/Modules/Carbon/XuanYuanMirrorPanel.lua index bdd3709711..0813ccc51a 100644 --- a/Assets/ManagedResources/~Lua/Modules/Carbon/XuanYuanMirrorPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Carbon/XuanYuanMirrorPanel.lua @@ -144,7 +144,7 @@ this.UpdateCarbonContent = function(...) Util.GetGameObject(go, "redPoint").gameObject:SetActive(false) end end - Util.SetGray(go,not state) + Util.SetGray(go, not state) Util.AddOnceClick(go ,function() if state then UIManager.OpenPanel(UIName.XuanYuanMirrorPanelList,k) diff --git a/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_QingLongSecretTreasure.lua b/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_QingLongSecretTreasure.lua index 4a682fb909..0644bdef72 100644 --- a/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_QingLongSecretTreasure.lua +++ b/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_QingLongSecretTreasure.lua @@ -59,21 +59,24 @@ 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() Timer.New(function() if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureOfSomeBody) then + LogBlue("1111111") PopupTipPanel.ShowTip(Language[12320]) - parent:ClosePanel() + if parent then + parent:ClosePanel() + end return else this.refresh() @@ -83,7 +86,7 @@ end function this:OnShow(_parent,...) parent=_parent sortingOrder = _parent.sortingOrder - if not ActivityGiftManager.GetActivityOpenStatus(ActivityTypeDef.TreasureOfSomeBody) then + if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureOfSomeBody) then parent:ClosePanel() return end @@ -121,7 +124,7 @@ end --topBar按钮状态 function this:topBar() --设置礼包购买按钮状态 - treasureState = QinglongSerectTreasureManager.GetTreasureState()--秘宝礼包状态 0:可购买 1:已购买 + treasureState = QinglongSerectTreasureManager.GetTreasureState()--秘宝礼包状态 false:可购买 true:已购买 curScore = QinglongSerectTreasureManager.GetScore() local lv = QinglongSerectTreasureManager.GetLevel() this.lv.text = lv @@ -151,17 +154,17 @@ function this:topBar() this.buyBtn:GetComponent("Button").enabled = false this.buyBtnText.text = Language[12351] end - this.jiesuoBtn:GetComponent("Button").enabled = (treasureState == 0) - this.jiesuoBtnText.text = ((treasureState == 0) and Language[12352] or Language[12353]) + this.jiesuoBtn:GetComponent("Button").enabled = (not treasureState) + this.jiesuoBtnText.text = ((not treasureState) and Language[12352] or Language[12353]) Util.AddOnceClick(this.jiesuoBtn,function() UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.HeavenUnlockExtraRewardPanel,2) end) local times = PrivilegeManager.GetPrivilegeRemainValue(1007) - this.box :GetComponent("Image").enabled = (treasureState == 0) - this.extra:GetComponent("Button").enabled = ((not (treasureState == 0)) and (times > 0)) - this.canOpenExtra.gameObject:SetActive((not (treasureState == 0)) and (times > 0)) + 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((not (treasureState == 0)) 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() @@ -191,25 +194,35 @@ function this:showTaskList() this.ScrollView:SetData(rewardData,function(index, rewardItem) this:SingleTask(rewardItem, rewardData[index]) end) - - -- --定位打开界面时位置 - -- local t = 0 - -- if treasureState == 0 then - -- for i = 1, #rewardStateData do - -- if rewardStateData[i].state == 0 then - -- t = i - -- break - -- end - -- end - -- elseif treasureState == 1 then - -- for i = 1, #rewardStateData do - -- if rewardStateData[i].state == 1 or rewardStateData[i].state == 0 then - -- t = i - -- breakPopupTipPanel - -- end - -- end - -- end - --this.ScrollView:SetIndex(t-2) + local index = 0 + if QinglongSerectTreasureManager.GetLevel() == 1 then + index = 1 + else + 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 + index = k + break + elseif v.state == 0 and (not treasureState) and (k >= 35) then + index = 35 + break + end + end + if index == 0 then + for i = #rewardData , 1 , -1 do + if (rewardData[i].state == -1) or (rewardData[i].state == 1 and not treasureState) then + index = i + break + end + end + end + end + this.ScrollView:SetIndex(index) end @@ -239,7 +252,7 @@ function this:SingleTask(rewardItem, rewardSingleData) else itemsList[rewardItem][i].gameObject.transform:SetParent(box2.transform) 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]:OnOpen(false, rewardSingleData.Reward[i].item, 0.8, false) else @@ -267,7 +280,7 @@ function this:InitButtonState(rewardItem, rewardSingleData) --当前任务领取情况 local state = rewardSingleData.state Util.GetGameObject(get.gameObject, "Image"):SetActive(state == -1) - redPoint:SetActive(state == 0 or (state == 1 and treasureState > 0)) + redPoint:SetActive(state == 0 or (state == 1 and treasureState)) get.sprite = Util.LoadSprite(type[state].sprite) get.enabled = true text.text = type[state].text @@ -286,20 +299,20 @@ end function this:OnBtnDealClicked(rewardItem,rewardSingleData) if rewardSingleData.state ~= -2 then--分数达到要求 if (rewardSingleData.state == 0) or--任务未领取 - (rewardSingleData.state == 1 and treasureState > 0) then--任务未领取+礼包已购买 + (rewardSingleData.state == 1 and treasureState) then--任务未领取+礼包已购买 local id = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.TreasureOfSomeBody) LogBlue("activityId:"..id) NetManager.GetActivityRewardRequest(rewardSingleData.level,id,function(msg) UIManager.OpenPanel(UIName.RewardItemPopup,msg,1) --需要刷新界面 - if treasureState == 0 then--判断是否已经购买了礼包 + if not treasureState then--判断是否已经购买了礼包 QinglongSerectTreasureManager.SetSingleRewardState(rewardSingleData.level,1) else QinglongSerectTreasureManager.SetSingleRewardState(rewardSingleData.level,-1) end this.refresh()--刷新界面 end) - elseif rewardSingleData.state == 1 and treasureState == 0 then----任务已领取+礼包未购买(弹出购买界面) + elseif rewardSingleData.state == 1 and (not treasureState) then----任务已领取+礼包未购买(弹出购买界面) UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.HeavenUnlockExtraRewardPanel,2) end else--分数未达到要求 @@ -316,9 +329,9 @@ function this:ShowTime(endtime) this.remainTime.text = Language[12321]..TimeToDHMS(timeDown) self.timer = Timer.New(function() if timeDown < 1 then + this.remainTime.text = Language[12321]..TimeToDHMS(0) self.timer:Stop() self.timer = nil - this.Closefunction() return end timeDown = timeDown - 1 diff --git a/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_SecretTreasureTrail.lua b/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_SecretTreasureTrail.lua index 5a36ceb4cf..b8a54ac0b0 100644 --- a/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_SecretTreasureTrail.lua +++ b/Assets/ManagedResources/~Lua/Modules/Mission/MissionDailyPanel_SecretTreasureTrail.lua @@ -75,7 +75,6 @@ function this:RemoveListener() Game.GlobalEvent:RemoveEvent(GameEvent.TreasureOfHeaven.RechargeQinglongSerectSuccess, this.refresh,curType) Game.GlobalEvent:RemoveEvent(GameEvent.TreasureOfHeaven.TaskRefresh, this.RefreshTime) Game.GlobalEvent:RemoveEvent(GameEvent.Activity.OnActivityOpenOrClosen,this.CloseFunction) - Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, this.refresh,curType) end @@ -85,14 +84,17 @@ function this.RefreshTime() end) end -this.Closefunction = function() +this.CloseFunction = function() Timer.New(function() if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureOfSomeBody) then + LogBlue("22222222222") PopupTipPanel.ShowTip(Language[12320]) - parent:ClosePanel() + if parent then + parent:ClosePanel() + end return else - this.refresh(curType) + this.RefreshTime() end end,1):Start() end @@ -100,7 +102,7 @@ end function this:OnShow(_parent,...) parent=_parent sortingOrder = _parent.sortingOrder - if not ActivityGiftManager.GetActivityOpenStatus(ActivityTypeDef.TreasureOfSomeBody) then + if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.TreasureOfSomeBody) then parent:ClosePanel() return end @@ -110,17 +112,17 @@ end --topBar按钮状态 function this:SetTopBar() treasureState = QinglongSerectTreasureManager.GetTreasureState()--秘宝礼包状态 0:可购买 1:已购买 - this.jiesuoBtn:GetComponent("Button").enabled = (treasureState == 0) - this.jiesuoBtnText.text = ((treasureState == 0) and Language[12352] or Language[12353]) + this.jiesuoBtn:GetComponent("Button").enabled = (not treasureState) + this.jiesuoBtnText.text = ((not treasureState) and Language[12352] or Language[12353]) Util.AddOnceClick(this.jiesuoBtn,function() UIManager.OpenPanel(UIName.GeneralPopup,GENERAL_POPUP_TYPE.HeavenUnlockExtraRewardPanel,2) end) local times = PrivilegeManager.GetPrivilegeRemainValue(1007) - this.box:GetComponent("Image").enabled = (treasureState == 0) - this.extra:GetComponent("Button").enabled = ((not (treasureState == 0)) and (times > 0)) - this.canOpenExtra.gameObject:SetActive((not (treasureState == 0)) and (times > 0)) + 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((not (treasureState == 0)) 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() @@ -201,7 +203,7 @@ local type={ } --单个任务 function this:SingleTask(go, rewardSingleData) - local activityRewardGo = go + local activityRewardGo = go activityRewardGo:SetActive(true) local sConFigData = rewardSingleData local strs = string.split(sConFigData.show) @@ -247,14 +249,13 @@ function this:ShowTime(curType) this.remainTime.text = Language[12321]..TimeToDHMS(timeDown) self.timer = Timer.New(function() if timeDown < 1 then + this.remainTime.text = Language[12321]..TimeToDHMS(0) self.timer:Stop() self.timer = nil - this.RefreshTime() - if ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.TreasureOfSomeBody) - GetTimeStamp() < 1 then - this.Closefunction() - end - return + this.RefreshTime() + return end + timeDown = timeDown - 1 this.remainTime.text = Language[12321]..TimeToDHMS(timeDown) end, 1, -1, true) diff --git a/Assets/ManagedResources/~Lua/Modules/Mission/QinglongSerectTreasureManager.lua b/Assets/ManagedResources/~Lua/Modules/Mission/QinglongSerectTreasureManager.lua index bf99971563..e0bc34dbca 100644 --- a/Assets/ManagedResources/~Lua/Modules/Mission/QinglongSerectTreasureManager.lua +++ b/Assets/ManagedResources/~Lua/Modules/Mission/QinglongSerectTreasureManager.lua @@ -8,6 +8,8 @@ this.scoreId = 0 this.score = 0 this.traiWeekTime = 0 this.level = 0 +this.hadBuyTreasure = false + function this.Initialize() this.InitializeData() end @@ -92,7 +94,7 @@ function this.UpdateTreasureState2() local activityId = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.TreasureOfSomeBody) if this.rewardData[activityId] then for k,v in pairs(this.rewardData[activityId]) do - if level < k or (level >= k and this.GetTreasureState() < 1 and v.type == 1) then + if level < k or (level >= k and (not this.GetTreasureState()) and v.type == 1) then v.state = -2 elseif v.state == -2 then v.state = 0 @@ -130,8 +132,7 @@ function this.GetTimeShow(data) end function this.GetTreasureState() - this.TreasrueState = OperatingManager.GetGoodsBuyTime(GoodsTypeDef.FindBaby,5001) - return this.TreasrueState + return this.hadBuyTreasure end function this.GetScore() @@ -169,7 +170,9 @@ end function this.SetLevel(_level) this.level = _level end - +function this.SetTreasureBuyStatus(hadBuy) + this.hadBuyTreasure = (hadBuy == 1) +end function this.GetLevel() if not ActivityGiftManager.GetActivityOpenStatus(ActivityTypeDef.TreasureOfSomeBody) then return 0 @@ -210,7 +213,7 @@ function this.GetQinglongSerectTreasureRedPot() local activityId = ActivityGiftManager.GetActivityIdByType(ActivityTypeDef.TreasureOfSomeBody) for i, v in pairs(this.rewardData[activityId]) do if i ~= 0 then - if v.state == 0 or (v.state == 1 and state > 0) then + if v.state == 0 or (v.state == 1 and state) then return true end end diff --git a/Assets/ManagedResources/~Lua/Modules/SevenDayCarnival/SevenDayCarnivalPanelV2.lua b/Assets/ManagedResources/~Lua/Modules/SevenDayCarnival/SevenDayCarnivalPanelV2.lua index 1810e5f516..f03d4e3fd1 100644 --- a/Assets/ManagedResources/~Lua/Modules/SevenDayCarnival/SevenDayCarnivalPanelV2.lua +++ b/Assets/ManagedResources/~Lua/Modules/SevenDayCarnival/SevenDayCarnivalPanelV2.lua @@ -457,16 +457,27 @@ function this.SingleItemDataShow(go, data) --Util.GetGameObject(go, "current/redPoint"):SetActive(curServerTask.state == 1) Util.GetGameObject(go, "current/finished"):SetActive(curServerTask.state == 2) Util.GetGameObject(go, "current/buyBtn"):SetActive(false) - jumpBtn:SetActive(curServerTask.state == 0) Util.GetGameObject(go, "current/progress"):SetActive(not curServerTask.state == 2) Util.AddOnceClick(dealBtn, function() NetManager.TakeMissionRewardRequest(TaskTypeDef.SevenDayCarnival, curServerTask.missionId, function(respond) UIManager.OpenPanel(UIName.RewardItemPopup, respond.drop, 1) end) end) - Util.AddOnceClick(jumpBtn, function() - JumpManager.GoJump(data.Jump[1]) - end) + -- 判断是否需要跳转 + if curServerTask.state == 0 then + jumpBtn:SetActive(true) + local isJump = data.Jump and data.Jump[1] and data.Jump[1] ~= 0 + local btnText = Util.GetGameObject(jumpBtn, "Text"):GetComponent("Text") + btnText.text = isJump and Language[10023] or Language[10366] + Util.SetGray(jumpBtn, not isJump) + Util.AddOnceClick(jumpBtn, function() + if isJump then + JumpManager.GoJump(data.Jump[1]) + end + end) + else + jumpBtn:SetActive(false) + end end --界面关闭时调用(用于子类重写) function SevenDayCarnivalPanelV2:OnClose()