diff --git a/Assets/ManagedResources/~Lua/Data/SoundData.lua b/Assets/ManagedResources/~Lua/Data/SoundData.lua index 4d16d9226e..642b84f904 100644 --- a/Assets/ManagedResources/~Lua/Data/SoundData.lua +++ b/Assets/ManagedResources/~Lua/Data/SoundData.lua @@ -78,4 +78,20 @@ SoundConfig = { Ambient_Carbon = "Amb_02", Ambient_Login = "Amb_03", Sound_UnlockLevel ="UI_UnlockLevel_01", + Sound_schl ="UI_schl", + Sound_schl_loop ="UI_schl_loop", + Sound_tsjl ="UI_tsjl", + Sound_tsjl_loop ="UI_tsjl_loop", + Sound_mrhl ="UI_mrhl", + Sound_syz ="UI_syz", + Sound_syz_loop ="UI_syz_loop", + Sound_lhj ="UI_lhj",--福星高照 + Sound_xytb ="UI_xytb",--探宝 + Sound_hcs ="UI_hcs", + Sound_zd ="UI_zd", + Sound_zp ="UI_zp",-- 森罗幻境转盘 + Sound_xyc ="UI_xyc",-- 森罗幻境进入下一层 + Sound_tgxb_pq ="UI_tgxb_pq", + Sound_dntg_qj ="UI_dntg_qj", + Sound_dntg_cy ="UI_dntg_cy", } \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/ActivityGift/AllActivityManager.lua b/Assets/ManagedResources/~Lua/Modules/ActivityGift/AllActivityManager.lua new file mode 100644 index 0000000000..3d9174cf97 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/ActivityGift/AllActivityManager.lua @@ -0,0 +1,889 @@ +AllActivityManager = {}; +local this = AllActivityManager +local ActivityRewardConfig = ConfigManager.GetConfig(ConfigName.ActivityRewardConfig) +local GlobalActivity = ConfigManager.GetConfig(ConfigName.GlobalActivity) +local giftData = {} +function this.Initialize() +end + +-- 获取服务器活动领取进度数据 +function this.InitActivityServerData(msg, isUpdate) + if not isUpdate then + this.mission = {} + end + for i, v in ipairs(msg.activityInfo) do + + this.CheckMoneyProgress(v) + this.mission[v.activityId] = v + LogRed("刷新活动数据activityId:" .. v.activityId .. " value:" .. v.value) + end +end + +function this.RefreshActivityData(respond) + --closed + if respond.closeActivityId then + for i = 1, #respond.closeActivityId do + if this.mission[respond.closeActivityId[i]] then + LogRed(Language[10003] .. respond.closeActivityId[i]) + this.mission[respond.closeActivityId[i]] = nil + Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnActivityOpenOrClose, { + type = activityType, + status = 0 --关闭 + }) + end + end + end + --newOpen + if respond.activityInfo then + for i = 1, #respond.activityInfo do + LogRed(Language[10004] .. respond.activityInfo[i].activityId) + this.mission[respond.activityInfo[i].activityId] = respond.activityInfo[i] + local activityType = this.GetActivityTypeFromId(respond.activityInfo[i].activityId) + Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnActivityOpenOrClose, { + type = this.GetActivityTypeFromId(respond.activityInfo[i].activityId), + status = 1 --开启 + }) + end + end + this.InitActivityServerData(respond, true) + this.RefreshActivityRedPoint() +end + +--刷新某个活动的数据进度 +function this.RefreshActivityProgressData(msg) + -- 检测 + this.CheckMoneyProgress(msg.activityInfo) + LogRed("刷新活动数据activityId:" .. msg.activityInfo.activityId .. "value:" .. msg.activityInfo.value) + if this.mission[msg.activityInfo.activityId] then + this.mission[msg.activityInfo.activityId].value = msg.activityInfo.value + for i = 1, #msg.activityInfo.mission do + for _, missionInfo in pairs(this.mission[msg.activityInfo.activityId].mission) do + if missionInfo.missionId == msg.activityInfo.mission[i].missionId then + missionInfo.state = msg.activityInfo.mission[i].state + missionInfo.progress = msg.activityInfo.mission[i].progress + LogRed(msg.activityInfo.activityId.." 刷新活动数据missionId:" .. missionInfo.missionId .. "state:" .. missionInfo.state .. "progress:" .. missionInfo.progress) + end + end + end + this.RefreshActivityRedPoint() + Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnActivityProgressStateChange) + --断线重连时 在线奖励活动 数据刷新 + this.CutUpLineUpdateOnLineData(msg) + end +end + + +--断线重连时 在线奖励活动 数据刷新 +function this.CutUpLineUpdateOnLineData(msg) + if (msg.activityInfo.activityId == ActivityTypeDef.OnlineGift) then + for i = 1, #msg.activityInfo.mission do + this.onlineOpen = true + this.onlineGetRewardState[ msg.activityInfo.mission[i].missionId] = msg.activityInfo.mission[i].state + this.haveOnlineTime = msg.activityInfo.mission[i].progress + this.onlineTime= msg.activityInfo.mission[i].progress + this.cuOnLineTimestamp = GetTimeStamp() - msg.activityInfo.mission[i].progress + LogRed("------------------------------------后端刷新在线时长3 "..msg.activityInfo.mission[i].progress.." "..TimeToHMS(msg.activityInfo.mission[i].progress)) + end + end +end + +--五点凌晨刷新 +function this.FiveAMRefreshActivityProgress(msg) + LogRed("5AM刷新活动数据") + for i = 1, #msg.activityInfo do + if not this.mission[msg.activityInfo[i].activityId] then + Game.GlobalEvent:DispatchEvent(GameEvent.Activity.OnActivityOpenOrClose, { + type = this.GetActivityTypeFromId(msg.activityInfo[i].activityId), + status = 1 --开启 + }) + end + -- 检测活动钱数 + this.CheckMoneyProgress(msg.activityInfo[i]) + this.mission[msg.activityInfo[i].activityId] = msg.activityInfo[i] + LogRed("刷新活动数据activityId:" .. msg.activityInfo[i].activityId .. "value:" .. msg.activityInfo[i].value) + end + this.RefreshActivityRedPoint() +end + +-- 检测进度 +function this.CheckMoneyProgress(v) + if v.activityId == ActivityTypeDef.FirstRecharge + or v.activityId == ActivityTypeDef.LuckyCat + or v.activityId == ActivityTypeDef.DailyRecharge + -- or v.activityId == ActivityTypeDef.ContinuityRecharge + or v.activityId == ActivityTypeDef.AccumulativeRechargeExper + or v.activityId == ActivityTypeDef.DynamicAct_recharge + or v.activityId == ActivityTypeDef.FindFairyCeremony then + + for n, m in ipairs(v.mission) do + m.progress = m.progress / 1000 + end + v.value = v.value / 1000 + end +end + + +function this.RefreshActivityRedPoint() + Game.GlobalEvent:DispatchEvent(GameEvent.MissionDaily.OnMissionDailyChanged) + CheckRedPointStatus(RedPointType.FirstRecharge) + CheckRedPointStatus(RedPointType.ContinuityRecharge) + CheckRedPointStatus(RedPointType.SevenDayCarnival) + --限时活动 + CheckRedPointStatus(RedPointType.Expert_AdventureExper) + CheckRedPointStatus(RedPointType.Expert_AreaExper) + CheckRedPointStatus(RedPointType.Expert_UpStarExper) + CheckRedPointStatus(RedPointType.Expert_EquipExper) + CheckRedPointStatus(RedPointType.Expert_GoldExper) + CheckRedPointStatus(RedPointType.Expert_FightExper) + CheckRedPointStatus(RedPointType.Expert_EnergyExper) + CheckRedPointStatus(RedPointType.Expert_Talisman) + CheckRedPointStatus(RedPointType.Expert_SoulPrint) + CheckRedPointStatus(RedPointType.Expert_AccumulativeRecharge) + CheckRedPointStatus(RedPointType.CourtesyDress_SevenDay) + CheckRedPointStatus(RedPointType.LuckyCat_GetReward) + CheckRedPointStatus(RedPointType.Expert_LuckyTurn) + CheckRedPointStatus(RedPointType.Expert_FindTreasure) + CheckRedPointStatus(RedPointType.Expert_Recruit) + CheckRedPointStatus(RedPointType.Expert_SecretBox) + --战力排行 + CheckRedPointStatus(RedPointType.WarPowerSort_Sort) + --东海寻仙 + CheckRedPointStatus(RedPointType.FindFairy_OneView) + CheckRedPointStatus(RedPointType.FindFairy_ThreeView) + CheckRedPointStatus(RedPointType.FindFairy_FourView) + CheckRedPointStatus(RedPointType.DynamicActTask) + CheckRedPointStatus(RedPointType.QinglongSerectTreasure) +end + + +--通过活动类型获取活动数据 +function this.GetActivityTypeInfo(type) + local globalActConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.GlobalActivity, "Type", type) + local missionData = nil + table.walk(globalActConfigs, function(actConfigInfo) + if this.mission[actConfigInfo.Id] then + missionData = this.mission[actConfigInfo.Id] + end + end) + return missionData +end + +--通过活动类型获取活动id +function this.GetActivityIdByType(type) + local globalActConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.GlobalActivity, "Type", type) + local id = 0 + local missionData = nil + table.walk(globalActConfigs, function(actConfigInfo) + if this.mission[actConfigInfo.Id] then + --LogError("actConfigInfo.Id "..actConfigInfo.Id) + id = actConfigInfo.Id + end + end) + return id +end + +function this.GetActivityValueInfo(type, Id) + if this.mission[type] then + -- LogBlue("this.mission[type].value:"..this.mission[type].value) + return this.mission[type].value + end +end +function this.GetActivityInfo(type, Id) + if this.mission[type] then + for _, missInfo in pairs(this.mission[type].mission) do + if missInfo.missionId == Id then + return missInfo + end + end + else + Log(string.format(Language[10001], type, Id)) + return nil,0 + end +end + +function this.GetActivityInfoByType(type) + if this.mission[type] then + return this.mission[type] + end +end +function this.SetActivityInfo(type, Id, state) + for _, missInfo in pairs(this.mission[type].mission) do + if missInfo.missionId == Id then + missInfo.state = state + break + end + end +end + +function this.GetActivityOpenStatus(type) + local id = this.GetActivityIdByType(type) + if this.mission[id] then + return this.mission[id].reallyOpen == 1 + else + Log(string.format(Language[10002], type)) + return false + end +end +function this.SetActivityOpenStatus(type) + if this.mission[type] then + this.mission[type].reallyOpen = 1 + else + Log(string.format(Language[10002], type)) + end +end + + +--获取活动结束时间 +function this.GetTaskEndTime(activityType) + local activityInfo = ActivityGiftManager.GetActivityTypeInfo(activityType) + local endTime = 0 + if activityInfo then + endTime = activityInfo.endTime + end + return endTime +end + +--获取活动开始时间 +function this.GetTaskStartTime(activityType) + local activityInfo = ActivityGiftManager.GetActivityTypeInfo(activityType) + + local startTime = 0 + if activityInfo then + startTime = activityInfo.startTime + end + return startTime +end +------------------------------------------------ +------------------------------------------------ +------------------------------------------------ + + +function this.GetActivityRewardRequest(type, index) + --local rewardId=0 + --向服务器发送领取在线奖励请求 + NetManager.GetActivityRewardRequest(index, type, function(_drop) + UIManager.OpenPanel(UIName.RewardItemPopup, _drop, 1) + if (type == ActivityTypeDef.OnlineGift) then + this.onlineGetRewardState[index] = 1 + CheckRedPointStatus(RedPointType.CourtesyDress_Online) + table.sort(this.onlineData, function(a, b) + return a.Id < b.Id + end) + Game.GlobalEvent:DispatchEvent(GameEvent.Activity.GetRewardRefresh, this.onlineData) + elseif (type == ActivityTypeDef.EightDayGift) then + this.sevenDayGetRewardState[index] = 1 + CheckRedPointStatus(RedPointType.CourtesyDress_SevenDay) + table.sort(this.sevenDayData, function(a, b) + if this.sevenDayGetRewardState[a.Id] == this.sevenDayGetRewardState[b.Id] then + return a.Id < b.Id + else + return this.sevenDayGetRewardState[a.Id] < this.sevenDayGetRewardState[b.Id] + end + end) + Game.GlobalEvent:DispatchEvent(GameEvent.Activity.GetRewardRefresh, this.sevenDayData) + elseif (type == ActivityTypeDef.ChapterAward) then + this.chapterGetRewardState[index] = 1 + CheckRedPointStatus(RedPointType.CourtesyDress_Chapter) + table.sort(this.chapterGiftData, function(a, b) + if this.chapterGetRewardState[a.Id] == this.chapterGetRewardState[b.Id] then + return a.Id < b.Id + else + return this.chapterGetRewardState[a.Id] < this.chapterGetRewardState[b.Id] + end + end) + Game.GlobalEvent:DispatchEvent(GameEvent.Activity.GetRewardRefresh, this.chapterGiftData) + end + --CheckRedPointStatus(RedPointType.SecretTer) + Game.GlobalEvent:DispatchEvent(GameEvent.Adventure.OnRefreshRedShow) + end) +end +-- 红点检测监听方法 +function this.CheckRedFunc(redType) + if redType == RedPointType.CourtesyDress_SevenDay then + if this.mission[ActivityTypeDef.EightDayGift] then + local number = 0 + for i, v in pairs(this.sevenDayGetRewardState) do + if (v == 1) then + number = number + 1 + end + end + local curDay = math.ceil((CalculateSecondsNowTo_N_OClock(24) + GetTimeStamp() - PlayerManager.userCreateTime)/86400) + if (number < curDay) then + return true + else + return false + end + else + return false + end + elseif redType == RedPointType.CourtesyDress_Chapter then + local isShowRed = false + for i = 1, table.nums(this.chapterGetRewardState) do + for j, v in pairs(this.chapterGiftData) do + if (i == v.Sort) then + if FightPointPassManager.GetFightStateById(v.Values[1][1]) == FIGHT_POINT_STATE.PASS and this.chapterGetRewardState[v.Id] == 0 then + isShowRed = true + return isShowRed + end + end + end + end + return isShowRed + elseif redType == RedPointType.CourtesyDress_Online then + local number = 0 + for i, v in pairs(this.onlineGetRewardState) do + if (v == 1) then + number = number + 1 + end + end + + --当活动未开或奖励全部领取完毕 + if ActTimeCtrlManager.SingleFuncState(FUNCTION_OPEN_TYPE.Online_Reward)==false then + return false + else--当活动开启或奖励未领取完毕 + local timeNum = GetTimeStamp() - this.cuOnLineTimestamp + local currentTimeIndex = 0 + for i = 1, #this.onlineData do + if this.onlineGetRewardState[this.onlineData[i].Id] == 0 then + if (math.floor(timeNum)) >= (this.onlineData[i].Values[1][1]*60) then + currentTimeIndex = this.onlineData[i].Sort + end + end + end + --Log("number < this.currentTimeIndex "..number .." "..currentTimeIndex) + if (number < currentTimeIndex) then --当已领取数小于未领取数 + return true + else + return false + end + end + end +end + + +function this.GetActivityTypeFromId(activityId) + local globalActConfig = ConfigManager.GetConfigDataByKey(ConfigName.GlobalActivity, "Id", activityId) + return globalActConfig.Type +end + +function this.IsActivityTypeOpen(type) + local globalActConfigs = ConfigManager.GetAllConfigsDataByKey(ConfigName.GlobalActivity, "Type", type) + local activityId = nil + table.walk(globalActConfigs, function(actConfigInfo) + if this.mission and this.mission[actConfigInfo.Id] then + activityId = actConfigInfo.Id + end + end) + return activityId +end + +function this.GetContinuityRechargeRedPoint() + local redPoint = false + if this.IsActivityTypeOpen(ActivityTypeDef.ContinuityRecharge) then + local continuityRechargeList = this.GetActivityTypeInfo(ActivityTypeDef.ContinuityRecharge) + for i = 1, #continuityRechargeList.mission do + local rechargeInfo = continuityRechargeList.mission[i] + redPoint = redPoint or (rechargeInfo.progress == 1 and rechargeInfo.state == 0) + end + end + return redPoint +end + +function this.GetGrowthRechargeExist() + if this.IsGetAllGrowthReward() or this.IsActivityTypeOpen(ActivityTypeDef.GrowthReward) == nil then + return false + end + return true +end + +function this.IsGetAllGrowthReward() + local isGetAll = true + if this.IsActivityTypeOpen(ActivityTypeDef.GrowthReward) then + local activityInfo = this.GetActivityTypeInfo(ActivityTypeDef.GrowthReward) + for i = 1, #activityInfo.mission do + isGetAll = isGetAll and activityInfo.mission[i].state == 1 + end + end + return isGetAll +end +--检测限时活动红点 +function this.ExpterActivityIsShowRedPoint(activeIndex) + local activeType = 0 + -- Log("activeIndex "..activeIndex) + --注意 红点枚举id %100 就是按钮顺序 + activeType = numExChange[math.floor(activeIndex % 100)] + -- Log("activeType "..activeType) + local expertRewardTabs = this.GetActivityTypeInfo(activeType) + if expertRewardTabs then + for i = 1, #expertRewardTabs.mission do + local conFigData = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig, expertRewardTabs.mission[i].missionId) + local value = 0 + --限时累计活动特殊数值读取处理 + if activeType == ActivityTypeDef.AccumulativeRechargeExper then + value = conFigData.Values[1][1] + else + value = conFigData.Values[2][1] + end + if expertRewardTabs.mission[i].state == 0 then + if activeType == ActivityTypeDef.UpStarExper or activeType == ActivityTypeDef.Talisman + or activeType == ActivityTypeDef.SoulPrint or activeType == ActivityTypeDef.EquipExper + or activeType == ActivityTypeDef.FindTreasureExper then + --进阶因为每个都不一样 特殊判断 + if expertRewardTabs.mission[i].progress >= value then + --Log("expertRewardTabs.mission[i].progress " .. expertRewardTabs.mission[i].progress) + --Log("限时红点 --------------- true") + return true + end + elseif activeType == ActivityTypeDef.UpLvAct then + if expertRewardTabs.value >= value and expertRewardTabs.mission[i].progress >= 0 then + return true + end + elseif activeType == ActivityTypeDef.FastExplore then + if expertRewardTabs.value >= value then + return true + end + else + if expertRewardTabs.value >= value then + --Log("限时红点 --------------- true") + return true + end + end + end + end + end + --Log("限时红点 --------------- false") + return false +end +--检测升级限时礼包活动红点 +function this.ExperyUpLvActivityIsShowRedPoint() + local activeData = ActivityGiftManager.GetActivityTypeInfo(ActivityTypeDef.UpLvAct) + if activeData and activeData.mission then + for i = 1, #activeData.mission do + local curConfigData = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig,activeData.mission[i].missionId) + if curConfigData and activeData.mission[i].state == 0 and activeData.value >= curConfigData.Values[2][1] and activeData.mission[i].progress>0 then + return true + end + end + end + return false +end +--检测周卡活动红点 +function this.WeedCardActivityIsShowRedPoint() + local weekCardData = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.WeekCard, 12) + if weekCardData then + --Log("weekCardData.buyTimes "..weekCardData.buyTimes.." "..PatFaceManager.isFirstLog.." "..tostring(this.isOpenWeekCard)) + if weekCardData.buyTimes <= 0 and PatFaceManager.isFirstLog == 0 and this.isOpenWeekCard == false then + --Log("检测周卡活动红点 --------------- true") + return true + end + end + --Log("检测周卡活动红点 --------------- false") + return false +end +--检测战力排行活动红点 +function this.WarPowerSortActivityIsShowRedPoint() + local expertRewardTabs = this.GetActivityTypeInfo(ActivityTypeDef.WarPowerReach) + if expertRewardTabs then + for i = 1, #expertRewardTabs.mission do + local conFigData = ConfigManager.GetConfigData(ConfigName.ActivityRewardConfig, expertRewardTabs.mission[i].missionId) + local value = conFigData.Values[1][1] + if expertRewardTabs.mission[i].state == 0 then + if expertRewardTabs.value >= value then + --Log("红点红点 ") + return true + end + end + end + end + return false +end +--限时活动里是否有活动开启 > 0 说明有开启的活动 +function this.GetExpertActiveisOpen() + --所有达人 + for i, v in pairs(numExChange) do + local curActiveData = ActivityGiftManager.GetActivityTypeInfo(v) + if curActiveData then + if curActiveData.endTime - GetTimeStamp() > 0 then + return i + end + end + end + local LimitExchange = this.GetActivityTypeInfo(ActivityTypeDef.LimitExchange) + if LimitExchange then + if LimitExchange.endTime - GetTimeStamp() > 0 then + return ActivityTypeDef.LimitExchange + end + end + + local weekCardData = OperatingManager.GetGiftGoodsInfo(GoodsTypeDef.WeekCard, 12) + if weekCardData then + if weekCardData.endTime - GetTimeStamp() > 0 then + return ExperType.WeekCard + end + end + local patFaceAllData = nil--{ConfigManager.GetConfigData(ConfigName.LoginPosterConfig,1)}--PatFaceManager.GetPatFaceAllDataTabs() + if RecruitManager.isTenRecruit == 0 then + patFaceAllData = { ConfigManager.GetConfigData(ConfigName.LoginPosterConfig, 1) } + end + if patFaceAllData and #patFaceAllData > 0 then + return ExperType.PatFace + end + --异妖直购 + for i, v in ConfigPairs(ConfigManager.GetConfig(ConfigName.LoginPosterConfig)) do + if v.Type == 2 then + --异妖直购特殊处理 + if v.OpenRules[1] == 1 then + if PlayerManager.level >= v.OpenRules[2] and PlayerManager.level <= v.CloseRules[2] then + local conFigData = ConfigManager.GetConfigData(ConfigName.RechargeCommodityConfig, v.ShopId) + local shopItemData = OperatingManager.GetGiftGoodsInfo(conFigData.Type, v.ShopId) + if shopItemData then + return ExperType.DiffMonster + end + end + end + end + end + --幸运探宝 + --local curActiveData = not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LuckyTurnTable_One) + --if curActiveData then + -- return 6 + --end + --福星高照 + local curActiveData = not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LuckyCat) + if curActiveData then + return ExperType.LuckyCat + end + -- 七日 + local curActiveData = not not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.EightDayGift) + if curActiveData then + return ExperType.SevenDay + end + --星级成长礼 + if OperatingManager.IsHeroGiftActive() then + return ExperType.StarGrowGift + end + return 0 +end +--判断七日,在线,章节是否全部领取完了 +function this.ActivityIsHaveGetFinally(state) + local isGetAllReward = true + for i, v in pairs(state) do + if (v == 0) then + isGetAllReward = false + end + end + return isGetAllReward +end + + +-- 获取所有开启的显示活动ID +function this.GetExpertActiveisAllOpenIds() + local activityIds = {} + for i, v in pairs(numExChange) do + local curActiveData = ActivityGiftManager.GetActivityTypeInfo(v) + if curActiveData then + if curActiveData.endTime - GetTimeStamp() > 0 then + --Log("开启活动id ======== " .. curActiveData.activityId) + table.insert(activityIds,curActiveData.activityId) + end + end + end + local LimitExchange = this.GetActivityTypeInfo(ActivityTypeDef.LimitExchange) + if LimitExchange then + if LimitExchange.endTime - GetTimeStamp() > 0 then + table.insert(activityIds,LimitExchange.activityId) + end + end + local patFaceAllData = nil + if RecruitManager.isTenRecruit == 0 then + patFaceAllData = { ConfigManager.GetConfigData(ConfigName.LoginPosterConfig, 1) } + end + if patFaceAllData and #patFaceAllData > 0 then + table.insert(activityIds,ActivityTypeDef.PatFace) + end + --幸运探宝 + local luckyTurnTable_One = 0 + luckyTurnTable_One = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LuckyTurnTable_One) + local upper_Two = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LuckyTurnTable_Two) + if luckyTurnTable_One then + if luckyTurnTable_One > 0 then + table.insert(activityIds, luckyTurnTable_One) + end + end + + if upper_Two then + if upper_Two > 0 then + table.insert(activityIds, upper_Two) + end + end + + --福星高照 + local luckyCat = 0 + luckyCat = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.LuckyCat) + if luckyCat then + if luckyCat > 0 then + table.insert(activityIds, luckyCat) + end + end + -- 七日 + local sevenDay = 0 + sevenDay = ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.EightDayGift) + if sevenDay then + if sevenDay > 0 then + table.insert(activityIds, sevenDay) + end + end + return activityIds +end + +---关卡通关豪礼相关--- +--根据当前关数 获取最近下一关卡橙色角色 +function this.GetNextHeroInfo() + local allData={} + local heroData={} + --Log("当前通过关卡"..FightPointPassManager.lastPassFightId) + local startIndex=5001 + local mainLevelEndId=ConfigManager.TryGetConfigDataByKey(ConfigName.MainLevelConfig,"NextLevel",-1).Id--最高关卡 + local endIndex=this.GetConfigForValues(ConfigName.ActivityRewardConfig,mainLevelEndId).Id + + --活动表处于开始结束索引之间的全部数据 + for i = startIndex, endIndex do + local reward = ConfigManager.TryGetConfigData(ConfigName.ActivityRewardConfig,i) + if reward then + table.insert(allData, reward) + end + end + + --输出ActivityRewardConfig里下一关的索引 + local index + for i = 1, #allData do + if ConfigManager.GetConfigData(ConfigName.MainLevelConfig,FightPointPassManager.curOpenFight).SortId-1 < ConfigManager.GetConfigData(ConfigName.MainLevelConfig,allData[i].Values[1][1]).SortId then + index= this.GetConfigForValues(ConfigName.ActivityRewardConfig,allData[i].Values[1][1]).Id + break + end + end + + --剩余数据 + local residueData={} + for i = index, endIndex do + local reward = ConfigManager.TryGetConfigData(ConfigName.ActivityRewardConfig,i) + if reward then + table.insert(residueData, reward) + end + end + + --剩余数据中将立绘数据存入 + for i = 1, #residueData do + local itemData=ConfigManager.GetConfigData(ConfigName.ItemConfig,residueData[i].Reward[1][1]) + if itemData.ItemType==1 and (itemData.Quantity==5 or itemData.Quantity==4)then --and allData[i].Reward[1][2]==1 + table.insert(heroData,residueData[i]) + end + end + + if #heroData>0 then --如果有数据 + return heroData[1].Reward[1][1],heroData[1].Values[1][1] --返回目标立绘id 关卡id + else + return #heroData,#heroData--如果没数据 返回0 + end +end + +--根据双重key的value锁定id value为2维数组(目前没有这种接口) +function this.GetConfigForValues(configName,pointId) + local data={} + for _, configInfo in ConfigPairs(ConfigManager.GetConfig(configName)) do + if configInfo.ActivityId == 3 and configInfo.Values[1][1] == pointId then + data = configInfo + break + end + end + return data +end +--------------------- +--- 根据活动ID获取表格中相同活动ID第一项的数据 +function this.GetActivityDataById(id) + for k, v in ConfigPairs(ActivityRewardConfig) do + if v and v.ActivityId == id then + return v + end + end +end + + +---剑影仙踪相关--- +--获取剑影仙踪任务数据 +function this.GetTaskData() + local taskList={} + local taskValue=0 + + local data= this.GetActivityTypeInfo(ActivityTypeDef.SupremeHero) + + if not data then + return 0, taskList + end + + table.sort(data.mission,function(a,b) + return a.missionId= 1 then + taskValue = taskValue + 1 + end + end + + return taskValue,taskList +end + +--剑影仙踪红点检测 差一个通关完毕 符合要求的红点检测 点击领取红点未检测 +function this.CheckSupremeHeroRedPoint() + if not ActivityGiftManager.IsActivityTypeOpen(ActivityTypeDef.SupremeHero) then + return + end + local isOpen + local num,list= this.GetTaskData() + + local complete=0 --任务是否完成 + local receive=0 --任务是否领取 + for i = 1, #list do + if list[i]>0 then + complete=complete+1 + end + if list[i]==2 then + receive=receive+1 + end + end + + if complete<3 then--任务未完成 + isOpen=PatFaceManager.isFirstLog==0 and not this.isFirstForSupremeHero + else + isOpen=receive<3 + end + + return isOpen +end + + +--获取活动剩余时间 +function this.GetTaskRemainTime(activityType) + local remainTime = 0 + remainTime =this.GetTaskEndTime(activityType)- this.GetTaskEndTime(activityType) + return remainTime +end + +function this.GetRewardState() + local taskValue,missionData= this.GetTaskData() + local doneNum = 0 + for i = 1, 3 do + if missionData[i] == 2 then + doneNum = doneNum + 1 + end + end + local state = doneNum == 3 and 3 or 2 + return state +end + +---------------- +-- 获取下一个每日奖励的时间 +function this.GetNextOnlineRewardData() + for _, data in ipairs(this.onlineData) do + local state = this.onlineGetRewardState[data.Id] + if state ~= 1 then -- 如果不是已完成状态则返回数据 + if state == 0 then + local curOnlineTime = GetTimeStamp() - ActivityGiftManager.cuOnLineTimestamp + local needTime = data.Values[1][1]*60 + if curOnlineTime < needTime then + state = -1 + end + end + return data, state + end + end +end + +--达人获取id +function this.GetOpenExpertIdByActivityType(activityType) + local activityInfo = ActivityGiftManager.GetActivityTypeInfo(activityType) + if activityInfo then + return activityInfo.activityId + end + return 0 +end + +-------------------------------------------- +--主动刷新 置本地数据 +function this.RefreshAcitvityData(acitvityIds,fun) + NetManager.RefreshAcitvityData(acitvityIds,function (msg) + for i = 1, #msg.activityInfo do + if this.mission[msg.activityInfo[i].activityId] then + this.mission[msg.activityInfo[i].activityId].value = msg.activityInfo[i].value + for j = 1, #msg.activityInfo[i].mission do + for _, missionInfo in pairs(this.mission[msg.activityInfo[i].activityId].mission) do + if missionInfo.missionId == msg.activityInfo[i].mission[j].missionId then + missionInfo.state = msg.activityInfo[i].mission[j].state + missionInfo.progress = msg.activityInfo[i].mission[j].progress + --LogError("msg.activityInfo[i].mission[j] "..msg.activityInfo[i].mission[j].missionId.." "..msg.activityInfo[i].mission[j].progress) + end + end + end + end + end + if fun then fun() end + CheckRedPointStatus(RedPointType.Expert_UpLv) + end) +end + +--获取活动已开启的时间 +function this.GetCurrentDayNumber(type) + local DayActInfo = ActivityGiftManager.GetActivityTypeInfo(type) + local startTime = DayActInfo.startTime + local needDayNumber = math.ceil((GetTimeStamp() - startTime) / 86400) + return needDayNumber +end + +--章节检测距离下次领奖还有几关 +function this.GetRewardNeedLevel() + for i = 1, table.nums(this.chapterGetRewardState) do + for j, v in pairs(this.chapterGiftData) do + if (i == v.Sort) then + if FightPointPassManager.GetFightStateById(v.Values[1][1]) ~= FIGHT_POINT_STATE.PASS and this.chapterGetRewardState[v.Id] == 0 then + return this.mainLevelConfig[v.Values[1][1]].SortId - this.mainLevelConfig[FightPointPassManager.curOpenFight].SortId + 1 + end + end + end + end + return 0 +end +--开服福利排序 +local OpenSeverWelfareSortTable = { + [0] = 1, + [1] = 0, +} +function this. OpenSeverWelfareRewardTabsSort(missions) + table.sort(missions,function(a,b) + if a.state == b.state then + return a.missionId < b.missionId + else + return OpenSeverWelfareSortTable[a.state] > OpenSeverWelfareSortTable[b.state] + end + end) +end + + +function this.GetTimeStartToEnd(type) + local info= ActivityGiftManager.GetActivityTypeInfo(type) + local startTime= this.GetTimeShow(info.startTime) + local endtime= this.GetTimeShow(info.endTime) + return startTime.."~"..endtime +end + +---时间格式化接口 +function this.GetTimeShow(data) + local year = math.floor(os.date("%Y", data)) + local month = math.floor(os.date("%m", data)) + local day = math.floor(os.date("%d", data)) + local time = year .. "-" .. month .. "-" .. day + return time +end + +return this \ No newline at end of file diff --git a/Assets/ManagedResources/~Lua/Modules/ActivityGift/AllActivityManager.lua.meta b/Assets/ManagedResources/~Lua/Modules/ActivityGift/AllActivityManager.lua.meta new file mode 100644 index 0000000000..44c6e86a86 --- /dev/null +++ b/Assets/ManagedResources/~Lua/Modules/ActivityGift/AllActivityManager.lua.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: e8da346c6a03e8942bad3261076b5575 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ManagedResources/~Lua/Modules/Expedition/ExpeditionMainPanel.lua b/Assets/ManagedResources/~Lua/Modules/Expedition/ExpeditionMainPanel.lua index 91fd5e9071..fc906f19d0 100644 --- a/Assets/ManagedResources/~Lua/Modules/Expedition/ExpeditionMainPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Expedition/ExpeditionMainPanel.lua @@ -121,10 +121,11 @@ function ExpeditionMainPanel:BindEvent() ExpeditionManager.expeditionLeve = shotTiemeLevel[1] self:RefreshManagerData() end + -- 音效 + SoundManager.PlaySound(SoundConfig.UI_dntg_cy) --LogGreen("ExpeditionManager.expeditionLeve "..ExpeditionManager.expeditionLeve) end) Util.AddClick(self.UI_Effect_ChuanSongMen_JinSeBtn, function() - --LogGreen("UI_Effect_ChuanSongMen_JinSeBtn "..#shotTiemeLevel) if #shotTiemeLevel > 1 then MsgPanel.ShowTwo(Language[10497], function() end, function() @@ -135,6 +136,8 @@ function ExpeditionMainPanel:BindEvent() ExpeditionManager.expeditionLeve = shotTiemeLevel[1] self:RefreshManagerData() end + -- 音效 + SoundManager.PlaySound(SoundConfig.UI_dntg_cy) --LogGreen("ExpeditionManager.expeditionLeve "..ExpeditionManager.expeditionLeve) end) BindRedPointObject(RedPointType.Expedition_Treasure, self.redPoint) @@ -655,7 +658,9 @@ function ExpeditionMainPanel:PlayerMoveFun() --self.mask:SetActive(isPlayerMove) SkeletonGraphic.AnimationState:SetAnimation(0, "move2", true) local timeNum = math.abs(oldPos.y - targetPos.y)/350--350/1s - --玩家行走 + -- 音效 + SoundManager.PlaySound(SoundConfig.Sound_dntg_qj) + --玩家行走 self.liveNode.transform:DOLocalMove(targetPos, timeNum, false):OnStart(function () end):OnComplete(function () --Log("行走完毕") diff --git a/Assets/ManagedResources/~Lua/Modules/FindTreasure/FindTreasureDispatchPanel.lua b/Assets/ManagedResources/~Lua/Modules/FindTreasure/FindTreasureDispatchPanel.lua index 580df20d5f..82fa06eaec 100644 --- a/Assets/ManagedResources/~Lua/Modules/FindTreasure/FindTreasureDispatchPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/FindTreasure/FindTreasureDispatchPanel.lua @@ -86,6 +86,7 @@ function FindTreasureDispatchPanel:BindEvent() --Log("curSelectHeroIdsTab "..curSelectHeroIdsTab[i]) --end NetManager.FindTreasureMissingRoomSendHeroRequest(missionData.missionId,curSelectHeroIdsTab,function() + SoundManager.PlaySound(SoundConfig.Sound_tgxb_pq) TaskManager.RefreshFindTreasureHerosData(missionData.missionId,curSelectHeroIdsTab,conFigData.WasteTime) Game.GlobalEvent:DispatchEvent(GameEvent.FindTreasure.RefreshFindTreasure,false) self:ClosePanel() diff --git a/Assets/ManagedResources/~Lua/Modules/FirstRecharge/FirstRechargePanel.lua b/Assets/ManagedResources/~Lua/Modules/FirstRecharge/FirstRechargePanel.lua index 84abcbc3e0..4efc60c843 100644 --- a/Assets/ManagedResources/~Lua/Modules/FirstRecharge/FirstRechargePanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/FirstRecharge/FirstRechargePanel.lua @@ -62,6 +62,7 @@ end function FirstRechargePanel:BindEvent() Util.AddClick(self.closeBtn, function() self:ClosePanel() + SoundManager.PlayMusic(SoundConfig.BGM_Main) end) Util.AddClick(self.reChargeBtn, function() self:OnRechargeBtnClicked() @@ -107,6 +108,9 @@ function FirstRechargePanel:OnSortingOrderChange() end local fun = nil function FirstRechargePanel:OnOpen(context,_fun) + -- 音效 + SoundManager.PlaySound(SoundConfig.Sound_schl) + SoundManager.PlayMusic(SoundConfig.Sound_schl_loop) context = context and context or {} self.selectTabIndex = context.tabIndex and context.tabIndex or 1 -- self:SetOncePart() diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/SupremeHeroPopup.lua b/Assets/ManagedResources/~Lua/Modules/Popup/SupremeHeroPopup.lua index 214d6c4cfe..f5c1504d96 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/SupremeHeroPopup.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/SupremeHeroPopup.lua @@ -108,6 +108,7 @@ function SupremeHeroPopup:BindEvent() Util.AddClick(this.backBtn,function() if not canClose then return end self:ClosePanel() + SoundManager.PlayMusic(SoundConfig.BGM_Main) end) --完成按钮 Util.AddClick(this.doneBtn,function() @@ -162,6 +163,9 @@ end local fun = nil function SupremeHeroPopup:OnOpen(_fun) fun = _fun + -- 音效 + SoundManager.PlaySound(SoundConfig.Sound_tsjl) + SoundManager.PlayMusic(SoundConfig.Sound_tsjl_loop) end function SupremeHeroPopup:OnShow() diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_TrialBomb.lua b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_TrialBomb.lua index 43317e019b..73a9d04225 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_TrialBomb.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_TrialBomb.lua @@ -44,6 +44,7 @@ function this:BindEvent() else NetManager.RequestUseBomb(function (msg)--请求使用炸弹 MapTrialManager.bombUsed = MapTrialManager.bombUsed + 1 + SoundManager.PlaySound(SoundConfig.Sound_zd) parent:ClosePanel() UIManager.OpenPanel(UIName.RewardItemPopup, msg.drop, 1,function() MapTrialManager.UpdatePowerValue(msg.essenceValue) diff --git a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_TrialXingYao.lua b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_TrialXingYao.lua index 501a1e213e..adfc838d80 100644 --- a/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_TrialXingYao.lua +++ b/Assets/ManagedResources/~Lua/Modules/Popup/View/GeneralPopup_TrialXingYao.lua @@ -66,6 +66,7 @@ function this:BindEvent() return end NetManager.UseAddHpItemRequest(selectHeroDid,function() + SoundManager.PlaySound(SoundConfig.Sound_hcs) PopupTipPanel.ShowTip(string.format(Language[11654],itemConfig[itemId].Name)) MapManager.addHpCount=MapManager.addHpCount+1 curHeroHp=curHeroHp+5000 --5000增加的血量也是要配表的 diff --git a/Assets/ManagedResources/~Lua/Modules/Recruit/ElementDrawCardPanel.lua b/Assets/ManagedResources/~Lua/Modules/Recruit/ElementDrawCardPanel.lua index b2813bfbaa..20b703d0ff 100644 --- a/Assets/ManagedResources/~Lua/Modules/Recruit/ElementDrawCardPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Recruit/ElementDrawCardPanel.lua @@ -148,6 +148,9 @@ function ElementDrawCardPanel:BindEvent() -- this.getCardPanel5:SetActive(false) this.getCardPanel1:GetComponent("PlayFlyAnim"):PlayAnim(true) this.effect:SetActive(true) + -- 音效 + SoundManager.PlaySound(SoundConfig.Sound_syz) + SoundManager.PlayMusic(SoundConfig.Sound_syz_loop) end) Util.AddClick(this.itemBtn2, function () this.getCardPanel1:SetActive(false) @@ -157,6 +160,9 @@ function ElementDrawCardPanel:BindEvent() -- this.getCardPanel5:SetActive(false) this.getCardPanel2:GetComponent("PlayFlyAnim"):PlayAnim(true) this.effect:SetActive(true) + -- 音效 + SoundManager.PlaySound(SoundConfig.Sound_syz) + SoundManager.PlayMusic(SoundConfig.Sound_syz_loop) end) Util.AddClick(this.itemBtn3, function () this.getCardPanel1:SetActive(false) @@ -166,6 +172,9 @@ function ElementDrawCardPanel:BindEvent() -- this.getCardPanel5:SetActive(false) this.getCardPanel3:GetComponent("PlayFlyAnim"):PlayAnim(true) this.effect:SetActive(true) + -- 音效 + SoundManager.PlaySound(SoundConfig.Sound_syz) + SoundManager.PlayMusic(SoundConfig.Sound_syz_loop) end) Util.AddClick(this.itemBtn4, function () this.getCardPanel1:SetActive(false) @@ -175,6 +184,9 @@ function ElementDrawCardPanel:BindEvent() -- this.getCardPanel5:SetActive(false) this.getCardPanel4:GetComponent("PlayFlyAnim"):PlayAnim(true) this.effect:SetActive(true) + -- 音效 + SoundManager.PlaySound(SoundConfig.Sound_syz) + SoundManager.PlayMusic(SoundConfig.Sound_syz_loop) end) -- Util.AddClick(this.itemBtn5, function () -- this.getCardPanel1:SetActive(false) @@ -189,18 +201,22 @@ function ElementDrawCardPanel:BindEvent() Util.AddClick(this.getCardPanelBtnBack1, function () this.getCardPanel1:SetActive(false) this.effect:SetActive(false) + SoundManager.PlayMusic(SoundConfig.BGM_Main) end) Util.AddClick(this.getCardPanelBtnBack2, function () this.getCardPanel2:SetActive(false) this.effect:SetActive(false) + SoundManager.PlayMusic(SoundConfig.BGM_Main) end) Util.AddClick(this.getCardPanelBtnBack3, function () this.getCardPanel3:SetActive(false) this.effect:SetActive(false) + SoundManager.PlayMusic(SoundConfig.BGM_Main) end) Util.AddClick(this.getCardPanelBtnBack4, function () this.getCardPanel4:SetActive(false) this.effect:SetActive(false) + SoundManager.PlayMusic(SoundConfig.BGM_Main) end) -- Util.AddClick(this.getCardPanelBtnBack5, function () -- this.getCardPanel5:SetActive(false) diff --git a/Assets/ManagedResources/~Lua/Modules/UpGradePackage/UpGradePackagePanel.lua b/Assets/ManagedResources/~Lua/Modules/UpGradePackage/UpGradePackagePanel.lua index 5b22325730..44dc133941 100644 --- a/Assets/ManagedResources/~Lua/Modules/UpGradePackage/UpGradePackagePanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/UpGradePackage/UpGradePackagePanel.lua @@ -111,6 +111,8 @@ end --界面打开时调用(用于子类重写) function this:OnOpen(_fun) fun = _fun + -- 音效 + SoundManager.PlaySound(SoundConfig.Sound_mrhl) end --获取(自己拼凑)礼包数据