Unofficial CardLife revival project, pronounced like "celery"
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.8KB

  1. using System;
  2. using CLre_server.API.Engines;
  3. using Game.DataLoader;
  4. using GameServer;
  5. using Svelto.Context;
  6. using Svelto.ECS;
  7. namespace CLre_server.API.MainServer
  8. {
  9. class ServerReadyEngine : ServerEnginePostBuild, IWaitForFrameworkInitialization, IWaitForFrameworkDestruction
  10. {
  11. internal static event EventHandler<StartedEventArgs> serverEngineReady;
  12. internal static event EventHandler<StartedEventArgs> serverFrameworkReady;
  13. internal static event EventHandler<StopEventArgs> serverFrameworkDestroyed;
  14. public override void Ready()
  15. {
  16. GameServerSettings gss = Server.Instance.GameServerSettings;
  17. if (serverEngineReady != null) serverEngineReady(this, new StartedEventArgs
  18. {
  19. photonVersion = PhotonNetwork.gameVersion,
  20. photonRegion = PhotonNetwork.CloudRegion,
  21. gameGuid = gss.GetGameGuid(),
  22. worldName = gss.GetWorldName(),
  23. });
  24. }
  25. public override IEntitiesDB entitiesDB { get; set; }
  26. public override IEntityFactory entityFactory { get; set; }
  27. public void OnFrameworkInitialized()
  28. {
  29. GameServerSettings gss = Server.Instance.GameServerSettings;
  30. if (serverFrameworkReady != null) serverFrameworkReady(this, new StartedEventArgs
  31. {
  32. photonVersion = PhotonNetwork.gameVersion,
  33. photonRegion = PhotonNetwork.CloudRegion,
  34. gameGuid = gss.GetGameGuid(),
  35. worldName = gss.GetWorldName(),
  36. });
  37. }
  38. public void OnFrameworkDestroyed()
  39. {
  40. if (serverFrameworkDestroyed != null) serverFrameworkDestroyed(this, new StopEventArgs{});
  41. }
  42. }
  43. }