186 lines
6.7 KiB
Lua
186 lines
6.7 KiB
Lua
|
local XinJiangLaiXi = quick_class("XinJiangLaiXi")
|
||
|
-- local allData={}
|
||
|
-- local itemsGrid = {}--item重复利用
|
||
|
local this=XinJiangLaiXi
|
||
|
local sortingOrder = 0
|
||
|
-- local parent = {}
|
||
|
-- local properTypeConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
|
||
|
-- local rechargeConfigId = 0
|
||
|
-- local rechargeData = {}
|
||
|
-- local fakeId = 0
|
||
|
-- this.LiveObj = nil
|
||
|
function XinJiangLaiXi:ctor(mainPanel, gameObject)
|
||
|
self.mainPanel = mainPanel
|
||
|
self.gameObject = gameObject
|
||
|
self:InitComponent(gameObject)
|
||
|
self:BindEvent()
|
||
|
end
|
||
|
|
||
|
function XinJiangLaiXi:InitComponent(gameObject)
|
||
|
this.time = Util.GetGameObject(gameObject, "time/times"):GetComponent("Text")
|
||
|
this.money = Util.GetGameObject(gameObject, "money/times"):GetComponent("Text")
|
||
|
this.fightBtn = Util.GetGameObject(gameObject, "layout/fightBtn")
|
||
|
this.storeBtn = Util.GetGameObject(gameObject, "layout/storeBtn")
|
||
|
this.helpBtn = Util.GetGameObject(gameObject, "helpBtn")
|
||
|
this.scrollItem = Util.GetGameObject(gameObject, "scroller/grid")
|
||
|
this.liveRoot = Util.GetGameObject(gameObject, "bg/liveRoot")
|
||
|
this.tip1 = Util.GetGameObject(gameObject, "layout/Text1"):GetComponent("Text")
|
||
|
this.tip2 = Util.GetGameObject(gameObject, "layout/Text2"):GetComponent("Text")
|
||
|
end
|
||
|
|
||
|
--绑定事件(用于子类重写)
|
||
|
function XinJiangLaiXi:BindEvent()
|
||
|
-- Util.AddClick(this.buyBtn,function()
|
||
|
-- if rechargeData.buyTimes >= rechargeData.dynamicBuyTimes then
|
||
|
-- return
|
||
|
-- end
|
||
|
-- --直购商品
|
||
|
-- PayManager.Pay(rechargeConfigId, function(id)
|
||
|
-- this.RechargeSuccessFunc(id)
|
||
|
-- end) end)
|
||
|
-- Util.AddClick(this.reviewBtn,function()
|
||
|
-- local fdata, fseed = BattleManager.GetFakeBattleData(fakeId)
|
||
|
-- local testFightData = {
|
||
|
-- fightData = fdata,
|
||
|
-- fightSeed = fseed,
|
||
|
-- fightType = 0,
|
||
|
-- maxRound = 20
|
||
|
-- }
|
||
|
-- UIManager.OpenPanel(UIName.BattlePanel, testFightData, BATTLE_TYPE.Test)
|
||
|
-- end)
|
||
|
end
|
||
|
-- function this.RechargeSuccessFunc(id)
|
||
|
-- FirstRechargeManager.RefreshAccumRechargeValue(id)
|
||
|
-- this.OnShowData()
|
||
|
-- end
|
||
|
--添加事件监听(用于子类重写)
|
||
|
function XinJiangLaiXi:AddListener()
|
||
|
end
|
||
|
|
||
|
--移除事件监听(用于子类重写)
|
||
|
function XinJiangLaiXi:RemoveListener()
|
||
|
end
|
||
|
|
||
|
--界面打开时调用(用于子类重写)
|
||
|
function XinJiangLaiXi:OnOpen()
|
||
|
|
||
|
end
|
||
|
|
||
|
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
|
||
|
function XinJiangLaiXi:OnShow(_sortingOrder,_parent)
|
||
|
-- parent = _parent
|
||
|
-- sortingOrder = _sortingOrder
|
||
|
-- this:OnShowData()
|
||
|
-- XinJiangLaiXi:SetTime()
|
||
|
end
|
||
|
-- function XinJiangLaiXi:OnShowData()
|
||
|
-- local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.ShenYiTianJiang)
|
||
|
-- local activityConfig = ConfigManager.GetConfigData(ConfigName.GlobalActivity,activityId)
|
||
|
-- rechargeConfigId = activityConfig.CanBuyRechargeId[1]
|
||
|
-- allData = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig,rechargeConfigId)
|
||
|
-- if not itemsGrid then
|
||
|
-- itemsGrid = {}
|
||
|
-- end
|
||
|
-- for k,v in ipairs(itemsGrid) do
|
||
|
-- v.gameObject:SetActive(false)
|
||
|
-- end
|
||
|
-- for k,v in ipairs(allData.RewardShow) do
|
||
|
-- if not itemsGrid[k] then
|
||
|
-- itemsGrid[k] = SubUIManager.Open(SubUIConfig.ItemView,this.scrollItem.transform)
|
||
|
-- end
|
||
|
-- itemsGrid[k].gameObject:SetActive(true)
|
||
|
-- itemsGrid[k]:OnOpen(false, {v[1],v[2]}, 1,false,false,false,sortingOrder)
|
||
|
-- end
|
||
|
-- local strs = string.split(activityConfig.ExpertDec,'#')
|
||
|
-- local skinId = tonumber(strs[1])
|
||
|
-- fakeId = tonumber(strs[2])
|
||
|
-- local skinConfig = ConfigManager.GetConfigDataByKey(ConfigName.HeroSkin,"Type",skinId)
|
||
|
-- if this.LiveObj then
|
||
|
-- poolManager:UnLoadLive(this.LiveObj.name,this.LiveObj)
|
||
|
-- this.LiveObj = nil
|
||
|
-- end
|
||
|
-- this.proPertyText.text = "属性加成:"
|
||
|
-- if not skinConfig then
|
||
|
-- else
|
||
|
-- LogGreen(skinConfig.Live.." name:"..GetResourcePath(skinConfig.Live))
|
||
|
-- this.LiveObj = poolManager:LoadLive(GetResourcePath(skinConfig.Live),this.liveRoot.transform, Vector3.one * skinConfig.Scale, Vector3.New(skinConfig.Position[1], skinConfig.Position[2], 0))
|
||
|
-- this.skinName.text = ConfigManager.GetConfigData(ConfigName.HeroConfig,skinConfig.HeroId).ReadingName
|
||
|
-- local heroSkinSingleProVal = {}
|
||
|
-- for _,v in ipairs(skinConfig.MonomerProperty) do
|
||
|
-- if not heroSkinSingleProVal[v[1]] then
|
||
|
-- heroSkinSingleProVal[v[1]] = 0
|
||
|
-- end
|
||
|
-- heroSkinSingleProVal[v[1]] = heroSkinSingleProVal[v[1]] + v[2]
|
||
|
-- end
|
||
|
-- for k,v in pairs(heroSkinSingleProVal) do
|
||
|
-- this.proPertyText.text = this.proPertyText.text..properTypeConfig[k].Info.."+"..GetPropertyFormatStr(properTypeConfig[k].Style,v)
|
||
|
-- end
|
||
|
-- end
|
||
|
|
||
|
-- rechargeData = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.DirectPurchaseGift, rechargeConfigId)
|
||
|
-- if rechargeData then
|
||
|
-- this.buytimes.text = "剩余次数:"..(rechargeData.dynamicBuyTimes - rechargeData.buyTimes)
|
||
|
-- else
|
||
|
-- LogGreen("找不到数据了:"..rechargeConfigId)
|
||
|
-- end
|
||
|
-- end
|
||
|
|
||
|
-- function XinJiangLaiXi:SetTime()
|
||
|
-- if self.timer then
|
||
|
-- self.timer:Stop()
|
||
|
-- self.timer = nil
|
||
|
-- end
|
||
|
-- local endTime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.ShenYiTianJiang)
|
||
|
-- local timeDown = endTime - GetTimeStamp()
|
||
|
-- this.time.text = Language[12321]..TimeToDHMS(timeDown)
|
||
|
-- self.timer = Timer.New(function()
|
||
|
-- timeDown = timeDown - 1
|
||
|
-- if timeDown < 1 then
|
||
|
-- self.timer:Stop()
|
||
|
-- self.timer = nil
|
||
|
-- this.time.text = Language[12321]..TimeToDHMS(0)
|
||
|
-- end
|
||
|
-- this.time.text = Language[12321]..TimeToDHMS(timeDown)
|
||
|
-- end, 1, -1, true)
|
||
|
-- self.timer:Start()
|
||
|
-- end
|
||
|
|
||
|
--界面打开时调用(用于子类重写)
|
||
|
function XinJiangLaiXi:OnOpen()
|
||
|
|
||
|
|
||
|
end
|
||
|
|
||
|
-- function this.RechargeSuccessFunc(id)
|
||
|
-- FirstRechargeManager.RefreshAccumRechargeValue(id)
|
||
|
-- --OperatingManager.RefreshGiftGoodsBuyTimes(GoodsTypeDef.GiftBuy, id)
|
||
|
-- this.OnShowData()
|
||
|
-- end
|
||
|
|
||
|
function XinJiangLaiXi:OnClose()
|
||
|
|
||
|
end
|
||
|
|
||
|
--界面销毁时调用(用于子类重写)
|
||
|
function XinJiangLaiXi:OnDestroy()
|
||
|
-- if self.timer then
|
||
|
-- self.timer:Stop()
|
||
|
-- self.timer = nil
|
||
|
-- end
|
||
|
-- if this.LiveObj then
|
||
|
-- poolManager:UnLoadLive(this.LiveObj.name,this.LiveObj)
|
||
|
-- this.LiveObj = nil
|
||
|
-- end
|
||
|
-- sortingOrder = 0
|
||
|
-- itemsGrid = {}
|
||
|
end
|
||
|
|
||
|
function XinJiangLaiXi:OnHide()
|
||
|
-- if self.timer then
|
||
|
-- self.timer:Stop()
|
||
|
-- self.timer = nil
|
||
|
-- end
|
||
|
-- sortingOrder = 0
|
||
|
end
|
||
|
|
||
|
return XinJiangLaiXi
|