From 5d15c9fe3cf5cd141bae27f3b988bce589158d7c Mon Sep 17 00:00:00 2001 From: vurtne14 Date: Sat, 11 Oct 2025 18:10:55 +0800 Subject: [PATCH] 1 --- .../~Lua/Common/GlobalDefine.lua | 1 + .../~Lua/Modules/Carbon/DailyCarbonPanel.lua | 267 +++++++++--------- 2 files changed, 140 insertions(+), 128 deletions(-) diff --git a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua index 4e1850c68..4e636734b 100644 --- a/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua +++ b/Assets/ManagedResources/~Lua/Common/GlobalDefine.lua @@ -1716,6 +1716,7 @@ FUNCTION_OPEN_TYPE = { DAILYCHALLENGE_HERODEBRIS = 69, -- 每日角色碎片副本 DAILYCHALLENGE_TALISMAN = 70, -- 每日法宝副本 DAILYCHALLENGE_SOULPRINT = 71, -- 每日魂印副本 + DAILYCHALLENGE_GIFT = 115, -- 每日礼物副本 GUILD_BATTLE = 72, -- 公会战 MINSKBATTLE = 73, -- 梦魇入侵 PEOPLE_MIRROR = 74, -- 腐化之战 diff --git a/Assets/ManagedResources/~Lua/Modules/Carbon/DailyCarbonPanel.lua b/Assets/ManagedResources/~Lua/Modules/Carbon/DailyCarbonPanel.lua index 755ce93a5..77ec6b7d1 100644 --- a/Assets/ManagedResources/~Lua/Modules/Carbon/DailyCarbonPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Carbon/DailyCarbonPanel.lua @@ -11,21 +11,23 @@ local showIndex = 0 local orginLayer = 0 -local carbonIndex = 0--副本索引 +local carbonIndex = 0 --副本索引 local isGoBattle = fa --顶部背景图 local titleBg = { --金币 - [1] = {bg = "X1_wuzi_banner01",icon = "X1_wuzi_jinbi",titleTip = specialConfig[41].Value, textbg = GetLanguageStrById(10328), color = Color.New(209/255,91/255,0/255,1)}, + [1] = { bg = "X1_wuzi_banner01", icon = "X1_wuzi_jinbi", titleTip = specialConfig[41].Value, textbg = GetLanguageStrById(10328), color = Color.New(209 / 255, 91 / 255, 0 / 255, 1) }, --经验 - [2] = {bg = "X1_wuzi_banner02",icon = "X1_wuzi_jingyan",titleTip = specialConfig[42].Value, textbg = GetLanguageStrById(10329), color = Color.New(0/255,119/255,241/255,1)}, + [2] = { bg = "X1_wuzi_banner02", icon = "X1_wuzi_jingyan", titleTip = specialConfig[42].Value, textbg = GetLanguageStrById(10329), color = Color.New(0 / 255, 119 / 255, 241 / 255, 1) }, --碎片 - [3] = {bg = "X1_wuzi_banner04",icon = "X1_wuzi_yingxiong",titleTip = specialConfig[43].Value, textbg = GetLanguageStrById(10330), color = Color.New(224/255,51/255,4/255,1)}, + [3] = { bg = "X1_wuzi_banner04", icon = "X1_wuzi_yingxiong", titleTip = specialConfig[43].Value, textbg = GetLanguageStrById(10330), color = Color.New(224 / 255, 51 / 255, 4 / 255, 1) }, --支援 - [4] = {bg = "X1_wuzi_banner03",icon = "X1_wuzi_shouhu",titleTip = specialConfig[44].Value, textbg = GetLanguageStrById(10331), color = Color.New(137/255,76/255,212/255,1)}, + [4] = { bg = "X1_wuzi_banner03", icon = "X1_wuzi_shouhu", titleTip = specialConfig[44].Value, textbg = GetLanguageStrById(10331), color = Color.New(137 / 255, 76 / 255, 212 / 255, 1) }, --方案 - [5] = {bg = "X1_wuzi_banner05",icon = "X1_wuzi_jiezhi",titleTip = specialConfig[45].Value, textbg = GetLanguageStrById(10332), color = Color.New(254/255,0/255,85/255,1)}, + [5] = { bg = "X1_wuzi_banner05", icon = "X1_wuzi_jiezhi", titleTip = specialConfig[45].Value, textbg = GetLanguageStrById(10332), color = Color.New(254 / 255, 0 / 255, 85 / 255, 1) }, + --礼物 + [6] = { bg = "X1_wuzi_banner01", icon = "X1_wuzi_liwu", titleTip = specialConfig[158].Value, textbg = GetLanguageStrById(1012392), color = Color.New(254 / 255, 0 / 255, 85 / 255, 1) }, } --难度图片 local qualityBg = { @@ -40,33 +42,35 @@ local qualityBg = { [9] = { color = Color.New(255 / 255, 244 / 255, 25 / 255, 255 / 255), font = GetLanguageStrById(10310) } } -local itemList = {}--奖励容器 +local itemList = {} --奖励容器 --每日副本服务器数据 -local buyTime = 0--购买次数 -local freeTime = 0--免费次数 +local buyTime = 0 --购买次数 +local freeTime = 0 --免费次数 --Tab local TabBox = require("Modules/Common/TabBox") -local _TabData = { [1] = {default = "X1_wuzi_jinbi_weixuanzhong",select = "X1_wuzi_jinbi_xuanzhong" ,lock = "X1_wuzi_jinbi_weixuanzhong", name = GetLanguageStrById(10328),type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_COIN }, - [2] = {default = "X1_wuzi_jingyan_weixuanzhong",select = "X1_wuzi_jingyan_xuanzhong" ,lock = "X1_wuzi_jingyan_weixuanzhong", name = GetLanguageStrById(10329),type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_EXP }, - [3] = {default = "X1_wuzi_suipian_weixuanzhong",select = "X1_wuzi_suipian_xuanzhong" ,lock = "X1_wuzi_suipian_weixuanzhong", name = GetLanguageStrById(10330),type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_HERODEBRIS }, - [4] = {default = "X1_wuzi_shouhu_weixuanzhong",select = "X1_wuzi_shouhu_xuanzhong" ,lock = "X1_wuzi_shouhu_weixuanzhong", name = GetLanguageStrById(10331),type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_TALISMAN }, - [5] = {default = "X1_wuzi_jiezhi_weixuanzhong",select = "X1_wuzi_jiezhi_xuanzhong" ,lock = "X1_wuzi_jiezhi_weixuanzhong", name = GetLanguageStrById(10332),type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_SOULPRINT } - } +local _TabData = { + [1] = { default = "X1_wuzi_jinbi_weixuanzhong", select = "X1_wuzi_jinbi_xuanzhong", lock = "X1_wuzi_jinbi_weixuanzhong", name = GetLanguageStrById(10328), type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_COIN }, + [2] = { default = "X1_wuzi_jingyan_weixuanzhong", select = "X1_wuzi_jingyan_xuanzhong", lock = "X1_wuzi_jingyan_weixuanzhong", name = GetLanguageStrById(10329), type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_EXP }, + [3] = { default = "X1_wuzi_suipian_weixuanzhong", select = "X1_wuzi_suipian_xuanzhong", lock = "X1_wuzi_suipian_weixuanzhong", name = GetLanguageStrById(10330), type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_HERODEBRIS }, + [4] = { default = "X1_wuzi_shouhu_weixuanzhong", select = "X1_wuzi_shouhu_xuanzhong", lock = "X1_wuzi_shouhu_weixuanzhong", name = GetLanguageStrById(10331), type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_TALISMAN }, + [5] = { default = "X1_wuzi_jiezhi_weixuanzhong", select = "X1_wuzi_jiezhi_xuanzhong", lock = "X1_wuzi_jiezhi_weixuanzhong", name = GetLanguageStrById(10332), type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_SOULPRINT }, + [6] = { default = "X1_wuzi_liwu_weixuanzhong", select = "X1_wuzi_liwu_xuanzhong", lock = "X1_wuzi_liwu_weixuanzhong", name = GetLanguageStrById(1012392), type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_GIFT } +} function DailyCarbonPanel:InitComponent() - this.panel = Util.GetGameObject(this.gameObject,"Panel") + this.panel = Util.GetGameObject(this.gameObject, "Panel") - this.bg = Util.GetGameObject(this.panel,"bg"):GetComponent("Image") - this.titleIcon = Util.GetGameObject(this.panel,"bg/title/icon"):GetComponent("Image") - this.titleText = Util.GetGameObject(this.panel,"bg/title/Text"):GetComponent("Text") - this.titleFontBg = Util.GetGameObject(this.panel,"bg/title/fontBg"):GetComponent("Image") - this.titleFont = Util.GetGameObject(this.panel,"bg/title/fontBg/Text"):GetComponent("Text") + this.bg = Util.GetGameObject(this.panel, "bg"):GetComponent("Image") + this.titleIcon = Util.GetGameObject(this.panel, "bg/title/icon"):GetComponent("Image") + this.titleText = Util.GetGameObject(this.panel, "bg/title/Text"):GetComponent("Text") + this.titleFontBg = Util.GetGameObject(this.panel, "bg/title/fontBg"):GetComponent("Image") + this.titleFont = Util.GetGameObject(this.panel, "bg/title/fontBg/Text"):GetComponent("Text") - this.timeTip = Util.GetGameObject(this.panel,"TimeTip/Text"):GetComponent("Text") + this.timeTip = Util.GetGameObject(this.panel, "TimeTip/Text"):GetComponent("Text") - this.backBtn = Util.GetGameObject(this.panel,"backBtn") + this.backBtn = Util.GetGameObject(this.panel, "backBtn") this.helpBtn = Util.GetGameObject(this.panel, "HelpBtn") this.sweepBtn = Util.GetGameObject(this.panel, "sweepBtn") this.helpPosition = this.helpBtn:GetComponent("RectTransform").localPosition @@ -76,16 +80,17 @@ function DailyCarbonPanel:InitComponent() this.scroll = Util.GetGameObject(this.panel, "Scroll") local w = this.scroll.transform.rect.width local h = this.scroll.transform.rect.height - this.scrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView,this.scroll.transform, - this.pre, nil, Vector2.New(this.scroll.transform.rect.width,this.scroll.transform.rect.height), 1, 1, Vector2.New(0, 0)) + this.scrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.scroll.transform, + this.pre, nil, Vector2.New(this.scroll.transform.rect.width, this.scroll.transform.rect.height), 1, 1, + Vector2.New(0, 0)) this.scrollView.moveTween.MomentumAmount = 1 this.scrollView.moveTween.Strength = 2 this.tabBox = Util.GetGameObject(this.panel, "TabBox") this.TabCtrl = TabBox.New() - this.HeadFrameView =SubUIManager.Open(SubUIConfig.PlayerHeadFrameView, self.gameObject.transform) - this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform, { showType = UpViewOpenType.ShowRight}) + this.HeadFrameView = SubUIManager.Open(SubUIConfig.PlayerHeadFrameView, self.gameObject.transform) + this.UpView = SubUIManager.Open(SubUIConfig.UpView, self.transform, { showType = UpViewOpenType.ShowRight }) end function DailyCarbonPanel:BindEvent() @@ -96,7 +101,7 @@ function DailyCarbonPanel:BindEvent() end) --帮助按钮 Util.AddClick(this.helpBtn, function() - UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.DailyCarbon,this.helpPosition.x,this.helpPosition.y) + UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.DailyCarbon, this.helpPosition.x, this.helpPosition.y) end) --一键扫荡 @@ -107,15 +112,16 @@ function DailyCarbonPanel:BindEvent() return end - local data = ConfigManager.GetConfigDataByKey("DailyChallengeConfig","Type",carbonIndex) - local storeData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.StoreConfig,"StoreId",7,"Limit",data.PrivilegeId[1])--商店表数据 + local data = ConfigManager.GetConfigDataByKey("DailyChallengeConfig", "Type", carbonIndex) + local storeData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.StoreConfig, "StoreId", 7, "Limit", + data.PrivilegeId[1]) --商店表数据 --钻石消耗提示 if buyTime > 0 then - local itemName = ConfigManager.GetConfigDataByKey("ItemConfig","Id",storeData.Cost[1][1]) - if BagManager.GetItemCountById(storeData.Cost[1][1]) >= storeData.Cost[2][4]*buyTime then - -- if freeTime > 0 then - -- NetManager.CopyOneKeySweepRequest(carbonIndex,false,function(msg) + local itemName = ConfigManager.GetConfigDataByKey("ItemConfig", "Id", storeData.Cost[1][1]) + if BagManager.GetItemCountById(storeData.Cost[1][1]) >= storeData.Cost[2][4] * buyTime then + -- if freeTime > 0 then + -- NetManager.CopyOneKeySweepRequest(carbonIndex,false,function(msg) -- UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function() -- if freeTime > 0 then -- PrivilegeManager.RefreshPrivilegeUsedTimes(data.PrivilegeId[2],freeTime) @@ -124,40 +130,41 @@ function DailyCarbonPanel:BindEvent() -- end) -- end) -- else - local str_1 =string.format(GetLanguageStrById(50279), freeTime ,buyTime,storeData.Cost[2][4]*buyTime,GetLanguageStrById(itemName.Name)) - UIManager.OpenPanel(UIName.GeneralPopup, GENERAL_POPUP_TYPE.Choose,str_1, nil, function(_usebuy) - NetManager.CopyOneKeySweepRequest(carbonIndex,_usebuy,function(msg) - local shopData = ShopManager.GetShopDataByType(SHOP_TYPE.FUNCTION_SHOP) - for _, v in ipairs(shopData.storeItem) do - if v.id == storeData.Id then - if _usebuy then - v.buyNum = v.buyNum + buyTime - else - v.buyNum = v.buyNum - end - break + local str_1 = string.format(GetLanguageStrById(50279), freeTime, buyTime, + storeData.Cost[2][4] * buyTime, GetLanguageStrById(itemName.Name)) + UIManager.OpenPanel(UIName.GeneralPopup, GENERAL_POPUP_TYPE.Choose, str_1, nil, function(_usebuy) + NetManager.CopyOneKeySweepRequest(carbonIndex, _usebuy, function(msg) + local shopData = ShopManager.GetShopDataByType(SHOP_TYPE.FUNCTION_SHOP) + for _, v in ipairs(shopData.storeItem) do + if v.id == storeData.Id then + if _usebuy then + v.buyNum = v.buyNum + buyTime + else + v.buyNum = v.buyNum end + break end - UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function() - -- if freeTime > 0 then - PrivilegeManager.RefreshPrivilegeUsedTimes(data.PrivilegeId[2],freeTime) - -- end - this.OnTabChange(carbonIndex) - end) + end + UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1, function() + -- if freeTime > 0 then + PrivilegeManager.RefreshPrivilegeUsedTimes(data.PrivilegeId[2], freeTime) + -- end + this.OnTabChange(carbonIndex) end) end) - -- MsgPanel.ShowTwo(, nil,) + end) + -- MsgPanel.ShowTwo(, nil,) -- end else - PopupTipPanel.ShowTip(string.format(GetLanguageStrById(10343),GetLanguageStrById(itemName.Name))) + PopupTipPanel.ShowTip(string.format(GetLanguageStrById(10343), GetLanguageStrById(itemName.Name))) end return end - NetManager.CopyOneKeySweepRequest(carbonIndex, false, function(msg) - UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function() + NetManager.CopyOneKeySweepRequest(carbonIndex, false, function(msg) + UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1, function() if freeTime > 0 then - PrivilegeManager.RefreshPrivilegeUsedTimes(data.PrivilegeId[2],freeTime) + PrivilegeManager.RefreshPrivilegeUsedTimes(data.PrivilegeId[2], freeTime) end this.OnTabChange(carbonIndex) end) @@ -178,11 +185,11 @@ function DailyCarbonPanel:OnSortingOrderChange() end function DailyCarbonPanel:AddListener() - Game.GlobalEvent:AddEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh,this.FiveRefresh) + Game.GlobalEvent:AddEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.FiveRefresh) end function DailyCarbonPanel:RemoveListener() - Game.GlobalEvent:RemoveEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh,this.FiveRefresh) + Game.GlobalEvent:RemoveEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.FiveRefresh) end function DailyCarbonPanel:OnOpen(_carbonIndex) @@ -198,15 +205,16 @@ function DailyCarbonPanel:OnShow() this.TabCtrl:SetTabAdapter(this.TabAdapter) this.TabCtrl:SetTabIsLockCheck(this.TabIsLockCheck) this.TabCtrl:SetChangeTabCallBack(this.OnTabChange) - this.TabCtrl:Init_SetTabAndBox(this.tabBox, _TabData, carbonIndex, Util.GetGameObject(this.tabBox, "tab"), Util.GetGameObject(this.tabBox, "box")) + this.TabCtrl:Init_SetTabAndBox(this.tabBox, _TabData, carbonIndex, Util.GetGameObject(this.tabBox, "tab"), + Util.GetGameObject(this.tabBox, "box")) -- 音效 SoundManager.PlayMusic(SoundConfig.BGM_Carbon) end function DailyCarbonPanel:RefreshRedPotShow() - local tabs = Util.GetGameObject(this.tabBox,"box").transform - for i = 1,tabs.childCount do - Util.GetGameObject(tabs:GetChild(i-1),"Redpot").gameObject:SetActive(CarbonManager.GetDailyCarbons(i).state) + local tabs = Util.GetGameObject(this.tabBox, "box").transform + for i = 1, tabs.childCount do + Util.GetGameObject(tabs:GetChild(i - 1), "Redpot").gameObject:SetActive(CarbonManager.GetDailyCarbons(i).state) end CheckRedPointStatus(RedPointType.HeroExplore) end @@ -231,7 +239,7 @@ function this.OnTabChange(i) carbonIndex = i curData = {} - curData = ConfigManager.GetAllConfigsDataByKey(ConfigName.DailyChallengeConfig,"Type",i) + curData = ConfigManager.GetAllConfigsDataByKey(ConfigName.DailyChallengeConfig, "Type", i) this.bg.sprite = Util.LoadSprite(titleBg[i].bg) this.titleIcon.sprite = Util.LoadSprite(titleBg[i].icon) @@ -250,14 +258,14 @@ function this.SetScroll(_index) for i = 1, #curData do local ldata = nil - if curData[i-1] ~= nil then - ldata = curData[i-1] + if curData[i - 1] ~= nil then + ldata = curData[i - 1] end local data = curData[i] - local _lv = 0--等级 - local _point = 0--关卡 - local _power = 0--data.ForceShow--表战力 + local _lv = 0 --等级 + local _point = 0 --关卡 + local _power = 0 --data.ForceShow--表战力 for i = 1, #data.OpenRules do if data.OpenRules[i][1] == 1 then _lv = data.OpenRules[i][2] @@ -278,9 +286,9 @@ function this.SetScroll(_index) end local isOpen = (not ldata or CarbonManager.IsDailyCarbonPass(ldata.Id)) -- 上一个副本解锁 - and PlayerManager.level >= _lv -- 等级 - and (_point == 0 or FightPointPassManager.IsFightPointPass(_point)) - and PlayerManager.maxForce >= _power -- 战斗力 + and PlayerManager.level >= _lv -- 等级 + and (_point == 0 or FightPointPassManager.IsFightPointPass(_point)) + and PlayerManager.maxForce >= _power -- 战斗力 -- if isOpen and not CarbonManager.IsDailyCarbonPass(data.Id) then -- showIndex = _index @@ -288,8 +296,8 @@ function this.SetScroll(_index) end -- local itemList = {} - this.scrollView:SetData(curData,function(index,root) - this.SetData(root,curData[index], curData[index - 1]) + this.scrollView:SetData(curData, function(index, root) + this.SetData(root, curData[index], curData[index - 1]) -- itemList[index] = root end) Util.SetGray(this.sweepBtn, not this.isOk) @@ -302,26 +310,27 @@ end function this.SetData(root, data, ldata) -- root:SetActive(true) local type = 0 --0为未开启 1为挑战 2为扫荡 - local title = Util.GetGameObject(root,"Title"):GetComponent("Text") - local reward = Util.GetGameObject(root,"Reward") - local tip = Util.GetGameObject(root,"Tip"):GetComponent("Text") + local title = Util.GetGameObject(root, "Title"):GetComponent("Text") + local reward = Util.GetGameObject(root, "Reward") + local tip = Util.GetGameObject(root, "Tip"):GetComponent("Text") - local goBtn = Util.GetGameObject(root,"GoBtn") - local sweep = Util.GetGameObject(goBtn,"sweep") - local challenge = Util.GetGameObject(goBtn,"challenge") + local goBtn = Util.GetGameObject(root, "GoBtn") + local sweep = Util.GetGameObject(goBtn, "sweep") + local challenge = Util.GetGameObject(goBtn, "challenge") - local Consume = Util.GetGameObject(root,"Consume") + local Consume = Util.GetGameObject(root, "Consume") -- local goIcon = Util.GetGameObject(root,"Consume/Icon") - local goIconNum = Util.GetGameObject(root,"Consume/Num"):GetComponent("Text") + local goIconNum = Util.GetGameObject(root, "Consume/Num"):GetComponent("Text") - local storeData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.StoreConfig,"StoreId",7,"Limit",data.PrivilegeId[1])--商店表数据 + local storeData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.StoreConfig, "StoreId", 7, "Limit", + data.PrivilegeId[1]) --商店表数据 title.text = qualityBg[data.Quality].font title.color = qualityBg[data.Quality].color - ResetItemView(root,reward.transform,itemList,3,1,orginLayer,false,data.RewardView) + ResetItemView(root, reward.transform, itemList, 3, 1, orginLayer, false, data.RewardView) --解锁状态 - local _lv = 0 --等级 + local _lv = 0 --等级 local _point = 0 --关卡 local _power = 0 --data.ForceShow--表战力 @@ -347,9 +356,9 @@ function this.SetData(root, data, ldata) local maxPower = FormationManager.GetMaxPowerForTeamID() -- 判断每日副本是否解锁 local isOpen = (not ldata or CarbonManager.IsDailyCarbonPass(ldata.Id)) -- 上一个副本解锁 - and PlayerManager.level >= _lv -- 等级 + and PlayerManager.level >= _lv -- 等级 and (_point == 0 or FightPointPassManager.IsFightPointPass(_point)) - and maxPower >= _power -- 战斗力 + and maxPower >= _power -- 战斗力 --显示挑战或扫荡道具消耗 Consume:SetActive(isOpen and freeTime <= 0) @@ -357,8 +366,8 @@ function this.SetData(root, data, ldata) goIconNum.text = storeData.Cost[2][4] end - Util.GetGameObject(challenge,"Text"):GetComponent("Text").text = GetLanguageStrById(10334) - Util.GetGameObject(sweep,"Text"):GetComponent("Text").text = GetLanguageStrById(10336) + Util.GetGameObject(challenge, "Text"):GetComponent("Text").text = GetLanguageStrById(10334) + Util.GetGameObject(sweep, "Text"):GetComponent("Text").text = GetLanguageStrById(10336) --表现显示 Util.SetGray(goBtn, not isOpen) if isOpen then @@ -366,7 +375,7 @@ function this.SetData(root, data, ldata) goBtn:SetActive(true) tip.gameObject:SetActive(false) sweep:SetActive(false) - if CarbonManager.IsDailyCarbonPass(data.Id) then--扫荡 + if CarbonManager.IsDailyCarbonPass(data.Id) then --扫荡 this.isOk = true type = 2 sweep:SetActive(true) @@ -375,41 +384,42 @@ function this.SetData(root, data, ldata) type = 0 goBtn:SetActive(false) tip.gameObject:SetActive(true) - tip.text = string.format(GetLanguageStrById(10338),_power) + tip.text = string.format(GetLanguageStrById(10338), _power) end --点击事件 Util.AddOnceClick(goBtn, function() local func = function() if PlayerManager.level < _lv then - PopupTipPanel.ShowTip(string.format(GetLanguageStrById(10340),_lv)) + PopupTipPanel.ShowTip(string.format(GetLanguageStrById(10340), _lv)) return elseif maxPower < _power then PopupTipPanel.ShowTip(string.format(GetLanguageStrById(12219), _power)) - return + return elseif _point ~= 0 and not FightPointPassManager.IsFightPointPass(_point) then PopupTipPanel.ShowTip(string.format(GetLanguageStrById(12220), mainLevelConfig[_point].Name)) - return - -- elseif PlayerManager.curMapId ~= 0 and FightPointPassManager.IsFightPointPass(PlayerManager.curMapId)==false then - -- PopupTipPanel.ShowTip(string.format(GetLanguageStrById(10341),mainLevelConfig[_point].Name)) - -- return + return + -- elseif PlayerManager.curMapId ~= 0 and FightPointPassManager.IsFightPointPass(PlayerManager.curMapId)==false then + -- PopupTipPanel.ShowTip(string.format(GetLanguageStrById(10341),mainLevelConfig[_point].Name)) + -- return end - + if not isOpen then PopupTipPanel.ShowTip(GetLanguageStrById(12191)) return end - + --检测剩余次数 if buyTime <= 0 and freeTime <= 0 then PopupTipPanel.ShowTip(GetLanguageStrById(10342)) return end - + --检测妖晶数量 local itemId = storeData.Cost[1][1] --消耗道具 if BagManager.GetItemCountById(itemId) < storeData.Cost[2][4] and freeTime <= 0 then - PopupTipPanel.ShowTip(string.format(GetLanguageStrById(10343),GetLanguageStrById(itemConfig[itemId].Name))) + PopupTipPanel.ShowTip(string.format(GetLanguageStrById(10343), + GetLanguageStrById(itemConfig[itemId].Name))) return end @@ -420,7 +430,6 @@ function this.SetData(root, data, ldata) isGoBattle = true NetManager.DailyChallengeRequest(data.Id, type, function(msg) - ThinkingAnalyticsManager.Track("train_start", { train_start_id = data.Id }) @@ -428,30 +437,31 @@ function this.SetData(root, data, ldata) local fightData = BattleManager.GetBattleServerData(msg) fightData.mapName = this.GetMapName(data.Type) if type == 1 then --挑战 - BattleManager.SetAgainstInfoAICommon(BATTLE_TYPE.CollectMaterials, G_DailyChallengeConfig[data.Id].MonsterId) + BattleManager.SetAgainstInfoAICommon(BATTLE_TYPE.CollectMaterials, + G_DailyChallengeConfig[data.Id].MonsterId) UIManager.OpenPanel(UIName.BattleStartPopup, function() - UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.CollectMaterials , function(result) - if result.result == 0 then - this.SetTimeTip() - this:RefreshRedPotShow() - this.SetScroll() - isGoBattle = false - elseif result.result == 1 then - UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function() - PrivilegeManager.RefreshPrivilegeUsedTimes(data.PrivilegeId[2],1) - CarbonManager.AddDailyChallengeInfo(data.Id) - -- this.RefreshShow(carbonIndex) + UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.CollectMaterials, function(result) + if result.result == 0 then this.SetTimeTip() this:RefreshRedPotShow() this.SetScroll() isGoBattle = false - end) - end + elseif result.result == 1 then + UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1, function() + PrivilegeManager.RefreshPrivilegeUsedTimes(data.PrivilegeId[2], 1) + CarbonManager.AddDailyChallengeInfo(data.Id) + -- this.RefreshShow(carbonIndex) + this.SetTimeTip() + this:RefreshRedPotShow() + this.SetScroll() + isGoBattle = false + end) + end + end) end) - end) elseif type == 2 then --扫荡 - UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1,function() - PrivilegeManager.RefreshPrivilegeUsedTimes(data.PrivilegeId[2],1) + UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1, function() + PrivilegeManager.RefreshPrivilegeUsedTimes(data.PrivilegeId[2], 1) -- this.RefreshShow(carbonIndex) this.SetTimeTip() this:RefreshRedPotShow() @@ -478,33 +488,34 @@ end --设置剩余次数 function this.SetTimeTip() - local storeData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.StoreConfig,"StoreId",7,"Limit",curData[1].PrivilegeId[1])--商店表数据 + local storeData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.StoreConfig, "StoreId", 7, "Limit", + curData[1].PrivilegeId[1]) --商店表数据 local buyTimeId = curData[1].PrivilegeId[1] local freeTimeId = curData[1].PrivilegeId[2] - buyTime = ShopManager.GetShopItemRemainBuyTimes(SHOP_TYPE.FUNCTION_SHOP,storeData.Id) --购买次数 - freeTime = PrivilegeManager.GetPrivilegeRemainValue(freeTimeId) --免费次数 + buyTime = ShopManager.GetShopItemRemainBuyTimes(SHOP_TYPE.FUNCTION_SHOP, storeData.Id) --购买次数 + freeTime = PrivilegeManager.GetPrivilegeRemainValue(freeTimeId) --免费次数 local str = "" if freeTime > 0 then - str = string.format(GetLanguageStrById(10344),""..tostring(freeTime).."") + str = string.format(GetLanguageStrById(10344), "" .. tostring(freeTime) .. "") else - str = string.format(GetLanguageStrById(10345),""..tostring(buyTime).."") + str = string.format(GetLanguageStrById(10345), "" .. tostring(buyTime) .. "") end this.timeTip.text = str end -- tab节点显示自定义 function this.TabAdapter(tab, index, status) - local select = Util.GetGameObject(tab,"select") + local select = Util.GetGameObject(tab, "select") local lock = Util.GetGameObject(tab, "LockImage") lock:SetActive(status == "lock") select:SetActive(status == "select") - local bg = Util.GetGameObject(tab,"bg"):GetComponent("Image") + local bg = Util.GetGameObject(tab, "bg"):GetComponent("Image") bg.sprite = Util.LoadSprite(GetPictureFont(_TabData[index][status])) end function this.TabIsLockCheck(index) if not ActTimeCtrlManager.SingleFuncState(_TabData[index].type) then - return true,ActTimeCtrlManager.SystemOpenTip(_TabData[index].type) + return true, ActTimeCtrlManager.SystemOpenTip(_TabData[index].type) end return false end @@ -521,4 +532,4 @@ function this.GetMapName(type) return typeToMap[type] end -return DailyCarbonPanel \ No newline at end of file +return DailyCarbonPanel