Renamed interface to IOnLoad
Added OnLoad mod Expanded `OnLoadOrder` options
This commit is contained in:
@@ -9,7 +9,7 @@ using SptCommon.Annotations;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(OnLoad), TypePriority = OnLoadOrder.GameCallbacks)]
|
||||
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.GameCallbacks)]
|
||||
[Injectable(InjectableTypeOverride = typeof(GameCallbacks))]
|
||||
public class GameCallbacks(
|
||||
HttpResponseUtil _httpResponseUtil,
|
||||
@@ -17,7 +17,7 @@ public class GameCallbacks(
|
||||
SaveServer _saveServer,
|
||||
GameController _gameController,
|
||||
TimeUtil _timeUtil
|
||||
) : OnLoad
|
||||
) : IOnLoad
|
||||
{
|
||||
public Task OnLoad()
|
||||
{
|
||||
|
||||
@@ -4,8 +4,8 @@ using SptCommon.Annotations;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(OnLoad), TypePriority = OnLoadOrder.HandbookCallbacks)]
|
||||
public class HandbookCallbacks(HandBookController _handBookController) : OnLoad
|
||||
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.HandbookCallbacks)]
|
||||
public class HandbookCallbacks(HandBookController _handBookController) : IOnLoad
|
||||
{
|
||||
public Task OnLoad()
|
||||
{
|
||||
|
||||
@@ -5,8 +5,8 @@ using SptCommon.Annotations;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(InjectionType.Singleton, InjectableTypeOverride = typeof(OnLoad), TypePriority = OnLoadOrder.HttpCallbacks)]
|
||||
public class HttpCallbacks(HttpServer _httpServer, ApplicationContext _applicationContext) : OnLoad
|
||||
[Injectable(InjectionType.Singleton, InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.HttpCallbacks)]
|
||||
public class HttpCallbacks(HttpServer _httpServer, ApplicationContext _applicationContext) : IOnLoad
|
||||
{
|
||||
public Task OnLoad()
|
||||
{
|
||||
|
||||
@@ -4,8 +4,8 @@ using SptCommon.Annotations;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(OnLoad), TypePriority = OnLoadOrder.PresetCallbacks)]
|
||||
public class PresetCallbacks(PresetController _presetController) : OnLoad
|
||||
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.PresetCallbacks)]
|
||||
public class PresetCallbacks(PresetController _presetController) : IOnLoad
|
||||
{
|
||||
public Task OnLoad()
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ using SptCommon.Annotations;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(OnLoad), TypePriority = OnLoadOrder.RagfairCallbacks)]
|
||||
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.RagfairCallbacks)]
|
||||
[Injectable(InjectableTypeOverride = typeof(OnUpdate), TypePriority = OnUpdateOrder.RagfairCallbacks)]
|
||||
[Injectable(InjectableTypeOverride = typeof(RagfairCallbacks))]
|
||||
public class RagfairCallbacks(
|
||||
@@ -21,7 +21,7 @@ public class RagfairCallbacks(
|
||||
RagfairTaxService _ragfairTaxService,
|
||||
RagfairPriceService _ragfairPriceService,
|
||||
ConfigServer _configServer
|
||||
) : OnLoad, OnUpdate
|
||||
) : IOnLoad, OnUpdate
|
||||
{
|
||||
private readonly RagfairConfig _ragfairConfig = _configServer.GetConfig<RagfairConfig>();
|
||||
|
||||
|
||||
@@ -6,14 +6,14 @@ using SptCommon.Annotations;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(OnLoad), TypePriority = OnLoadOrder.SaveCallbacks)]
|
||||
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.SaveCallbacks)]
|
||||
[Injectable(InjectableTypeOverride = typeof(OnUpdate), TypePriority = OnUpdateOrder.SaveCallbacks)]
|
||||
public class SaveCallbacks(
|
||||
SaveServer _saveServer,
|
||||
ConfigServer _configServer,
|
||||
BackupService _backupService
|
||||
)
|
||||
: OnLoad, OnUpdate
|
||||
: IOnLoad, OnUpdate
|
||||
{
|
||||
private readonly CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
|
||||
|
||||
|
||||
@@ -8,14 +8,14 @@ using SptCommon.Annotations;
|
||||
|
||||
namespace Core.Callbacks;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(OnLoad), TypePriority = OnLoadOrder.TraderCallbacks)]
|
||||
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.TraderCallbacks)]
|
||||
[Injectable(InjectableTypeOverride = typeof(OnUpdate), TypePriority = OnUpdateOrder.TraderCallbacks)]
|
||||
[Injectable(InjectableTypeOverride = typeof(TraderCallbacks))]
|
||||
public class TraderCallbacks(
|
||||
HttpResponseUtil _httpResponseUtil,
|
||||
TraderController _traderController,
|
||||
ConfigServer _configServer
|
||||
) : OnLoad, OnUpdate
|
||||
) : IOnLoad, OnUpdate
|
||||
{
|
||||
private readonly TraderConfig _traderConfig = _configServer.GetConfig<TraderConfig>();
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
namespace Core.DI;
|
||||
|
||||
public interface OnLoad
|
||||
public interface IOnLoad
|
||||
{
|
||||
Task OnLoad();
|
||||
string GetRoute();
|
||||
@@ -2,7 +2,9 @@ namespace Core.DI;
|
||||
|
||||
public static class OnLoadOrder
|
||||
{
|
||||
public const int Database = 0;
|
||||
public const int PreSPTDatabase = 0;
|
||||
public const int Database = 1;
|
||||
public const int PostSptDatabase = 2;
|
||||
public const int GameCallbacks = 100;
|
||||
public const int PostDBModLoader = 200;
|
||||
public const int HandbookCallbacks = 300;
|
||||
@@ -13,4 +15,5 @@ public static class OnLoadOrder
|
||||
public const int PresetCallbacks = 800;
|
||||
public const int RagfairPriceService = 900;
|
||||
public const int RagfairCallbacks = 1000;
|
||||
public const int PostServerLoad = 9999;
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ using SptCommon.Annotations;
|
||||
|
||||
namespace Core.Loaders;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(OnLoad), TypePriority = OnLoadOrder.PostDBModLoader)]
|
||||
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.PostDBModLoader)]
|
||||
public class PostDBModLoader(
|
||||
ISptLogger<PostDBModLoader> _logger,
|
||||
IEnumerable<IPostDBLoadMod> _postDbLoadMods
|
||||
) : OnLoad
|
||||
) : IOnLoad
|
||||
{
|
||||
public async Task OnLoad()
|
||||
{
|
||||
|
||||
@@ -6,11 +6,11 @@ using SptCommon.Annotations;
|
||||
|
||||
namespace Core.Loaders;
|
||||
|
||||
[Injectable(InjectableTypeOverride = typeof(OnLoad), TypePriority = OnLoadOrder.PostSptModLoader)]
|
||||
[Injectable(InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.PostSptModLoader)]
|
||||
public class PostSptModLoader(
|
||||
ISptLogger<PostSptModLoader> _logger,
|
||||
IEnumerable<IPostSptLoadMod> _postSptLoadMods
|
||||
) : OnLoad
|
||||
) : IOnLoad
|
||||
{
|
||||
public async Task OnLoad()
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ public class App
|
||||
protected LocalisationService _localisationService;
|
||||
|
||||
protected ISptLogger<App> _logger;
|
||||
protected IEnumerable<OnLoad> _onLoad;
|
||||
protected IEnumerable<IOnLoad> _onLoad;
|
||||
protected IEnumerable<OnUpdate> _onUpdate;
|
||||
protected Dictionary<string, long> _onUpdateLastRun = new();
|
||||
protected Timer _timer;
|
||||
@@ -36,7 +36,7 @@ public class App
|
||||
EncodingUtil encodingUtil,
|
||||
HttpServer httpServer,
|
||||
DatabaseService databaseService,
|
||||
IEnumerable<OnLoad> onLoadComponents,
|
||||
IEnumerable<IOnLoad> onLoadComponents,
|
||||
IEnumerable<OnUpdate> onUpdateComponents
|
||||
)
|
||||
{
|
||||
|
||||
@@ -11,8 +11,8 @@ using LogLevel = Core.Models.Spt.Logging.LogLevel;
|
||||
|
||||
namespace Core.Utils;
|
||||
|
||||
[Injectable(InjectionType.Singleton, InjectableTypeOverride = typeof(OnLoad), TypePriority = OnLoadOrder.Database)]
|
||||
public class DatabaseImporter : OnLoad
|
||||
[Injectable(InjectionType.Singleton, InjectableTypeOverride = typeof(IOnLoad), TypePriority = OnLoadOrder.Database)]
|
||||
public class DatabaseImporter : IOnLoad
|
||||
{
|
||||
private const string _sptDataPath = "./Assets/";
|
||||
private readonly HttpConfig httpConfig;
|
||||
|
||||
Reference in New Issue
Block a user