2021-03-18 18:51:13 +00:00
|
|
|
using System;
|
2021-05-27 01:22:23 +01:00
|
|
|
using System.Collections;
|
2021-03-18 18:51:13 +00:00
|
|
|
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<StartedEventArgs> serverEngineReady;
|
|
|
|
|
|
|
|
internal static event EventHandler<StartedEventArgs> serverFrameworkReady;
|
|
|
|
|
|
|
|
internal static event EventHandler<StopEventArgs> serverFrameworkDestroyed;
|
|
|
|
|
|
|
|
public override void Ready()
|
|
|
|
{
|
|
|
|
GameServerSettings gss = Server.Instance.GameServerSettings;
|
|
|
|
if (serverEngineReady != null) serverEngineReady(this, new StartedEventArgs
|
|
|
|
{
|
|
|
|
photonVersion = PhotonNetwork.gameVersion,
|
|
|
|
photonRegion = PhotonNetwork.CloudRegion,
|
2021-05-27 01:22:23 +01:00
|
|
|
gameGuid = gss == null ? "" : gss.GetGameGuid(),
|
|
|
|
worldName = gss == null ? "" : gss.GetWorldName(),
|
2021-03-18 18:51:13 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public void OnFrameworkInitialized()
|
|
|
|
{
|
|
|
|
GameServerSettings gss = Server.Instance.GameServerSettings;
|
|
|
|
if (serverFrameworkReady != null) serverFrameworkReady(this, new StartedEventArgs
|
|
|
|
{
|
|
|
|
photonVersion = PhotonNetwork.gameVersion,
|
|
|
|
photonRegion = PhotonNetwork.CloudRegion,
|
2021-05-27 01:22:23 +01:00
|
|
|
gameGuid = gss == null ? "" : gss.GetGameGuid(),
|
|
|
|
worldName = gss == null ? "" : gss.GetWorldName(),
|
2021-03-18 18:51:13 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public void OnFrameworkDestroyed()
|
|
|
|
{
|
|
|
|
if (serverFrameworkDestroyed != null) serverFrameworkDestroyed(this, new StopEventArgs{});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|