using System; using System.Collections; using CLre_server.API.Engines; using Game.DataLoader; using GameServer; using Svelto.Context; using Svelto.ECS; namespace CLre_server.API.MainServer { class ServerReadyEngine : ServerEnginePostBuild, IWaitForFrameworkInitialization, IWaitForFrameworkDestruction { internal static event EventHandler serverEngineReady; internal static event EventHandler serverFrameworkReady; internal static event EventHandler serverFrameworkDestroyed; public override void Ready() { GameServerSettings gss = Server.Instance.GameServerSettings; if (serverEngineReady != null) serverEngineReady(this, new StartedEventArgs { photonVersion = PhotonNetwork.gameVersion, photonRegion = PhotonNetwork.CloudRegion, gameGuid = gss == null ? "" : gss.GetGameGuid(), worldName = gss == null ? "" : gss.GetWorldName(), }); } public void OnFrameworkInitialized() { GameServerSettings gss = Server.Instance.GameServerSettings; if (serverFrameworkReady != null) serverFrameworkReady(this, new StartedEventArgs { photonVersion = PhotonNetwork.gameVersion, photonRegion = PhotonNetwork.CloudRegion, gameGuid = gss == null ? "" : gss.GetGameGuid(), worldName = gss == null ? "" : gss.GetWorldName(), }); } public void OnFrameworkDestroyed() { if (serverFrameworkDestroyed != null) serverFrameworkDestroyed(this, new StopEventArgs{}); } } }