135 lines
4.4 KiB
Lua
135 lines
4.4 KiB
Lua
require("Base/BasePanel")
|
|
StoryMapPanel = Inherit(BasePanel)
|
|
local this = StoryMapPanel
|
|
require("Modules/Map/Logic/TileMapView")
|
|
|
|
-- 小地图
|
|
local fightMap = require("Modules/Fight/View/FightPointMapView")
|
|
--初始化组件(用于子类重写)
|
|
function this:InitComponent()
|
|
this.TT = Util.GetGameObject(self.gameObject,"scroll/mapParent/TT")
|
|
this.startBtn = Util.GetGameObject(self.gameObject,"Start")
|
|
this.ViewCameraTran = Util.GetGameObject(self.gameObject,"CameraPos# (1)")
|
|
end
|
|
|
|
--绑定事件(用于子类重写)
|
|
function this:BindEvent()
|
|
Util.AddClick(this.btnBack, function ()
|
|
this:ClosePanel()
|
|
end)
|
|
Util.AddClick(this.startBtn, function ()
|
|
UIManager.camera.clearFlags = CameraClearFlags.Depth
|
|
this.liveNode:SetWalkDir(WALK_DIR.RUN_UP)
|
|
local timer = 0
|
|
LogGreen("timer:"..timer)
|
|
this.timer = Timer.New(function()
|
|
local v = Vector3.New(this.TT.transform.anchoredPosition3D.x + 800 ,this.TT.transform.anchoredPosition3D.y ,this.TT.transform.anchoredPosition3D.z )
|
|
this:RunMap(v,timer)
|
|
-- local MoveSpeed = 1
|
|
-- this.TT.transform.Translate(Vector3.forward * MoveSpeed * Time.deltaTime, RedBall.transform);
|
|
end,1)
|
|
this.timer:Start()
|
|
end)
|
|
end
|
|
|
|
function this:RunMap(v,timer)
|
|
this.TT.transform:DOAnchorPos(v,1):OnComplete(function ()
|
|
v = Vector3.New(this.TT.transform.anchoredPosition3D.x + 800 ,this.TT.transform.anchoredPosition3D.y ,this.TT.transform.anchoredPosition3D.z )
|
|
--Util.SetLocalPosition(this.ViewCameraTran.transform, this.TT.transform.anchoredPosition3D.x ,this.TT.transform.anchoredPosition3D.y ,this.TT.transform.anchoredPosition3D.z)
|
|
timer = timer + 1
|
|
if timer > 5 then
|
|
return
|
|
else
|
|
this:RunMap(v,timer)
|
|
end
|
|
end):SetEase(Ease.Linear)
|
|
end
|
|
|
|
--添加事件监听(用于子类重写)
|
|
function this:AddListener()
|
|
|
|
end
|
|
|
|
--移除事件监听(用于子类重写)
|
|
function this:RemoveListener()
|
|
|
|
end
|
|
|
|
--界面打开时调用(用于子类重写)
|
|
function this:OnOpen(_mapData)
|
|
--this:LoadMapData()
|
|
this.LoadTT()
|
|
|
|
end
|
|
--local mapCtrl = "MapCtrl"
|
|
-- function this:LoadMapData()
|
|
-- UIManager.camera.clearFlags = CameraClearFlags.Depth
|
|
-- -- 所有物体的根节点
|
|
-- this.mapRoot = poolManager:LoadAsset(mapCtrl, PoolManager.AssetType.GameObject)
|
|
-- this.mapRoot.name = mapCtrl
|
|
-- this.mapRoot.transform:SetParent(UIManager.uiRoot.transform.parent)
|
|
-- this.mapRoot.transform.position = Vector3.New(0, 0, -100)
|
|
|
|
-- TileMapView.fogSize = 2
|
|
-- local curChapter = FightPointPassManager.GetCurChapterIndex()
|
|
-- local index = 1
|
|
-- index = math.floor((curChapter - 1) % 5 + 1)
|
|
-- -- LogPink("#mapIdList:"..#mapIdList.." m_curMapId:"..m_curMapId.." curChapter:"..curChapter.." index:"..index.." State:"..tostring(FightPointPassManager.isOpenNewChapter))
|
|
-- TileMapView.AwakeInit(this.mapRoot, 5002, nil, Vector2.New(180, 180))
|
|
-- TileMapView.isShowFog = false
|
|
|
|
|
|
-- TileMapController.IsShieldDrag = function()
|
|
-- --当栈中有逻辑,则拖动可以打断镜头跟随
|
|
|
|
-- return false
|
|
-- end
|
|
-- TileMapController.OnClickTile = this.OnClickTile
|
|
-- TileMapController.Init(this.mapRoot, this.dragCtrl)
|
|
|
|
-- TileMapView.Init()
|
|
|
|
-- --TileMapView.SetSpriteBG(mapRes[index])
|
|
|
|
-- -- 设置镜头的尺寸
|
|
-- TileMapView.SetMapScale(Screen.height / 1920)
|
|
|
|
-- -- 设置相机初始化位置
|
|
-- local camInitPos = InitCamPos[5002].pos
|
|
-- TileMapView.SetCameraPos(camInitPos)
|
|
|
|
-- -- 设置不点击
|
|
-- this.dragCtrl:SetActive(false)
|
|
-- end
|
|
|
|
local npc = "live2d_npc_map_boy"
|
|
---加载跑图角色
|
|
function this.LoadTT()
|
|
this.liveNode = PlayerLiveView:New(this.TT,1)
|
|
this.liveNode:OnOpen(GetPlayerRoleSingleConFig().Scale13,Vector3.New(0,-30,0),WALK_DIR.IDLE_FRONT)
|
|
--Util.SetLocalPosition(this.ViewCameraTran.transform, this.TT.transform.anchoredPosition3D.x ,this.TT.transform.anchoredPosition3D.y ,this.ViewCameraTran.transform.anchoredPosition3D.z)
|
|
end
|
|
|
|
--设置跑图角色方向
|
|
function this.SetTTDirection()
|
|
|
|
end
|
|
|
|
function this:OnShow()
|
|
|
|
end
|
|
|
|
function this:OnSortingOrderChange()
|
|
|
|
end
|
|
|
|
--界面关闭时调用(用于子类重写)
|
|
function this:OnClose()
|
|
|
|
end
|
|
|
|
--界面销毁时调用(用于子类重写)
|
|
function this:OnDestroy()
|
|
|
|
end
|
|
return StoryMapPanel |