【ID1009655】

【优化】主题活动默认放到第一排第一个按钮位置

(cherry picked from commit 7c960704aa)
dev_chengFeng
jiaoyangna 2021-07-09 18:01:41 +08:00
parent f7e5775495
commit fe5fc7fa68
1 changed files with 103 additions and 58 deletions

View File

@ -30,7 +30,7 @@ local isFirstOpen = 0
local isUpperMonthCardTimeShow = true
local activitys = {}
local activityTabs = {}
local activeSelfTabs = {}
local moveSceneList = {
[1] = 0,
[2] = 0.02,
@ -747,7 +747,7 @@ function this.CreatActivity()
if not activityTabs[k] then
activityTabs[k] = {}
local root = this.RightUp
if v.ListType == 1 then
if v.ListType == -1 then
root = this.RightUp2Grid
end
activityTabs[k].go = newObjToParent(this.activityTabPrefab,root)
@ -800,6 +800,43 @@ function this.CreatActivity()
Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.RefreshRightUp)
end
function this.RefreshLayer(showTab,k,v)
if showTab then
activityTabs[k].go.gameObject:SetActive(true)
if v.ListType == -1 or activeSelfTabs[v.Sort] then
return
end
activeSelfTabs[v.Sort] = {}
activeSelfTabs[v.Sort].tab = activityTabs[k]
activeSelfTabs[v.Sort].data = v
else
activityTabs[k].go.gameObject:SetActive(false)
if not activeSelfTabs[v.Sort] then
return
end
activeSelfTabs[v.Sort] = nil
end
local tempTabs = {}
for k,v in pairs(activeSelfTabs) do
table.insert(tempTabs,v)
end
table.sort(tempTabs,function(a,b)
if a.data.ListType == b.data.ListType then
return a.data.Sort < b.data.Sort
else
return a.data.ListType < b.data.ListType
end
end)
for k,v in ipairs(tempTabs) do
if v.data.ListType == 0 then
v.tab.go.transform:SetSiblingIndex(k - 1)
else
v.tab.go.transform:SetSiblingIndex(v.data.ListType - 1)
end
end
end
local ySet = {[1] = 361 ,[2] = 512,[3] = 663,[4] = 814,[5] = 965 }
--设置右侧条
function this.SetRightBarSize()
@ -1131,6 +1168,7 @@ function this.TimeFormat()
this.ZhuShengZhiDianBtn()
for k,v in pairs(activitys) do
local showTab = activityTabs[k].go.gameObject.activeSelf
local ishow = DynamicActivityManager.IsQualifiled(v.Id)
if ishow then
if v.ActId == 666 then
@ -1140,20 +1178,20 @@ function this.TimeFormat()
local time = giftList[1].endTime - GetTimeStamp()
if time < 1 then
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, giftList[1].goodsId)
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
else
activityTabs[k].go.gameObject:SetActive(true)
showTab = true
activityTabs[k].timeText.text = TimeToHMS(time)
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
elseif v.ActId == 668 then
-- 加入对月卡的判断
-- local isMonthCardActive = OperatingManager.IsMonthCardActive()
local isOpen_128 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128)
local isOpen_328 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328)
activityTabs[k].go.gameObject:SetActive( (isOpen_128 or isOpen_328))--isMonthCardActive and
showTab = (isOpen_128 or isOpen_328)--isMonthCardActive and
-- if isMonthCardActive then
local cardType = nil
if isOpen_328 then
@ -1167,9 +1205,9 @@ function this.TimeFormat()
if data then
local time = data.endTime - PlayerManager.serverTime
if time < 1 then
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
else
activityTabs[k].go.gameObject:SetActive(true)
showTab = true
if OperatingManager.GetGoodsBuyTime(GoodsTypeDef.MONTHCARD_128) > 0 and OperatingManager.GetGoodsBuyTime(GoodsTypeDef.MONTHCARD_328) > 0 then
activityTabs[k].timeImg.gameObject:SetActive(false)
elseif time >= 86400 then
@ -1184,34 +1222,34 @@ function this.TimeFormat()
elseif v.ActId == 667 then
local limitSkinGift = OperatingManager.GetTimeLimitSkinInfoList()
if not limitSkinGift then
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
else
local time = limitSkinGift.endTime - GetTimeStamp()
if time > 0 then
activityTabs[k].go.gameObject:SetActive(true)
showTab = true
activityTabs[k].timeText.text = TimeToFelaxible(time)
local canGet = BagManager.GetTotalItemNum(1221) > 0 and BagManager.GetTotalItemNum(1222) > 0 and
BagManager.GetTotalItemNum(1223) > 0 and BagManager.GetTotalItemNum(1224) > 0
activityTabs[k].redpot:SetActive(canGet)
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
end
elseif v.ActId == 6301 then
local ActData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.FuXingGaoZhao)
if ActData then
activityTabs[k].timeText.transform.parent.gameObject:SetActive(ActData.value == 0)
activityTabs[k].go.gameObject:SetActive(ActData.value ~= 2)
showTab = ActData.value ~= 2
if ActData.value == 0 then
local data = string.split(ConfigManager.GetConfigDataByKey(ConfigName.SpecialConfig,"Id",109).Value,"#")
local time = ActData.startTime + tonumber(data[1])*86400 - GetTimeStamp()
activityTabs[k].timeText.text = TimeToFelaxible(time)
if time <= 0 then
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
elseif v.ShowTime == 1 and activityTabs[k].go.gameObject.activeSelf then
if v.ActiveType > 0 then
@ -1225,13 +1263,13 @@ function this.TimeFormat()
if time>= 86400 then
activityTabs[k].timeText.text = TimeToDH(time)
else
activityTabs[k].timeText.text = TimeToHMS(time)
activityTabs[k].timeText.text = TimeToHMS(time)
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
supremHadSet = true
end
elseif v.ActiveType == ActivityTypeDef.TreasureStore then
@ -1243,10 +1281,10 @@ function this.TimeFormat()
activityTabs[k].timeText.text = TimeToHMS(endTime)
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
elseif v.FunType and v.FunType == 41 then
activityTabs[k].go.gameObject:SetActive(DailyRechargeManager.GetDailyRechargeExist())
showTab = DailyRechargeManager.GetDailyRechargeExist()
else
local info = ActivityGiftManager.GetActivityTypeInfo(v.ActiveType)
local extraTime = 0
@ -1259,56 +1297,57 @@ function this.TimeFormat()
elseif tempTime > 0 and tempTime < extraTime then
activityTabs[k].timeText.text = TimeToFelaxible(tempTime)
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
-- elseif v.FunType == FUNCTION_OPEN_TYPE.ARENA then
-- local isOpen = ActTimeCtrlManager.SingleFuncState(v.FunType)
-- local baseInfo = ArenaTopMatchManager.GetBaseData()
-- if not isOpen or not baseInfo or not baseInfo.battleStage or baseInfo.battleStage == TOP_MATCH_STAGE.OVER then
-- activityTabs[k].go.gameObject:SetActive(false)
-- showTab = false
-- elseif baseInfo.battleStage == TOP_MATCH_STAGE.CLOSE then
-- local startTime = ArenaTopMatchManager.GetTopMatchTime()
-- local tempTime = startTime - PlayerManager.serverTime
-- -- 当日五点开始显示
-- if tempTime > 0 and tempTime < 16 * 60 * 60 then
-- activityTabs[k].go.gameObject:SetActive(true)
-- showTab = true
-- activityTabs[k].timeText.text = Language[11211]..TimeToHMS(tempTime)
-- else
-- activityTabs[k].go.gameObject:SetActive(false)
-- showTab = false
-- end
-- else
-- activityTabs[k].go.gameObject:SetActive(true)
-- showTab = true
-- activityTabs[k].timeText.text = Language[11212]
-- end
elseif v.FunType == 72 then
local status = DeathPosManager.GetStatus()
local endTime = DeathPosManager.GetOverTime()
if not status or status == DeathPosStatus.Close or status == DeathPosStatus.Belated or status == DeathPosStatus.Reward then
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
else
if endTime then
local tempTime = endTime - PlayerManager.serverTime
if tempTime and tempTime > 0 then
activityTabs[k].timeText.text = Language[11213]..TimeToHMS(tempTime)
activityTabs[k].go.gameObject:SetActive(true)
showTab = true
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
this.RefreshLayer(showTab,k,v)
end
end
@ -1323,7 +1362,7 @@ function this:OnClose()
for k,v in ipairs(activitys) do
if v.RpType > 0 then
ClearRedPointObject(v.RpType,activityTabs[k].redpot)
-- activityTabs[k].go.gameObject:SetActive(false)
-- showTab = false)
end
end
end
@ -1333,6 +1372,7 @@ function this:OnDestroy()
this.spLoader:Destroy()
activityTabs = {}
activitys = {}
activeSelfTabs = {}
SubUIManager.Close(this.UpView)
SubUIManager.Close(this.BtView)
SubUIManager.Close(this.ChatTipView)
@ -1371,9 +1411,11 @@ function this.RefreshGiftBtnShow()
if v.ActId == 668 and ishow then
-- 加入对月卡的判断
-- local isMonthCardActive = OperatingManager.IsMonthCardActive()
local showTab = activityTabs[k].go.gameObject.activeSelf
local isOpen_128 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128)
local isOpen_328 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328)
activityTabs[k].go.gameObject:SetActive( (isOpen_128 or isOpen_328))--isMonthCardActive and
showTab = (isOpen_128 or isOpen_328)--isMonthCardActive and
this.RefreshLayer(showTab,k,v)
end
end
end
@ -1381,13 +1423,14 @@ end
function this.RefreshActivityBtn(context)
--LogGreen("context.type1 " .. context.type .. " " .. context.status)
for k,v in ipairs(activitys) do
local showTab = activityTabs[k].go.gameObject.activeSelf
local ishow = DynamicActivityManager.IsQualifiled(v.Id)
if ishow then
if v.ActiveType > 0 and v.ActiveType == context.type then
local activityId = ActivityGiftManager.IsActivityTypeOpen(v.ActiveType)
if activityId and activityId > 0 and ActivityGiftManager.IsQualifiled(v.ActiveType) then
if v.FunType and v.FunType == 41 then
activityTabs[k].go.gameObject:SetActive(DailyRechargeManager.GetDailyRechargeExist())
showTab = DailyRechargeManager.GetDailyRechargeExist()
elseif v.ActiveType == 20000 then
local tempConfig = ConfigManager.TryGetConfigDataByThreeKey(ConfigName.ActivityGroups,"ActId",GlobalActConfig[activityId].ShowArt,"PageType",0,"ActiveType",v.ActiveType)
if not tempConfig then
@ -1396,27 +1439,28 @@ function this.RefreshActivityBtn(context)
if tempConfig then
activityTabs[k].img.sprite = this.spLoader:LoadSprite(tempConfig.Icon[1])
end
activityTabs[k].go.gameObject:SetActive(context.status == 1)
showTab = context.status == 1
else
activityTabs[k].go.gameObject:SetActive(context.status == 1)
showTab = context.status == 1
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
elseif v.FunType > 0 and v.FunType == context.type then
if ActTimeCtrlManager.SingleFuncState(v.FunType) then
if v.FunType and v.FunType == 41 then
activityTabs[k].go.gameObject:SetActive(DailyRechargeManager.GetDailyRechargeExist())
showTab = DailyRechargeManager.GetDailyRechargeExist()
else
activityTabs[k].go.gameObject:SetActive(context.status == 1)
showTab = context.status == 1
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
this.RefreshLayer(showTab,k,v)
end
isRefeshIcon = true
end
@ -1426,6 +1470,7 @@ function this.RefreshActivityShow()
this.RefreshEightGiftPreview()
for k,v in ipairs(activitys) do
local showTab = activityTabs[k].go.gameObject.activeSelf
local ishow = DynamicActivityManager.IsQualifiled(v.Id)
if ishow then
if v.RpType > 0 then
@ -1441,12 +1486,12 @@ function this.RefreshActivityShow()
local time = giftList[1].endTime - GetTimeStamp()
if time < 1 then
OperatingManager.RemoveItemInfoByType(GoodsTypeDef.DirectPurchaseGift, giftList[1].goodsId)
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
else
activityTabs[k].go.gameObject:SetActive(true)
showTab = true
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
elseif v.ActId == 668 then
--超值基金
@ -1454,7 +1499,7 @@ function this.RefreshActivityShow()
-- local isMonthCardActive = OperatingManager.IsMonthCardActive()
local isOpen_128 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_128)
local isOpen_328 = OperatingManager.IsBaseOpen(GoodsTypeDef.MONTHCARD_328)
activityTabs[k].go.gameObject:SetActive( (isOpen_128 or isOpen_328))--isMonthCardActive and
showTab = (isOpen_128 or isOpen_328)--isMonthCardActive and
-- if isMonthCardActive then
local cardType = nil
if isOpen_328 then
@ -1468,9 +1513,9 @@ function this.RefreshActivityShow()
if data then
local time = data.endTime - PlayerManager.serverTime
if time < 1 then
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
else
activityTabs[k].go.gameObject:SetActive(true)
showTab = true
end
end
end
@ -1483,34 +1528,34 @@ function this.RefreshActivityShow()
if ActivityGiftManager.GetRewardState(42) ~= 3 then
local endTime = ActivityGiftManager.GetTaskEndTime(ActivityTypeDef.SupremeHero)
if endTime - PlayerManager.serverTime > 0 then
activityTabs[k].go.gameObject:SetActive(true)
showTab = true
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
elseif v.FunType and v.FunType == 41 then
activityTabs[k].go.gameObject:SetActive(DailyRechargeManager.GetDailyRechargeExist())
showTab = DailyRechargeManager.GetDailyRechargeExist()
else
activityTabs[k].go.gameObject:SetActive(true)
showTab = true
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
elseif v.FunType > 0 then
if ActTimeCtrlManager.SingleFuncState(v.FunType) then
activityTabs[k].go.gameObject:SetActive(true)
showTab = true
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
else
activityTabs[k].go.gameObject:SetActive(false)
showTab = false
end
this.RefreshLayer(showTab,k,v)
end
end