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

51 lines
1.3 KiB
C#
Raw Normal View History

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