【灵脉秘境】切磋

dev_chengFeng
ZhangBiao 2021-11-19 16:16:45 +08:00
parent c8d4cadb2b
commit 5e09e0b9a3
3 changed files with 63 additions and 35 deletions

View File

@ -8,10 +8,13 @@ local hadClick = false
this.nodeData = {}
local curFormationTypeDef
--- 逻辑初始化
function this.Init(root, _nodeData)
function this.Init(root,...)
this.spLoader = SpriteLoader.New()
this.root = root
this.nodeData = _nodeData
local temp = {...}
LogGreen("temp[1]:"..tostring(temp[1]).." temp[2]:"..tostring(temp[2]))
this.nodeData = temp[1]
this.isTest = temp[2] and temp[2] or false
this.InitView()
end
--- 获取需要显示的编队id
@ -69,36 +72,57 @@ function this.StartFight()
PopupTipPanel.ShowTip(string.format(Language[10699], 1))
return
end
if this.nodeData.uid == PlayerManager.uid then
this.root:ClosePanel()
else
NetManager.LingMaiBattleRequest(this.nodeData.Id,2030,function (msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(2030, 1)--更新特权
if this.isTest then
LogRed("#################")
PlayerManager.RequestPlayWithSomeOne(this.nodeData.uid, FormationTypeDef.FORMATION_LINGMAIMIJING, this.nodeData.name, function(result)
this.root:ClosePanel()
local arg = {}
arg.result = result.result
arg.blue = {}
arg.blue.uid = PlayerManager.uid
arg.blue.name = PlayerManager.nickName
arg.blue.head = PlayerManager.head
arg.blue.frame = HeadManager.GetCurFrameId()
arg.red= {}
arg.red.uid = this.nodeData.uid
arg.red.name = this.nodeData.name
arg.red.head = this.nodeData.head
arg.red.frame = this.nodeData.headFrame
local num = this.nodeData.uid > 0 and 1 or 0
local fightData = BattleManager.GetBattleServerData(msg,num)
LingMaiMiJingManager.battleResult = msg
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.LINGMAIMIJING,function ()
local arg = {}
arg.panelType=2
arg.result = msg.result
arg.blue = {}
arg.blue.uid = PlayerManager.uid
arg.blue.name = PlayerManager.nickName
arg.blue.head = PlayerManager.head
arg.blue.frame = HeadManager.GetCurFrameId()
arg.red= {}
arg.red.uid = this.nodeData.uid
arg.red.name = this.nodeData.name
arg.red.head = this.nodeData.head
arg.red.frame = this.nodeData.headFrame
-- 不用回放直接显示结果
UIManager.OpenPanel(UIName.ArenaResultPopup, arg)
end):SetResult(msg.result)
end)
-- 不用回放直接显示结果
UIManager.OpenPanel(UIName.ArenaResultPopup, arg)
end,this.isTest)
else
if this.nodeData.uid == PlayerManager.uid then
this.root:ClosePanel()
else
NetManager.LingMaiBattleRequest(this.nodeData.Id,2030,function (msg)
PrivilegeManager.RefreshPrivilegeUsedTimes(2030, 1)--更新特权
this.root:ClosePanel()
local num = this.nodeData.uid > 0 and 1 or 0
local fightData = BattleManager.GetBattleServerData(msg,num)
LingMaiMiJingManager.battleResult = msg
UIManager.OpenPanel(UIName.BattlePanel, fightData, BATTLE_TYPE.LINGMAIMIJING,function ()
local arg = {}
arg.panelType=2
arg.result = msg.result
arg.blue = {}
arg.blue.uid = PlayerManager.uid
arg.blue.name = PlayerManager.nickName
arg.blue.head = PlayerManager.head
arg.blue.frame = HeadManager.GetCurFrameId()
arg.red= {}
arg.red.uid = this.nodeData.uid
arg.red.name = this.nodeData.name
arg.red.head = this.nodeData.head
arg.red.frame = this.nodeData.headFrame
-- 不用回放直接显示结果
UIManager.OpenPanel(UIName.ArenaResultPopup, arg)
end):SetResult(msg.result)
end)
end
end
end
return this

View File

@ -89,13 +89,12 @@ function this.GetLingMaiServerData(msg,func)
this.lingmaiData = msg.lingmaiData
for i = 1, #msg.lingmaiData do
this.curPage = lodeConfig[msg.lingmaiData[i].lingmaiId].PageNo
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))
-- 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))
msg.lingmaiData[i].name = PracticeManager.SetNameColor(msg.lingmaiData[i].name,msg.lingmaiData[i].practiceLevel)
end
LogGreen("state:"..tostring(msg.state).." myPlaceId:"..tostring(msg.myOccupyId).." startTime:"..tostring(msg.myOccupyTime)
Log("state:"..tostring(msg.state).." myPlaceId:"..tostring(msg.myOccupyId).." startTime:"..tostring(msg.myOccupyTime)
.." fightTime:"..tostring(msg.remainChangeTimes).." lingmaiData:"..tostring(#msg.lingmaiData).." curPage:"..tostring(this.curPage).." timePoint:"..tostring(msg.timePoint))
-- Game.GlobalEvent:DispatchEvent(GameEvent.LingMaiMiJing.RefreshPanel)
if func then
func()
end
@ -108,7 +107,6 @@ function this.OpenRecord()
end
function this.CheckPrivilage(func)
-- LogBlue("特权2030"..tostring(PrivilegeManager.GetPrivilegeRemainValue(2030)).." 特权2031"..tostring(PrivilegeManager.GetPrivilegeRemainValue(2031)))
if PrivilegeManager.GetPrivilegeRemainValue(2030) <= 0 then
if PrivilegeManager.GetPrivilegeRemainValue(2031) > 0 then
local costId, finalNum, oriCostNum = ShopManager.calculateBuyCost(SHOP_TYPE.FUNCTION_SHOP,10044, 1)

View File

@ -83,7 +83,7 @@ local _ViewConfig = {
tip = "灵脉秘境阵容:",
isAddFriend = false,
btnType = {
{name = "切磋", func = 3},
{name = "切磋", func = 8},
{name = "挑战", func = 8},
{name = "调整编队", func = 8},
}
@ -557,10 +557,16 @@ end
function this.LingMaiFormaion()
if this.data.uid == PlayerManager.uid then
this:ClosePanel()
Log("调整编队")
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.LINGMAIMIJING, this.data)
elseif this.data.Id > LingMaiMiJingManager.myPlaceId then
this:ClosePanel()
Log("切磋")
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.LINGMAIMIJING, this.data,true)
else
LingMaiMiJingManager.CheckPrivilage(function ()
this:ClosePanel()
Log("正常战斗")
UIManager.OpenPanel(UIName.FormationPanelV2, FORMATION_TYPE.LINGMAIMIJING, this.data)
end)
end