【挂机】修复部分章节卡死

dev_chengFeng
gaoxin 2021-04-25 16:05:11 +08:00
parent 438bfea81a
commit 4a33407d27
2 changed files with 15 additions and 20 deletions

View File

@ -17,27 +17,19 @@ local mapIdList = {
[5] = 5004, [5] = 5004,
} }
--初始化相机位置
local InitCamPos = {
[4002] = {pos = Vector3.New(27.5, -27.5, -50)},
[5005] = {pos = Vector3.New(20, -15, -50)},
[5002] = {pos = Vector3.New(27.5, -27.5, -50)},
[5003] = {pos = Vector3.New(27.5, -18, -50)},
[5004] = {pos = Vector3.New(27.5, -18, -50)},
}
-- 临时可生成怪的区域 -- 临时可生成怪的区域
local monsterArea = { local monsterArea = {
[5005] = { [5005] = {
x_pos = {min = 10, max = 28}, x_pos = {min = 8, max = 28},
y_pos = {min = 8, max = 14}, y_pos = {min = 8, max = 14},
}, },
[4002] = { [4002] = {
x_pos = {min = 10, max = 20}, x_pos = {min = 8, max = 24},
y_pos = {min = 10, max = 15}, y_pos = {min = 9, max = 23},
}, },
[5002] = { [5002] = {
x_pos = {min = 9, max = 28}, x_pos = {min = 9, max = 32},
y_pos = {min = 8, max = 16}, y_pos = {min = 8, max = 16},
}, },
[5003] = { [5003] = {
@ -52,7 +44,7 @@ local monsterArea = {
--自己角色的出生点 --自己角色的出生点
local startUV = { local startUV = {
[5005] = {u = 11, v = 8}, [5005] = {u = 15, v = 10},
[4002] = {u = 15, v = 15}, [4002] = {u = 15, v = 15},
[5002] = {u = 15, v = 15}, [5002] = {u = 15, v = 15},
[5003] = {u = 15, v = 10}, [5003] = {u = 15, v = 10},
@ -115,11 +107,13 @@ function this:Init()
PlayerManager.GetFightMapPlayerNPCData(randomNum,function(NPCList) PlayerManager.GetFightMapPlayerNPCData(randomNum,function(NPCList)
--LogGreen("NPCList:"..LengthOfTable(NPCList)) --LogGreen("NPCList:"..LengthOfTable(NPCList))
local index = 1 local index = 1
local area = monsterArea[m_curMapId]
local suv = startUV[m_curMapId]
for k,v in pairs(NPCList) do for k,v in pairs(NPCList) do
local index1 = math.random(6,12) local index1 = math.random(area.x_pos.min,suv.u - 3)
local index2 = math.random(19,38) local index2 = math.random(suv.u + 3,area.x_pos.max)
local index3 = math.random(1,2) local index3 = math.random(1,2)
local index4 = math.random(2,19) local index4 = math.random(area.y_pos.min,area.y_pos.max)
this.playerViews[index] = SubUIManager.Open(SubUIConfig.SingleFightPlayerView,this.mapRoot.transform,this) this.playerViews[index] = SubUIManager.Open(SubUIConfig.SingleFightPlayerView,this.mapRoot.transform,this)
this.playerViews[index]:SetData((index3 == 1 and index1 or index2),index4,false,v) this.playerViews[index]:SetData((index3 == 1 and index1 or index2),index4,false,v)
index = index + 1 index = index + 1
@ -132,6 +126,10 @@ function this:Init()
this.playerViews[0]:SetData(startUV[m_curMapId].u,startUV[m_curMapId].v,true) this.playerViews[0]:SetData(startUV[m_curMapId].u,startUV[m_curMapId].v,true)
end end
-- 设置相机初始化位置
local v4 = this.playerViews[0].transform.localPosition
v4.z = -50
TileMapView.SetCameraPos(v4)
-- 初始化两个地图标志 -- 初始化两个地图标志
this.LoadMapIcon() this.LoadMapIcon()
this.SetPlayerViewWalk() this.SetPlayerViewWalk()
@ -168,10 +166,6 @@ function this:LoadMapData()
-- 设置镜头的尺寸 -- 设置镜头的尺寸
TileMapView.SetMapScale(Screen.height / 1920) TileMapView.SetMapScale(Screen.height / 1920)
-- 设置相机初始化位置
local camInitPos = InitCamPos[m_curMapId].pos
TileMapView.SetCameraPos(camInitPos)
-- 设置不点击 -- 设置不点击
this.dragCtrl:SetActive(false) this.dragCtrl:SetActive(false)

View File

@ -180,6 +180,7 @@ function SingleFightPlayerView:SetData(u,v,isSelf,data)
--角色当前的uv --角色当前的uv
self.roleCurPos = TileMapView.GetMapData():GetMapData(u, v) self.roleCurPos = TileMapView.GetMapData():GetMapData(u, v)
LogWarn(self.roleCurPos.u.."||"..self.roleCurPos.v)
self.bLeaderIsIdle = true self.bLeaderIsIdle = true
self:SetWalkDir(WALK_DIR.LAUCH) self:SetWalkDir(WALK_DIR.LAUCH)