2020-06-18 01:04:08 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
using RobocraftX.Common;
|
|
|
|
|
using RobocraftX.StateSync;
|
|
|
|
|
using Svelto.ECS;
|
|
|
|
|
using Unity.Jobs;
|
|
|
|
|
|
|
|
|
|
using GamecraftModdingAPI.Engines;
|
|
|
|
|
using GamecraftModdingAPI.Utility;
|
|
|
|
|
|
|
|
|
|
namespace GamecraftModdingAPI.App
|
|
|
|
|
{
|
|
|
|
|
public class GameBuildSimEventEngine : IApiEngine, IUnorderedInitializeOnTimeRunningModeEntered, IUnorderedInitializeOnTimeStoppedModeEntered
|
|
|
|
|
{
|
|
|
|
|
public event EventHandler<GameEventArgs> SimulationMode;
|
|
|
|
|
|
|
|
|
|
public event EventHandler<GameEventArgs> BuildMode;
|
|
|
|
|
|
|
|
|
|
public string Name => "GamecraftModdingAPIBuildSimEventGameEngine";
|
|
|
|
|
|
|
|
|
|
public bool isRemovable => false;
|
|
|
|
|
|
|
|
|
|
public EntitiesDB entitiesDB { set; private get; }
|
|
|
|
|
|
|
|
|
|
public void Dispose() { }
|
|
|
|
|
|
|
|
|
|
public void Ready() { }
|
|
|
|
|
|
2020-07-10 22:30:58 +00:00
|
|
|
|
public JobHandle OnInitializeTimeRunningMode(JobHandle inputDeps)
|
2020-06-18 01:04:08 +00:00
|
|
|
|
{
|
|
|
|
|
ExceptionUtil.InvokeEvent(SimulationMode, this, new GameEventArgs { GameName = GameMode.SaveGameDetails.Name, GamePath = GameMode.SaveGameDetails.Folder });
|
2020-07-10 22:30:58 +00:00
|
|
|
|
return inputDeps;
|
2020-06-18 01:04:08 +00:00
|
|
|
|
}
|
|
|
|
|
|
2020-07-10 22:30:58 +00:00
|
|
|
|
public JobHandle OnInitializeTimeStoppedMode(JobHandle inputDeps)
|
2020-06-18 01:04:08 +00:00
|
|
|
|
{
|
|
|
|
|
ExceptionUtil.InvokeEvent(BuildMode, this, new GameEventArgs { GameName = GameMode.SaveGameDetails.Name, GamePath = GameMode.SaveGameDetails.Folder });
|
2020-07-10 22:30:58 +00:00
|
|
|
|
return inputDeps;
|
2020-06-18 01:04:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public struct GameEventArgs
|
|
|
|
|
{
|
|
|
|
|
public string GameName;
|
|
|
|
|
|
|
|
|
|
public string GamePath;
|
|
|
|
|
}
|
|
|
|
|
}
|