miduo_client/Assets/ManagedResources/~Lua/Modules/Carbon/DailyCarbonPanel.lua

472 lines
20 KiB
Lua
Raw Normal View History

2025-03-14 11:58:20 +08:00
----- 日常副本 -----
2020-05-09 13:31:21 +08:00
require("Base/BasePanel")
DailyCarbonPanel = Inherit(BasePanel)
local this = DailyCarbonPanel
2024-09-06 10:38:56 +08:00
local dailyChallengeConfig = ConfigManager.GetConfig(ConfigName.DailyChallengeConfig)
2020-05-09 13:31:21 +08:00
local mainLevelConfig = ConfigManager.GetConfig(ConfigName.MainLevelConfig)
2024-09-06 10:38:56 +08:00
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
local specialConfig = ConfigManager.GetConfig(ConfigName.SpecialConfig)
local curData = {}
2020-05-09 13:31:21 +08:00
2024-09-06 10:38:56 +08:00
local orginLayer = 0
2020-05-09 13:31:21 +08:00
2024-09-06 10:38:56 +08:00
local carbonIndex = 0 --副本索引
2020-08-22 15:31:14 +08:00
local maxForce = 0
2020-05-09 13:31:21 +08:00
--顶部背景图
2024-09-06 10:38:56 +08:00
local titleBg = {
2020-07-29 17:50:15 +08:00
--金币
2025-09-30 20:09:14 +08:00
[1] = { bg = "z_zhaohuan_banner_01", titleImg = Language[10327], titleTip = GetLanguageStrById(specialConfig[41].Value), pos = Vector3.New(257.08, 658.37, 0) },
2020-07-29 17:50:15 +08:00
--经验
2025-09-30 20:09:14 +08:00
[2] = { bg = "r_richang_banner_4", titleImg = Language[10325], titleTip = GetLanguageStrById(specialConfig[42].Value), pos = Vector3.New(257.08, 651.24, 0) },
2020-07-29 17:50:15 +08:00
--神将
2025-09-30 20:09:14 +08:00
[3] = { bg = "z_zhaohuan_banner_03", titleImg = Language[10326], titleTip = GetLanguageStrById(specialConfig[43].Value), pos = Vector3.New(257.08, 658.37, 0) },
2020-07-29 17:50:15 +08:00
--法宝
2025-10-24 16:40:40 +08:00
[4] = { bg = "z_zhaohuan_banner_01", titleImg = GetLanguageStrById("法宝聚灵副本"), titleTip = GetLanguageStrById(specialConfig[44].Value), pos = Vector3.New(257.08, 651.24, 0) },
2020-07-29 17:50:15 +08:00
--魂印
2024-09-06 10:38:56 +08:00
[5] = { bg = "r_richang_banner_1_zh", titleImg = Language[10329], titleTip = GetLanguageStrById(specialConfig[45].Value), pos = Vector3.New(257.08, 651.24, 0) },
2020-05-09 13:31:21 +08:00
}
--难度图片
2024-09-06 10:38:56 +08:00
local qualityBg = {
[1] = { s = "gm_richang_jd_zh", b = "gm_richang_di1", name = Language[10330] },
[2] = { s = "gm_richang_pt_zh", b = "gm_richang_di1", name = Language[10331] },
[3] = { s = "gm_richang_kn_zh", b = "gm_richang_di1", name = Language[10332] },
[4] = { s = "gm_richang_em_zh", b = "gm_richang_di1", name = Language[10333] },
[5] = { s = "gm_richang_ly_zh", b = "gm_richang_di2", name = Language[10334] },
[6] = { s = "gm_richang_dy_zh", b = "gm_richang_di2", name = Language[10335] },
[7] = { s = "gm_richang_sy_zh", b = "gm_richang_di2", name = Language[10336] },
[8] = { s = "gm_richang_cq_zh", b = "gm_richang_di2", name = Language[10337] },
[9] = { s = "gm_richang_sh_zh", b = "gm_richang_di2", name = Language[10338] }
2020-05-09 13:31:21 +08:00
}
2024-09-06 10:38:56 +08:00
local itemList = {} --奖励容器
2020-05-09 13:31:21 +08:00
--每日副本服务器数据
2024-09-06 10:38:56 +08:00
local buyTime = 0 --购买次数
local freeTime = 0 --免费次数
local maxBuyTime = 0
local maxFreeTime = 0
2020-05-09 13:31:21 +08:00
--Tab
local TabBox = require("Modules/Common/TabBox")
2024-09-06 10:38:56 +08:00
local _TabData = {
2025-09-30 20:09:14 +08:00
[1] = { default = "c_mp_00051_t1", select = "c_mp_00051_t1", lock = "c_mp_00051_t1", name = Language[10327], type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_COIN },
[2] = { default = "c_negw_00009_t1", select = "c_negw_00009_t1", lock = "c_negw_00009_t1", name = Language[10309], type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_EXP },
[3] = { default = "c_ttjz_00041_s1_t1", select = "c_ttjz_00041_s1_t1", lock = "c_ttjz_00041_s1_t1", name = Language[10310], type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_HERODEBRIS },
2025-12-04 16:17:33 +08:00
[4] = { default = "c_h_0007_t1", select = "c_h_0007_t1", lock = "c_h_0007_t1", name = GetLanguageStrById("法灵副本"), type = FUNCTION_OPEN_TYPE.DAILYCHALLENGE_TALISMAN },
2024-09-06 10:38:56 +08:00
}
2020-05-09 13:31:21 +08:00
function DailyCarbonPanel:InitComponent()
2021-04-21 13:12:04 +08:00
this.spLoader = SpriteLoader.New()
2024-09-06 10:38:56 +08:00
this.panel = Util.GetGameObject(this.gameObject, "Panel")
this.titleBg = Util.GetGameObject(this.panel, "TitleBg"):GetComponent("Image")
this.titleImg = Util.GetGameObject(this.panel, "TitleBg/Image"):GetComponent("Text")
this.titleTip = Util.GetGameObject(this.panel, "TitleBg/Text"):GetComponent("Text")
this.timeTip = Util.GetGameObject(this.panel, "TimeTip"):GetComponent("Text")
this.backBtn = Util.GetGameObject(this.panel, "BackBtn")
this.helpBtn = Util.GetGameObject(this.panel, "HelpBtn")
this.helpPosition = this.helpBtn:GetComponent("RectTransform").localPosition
2020-05-09 13:31:21 +08:00
--滚动条
this.pre = Util.GetGameObject(this.panel, "Scroll/Pre")
this.scroll = Util.GetGameObject(this.panel, "Scroll")
2024-09-06 10:38:56 +08:00
this.scrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, this.scroll.transform,
this.pre, nil, Vector2.New(1078, 985), 1, 1, Vector2.New(0, 15))
2020-05-09 13:31:21 +08:00
this.scrollView.moveTween.MomentumAmount = 1
this.scrollView.moveTween.Strength = 2
this.upView = SubUIManager.Open(SubUIConfig.UpView, self.gameObject.transform)
this.tabBox = Util.GetGameObject(this.panel, "TabBox")
this.TabCtrl = TabBox.New()
end
function DailyCarbonPanel:BindEvent()
--返回按钮
Util.AddClick(this.backBtn, function()
PlaySoundWithoutClick(SoundConfig.Sound_UICancel)
self:ClosePanel()
end)
--帮助按钮
Util.AddClick(this.helpBtn, function()
2024-09-06 10:38:56 +08:00
UIManager.OpenPanel(UIName.HelpPopup, HELP_TYPE.DailyCarbon, this.helpPosition.x, this.helpPosition.y)
2020-05-09 13:31:21 +08:00
end)
end
function DailyCarbonPanel:OnSortingOrderChange()
orginLayer = self.sortingOrder
2020-05-25 19:16:23 +08:00
for i, v in pairs(itemList) do
for j = 1, #itemList[i] do
itemList[i][j]:SetEffectLayer(orginLayer)
end
end
2020-05-09 13:31:21 +08:00
end
function DailyCarbonPanel:AddListener()
2024-09-06 10:38:56 +08:00
Game.GlobalEvent:AddEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.FiveRefresh)
2020-05-09 13:31:21 +08:00
end
function DailyCarbonPanel:RemoveListener()
2024-09-06 10:38:56 +08:00
Game.GlobalEvent:RemoveEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, this.FiveRefresh)
2020-05-09 13:31:21 +08:00
end
2020-06-13 11:47:13 +08:00
function DailyCarbonPanel:OnOpen(_carbonIndex)
carbonIndex = _carbonIndex and _carbonIndex or 1
2020-05-09 13:31:21 +08:00
this.upView:OnOpen({ showType = UpViewOpenType.ShowLeft, panelType = PanelType.Main })
end
function DailyCarbonPanel:OnShow()
SoundManager.PlayMusic(SoundConfig.BGM_Carbon)
2020-08-05 16:26:45 +08:00
local curFormationForce = FormationManager.GetFormationPower(FormationTypeDef.FORMATION_NORMAL)
if PlayerManager.maxForce < curFormationForce then
PlayerManager.maxForce = curFormationForce
end
maxForce = PlayerManager.maxForce
2024-09-06 10:38:56 +08:00
if carbonIndex == 0 then carbonIndex = 1 end
2020-05-09 13:31:21 +08:00
this.TabCtrl:SetTabAdapter(this.TabAdapter)
this.TabCtrl:SetTabIsLockCheck(this.TabIsLockCheck)
2024-09-06 10:38:56 +08:00
this.TabCtrl:SetChangeTabCallBack(function(index)
this.RefreshShow(index, true, true)
2022-01-13 12:04:22 +08:00
end)
2024-09-06 10:38:56 +08:00
this.TabCtrl:Init(this.tabBox, _TabData, carbonIndex)
2020-06-03 19:09:01 +08:00
-- 音效
SoundManager.PlayMusic(SoundConfig.BGM_Carbon)
2020-05-09 13:31:21 +08:00
end
2020-07-29 17:50:15 +08:00
function DailyCarbonPanel:RefreshRedPotShow()
2024-09-06 10:38:56 +08:00
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)
2020-07-29 17:50:15 +08:00
end
2024-09-06 10:38:56 +08:00
CheckRedPointStatus(RedPointType.HeroExplore)
2020-07-29 17:50:15 +08:00
end
2020-05-09 13:31:21 +08:00
function DailyCarbonPanel:OnClose()
end
function DailyCarbonPanel:OnDestroy()
2021-04-21 13:12:04 +08:00
this.spLoader:Destroy()
2024-09-06 10:38:56 +08:00
itemList = {}
this.scrollView = nil
2020-05-09 13:31:21 +08:00
SubUIManager.Close(this.upView)
end
function this.FiveRefresh()
2024-09-06 10:38:56 +08:00
this.RefreshShow(1, false, false)
2020-07-29 17:50:15 +08:00
DailyCarbonPanel:RefreshRedPotShow()
2020-05-09 13:31:21 +08:00
end
--刷新面板
2024-09-06 10:38:56 +08:00
function this.RefreshShow(i, isTop, isAni)
2020-05-09 13:31:21 +08:00
carbonIndex = i
2024-09-06 10:38:56 +08:00
curData = {}
2024-09-06 10:38:56 +08:00
curData = ConfigManager.GetAllConfigsDataByKey(ConfigName.DailyChallengeConfig, "Type", i)
2020-05-09 13:31:21 +08:00
2024-09-06 10:38:56 +08:00
this.titleBg.sprite = this.spLoader:LoadSprite(titleBg[i].bg)
this.titleImg.text = titleBg[i].titleImg --this.spLoader:LoadSprite(titleBg[i].titleImg)
this.titleTip.text = titleBg[i].titleTip
2020-09-02 17:38:56 +08:00
-- this.titleTip.gameObject:GetComponent("RectTransform").localPosition = titleBg[i].pos
2020-05-09 13:31:21 +08:00
this.SetTimeTip()
2024-09-06 10:38:56 +08:00
this.SetScroll(i, isTop, isAni)
2020-07-29 17:50:15 +08:00
DailyCarbonPanel:RefreshRedPotShow()
2020-05-09 13:31:21 +08:00
end
--设置滚动条
2022-12-08 17:00:29 +08:00
local curMaxOpenId = 1
2024-09-06 10:38:56 +08:00
local curName = ""
function this.SetScroll(i, isTop, isAni)
local list = {}
for k, v in ipairs(curData) do
2020-08-26 12:23:10 +08:00
if not CarbonManager.IsDailyCarbonPass(v.Id) then
2022-12-08 17:00:29 +08:00
curMaxOpenId = v.Quality
2020-08-26 12:23:10 +08:00
break
end
end
2024-09-06 10:38:56 +08:00
local isEnd = false
if CarbonManager.IsDailyCarbonPass(curData[#curData].Id) then
2024-09-06 10:38:56 +08:00
isEnd = true
curMaxOpenId = #curData
end
2024-09-06 10:38:56 +08:00
curName = qualityBg[curMaxOpenId].name
this.timeTip.text = Language[10339] .. curName
2022-12-08 17:00:29 +08:00
--state 1:挑战 2未开启 3.扫荡
2024-09-06 10:38:56 +08:00
for k, v in ipairs(curData) do
local aaa = {}
aaa.config = v
2022-12-08 17:00:29 +08:00
--解锁状态
2024-09-06 10:38:56 +08:00
local _lv = 0 --等级
local _point = 0 --关卡
2022-12-08 17:00:29 +08:00
local _power = 0 --data.ForceShow--表战力
for i = 1, #v.OpenRules do
if v.OpenRules[i][1] == 1 then
_lv = v.OpenRules[i][2]
elseif v.OpenRules[i][1] == 2 then
_point = v.OpenRules[i][2]
elseif v.OpenRules[i][1] == 3 then
_power = v.OpenRules[i][2]
end
end
2024-09-06 10:38:56 +08:00
-- LogError("lv==".._lv.." point==".._point.." power==".._power)
local lastData = curData[k - 1]
-- 判断每日副本是否解锁
local isOpen = (not lastData or CarbonManager.IsDailyCarbonPass(lastData.Id)) -- 上一个副本解锁
and PlayerManager.level >= _lv -- 等级
and (_point == 0 or FightPointPassManager.IsFightPointPass(_point))
and PlayerManager.maxForce >= _power -- 战斗力
2022-12-08 17:00:29 +08:00
if isOpen then
if CarbonManager.IsDailyCarbonPass(v.Id) then
if isEnd then
2024-09-06 10:38:56 +08:00
if v.Quality == curMaxOpenId then
aaa.state = 0
2022-12-08 17:00:29 +08:00
else
2024-09-06 10:38:56 +08:00
aaa.state = 3
2022-12-08 17:00:29 +08:00
end
else
2024-09-06 10:38:56 +08:00
if v.Quality == curMaxOpenId - 1 then
aaa.state = 0
else
aaa.state = 3
end
2022-12-08 17:00:29 +08:00
end
else
2024-09-06 10:38:56 +08:00
aaa.state = 1
2022-12-08 17:00:29 +08:00
end
else
2024-09-06 10:38:56 +08:00
aaa.state = 2
2022-12-08 17:00:29 +08:00
end
2024-09-06 10:38:56 +08:00
list[k] = aaa
2022-12-08 17:00:29 +08:00
end
2024-09-06 10:38:56 +08:00
table.sort(list, function(a, b)
if a.state == b.state then
return a.config.Id < b.config.Id
2022-12-08 17:00:29 +08:00
else
2024-09-06 10:38:56 +08:00
return a.state < b.state
2022-12-08 17:00:29 +08:00
end
end)
2024-09-06 10:38:56 +08:00
this.scrollView:SetData(list, function(index, root)
this.SetData(root, list[index].config, list[index - 1], list[index].state)
end, not isTop, not isAni)
2020-05-09 13:31:21 +08:00
end
2020-06-23 18:36:24 +08:00
--设置滚动条数据 root根节点 data本地表数据 ldata 上一条数据
2024-09-06 10:38:56 +08:00
function this.SetData(root, data, ldata, state)
local type = 0 --0为未开启 1为挑战 2为扫荡
local bgQuality = Util.GetGameObject(root, "Bg"):GetComponent("Image")
local title = Util.GetGameObject(root, "Title"):GetComponent("Image")
2024-01-18 21:38:32 +08:00
local textDifficulty = Util.GetGameObject(root, "TextDifficulty"):GetComponent("Text")
2024-09-06 10:38:56 +08:00
local frame = Util.GetGameObject(root, "frame"):GetComponent("Image")
local reward = Util.GetGameObject(root, "Reward")
local tip = Util.GetGameObject(root, "Tip"):GetComponent("Text")
local power = Util.GetGameObject(root, "powerBtn/value"):GetComponent("Text")
local info = Util.GetGameObject(root, "info"):GetComponent("Text")
local goBtn = Util.GetGameObject(root, "GoBtn")
local goBtnImage = goBtn:GetComponent("Image")
local goBtnText = Util.GetGameObject(goBtn, "Text"):GetComponent("Text")
local goIcon = Util.GetGameObject(goBtn, "Icon")
local goIconNum = Util.GetGameObject(goBtn, "IconNum")
local goIconNumText = goIconNum:GetComponent("Text")
local storeData = ConfigManager.GetConfigDataByDoubleKey(ConfigName.StoreConfig, "StoreId", 7, "Limit",
data.PrivilegeId[1]) --商店表数据
title.sprite = this.spLoader:LoadSprite(qualityBg[data.Quality].s)
title:SetNativeSize()
2024-09-20 11:45:46 +08:00
textDifficulty.text = GetLanguageStrById(qualityBg[data.Quality].name)
2024-09-06 10:38:56 +08:00
frame.sprite = this.spLoader:LoadSprite(qualityBg[data.Quality].b)
ResetItemView(root, reward.transform, itemList, 3, 0.9, orginLayer, false, data.RewardView)
2022-12-08 17:00:29 +08:00
--LogError("state==="..state)
2020-05-09 13:31:21 +08:00
--解锁状态
2024-09-06 10:38:56 +08:00
local _lv = 0 --等级
local _point = 0 --关卡
2020-07-01 18:14:03 +08:00
local _power = 0 --data.ForceShow--表战力
for i = 1, #data.OpenRules do
if data.OpenRules[i][1] == 1 then
_lv = data.OpenRules[i][2]
elseif data.OpenRules[i][1] == 2 then
_point = data.OpenRules[i][2]
elseif data.OpenRules[i][1] == 3 then
_power = data.OpenRules[i][2]
end
end
if data.OpenRules[2] ~= nil and data.OpenRules[1][1] == 1 then
_lv = data.OpenRules[1][2]
end
if data.OpenRules[1] ~= nil and data.OpenRules[1][1] == 2 then
2024-09-06 10:38:56 +08:00
_point = data.OpenRules[1][2]
2020-07-01 18:14:03 +08:00
end
2024-09-06 10:38:56 +08:00
if data.OpenRules[2][1] == 3 then
_power = data.OpenRules[2][2]
2020-07-01 18:14:03 +08:00
end
2024-09-06 10:38:56 +08:00
2020-07-01 18:14:03 +08:00
-- 判断每日副本是否解锁
2024-09-06 10:38:56 +08:00
local isOpen = (not ldata or CarbonManager.IsDailyCarbonPass(ldata.config.Id)) -- 上一个副本解锁
and PlayerManager.level >= _lv -- 等级
2020-07-01 18:14:03 +08:00
and (_point == 0 or FightPointPassManager.IsFightPointPass(_point))
2024-09-06 10:38:56 +08:00
and PlayerManager.maxForce >= _power -- 战斗力
2020-05-09 13:31:21 +08:00
--显示挑战或扫荡道具消耗
goIcon:SetActive(false)
2024-09-06 10:38:56 +08:00
goIconNum:SetActive(false)
2020-05-09 13:31:21 +08:00
2024-09-06 10:38:56 +08:00
if freeTime <= 0 then
goIconNumText.text = storeData.Cost[2][4]
2020-05-09 13:31:21 +08:00
end
2022-12-08 17:00:29 +08:00
goBtn:SetActive(false)
2020-05-09 13:31:21 +08:00
--表现显示
2024-09-06 10:38:56 +08:00
if state == 1 then
goBtnText.text = Language[10340]
2022-12-08 17:00:29 +08:00
goBtn:SetActive(true)
2024-09-06 10:38:56 +08:00
goBtnImage.sprite = this.spLoader:LoadSprite("s_slbz_1anniuhuangse")
2024-08-29 21:36:51 +08:00
--power.text = _power--string.format("战力:%s", _power)
2022-12-08 17:00:29 +08:00
--power.transform.parent.gameObject:SetActive(true)
2024-01-18 21:38:32 +08:00
--info.text=string.format("战斗力达到%s可挑战",_power)
2024-09-06 10:38:56 +08:00
info.text = string.format("%s", _power)
2021-03-03 17:04:17 +08:00
tip.gameObject:SetActive(false)
2024-09-06 10:38:56 +08:00
type = 1
elseif state == 2 then
2024-08-29 21:36:51 +08:00
--power.text = _power --string.format("<color=red>战力:%s</color>", _power)
--goBtnText.text="未开启"
2022-12-08 17:00:29 +08:00
goBtn:SetActive(false)
tip.gameObject:SetActive(true)
2024-09-06 10:38:56 +08:00
tip.text = Language[10341]
2024-01-18 21:38:32 +08:00
--info.text=string.format("战斗力达到%s可挑战",_power)
2024-09-06 10:38:56 +08:00
info.text = string.format("%s", _power)
2022-12-08 17:00:29 +08:00
--power.transform.parent.gameObject:SetActive(true)
2024-09-06 10:38:56 +08:00
type = 0
elseif state == 3 then
2022-12-08 17:00:29 +08:00
--goIcon:SetActive(state==1 and freeTime<=0)
--ssgoIconNum:SetActive(state==1 and freeTime<=0)
2024-09-06 10:38:56 +08:00
type = 2
2024-01-18 21:38:32 +08:00
--info.text=string.format("战斗力达到%s可挑战",_power)
2024-09-06 10:38:56 +08:00
info.text = string.format("%s", _power)
2024-08-29 21:36:51 +08:00
-- goBtnText.text="扫荡"
2022-12-08 17:00:29 +08:00
-- goBtnImage.sprite=this.spLoader:LoadSprite("s_slbz_1anniuhuise")
goBtn:SetActive(false)
2024-09-06 10:38:56 +08:00
tip.text = Language[10342]
2022-12-08 17:00:29 +08:00
tip.gameObject:SetActive(true)
--power.transform.parent.gameObject:SetActive(false)
2024-09-06 10:38:56 +08:00
elseif state == 0 then
goIcon:SetActive(freeTime <= 0)
goIconNum:SetActive(freeTime <= 0)
2022-12-08 17:00:29 +08:00
goBtn:SetActive(true)
2024-09-06 10:38:56 +08:00
type = 2
goBtnText.text = Language[10343]
info.text = string.format(Language[10344], buyTime + freeTime, maxBuyTime + maxFreeTime)
goBtnImage.sprite = this.spLoader:LoadSprite("s_slbz_1anniuhuangse")
2020-08-26 20:20:40 +08:00
tip.gameObject:SetActive(false)
2022-12-08 17:00:29 +08:00
--power.transform.parent.gameObject:SetActive(false)
2020-05-09 13:31:21 +08:00
end
2022-12-08 17:00:29 +08:00
--Util.SetGray(goBtn,state==1)
2020-05-09 13:31:21 +08:00
2020-07-01 18:14:03 +08:00
2024-09-06 10:38:56 +08:00
--点击事件
Util.AddOnceClick(goBtn, function()
if PlayerManager.level < _lv then
PopupTipPanel.ShowTip(string.format(Language[10315], _lv))
2020-07-01 18:14:03 +08:00
return
2020-08-22 15:31:14 +08:00
elseif PlayerManager.maxForce < _power then
2024-08-29 21:36:51 +08:00
PopupTipPanel.ShowTip(string.format(Language[10316], _power))
2024-09-06 10:38:56 +08:00
return
2020-07-01 18:14:03 +08:00
elseif _point ~= 0 and not FightPointPassManager.IsFightPointPass(_point) then
2024-08-29 21:36:51 +08:00
PopupTipPanel.ShowTip(string.format(Language[10317], GetLanguageStrById(mainLevelConfig[_point].Name)))
2024-09-06 10:38:56 +08:00
return
-- elseif PlayerManager.curMapId ~= 0 and FightPointPassManager.IsFightPointPass(PlayerManager.curMapId)==false then
-- PopupTipPanel.ShowTip(string.format("未通关%s",mainLevelConfig[_point].Name))
-- return
2020-07-01 18:14:03 +08:00
end
2024-09-06 10:38:56 +08:00
if state == 2 then
2024-08-29 21:36:51 +08:00
PopupTipPanel.ShowTip(Language[10318])
2020-06-23 18:36:24 +08:00
return
end
2020-05-09 13:31:21 +08:00
--检测剩余次数
2024-09-06 10:38:56 +08:00
if buyTime <= 0 and freeTime <= 0 and type == 2 then
2024-08-29 21:36:51 +08:00
PopupTipPanel.ShowTip(Language[10319])
2020-05-09 13:31:21 +08:00
return
end
--检测妖晶数量
2024-09-06 10:38:56 +08:00
local itemId = storeData.Cost[1][1] --消耗道具
if BagManager.GetItemCountById(itemId) < storeData.Cost[2][4] and freeTime <= 0 and type == 2 then
PopupTipPanel.ShowTip(string.format(Language[10320], GetLanguageStrById(itemConfig[itemId].Name)))
2020-05-09 13:31:21 +08:00
return
end
--当免费次数不足 是扫荡 购买次数
2024-09-06 10:38:56 +08:00
if freeTime <= 0 and type == 2 then
ShopManager.RequestBuyShopItem(SHOP_TYPE.FUNCTION_SHOP, storeData.Id, 1, function() end)
2020-05-09 13:31:21 +08:00
end
-- TODO: 没有战斗结果校验
2024-09-06 10:38:56 +08:00
NetManager.DailyChallengeRequest(data.Id, type, function(msg)
2020-06-03 19:09:01 +08:00
local fightData = BattleManager.GetBattleServerData(msg)
2024-09-06 10:38:56 +08:00
if state == 1 then --挑战
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.DAILY_CHALLENGE, function(result)
if result.result == 0 then
elseif result.result == 1 then
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1, function()
-- PrivilegeManager.RefreshPrivilegeUsedTimes(data.PrivilegeId[2],1)
2020-05-09 13:31:21 +08:00
CarbonManager.AddDailyChallengeInfo(data.Id)
2024-09-06 10:38:56 +08:00
this.RefreshShow(carbonIndex, false, false)
2020-05-09 13:31:21 +08:00
end)
end
end)
2024-09-06 10:38:56 +08:00
elseif state == 0 then --扫荡
UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1, function()
PrivilegeManager.RefreshPrivilegeUsedTimes(data.PrivilegeId[2], 1)
this.RefreshShow(carbonIndex, false, false)
2020-05-09 13:31:21 +08:00
end)
end
end)
end)
end
--设置剩余次数
function this.SetTimeTip()
2024-09-06 10:38:56 +08:00
LogError("curData[1].PrivilegeId[1]==" .. 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]
LogError("buytimeid==" .. buyTimeId .. " freetimeid==" .. freeTimeId)
buyTime = ShopManager.GetShopItemRemainBuyTimes(SHOP_TYPE.FUNCTION_SHOP, storeData.Id) --购买次数
maxBuyTime = ShopManager.GetShopItemLimitBuyCount(storeData.Id)
freeTime = PrivilegeManager.GetPrivilegeRemainValue(freeTimeId) --免费次数
maxFreeTime = PrivilegeManager.GetPrivilegeNumberById(freeTimeId)
--LogGreen("buyTime "..buyTime.." freeTime "..freeTime)
2024-09-06 10:38:56 +08:00
LogError("maxBuyTime==" .. maxBuyTime .. " maxFreeTime==" .. maxFreeTime)
local str = ""
if freeTime > 0 then
str = string.format(Language[10321], tostring(freeTime))
2020-05-09 13:31:21 +08:00
else
2024-09-06 10:38:56 +08:00
str = string.format(Language[10322], tostring(buyTime))
2020-05-09 13:31:21 +08:00
end
2022-12-08 17:00:29 +08:00
--this.timeTip.text=str
2020-05-09 13:31:21 +08:00
end
-- tab节点显示自定义
function this.TabAdapter(tab, index, status)
local lock = Util.GetGameObject(tab, "LockImage")
local islock = status == "lock"
2024-09-06 10:38:56 +08:00
Util.SetGray(Util.GetGameObject(tab, "Image").gameObject, islock)
2020-05-09 13:31:21 +08:00
lock:SetActive(islock)
2024-09-06 10:38:56 +08:00
Util.GetGameObject(tab, "Image"):GetComponent("Image").sprite = this.spLoader:LoadSprite(_TabData[index][status])
Util.GetGameObject(tab, "Text"):GetComponent("Text").text = titleBg[index].titleImg --_TabData[index].name
2020-05-09 13:31:21 +08:00
end
function this.TabIsLockCheck(index)
if not ActTimeCtrlManager.SingleFuncState(_TabData[index].type) then
2025-11-07 18:46:20 +08:00
if not ActTimeCtrlManager.FuncTimeJudge(_TabData[index].type) then
return true, "活动暂未开启!"
else
return true, ActTimeCtrlManager.SystemOpenTip(_TabData[index].type)
end
2020-05-09 13:31:21 +08:00
end
return false
end
2024-09-06 10:38:56 +08:00
return DailyCarbonPanel