Skip to content

Commit

Permalink
Merge pull request #33 from Timberborn-Modding-Central/0.5.0.1
Browse files Browse the repository at this point in the history
0.5.0.0-rc.2
  • Loading branch information
KYPremco authored Sep 22, 2022
2 parents 0ef7a81 + 739ab6c commit 730bc83
Show file tree
Hide file tree
Showing 41 changed files with 228 additions and 371 deletions.
27 changes: 0 additions & 27 deletions Core/TimberApi.Common/Extensions/AppDomainExtensions.cs

This file was deleted.

5 changes: 5 additions & 0 deletions Core/TimberApi.Common/Extensions/AssemblyExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,10 @@ public static IEnumerable<Type> GetTypesWithInterface<TInterface>(this Assembly
{
return assembly.GetTypes().Where(x => typeof(TInterface).IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract);
}

public static IEnumerable<Type> GetTypesByAttribute<TAttribute>(this Assembly assembly) where TAttribute : class
{
return assembly.GetTypes().Where(type => type.IsDefined(typeof(TAttribute)));
}
}
}
12 changes: 0 additions & 12 deletions Core/TimberApi.Common/SingletonSystem/ISingletonRepository.cs

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Timberborn.SingletonSystem;

namespace TimberApi.Common.SingletonSystem
{
[Singleton]
public interface ITimberApiLoadableSingleton
{
void Load();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Timberborn.SingletonSystem;

namespace TimberApi.Common.SingletonSystem
{
[Singleton]
public interface ITimberApiPostLoadableSingleton
{
void PostLoad();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using Timberborn.SingletonSystem;

namespace TimberApi.Common.SingletonSystem
{
[Singleton]
public interface ITimberApiPreLoadableSingleton
{
void PreLoad();
}
}
94 changes: 0 additions & 94 deletions Core/TimberApi.Common/SingletonSystem/SingletonListener.cs

This file was deleted.

23 changes: 0 additions & 23 deletions Core/TimberApi.Common/SingletonSystem/SingletonRepository.cs

This file was deleted.

32 changes: 0 additions & 32 deletions Core/TimberApi.Common/SingletonSystem/SingletonRunner.cs

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@

namespace TimberApi.Core.BootstrapSystem
{
internal static class BootstrapPatch
internal static class BootstrapPatcher
{
public static void Apply()
public static void Patch()
{
try
{
var harmony = new Harmony("TimberApi.bootstrapper");

harmony.Patch(AccessTools.Method(typeof(BootstrapperConfigurator), "Configure"), new HarmonyMethod(AccessTools.Method(typeof(BootstrapPatch), nameof(BootstrapperConfiguratorPatch))));
harmony.Patch(AccessTools.Method(typeof(BootstrapperConfigurator), "Configure"),
new HarmonyMethod(AccessTools.Method(typeof(BootstrapPatcher), nameof(BootstrapperConfiguratorPatch))));
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
using Bindito.Core;
using Bindito.Unity;
using TimberApi.Common;
using TimberApi.Common.SingletonSystem;
using TimberApi.Core.ConfigSystem;
using TimberApi.Core.ConfiguratorSystem;
using TimberApi.Core.ConsoleSystem;
using TimberApi.Core.LoggingSystem;
using TimberApi.Core.ModLoaderSystem;
using TimberApi.Core.SingletonSystem;
using TimberApi.LocalizationSystem;
using TimberApi.SpecificationSystem;

namespace TimberApi.Core.BootstrapSystem
{
Expand All @@ -21,7 +24,11 @@ private void Awake()
{
Instance = this;
AddPrefabConfigurators();
BootstrapPatch.Apply();
BootstrapPatcher.Patch();
ConfiguratorPatcher.Patch();
LocalizationPatcher.Patch();
SpecificationPatcher.Patch();
SingletonSystemPatcher.Patch();
}
catch (Exception e)
{
Expand All @@ -37,20 +44,13 @@ public override void Configure(IContainerDefinition containerDefinition)
containerDefinition.Install(GetInstanceFromPrefab<ConsoleSystemConfigurator>());
containerDefinition.Install(GetInstanceFromPrefab<ModLoaderSystemConfigurator>());
containerDefinition.Install(new ConfigSystemConfigurator());
containerDefinition.Install(new ConfiguratorSystemConfigurator());

// Start runner
containerDefinition.Bind<TimberApiCoreRunner>().AsSingleton();

// TimberAPI Initialization
containerDefinition.Bind<ISingletonRepository>().To<SingletonRepository>().AsSingleton();
var instance = new SingletonListener();
containerDefinition.Bind<SingletonListener>().ToInstance(instance);
containerDefinition.AddInjectionListener(instance);
containerDefinition.AddProvisionListener(instance);

containerDefinition.Install(new BootstrapConfigurator());

containerDefinition.Bind<SingletonRunner>().AsSingleton();
}

private void AddPrefabConfigurators()
Expand Down
Loading

0 comments on commit 730bc83

Please sign in to comment.