56 lines
1.3 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
{
2024-08-31 15:35:12 +08:00
public GameObject Player;
public GameObject Boss;
2024-08-17 14:27:18 +08:00
public GameObject VWorld;
public CinemachineFreeLook FreeLook;
private async void Awake()
{
2024-08-31 15:35:12 +08:00
2024-08-17 14:27:18 +08:00
await JNetGame.Instance.Init(App.AllSystem());
//绑定资源
2024-08-31 15:35:12 +08:00
App.Resource.Register(VWorld,Player,Boss,FreeLook);
2024-08-17 14:27:18 +08:00
//开始运行同步
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-31 15:35:12 +08:00
if (App.IsSlaveServer()) App.Game.StartServer<JNGTileSlaveServerSystem>();
2024-08-22 20:37:39 +08:00
if (App.IsClient()) App.Game.StartClient<JNGTileClientSystem>();
2024-08-17 14:27:18 +08:00
}
public void OnClickPlayerCreate()
{
var input = App.Game.GetInput<IDWorld>();
input.IsPlayerCreate = true;
}
2024-08-31 15:35:12 +08:00
public void OnClickBossCreate()
{
var input = App.Game.GetInput<IDWorld>();
input.IsBossCreate = true;
}
2024-08-17 14:27:18 +08:00
public void OnClickButton()
{
var input = App.Game.GetInput<IDWorld>();
input.IsAdd = true;
}
2024-08-31 15:35:12 +08:00
2024-08-17 14:27:18 +08:00
}