mirror of
https://gitee.com/jisol/jisol-game/
synced 2025-06-26 19:34:47 +00:00
58 lines
1.2 KiB
C#
58 lines
1.2 KiB
C#
|
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())
|
||
|
{
|
||
|
var tileServer = App.Game.Start<JNGTileServerSystem>();
|
||
|
JNTileServerDebuger.Instance.Add(tileServer);
|
||
|
}
|
||
|
if (App.IsClient()) App.Game.Start<JNGTileClientSystem>();
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
|
||
|
public void OnClickServerCreate()
|
||
|
{
|
||
|
App.Game.Start<JNGTileServerSystem>();
|
||
|
}
|
||
|
|
||
|
}
|