2021-11-11 10:06:49 +08:00
|
|
|
|
LingMaiMiJingManager = {}
|
|
|
|
|
local this = LingMaiMiJingManager
|
2021-11-11 16:36:52 +08:00
|
|
|
|
local lodeConfig = ConfigManager.GetConfig(ConfigName.LodeConfig)
|
2021-11-17 16:14:47 +08:00
|
|
|
|
local monsterGroup = ConfigManager.GetConfig(ConfigName.MonsterGroup)
|
|
|
|
|
local monsterConfig = ConfigManager.GetConfig(ConfigName.MonsterConfig)
|
2021-11-11 10:06:49 +08:00
|
|
|
|
|
|
|
|
|
function this.Initialize()
|
2021-11-16 11:21:37 +08:00
|
|
|
|
this.state = 1--当前状态
|
2021-11-16 17:34:37 +08:00
|
|
|
|
this.startTime = 0--我开始占领此矿脉的时间
|
2021-11-16 11:21:37 +08:00
|
|
|
|
this.endTime = 1638460800--结束时间
|
2021-11-16 18:30:08 +08:00
|
|
|
|
this.myPlaceId = 1--当前我占领的矿脉的id
|
2021-11-16 11:21:37 +08:00
|
|
|
|
this.fightTime = 0--我的剩余挑战次数
|
2021-11-17 16:14:47 +08:00
|
|
|
|
this.curPage = 0
|
|
|
|
|
this.lingmaiData = {}
|
2021-11-16 17:34:37 +08:00
|
|
|
|
this.battleResult = {}
|
2021-11-18 15:14:39 +08:00
|
|
|
|
this.recordData = {}
|
2021-11-11 10:06:49 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-11-11 16:36:52 +08:00
|
|
|
|
--获取manager中的信息
|
|
|
|
|
function this.GetData()
|
|
|
|
|
local data = {}
|
|
|
|
|
data.state = this.state
|
|
|
|
|
data.startTime = this.startTime
|
|
|
|
|
data.endTime = this.endTime
|
|
|
|
|
data.myPlaceId = this.myPlaceId
|
2021-11-17 16:14:47 +08:00
|
|
|
|
data.lingmaiData = {}
|
2021-11-11 16:36:52 +08:00
|
|
|
|
for i = 1, 5 do
|
2021-11-17 16:14:47 +08:00
|
|
|
|
data.lingmaiData[i] = {}
|
|
|
|
|
-- LogGreen("placeId:"..tostring(this.lingmaiData[i].id).." playerId:"..tostring(this.lingmaiData[i].uid).." Name:"..tostring(this.lingmaiData[i].name))
|
2021-11-18 13:29:26 +08:00
|
|
|
|
if not this.lingmaiData[i] then
|
|
|
|
|
LogError("服务器发来的灵脉Id为0")
|
|
|
|
|
-- Game.GlobalEvent:DispatchEvent(GameEvent.LingMaiMiJing.ClosePanel)
|
|
|
|
|
return nil
|
|
|
|
|
end
|
2021-11-17 16:14:47 +08:00
|
|
|
|
data.lingmaiData[i].Id = this.lingmaiData[i].lingmaiId
|
|
|
|
|
local curId = data.lingmaiData[i].Id
|
|
|
|
|
data.lingmaiData[i].No = lodeConfig[curId].No
|
|
|
|
|
data.lingmaiData[i].PageNo = lodeConfig[curId].PageNo
|
|
|
|
|
data.lingmaiData[i].Group = lodeConfig[curId].Group
|
|
|
|
|
data.lingmaiData[i].Quality = lodeConfig[curId].Quality
|
|
|
|
|
data.lingmaiData[i].RewardList = lodeConfig[curId].RewardList
|
|
|
|
|
data.lingmaiData[i].Guard = lodeConfig[curId].Guard
|
|
|
|
|
data.lingmaiData[i].veinName = lodeConfig[curId].Name
|
|
|
|
|
local monsterGroupData = monsterGroup[data.lingmaiData[i].Guard].Contents
|
|
|
|
|
|
|
|
|
|
--拼接玩家数据
|
|
|
|
|
if this.lingmaiData[i].uid ~= 0 then
|
|
|
|
|
data.lingmaiData[i].uid = this.lingmaiData[i].uid
|
|
|
|
|
data.lingmaiData[i].name = this.lingmaiData[i].name
|
|
|
|
|
data.lingmaiData[i].servername = this.lingmaiData[i].servername
|
|
|
|
|
data.lingmaiData[i].head = this.lingmaiData[i].head
|
|
|
|
|
data.lingmaiData[i].headFrame = this.lingmaiData[i].headFrame
|
2021-11-15 09:56:02 +08:00
|
|
|
|
else
|
2021-11-17 16:14:47 +08:00
|
|
|
|
data.lingmaiData[i].uid = 0
|
2024-01-04 20:16:39 +08:00
|
|
|
|
data.lingmaiData[i].name = "宝岛"
|
2021-11-17 16:14:47 +08:00
|
|
|
|
data.lingmaiData[i].servername = ""
|
|
|
|
|
data.lingmaiData[i].head = 0
|
|
|
|
|
data.lingmaiData[i].headFrame = 0
|
|
|
|
|
data.lingmaiData[i].level = 100
|
|
|
|
|
data.lingmaiData[i].teamInfo = {}
|
|
|
|
|
data.lingmaiData[i].teamInfo.totalForce = lodeConfig[curId].GuardCombatNum
|
|
|
|
|
data.lingmaiData[i].teamInfo.team = {}
|
|
|
|
|
for j = 1, 6 do
|
|
|
|
|
if monsterGroupData[1] then
|
|
|
|
|
local monsterData = monsterConfig[monsterGroupData[1][j]]
|
|
|
|
|
local herodata = {}
|
2021-11-17 17:24:51 +08:00
|
|
|
|
-- LogBlue(data.lingmaiData[i].Guard.." "..monsterGroupData[1][j].." "..monsterData.MonsterId.." "..monsterData.Star.." "..monsterData.Level)
|
2021-11-17 16:14:47 +08:00
|
|
|
|
herodata.heroTid = monsterData.MonsterId
|
2021-11-17 17:24:51 +08:00
|
|
|
|
herodata.star = monsterData.Star
|
2021-11-17 16:14:47 +08:00
|
|
|
|
herodata.level = monsterData.Level
|
|
|
|
|
herodata.position = j
|
|
|
|
|
herodata.skinId = 0
|
|
|
|
|
herodata.godSoulLv = 0
|
|
|
|
|
table.insert(data.lingmaiData[i].teamInfo.team,herodata)
|
|
|
|
|
end
|
|
|
|
|
end
|
2021-11-15 09:56:02 +08:00
|
|
|
|
end
|
2021-11-11 16:36:52 +08:00
|
|
|
|
end
|
|
|
|
|
return data
|
|
|
|
|
end
|
|
|
|
|
|
2021-11-11 14:28:02 +08:00
|
|
|
|
--获取服务器发来的信息
|
2021-11-11 16:36:52 +08:00
|
|
|
|
function this.GetLingMaiServerData(msg,func)
|
2021-11-18 15:14:39 +08:00
|
|
|
|
this.state = msg.state
|
2021-11-16 18:30:08 +08:00
|
|
|
|
this.myPlaceId = msg.myOccupyId
|
2021-11-15 18:38:53 +08:00
|
|
|
|
this.startTime = msg.myOccupyTime
|
2021-11-16 11:21:37 +08:00
|
|
|
|
this.fightTime = msg.remainChangeTimes
|
2021-11-18 15:45:21 +08:00
|
|
|
|
this.endTime = msg.timePoint
|
2021-11-17 16:14:47 +08:00
|
|
|
|
this.lingmaiData = msg.lingmaiData
|
|
|
|
|
for i = 1, #msg.lingmaiData do
|
|
|
|
|
this.curPage = lodeConfig[msg.lingmaiData[i].lingmaiId].PageNo
|
2021-11-19 16:16:45 +08:00
|
|
|
|
-- LogYellow("id:"..tostring(msg.lingmaiData[i].lingmaiId).." uid:"..tostring(msg.lingmaiData[i].uid).." name:"..tostring(msg.lingmaiData[i].name)
|
|
|
|
|
-- .." practiceLevel:"..tostring(msg.lingmaiData[i].practiceLevel).." servername:"..tostring(msg.lingmaiData[i].servername))
|
2021-11-17 16:14:47 +08:00
|
|
|
|
msg.lingmaiData[i].name = PracticeManager.SetNameColor(msg.lingmaiData[i].name,msg.lingmaiData[i].practiceLevel)
|
2021-11-16 11:21:37 +08:00
|
|
|
|
end
|
2021-11-29 13:40:53 +08:00
|
|
|
|
Log("灵脉秘境:state:"..tostring(msg.state).." myPlaceId:"..tostring(msg.myOccupyId).." startTime:"..tostring(msg.myOccupyTime)
|
2021-11-18 15:45:21 +08:00
|
|
|
|
.." fightTime:"..tostring(msg.remainChangeTimes).." lingmaiData:"..tostring(#msg.lingmaiData).." curPage:"..tostring(this.curPage).." timePoint:"..tostring(msg.timePoint))
|
2021-11-11 16:36:52 +08:00
|
|
|
|
if func then
|
|
|
|
|
func()
|
|
|
|
|
end
|
2021-11-11 14:28:02 +08:00
|
|
|
|
end
|
2021-11-11 10:06:49 +08:00
|
|
|
|
|
2021-11-15 18:38:53 +08:00
|
|
|
|
function this.OpenRecord()
|
|
|
|
|
NetManager.LingMaiRecordRequest(function ()
|
2021-11-18 11:35:20 +08:00
|
|
|
|
UIManager.OpenPanel(UIName.GeneralBigPopup,GENERAL_POPUP_TYPE.LingMaiRecord)
|
2021-11-15 18:38:53 +08:00
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
2021-11-18 14:10:57 +08:00
|
|
|
|
function this.CheckPrivilage(func)
|
|
|
|
|
if PrivilegeManager.GetPrivilegeRemainValue(2030) <= 0 then
|
|
|
|
|
if PrivilegeManager.GetPrivilegeRemainValue(2031) > 0 then
|
|
|
|
|
local costId, finalNum, oriCostNum = ShopManager.calculateBuyCost(SHOP_TYPE.FUNCTION_SHOP,10044, 1)
|
|
|
|
|
local itemName = ConfigManager.GetConfigData(ConfigName.ItemConfig,costId).Name
|
|
|
|
|
MsgPanel.ShowTwo(string.format( Language[10516],finalNum,itemName), nil, function()
|
|
|
|
|
--买东西
|
|
|
|
|
ShopManager.RequestBuyShopItem(SHOP_TYPE.FUNCTION_SHOP,10044,1,function()
|
|
|
|
|
PopupTipPanel.ShowTip(Language[10517])
|
|
|
|
|
PrivilegeManager.RefreshPrivilegeUsedTimes(2031, 1)--更新特权
|
|
|
|
|
func()
|
2021-11-18 18:43:22 +08:00
|
|
|
|
end,0)
|
2021-11-18 14:10:57 +08:00
|
|
|
|
end)
|
|
|
|
|
else
|
|
|
|
|
PopupTipPanel.ShowTip("<color=red>今日已无挑战次数!</color>")
|
|
|
|
|
end
|
|
|
|
|
else
|
|
|
|
|
func()
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
2021-11-18 15:14:39 +08:00
|
|
|
|
function this.CheckRedPoint()
|
2021-11-22 17:59:46 +08:00
|
|
|
|
--判断功能是否开启
|
|
|
|
|
if not ActTimeCtrlManager.IsQualifiled(FUNCTION_OPEN_TYPE.LINGMAIMIJING) then
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
--判断世界等级是否够
|
|
|
|
|
local conFigWorldLevel = ConfigManager.GetConfigData(ConfigName.MServerLodeSetting,1).WorldLevel
|
|
|
|
|
if PlayerManager.worldLeve < conFigWorldLevel then --如果世界等级不足
|
|
|
|
|
return false
|
|
|
|
|
end
|
|
|
|
|
-- 跨服相关判断
|
|
|
|
|
if not JumpServerManager.GetLingMaiIsStart() then
|
|
|
|
|
return false
|
|
|
|
|
elseif not JumpServerManager.GetHightLadderDataIsGroup() then
|
|
|
|
|
return false
|
|
|
|
|
end
|
2021-11-19 15:38:41 +08:00
|
|
|
|
if this.state ~= 1 then
|
|
|
|
|
return false
|
|
|
|
|
end
|
2021-11-22 18:08:48 +08:00
|
|
|
|
if this.myPlaceId <= 0 then
|
2021-11-18 15:14:39 +08:00
|
|
|
|
return true
|
|
|
|
|
end
|
2021-11-18 18:43:22 +08:00
|
|
|
|
if #this.recordData > 0 then
|
|
|
|
|
if not PlayerPrefs.GetString(PlayerManager.uid.."LingMai") then
|
|
|
|
|
PlayerPrefs.SetString(PlayerManager.uid.."LingMai", "")
|
|
|
|
|
end
|
2021-11-22 16:11:21 +08:00
|
|
|
|
for i = 1, #this.recordData do
|
2021-11-22 19:11:07 +08:00
|
|
|
|
if this.recordData[i].type == 1 then
|
|
|
|
|
return PlayerPrefs.GetString(PlayerManager.uid.."LingMai") ~= tostring(this.recordData[i].time)
|
2021-11-22 16:11:21 +08:00
|
|
|
|
end
|
2021-11-18 18:43:22 +08:00
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
return false
|
2021-11-18 15:14:39 +08:00
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
function this.CheckRecord()
|
2021-11-22 16:11:21 +08:00
|
|
|
|
for i = 1, #this.recordData do
|
2021-11-22 17:20:04 +08:00
|
|
|
|
if this.recordData[i].type == 1 then
|
2021-11-22 16:11:21 +08:00
|
|
|
|
return PlayerPrefs.GetString(PlayerManager.uid.."LingMai") ~= tostring(this.recordData[i].time)
|
|
|
|
|
end
|
2021-11-19 09:38:41 +08:00
|
|
|
|
end
|
|
|
|
|
return false
|
2021-11-18 15:14:39 +08:00
|
|
|
|
end
|
|
|
|
|
|
2021-11-22 17:59:46 +08:00
|
|
|
|
|
|
|
|
|
function this.CheckQiJieJump(funcType,SettingNum,func)
|
|
|
|
|
--判断功能是否开启
|
|
|
|
|
if not ActTimeCtrlManager.IsQualifiled(funcType) then
|
|
|
|
|
PopupTipPanel.ShowTip(ActTimeCtrlManager.GetFuncTip(funcType))
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
--判断世界等级是否够
|
|
|
|
|
local conFigWorldLevel = ConfigManager.GetConfigData(ConfigName.MServerLodeSetting,SettingNum).WorldLevel
|
|
|
|
|
if PlayerManager.worldLeve < conFigWorldLevel then --如果世界等级不足
|
|
|
|
|
PopupTipPanel.ShowTip(string.format("世界等级到达%s后开启!",conFigWorldLevel))
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
-- 跨服相关判断
|
|
|
|
|
JumpServerManager.GetWorldArenaInfoRequest(function()
|
|
|
|
|
if not JumpServerManager.GetQiJieIsStart() then
|
|
|
|
|
PopupTipPanel.ShowTip(string.format("开服第%s周开放!",ConfigManager.GetConfigData(ConfigName.MServerArenaSetting,SettingNum).OpenWeek))
|
|
|
|
|
return
|
|
|
|
|
elseif not JumpServerManager.GetHightLadderDataIsGroup() then
|
|
|
|
|
PopupTipPanel.ShowTip("未划分跨服分组,无法参与!")
|
|
|
|
|
return
|
|
|
|
|
end
|
|
|
|
|
if func then
|
|
|
|
|
func()
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
end
|
|
|
|
|
|
2021-11-11 10:06:49 +08:00
|
|
|
|
return LingMaiMiJingManager
|