TCX_LongZhu
parent
89891e786d
commit
c09fcbba4b
|
|
@ -6,7 +6,7 @@ local weekReward = ConfigManager.GetConfig(ConfigName.WeekRewardConfig)
|
|||
local _ItemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||
local _RechargeCommodityConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||||
local weekcardR = nil
|
||||
--初始化组件(用于子类重写)
|
||||
-- 初始化组件(用于子类重写)
|
||||
function WeekCardPanel:InitComponent()
|
||||
self.spLoader = SpriteLoader.New()
|
||||
self.grid = Util.GetGameObject(self.gameObject, "grid")
|
||||
|
|
@ -60,7 +60,7 @@ function WeekCardPanel:InitComponent()
|
|||
end
|
||||
end
|
||||
|
||||
--绑定事件(用于子类重写)
|
||||
-- 绑定事件(用于子类重写)
|
||||
function WeekCardPanel:BindEvent()
|
||||
Util.AddClick(self.helpBtn, function()
|
||||
local pos = self.helpBtn.transform.localPosition
|
||||
|
|
@ -71,17 +71,17 @@ function WeekCardPanel:BindEvent()
|
|||
end)
|
||||
end
|
||||
|
||||
--添加事件监听(用于子类重写)
|
||||
-- 添加事件监听(用于子类重写)
|
||||
function WeekCardPanel:AddListener()
|
||||
Game.GlobalEvent:AddEvent(GameEvent.WeekCard.OnWeekCardUpdate, self.RefreshShow, self)
|
||||
end
|
||||
|
||||
--移除事件监听(用于子类重写)
|
||||
-- 移除事件监听(用于子类重写)
|
||||
function WeekCardPanel:RemoveListener()
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.WeekCard.OnWeekCardUpdate, self.RefreshShow, self)
|
||||
end
|
||||
|
||||
--界面打开时调用(用于子类重写)
|
||||
-- 界面打开时调用(用于子类重写)
|
||||
function WeekCardPanel:OnOpen(args)
|
||||
-- self.actConfig = _activityConfig
|
||||
-- self.pageIndex = _index
|
||||
|
|
@ -96,7 +96,7 @@ end
|
|||
local allcards = {}
|
||||
local curKey = 0
|
||||
local curIndex = 0
|
||||
--local activityId=0
|
||||
-- local activityId=0
|
||||
local endTime = 0
|
||||
function WeekCardPanel:OnShow()
|
||||
self.gameObject:SetActive(true)
|
||||
|
|
@ -109,7 +109,7 @@ function WeekCardPanel:OnShow()
|
|||
endTime = id.endTime
|
||||
self.timeTxt.text = "活动时间:" .. TimeStampToDateStr6(id.startTime) .. "至" .. TimeStampToDateStr6(id.endTime)
|
||||
weekcardR = ConfigManager.GetConfigDataByKey(ConfigName.WeekcardRotationConfig, "GlobalActivity", id.activityId)
|
||||
--weekcardR=ConfigManager.GetConfigData(ConfigName.WeekcardRotationConfig,1)
|
||||
-- weekcardR=ConfigManager.GetConfigData(ConfigName.WeekcardRotationConfig,1)
|
||||
local cardTypes = {}
|
||||
for i = 1, #weekcardR.WeekcardType do
|
||||
local id = weekcardR.WeekcardType[i][3]
|
||||
|
|
@ -117,7 +117,7 @@ function WeekCardPanel:OnShow()
|
|||
local max = weekcardR.WeekcardType[i][2]
|
||||
local type = _WeekcardConfig[id].Type
|
||||
local data = WeekCardManager.GetWeekCardData(id)
|
||||
--已经购买
|
||||
-- 已经购买
|
||||
if data then
|
||||
if allcards[type] == nil then
|
||||
allcards[type] = {}
|
||||
|
|
@ -125,17 +125,17 @@ function WeekCardPanel:OnShow()
|
|||
table.insert(allcards[type], _WeekcardConfig[id])
|
||||
table.insert(cardTypes, _WeekcardConfig[id].WeekcardType)
|
||||
else
|
||||
if PlayerManager.level >= min and PlayerManager.level <= max and not cardTypes[_WeekcardConfig[id].WeekcardType] then
|
||||
if PlayerManager.level >= min and PlayerManager.level <= max and
|
||||
not cardTypes[_WeekcardConfig[id].WeekcardType] then
|
||||
if allcards[type] == nil then
|
||||
allcards[type] = {}
|
||||
end
|
||||
table.insert(allcards[type], _WeekcardConfig[id])
|
||||
end
|
||||
end
|
||||
--table.insert(allcards,weekcardR.WeekcardType[i][3])
|
||||
-- table.insert(allcards,weekcardR.WeekcardType[i][3])
|
||||
end
|
||||
|
||||
|
||||
for i = 1, 5 do
|
||||
self.tabs[i]:SetActive(false)
|
||||
end
|
||||
|
|
@ -168,7 +168,7 @@ function WeekCardPanel:OnShow()
|
|||
end
|
||||
|
||||
function WeekCardPanel:CheckTabRed()
|
||||
--检测页签红点
|
||||
-- 检测页签红点
|
||||
local num = 0
|
||||
for key, value in pairs(allcards) do
|
||||
num = num + 1
|
||||
|
|
@ -196,7 +196,7 @@ function WeekCardPanel:RefreshShow()
|
|||
self:SetCardWind(curKey)
|
||||
end
|
||||
|
||||
--设置周卡界面
|
||||
-- 设置周卡界面
|
||||
function WeekCardPanel:SetCardWind(key)
|
||||
curkey = key
|
||||
if allcards[curkey] then
|
||||
|
|
@ -220,14 +220,14 @@ function WeekCardPanel:SetCardWind(key)
|
|||
Util.GetGameObject(self.tabs[aaa], "Text"):GetComponent("Text").text = "传奇周卡"
|
||||
end
|
||||
]]
|
||||
|
||||
|
||||
for i = 1, #allcards[curkey] do
|
||||
self:ShowCardInfo(i, allcards[curkey][i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--显示周卡信息
|
||||
-- 显示周卡信息
|
||||
function WeekCardPanel:ShowCardInfo(index, config)
|
||||
local pre = self.cardPres[index]
|
||||
if not pre then
|
||||
|
|
@ -245,7 +245,7 @@ function WeekCardPanel:ShowCardInfo(index, config)
|
|||
pre.btnImg.sprite = self.spLoader:LoadSprite("X1_shouzha_yeqianxuanzhong_01")
|
||||
pre.nameBg.sprite = self.spLoader:LoadSprite("UI_hz_zhonghe01_64")
|
||||
else
|
||||
pre.name.text = config.Name --"豪华"
|
||||
pre.name.text = config.Name -- "豪华"
|
||||
pre.bg.sprite = self.spLoader:LoadSprite("X1_chongzhi_zuanshidiban")
|
||||
pre.btnImg.sprite = self.spLoader:LoadSprite("X1_shouzha_yeqianxuanzhong_03")
|
||||
pre.nameBg.sprite = self.spLoader:LoadSprite("UI_hz_zhonghe01_64")
|
||||
|
|
@ -259,7 +259,7 @@ function WeekCardPanel:ShowCardInfo(index, config)
|
|||
-- pre.rewards
|
||||
-- weekReward
|
||||
local allNum = 0
|
||||
local leijiNum = 0
|
||||
-- local leijiNum = 0
|
||||
local name = ""
|
||||
local icon = ""
|
||||
local oneNum = 0
|
||||
|
|
@ -276,8 +276,8 @@ function WeekCardPanel:ShowCardInfo(index, config)
|
|||
oneNum = num
|
||||
icon = GetResourcePath(_ItemConfig[id].ResourceID)
|
||||
itemId = id
|
||||
pre.rewards[i]:GetComponent("Image").sprite = self.spLoader:LoadSprite(GetQuantityImageByquality(
|
||||
_ItemConfig[id].Quantity))
|
||||
pre.rewards[i]:GetComponent("Image").sprite =
|
||||
self.spLoader:LoadSprite(GetQuantityImageByquality(_ItemConfig[id].Quantity))
|
||||
local icon1 = Util.GetGameObject(pre.rewards[i], "Image"):GetComponent("Image")
|
||||
icon1.sprite = self.spLoader:LoadSprite(icon)
|
||||
local stateTxt = Util.GetGameObject(pre.rewards[i], "Text"):GetComponent("Text")
|
||||
|
|
@ -288,7 +288,7 @@ function WeekCardPanel:ShowCardInfo(index, config)
|
|||
numTxt.text = num
|
||||
end
|
||||
if leijiDayNum >= config.BaseRewardID[i][1] then
|
||||
leijiNum = leijiNum + num
|
||||
-- leijiNum = leijiNum + num
|
||||
end
|
||||
allNum = allNum + num
|
||||
end
|
||||
|
|
@ -317,14 +317,14 @@ function WeekCardPanel:ShowCardInfo(index, config)
|
|||
getNum = getNum + 1
|
||||
end
|
||||
end
|
||||
--local residueTimeNum = endTime - GetTimeStamp()
|
||||
--local dayNum = math.floor(residueTimeNum / (24 * 3600))
|
||||
-- local residueTimeNum = endTime - GetTimeStamp()
|
||||
-- local dayNum = math.floor(residueTimeNum / (24 * 3600))
|
||||
pre.timeTxt.text = "(剩余" .. dayNum .. "天)"
|
||||
if dayNum == 0 then
|
||||
pre.timeTxt.gameObject:SetActive(false)
|
||||
else
|
||||
pre.timeTxt.gameObject:SetActive(true)
|
||||
|
||||
|
||||
end
|
||||
if getNum > 0 then
|
||||
-- 领取奖励
|
||||
|
|
@ -333,7 +333,7 @@ function WeekCardPanel:ShowCardInfo(index, config)
|
|||
Util.SetGray(pre.btn, false)
|
||||
Util.AddOnceClick(pre.btn, function()
|
||||
local id = ActivityGiftManager.GetActivityTypeInfo(102)
|
||||
--LogError("cardid=="..data.id.." id=="..id.activityId)
|
||||
-- LogError("cardid=="..data.id.." id=="..id.activityId)
|
||||
WeekCardManager.RequestGetWeekCardReward(data.id, id.activityId, function()
|
||||
-- 刷新显示
|
||||
self:RefreshShow()
|
||||
|
|
@ -353,17 +353,21 @@ function WeekCardPanel:ShowCardInfo(index, config)
|
|||
-- 购买周卡
|
||||
pre.timeTxt.gameObject:SetActive(false)
|
||||
pre.lideTxt.gameObject:SetActive(true)
|
||||
pre.lideTxt.text = "<color=#382600>激活立得</color><color=#C72F2B>"..name.."*"..PrintWanNum2(leijiNum).."</color>"
|
||||
local id = rechargeCfg.RewardShow[1][1]
|
||||
local num = rechargeCfg.RewardShow[1][2]
|
||||
local _name = _ItemConfig[id].Name
|
||||
pre.lideTxt.text = "<color=#382600>激活立得</color><color=#C72F2B>" .. _name .. "*" .. PrintWanNum2(num) ..
|
||||
"</color>"
|
||||
pre.btnText.text = MoneyUtil.GetMoneyUnitNameWithMoney(rechargeCfg.Price)
|
||||
pre.red:SetActive(false)
|
||||
Util.SetGray(pre.btn, false)
|
||||
Util.AddOnceClick(pre.btn, function()
|
||||
PayManager.Pay(config.RechargeId, function(id)
|
||||
-- 前端修改购买状态
|
||||
--data.isBuy = true
|
||||
--WeekCardManager.UpdateWeekCardData(data)
|
||||
-- data.isBuy = true
|
||||
-- WeekCardManager.UpdateWeekCardData(data)
|
||||
-- 刷新显示
|
||||
--self:SetCardWind(curKey)
|
||||
-- self:SetCardWind(curKey)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
|
@ -450,14 +454,14 @@ function WeekCardPanel:SetCardShow(index, data)
|
|||
end
|
||||
end
|
||||
|
||||
--界面关闭时调用(用于子类重写)
|
||||
-- 界面关闭时调用(用于子类重写)
|
||||
function WeekCardPanel:OnClose()
|
||||
--CheckRedPointStatus(RedPointType.WeekCard)
|
||||
-- CheckRedPointStatus(RedPointType.WeekCard)
|
||||
CheckRedPointStatus(RedPointType.WeekCardOpen)
|
||||
CheckRedPointStatus(RedPointType.WeekCardReward)
|
||||
end
|
||||
|
||||
--界面销毁时调用(用于子类重写)
|
||||
-- 界面销毁时调用(用于子类重写)
|
||||
function WeekCardPanel:OnDestroy()
|
||||
self.spLoader:Destroy()
|
||||
self.cardPres = {}
|
||||
|
|
|
|||
Loading…
Reference in New Issue