This repository has been archived on 2024-10-29. You can view files and clone it, but cannot push or open issues or pull requests.
beatsaber-scoretracker/Mod/Plugin.cs
Liam c04a51de35
Some checks failed
Deploy API / docker (17, 3.8.5) (push) Failing after 1m32s
why
2024-08-07 05:19:39 +01:00

51 lines
1.3 KiB
C#

using IPA;
using IPALogger = IPA.Logging.Logger;
using SiraUtil.Zenject;
using IPA.Loader;
using Zenject;
using ScoreTracker.Core;
using System.Threading.Tasks;
using ScoreTracker.API;
using System.Collections.Generic;
namespace ScoreTracker
{
[Plugin(RuntimeOptions.SingleStartInit)]
public class Plugin
{
internal static Plugin Instance { get; private set; }
internal static IPALogger Log { get; private set; }
internal static DiContainer Container; // Workaround to access the Zenject container in SceneLoaded
[Init]
public Plugin(IPALogger logger, PluginMetadata metadata, Zenjector zenjector)
{
Instance = this;
Log = logger; // Setup the logger
// Install our Zenject bindings
zenjector.Install<AppInstaller>(Location.App);
}
[OnStart]
public void OnApplicationStart()
{
Log.Info("OnApplicationStart");
Task.Run(async () =>
{
await Request.PostJsonAsync("http://localhost:7500/boobies", new Dictionary<object, object> {
{ "boobies", "yes" }
});
});
}
[OnExit]
public void OnApplicationQuit()
{
Log.Info("OnApplicationQuit");
}
}
}