miduo_client/Assets/ManagedResources/~Lua/Modules/Expedition/ExpeditionMainPanel.lua

641 lines
29 KiB
Lua

require("Base/BasePanel")
ExpeditionMainPanel = Inherit(BasePanel)
local nodeGrid = {}
local nodeItemGrid = {}
local boxList={}--宝箱按钮
local BoxItemPres = {}
local timer = Timer.New()
local allBoxData , curPassLay
local live2dList = {}
local npc = ""
local GetCurNodeInfo = {}--当前操作层数据
local SkeletonGraphic--动画组件
local isPlayerMove = false--是否在播放人物行走动画
local isFirstOnOpen = false--是否是经过onopen 打开界面 只有此时才会刷新数据
local isAllHaveAttack = false--是否有状态不一致情况 说明不是失败过 就是未领取圣物状态
local curNodeGo
local nodeGoTable = {}
local timer2 = Timer.New()
--初始化组件(用于子类重写)
function ExpeditionMainPanel:InitComponent()
self.backBtn = Util.GetGameObject(self.gameObject, "btnBack")
self.Btn1 = Util.GetGameObject(self.gameObject, "Btn1")
self.Btn2 = Util.GetGameObject(self.gameObject, "Btn2")
self.Btn3 = Util.GetGameObject(self.gameObject, "Btn3")
self.helpBtn = Util.GetGameObject(self.gameObject, "helpBtn")
self.helpPos = Util.GetGameObject(self.gameObject, "helpBtn"):GetComponent("RectTransform").localPosition
--self.timeTextGo = Util.GetGameObject(self.gameObject, "titleImage/timeText")
--self.timeText = Util.GetGameObject(self.gameObject, "titleImage/timeText"):GetComponent("Text")
nodeGrid = {}
nodeItemGrid = {}
for i = 1, 1 do
nodeGrid[i] = Util.GetGameObject(self.gameObject, "rect/grid/singlePre ("..i..")")
local nodeGridItemsGri = {}
for j = 1, 3 do
nodeGridItemsGri[j] = Util.GetGameObject(nodeGrid[i], "itemList/item ("..j..")")
end
nodeItemGrid[i] = nodeGridItemsGri
end
self.RewardPanel = Util.GetGameObject(self.transform, "boxRwardBg/RewardPanel")
self.rewardMaskBtn = Util.GetGameObject(self.transform, "boxRwardBg/RewardPanel/rewardMaskBtn")
self.boxItemGrid = Util.GetGameObject(self.transform, "boxRwardBg/RewardPanel/ViewRect/grid").transform
self.progressBottom = Util.GetGameObject(self.transform, "boxRwardBg/progressBottom/Image"):GetComponent("Image")
self.totalPro = Util.GetGameObject(self.transform, "boxRwardBg/totalPro"):GetComponent("Text")
self.getInfo = Util.GetGameObject(self.transform, "boxRwardBg/RewardPanel/getInfo"):GetComponent("Text")
self.mask = Util.GetGameObject(self.gameObject, "mask")
self.mask:SetActive(false)
boxList={}
BoxItemPres = {}
for i = 1, 3 do
boxList[i] = Util.GetGameObject(self.transform, "boxRwardBg/btnList/BoxBtn"..i)
BoxItemPres[i] = SubUIManager.Open(SubUIConfig.ItemView, self.boxItemGrid)
end
self.UI_effect_BaoXiang = Util.GetGameObject(self.gameObject, "bg/UI_effect_BaoXiang")
npc = NameManager.roleSex == ROLE_SEX.BOY and "live2d_npc_map" or "live2d_npc_map_nv"
local scale = NameManager.roleSex == ROLE_SEX.BOY and Vector3.one*0.2 or Vector3.one * 0.12
self.liveNode = poolManager:LoadLive(npc, Util.GetTransform(self.transform, "playerLive"), scale, Vector3.zero)
SkeletonGraphic = self.liveNode:GetComponent("SkeletonGraphic")
if SkeletonGraphic then
SkeletonGraphic.AnimationState:SetAnimation(0, "move2", true)
SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, 0, 0)
end
--local sv = SubUIManager.Open(SubUIConfig.ScrollFitterView, this.scrollRoot.transform,
-- this.chatItem, Vector2.New(1080, rootHight - 10), 1, 10)
local v2 = Util.GetGameObject(self.gameObject, "rect"):GetComponent("RectTransform").rect
self.singlePre = Util.GetGameObject(self.transform, "singlePre")
self.ScrollView = SubUIManager.Open(SubUIConfig.ScrollFitterView, Util.GetGameObject(self.transform, "rect").transform,
self.singlePre, Vector2.New(1080, 1675.4), 1, 1)
self.ScrollView.moveTween.MomentumAmount = 1
self.ScrollView.moveTween.Strength = 1
self.ScrollView.elastic = false
end
--绑定事件(用于子类重写)
function ExpeditionMainPanel:BindEvent()
Util.AddClick(self.backBtn, function()
if isPlayerMove == false then
self:ClosePanel()
end
end)
Util.AddClick(self.Btn1, function()
UIManager.OpenPanel(UIName.ExpeditionHeroListResurgencePopup)
end)
Util.AddClick(self.Btn2, function()
UIManager.OpenPanel(UIName.ExpeditionHeroListInfoPopup)
end)
Util.AddClick(self.Btn3, function()
UIManager.OpenPanel(UIName.ExpeditionHalidomPanel)
end)
Util.AddClick(self.rewardMaskBtn, function()
self.RewardPanel:SetActive(false)
end)
Util.AddClick(self.helpBtn, function()
UIManager.OpenPanel(UIName.HelpPopup,HELP_TYPE.Expedition,self.helpPos.x,self.helpPos.y)
end)
end
--添加事件监听(用于子类重写)
function ExpeditionMainPanel:AddListener()
end
--移除事件监听(用于子类重写)
function ExpeditionMainPanel:RemoveListener()
end
local isSetIndex = false
--界面打开时调用(用于子类重写)
function ExpeditionMainPanel:OnOpen(_isPlayAni,_isSetIndex)
ExpeditionManager.ExpeditionRrefreshFormation()
isSetIndex = _isSetIndex or false
isFirstOnOpen = true
isAllHaveAttack = false
isPlayerMove = _isPlayAni
self.mask:SetActive(isPlayerMove)
--Log("self.mask "..tostring(isPlayerMove))
self.RewardPanel:SetActive(false)
ExpeditionManager.GetActivityIsShowRedPoint(false,"1")
end
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
function ExpeditionMainPanel:OnShow()
--Log("isPlayerMove "..tostring(isPlayerMove))
isAllHaveAttack = false
if isPlayerMove then
self:EndPlayerMoveFun()
else
if isFirstOnOpen then
nodeGoTable = {}
self:OnShowBoxData()
self:OnShowNodeData()
self:StarPlayerMoveFun()
end
end
isFirstOnOpen = false
end
--实例化层数信息
function ExpeditionMainPanel:OnShowNodeData()
--节点
isPlayerMove = false
self.mask:SetActive(isPlayerMove)
--Log("self.mask "..tostring(isPlayerMove))
self.UI_effect_BaoXiang.transform:SetParent(self.transform)
self.UI_effect_BaoXiang:SetActive(false)
local AllLayNodeList = ExpeditionManager.GetAllLayNodeList()
if AllLayNodeList == nil then return end
local curAllLayNodeList = {}
for i = #AllLayNodeList, 1, -1 do
table.insert(curAllLayNodeList,AllLayNodeList[i])
end
GetCurNodeInfo = ExpeditionManager.GetCurNodeInfo()
isAllHaveAttack = false
self.ScrollView:SetData(curAllLayNodeList, function (index, go)
self:SingleNodeShow(go,curAllLayNodeList[index],(#AllLayNodeList - index) + 1)
end)
if isSetIndex then
--Log("(#AllLayNodeList - GetCurNodeInfo.lay "..#AllLayNodeList - GetCurNodeInfo.lay + 1 )
local index = #AllLayNodeList - GetCurNodeInfo.lay + 1
if index == 1 then
self.ScrollView:SetIndex(1)
Util.GetGameObject(self.ScrollView.gameObject, "grid").transform.anchoredPosition = Vector3.New(0,340,0)
else
self.ScrollView:SetIndex(index)
end
--if index > 1 then
-- self.ScrollView:SetIndex(index)
--elseif index == 1 then
-- self.ScrollView:SetIndex(2)
-- Util.GetGameObject(self.ScrollView.gameObject, "grid").transform.anchoredPosition = Vector3.New(0,1270,0)
--else
-- self.ScrollView:SetIndex(1)
-- Util.GetGameObject(self.ScrollView.gameObject, "grid").transform.anchoredPosition = Vector3.New(0,340,0)
--end
end
end
local liveNodeList = {}
--实例化每层信息
function ExpeditionMainPanel:SingleNodeShow(go,layNodeListData,index)
nodeGoTable[go.name] = {data = layNodeListData,goData = go}
local nodeGo = go
local bgImage = nodeGo:GetComponent("Image")
if index == 15 then
bgImage.sprite = Util.LoadSprite("l_lieyaozhilu_di10")
Util.GetGameObject(nodeGo, "bg"):SetActive(false)
Util.GetGameObject(nodeGo, "bg2"):SetActive(false)
Util.GetGameObject(nodeGo, "itemList").transform.anchoredPosition = Vector3.New(0,-841.0002,0)
Util.GetGameObject(nodeGo, "finish").transform.anchoredPosition = Vector3.New(-6,-731,0)
Util.GetGameObject(nodeGo, "starPos").transform.anchoredPosition = Vector3.New(-905,-856,0)
Util.GetGameObject(nodeGo, "endPos").transform.anchoredPosition = Vector3.New(801,-856,0)
--elseif index == 15 then3
else
Util.GetGameObject(nodeGo, "bg"):SetActive(true)
Util.GetGameObject(nodeGo, "bg2"):SetActive(true)
Util.GetGameObject(nodeGo, "itemList").transform.anchoredPosition = Vector3.New(0,-132,0)
Util.GetGameObject(nodeGo, "finish").transform.anchoredPosition = Vector3.New(-6,-6,0)
Util.GetGameObject(nodeGo, "starPos").transform.anchoredPosition = Vector3.New(-905,-147,0)
Util.GetGameObject(nodeGo, "endPos").transform.anchoredPosition = Vector3.New(801,-147,0)
bgImage.sprite = Util.LoadSprite("l_lieyaozhilu_di8")
end
local layText = Util.GetGameObject(nodeGo, "bg2/Image (1)/Text"):GetComponent("Text")
layText.text = ""..index..""
if GetCurNodeInfo.lay ~= index then
self:SetCurAlpha(layText,0.4)
if Util.GetGameObject(nodeGo, "starPos").transform.childCount > 0 then
self.liveNode:SetActive(false)
end
else
curNodeGo = go
self:SetCurAlpha(layText,1)
self.liveNode:SetActive(true)
if Util.GetGameObject(nodeGo, "starPos").transform.childCount <= 0 then
self.liveNode.transform:SetParent(Util.GetGameObject(nodeGo, "starPos").transform)
self.liveNode.transform.localPosition = Vector3.zero
end
end
Util.GetGameObject(nodeGo, "finish"):SetActive(GetCurNodeInfo.lay > index)
Util.GetGameObject(nodeGo, "itemList"):SetActive(GetCurNodeInfo.lay <= index)
Util.GetGameObject(nodeGo, "mask"):SetActive(GetCurNodeInfo.lay < index)
if index == GetCurNodeInfo.lay and GetCurNodeInfo.state == ExpeditionNodeState.Finish then--打完最后一层
Util.GetGameObject(nodeGo, "finish"):SetActive(true)
Util.GetGameObject(nodeGo, "itemList"):SetActive(false)
self.liveNode:SetActive(false)
end
local isAttack = false
local stateNum = layNodeListData[1].state
--Log("stateNum "..stateNum)
for i = 1, #layNodeListData do
if stateNum ~= layNodeListData[i].state and GetCurNodeInfo.lay == layNodeListData[i].lay then
isAttack = true
isAllHaveAttack = true
end
end
for j = 1, 3 do
Util.GetGameObject(nodeGo, "itemList/item ("..j..")"):SetActive(false)
end
--卸载加载的立绘
if liveNodeList[go] then
for i = 1, #liveNodeList[go] do
local item = liveNodeList[go][i]
poolManager:UnLoadLive(item.name, item.go, PoolManager.AssetType.GameObject)
end
end
liveNodeList[go] = {}
for i = 1, #layNodeListData do--每个节点显示
local curItemGo = Util.GetGameObject(nodeGo, "itemList/item ("..i..")")
curItemGo:SetActive(true)
local clickbtn = Util.GetGameObject(curItemGo, "click")
---实例化动画---
--Util.ClearChild(Util.GetGameObject(curItemGo, "goParent").transform)
if GetCurNodeInfo.lay <= layNodeListData[i].lay then
liveNodeList[go][i] = self:InitLiveSet(layNodeListData[i].type, Util.GetGameObject(curItemGo, "goParent"))
end
--------------
Util.GetGameObject(curItemGo, "goParent"):SetActive(true)
Util.GetGameObject(curItemGo, "click"):SetActive(true)
if Util.GetGameObject(curItemGo, "halidomParent").transform.childCount > 0 then
self.UI_effect_BaoXiang:SetActive(false)
end
local pos = Util.GetGameObject(curItemGo, "pos")--节点位置 人物动画用
pos.transform.localPosition = Vector3.New(0,-10,0)
if isAttack then
if layNodeListData[i].state == ExpeditionNodeState.No then--关闭 状态
Util.GetGameObject(curItemGo, "goParent"):SetActive(false)
Util.GetGameObject(curItemGo, "click"):SetActive(false)
elseif layNodeListData[i].state == ExpeditionNodeState.NoPass then--失败过 状态
self:PlayerMovePosFun(nodeGo,curItemGo)
elseif layNodeListData[i].state == ExpeditionNodeState.NoGetEquip then--未领圣物状态
self:PlayerMovePosFun(nodeGo,curItemGo)
Util.GetGameObject(curItemGo, "goParent"):SetActive(false)
self.UI_effect_BaoXiang.transform:SetParent(Util.GetGameObject(curItemGo, "halidomParent").transform)
self.UI_effect_BaoXiang.transform.localPosition=Vector3.zero;
self.UI_effect_BaoXiang:SetActive(true)
end
end
if GetCurNodeInfo.lay > layNodeListData[i].lay then return end--已完成直接跳过显示 已通关遮罩
self:SingleNodeInfoIconShow(curItemGo,layNodeListData[i],isAttack)
--Log(layNodeListData[i].lay.." ".. layNodeListData[i].sortId.." ".. layNodeListData[i].type.." "..layNodeListData[i].state)
if self.liveNode.transform.localPosition.y <=0 and GetCurNodeInfo.lay == layNodeListData[i].lay then
self:StarPlayerMoveFun()
end
Util.AddOnceClick(clickbtn, function()
if isPlayerMove then return end
if layNodeListData[i].state == ExpeditionNodeState.No then
PopupTipPanel.ShowTip("未开启!")
elseif layNodeListData[i].state == ExpeditionNodeState.NoPass then
if layNodeListData[i].type == ExpeditionNodeType.Boss or layNodeListData[i].type == ExpeditionNodeType.Jy or
layNodeListData[i].type == ExpeditionNodeType.Common then
self:PlayerMoveFun(pos,nodeGo,curItemGo,function()
UIManager.OpenPanel(UIName.ExpeditionMonsterInfoPopup,layNodeListData[i])
end)
elseif layNodeListData[i].type == ExpeditionNodeType.Halidom then--圣物节点
self:PlayerMoveFun(pos,nodeGo,curItemGo,function()
UIManager.OpenPanel(UIName.ExpeditionSelectHalidomPanel,false)
end)
elseif layNodeListData[i].type == ExpeditionNodeType.Reply then--回复节点
self:PlayerMoveFun(pos,nodeGo,curItemGo,function()
local num = ConfigManager.GetConfigData(ConfigName.ExpeditionSetting,1).RegeneratePercent/100
MsgPanel.ShowTwo("一眼神奇的甘泉,可使所有存活的猎妖师回复生命上限"..num.."%的生命值,是否前往?", nil, function(isShow)
NetManager.ReCoverExpeditionHeroRequest(layNodeListData[i].sortId,function (msg)
ExpeditionManager.UpdateHeroHpValue(msg.heroInfo)
--self:OnShowNodeData()
--self:OnShowBoxData()
--self:StarPlayerMoveFun()
self:EndPlayerMoveFun()
end)
end, nil, "前往", "回复之泉")
end)
elseif layNodeListData[i].type == ExpeditionNodeType.Resurgence then--复活节点
self:PlayerMoveFun(pos,nodeGo,curItemGo,function()
UIManager.OpenPanel(UIName.ExpeditionHeroListResurgencePopup,layNodeListData[i],function (btnState)
--self:OnShowNodeData()
--self:OnShowBoxData()
--self:StarPlayerMoveFun()
--Log("btnState "..btnState)
if btnState == 1 or btnState == 3 then--确定 直接通过
self:EndPlayerMoveFun()
elseif btnState == 2 or btnState == 4 then--取消 关闭
end
end)
end)
end
elseif layNodeListData[i].state == ExpeditionNodeState.NoGetEquip then
self:PlayerMoveFun(pos,nodeGo,curItemGo,function()
UIManager.OpenPanel(UIName.ExpeditionSelectHalidomPanel,false)
end)
elseif layNodeListData[i].state == ExpeditionNodeState.Finish then
PopupTipPanel.ShowTip("已完成!")
elseif layNodeListData[i].state == ExpeditionNodeState.Over then
PopupTipPanel.ShowTip("已通过!")
end
end)
end
end
--刷新箱子显示
function ExpeditionMainPanel:OnShowBoxData()
allBoxData , curPassLay = ExpeditionManager.GetAllNodeBoxnfoList()
for i = 1, math.max(#allBoxData, #boxList) do
local go = boxList[i]
if not go then
go = newObject(boxList[3])
go.transform:SetParent(Util.GetGameObject(self.transform, "boxRwardBg/btnList").transform)
go.name = "BoxBtn"..i
go.transform.localScale = Vector3.one
go.transform.localPosition = Vector3.zero
boxList[i] = go
end
go.gameObject:SetActive(false)
end
local keys = GameDataBase.SheetBase.GetKeys(ConfigManager.GetConfig(ConfigName.ExpeditionFloorConfig))
self.progressBottom.fillAmount = curPassLay/#keys
self.totalPro.text=curPassLay.."/"..#keys
for i = 1, #allBoxData do
--Log("allBoxData[i].state "..allBoxData[i].state)
boxList[i]:SetActive(true)
Util.GetGameObject(boxList[i], "num"):GetComponent("Text").text = allBoxData[i].ConFigData.Id..""
Util.GetGameObject(boxList[i], "getFinish"):SetActive(allBoxData[i].state==3)
Util.GetGameObject(boxList[i], "redPoint"):SetActive(allBoxData[i].state==2)
Util.AddOnceClick(boxList[i], function()
if allBoxData[i].state == ExpeditionNodeState.NoPass then
self:MissionBoxClick(allBoxData[i])
--PopupTipPanel.ShowTip("需通过"..allBoxData[i].ConFigData.Id.."层后才可领取!")
elseif allBoxData[i].state == ExpeditionNodeState.NoGetEquip then
NetManager.TakeExpeditionBoxRewardRequest(allBoxData[i].ConFigData.Id,function (msg)
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1)
ExpeditionManager.UpdateBoxValue(allBoxData[i].ConFigData.Id)
self:OnShowBoxData()
end)
else
self:MissionBoxClick(allBoxData[i])
end
end)
end
end
function ExpeditionMainPanel:MissionBoxClick(_singleData)
if _singleData.state == ExpeditionNodeState.NoPass or _singleData.state == ExpeditionNodeState.Finish then
self.getInfo.text="通过".._singleData.ConFigData.Id.."层可领取"
local reward = _singleData.ConFigData.TreasureBox
if reward then
for i = 1, math.max(#BoxItemPres, #reward) do
local go = BoxItemPres[i]
if not go then
go = SubUIManager.Open(SubUIConfig.ItemView, self.boxItemGrid)
go.gameObject.name = "frame"..i
BoxItemPres[i] = go
end
go.gameObject:SetActive(false)
end
for i = 1, #reward do
BoxItemPres[i].gameObject:SetActive(true)
BoxItemPres[i]:OnOpen(false,reward[i],0.75)
end
end
self.rewardMaskBtn:SetActive(true)
self.RewardPanel:SetActive(true)
elseif _singleData.state == ExpeditionNodeState.NoGetEquip then
NetManager.TakeMissionRewardRequest(TaskTypeDef.DayTask,_singleData.missionId,function (msg)
TaskManager.SetTypeTaskState(TaskTypeDef.DayTask, _singleData.missionId, SingleDailyMissionState.GetFinish)
UIManager.OpenPanel(UIName.RewardItemPopup,msg.drop,1)
self:OnShowBoxData()
end)
end
end
--刷新倒计时显示
function ExpeditionMainPanel:RemainTimeDown(_timeTextExpertgo,_timeTextExpert,timeDown)
if timeDown > 0 then
_timeTextExpertgo:SetActive(true)
_timeTextExpert.text = "剩余时间:"..self:TimeStampToDateString(timeDown)
if timer then
timer:Stop()
timer = nil
end
timer = Timer.New(function()
_timeTextExpert.text = "剩余时间:"..self:TimeStampToDateString(timeDown)
if timeDown < 0 then
_timeTextExpertgo:SetActive(false)
timer:Stop()
timer = nil
end
timeDown = timeDown - 1
end, 1, -1, true)
timer:Start()
else
_timeTextExpertgo:SetActive(false)
end
end
function ExpeditionMainPanel:TimeStampToDateString(second)
local day = math.floor(second / (24 * 3600))
local minute = math.floor(second / 60) % 60
local sec = second % 60
local hour = math.floor(math.floor(second - day * 24 * 3600 - sec - minute * 60) / 3600)
return string.format("%02d时%02d分%02d秒", hour, minute, sec)
end
--界面关闭时调用(用于子类重写)
function ExpeditionMainPanel:OnClose()
if timer then
timer:Stop()
timer = nil
end
if timer2 then
timer2:Stop()
timer2 = nil
end
end
--界面销毁时调用(用于子类重写)
function ExpeditionMainPanel:OnDestroy()
--if live2dList and #live2dList > 0 then
-- for i = 1, #live2dList do
-- poolManager:UnLoadLive(live2dList[i][1], live2dList[i][2], PoolManager.AssetType.GameObject)
-- live2dList[i] = nil
-- end
--end
--live2dList = {}
if self.liveNode then
poolManager:UnLoadLive(npc, self.liveNode, PoolManager.AssetType.GameObject)
self.liveNode = nil
end
end
--实例化节点立绘
function ExpeditionMainPanel:InitLiveSet(iconId, go)
local configData = ConfigManager.GetConfigData(ConfigName.ExpeditionNodeConfig,iconId)
local live2d = poolManager:LoadLive(configData.Icon, Util.GetTransform(go, "goParent"),
Vector3.one * configData.Scale, Vector3.New(configData.Position[1], configData.Position[2],0))
--local curLive = {configData.Icon,live2d}
--table.insert(live2dList,curLive)
local skeleton = live2d:GetComponent("SkeletonGraphic")
if skeleton and iconId == 2 then--首领
skeleton.AnimationState:SetAnimation(0, "idle2", true)
end
return {name=configData.Icon, go=live2d}
end
-- 设置文本透明度
function ExpeditionMainPanel:SetCurAlpha(text, a)
local color = text.color
color.a = a
text.color = color
end
function ExpeditionMainPanel:StarPlayerMoveFun()
--Log("isAllHaveAttack "..tostring(isAllHaveAttack))
if isAllHaveAttack then return end
self.liveNode.transform.localPosition = Vector3.zero
local targetPos = self.liveNode.transform.localPosition + Vector3.New(430,0,0)
SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, 0, 0)
isPlayerMove = true
self.mask:SetActive(isPlayerMove)
--Log("self.mask "..tostring(isPlayerMove))
SkeletonGraphic.AnimationState:SetAnimation(0, "move2", true)
self.liveNode.transform:DOLocalMove(targetPos, 1, false):OnStart(function ()
end):OnComplete(function ()
--Log("行走完毕")
SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
isPlayerMove = false
self.mask:SetActive(isPlayerMove)
--Log("self.mask "..tostring(isPlayerMove))
end):SetEase(Ease.Linear)
end
function ExpeditionMainPanel:EndPlayerMoveFun(fun)
if curNodeGo then
Util.GetGameObject(curNodeGo, "finish"):SetActive(true)
Util.GetGameObject(curNodeGo, "itemList"):SetActive(false)
end
local targetPos = Vector3.New(1706,0,0)
SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, 0, 0)
isPlayerMove = true
self.mask:SetActive(isPlayerMove)
--Log("self.mask "..tostring(isPlayerMove))
SkeletonGraphic.AnimationState:SetAnimation(0, "move2", true)
local timeNum = math.abs(self.liveNode.transform.localPosition.x - targetPos.x)/350--350/1s
self.liveNode.transform:DOLocalMove(targetPos, timeNum, false):OnStart(function ()
end):OnComplete(function ()
--Log("行走完毕")
SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
isPlayerMove = false
self.mask:SetActive(isPlayerMove)
--Log("self.mask "..tostring(isPlayerMove))
self:OnShowBoxData()
--self:OnShowNodeData()
self:SelfUpdataPanelShow()
end):SetEase(Ease.Linear)
end
function ExpeditionMainPanel:PlayerMoveFun(pos,nodeGo,curItemGo,fun)
local oldPos = self.liveNode.transform.localPosition
pos.transform:SetParent(Util.GetGameObject(nodeGo, "starPos").transform)
local targetPos = pos.transform.localPosition
if oldPos.x - targetPos.x > 0 then
SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, 180, 0)
else
SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, 0, 0)
end
isPlayerMove = true
self.mask:SetActive(isPlayerMove)
--Log("self.mask "..tostring(isPlayerMove))
SkeletonGraphic.AnimationState:SetAnimation(0, "move2", true)
local timeNum = math.abs(oldPos.x - targetPos.x)/350--350/1s
self.liveNode.transform:DOLocalMove(targetPos, timeNum, false):OnStart(function ()
end):OnComplete(function ()
--Log("行走完毕")
SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
isPlayerMove = false
self.mask:SetActive(isPlayerMove)
--Log("self.mask "..tostring(isPlayerMove))
pos.transform:SetParent(curItemGo.transform)
if fun then
fun()
end
end):SetEase(Ease.Linear)
end
function ExpeditionMainPanel:PlayerMovePosFun(nodeGo,curItemGo)
self.liveNode.transform:SetParent(curItemGo.transform)
self.liveNode.transform.localPosition = Vector3.zero
SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
if timer2 then
timer2:Stop()
timer2 = nil
end
timer2 = Timer.New(function ()
if nodeGo and self.liveNode then
self.liveNode.transform:SetParent(Util.GetGameObject(nodeGo, "starPos").transform)
end
end, 0.1):Start()
end
function ExpeditionMainPanel:SingleNodeInfoIconShow(nodeGo,layNodeData)
local infoIcon = Util.GetGameObject(nodeGo, "infoIcon")
infoIcon :SetActive(false)
local warPowerGo = Util.GetGameObject(infoIcon, "warPowerGo")
warPowerGo:SetActive(false)
local iconImage = Util.GetGameObject(warPowerGo, "iconImage"):GetComponent("Image")
local powerText = Util.GetGameObject(warPowerGo, "powerText"):GetComponent("Text")
local textIconGo = Util.GetGameObject(infoIcon, "textIconGo")
textIconGo:SetActive(false)
local iconImage2 = Util.GetGameObject(textIconGo, "iconImage"):GetComponent("Image")
if GetCurNodeInfo.lay == layNodeData.lay then--当前层
infoIcon:SetActive(true)
if layNodeData.type == ExpeditionNodeType.Jy or layNodeData.type == ExpeditionNodeType.Boss or layNodeData.type == ExpeditionNodeType.Common then
warPowerGo:SetActive(true)
iconImage.sprite = Util.LoadSprite(ExpeditionManager.NodeInfoIcon[layNodeData.type])
powerText.text = layNodeData.bossTeaminfo.totalForce
elseif layNodeData.type == ExpeditionNodeType.Resurgence or layNodeData.type == ExpeditionNodeType.Reply or layNodeData.type == ExpeditionNodeType.Halidom then
textIconGo:SetActive(true)
iconImage2.sprite = Util.LoadSprite(ExpeditionManager.NodeInfoIcon[layNodeData .type])
end
if isAllHaveAttack then
if layNodeData.state == ExpeditionNodeState.No then--关闭 状态
infoIcon:SetActive(false)
elseif layNodeData.state == ExpeditionNodeState.NoGetEquip then--未领圣物状态
warPowerGo:SetActive(false)
textIconGo:SetActive(true)
iconImage2.sprite = Util.LoadSprite(ExpeditionManager.NodeInfoIcon[ExpeditionNodeType.Halidom])
end
end
end
end
function ExpeditionMainPanel:SelfUpdataPanelShow()
isPlayerMove = false
self.mask:SetActive(isPlayerMove)
--Log("self.mask "..tostring(isPlayerMove))
self.UI_effect_BaoXiang.transform:SetParent(self.transform)
self.UI_effect_BaoXiang:SetActive(false)
local AllLayNodeList = ExpeditionManager.GetAllLayNodeList()
if AllLayNodeList == nil then return end
local curAllLayNodeList = {}
for i = #AllLayNodeList, 1, -1 do
table.insert(curAllLayNodeList,AllLayNodeList[i])
end
GetCurNodeInfo = ExpeditionManager.GetCurNodeInfo()
isAllHaveAttack = false
local curNodeGo
--nodeGoTable data = layNodeListData,goData = go
for i, v in pairs(nodeGoTable) do
if v.data[1].lay == GetCurNodeInfo.lay then
curNodeGo = v.goData
--Log("v.goData "..v.goData.name)
end
end
if curNodeGo then
self:SingleNodeShow(curNodeGo,curAllLayNodeList[15 - GetCurNodeInfo.lay + 1],GetCurNodeInfo.lay)
self:StarPlayerMoveFun()
end
end
return ExpeditionMainPanel