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.

51 lines
1.9KB

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