TCX_LongZhu
parent
419691610a
commit
7a14770eae
|
|
@ -1637,6 +1637,7 @@ GoodsTypeDef = {
|
|||
chaozhifanli = 18,
|
||||
GMJustBuy = 20,
|
||||
HHBG = 22, --无限资源阁
|
||||
DJQ = 63, --代金券
|
||||
}
|
||||
|
||||
--工坊功能类型
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1ab637d2001e2e94fad193ec6110b673
|
||||
guid: a9c87918c42277845b947bf6d1a48823
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ function PackageManager.Initialize()
|
|||
if not this.ConfigName then
|
||||
this.ConfigName = "LOCAL"
|
||||
end
|
||||
LogGreen("当前包名为:"..this.ConfigName)
|
||||
local PackagerConfig = ConfigManager.GetConfig(ConfigName.PackageConfig)
|
||||
for _, config in ConfigPairs(PackagerConfig) do
|
||||
if config.ConfigName == this.ConfigName then
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@
|
|||
--]]
|
||||
require("Modules.Operating.MonthCardManager")
|
||||
require("Modules.Operating.WeekCardManager")
|
||||
local rechargeOrder=ConfigManager.GetConfig(ConfigName.RechargeCommodityorder)
|
||||
local rechargeOrder = ConfigManager.GetConfig(ConfigName.RechargeCommodityorder)
|
||||
OperatingManager = {}
|
||||
local this = OperatingManager
|
||||
--后端数据 以RechargeCommodityConfig表Type为键
|
||||
--后端数据 以RechargeCommodityConfig表Type为键
|
||||
local giftGoodsInfoList = {}
|
||||
--- 新的数据列表,按照ID存取
|
||||
local newGoodsList = {}
|
||||
|
|
@ -18,10 +18,10 @@ local hadBuyGoodsList = {}
|
|||
local rechargeConfig = ConfigManager.GetConfig(ConfigName.RechargeCommodityConfig)
|
||||
local luxuryConfig = ConfigManager.GetConfig(ConfigName.LuxuryFundConfig)
|
||||
--后端数据 goodsId;//商品id buyTimes; //购买次数 startTime;//开始时间 endTime; //结束时间 dynamicBuyTimes; //可购买次数
|
||||
local giftGoodsInfo
|
||||
local giftGoodsInfo
|
||||
|
||||
this.upGradePackagePanelType = 0
|
||||
this.upGradePackagePanelIndex = 0
|
||||
this.upGradePackagePanelType = 1
|
||||
this.upGradePackagePanelIndex = 1
|
||||
this.IsShowFiveStarPatch = true
|
||||
|
||||
-- 月卡激活提示内容,也用来标记是否需要拍脸提示
|
||||
|
|
@ -34,52 +34,63 @@ function this.Initialize()
|
|||
|
||||
Game.GlobalEvent:AddEvent(GameEvent.PatFace.PatFaceHaveGrowGift, this.NewHeroGift)
|
||||
|
||||
|
||||
|
||||
this.showStr = ""
|
||||
end
|
||||
|
||||
---------------------------局限性----------------------------
|
||||
function this.SetBasicValues(giftGoodsList)
|
||||
function this.SetBasicValues(giftGoodsList)
|
||||
giftGoodsInfo = giftGoodsList
|
||||
for _, v in pairs(GoodsTypeDef) do
|
||||
giftGoodsInfoList[v] = {}
|
||||
end
|
||||
for _, giftGoodsInfo in ipairs(giftGoodsList) do
|
||||
if giftGoodsInfo.goodsId and giftGoodsInfo.goodsId ~= 0 then
|
||||
local rechargeConfigLocal = ConfigManager.TryGetConfigData(ConfigName.RechargeCommodityConfig, giftGoodsInfo.goodsId)
|
||||
local rechargeConfigLocal = ConfigManager.TryGetConfigData(ConfigName.RechargeCommodityConfig,
|
||||
giftGoodsInfo.goodsId)
|
||||
if rechargeConfigLocal then
|
||||
LogBlue("礼包类型:"..tostring(rechargeConfigLocal.Type).." 礼包ID:"..tostring(giftGoodsInfo.goodsId).." 已购:"..tostring(giftGoodsInfo.buyTimes)
|
||||
.."次 开始时间:"..tostring(giftGoodsInfo.startTime).." 结束时间:"..tostring(giftGoodsInfo.endTime).. " 可购:" ..tostring(giftGoodsInfo.dynamicBuyTimes).." 是否已买:"..tostring(giftGoodsInfo.isBought))
|
||||
if giftGoodsInfo.endTime == 0 and giftGoodsInfo.startTime == 0 and (rechargeConfigLocal.ShowType == 25 or rechargeConfigLocal.ShowType == 26 or rechargeConfigLocal.ShowType == 8 ) then
|
||||
elseif rechargeConfigLocal.Package == 2 and AppConst.SdkChannel=="XQDC" then
|
||||
-- elseif this.CheckGiftFrontIsOpen(giftGoodsInfo.goodsId)==false then
|
||||
-- LogError("前置条件不满足================")
|
||||
LogBlue("礼包类型:" ..
|
||||
tostring(rechargeConfigLocal.Type) ..
|
||||
" 礼包ID:" .. tostring(giftGoodsInfo.goodsId) .. " 已购:" .. tostring(giftGoodsInfo.buyTimes)
|
||||
..
|
||||
"次 开始时间:" ..
|
||||
tostring(giftGoodsInfo.startTime) ..
|
||||
" 结束时间:" ..
|
||||
tostring(giftGoodsInfo.endTime) ..
|
||||
" 可购:" .. tostring(giftGoodsInfo.dynamicBuyTimes) ..
|
||||
" 是否已买:" .. tostring(giftGoodsInfo.isBought))
|
||||
if giftGoodsInfo.endTime == 0 and giftGoodsInfo.startTime == 0 and (rechargeConfigLocal.ShowType == 25 or rechargeConfigLocal.ShowType == 26 or rechargeConfigLocal.ShowType == 8) then
|
||||
--LogError("礼包时间不对ddddddddddddddddddddd" .. tostring(rechargeConfigLocal.Type))
|
||||
elseif rechargeConfigLocal.Package == 2 and AppConst.SdkChannel == "XQDC" then
|
||||
-- elseif this.CheckGiftFrontIsOpen(giftGoodsInfo.goodsId)==false then
|
||||
-- LogError("前置条件不满足================")
|
||||
--LogError("礼包时间不对ddddddddddddddddddddd" .. tostring(rechargeConfigLocal.Type))
|
||||
else
|
||||
if giftGoodsInfoList[rechargeConfigLocal.Type] then
|
||||
table.insert(giftGoodsInfoList[rechargeConfigLocal.Type], giftGoodsInfo)
|
||||
end
|
||||
end
|
||||
else
|
||||
LogError("服务器发过来一个前端表中不存在的礼包:"..tostring(giftGoodsInfo.goodsId))
|
||||
LogError("服务器发过来一个前端表中不存在的礼包:" .. tostring(giftGoodsInfo.goodsId))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--屏蔽前置礼包没有达成购买限制的
|
||||
local removeList={}
|
||||
local removeList = {}
|
||||
for _, v in pairs(GoodsTypeDef) do
|
||||
for key, value in pairs(giftGoodsInfoList[v]) do
|
||||
if this.CheckGiftFrontIsOpen(value.goodsId)==false then
|
||||
if removeList[v]==nil then
|
||||
removeList[v]={}
|
||||
end
|
||||
table.insert(removeList[v],value)
|
||||
if this.CheckGiftFrontIsOpen(value.goodsId) == false then
|
||||
if removeList[v] == nil then
|
||||
removeList[v] = {}
|
||||
end
|
||||
table.insert(removeList[v], value)
|
||||
end
|
||||
end
|
||||
end
|
||||
for k, v in pairs(removeList) do
|
||||
for i=1,#v do
|
||||
table.removebyvalue(giftGoodsInfoList[k],v[i])
|
||||
for i = 1, #v do
|
||||
table.removebyvalue(giftGoodsInfoList[k], v[i])
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -88,51 +99,51 @@ end
|
|||
|
||||
--检测礼包前置是否开启
|
||||
function this.CheckGiftFrontIsOpen(gift)
|
||||
local isOpen=true
|
||||
local isOpen = true
|
||||
for k, v in ConfigPairs(rechargeOrder) do
|
||||
|
||||
if gift == v.BehindCommodity then
|
||||
--LogError("v.id======================="..v.Id)
|
||||
if v.FrontCommodity>0 then
|
||||
local time=this.GetLeftBuyTime(rechargeConfig[v.FrontCommodity].Type, v.FrontCommodity)
|
||||
local buyTime= this.GetGoodsBuyTime(rechargeConfig[v.FrontCommodity].Type, v.FrontCommodity)
|
||||
--无限次
|
||||
if time==-1 then
|
||||
LogError(" giftid===="..gift)
|
||||
return true
|
||||
end
|
||||
if v.FrontCommodity > 0 then
|
||||
local time = this.GetLeftBuyTime(rechargeConfig[v.FrontCommodity].Type, v.FrontCommodity)
|
||||
local buyTime = this.GetGoodsBuyTime(rechargeConfig[v.FrontCommodity].Type, v.FrontCommodity)
|
||||
--无限次
|
||||
if time == -1 then
|
||||
--LogError(" giftid===="..gift)
|
||||
return true
|
||||
end
|
||||
|
||||
-- LogError("time================="..time.." v.FrontCommodityNumber==========="..v.FrontCommodityNumber.." buyTime=="..buyTime.." giftid===="..gift)
|
||||
if time>v.FrontCommodityNumber then
|
||||
return false
|
||||
end
|
||||
--LogError("time================="..time.." v.FrontCommodityNumber==========="..v.FrontCommodityNumber.." buyTime=="..buyTime.." giftid===="..gift)
|
||||
if time > v.FrontCommodityNumber then
|
||||
return false
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
return isOpen
|
||||
end
|
||||
|
||||
--判断商品是否可购买(成长礼)
|
||||
function this.IsGrowthGiftGoodsAvailable(goodsType)
|
||||
for _, v in ipairs(giftGoodsInfo)do
|
||||
for _, v in ipairs(giftGoodsInfo) do
|
||||
if v and v.goodsId and v.goodsId ~= 0 then
|
||||
local rechargeConfig = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, v.goodsId)
|
||||
if(rechargeConfig.Type == goodsType and v.dynamicBuyTimes == 1 and v.buyTimes ~= v.dynamicBuyTimes)then
|
||||
if (rechargeConfig.Type == goodsType and v.dynamicBuyTimes == 1 and v.buyTimes ~= v.dynamicBuyTimes) then
|
||||
return v
|
||||
end
|
||||
end
|
||||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
--判断商品是否购买过
|
||||
function this.IsBuyGift(goodsId)
|
||||
if not goodsId then
|
||||
return false
|
||||
end
|
||||
for _, v in ipairs(giftGoodsInfo)do
|
||||
if v.goodsId == goodsId and (v.buyTimes > 0 or v.isBought>0 )then
|
||||
for _, v in ipairs(giftGoodsInfo) do
|
||||
if v.goodsId == goodsId and (v.buyTimes > 0 or v.isBought > 0) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
|
|
@ -155,14 +166,14 @@ end
|
|||
|
||||
--- 删除某一类型的某一条商品数据
|
||||
function this.RemoveItemInfoByType(type, goodsId)
|
||||
if not giftGoodsInfoList[type] then
|
||||
if not giftGoodsInfoList[type] then
|
||||
Log("此类商品不存在")
|
||||
return
|
||||
return
|
||||
end
|
||||
|
||||
for k,v in pairs(giftGoodsInfoList[type]) do
|
||||
if v then
|
||||
if v.goodsId == goodsId then
|
||||
for k, v in pairs(giftGoodsInfoList[type]) do
|
||||
if v then
|
||||
if v.goodsId == goodsId then
|
||||
table.remove(giftGoodsInfoList[type], k)
|
||||
end
|
||||
end
|
||||
|
|
@ -177,7 +188,7 @@ end
|
|||
-- 判断相应显示类型的礼包是否存在用于判断是否开启了相应的充值活动
|
||||
function this.HasGoodsByShowType(showType)
|
||||
local list = ConfigManager.GetAllConfigsDataByKey(ConfigName.RechargeCommodityConfig, "ShowType", showType)
|
||||
if not list then return false end
|
||||
if not list then return false end
|
||||
for _, goods in ipairs(list) do
|
||||
if this.GetGiftGoodsInfo(goods.Type, goods.Id) then
|
||||
return true
|
||||
|
|
@ -199,7 +210,7 @@ function this.GetGiftGoodsInfo(goodsType, Id)
|
|||
end
|
||||
else
|
||||
-- 判断是否可用
|
||||
if _IsGiftGoodsAvailable(giftGoodsInfo) then
|
||||
if _IsGiftGoodsAvailable(giftGoodsInfo) then
|
||||
return giftGoodsInfo
|
||||
end
|
||||
end
|
||||
|
|
@ -210,14 +221,14 @@ end
|
|||
function this.GetGiftGoodsInfoList(type)
|
||||
-- return giftGoodsInfoList[type] and giftGoodsInfoList[type] or {}
|
||||
if not giftGoodsInfoList[type] then
|
||||
LogError("没有这个类型的礼包:"..tostring(type))
|
||||
LogError("没有这个类型的礼包:" .. tostring(type))
|
||||
return {}
|
||||
end
|
||||
local newGiftGoodsInfoList = {}
|
||||
for k,v in pairs(giftGoodsInfoList[type]) do
|
||||
--and PlayerManager.level >= rechargeConfig[v.goodsId].LevelLinit[1] and PlayerManager.level <= rechargeConfig[v.goodsId].LevelLinit[2]
|
||||
if rechargeConfig[v.goodsId] then
|
||||
table.insert(newGiftGoodsInfoList,v)
|
||||
for k, v in pairs(giftGoodsInfoList[type]) do
|
||||
--and PlayerManager.level >= rechargeConfig[v.goodsId].LevelLinit[1] and PlayerManager.level <= rechargeConfig[v.goodsId].LevelLinit[2]
|
||||
if rechargeConfig[v.goodsId] and rechargeConfig[v.goodsId].ShowType ~= 0 then
|
||||
table.insert(newGiftGoodsInfoList, v)
|
||||
end
|
||||
end
|
||||
return newGiftGoodsInfoList
|
||||
|
|
@ -244,7 +255,7 @@ function this.GetLeftBuyTime(type, goodsId)
|
|||
|
||||
--- 此类商品的购买次数限制
|
||||
local limitTime = rechargeConfig[goodsId].Limit
|
||||
if limitTime == 0 then --- 不限购
|
||||
if limitTime == 0 then --- 不限购
|
||||
return -1
|
||||
else
|
||||
local boughtTime = this.GetGoodsBuyTime(type, goodsId)
|
||||
|
|
@ -252,25 +263,24 @@ function this.GetLeftBuyTime(type, goodsId)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
--- 获取商品已经购买次数
|
||||
function this.GetGoodsBuyTime(type, goodsId)
|
||||
if not giftGoodsInfoList[type] then
|
||||
--王振兴添加 防止没有查询到数据报错
|
||||
return 0
|
||||
end
|
||||
for k,v in pairs(giftGoodsInfoList[type]) do
|
||||
for k, v in pairs(giftGoodsInfoList[type]) do
|
||||
if not goodsId then
|
||||
--LogError("goodid====="..goodsId)
|
||||
return v.buyTimes
|
||||
end
|
||||
if v.goodsId == goodsId then
|
||||
if rechargeConfig[goodsId] then
|
||||
if rechargeConfig[goodsId].Otype==3 then
|
||||
return v.isBought
|
||||
else
|
||||
return v.buyTimes
|
||||
end
|
||||
if rechargeConfig[goodsId].Otype == 3 then
|
||||
return v.isBought
|
||||
else
|
||||
return v.buyTimes
|
||||
end
|
||||
end
|
||||
return v.buyTimes
|
||||
end
|
||||
|
|
@ -279,7 +289,6 @@ function this.GetGoodsBuyTime(type, goodsId)
|
|||
return 0
|
||||
end
|
||||
|
||||
|
||||
--------------------------------------------------------------
|
||||
function this.SetHadBuyGoodsId(BuyGoodsList)
|
||||
for i = 1, #BuyGoodsList do
|
||||
|
|
@ -302,15 +311,15 @@ function this.GetGrowthRedPointState()
|
|||
local openId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.GrowthReward)
|
||||
local hasGift = OperatingManager.HasGoodsByShowType(4)
|
||||
if openId then
|
||||
local isGet=RecruitTreasureManager.GetQuanMinRed(openId)
|
||||
local isGet = RecruitTreasureManager.GetQuanMinRed(openId)
|
||||
if isGet then
|
||||
return true
|
||||
return true
|
||||
end
|
||||
end
|
||||
if not hasGift then return false end
|
||||
local giftGoodsInfo = OperatingManager.IsGrowthGiftGoodsAvailable(GoodsTypeDef.GrowthReward)
|
||||
if not giftGoodsInfo then return false end
|
||||
|
||||
|
||||
if openId then
|
||||
-- 判断对应礼包是否购买
|
||||
local globalActConfigs = ConfigManager.TryGetConfigData(ConfigName.GlobalActivity, openId)
|
||||
|
|
@ -329,11 +338,10 @@ function this.GetGrowthRedPointState()
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return redPoint
|
||||
end
|
||||
|
||||
|
||||
-- 商品时间数据
|
||||
local _GoodsDurationData = {}
|
||||
function this.SetGoodsDurationData(dataList)
|
||||
|
|
@ -346,24 +354,25 @@ function this.SetGoodsDurationData(dataList)
|
|||
--Log("商品类型 = "..data.goodsType..", 剩余时间 = "..data.endTime)
|
||||
end
|
||||
end
|
||||
|
||||
-- 根据类型判断相应的物品是否开启并返回相应的ID
|
||||
function this.GetActiveGoodsIDByType(goodsType)
|
||||
for goodsId, endTime in pairs(_GoodsDurationData) do
|
||||
if rechargeConfig[goodsId] and rechargeConfig[goodsId].Type == goodsType and endTime > GetTimeStamp() then
|
||||
if rechargeConfig[goodsId] and rechargeConfig[goodsId].Type == goodsType and endTime > GetTimeStamp() then
|
||||
return goodsId, endTime
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
function this.GetGoodsEndTime(goodsType)
|
||||
local goodsId, endTime = this.GetActiveGoodsIDByType(goodsType)
|
||||
return endTime
|
||||
end
|
||||
|
||||
function this.RemoveEndTime(goodsId)
|
||||
_GoodsDurationData[goodsId] = nil
|
||||
end
|
||||
|
||||
function this.SetGoodsEndTime(goodsId, endTime)
|
||||
_GoodsDurationData[goodsId] = endTime
|
||||
end
|
||||
|
|
@ -383,7 +392,6 @@ function this.IsGoodsExit(type, id)
|
|||
return isOpen
|
||||
end
|
||||
|
||||
|
||||
-- 五星成长礼红点
|
||||
function this.GetRedState()
|
||||
local isRed = false
|
||||
|
|
@ -398,7 +406,6 @@ function this.GetRedState()
|
|||
return isRed
|
||||
end
|
||||
|
||||
|
||||
---------------------------------------累计签到--------------------------------
|
||||
local _SignInData
|
||||
function this.SetSignInData(signIn)
|
||||
|
|
@ -412,9 +419,10 @@ end
|
|||
|
||||
--红点检测方法
|
||||
function this.GetSignInRedPointStatus()
|
||||
local receiveNum=PrivilegeManager.GetPrivilegeRemainValue(PRIVILEGE_TYPE.DAY_SIGN_IN)--本地标记可领取次数
|
||||
local rechargeNum=PrivilegeManager.GetPrivilegeNumber(PRIVILEGE_TYPE.DAY_SIGN_IN)--充值标记 1未充值 2已充值
|
||||
return _SignInData.state == 0 --or receiveNum>0--(_SignInData.state==1 and ((receiveNum==0 and rechargeNum==1) or (receiveNum==1 and rechargeNum==2)))
|
||||
local receiveNum = PrivilegeManager.GetPrivilegeRemainValue(PRIVILEGE_TYPE.DAY_SIGN_IN) --本地标记可领取次数
|
||||
local rechargeNum = PrivilegeManager.GetPrivilegeNumber(PRIVILEGE_TYPE.DAY_SIGN_IN) --充值标记 1未充值 2已充值
|
||||
return _SignInData.state ==
|
||||
0 --or receiveNum>0--(_SignInData.state==1 and ((receiveNum==0 and rechargeNum==1) or (receiveNum==1 and rechargeNum==2)))
|
||||
end
|
||||
|
||||
---------------------------------- 什么什么什么新鸡成长礼包 ------------------------------------------
|
||||
|
|
@ -424,21 +432,19 @@ function this.NewHeroGift()
|
|||
CheckRedPointStatus(RedPointType.HERO_STAR_GIFT)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--- 获取那个的显示数据
|
||||
function this.GetStarGiftData()
|
||||
local data = {}
|
||||
for k, v in ConfigPairs(rechargeConfig) do
|
||||
if v.ShowType == 8 then
|
||||
if v.ShowType == 8 then
|
||||
local t = {}
|
||||
t.data = v -- 数据结构
|
||||
t.Id = v.Id -- 商品ID
|
||||
t.data = v -- 数据结构
|
||||
t.Id = v.Id -- 商品ID
|
||||
data[#data + 1] = t
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
return data
|
||||
end
|
||||
|
||||
|
|
@ -446,19 +452,19 @@ function this.IsHeroGiftActive()
|
|||
-- 关闭星级成长礼显示
|
||||
local activeNum = 0
|
||||
if not giftGoodsInfoList[GoodsTypeDef.DirectPurchaseGift] then
|
||||
return false
|
||||
return false
|
||||
else
|
||||
for i = 1, #giftGoodsInfoList[GoodsTypeDef.DirectPurchaseGift] do
|
||||
local data =giftGoodsInfoList[GoodsTypeDef.DirectPurchaseGift][i]
|
||||
if data then
|
||||
for i = 1, #giftGoodsInfoList[GoodsTypeDef.DirectPurchaseGift] do
|
||||
local data = giftGoodsInfoList[GoodsTypeDef.DirectPurchaseGift][i]
|
||||
if data then
|
||||
local id = data.goodsId
|
||||
if rechargeConfig[id].ShowType == 8 then --- 只有前端显示的商品类型
|
||||
activeNum = activeNum + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
return activeNum > 0
|
||||
end
|
||||
|
||||
|
|
@ -474,12 +480,12 @@ function this.GetGiftShowData()
|
|||
data.id = goodsId
|
||||
data.name = GetLanguageStrById(staticData[i].data.Name)
|
||||
local serData = this.GetGiftGoodsInfo(GoodsTypeDef.DirectPurchaseGift, goodsId)
|
||||
if serData and serData.endTime > 0 then --- 商品激活可购买
|
||||
if serData and serData.endTime > 0 then --- 商品激活可购买
|
||||
data.endTime = serData.endTime
|
||||
data.startTime = serData.startTime
|
||||
data.startTime = serData.startTime
|
||||
data.leftBuyTime = serData.dynamicBuyTimes
|
||||
data.isActive = 1
|
||||
else --- 未激活只是显示而已
|
||||
else --- 未激活只是显示而已
|
||||
data.endTime = 0
|
||||
data.startTime = 0
|
||||
data.leftBuyTime = 0
|
||||
|
|
@ -487,25 +493,22 @@ function this.GetGiftShowData()
|
|||
end
|
||||
|
||||
newData[#newData + 1] = data
|
||||
|
||||
end
|
||||
|
||||
---排序
|
||||
|
||||
|
||||
if #newData > 1 then
|
||||
|
||||
if #newData > 1 then
|
||||
table.sort(newData, function(a, b)
|
||||
if a.isActive == b.isActive then
|
||||
return a.id > b.id
|
||||
if a.isActive == b.isActive then
|
||||
return a.id > b.id
|
||||
else
|
||||
return a.isActive > b.isActive
|
||||
end
|
||||
|
||||
end)
|
||||
end
|
||||
|
||||
return newData
|
||||
|
||||
return newData
|
||||
end
|
||||
|
||||
--- 礼包红点
|
||||
|
|
@ -514,7 +517,7 @@ function this.IsHeroStarGiftActive()
|
|||
local isActive = this.IsHeroGiftActive()
|
||||
local hasRed = clickedState == 1 and isActive
|
||||
return hasRed
|
||||
end
|
||||
end
|
||||
|
||||
function this.SetHeroRedState(value)
|
||||
PlayerPrefs.SetInt(PlayerManager.uid .. "hero_star_gift", value)
|
||||
|
|
@ -523,19 +526,20 @@ end
|
|||
function this.GetHeroRedState()
|
||||
return PlayerPrefs.GetInt(PlayerManager.uid .. "hero_star_gift")
|
||||
end
|
||||
|
||||
----------------------------------------------------------------------------------------------
|
||||
|
||||
--- 获取鸡精面版的显示信息
|
||||
--- 传进来的参数值是 33或者是34基金类型
|
||||
function this.GetPanelShowReward(type, isAll,isOverlay)
|
||||
function this.GetPanelShowReward(type, isAll, isOverlay)
|
||||
local data = {}
|
||||
for k, v in ConfigPairs(luxuryConfig) do
|
||||
if not isAll then
|
||||
if v.Type == type and v.ShowReward == 1 then
|
||||
if not isAll then
|
||||
if v.Type == type and v.ShowReward == 1 then
|
||||
data[#data + 1] = v
|
||||
end
|
||||
else
|
||||
if v.Type == type then
|
||||
if v.Type == type then
|
||||
data[#data + 1] = v
|
||||
end
|
||||
end
|
||||
|
|
@ -551,7 +555,7 @@ function this.GetPanelShowReward(type, isAll,isOverlay)
|
|||
end
|
||||
local endData2 = {}
|
||||
for i, v in pairs(endData) do
|
||||
table.insert(endData2,{i,v})
|
||||
table.insert(endData2, { i, v })
|
||||
end
|
||||
return endData2
|
||||
else
|
||||
|
|
@ -563,41 +567,41 @@ end
|
|||
function this.IsBaseOpen(type, id)
|
||||
local isOpen = false
|
||||
local data = this.GetGiftGoodsInfo(type, id)
|
||||
|
||||
|
||||
if data then
|
||||
--- 常驻
|
||||
if tonumber(data.endTime) == 0 then
|
||||
if tonumber(data.endTime) == 0 then
|
||||
isOpen = true
|
||||
else
|
||||
else
|
||||
local time = data.endTime - PlayerManager.serverTime
|
||||
local isBuy = this.IsBaseBuy(type)
|
||||
|
||||
isOpen = time > 0
|
||||
|
||||
-- 如果购买了结束也没有用
|
||||
if isBuy then
|
||||
if isBuy then
|
||||
isOpen = true
|
||||
end
|
||||
end
|
||||
end
|
||||
else
|
||||
isOpen = false
|
||||
-- 如果购买了结束也没有用
|
||||
if this.IsBaseBuy(type) then
|
||||
if this.IsBaseBuy(type) then
|
||||
isOpen = true
|
||||
end
|
||||
end
|
||||
|
||||
return isOpen
|
||||
end
|
||||
end
|
||||
|
||||
--- 判断某一个鸡精是否购买
|
||||
function this.IsBaseBuy(type)
|
||||
local leftTime = this.GetGoodsEndTime(type)
|
||||
local isBuy = false
|
||||
if not leftTime then
|
||||
if not leftTime then
|
||||
isBuy = false
|
||||
else
|
||||
if leftTime <= 0 then
|
||||
if leftTime <= 0 then
|
||||
isBuy = false
|
||||
else
|
||||
isBuy = true
|
||||
|
|
@ -609,7 +613,7 @@ end
|
|||
---- 界面打开时设置一下服务器数据
|
||||
function this.SetSerData(goodsType)
|
||||
local endTime = this.GetGoodsEndTime(goodsType)
|
||||
if not endTime then return end
|
||||
if not endTime then return end
|
||||
|
||||
local startTime = endTime - 24 * 30 * 60 * 60
|
||||
local passSecond = GetTimeStamp() - startTime
|
||||
|
|
@ -630,43 +634,42 @@ local oneDaySeconds = 24 * 60 * 60
|
|||
function this.GetRewardDay(goodType)
|
||||
-- Log("天数 " .. getDay[goodType])
|
||||
-- 未激活时没有天数
|
||||
if not this.IsBaseBuy(goodType) then return 0 end
|
||||
if not this.IsBaseBuy(goodType) then return 0 end
|
||||
return getDay[goodType]
|
||||
end
|
||||
|
||||
--- 设置累计天数
|
||||
function this.SetSignRewarDay(goodType, second)
|
||||
if not getDay[goodType] then getDay[goodType] = {} end
|
||||
if not getDay[goodType] then getDay[goodType] = {} end
|
||||
-- 小于24小时按一天
|
||||
if second <= oneDaySeconds * 1 then
|
||||
if second <= oneDaySeconds * 1 then
|
||||
getDay[goodType] = 1
|
||||
elseif second >= oneDaySeconds * 30 then
|
||||
getDay[goodType] = 30
|
||||
elseif second >= oneDaySeconds * 30 then
|
||||
getDay[goodType] = 30
|
||||
else
|
||||
|
||||
local hour = math.ceil(math.ceil(second / 60) / 60)
|
||||
getDay[goodType] = math.ceil(hour / 24)
|
||||
-- Log("累计" .. hour .. "小时")
|
||||
getDay[goodType] = getDay[goodType] >= 30 and 30 or getDay[goodType]
|
||||
end
|
||||
end
|
||||
getDay[goodType] = getDay[goodType] >= 30 and 30 or getDay[goodType]
|
||||
end
|
||||
end
|
||||
|
||||
-- 显示数据
|
||||
function this.GetShowTime(endTime)
|
||||
local duration = 30 * 24 * 60 * 60
|
||||
local endStr = os.date(Language[11383], endTime)
|
||||
local startStr = os.date(Language[11383], endTime - duration + 1)
|
||||
local endStr = os.date(Language[12016], endTime)
|
||||
local startStr = os.date(Language[12016], endTime - duration + 1)
|
||||
return startStr, endStr
|
||||
end
|
||||
|
||||
|
||||
--礼包抢购是否开启
|
||||
function this.IsGiftBuyActive()
|
||||
local activeNum = 0
|
||||
local GiftBuyData = ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.RechargeCommodityConfig, "ShowType", 20, "Type", GoodsTypeDef.DirectPurchaseGift)
|
||||
local GiftBuyData = ConfigManager.GetAllConfigsDataByDoubleKey(ConfigName.RechargeCommodityConfig, "ShowType", 20,
|
||||
"Type", GoodsTypeDef.DirectPurchaseGift)
|
||||
if GiftBuyData then
|
||||
for i = 1, #GiftBuyData do
|
||||
local curgoodData = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.DirectPurchaseGift, GiftBuyData[i].Id)
|
||||
local curgoodData = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.DirectPurchaseGift, GiftBuyData[i].Id)
|
||||
if curgoodData then
|
||||
if curgoodData.endTime - GetTimeStamp() > 0 then
|
||||
activeNum = activeNum + 1
|
||||
|
|
@ -677,7 +680,6 @@ function this.IsGiftBuyActive()
|
|||
return activeNum > 0
|
||||
end
|
||||
|
||||
|
||||
-- function this.GetTimeLimitRedPointStatus()
|
||||
-- local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
|
||||
-- local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.FindFairy)
|
||||
|
|
@ -692,64 +694,64 @@ end
|
|||
-- RecruitManager.freeUseTimeList[freeTimesId]=freeTime
|
||||
-- return freeTime and freeTime >= 1
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
--检测心愿抽卡活动红点
|
||||
function this.GetWishDrawRedPointStatus()
|
||||
local isOpen =CheckFunctionOpenClient(FUNCTION_OPEN_TYPE.ChouJiangRukou)
|
||||
if isOpen==false then
|
||||
local isOpen = CheckFunctionOpenClient(FUNCTION_OPEN_TYPE.ChouJiangRukou)
|
||||
if isOpen == false then
|
||||
return false
|
||||
end
|
||||
local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LimitUpHero)
|
||||
if not activityId then
|
||||
return false
|
||||
end
|
||||
local wish=ConfigManager.TryGetConfigData(ConfigName.WishActivitySetting,1)
|
||||
local wish = ConfigManager.TryGetConfigData(ConfigName.WishActivitySetting, 1)
|
||||
if not wish then
|
||||
return false
|
||||
end
|
||||
local freeTimesId=wish.FreeTimes
|
||||
local freeTime= 0
|
||||
if freeTimesId>0 then
|
||||
freeTime= PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
|
||||
RecruitManager.freeUseTimeList[freeTimesId]=freeTime
|
||||
local freeTimesId = wish.FreeTimes
|
||||
local freeTime = 0
|
||||
if freeTimesId > 0 then
|
||||
freeTime = PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
|
||||
RecruitManager.freeUseTimeList[freeTimesId] = freeTime
|
||||
return freeTime and freeTime >= 1
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
function this.GetTianDiHongLuRedPointStatus()
|
||||
local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
|
||||
local lotterySetting = ConfigManager.GetConfig(ConfigName.LotterySetting)
|
||||
local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.tiandihonglu)
|
||||
if not activityId then
|
||||
return false
|
||||
end
|
||||
local array = ConfigManager.GetConfigDataByDoubleKey(ConfigName.LotterySetting,"ActivityId",activityId,"PerCount",1)
|
||||
local freeTimesId=lotterySetting[array.Id].FreeTimes
|
||||
local freeTime= 0
|
||||
if freeTimesId>0 then
|
||||
freeTime= PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
|
||||
RecruitManager.freeUseTimeList[freeTimesId]=freeTime
|
||||
local array = ConfigManager.GetConfigDataByDoubleKey(ConfigName.LotterySetting, "ActivityId", activityId, "PerCount",
|
||||
1)
|
||||
local freeTimesId = lotterySetting[array.Id].FreeTimes
|
||||
local freeTime = 0
|
||||
if freeTimesId > 0 then
|
||||
freeTime = PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
|
||||
RecruitManager.freeUseTimeList[freeTimesId] = freeTime
|
||||
return freeTime and freeTime >= 1
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function this.GetQiankunBoxRedPointStatus()
|
||||
local lotterySetting=ConfigManager.GetConfig(ConfigName.LotterySetting)
|
||||
local lotterySetting = ConfigManager.GetConfig(ConfigName.LotterySetting)
|
||||
local activityId = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.QianKunBox)
|
||||
if not activityId then
|
||||
return false
|
||||
end
|
||||
local array = ConfigManager.GetConfigDataByDoubleKey(ConfigName.LotterySetting,"ActivityId",activityId,"PerCount",1)
|
||||
local freeTimesId=lotterySetting[array.Id].FreeTimes
|
||||
local freeTime= 0
|
||||
if freeTimesId>0 then
|
||||
freeTime= PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
|
||||
RecruitManager.freeUseTimeList[freeTimesId]=freeTime
|
||||
local array = ConfigManager.GetConfigDataByDoubleKey(ConfigName.LotterySetting, "ActivityId", activityId, "PerCount",
|
||||
1)
|
||||
local freeTimesId = lotterySetting[array.Id].FreeTimes
|
||||
local freeTime = 0
|
||||
if freeTimesId > 0 then
|
||||
freeTime = PrivilegeManager.GetPrivilegeRemainValue(freeTimesId)
|
||||
RecruitManager.freeUseTimeList[freeTimesId] = freeTime
|
||||
return freeTime and freeTime >= 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
this.TimeLimitedTimes = 0
|
||||
this.allData = {}
|
||||
|
|
@ -757,18 +759,18 @@ function this.InitDynamicActData()
|
|||
local id = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.DynamicAct)
|
||||
if (not id) or id < 1 then
|
||||
return nil
|
||||
end
|
||||
end
|
||||
this.allData = {}
|
||||
local allListData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ThemeActivityTaskConfig, "ActivityId", id)
|
||||
local allMissionData = TaskManager.GetTypeTaskList(TaskTypeDef.DynamicActTask)
|
||||
-- --LogGreen("allMissionData:"..#allMissionData)
|
||||
for i=1,#allListData do
|
||||
for j=1,#allMissionData do
|
||||
if allListData[i].Id == allMissionData[j].missionId then
|
||||
for i = 1, #allListData do
|
||||
for j = 1, #allMissionData do
|
||||
if allListData[i].Id == allMissionData[j].missionId then
|
||||
local data = {}
|
||||
data.id = allMissionData[j].missionId
|
||||
data.progress = allMissionData[j].progress
|
||||
local strs = string.split(GetLanguageStrById(allListData[i].Show),"#")
|
||||
data.progress = allMissionData[j].progress
|
||||
local strs = string.split(GetLanguageStrById(allListData[i].Show), "#")
|
||||
data.title = strs[1]
|
||||
data.content = strs[2]
|
||||
data.value = allListData[i].TaskValue[2][1]
|
||||
|
|
@ -782,21 +784,22 @@ function this.InitDynamicActData()
|
|||
-- data.state = 0
|
||||
-- end
|
||||
-- end
|
||||
data.type = allListData[i].Type
|
||||
data.reward = {allListData[i].Integral[1][1],allListData[i].Integral[1][2]}
|
||||
data.type = allListData[i].Type
|
||||
data.reward = { allListData[i].Integral[1][1], allListData[i].Integral[1][2] }
|
||||
data.jump = allListData[i].Jump[1]
|
||||
table.insert(this.allData,data)
|
||||
table.insert(this.allData, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
return this.allData
|
||||
end
|
||||
|
||||
function this.CheckDynamicActTaskRed(red)
|
||||
this.InitDynamicActData()
|
||||
this.InitDynamicActData()
|
||||
if not this.allData then
|
||||
return false
|
||||
end
|
||||
local type
|
||||
local type
|
||||
if red == RedPointType.DynamicActTask_MeiRi then
|
||||
type = 1
|
||||
elseif red == RedPointType.DynamicActTask_MeiZhou then
|
||||
|
|
@ -804,13 +807,14 @@ function this.CheckDynamicActTaskRed(red)
|
|||
else
|
||||
type = 0
|
||||
end
|
||||
for i=1,#this.allData do
|
||||
for i = 1, #this.allData do
|
||||
if this.allData[i].state == 1 and (type == 0 or (this.allData[i].type == type)) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function this.InitLeiJiChongZhiData(_type)
|
||||
local id = 0
|
||||
local type = _type
|
||||
|
|
@ -830,45 +834,48 @@ function this.InitLeiJiChongZhiData(_type)
|
|||
end
|
||||
else
|
||||
type = ActivityTypeDef.AccumulativeRechargeExper
|
||||
local tempConfig = ConfigManager.GetConfigData(ConfigName.GlobalActivity,id)
|
||||
local tempConfig = ConfigManager.GetConfigData(ConfigName.GlobalActivity, id)
|
||||
if tempConfig and tempConfig.ShowArt == 1 then
|
||||
return nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
this.LeiJiChongZhiData = {}
|
||||
local allListData = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig, "ActivityId", id)
|
||||
local allMissionData = ActivityGiftManager.GetActivityTypeInfo(type)
|
||||
for i=1,#allListData do
|
||||
for j=1,#allMissionData.mission do
|
||||
for i = 1, #allListData do
|
||||
for j = 1, #allMissionData.mission do
|
||||
if allListData[i].Id == allMissionData.mission[j].missionId then
|
||||
local data = {}
|
||||
data.id = allMissionData.mission[j].missionId
|
||||
data.id = allMissionData.mission[j].missionId
|
||||
data.progress = allMissionData.value
|
||||
data.value = allListData[i].Values[1][1]
|
||||
data.state = allMissionData.mission[j].state == 1 and allMissionData.mission[j].state or (data.progress>= data.value and 2 or 0) -- 0 前往 1已领奖 2领奖
|
||||
data.state = allMissionData.mission[j].state == 1 and allMissionData.mission[j].state or
|
||||
(data.progress >= data.value and 2 or 0) -- 0 前往 1已领奖 2领奖
|
||||
data.reward = allListData[i].Reward
|
||||
data.jump = allListData[i].Jump[1]
|
||||
table.insert(this.LeiJiChongZhiData,data)
|
||||
table.insert(this.LeiJiChongZhiData, data)
|
||||
end
|
||||
end
|
||||
end
|
||||
return this.LeiJiChongZhiData
|
||||
end
|
||||
|
||||
function this.CheckLeiJiChongZhiRedData()
|
||||
local mission = this.InitLeiJiChongZhiData()
|
||||
if not mission or #mission < 1 then
|
||||
return false
|
||||
end
|
||||
for j = 1,#mission do
|
||||
for j = 1, #mission do
|
||||
-- --LogGreen(mission[j].id..":"..mission[j].state)
|
||||
if mission[j].state == 2 then
|
||||
return true
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function this.CheckWeekGiftPageRedPoint()
|
||||
local boughtNum = 0
|
||||
local limitNum = 0
|
||||
|
|
@ -877,14 +884,15 @@ function this.CheckWeekGiftPageRedPoint()
|
|||
if rechargeConfig[shopData[i].goodsId].ShowType == DirectBuyType.WEEK_GIFT then
|
||||
boughtNum = OperatingManager.GetGoodsBuyTime(GoodsTypeDef.DirectPurchaseGift, shopData[i].goodsId)
|
||||
limitNum = rechargeConfig[shopData[i].goodsId].Limit
|
||||
local isCanBuy = limitNum - boughtNum >0
|
||||
local isCanBuy = limitNum - boughtNum > 0
|
||||
if isCanBuy and rechargeConfig[shopData[i].goodsId].Price <= 0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
function this.CheckMonthGiftPageRedPoint()
|
||||
local boughtNum = 0
|
||||
local limitNum = 0
|
||||
|
|
@ -893,7 +901,7 @@ function this.CheckMonthGiftPageRedPoint()
|
|||
if rechargeConfig[shopData[i].goodsId].ShowType == DirectBuyType.MONTH_GIFT then
|
||||
boughtNum = OperatingManager.GetGoodsBuyTime(GoodsTypeDef.DirectPurchaseGift, shopData[i].goodsId)
|
||||
limitNum = rechargeConfig[shopData[i].goodsId].Limit
|
||||
local isCanBuy = limitNum - boughtNum >0
|
||||
local isCanBuy = limitNum - boughtNum > 0
|
||||
if isCanBuy and rechargeConfig[shopData[i].goodsId].Price <= 0 then
|
||||
return true
|
||||
end
|
||||
|
|
@ -911,32 +919,29 @@ function this.CheckTimeLimitHeroStoreRedPoint()
|
|||
end
|
||||
local shopData = OperatingManager.GetGiftGoodsInfoList(GoodsTypeDef.DirectPurchaseGift)
|
||||
for i = 1, #shopData do
|
||||
if rechargeConfig[shopData[i].goodsId].ShowType == DirectBuyType.XIANSHIMIBAO then
|
||||
if rechargeConfig[shopData[i].goodsId].ShowType == DirectBuyType.XIANSHIMIBAO and rechargeConfig[shopData[i].goodsId].ShowType == 51 then
|
||||
boughtNum = OperatingManager.GetGoodsBuyTime(GoodsTypeDef.DirectPurchaseGift, shopData[i].goodsId)
|
||||
limitNum = rechargeConfig[shopData[i].goodsId].Limit
|
||||
local isCanBuy = limitNum - boughtNum >0
|
||||
local isCanBuy = limitNum - boughtNum > 0
|
||||
if isCanBuy and rechargeConfig[shopData[i].goodsId].Price <= 0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
local red=DynamicActivityManager.CheckMingWangRed()
|
||||
local red = DynamicActivityManager.CheckMingWangRed()
|
||||
if red then
|
||||
return true
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
function this.CheckWishEquipStoreRedPoint()
|
||||
local boughtNum = 0
|
||||
local limitNum = 0
|
||||
|
||||
local isOpen =CheckFunctionOpen(FUNCTION_OPEN_TYPE.EquipWish)
|
||||
if isOpen==false then
|
||||
return false
|
||||
local isOpen = CheckFunctionOpen(FUNCTION_OPEN_TYPE.EquipWish)
|
||||
if isOpen == false then
|
||||
return false
|
||||
end
|
||||
local activityId = ActivityGiftManager.IsActivityTypeOpen(20015)
|
||||
if not activityId then
|
||||
|
|
@ -944,30 +949,27 @@ function this.CheckWishEquipStoreRedPoint()
|
|||
end
|
||||
local shopData = OperatingManager.GetGiftGoodsInfoList(GoodsTypeDef.DirectPurchaseGift)
|
||||
for i = 1, #shopData do
|
||||
if rechargeConfig[shopData[i].goodsId].ShowType == DirectBuyType.XIANSHIMIBAO then
|
||||
if rechargeConfig[shopData[i].goodsId].ShowType == DirectBuyType.XIANSHIMIBAO and rechargeConfig[shopData[i].goodsId].ShowType == 60 then
|
||||
boughtNum = OperatingManager.GetGoodsBuyTime(GoodsTypeDef.DirectPurchaseGift, shopData[i].goodsId)
|
||||
limitNum = rechargeConfig[shopData[i].goodsId].Limit
|
||||
local isCanBuy = limitNum - boughtNum >0
|
||||
local isCanBuy = limitNum - boughtNum > 0
|
||||
if isCanBuy and rechargeConfig[shopData[i].goodsId].Price <= 0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
local red=DynamicActivityManager.CheckMingWangRed()
|
||||
local red = DynamicActivityManager.CheckMingWangRed()
|
||||
if red then
|
||||
return true
|
||||
return true
|
||||
end
|
||||
return false
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
||||
--为限时神装写的(只有一个)
|
||||
function this.GetTimeLimitSkinInfoList()
|
||||
local giftList={}
|
||||
local infoList = OperatingManager.GetGiftGoodsInfoList(GoodsTypeDef.DirectPurchaseGift)--拿取所有类型5礼包信息(包含需要的礼包)
|
||||
local infoList2 = ConfigManager.GetConfigDataByKey(ConfigName.RechargeCommodityConfig,"ShowType",29)
|
||||
local giftList = {}
|
||||
local infoList = OperatingManager.GetGiftGoodsInfoList(GoodsTypeDef.DirectPurchaseGift) --拿取所有类型5礼包信息(包含需要的礼包)
|
||||
local infoList2 = ConfigManager.GetConfigDataByKey(ConfigName.RechargeCommodityConfig, "ShowType", 29)
|
||||
for index, value in pairs(infoList) do
|
||||
if infoList2.Id == value.goodsId and value.dynamicBuyTimes > 0 then
|
||||
return value
|
||||
|
|
@ -975,36 +977,30 @@ function this.GetTimeLimitSkinInfoList()
|
|||
end
|
||||
return nil
|
||||
end
|
||||
|
||||
--为限时折扣写的(含有多个)
|
||||
function this.GetInfoList(showData)
|
||||
local giftList={}
|
||||
local infoList = OperatingManager.GetGiftGoodsInfoList(GoodsTypeDef.DirectPurchaseGift)--拿取所有类型5礼包信息(包含需要的礼包)
|
||||
local giftList = {}
|
||||
local infoList = OperatingManager.GetGiftGoodsInfoList(GoodsTypeDef.DirectPurchaseGift) --拿取所有类型5礼包信息(包含需要的礼包)
|
||||
if not showData or #showData < 1 then
|
||||
return giftList
|
||||
end
|
||||
local giftList2 = {}
|
||||
for i = 1,#showData[1] do
|
||||
local infoList2 = ConfigManager.TryGetAllConfigsDataByKey(ConfigName.RechargeCommodityConfig,"ShowType",showData[1][i])
|
||||
if infoList2 then
|
||||
for i = 1, #infoList2 do
|
||||
table.insert(giftList2,infoList2[i])
|
||||
end
|
||||
else
|
||||
LogError("没有ShowType的推送礼包====="..showData[1][i])
|
||||
for i = 1, #showData[1] do
|
||||
local infoList2 = ConfigManager.GetAllConfigsDataByKey(ConfigName.RechargeCommodityConfig, "ShowType",
|
||||
showData[1][i])
|
||||
for i = 1, #infoList2 do
|
||||
table.insert(giftList2, infoList2[i])
|
||||
end
|
||||
|
||||
end
|
||||
if infoList then
|
||||
for index, value in pairs(infoList) do
|
||||
for i = 1, #giftList2 do
|
||||
if giftList2[i].Id == value.goodsId and value.dynamicBuyTimes > 0 then
|
||||
table.insert(giftList,value)
|
||||
end
|
||||
for index, value in pairs(infoList) do
|
||||
for i = 1, #giftList2 do
|
||||
if giftList2[i].Id == value.goodsId and value.dynamicBuyTimes > 0 then
|
||||
table.insert(giftList, value)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return giftList
|
||||
end
|
||||
|
||||
return this
|
||||
return this
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
local RechargeView = {}
|
||||
local RechargeView = {}
|
||||
function RechargeView:New(gameObject)
|
||||
local b = {}
|
||||
b.gameObject = gameObject
|
||||
|
|
@ -102,4 +102,3 @@ end
|
|||
|
||||
|
||||
return RechargeView
|
||||
|
||||
|
|
|
|||
|
|
@ -10,12 +10,12 @@ end
|
|||
|
||||
--添加事件监听(用于子类重写)
|
||||
function RechargeViewNew:AddListener()
|
||||
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess,self.SetGrowGift,self)
|
||||
Game.GlobalEvent:AddEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.SetGrowGift, self)
|
||||
end
|
||||
|
||||
--移除事件监听(用于子类重写)
|
||||
function RechargeViewNew:RemoveListener()
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess,self.SetGrowGift,self)
|
||||
Game.GlobalEvent:RemoveEvent(GameEvent.MoneyPay.OnPayResultSuccess, self.SetGrowGift, self)
|
||||
end
|
||||
|
||||
function RechargeViewNew:InitComponent()
|
||||
|
|
@ -28,9 +28,9 @@ function RechargeViewNew:InitComponent()
|
|||
end
|
||||
-- 显示特权信息
|
||||
--===================成长礼包================
|
||||
self.grow = Util.GetGameObject(self.gameObject,"growPack/Content")
|
||||
self.tip = Util.GetGameObject(self.grow,"Tip"):GetComponent("Text")
|
||||
self.icon = Util.GetGameObject(self.grow,"Icon"):GetComponent("Image")
|
||||
self.grow = Util.GetGameObject(self.gameObject, "growPack/Content")
|
||||
self.tip = Util.GetGameObject(self.grow, "Tip"):GetComponent("Text")
|
||||
self.icon = Util.GetGameObject(self.grow, "Icon"):GetComponent("Image")
|
||||
self.Level = Util.GetGameObject(self.grow,"Icon/Level"):GetComponent("Text")
|
||||
self.name = Util.GetGameObject(self.grow,"Name"):GetComponent("Image")
|
||||
self.name.sprite=self.spLoader:LoadSprite("gm_mingwang_title")
|
||||
|
|
@ -49,13 +49,13 @@ function RechargeViewNew:InitComponent()
|
|||
self.endTimeBg = Util.GetGameObject(self.gameObject,"growPack/Time")
|
||||
self.endTimeBg.gameObject:SetActive(false)
|
||||
self.ItemList = {}
|
||||
|
||||
end
|
||||
|
||||
function RechargeViewNew:BindEvent()
|
||||
end
|
||||
|
||||
--界面打开时调用(用于子类重写)
|
||||
function RechargeViewNew:OnOpen(_activityConfig,_index,parent)
|
||||
function RechargeViewNew:OnOpen(_activityConfig, _index, parent)
|
||||
self.actConfig = _activityConfig
|
||||
self.pageIndex = _index
|
||||
self.parent = parent
|
||||
|
|
@ -67,7 +67,12 @@ end
|
|||
function RechargeViewNew:OnShow(_sortingOrder)
|
||||
self.gameObject:SetActive(true)
|
||||
self.sortingOrder = _sortingOrder
|
||||
self.shopView:ShowShop(SHOP_TYPE.SOUL_STONE_SHOP, self.sortingOrder)
|
||||
LogError("self.actConfig=============" .. self.actConfig.ShopData[1][3])
|
||||
local showType = 3
|
||||
if self.actConfig.ShopData and #self.actConfig.ShopData > 0 then
|
||||
showType = self.actConfig.ShopData[1][3]
|
||||
end
|
||||
self.shopView:ShowShop(SHOP_TYPE.SOUL_STONE_SHOP, self.sortingOrder, showType)
|
||||
self:SetGrowGift()
|
||||
end
|
||||
|
||||
|
|
@ -103,7 +108,7 @@ function RechargeViewNew:SetGrowGift()
|
|||
end
|
||||
end
|
||||
|
||||
Log("当前声望Level:"..tostring(DynamicActivityManager.curLevel).." Index:"..tostring(DynamicActivityManager.Index))
|
||||
Log("当前声望Level:" .. tostring(DynamicActivityManager.curLevel) .. " Index:" .. tostring(DynamicActivityManager.Index))
|
||||
--如果有当前声望数据,就显示,没有就显示上一档位
|
||||
--local data = not not growData[DynamicActivityManager.Index] and growData[DynamicActivityManager.Index] or growData[DynamicActivityManager.Index-1]
|
||||
local data=growData[DynamicActivityManager.Index]
|
||||
|
|
@ -112,24 +117,25 @@ function RechargeViewNew:SetGrowGift()
|
|||
end
|
||||
self:RefreshReward(data)
|
||||
|
||||
Util.AddOnceClick(self.btnLeft,function ()
|
||||
Util.AddOnceClick(self.btnLeft, function()
|
||||
if growData[DynamicActivityManager.Index - 1] then
|
||||
DynamicActivityManager.Index = DynamicActivityManager.Index - 1
|
||||
self:RefreshReward(growData[DynamicActivityManager.Index])
|
||||
end
|
||||
end)
|
||||
Util.AddOnceClick(self.btnRight,function ()
|
||||
Util.AddOnceClick(self.btnRight, function()
|
||||
if growData[DynamicActivityManager.Index + 1] then
|
||||
DynamicActivityManager.Index = DynamicActivityManager.Index + 1
|
||||
self:RefreshReward(growData[DynamicActivityManager.Index])
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
--刷新奖励、按钮显示
|
||||
function RechargeViewNew:RefreshReward(Data)
|
||||
local rechargeNum =BagManager.GetItemCountById(1351) --VipManager.GetChargedNum()--已经充值的金额
|
||||
self.btnLeft:SetActive(not not growData[DynamicActivityManager.Index - 1])--左按钮显示
|
||||
self.btnRight:SetActive(not not growData[DynamicActivityManager.Index + 1])--右按钮显示
|
||||
local rechargeNum = BagManager.GetItemCountById(1351) --VipManager.GetChargedNum()--已经充值的金额
|
||||
self.btnLeft:SetActive(not not growData[DynamicActivityManager.Index - 1]) --左按钮显示
|
||||
self.btnRight:SetActive(not not growData[DynamicActivityManager.Index + 1]) --右按钮显示
|
||||
-- LogPink(DynamicActivityManager.Index.." 金额:"..tostring(Data.data.shopItemData.BuyRule[2]).." 限购:"..tostring(Data.data.limitNum).." 已购:"..tostring(Data.data.boughtNum).." rechargeNum:"..tostring(rechargeNum))
|
||||
local text = 1
|
||||
local num = 0
|
||||
|
|
@ -142,8 +148,8 @@ function RechargeViewNew:RefreshReward(Data)
|
|||
text = DynamicActivityManager.Index
|
||||
num = growData[DynamicActivityManager.Index].data.shopItemData.BuyRule[2]
|
||||
end
|
||||
num=DynamicActivityManager.GetMingWangLv(num)
|
||||
local aaa=growData[DynamicActivityManager.curLevel].data.shopItemData.BuyRule[2]
|
||||
num = DynamicActivityManager.GetMingWangLv(num)
|
||||
local aaa = growData[DynamicActivityManager.curLevel].data.shopItemData.BuyRule[2]
|
||||
if DynamicActivityManager.curLevel <= 2 then
|
||||
--self.tip.text = string.format("再获得%s积分升至名望1",num - rechargeNum)
|
||||
elseif DynamicActivityManager.curLevel + 1 >= #growData and rechargeNum >= DynamicActivityManager.GetMingWangLv(aaa) then
|
||||
|
|
@ -215,6 +221,7 @@ function RechargeViewNew:RefreshReward(Data)
|
|||
self.ItemList[i] = SubUIManager.Open(SubUIConfig.ItemView,self.reward.transform)
|
||||
end
|
||||
self.ItemList[i]:OnOpen(false, {Data.data.shows[i][1],Data.data.shows[i][2],Data.data.shows[i][3]}, 0.9,false,false,false,self.sortingOrder)
|
||||
--false, false, false, self.sortingOrder)
|
||||
self.ItemList[i].gameObject:SetActive(true)
|
||||
end
|
||||
|
||||
|
|
@ -259,7 +266,4 @@ function RechargeViewNew:OnDestroy()
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
return RechargeViewNew
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
local _ShopTypeConfig = ConfigManager.GetConfig(ConfigName.StoreTypeConfig)
|
||||
local itemConfig = ConfigManager.GetConfig(ConfigName.ItemConfig)
|
||||
local rechargeOrder = ConfigManager.GetConfig(ConfigName.RechargeCommodityorder)
|
||||
-- 通用得商店逻辑
|
||||
local ShopView = {}
|
||||
local this = ShopView
|
||||
|
|
@ -54,13 +56,12 @@ function this:InitComponent()
|
|||
self.rechargeShopItem = Util.GetGameObject(self.gameObject, "scrollbg/scrollroot/item")
|
||||
self.titleBg = Util.GetGameObject(self.gameObject, "titlebg")
|
||||
self.titleImg = Util.GetGameObject(self.gameObject, "titlebg/title")
|
||||
self.titleText = Util.GetGameObject(self.gameObject, "titlebg/title/titleText")
|
||||
self.helpBtn = Util.GetGameObject(self.gameObject, "titlebg/helpBtn") --scrollbg/titlebg/
|
||||
self.helpPosition = self.helpBtn:GetComponent("RectTransform").localPosition
|
||||
-- 创建循环列表
|
||||
if not self.ScrollView then
|
||||
self.ScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.scrollRoot.transform,
|
||||
self.shopItem, nil, Vector2.New(1060, 1000), 1, 2, Vector2.New(25, 20))
|
||||
self.shopItem, nil, Vector2.New(1000, 1024), 1, 3, Vector2.New(80, 0))
|
||||
self.ScrollView.moveTween.MomentumAmount = 1
|
||||
self.ScrollView.moveTween.Strength = 2
|
||||
end
|
||||
|
|
@ -69,7 +70,7 @@ function this:InitComponent()
|
|||
-- 创建循环列表
|
||||
if not self.RechargeScrollView then
|
||||
self.RechargeScrollView = SubUIManager.Open(SubUIConfig.ScrollCycleView, self.scrollRoot.transform,
|
||||
self.rechargeShopItem, nil, Vector2.New(1000, 1024), 1, 3, Vector2.New(40, 10))
|
||||
self.rechargeShopItem, nil, Vector2.New(1000, 1024), 1, 3, Vector2.New(80, 0))
|
||||
self.RechargeScrollView.moveTween.MomentumAmount = 1
|
||||
self.RechargeScrollView.moveTween.Strength = 2
|
||||
self.RechargeScrollView.gameObject.transform.localPosition = Vector3.New(0, -20, 0)
|
||||
|
|
@ -220,11 +221,14 @@ end
|
|||
-- 刷新商店内容显示
|
||||
function this:RefreshShopInfo(isRefresh, isTop, isAni)
|
||||
if self.ShopType == SHOP_TYPE.SOUL_STONE_SHOP then
|
||||
self.RechargeShopData = OperatingManager.GetGiftGoodsInfoList(GoodsTypeDef.DemonCrystal)
|
||||
if self.showType and self.showType ~= 0 then
|
||||
LogError("slef.shwotype==========================" .. self.showType)
|
||||
self.RechargeShopData = OperatingManager.GetGiftGoodsInfoList(self.showType)
|
||||
end
|
||||
else
|
||||
self.ShopData = ShopManager.GetShopDataByType(self.ShopType)
|
||||
end
|
||||
|
||||
LogError("ccccccccccccccccccc" .. tostring(self.ShopType) .. "/" .. tostring(self.showType))
|
||||
self:RefreshLive()
|
||||
self:RefreshBase()
|
||||
self:RefreshItemList(isRefresh, isTop, isAni)
|
||||
|
|
@ -429,7 +433,22 @@ function this:RefreshItemList(isRefresh, isTop, isAni)
|
|||
self.ScrollView.gameObject:SetActive(false)
|
||||
self.RechargeScrollView.gameObject:SetActive(true)
|
||||
local itemlist = self.RechargeShopData
|
||||
self.RechargeScrollView:SetData(itemlist, function(index, shopItem)
|
||||
local showList = {}
|
||||
LogError("#itemlist================================" .. #itemlist)
|
||||
for i = 1, #itemlist do
|
||||
local isCan = true
|
||||
for k, v in ConfigPairs(rechargeOrder) do
|
||||
if v.BehindCommodity == itemlist[i].goodsId then
|
||||
if VipManager.GetChargedNum() < v.RechargeAmount then
|
||||
isCan = false
|
||||
end
|
||||
end
|
||||
end
|
||||
if isCan then
|
||||
table.insert(showList, itemlist[i])
|
||||
end
|
||||
end
|
||||
self.RechargeScrollView:SetData(showList, function(index, shopItem)
|
||||
local itemData = itemlist[index]
|
||||
self:RechargeShopItemAdapter(shopItem, itemData)
|
||||
-- if isPlayShow then
|
||||
|
|
@ -485,11 +504,11 @@ function this:ShopItemAdapter(shopItem, itemData)
|
|||
local itemDes = Util.GetGameObject(bg, "itemDes"):GetComponent("Text")
|
||||
local limitBg = Util.GetGameObject(bg, "buyLimitbg")
|
||||
local limitTip = Util.GetGameObject(limitBg, "tip"):GetComponent("Text")
|
||||
Util.GetGameObject(limitBg, "buyLimit"):GetComponent("Text").text = ""
|
||||
local priceBg = Util.GetGameObject(bg, "pricebg")
|
||||
local itemPrice = Util.GetGameObject(bg, "pricebg/price"):GetComponent("Text")
|
||||
local costIcon = Util.GetGameObject(bg, "pricebg/costIcon"):GetComponent("Image")
|
||||
local discountbg = Util.GetGameObject(bg, "discountbg/zekouImage")
|
||||
local discountbg1 = Util.GetGameObject(bg, "discountbg")
|
||||
local empty = Util.GetGameObject(shopItem, "empty")
|
||||
local yihuode = Util.GetGameObject(shopItem, "yihuode")
|
||||
local lock = Util.GetGameObject(shopItem, "lock")
|
||||
|
|
@ -510,6 +529,7 @@ function this:ShopItemAdapter(shopItem, itemData)
|
|||
itemName.text = itemName.text ..
|
||||
"\n" ..
|
||||
string.format("<color=%s><size=%s>%s(%s/%s)</size></color>", "#FAE05C", "25", "拥有:", haveCount,
|
||||
haveCount,
|
||||
con.UsePerCount)
|
||||
end
|
||||
if con.ItemType == ItemType.Talisman then
|
||||
|
|
@ -517,7 +537,7 @@ function this:ShopItemAdapter(shopItem, itemData)
|
|||
if con.ItemDescribe then
|
||||
local str = string.split(con.ItemDescribe, ',')
|
||||
if str[1] then
|
||||
itemDes.text = str[1]
|
||||
itemDes.text = GetLanguageStrById(str[1])
|
||||
end
|
||||
else
|
||||
itemDes.gameObject:SetActive(false)
|
||||
|
|
@ -530,13 +550,12 @@ function this:ShopItemAdapter(shopItem, itemData)
|
|||
if price == 0 then
|
||||
discountbg1:SetActive(true)
|
||||
discountbg1:GetComponent("Image").sprite = self.spLoader:LoadSprite("X1_jingjichang_mianfei_zh")
|
||||
discountbg:SetActive(false)
|
||||
else
|
||||
local isDiscount = itemInfo.IsDiscount == 1
|
||||
discountbg1:SetActive(isDiscount)
|
||||
discountbg:SetActive(isDiscount)
|
||||
if isDiscount then
|
||||
discountbg:GetComponent("Text").text = itemInfo.DiscountDegree
|
||||
discountbg:GetComponent("Image").sprite = self.spLoader:LoadSprite("s_shop_zhekou_0" ..
|
||||
itemInfo.DiscountDegree .. "_zh")
|
||||
end
|
||||
end
|
||||
-- 消耗物品的信息
|
||||
|
|
@ -553,13 +572,13 @@ function this:ShopItemAdapter(shopItem, itemData)
|
|||
end
|
||||
end
|
||||
lock:SetActive(not _IsUnLock)
|
||||
--priceBg.gameObject:SetActive(_IsUnLock)
|
||||
priceBg.gameObject:SetActive(_IsUnLock)
|
||||
itemName.gameObject:SetActive(_IsUnLock)
|
||||
|
||||
-- -- 限购
|
||||
limitBg:SetActive(maxLimitCount ~= -1)
|
||||
limitTip.text = Language[12037] .. " " .. maxLimitCount
|
||||
SetTextVerTial(limitTip, Vector3.New(12.65, -4.2, 0), "MiddleLeft")
|
||||
--SetTextVerTial(limitTip, Vector3.New(12.65, -4.2, 0), "MiddleLeft")
|
||||
-- 售空 限购次数为-1 表示不限购
|
||||
local isEmpty = maxLimitCount ~= -1 and curBuyCount >= maxLimitCount
|
||||
if curBuyCount >= maxLimitCount then
|
||||
|
|
@ -590,7 +609,7 @@ function this:ShopItemAdapter(shopItem, itemData)
|
|||
local bgImage = Util.GetGameObject(bg, "Image")
|
||||
imgColor = isEmpty and Color.New(0.5, 0.5, 0.5, 1) or Color.New(0.54, 0.38, 0.81, 1)
|
||||
local pricebg = Util.GetGameObject(bg, "pricebg"):GetComponent("Image")
|
||||
pricebg.color =isEmpty and Color.New(0.1, 0.1, 0.1, 1) or Color.New(0.15, 0.15, 0.15, 1)
|
||||
pricebg.color = isEmpty and Color.New(0.1, 0.1, 0.1, 1) or Color.New(0.15, 0.15, 0.15, 1)
|
||||
Util.SetColor(bgImage, imgColor)
|
||||
SetAlpha(itemName, textA)
|
||||
--SetAlpha(limitTip, textA)
|
||||
|
|
@ -675,7 +694,12 @@ function this:RechargeShopItemAdapter(shopItem, itemData)
|
|||
-- 判断首充赠送
|
||||
local curBuyCount = itemData.buyTimes
|
||||
first:SetActive(curBuyCount < 1)
|
||||
firstNum.text = itemInfo.FirstMultiple[1][2]
|
||||
if itemInfo.FirstMultiple then
|
||||
firstNum.text = itemInfo.FirstMultiple[1][2]
|
||||
else
|
||||
firstNum.text = ""
|
||||
end
|
||||
|
||||
if itemInfo.ContinuedMultiple and tonumber(itemInfo.ContinuedMultiple[1]) ~= nil then
|
||||
xuChong:SetActive(curBuyCount >= 1)
|
||||
xuNum.text = itemInfo.ContinuedMultiple[2]
|
||||
|
|
@ -702,7 +726,7 @@ end
|
|||
|
||||
---=====================================对外接口=============================----
|
||||
-- 设置要显示的商店类型
|
||||
function this:ShowShop(shopType, _sortingOrder)
|
||||
function this:ShowShop(shopType, _sortingOrder, _showType)
|
||||
self.ScrollView:ForeachItemGO(function(index, go)
|
||||
go.gameObject:SetActive(false)
|
||||
end)
|
||||
|
|
@ -728,6 +752,7 @@ function this:ShowShop(shopType, _sortingOrder)
|
|||
|
||||
-- 刷新显示
|
||||
self.ShopType = shopType
|
||||
self.showType = _showType
|
||||
isPlayShow = true
|
||||
self.ShopId = ShopManager.GetShopDataByType(self.ShopType).id
|
||||
self.ShopConfig = _ShopTypeConfig[self.ShopId]
|
||||
|
|
|
|||
|
|
@ -75,6 +75,9 @@ function ForceRebuildLayout(_transform)
|
|||
end
|
||||
LayoutRebuilder.ForceRebuildLayoutImmediate(_transform)
|
||||
end
|
||||
if not LayoutRebuilder then
|
||||
LayoutRebuilder = UnityEngine.UI.LayoutRebuilder
|
||||
end
|
||||
end
|
||||
|
||||
function LoadStreamingTexture(spLoader, name, func)
|
||||
|
|
|
|||
Loading…
Reference in New Issue