【神将来袭】代码完善

dev_chengFeng
ZhangBiao 2020-12-01 15:52:34 +08:00
parent 758c59dcae
commit 2d51e11e10
5 changed files with 1615 additions and 119 deletions

View File

@ -1080,6 +1080,7 @@ ActivityTypeDef = {
ShenYiTianJiang = 71, --神衣天降
LingShouBaoGe = 100,--灵兽宝阁
LingShowTeHui = 101, --灵兽特惠
XinJiangLaiXi = 200,--新将来袭
--主题活动
FindFairy=43,--限时招募

View File

@ -177,7 +177,8 @@ ConfigName = {
HeroSkin = "HeroSkin",
BlessingConfigNew = "BlessingConfigNew",
BlessingRewardPoolNew = "BlessingRewardPoolNew",
SpiritAnimalSummon = "SpiritAnimalSummon"
SpiritAnimalSummon = "SpiritAnimalSummon",
NewHeroConfig = "NewHeroConfig"
}
require "Framework/GameDataBase"

View File

@ -223,6 +223,7 @@ function this.LingShouBuildData()
return rewardData,showData,curScore
end
--灵兽宝阁红点检测
function this.LingShouUpCheckRed()
local freeTime = 0
local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
@ -245,4 +246,20 @@ function this.LingShouUpCheckRed()
return false
end
--新将来袭获取数据
function this.XinJiangBuildData()
local data={}
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.XinJiangLaiXi)
local newHeroData = ConfigManager.GetConfigData(ConfigName.NewHeroConfig,ActData.activityId)
data.endTime = ActData.endTime
data.fightTime = PrivilegeManager.GetPrivilegeRemainValue(2012)
data.buyTime = PrivilegeManager.GetPrivilegeRemainValue(2013)
data.money = BagManager.GetTotalItemNum(16)
local rewardGroupId = newHeroData.DropList[#newHeroData.DropList][2]
data.reward = ConfigManager.GetConfigData(ConfigName.RewardGroup,rewardGroupId).RewardItem
data.activityId = ActData.activityId
return data
end
return this

View File

@ -1,14 +1,14 @@
local XinJiangLaiXi = quick_class("XinJiangLaiXi")
-- local allData={}
-- local itemsGrid = {}--item重复利用
local allData={}
local itemsGrid = {}--item重复利用
local this=XinJiangLaiXi
local sortingOrder = 0
-- local parent = {}
local parent = {}
-- local properTypeConfig = ConfigManager.GetConfig(ConfigName.PropertyConfig)
-- local rechargeConfigId = 0
-- local rechargeData = {}
-- local fakeId = 0
-- this.LiveObj = nil
this.LiveObj = nil
function XinJiangLaiXi:ctor(mainPanel, gameObject)
self.mainPanel = mainPanel
self.gameObject = gameObject
@ -26,33 +26,47 @@ function XinJiangLaiXi:InitComponent(gameObject)
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")
this.addBtn = Util.GetGameObject(gameObject, "layout/addBtn")
--shop
this.tabList = Util.GetGameObject(this.mainPanel,"bg/tabbox")
this.btnBack = Util.GetGameObject(this.mainPanel,"bg/btnBack")
this.bottomBar = Util.GetGameObject(this.mainPanel,"bg/bottomBar")
this.shop = Util.GetGameObject(this.gameObject,"shop")
this.shopBack = Util.GetGameObject(this.shop,"shopBack/btnBack")
this.content = Util.GetGameObject(this.shop,"content")
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)
Util.AddClick(this.fightBtn,function()
local fdata, fseed = BattleManager.GetFakeBattleData(1006)
local testFightData = {
fightData = fdata,
fightSeed = fseed,
fightType = 0,
maxRound = 20
}
UIManager.OpenPanel(UIName.BattlePanel, testFightData, BATTLE_TYPE.Test)
end)
Util.AddClick(this.storeBtn,function()
this.shop:SetActive(true)
this.btnBack:SetActive(false)
this.tabList:SetActive(false)
this.bottomBar:SetActive(false)
this:StoreShow()--商店
end)
Util.AddClick(this.shopBack,function()
this.shop:SetActive(false)
this.btnBack:SetActive(true)
this.tabList:SetActive(true)
this.bottomBar:SetActive(true)
end)
end
-- function this.RechargeSuccessFunc(id)
-- FirstRechargeManager.RefreshAccumRechargeValue(id)
-- this.OnShowData()
-- end
--添加事件监听(用于子类重写)
function XinJiangLaiXi:AddListener()
end
@ -68,94 +82,69 @@ end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function XinJiangLaiXi:OnShow(_sortingOrder,_parent)
-- parent = _parent
-- sortingOrder = _sortingOrder
-- this:OnShowData()
-- XinJiangLaiXi:SetTime()
parent = _parent
sortingOrder = _sortingOrder
allData = DynamicActivityManager.XinJiangBuildData()
XinJiangLaiXi: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
function XinJiangLaiXi:OnShowData()
if not itemsGrid then
itemsGrid = {}
end
for k,v in ipairs(itemsGrid) do
v.gameObject:SetActive(false)
end
for k,v in ipairs(allData.reward) 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,false,false,false,sortingOrder)
end
-- rechargeData = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.DirectPurchaseGift, rechargeConfigId)
-- if rechargeData then
-- this.buytimes.text = "剩余次数:"..(rechargeData.dynamicBuyTimes - rechargeData.buyTimes)
-- else
-- LogGreen("找不到数据了:"..rechargeConfigId)
-- end
-- end
if this.LiveObj then
poolManager:UnLoadLive(this.LiveObj.name,this.LiveObj)
this.LiveObj = nil
end
this.LiveObj = poolManager:LoadLive("l_lingshou_fenghuang",this.liveRoot.transform, Vector3.one, Vector3.zero)
-- 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
this.tip1.text = "剩余挑战次数:".."<color=green>"..allData.fightTime.."</color>"
this.tip1.text = "剩余购买次数:".."<color=green>"..allData.buyTime.."</color>"
end
function XinJiangLaiXi:SetTime()
if self.timer then
self.timer:Stop()
self.timer = nil
end
local timeDown = allData.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
parent:ClosePanel()
return
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 this:StoreShow()
if not this.shopView then
this.shopView = SubUIManager.Open(SubUIConfig.ShopView, this.content.transform)
end
this.shopView:ShowShop(SHOP_TYPE.CELEBRATION_SHOP,sortingOrder)
end
function XinJiangLaiXi:OnClose()
@ -163,24 +152,24 @@ end
--界面销毁时调用(用于子类重写)
function XinJiangLaiXi:OnDestroy()
-- if self.timer then
-- self.timer:Stop()
-- self.timer = nil
-- end
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
sortingOrder = 0
-- itemsGrid = {}
end
function XinJiangLaiXi:OnHide()
-- if self.timer then
-- self.timer:Stop()
-- self.timer = nil
-- end
-- sortingOrder = 0
if self.timer then
self.timer:Stop()
self.timer = nil
end
sortingOrder = 0
end
return XinJiangLaiXi