【限时活动】结构调整

dev_chengFeng
ZhangBiao 2021-04-20 20:32:36 +08:00
parent d1bbe68ebf
commit a7bd34cdad
8 changed files with 33989 additions and 53 deletions

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 530d25de0c519564bb01b958b1946f25
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -421,4 +421,5 @@ SubUIConfig = {
[10] = {name = "CommonActPage",assetName = "CommonActPage",script = "Modules/NewActivity/CommonActPage"},--活动界面预设
[11] = {name = "ExpertPage",assetName = "ExpertPage",script = "Modules/NewActivity/ExpertPage"},--达人界面预设
[12] = {name = "ExpertPre",assetName = "ExpertPre",script = "Modules/NewActivity/ExpertPre"},--达人单条预设
[13] = {name = "ConRechargePage",assetName = "ConRechargePage",script = "Modules/NewActivity/ConRechargePage"},--积天豪礼界面预设
}

View File

@ -20,9 +20,113 @@ local TypeInitFunc = {
end
end
end
end
end,
[ActivityTypeDef.ContinuityRecharge] = function ()
this.GetExpertData(3,ActivityTypeDef.ContinuityRecharge)
end,
[ActivityTypeDef.UpStarExper] = function ()--进阶达人
this.GetExpertData(1,ActivityTypeDef.UpStarExper)
end,
[ActivityTypeDef.Talisman] = function ()--法宝达人
this.GetExpertData(1,ActivityTypeDef.Talisman)
end,
[ActivityTypeDef.SoulPrint] = function ()--魂印达人
this.GetExpertData(1,ActivityTypeDef.SoulPrint)
end,
[ActivityTypeDef.EquipExper] = function ()--装备达人
this.GetExpertData(1,ActivityTypeDef.EquipExper)
end,
[ActivityTypeDef.EnergyExper] = function ()--体力达人
this.GetExpertData(2,ActivityTypeDef.EnergyExper)
end,
[ActivityTypeDef.FindTreasureExper] = function ()--寻宝达人
this.GetExpertData(1,ActivityTypeDef.FindTreasureExper)
end,
[ActivityTypeDef.ExpeditionExper] = function ()--天宫达人
this.GetExpertData(1,ActivityTypeDef.ExpeditionExper)
end,
[ActivityTypeDef.FastExplore] = function ()--极速达人
this.GetExpertData(2,ActivityTypeDef.FastExplore)
end,
[ActivityTypeDef.GoldExper] = function ()--点金达人
this.GetExpertData(2,ActivityTypeDef.GoldExper)
end,
[ActivityTypeDef.FightExper] = function ()--副本达人
this.GetExpertData(2,ActivityTypeDef.FightExper)
end,
[ActivityTypeDef.AreaExper] = function ()
this.GetExpertData(2,ActivityTypeDef.AreaExper)
end,
[ActivityTypeDef.slhjExper] = function ()--森罗幻境达人
this.GetExpertData(2,ActivityTypeDef.slhjExper)
end,
[ActivityTypeDef.LuckyTurnExper] = function ()--探宝达人
this.GetExpertData(2,ActivityTypeDef.LuckyTurnExper)
end,
[ActivityTypeDef.RecruitExper] = function ()--征募达人
this.GetExpertData(2,ActivityTypeDef.RecruitExper)
end,
[ActivityTypeDef.SecretBoxExper] = function ()--秘宝达人
this.GetExpertData(2,ActivityTypeDef.SecretBoxExper)
end,
[ActivityTypeDef.AccumulativeRechargeExper] = function ()---日累计充值
this.GetExpertData(2,ActivityTypeDef.AccumulativeRechargeExper)
end,
[ActivityTypeDef.UpLvAct] = function ()---日累计充值
this.GetExpertData(2,ActivityTypeDef.UpLvAct)
end,
}
function this.GetExpertData(indexType,actType)
local curData = dataList[actType]
local actRewardConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.ActivityRewardConfig,"ActivityId", actType)
for i = 1, #curData.rewards do
for j = 1, #actRewardConfigs do
if curData.rewards[i].missionId == actRewardConfigs[j].Id then
if indexType == 3 then -- 3 积天豪礼
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[1][2]
if curData.rewards[i].state == 1 then
curData.rewards[i].otherData.state = 2
elseif curData.rewards[i].progress == 1 then
curData.rewards[i].otherData.state = 1
else
curData.rewards[i].otherData.state = 0
end
curData.rewards[i].otherData.info = string.format("%s/%s",curData.rewards[i].progress,curData.rewards[i].otherData.Values)
else --日累计充值 达人
if actType == ActivityTypeDef.AccumulativeRechargeExper then
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[1][1]
elseif actType == ActivityTypeDef.ContinuityRecharge then
curData.rewards[i].otherData.Values = actRewardConfigs[j].Values[2][1]
end
if curData.rewards[i].state == 1 then
curData.rewards[i].otherData.state = 2
else
if indexType == 1 then
if curData.rewards[i].progress < curData.rewards[i].otherData.Values then
curData.rewards[i].otherData.state = 0
else
curData.rewards[i].otherData.state = 1
end
curData.rewardends[i].otherData.info = string.format("%s/%s",curData.rewards[i].progress,curData.rewards[i].otherData.Values)
elseif indexType == 2 then
if curData.value < curData.rewards[i].otherData.Values then
curData.rewards[i].otherData.state = 0
else
curData.rewards[i].otherData.state = 1
end
curData.rewards[i].otherData.info = string.format("%s/%s",curData.value,curData.rewards[i].otherData.Values)
end
end
end
curData.rewards[i].otherData.Reward = actRewardConfigs[j].Reward
curData.rewards[i].otherData.ContentsShow = actRewardConfigs[j].ContentsShow
curData.rewards[i].otherData.Sort = actRewardConfigs[j].Sort
end
end
end
end
--数据刷新时是否需要前端自己刷新,如果有就写里面
local TypeUpdateFunc = {
[ActivityTypeDef.YunYouShangRen] = function ()
@ -38,6 +142,8 @@ function this.GetData(actType)
dataList[actType] = this.InitSingleTypeData(actType)
if TypeInitFunc[actType] then
TypeInitFunc[actType]()
else
TypeInitFunc[-1]()
end
end
this.UpdateSingleTypeData(actType)

View File

@ -0,0 +1,167 @@
local ConRechargePage = {}
local rechargeNum = 0
function ConRechargePage:New(gameObject)
local b = {}
b.gameObject = gameObject
b.transform = gameObject.transform
setmetatable(b, { __index = ConRechargePage })
return b
end
local _MoneyConfig = {
[MoneyType.RMB] = Language[12282],
[MoneyType.USD] = Language[12283]
}
--添加事件监听(用于子类重写)
function ConRechargePage:AddListener()
Game.GlobalEvent:AddEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, self.RefreshPanel, self)
Game.GlobalEvent:AddEvent(GameEvent.Activity.ContinueRechargeRefresh, self.RefreshPanel, self)
end
--移除事件监听(用于子类重写)
function ConRechargePage:RemoveListener()
Game.GlobalEvent:RemoveEvent(GameEvent.FiveAMRefresh.ServerNotifyRefresh, self.RefreshPanel, self)
Game.GlobalEvent:RemoveEvent(GameEvent.Activity.ContinueRechargeRefresh, self.RefreshPanel, self)
end
function ConRechargePage:InitComponent()
self.sortingOrder = 0
self.Scroll = Util.GetGameObject(self.gameObject, "Content/Scroll")
self.itemPre = Util.GetGameObject(self.gameObject, "itemPre")
self.effect = Util.GetGameObject(self.gameObject, "UI_effect_OperatingPanel_normal")
self.image = Util.GetGameObject(self.gameObject, "Content/Image")
self.title1 = Util.GetGameObject(self.image, "title1"):GetComponent("Text")
self.obj = Util.GetGameObject(self.image, "obj")
if not self.moneyNum then
self.moneyNum = SubUIManager.Open(SubUIConfig.MoneyNumView, self.image.transform,
math.round(MoneyUtil.GetMoney(2000)) , MoneyNumViewType.Image_Horizontal, "ArtFont_2_cfont", 42, 0.7, Vector2.New(118, 161), Vector2.New(-30, -50), MoneyNumViewImageType.Big_1)
self.moneyNum:SetOffsetPosition(Vector2.New(0, -450))
end
end
function ConRechargePage:BindEvent()
Util.AddClick(self.btnHelp,function()
UIManager.OpenPanel(UIName.HelpPopup,self.actConfig.HelpId,self.helpPosition.x,self.helpPosition.y)
end)
end
--界面打开时调用(用于子类重写)
function ConRechargePage:OnOpen(_activityConfig,_index,parent)
self.actConfig = _activityConfig
self.pageIndex = _index
self.parent = parent
self.gameObject.name = "ConRechargePage"..self.actConfig.Id
end
-- 打开,重新打开时回调
function ConRechargePage:OnShow(_sortingOrder)
self.gameObject:SetActive(true)
self.sortingOrder = _sortingOrder or self.sortingOrder
self.actId = self.actConfig.ActId
self.actType = self.actConfig.ActiveType
if self.actConfig.IfBack == 1 then
if self.actConfig.ActiveType > 0 then
local id = ActivityGiftManager.IsActivityTypeOpen(self.actConfig.ActiveType)
if id and id > 0 then
self.actId = id
local config = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.ActivityGroups,"PageType",self.actConfig.PageType,"ActiveType",self.actConfig.ActiveType,"ActId",id)
if config then
self.actConfig = config
end
else
LogRed("活动类型:"..tostring(self.actConfig.ActiveType).."的活动未开启")
end
end
end
if self.actConfig.Icon[3] and self.actConfig.Icon[3] ~= "" then
self.bg.sprite = Util.LoadSprite(self.actConfig.Icon[3])
end
self.title1.text = _MoneyConfig[MoneyUtil.MT]
if GetCurLanguage() == 1 then
SetTextVerTial(self.title1,Vector3.New(38.295,152,0))
self.image.transform.localPosition = Vector2.New(-354,403)
elseif GetCurLanguage() == 2 then
SetTextVerTial(self.title1,Vector3.New(172.5,152,0))
self.obj.transform.localPosition = Vector2.New(-60,0)
end
Util.AddParticleSortLayer( self.effect, _sortingOrder - self.sortingOrder)
self.sortingOrder = _sortingOrder
--拿取数据
self:RefreshData(true,true)
end
--刷新数据
function ConRechargePage:RefreshData(isTop,isAni)
self.ActData = ConRechargePageManager.GetData(self.actConfig.ActiveType)
if self.actConfig.RpType > 0 then
CheckRedPointStatus(self.actConfig.RpType)
end
self:RefreshActData(isTop,isAni)
self:RefreshTime()
end
--刷新活动数据
function ConRechargePage:RefreshActData(isTop,isAni)
self.scrollView:ForeachItemGO(function(index, go)
go.gameObject:SetActive(false)
end)
self.scrollView:SetData(self.ActData.rewards, function (index, item)
self:ShowSingleData(item, self.ActData.rewards[index],index)
end,not isTop,not isAni)
end
function ConRechargePage:ShowSingleData(item,sdata,index)
if not self.ItemList then
self.ItemList = {}
end
if not self.ItemList[item] then
local subConfig = SubUIConfig[self.actConfig.UIName[2]]
self.ItemList[item] = SubUIManager.Open(subConfig,item.transform)
end
if not sdata then
item.gameObject:SetActive(false)
return
end
item.gameObject:SetActive(true)
self.ItemList[item]:SetData(sdata,self,self.sortingOrder,self.ActData.activityId)
end
function ConRechargePage:RefreshTime()
if self.actConfig.ShowTime == 0 then
self.time:SetActive(false)
return
end
if self.localTimer then
self.localTimer:Stop()
self.localTimer = nil
end
self.time:SetActive(true)
local freshTime = self.ActData.endTime - GetTimeStamp()
self.timeText.text = Language[10023]..TimeToFelaxible(freshTime)
self.localTimer = Timer.New(function ()
freshTime = freshTime - 1
self.timeText.text = Language[10023]..TimeToFelaxible(freshTime)
if freshTime <= 0 then
self.parent:ClosePanel()
end
end, 1, -1, true)
self.localTimer:Start()
end
function ConRechargePage:OnClose()
self.gameObject:SetActive(false)
end
function ConRechargePage:OnDestroy()
for k,v in pairs(self.ItemList) do
SubUIManager.Close(v)
end
self.ItemList = {}
if self.scrollView then
SubUIManager.Close(self.scrollView)
end
self.scrollView=nil
end
return ConRechargePage

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: db6fbabf75c82044b97162ab74c52415
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -84,7 +84,7 @@ function ExpertPage:OnShow(_sortingOrder)
self.btnHelp:SetActive(true)
end
--拿取数据
self:RefreshData(true,true,true)
self:RefreshData(true,true)
self:RefreshBtns()--刷新上方两个按钮
end
@ -105,7 +105,7 @@ function ExpertPage:RefreshBtns()
end
--刷新数据
function ExpertPage:RefreshData(isUpdata,isTop,isAni)
function ExpertPage:RefreshData(isTop,isAni)
self.ActData = CommonActPageManager.GetData(self.actConfig.ActiveType)
if self.actConfig.RpType > 0 then
CheckRedPointStatus(self.actConfig.RpType)

View File

@ -39,86 +39,50 @@ end
function ExpertPre:OnOpen()
end
function ExpertPre:SetData(_data,_parent,_sortingOrder,_activityId,_value,_configData)
function ExpertPre:SetData(_data,_parent,_sortingOrder,_activityId)
self.data = _data
self.parent = _parent
self.sortingOrder = _sortingOrder
self.activityId = _activityId
self.actConfig = _configData
self.value = _value
self:Refresh()
end
function ExpertPre:Refresh()
-- LogPink("self.data.missionId.:"..tostring(self.data.missionId).." self.data.progress:"..tostring(self.data.progress).." self.data.state:"..tostring(self.data.state))
local sConFigData = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig,self.data.missionId)
self.title.text = GetLanguageStrById(sConFigData.ContentsShow)
-- local sConFigData = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig,self.data.missionId)
self.title.text = GetLanguageStrById(self.data.otherData.ContentsShow)
--设置内容
if not self.itemList then
self.itemList = {}
end
for i = 1, #sConFigData.Reward do
for i = 1, #self.data.otherData.Reward do
if not self.itemList[i] then
self.itemList[i] = SubUIManager.Open(SubUIConfig.ItemView,self.grid.transform)
end
self.itemList[i]:OnOpen(false, sConFigData.Reward[i], 0.9,false,false,false,self.sortingOrder)
self.itemList[i]:OnOpen(false, self.data.otherData.Reward[i], 0.9,false,false,false,self.sortingOrder)
end
self:SetButton(sConFigData)
self:SetButton()
end
function ExpertPre:SetButton(sConFigData)
local value = sConFigData.Values[2][1]
if self.actConfig.ActiveType == ActivityTypeDef.AccumulativeRechargeExper then--日限时累充
value = sConFigData.Values[1][1]
end
local state = 0
if self.data.state == 0 then
if self.actConfig.ActiveType == ActivityTypeDef.UpStarExper or self.actConfig.ActiveType == ActivityTypeDef.Talisman
or self.actConfig.ActiveType == ActivityTypeDef.SoulPrint or self.actConfig.ActiveType == ActivityTypeDef.EquipExper
or self.actConfig.ActiveType == ActivityTypeDef.FindTreasureExper or self.actConfig.ActiveType == ActivityTypeDef.ExpeditionExper then--进阶因为每个都不一样 特殊判断
if self.data.progress < value then
state = 10
else
state = 0
end
else
if self.value < value then
state = 10
else
state = 0
end
end
elseif self.data.state == 1 then
state = 20
end
local btnData = BtnState[state]
function ExpertPre:SetButton()
local btnData = BtnState[self.data.otherData.state]
self.btnGet:GetComponent("Image").sprite = Util.LoadSprite(btnData.Img)
Util.SetGray(self.btnGet,btnData.isGray)
self.redPoint:SetActive(btnData.isRed)
self.btnText.text = btnData.Text
if self.actConfig.ActiveType == ActivityTypeDef.UpStarExper or self.actConfig.ActiveType == ActivityTypeDef.Talisman
or self.actConfig.ActiveType == ActivityTypeDef.SoulPrint or self.actConfig.ActiveType == ActivityTypeDef.EquipExper
or self.actConfig.ActiveType == ActivityTypeDef.FindTreasureExper or self.actConfig.ActiveType == ActivityTypeDef.ExpeditionExper then--进阶因为每个都不一样 特殊判断
self.info.text =string.format("%s/%s",self.data.progress,value)
else
self.info.text =string.format("%s/%s",self.value,value)
end
self.info.text = self.data.otherData.info
Util.AddOnceClick(self.btnGet, function()
if state == 0 then
if self.data.otherData.state == 0 then
NetManager.GetActivityRewardRequest(self.data.missionId, self.activityId, function(drop)
UIManager.OpenPanel(UIName.RewardItemPopup,drop,1,function()
self.parent:RefreshActData(true,false)
CheckRedPointStatus(RedPointType.Expert_FastExplore)
end)
end)
elseif state == 1 then
elseif self.data.otherData.state == 1 then
JumpManager.GoJump(sConFigData.Jump[1])
elseif state == 2 then
elseif self.data.otherData.state == 2 then
PopupTipPanel.ShowTip(Language[10101])
end
end)