53 lines
1.1 KiB
C#
Raw Normal View History

2024-08-17 14:27:18 +08:00
using AppGame;
using AppGame.Sync;
using Cinemachine;
using Game.Input;
using JNGame;
using JNGame.Sync.Debuger;
using UnityEngine;
public class DApplication : MonoBehaviour
{
public GameObject Player1;
public GameObject VWorld;
public CinemachineFreeLook FreeLook;
private async void Awake()
{
await JNetGame.Instance.Init(App.AllSystem());
//绑定资源
App.Resource.Register(VWorld,Player1,FreeLook);
//开始运行同步
if (App.IsServer())
{
2024-08-22 20:37:39 +08:00
var tileServer = App.Game.StartServer<JNGTileServerSystem>();
2024-08-17 14:27:18 +08:00
JNTileServerDebuger.Instance.Add(tileServer);
}
2024-08-22 20:37:39 +08:00
if (App.IsClient()) App.Game.StartClient<JNGTileClientSystem>();
2024-08-17 14:27:18 +08:00
}
private void Update()
{
App.Game.Update();
}
public void OnClickPlayerCreate()
{
var input = App.Game.GetInput<IDWorld>();
input.IsPlayerCreate = true;
}
public void OnClickButton()
{
var input = App.Game.GetInput<IDWorld>();
input.IsAdd = true;
}
}