mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-09-27 02:36:14 +00:00
提交
This commit is contained in:
50
JNFrame2/Assets/Scripts/Samples/Service/JNGResService.cs
Normal file
50
JNFrame2/Assets/Scripts/Samples/Service/JNGResService.cs
Normal file
@@ -0,0 +1,50 @@
|
||||
using System.Threading.Tasks;
|
||||
using Cinemachine;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using JNGame.Map;
|
||||
using JNGame.Map.DotRecast.Util;
|
||||
using JNGame.Util;
|
||||
using Plugins.JNGame.Network;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Service
|
||||
{
|
||||
public class JNGResService : JNServerBase
|
||||
{
|
||||
|
||||
//地图数据
|
||||
public StaticMapData MapData;
|
||||
|
||||
//地图数据2
|
||||
public MeshData MapData2;
|
||||
|
||||
//角色1
|
||||
public GameObject Player;
|
||||
//Boss
|
||||
public GameObject Boss;
|
||||
//世界
|
||||
public GameObject VWorld;
|
||||
|
||||
//相机
|
||||
public CinemachineFreeLook FreeLook;
|
||||
|
||||
public override async Task OnInit()
|
||||
{
|
||||
var map = await Resources.LoadAsync<TextAsset>("Battle/Map/NavMesh/Map_1001.navmesh") as TextAsset;
|
||||
var map2 = await Resources.LoadAsync<TextAsset>("map1") as TextAsset;
|
||||
if (map != null) MapData = JsonUtil.ToObject<StaticMapData>(map.text);
|
||||
if (map2 != null) MapData2 = JsonUtil.ToObject<MeshData>(map2.text);
|
||||
if (MapData != null) Debug.Log("加载地图资源完成");
|
||||
}
|
||||
|
||||
|
||||
public void Register(GameObject world,GameObject player,GameObject boss,CinemachineFreeLook freeLook)
|
||||
{
|
||||
Player = player;
|
||||
Boss = boss;
|
||||
VWorld = world;
|
||||
FreeLook = freeLook;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bbb29afc17db434db7a6fc5ce397b248
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user