2020-08-25 15:46:38 +08:00
require ( " Base/BasePanel " ) --(24暂时关闭)prefab中的天宫秘宝入口被关闭, 记得开启, 按钮底下还有个底儿
2020-05-09 13:31:21 +08:00
ExpeditionMainPanel = Inherit ( BasePanel )
2020-05-25 19:16:23 +08:00
local this = ExpeditionMainPanel
2020-05-09 13:31:21 +08:00
local nodeGrid = { }
local nodeItemGrid = { }
local timer = Timer.New ( )
2021-03-27 20:01:39 +08:00
-- local npc
2020-05-09 13:31:21 +08:00
local GetCurNodeInfo = { } --当前操作层数据
2021-03-27 20:01:39 +08:00
-- local SkeletonGraphic--动画组件
2020-05-09 13:31:21 +08:00
local isPlayerMove = false --是否在播放人物行走动画
local isAllHaveAttack = false --是否有状态不一致情况 说明不是失败过 就是未领取圣物状态
local nodeGoTable = { }
local timer2 = Timer.New ( )
2020-05-25 19:16:23 +08:00
local liveNodeList = { }
local targetPosGoAndData
2020-06-18 20:39:29 +08:00
local UI_effect_ExpeditionReward = nil
local curexpeditionNodeConfigIcon = nil
2020-06-03 19:09:01 +08:00
local expeditionLeveTable = {
2021-03-02 16:53:12 +08:00
[ - 1 ] = { numStr = Language [ 10002 ] , nodDi1 = " d_danaotiangong_taizi_01 " , nodDi2 = " d_danaotiangong_xuanzhongguang_01 " } ,
[ 1 ] = { numStr = Language [ 10001 ] , nodDi1 = " d_danaotiangong_taizi_01 " , nodDi2 = " d_danaotiangong_xuanzhongguang_01 " } ,
[ 2 ] = { numStr = Language [ 10002 ] , nodDi1 = " d_danaotiangong_taizi_01 " , nodDi2 = " d_danaotiangong_xuanzhongguang_01 " } ,
[ 3 ] = { numStr = Language [ 10003 ] , nodDi1 = " d_danaotiangong_taizi_01 " , nodDi2 = " d_danaotiangong_xuanzhongguang_01 " } ,
[ 4 ] = { numStr = Language [ 10003 ] , nodDi1 = " d_danaotiangong_taizi_02 " , nodDi2 = " d_danaotiangong_xuanzhongguang_02 " } ,
2020-05-25 19:16:23 +08:00
}
2020-06-03 19:09:01 +08:00
local layListGrid = { }
local cursortingOrder = 0
2020-06-18 20:39:29 +08:00
local cursortingOrder2 = 0
2020-06-13 11:47:13 +08:00
local expeditionNodeConfig = ConfigManager.GetConfig ( ConfigName.ExpeditionNodeConfig )
2020-06-18 20:39:29 +08:00
local AllLayNodeList = { }
local shotTiemeLevel = { } --临时层级
2020-05-09 13:31:21 +08:00
--初始化组件(用于子类重写)
function ExpeditionMainPanel : InitComponent ( )
2020-06-03 19:09:01 +08:00
cursortingOrder = 0
self.parent = Util.GetGameObject ( self.gameObject , " parent " )
self.gridMask = Util.GetGameObject ( self.gameObject , " rect/grid/mask " )
self.gridMaskImage = Util.GetGameObject ( self.gameObject , " rect/grid/mask/Image " ) : GetComponent ( " RectTransform " )
self.bg1 = Util.GetGameObject ( self.gameObject , " bg/bg (1) " )
self.bg2 = Util.GetGameObject ( self.gameObject , " bg/bg (2) " )
2020-09-02 18:27:03 +08:00
self.backBtn = Util.GetGameObject ( self.gameObject , " btnBackParent/btnBack " )
2020-06-03 19:09:01 +08:00
self.Btn1 = Util.GetGameObject ( self.parent , " lowGO/Btn1 " )
self.Btn2 = Util.GetGameObject ( self.parent , " lowGO/Btn2 " )
self.Btn3 = Util.GetGameObject ( self.parent , " lowGO/Btn3 " )
self.Btn4 = Util.GetGameObject ( self.parent , " upLeftGo/Btn4 " )
2020-06-18 20:39:29 +08:00
self.Btn5 = Util.GetGameObject ( self.parent , " lowGO/Btn5 " )
2021-01-28 11:42:05 +08:00
self.helpBtn = Util.GetGameObject ( self.parent , " helpBtn " )
2020-06-03 19:09:01 +08:00
self.redPoint = Util.GetGameObject ( self.parent , " upLeftGo/Btn4/redPoint " )
2021-01-28 11:42:05 +08:00
self.helpPos = Util.GetGameObject ( self.parent , " helpBtn " ) : GetComponent ( " RectTransform " ) . localPosition
2020-06-03 19:09:01 +08:00
self.titleImageText = Util.GetGameObject ( self.parent , " titleImage/titleImage (1) " ) : GetComponent ( " Text " )
self.timeTextGo = Util.GetGameObject ( self.parent , " titleImage/timeText " )
self.timeText = Util.GetGameObject ( self.parent , " titleImage/timeText " ) : GetComponent ( " Text " )
2020-05-09 13:31:21 +08:00
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
2020-06-23 18:36:24 +08:00
--self.mask = Util.GetGameObject(self.parent, "mask")
--self.mask:SetActive(false)
2021-03-27 20:01:39 +08:00
-- 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.26 or Vector3.one * 0.16
-- self.liveNode = poolManager:LoadLive(npc, Util.GetTransform(self.parent, "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
if self.liveNode then
self.liveNode : OnClose ( )
2020-05-09 13:31:21 +08:00
end
2021-03-27 20:01:39 +08:00
self.liveNode = PlayerLiveView : New ( Util.GetTransform ( self.parent , " playerLive " ) , 1 )
2021-03-30 10:28:03 +08:00
self.liveNode : OnOpen ( GetPlayerRoleSingleConFig ( ) . Scale10 , nil , WALK_DIR.IDLE_FRONT )
2021-03-27 20:01:39 +08:00
2020-05-09 13:31:21 +08:00
self.singlePre = Util.GetGameObject ( self.transform , " singlePre " )
2020-06-03 19:09:01 +08:00
self.grid = Util.GetGameObject ( self.transform , " rect/grid " )
2020-06-18 20:39:29 +08:00
self.Holy = Util.GetGameObject ( self.gameObject , " bg/Holy " )
self.UI_Effect_ChuanSongMen = Util.GetGameObject ( self.gameObject , " bg/UI_Effect_ChuanSongMen " )
self.UI_Effect_ChuanSongMen_LanSe = Util.GetGameObject ( self.gameObject , " bg/UI_Effect_ChuanSongMen/UI_Effect_ChuanSongMen_LanSe " )
self.UI_Effect_ChuanSongMen_JinSe = Util.GetGameObject ( self.gameObject , " bg/UI_Effect_ChuanSongMen/UI_Effect_ChuanSongMen_JinSe " )
self.UI_Effect_ChuanSongMen_LanSeBtn = Util.GetGameObject ( self.gameObject , " bg/UI_Effect_ChuanSongMen/UI_Effect_ChuanSongMen_LanSe/click " )
self.UI_Effect_ChuanSongMen_JinSeBtn = Util.GetGameObject ( self.gameObject , " bg/UI_Effect_ChuanSongMen/UI_Effect_ChuanSongMen_JinSe/click " )
2020-05-09 13:31:21 +08:00
end
--绑定事件(用于子类重写)
function ExpeditionMainPanel : BindEvent ( )
Util.AddClick ( self.backBtn , function ( )
if isPlayerMove == false then
2020-06-30 18:59:44 +08:00
ExpeditionManager.SetExpeditionPanelIsOpen ( 0 )
2020-06-28 17:52:29 +08:00
--LogRed("ExpeditionManager.ExpeditionPanelIsOpen "..ExpeditionManager.ExpeditionPanelIsOpen)
2020-05-09 13:31:21 +08:00
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 )
2020-05-25 19:16:23 +08:00
Util.AddClick ( self.Btn4 , function ( )
2020-06-28 17:52:29 +08:00
if isPlayerMove == false then
UIManager.OpenPanel ( UIName.TreasureOfHeavenPanel )
end
2020-06-18 20:39:29 +08:00
end )
Util.AddClick ( self.Btn5 , function ( )
2020-06-28 17:52:29 +08:00
if isPlayerMove == false then
JumpManager.GoJump ( 20005 )
end
2020-05-09 13:31:21 +08:00
end )
Util.AddClick ( self.helpBtn , function ( )
UIManager.OpenPanel ( UIName.HelpPopup , HELP_TYPE.Expedition , self.helpPos . x , self.helpPos . y )
end )
2020-06-18 20:39:29 +08:00
Util.AddClick ( self.UI_Effect_ChuanSongMen_LanSeBtn , function ( )
2020-06-28 17:52:29 +08:00
--LogGreen("UI_Effect_ChuanSongMen_LanSeBtn "..#shotTiemeLevel)
2020-06-18 20:39:29 +08:00
if # shotTiemeLevel > 1 then
2021-03-02 16:53:12 +08:00
MsgPanel.ShowTwo ( Language [ 10543 ] , function ( )
2020-06-18 20:39:29 +08:00
end , function ( )
ExpeditionManager.expeditionLeve = shotTiemeLevel [ 1 ]
self : RefreshManagerData ( )
end )
else
ExpeditionManager.expeditionLeve = shotTiemeLevel [ 1 ]
self : RefreshManagerData ( )
end
2020-06-28 17:52:29 +08:00
--LogGreen("ExpeditionManager.expeditionLeve "..ExpeditionManager.expeditionLeve)
2020-06-18 20:39:29 +08:00
end )
Util.AddClick ( self.UI_Effect_ChuanSongMen_JinSeBtn , function ( )
2020-06-28 17:52:29 +08:00
--LogGreen("UI_Effect_ChuanSongMen_JinSeBtn "..#shotTiemeLevel)
2020-06-18 20:39:29 +08:00
if # shotTiemeLevel > 1 then
2021-03-02 16:53:12 +08:00
MsgPanel.ShowTwo ( Language [ 10544 ] , function ( )
2020-06-18 20:39:29 +08:00
end , function ( )
ExpeditionManager.expeditionLeve = shotTiemeLevel [ 2 ]
self : RefreshManagerData ( )
end )
else
ExpeditionManager.expeditionLeve = shotTiemeLevel [ 1 ]
self : RefreshManagerData ( )
end
2020-06-28 17:52:29 +08:00
--LogGreen("ExpeditionManager.expeditionLeve "..ExpeditionManager.expeditionLeve)
2020-06-18 20:39:29 +08:00
end )
2020-06-03 19:09:01 +08:00
BindRedPointObject ( RedPointType.Expedition_Treasure , self.redPoint )
2020-05-09 13:31:21 +08:00
end
--添加事件监听(用于子类重写)
function ExpeditionMainPanel : AddListener ( )
2020-05-25 19:16:23 +08:00
Game.GlobalEvent : AddEvent ( GameEvent.Expedition . RefreshPlayAniMainPanel , self.PlayerMoveFun , self )
Game.GlobalEvent : AddEvent ( GameEvent.Expedition . RefreshMainPanel , self.OnShowNodeData , self )
2020-05-09 13:31:21 +08:00
end
--移除事件监听(用于子类重写)
function ExpeditionMainPanel : RemoveListener ( )
2020-05-25 19:16:23 +08:00
Game.GlobalEvent : RemoveEvent ( GameEvent.Expedition . RefreshPlayAniMainPanel , self.PlayerMoveFun , self )
Game.GlobalEvent : RemoveEvent ( GameEvent.Expedition . RefreshMainPanel , self.OnShowNodeData , self )
2020-05-09 13:31:21 +08:00
end
2020-05-25 19:16:23 +08:00
--界面打开时调用(用于子类重写)
function ExpeditionMainPanel : OnOpen ( )
2020-06-30 18:59:44 +08:00
ExpeditionManager.SetExpeditionPanelIsOpen ( 1 )
2020-06-28 17:52:29 +08:00
--LogRed("ExpeditionManager.ExpeditionPanelIsOpen "..ExpeditionManager.ExpeditionPanelIsOpen)
if ExpeditionManager.ExpeditionState == 3 then
2020-06-30 18:59:44 +08:00
ExpeditionManager.SetExpeditionState ( 1 )
2020-06-28 17:52:29 +08:00
end
2020-06-18 20:39:29 +08:00
self : OnShowNodeData ( true )
2020-05-25 19:16:23 +08:00
if ExpeditionManager.GetActivityStarOpenRedPoint ( ) then
PlayerPrefs.SetInt ( PlayerManager.uid .. " Expedition " , 1 )
end
2020-05-09 13:31:21 +08:00
end
2020-06-03 19:09:01 +08:00
function ExpeditionMainPanel : OnSortingOrderChange ( )
self.gridMask : GetComponent ( " Canvas " ) . sortingOrder = self.sortingOrder + 1
2020-06-30 18:59:44 +08:00
self.parent : GetComponent ( " Canvas " ) . sortingOrder = self.sortingOrder + 20
2020-09-02 18:27:03 +08:00
Util.GetGameObject ( self.gameObject , " btnBackParent " ) : GetComponent ( " Canvas " ) . sortingOrder = self.sortingOrder + 21
2020-06-18 20:39:29 +08:00
self.UI_Effect_ChuanSongMen_LanSeBtn : GetComponent ( " Canvas " ) . sortingOrder = self.sortingOrder + 10
self.UI_Effect_ChuanSongMen_JinSeBtn : GetComponent ( " Canvas " ) . sortingOrder = self.sortingOrder + 10
2020-06-30 18:59:44 +08:00
Util.AddParticleSortLayer ( self.UI_Effect_ChuanSongMen_LanSe , self.sortingOrder - cursortingOrder )
Util.AddParticleSortLayer ( self.UI_Effect_ChuanSongMen_JinSe , self.sortingOrder - cursortingOrder )
2020-06-18 20:39:29 +08:00
cursortingOrder = self.sortingOrder
2020-06-03 19:09:01 +08:00
end
2020-05-09 13:31:21 +08:00
--界面打开或者重新打开后,界面刷新时调用(用于子类重写)
2020-06-03 19:09:01 +08:00
function ExpeditionMainPanel : OnShow ( )
-- 音效
2020-07-01 09:40:20 +08:00
ExpeditionManager.SetExpeditionPanelIsOpen ( 1 )
2020-06-30 18:59:44 +08:00
ExpeditionManager.RefreshPanelShowByState ( ) --检测是否是间隔阶段
2020-06-28 17:52:29 +08:00
SoundManager.PlayMusic ( SoundConfig.BGM_Carbon )
2020-06-28 17:48:49 +08:00
local endTime = 0
2020-06-28 17:52:29 +08:00
endTime = ExpeditionManager.startTime + tonumber ( ConfigManager.GetConfigData ( ConfigName.GlobalSystemConfig , JumpType.Expedition ) . SeasonEnd ) - GetTimeStamp ( ) +
ConfigManager.GetConfigData ( ConfigName.GlobalSystemConfig , JumpType.Expedition ) . SeasonInterval * 60
2020-06-28 17:48:49 +08:00
self : RemainTimeDown ( self.timeTextGo , self.timeText , endTime )
2020-08-27 15:18:17 +08:00
self : IsTreasureOpen ( )
2020-06-03 19:09:01 +08:00
end
2020-08-27 15:18:17 +08:00
--大闹天宫入口是否开启
function ExpeditionMainPanel : IsTreasureOpen ( )
2020-08-27 22:10:08 +08:00
self.Btn4 : SetActive ( TreasureOfHeavenManger.resetTime ~= - 1 )
Util.GetGameObject ( self.parent , " upLeftGo/Image " ) : SetActive ( TreasureOfHeavenManger.resetTime ~= - 1 )
2020-08-27 15:18:17 +08:00
end
2020-05-09 13:31:21 +08:00
--实例化层数信息
2020-06-18 20:39:29 +08:00
function ExpeditionMainPanel : OnShowNodeData ( isMoveGrid )
2020-05-09 13:31:21 +08:00
isPlayerMove = false
2020-05-25 19:16:23 +08:00
isAllHaveAttack = false
nodeGoTable = { }
2021-03-02 16:53:12 +08:00
self.titleImageText . text = Language [ 10545 ] .. expeditionLeveTable [ ExpeditionManager.expeditionLeve ] . numStr .. Language [ 10269 ]
2020-06-03 19:09:01 +08:00
self.bg1 : SetActive ( ExpeditionManager.expeditionLeve ~= 4 )
self.bg2 : SetActive ( ExpeditionManager.expeditionLeve == 4 )
2020-05-25 19:16:23 +08:00
ExpeditionManager.ExpeditionRrefreshFormation ( ) --刷新编队
ExpeditionManager.GetActivityIsShowRedPoint ( false , " 1 " ) --刷新红点
2020-06-23 18:36:24 +08:00
--self.mask:SetActive(isPlayerMove)
2020-06-18 20:39:29 +08:00
self.UI_Effect_ChuanSongMen : SetActive ( false )
self.Holy . transform : SetParent ( self.transform )
self.Holy : SetActive ( false )
2020-05-25 19:16:23 +08:00
--节点
2020-06-18 20:39:29 +08:00
AllLayNodeList = ExpeditionManager.GetAllLayNodeList ( ) --所有层所有节点信息
2020-05-09 13:31:21 +08:00
if AllLayNodeList == nil then return end
local curAllLayNodeList = { }
2020-05-25 19:16:23 +08:00
for i = # AllLayNodeList , 1 , - 1 do --从下到上显示 所以倒序
2020-06-18 20:39:29 +08:00
table.insert ( curAllLayNodeList , AllLayNodeList [ i ] )
2020-05-09 13:31:21 +08:00
end
GetCurNodeInfo = ExpeditionManager.GetCurNodeInfo ( )
2020-06-28 17:48:49 +08:00
self.gridMaskImage . sizeDelta = Vector2.New ( 0 , ( 3000 /# curAllLayNodeList ) * ( # curAllLayNodeList - ( GetCurNodeInfo.lay + 1 ) ) )
2020-06-03 19:09:01 +08:00
for i = 1 , math.max ( # curAllLayNodeList , # layListGrid ) do
local go = layListGrid [ i ]
if not go then
go = newObject ( self.singlePre )
go.transform : SetParent ( self.grid . transform )
go.transform . localScale = Vector3.one
go.transform . localPosition = Vector3.zero
layListGrid [ i ] = go
end
go.gameObject : SetActive ( false )
2020-05-09 13:31:21 +08:00
end
2020-06-03 19:09:01 +08:00
for i = 1 , # AllLayNodeList do
ExpeditionMainPanel : SingleLayNodeShow ( layListGrid [ i ] , curAllLayNodeList [ i ] )
layListGrid [ i ] : SetActive ( true )
end
2020-06-18 20:39:29 +08:00
if isMoveGrid then
local gridH = 2746 --self.grid:GetComponent("RectTransform").sizeDelta.y
local rectH = 1656 --self.grid.transform.parent:GetComponent("RectTransform").sizeDelta.y
local endH = gridH - rectH
local curlay = GetCurNodeInfo.lay
if curlay <= 6 then
local y = endH / 6
y = endH - ( curlay - 1 ) * y
self.grid : GetComponent ( " RectTransform " ) . anchoredPosition = Vector3.New ( 0 , y , 0 )
end
2020-06-03 19:09:01 +08:00
end
--self.ScrollView:SetData(curAllLayNodeList, function (index, go)
-- self:SingleLayNodeShow(go,curAllLayNodeList[index],(#AllLayNodeList - index) + 1)
--end)
--LogError("#AllLayNodeList - GetCurNodeInfo.lay "..#AllLayNodeList - GetCurNodeInfo.lay)
--local curIndex = #AllLayNodeList - GetCurNodeInfo.lay
--if curIndex == 0 then
-- curIndex = curIndex + 1
--end
--self.ScrollView:SetIndex(curIndex)
2020-05-09 13:31:21 +08:00
end
--实例化每层信息
2020-06-03 19:09:01 +08:00
function ExpeditionMainPanel : SingleLayNodeShow ( go , layNodeListData )
2020-05-09 13:31:21 +08:00
nodeGoTable [ go.name ] = { data = layNodeListData , goData = go }
local nodeGo = go
--卸载加载的立绘
if liveNodeList [ go ] then
2020-09-22 11:39:05 +08:00
for key , value in pairs ( liveNodeList [ go ] ) do
if value then
poolManager : UnLoadLive ( value.name , value.go , PoolManager.AssetType . GameObject )
2020-06-13 11:47:13 +08:00
end
2020-05-09 13:31:21 +08:00
end
end
liveNodeList [ go ] = { }
2020-05-25 19:16:23 +08:00
--判断是否有未打赢过 和 未获取圣物的状态
local isAttack = false
for j = 1 , 3 do
Util.GetGameObject ( nodeGo , " itemList/item ( " .. j .. " ) " ) : SetActive ( false )
if # layNodeListData >= j then
if ( layNodeListData [ j ] . state == ExpeditionNodeState.NoPass or layNodeListData [ j ] . state == ExpeditionNodeState.NoGetEquip ) and GetCurNodeInfo.lay == layNodeListData [ j ] . lay then
isAttack = true
isAllHaveAttack = true
end
end
end
if self.liveNode then
2021-03-27 20:01:39 +08:00
self.liveNode . leader : SetActive ( true ) --玩家形象立绘
2020-05-25 19:16:23 +08:00
end
2020-06-18 20:39:29 +08:00
if layNodeListData [ 1 ] . lay == # AllLayNodeList then --最后奖励节点
Util.GetGameObject ( nodeGo , " itemList " ) : GetComponent ( " RectTransform " ) . anchoredPosition = Vector3.New ( 2 , 140 , 0 )
end
2020-05-09 13:31:21 +08:00
for i = 1 , # layNodeListData do --每个节点显示
2020-05-25 19:16:23 +08:00
Util.GetGameObject ( nodeGo , " itemList/item ( " .. i .. " ) " ) : SetActive ( true )
2020-06-23 18:36:24 +08:00
Util.GetGameObject ( nodeGo , " itemList/item ( " .. i .. " )/parent " ) : SetActive ( true )
2020-06-28 17:48:49 +08:00
Util.GetGameObject ( nodeGo , " itemList/item ( " .. i .. " )/parent/pedestalImage " ) : GetComponent ( " Image " ) : DOFade ( 1 , 0 ) : SetEase ( Ease.Linear )
Util.GetGameObject ( nodeGo , " itemList/item ( " .. i .. " )/parent/okAttackImage " ) : GetComponent ( " Image " ) : DOFade ( 1 , 0 ) : SetEase ( Ease.Linear )
2020-06-18 20:39:29 +08:00
Util.GetGameObject ( nodeGo , " itemList/item ( " .. i .. " )/parent " ) . transform.localPosition = Vector3.zero --Vector3.New(115.75,0,0)--91.65,
2020-05-25 19:16:23 +08:00
local curItemGo = Util.GetGameObject ( nodeGo , " itemList/item ( " .. i .. " )/parent " )
self : SingleNodeInfoIconShow ( curItemGo , layNodeListData [ i ] , isAttack )
2020-05-09 13:31:21 +08:00
---实例化动画---
2020-06-13 11:47:13 +08:00
local goImage = Util.GetGameObject ( curItemGo , " goParent/Image " )
2020-06-18 20:39:29 +08:00
goImage : SetActive ( false )
2020-06-13 11:47:13 +08:00
local curexpeditionNodeConfig = expeditionNodeConfig [ layNodeListData [ i ] . type ]
2020-06-28 17:52:29 +08:00
if GetCurNodeInfo.lay <= layNodeListData [ i ] . lay and layNodeListData [ i ] . lay ~= 1 and curexpeditionNodeConfig then
if curexpeditionNodeConfig.AniOrImage == 1 then
liveNodeList [ go ] [ i ] = self : InitLiveSet ( layNodeListData [ i ] . type , Util.GetGameObject ( curItemGo , " goParent " ) )
elseif curexpeditionNodeConfig.AniOrImage == 2 then
goImage : SetActive ( true )
goImage : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( curexpeditionNodeConfig.Icon )
goImage : GetComponent ( " Image " ) : SetNativeSize ( )
-- 设置图片大小位置
goImage : GetComponent ( " RectTransform " ) . anchoredPosition = Vector2.New ( curexpeditionNodeConfig.Position [ 1 ] , curexpeditionNodeConfig.Position [ 2 ] )
goImage.transform . localScale = Vector3.one * curexpeditionNodeConfig.Scale
elseif curexpeditionNodeConfig.AniOrImage == 3 then
local configData = ConfigManager.GetConfigData ( ConfigName.ExpeditionNodeConfig , ExpeditionNodeType.Reward )
if UI_effect_ExpeditionReward and curexpeditionNodeConfigIcon then
poolManager : UnLoadAsset ( curexpeditionNodeConfig.Icon , UI_effect_ExpeditionReward , PoolManager.AssetType . GameObject )
UI_effect_ExpeditionReward = nil
curexpeditionNodeConfigIcon = nil
2020-06-18 20:39:29 +08:00
end
2020-06-28 17:52:29 +08:00
UI_effect_ExpeditionReward = poolManager : LoadAsset ( curexpeditionNodeConfig.Icon , PoolManager.AssetType . GameObject )
curexpeditionNodeConfigIcon = curexpeditionNodeConfig.Icon
UI_effect_ExpeditionReward.transform : SetParent ( Util.GetGameObject ( curItemGo , " goParent " ) . transform )
UI_effect_ExpeditionReward.transform . localPosition = Vector3.New ( configData.Position [ 1 ] , configData.Position [ 2 ] , 0 )
UI_effect_ExpeditionReward.transform . localScale = Vector3.one * configData.Scale
Util.AddParticleSortLayer ( UI_effect_ExpeditionReward , self.sortingOrder - cursortingOrder2 + 10 )
UI_effect_ExpeditionReward : SetActive ( true )
cursortingOrder2 = self.sortingOrder
self.UI_Effect_ChuanSongMen . transform : SetParent ( Util.GetGameObject ( curItemGo , " goParent " ) . transform )
self.UI_Effect_ChuanSongMen . transform.localPosition = Vector3.New ( 0 , - 80 , 0 )
self.UI_Effect_ChuanSongMen . transform.localScale = Vector3.one
2020-06-13 11:47:13 +08:00
end
2020-06-28 17:52:29 +08:00
end
2020-05-09 13:31:21 +08:00
--------------
2020-05-25 19:16:23 +08:00
Util.GetGameObject ( curItemGo , " infoIcon " ) : SetActive ( true )
2020-06-03 19:09:01 +08:00
local pedestalImage = Util.GetGameObject ( curItemGo , " pedestalImage " )
local goParent = Util.GetGameObject ( curItemGo , " goParent " )
local halidomParent = Util.GetGameObject ( curItemGo , " halidomParent " )
pedestalImage : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( expeditionLeveTable [ ExpeditionManager.expeditionLeve ] . nodDi1 )
local okAttackDi = Util.GetGameObject ( curItemGo , " okAttackDi " )
okAttackDi : GetComponent ( " Image " ) . sprite = Util.LoadSprite ( expeditionLeveTable [ ExpeditionManager.expeditionLeve ] . nodDi2 )
local okAttackImage = Util.GetGameObject ( curItemGo , " okAttackImage " )
2020-06-19 20:19:35 +08:00
okAttackImage : SetActive ( ( layNodeListData [ i ] . state == ExpeditionNodeState.NoPass or layNodeListData [ i ] . state == ExpeditionNodeState.NoGetEquip ) and layNodeListData [ i ] . type ~= ExpeditionNodeType.Reward )
2020-06-03 19:09:01 +08:00
okAttackDi : SetActive ( layNodeListData [ i ] . state == ExpeditionNodeState.NoPass or layNodeListData [ i ] . state == ExpeditionNodeState.NoGetEquip )
2020-05-09 13:31:21 +08:00
Util.GetGameObject ( curItemGo , " click " ) : SetActive ( true )
2020-06-03 19:09:01 +08:00
local clickbtn = Util.GetGameObject ( curItemGo , " click " )
2020-05-09 13:31:21 +08:00
local pos = Util.GetGameObject ( curItemGo , " pos " ) --节点位置 人物动画用
2020-06-03 19:09:01 +08:00
--pos.transform.localPosition = Vector3.New(0,-10,0)
pedestalImage : SetActive ( true )
goParent : SetActive ( true )
halidomParent : SetActive ( true )
clickbtn : SetActive ( true )
2020-05-25 19:16:23 +08:00
if layNodeListData [ i ] . lay < GetCurNodeInfo.lay then
2020-06-03 19:09:01 +08:00
goParent : SetActive ( false )
halidomParent : SetActive ( false )
okAttackImage : SetActive ( false )
okAttackDi : SetActive ( false )
2020-05-25 19:16:23 +08:00
Util.GetGameObject ( curItemGo , " click " ) : SetActive ( false )
Util.GetGameObject ( curItemGo , " infoIcon " ) : SetActive ( false )
2020-06-18 20:39:29 +08:00
if layNodeListData [ i ] . state == ExpeditionNodeState.Over then --未打但已通过
pedestalImage : SetActive ( false )
2020-05-25 19:16:23 +08:00
end
elseif layNodeListData [ i ] . lay == GetCurNodeInfo.lay then
if layNodeListData [ i ] . state == ExpeditionNodeState.No then --未打过
elseif layNodeListData [ i ] . state == ExpeditionNodeState.NoPass then --打未通过
elseif layNodeListData [ i ] . state == ExpeditionNodeState.NoGetEquip then --未领取圣物
elseif layNodeListData [ i ] . state == ExpeditionNodeState.Finish then --已打过
self : PlayerMovePosFun ( pos , nodeGo , curItemGo )
2020-06-03 19:09:01 +08:00
goParent : SetActive ( false )
2020-05-25 19:16:23 +08:00
elseif layNodeListData [ i ] . state == ExpeditionNodeState.Over then --未打但已通过
2020-06-03 19:09:01 +08:00
goParent : SetActive ( false )
halidomParent : SetActive ( false )
okAttackImage : SetActive ( false )
okAttackDi : SetActive ( false )
2020-05-09 13:31:21 +08:00
Util.GetGameObject ( curItemGo , " click " ) : SetActive ( false )
2020-06-03 19:09:01 +08:00
pedestalImage : SetActive ( false )
2020-05-25 19:16:23 +08:00
Util.GetGameObject ( curItemGo , " infoIcon " ) : SetActive ( false )
end
elseif layNodeListData [ i ] . lay > GetCurNodeInfo.lay then
2020-06-03 19:09:01 +08:00
if layNodeListData [ i ] . state == ExpeditionNodeState.No then --打未通过
if layNodeListData [ i ] . lay >= GetCurNodeInfo.lay + 3 then
if layNodeListData [ i ] . type == ExpeditionNodeType.Jy or layNodeListData [ i ] . type == ExpeditionNodeType.Common then
goParent : SetActive ( false )
clickbtn : SetActive ( false )
end
end
elseif layNodeListData [ i ] . state == ExpeditionNodeState.NoPass then --打未通过
2020-05-25 19:16:23 +08:00
elseif layNodeListData [ i ] . state == ExpeditionNodeState.NoGetEquip then --未领取圣物
2020-06-18 20:39:29 +08:00
if layNodeListData [ i ] . type == ExpeditionNodeType.Reward then
if UI_effect_ExpeditionReward then
UI_effect_ExpeditionReward : SetActive ( false )
end
if ExpeditionManager.expeditionLeve == - 1 then
shotTiemeLevel = { 3 , 4 }
self.UI_Effect_ChuanSongMen : SetActive ( true )
self.UI_Effect_ChuanSongMen_LanSe : SetActive ( true )
self.UI_Effect_ChuanSongMen_JinSe : SetActive ( true )
else
shotTiemeLevel = { ExpeditionManager.expeditionLeve + 1 }
self.UI_Effect_ChuanSongMen : SetActive ( true )
self.UI_Effect_ChuanSongMen_LanSe : SetActive ( true )
self.UI_Effect_ChuanSongMen_JinSe : SetActive ( false )
end
else
goParent : SetActive ( false )
self.Holy . transform : SetParent ( halidomParent.transform )
local configData = ConfigManager.GetConfigData ( ConfigName.ExpeditionNodeConfig , ExpeditionNodeType.Halidom )
self.Holy . transform.localPosition = Vector3.New ( configData.Position [ 1 ] , configData.Position [ 2 ] , 0 )
self.Holy . transform.localScale = Vector3.one * configData.Scale
self.Holy : SetActive ( true )
end
2020-05-25 19:16:23 +08:00
elseif layNodeListData [ i ] . state == ExpeditionNodeState.Over then --未打但已通过
2020-06-03 19:09:01 +08:00
pedestalImage : SetActive ( false )
2020-06-18 20:39:29 +08:00
end
2020-05-09 13:31:21 +08:00
end
Util.AddOnceClick ( clickbtn , function ( )
2020-06-18 20:39:29 +08:00
if isPlayerMove then return end
ExpeditionManager.curAttackNodeInfo = layNodeListData [ i ]
2020-06-19 20:19:35 +08:00
--当前操作的节点对象
2020-06-18 20:39:29 +08:00
targetPosGoAndData = { pos = pos , layGo = nodeGo , layAllData = layNodeListData , curNodeData = layNodeListData [ i ] }
if layNodeListData [ i ] . state == ExpeditionNodeState.No then
if layNodeListData [ i ] . type == ExpeditionNodeType.Boss or layNodeListData [ i ] . type == ExpeditionNodeType.Jy or layNodeListData [ i ] . type == ExpeditionNodeType.Common then
UIManager.OpenPanel ( UIName.ExpeditionMonsterInfoPopup , EXPEDITON_POPUP_TYPE.Monster , layNodeListData [ i ] , 1 )
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Reply or layNodeListData [ i ] . type == ExpeditionNodeType.Resurgence then --回复节点 复活节点
UIManager.OpenPanel ( UIName.GeneralPopup , GENERAL_POPUP_TYPE.ExpeditionReply , layNodeListData [ i ] . type , layNodeListData [ i ] . state )
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Recruit then --招募节点
UIManager.OpenPanel ( UIName.ExpeditionMonsterInfoPopup , EXPEDITON_POPUP_TYPE.Recruit , layNodeListData [ i ] , 1 )
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Shop then --商店节点
UIManager.OpenPanel ( UIName.ExpeditionMonsterInfoPopup , EXPEDITON_POPUP_TYPE.Shop , layNodeListData [ i ] , 1 )
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Trail then --试炼节点
UIManager.OpenPanel ( UIName.ExpeditionMonsterInfoPopup , EXPEDITON_POPUP_TYPE.Trail , layNodeListData [ i ] , 1 )
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Greed then --贪婪节点
UIManager.OpenPanel ( UIName.ExpeditionMonsterInfoPopup , EXPEDITON_POPUP_TYPE.Greed , layNodeListData [ i ] , 1 )
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Reward then --最后奖励节点
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip ( Language [ 10546 ] )
2020-06-18 20:39:29 +08:00
end
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
UIManager.OpenPanel ( UIName.ExpeditionMonsterInfoPopup , EXPEDITON_POPUP_TYPE.Monster , layNodeListData [ i ] , 2 )
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Halidom then --圣物节点
UIManager.OpenPanel ( UIName.ExpeditionSelectHalidomPanel , false )
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Reply then --回复节点
UIManager.OpenPanel ( UIName.GeneralPopup , GENERAL_POPUP_TYPE.ExpeditionReply , layNodeListData [ i ] . type , layNodeListData [ i ] . state ,
function ( )
NetManager.ReCoverExpeditionHeroRequest ( layNodeListData [ i ] . sortId , function ( msg )
ExpeditionManager.UpdateHeroHpValue ( msg.heroInfo )
self : PlayerMoveFun ( )
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip ( Language [ 10547 ] )
2020-06-18 20:39:29 +08:00
end )
2020-05-25 19:16:23 +08:00
end )
2020-06-18 20:39:29 +08:00
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Resurgence then --复活节点
UIManager.OpenPanel ( UIName.GeneralPopup , GENERAL_POPUP_TYPE.ExpeditionReply , layNodeListData [ i ] . type , layNodeListData [ i ] . state ,
function ( )
local cueSelectHeroDid = self : HeroResurgence ( )
2020-06-30 18:59:44 +08:00
local GetHerosHaveIsDie = ExpeditionManager.GetHerosHaveIsDie ( )
2020-06-18 20:39:29 +08:00
NetManager.ReliveExpeditionHeroRequest ( cueSelectHeroDid , layNodeListData [ i ] . sortId , function ( )
2020-06-30 18:59:44 +08:00
if GetHerosHaveIsDie then
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip ( Language [ 10548 ] )
2020-06-30 18:59:44 +08:00
else
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip ( Language [ 10549 ] )
2020-06-30 18:59:44 +08:00
end
2020-06-18 20:39:29 +08:00
self : PlayerMoveFun ( )
end )
2020-05-25 19:16:23 +08:00
end )
2020-06-18 20:39:29 +08:00
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Recruit then --招募节点
UIManager.OpenPanel ( UIName.ExpeditionMonsterInfoPopup , EXPEDITON_POPUP_TYPE.Recruit , layNodeListData [ i ] , 2 , function ( )
self : PlayerMoveFun ( )
end )
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Shop then --商店节点
UIManager.OpenPanel ( UIName.ExpeditionMonsterInfoPopup , EXPEDITON_POPUP_TYPE.Shop , layNodeListData [ i ] , 2 , function ( )
self : PlayerMoveFun ( )
end )
2020-05-25 19:16:23 +08:00
2020-06-18 20:39:29 +08:00
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Trail then --试炼节点
UIManager.OpenPanel ( UIName.ExpeditionMonsterInfoPopup , EXPEDITON_POPUP_TYPE.Trail , layNodeListData [ i ] , 2 )
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Greed then --贪婪节点
UIManager.OpenPanel ( UIName.ExpeditionMonsterInfoPopup , EXPEDITON_POPUP_TYPE.Greed , layNodeListData [ i ] , 2 )
elseif layNodeListData [ i ] . type == ExpeditionNodeType.Reward then --最后奖励节点
NetManager.TakeExpeditionBoxRewardRequest ( layNodeListData [ i ] . sortId , function ( msg )
2020-07-23 13:55:12 +08:00
--加积分
NetManager.TreasureOfHeavenScoreRequest ( )
2020-06-18 20:39:29 +08:00
local compShowType = nil
if # msg.leve < 1 then
compShowType = 5
end
UIManager.OpenPanel ( UIName.RewardItemPopup , msg.drop , 1 , function ( )
if UI_effect_ExpeditionReward then
UI_effect_ExpeditionReward : SetActive ( false )
end
shotTiemeLevel = msg.leve
if # msg.leve > 1 then
2020-06-30 18:59:44 +08:00
ExpeditionManager.RefreshCurExpeditionLeve ( - 1 )
2020-06-18 20:39:29 +08:00
self.UI_Effect_ChuanSongMen : SetActive ( true )
self.UI_Effect_ChuanSongMen_LanSe : SetActive ( true )
self.UI_Effect_ChuanSongMen_JinSe : SetActive ( true )
elseif # msg.leve == 1 then
2020-06-23 18:36:24 +08:00
--LogGreen("msg.leve[1] "..msg.leve[1])
2020-06-28 17:52:29 +08:00
self.UI_Effect_ChuanSongMen : SetActive ( true )
self.UI_Effect_ChuanSongMen_LanSe : SetActive ( true )
self.UI_Effect_ChuanSongMen_JinSe : SetActive ( false )
2020-06-18 20:39:29 +08:00
else
--PopupTipPanel.ShowTip("已通关本次大闹天宫!")
self : PlayerMoveFun ( )
end
end , compShowType )
end )
end
elseif layNodeListData [ i ] . state == ExpeditionNodeState.NoGetEquip then
if layNodeListData [ i ] . type ~= ExpeditionNodeType.Reward then
2020-05-25 19:16:23 +08:00
UIManager.OpenPanel ( UIName.ExpeditionSelectHalidomPanel , false )
2020-05-09 13:31:21 +08:00
end
2020-06-18 20:39:29 +08:00
elseif layNodeListData [ i ] . state == ExpeditionNodeState.Finish then
--PopupTipPanel.ShowTip("已完成!")
elseif layNodeListData [ i ] . state == ExpeditionNodeState.Over then
2021-03-02 16:53:12 +08:00
PopupTipPanel.ShowTip ( Language [ 10550 ] )
2020-06-18 20:39:29 +08:00
end
end )
end
2020-05-09 13:31:21 +08:00
end
--刷新倒计时显示
function ExpeditionMainPanel : RemainTimeDown ( _timeTextExpertgo , _timeTextExpert , timeDown )
2020-12-03 04:55:51 +08:00
timeDown = timeDown - ( ConfigManager.GetConfigData ( ConfigName.GlobalSystemConfig , FUNCTION_OPEN_TYPE.EXPEDITION ) . SeasonInterval * 60 )
2020-05-09 13:31:21 +08:00
if timeDown > 0 then
_timeTextExpertgo : SetActive ( true )
2021-03-02 16:53:12 +08:00
_timeTextExpert.text = Language [ 10023 ] .. self : TimeStampToDateString ( timeDown )
2020-05-09 13:31:21 +08:00
if timer then
timer : Stop ( )
timer = nil
end
timer = Timer.New ( function ( )
2021-03-02 16:53:12 +08:00
_timeTextExpert.text = Language [ 10023 ] .. self : TimeStampToDateString ( timeDown )
2020-05-09 13:31:21 +08:00
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 )
2020-06-28 17:52:29 +08:00
--local day = math.floor(second / (24 * 3600))
2020-05-09 13:31:21 +08:00
local minute = math.floor ( second / 60 ) % 60
local sec = second % 60
2020-06-28 17:52:29 +08:00
local hour = math.floor ( math.floor ( second - sec - minute * 60 ) / 3600 )
2021-03-02 16:53:12 +08:00
return string.format ( Language [ 10551 ] , hour , minute , sec )
2020-05-09 13:31:21 +08:00
end
--界面关闭时调用(用于子类重写)
function ExpeditionMainPanel : OnClose ( )
2020-06-28 17:52:29 +08:00
self.timeText . text = " "
2020-05-09 13:31:21 +08:00
if timer then
timer : Stop ( )
timer = nil
end
if timer2 then
timer2 : Stop ( )
timer2 = nil
end
end
--界面销毁时调用(用于子类重写)
function ExpeditionMainPanel : OnDestroy ( )
2021-03-30 14:13:16 +08:00
if self.liveNode then
self.liveNode : OnClose ( )
end
2020-05-09 13:31:21 +08:00
--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 = {}
2021-03-27 20:01:39 +08:00
-- if self.liveNode then
-- poolManager:UnLoadLive(npc, self.liveNode, PoolManager.AssetType.GameObject)
-- self.liveNode = nil
-- end
2020-06-03 19:09:01 +08:00
layListGrid = { }
2020-06-18 20:39:29 +08:00
if UI_effect_ExpeditionReward and curexpeditionNodeConfigIcon then
poolManager : UnLoadAsset ( curexpeditionNodeConfigIcon , UI_effect_ExpeditionReward , PoolManager.AssetType . GameObject )
UI_effect_ExpeditionReward = nil
curexpeditionNodeConfigIcon = nil
end
2020-06-03 19:09:01 +08:00
ClearRedPointObject ( RedPointType.Expedition_Treasure )
2020-05-09 13:31:21 +08:00
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)
2020-06-13 11:47:13 +08:00
--local skeleton = live2d:GetComponent("SkeletonGraphic")
--if skeleton and iconId == 2 then--首领
-- skeleton.AnimationState:SetAnimation(0, "idle2", true)
--end
2020-05-09 13:31:21 +08:00
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 : PlayerMovePosFun ( nodeGo , curItemGo )
2021-03-27 20:01:39 +08:00
self.liveNode . leader.transform : SetParent ( nodeGo.transform )
self.liveNode . leader.transform . localPosition = Vector3.zero
-- SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
self.liveNode : SetWalkDir ( WALK_DIR.IDLE_FRONT )
2020-05-09 13:31:21 +08:00
end
function ExpeditionMainPanel : SingleNodeInfoIconShow ( nodeGo , layNodeData )
local infoIcon = Util.GetGameObject ( nodeGo , " infoIcon " )
local warPowerGo = Util.GetGameObject ( infoIcon , " warPowerGo " )
2020-06-13 11:47:13 +08:00
--local iconImage = Util.GetGameObject(warPowerGo, "iconImage"):GetComponent("Image")
2020-05-09 13:31:21 +08:00
local powerText = Util.GetGameObject ( warPowerGo , " powerText " ) : GetComponent ( " Text " )
local textIconGo = Util.GetGameObject ( infoIcon , " textIconGo " )
2020-06-13 11:47:13 +08:00
--local iconImage2 = Util.GetGameObject(textIconGo, "iconImage"):GetComponent("Image")
infoIcon : SetActive ( false )
warPowerGo : SetActive ( false )
2020-05-09 13:31:21 +08:00
textIconGo : SetActive ( false )
2020-06-18 20:39:29 +08:00
if layNodeData.lay < GetCurNodeInfo.lay + 3 and layNodeData.lay > GetCurNodeInfo.lay and ( layNodeData.state == ExpeditionNodeState.No or layNodeData.state == ExpeditionNodeState.NoPass ) then
2020-06-13 11:47:13 +08:00
if layNodeData.type == ExpeditionNodeType.Jy or layNodeData.type == ExpeditionNodeType.Common then
warPowerGo : SetActive ( true )
2020-05-09 13:31:21 +08:00
powerText.text = layNodeData.bossTeaminfo . totalForce
end
end
2020-06-18 20:39:29 +08:00
if layNodeData.type == ExpeditionNodeType.Boss and ( layNodeData.state == ExpeditionNodeState.No or layNodeData.state == ExpeditionNodeState.NoPass ) then
2020-06-13 11:47:13 +08:00
warPowerGo : SetActive ( true )
powerText.text = layNodeData.bossTeaminfo . totalForce
end
--if GetCurNodeInfo.lay == layNodeData.lay then--当前层
-- if layNodeData.type == ExpeditionNodeType.Jy or layNodeData.type == ExpeditionNodeType.Boss or layNodeData.type == ExpeditionNodeType.Common then
-- warPowerGo:SetActive(false)
-- --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
-- --iconImage2.sprite = Util.LoadSprite(ExpeditionManager.NodeInfoIcon[layNodeData .type])
-- end
-- if isAllHaveAttack then
-- if layNodeData.state == ExpeditionNodeState.No then--关闭 状态
-- elseif layNodeData.state == ExpeditionNodeState.NoGetEquip then--未领圣物状态
-- --iconImage2.sprite = Util.LoadSprite(ExpeditionManager.NodeInfoIcon[ExpeditionNodeType.Halidom])
-- end
-- end
--end
2020-05-09 13:31:21 +08:00
end
2020-05-25 19:16:23 +08:00
function ExpeditionMainPanel : PlayerMoveFun ( )
2020-06-23 18:36:24 +08:00
isPlayerMove = true
2020-05-25 19:16:23 +08:00
if not targetPosGoAndData.pos then return end
targetPosGoAndData.pos : SetActive ( true )
2021-03-27 20:01:39 +08:00
self.liveNode . leader.transform : SetParent ( targetPosGoAndData.pos . transform )
local oldPos = self.liveNode . leader.transform . localPosition
2020-06-03 19:09:01 +08:00
local targetPos = targetPosGoAndData.pos . transform.localPosition - Vector3.New ( 0 , 69 , 0 )
2020-05-25 19:16:23 +08:00
if oldPos.x - targetPos.x > 0 then
2021-03-27 20:01:39 +08:00
-- SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, 180, 0)
self.liveNode : SetWalkDir ( WALK_DIR.RUN_LEFT )
2020-05-25 19:16:23 +08:00
else
2021-03-27 20:01:39 +08:00
-- SkeletonGraphic.transform.localEulerAngles = Vector3.New(0, 0, 0)
self.liveNode : SetWalkDir ( WALK_DIR.RUN_RIGHT )
2020-05-25 19:16:23 +08:00
end
2020-06-23 18:36:24 +08:00
--self.mask:SetActive(isPlayerMove)
2021-03-27 20:01:39 +08:00
-- SkeletonGraphic.AnimationState:SetAnimation(0, "move2", true)
2020-05-25 19:16:23 +08:00
local timeNum = math.abs ( oldPos.y - targetPos.y ) / 350 --350/1s
2020-06-19 20:19:35 +08:00
--玩家行走
2021-03-27 20:01:39 +08:00
self.liveNode . leader.transform : DOLocalMove ( targetPos , timeNum , false ) : OnStart ( function ( )
2020-05-25 19:16:23 +08:00
end ) : OnComplete ( function ( )
--Log("行走完毕")
2021-03-27 20:01:39 +08:00
-- SkeletonGraphic.AnimationState:SetAnimation(0, "idle", true)
self.liveNode : SetWalkDir ( WALK_DIR.IDLE_FRONT )
2020-06-23 18:36:24 +08:00
--self.mask:SetActive(isPlayerMove)
2020-06-19 20:19:35 +08:00
--隐藏该层级所有形象
--播放下落动画
2020-05-25 19:16:23 +08:00
for i = 1 , # targetPosGoAndData.layAllData do
2020-06-19 20:19:35 +08:00
Util.GetGameObject ( targetPosGoAndData.layGo , " itemList/item ( " .. i .. " )/parent/goParent " ) : SetActive ( false )
Util.GetGameObject ( targetPosGoAndData.layGo , " itemList/item ( " .. i .. " )/parent/okAttackImage " ) : SetActive ( false )
2020-06-28 17:48:49 +08:00
Util.GetGameObject ( targetPosGoAndData.layGo , " itemList/item ( " .. i .. " )/parent/infoIcon " ) : SetActive ( false )
Util.GetGameObject ( targetPosGoAndData.layGo , " itemList/item ( " .. i .. " )/parent/okAttackDi " ) : SetActive ( false )
2020-05-25 19:16:23 +08:00
if targetPosGoAndData.layAllData [ i ] . sortId ~= targetPosGoAndData.curNodeData . sortId then
2020-06-18 20:39:29 +08:00
local curNodParent = Util.GetGameObject ( targetPosGoAndData.layGo , " itemList/item ( " .. i .. " )/parent " )
targetPos = curNodParent.transform . localPosition - Vector3.New ( 0 , 300 , 0 )
2020-06-28 17:48:49 +08:00
curNodParent.transform : DOLocalMove ( targetPos , 0.8 , false ) : SetEase ( Ease.Linear )
Util.GetGameObject ( curNodParent , " pedestalImage " ) : GetComponent ( " Image " ) : DOFade ( 0 , 0.8 ) : SetEase ( Ease.Linear )
Util.GetGameObject ( curNodParent , " okAttackImage " ) : GetComponent ( " Image " ) : DOFade ( 0 , 0.8 ) : SetEase ( Ease.Linear )
2020-05-25 19:16:23 +08:00
end
end
if timer2 then
timer2 : Stop ( )
timer2 = nil
end
timer2 = Timer.New ( function ( )
2020-06-18 20:39:29 +08:00
for i = 1 , # targetPosGoAndData.layAllData do
if targetPosGoAndData.layAllData [ i ] . sortId ~= targetPosGoAndData.curNodeData . sortId then
Util.GetGameObject ( targetPosGoAndData.layGo , " itemList/item ( " .. i .. " )/parent " ) : SetActive ( false )
end
end
2020-05-25 19:16:23 +08:00
if targetPosGoAndData.curNodeData . type == ExpeditionNodeType.Shop then
NetManager.StoreNodeRequest ( targetPosGoAndData.curNodeData . sortId , function ( )
UIManager.OpenPanel ( UIName.ExpeditionMonsterInfoPopup , EXPEDITON_POPUP_TYPE.Shop , targetPosGoAndData.curNodeData , 3 , function ( )
self : OnShowNodeData ( )
end )
end )
else
self : OnShowNodeData ( )
end
2020-06-23 18:36:24 +08:00
isPlayerMove = false
2020-06-28 17:48:49 +08:00
end , 0.8 )
2020-05-25 19:16:23 +08:00
timer2 : Start ( )
end ) : SetEase ( Ease.Linear )
end
function ExpeditionMainPanel : SelfUpdataPanelShow ( )
2020-06-18 20:39:29 +08:00
self.Holy . transform : SetParent ( self.transform )
self.Holy : SetActive ( false )
2020-05-09 13:31:21 +08:00
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
for i , v in pairs ( nodeGoTable ) do
if v.data [ 1 ] . lay == GetCurNodeInfo.lay then
curNodeGo = v.goData
end
end
if curNodeGo then
2020-05-25 19:16:23 +08:00
self : SingleLayNodeShow ( curNodeGo , curAllLayNodeList [ 15 - GetCurNodeInfo.lay + 1 ] , GetCurNodeInfo.lay )
2020-05-09 13:31:21 +08:00
end
end
2020-05-25 19:16:23 +08:00
function ExpeditionMainPanel : RefreshManagerData ( )
NetManager.GetExpeditionRequest ( ExpeditionManager.expeditionLeve , function ( )
self : OnShowNodeData ( )
end )
end
function ExpeditionMainPanel : HeroResurgence ( )
local heroDid = " "
local roleDidDatas = { }
local roleHurtDatas = { }
local _roleDatas = HeroManager.GetAllHeroDatas ( 1 )
for i = 1 , # _roleDatas do
local heroHp = 0
if ExpeditionManager.heroInfo [ _roleDatas [ i ] . dynamicId ] then
heroHp = ExpeditionManager.heroInfo [ _roleDatas [ i ] . dynamicId ] . remainHp
if heroHp <= 0 then
table.insert ( roleDidDatas , _roleDatas [ i ] )
elseif heroHp < 1 then
table.insert ( roleHurtDatas , _roleDatas [ i ] )
end
end
end
local cuSelectHeroIndex = 0
if roleDidDatas and # roleDidDatas > 0 then
cuSelectHeroIndex = math.random ( 1 , # roleDidDatas )
heroDid = roleDidDatas [ cuSelectHeroIndex ] . dynamicId
elseif roleHurtDatas and # roleHurtDatas > 0 then
cuSelectHeroIndex = math.random ( 1 , # roleHurtDatas )
heroDid = roleHurtDatas [ cuSelectHeroIndex ] . dynamicId
else
heroDid = _roleDatas [ 1 ] . dynamicId
end
return heroDid
end
2020-06-23 18:36:24 +08:00
return ExpeditionMainPanel