68 lines
1.7 KiB
C#
68 lines
1.7 KiB
C#
using System.IO;
|
|
using HarmonyLib;
|
|
using NeoModLoader.api;
|
|
using NeoModLoader.services;
|
|
using UnityEngine;
|
|
|
|
namespace IdleSpectator;
|
|
|
|
/// <summary>
|
|
/// Idle Spectator entry: I key AFK camera director over WorldLog events.
|
|
/// </summary>
|
|
public class ModClass : MonoBehaviour, IMod, IConfigurable, ILocalizable
|
|
{
|
|
private ModDeclare _declare;
|
|
private GameObject _gameObject;
|
|
private Harmony _harmony;
|
|
private ModConfig _config;
|
|
|
|
/// <summary>Absolute path to this mod's folder (parent of mod.json).</summary>
|
|
public static string ModFolder { get; private set; }
|
|
|
|
public ModDeclare GetDeclaration()
|
|
{
|
|
return _declare;
|
|
}
|
|
|
|
public GameObject GetGameObject()
|
|
{
|
|
return _gameObject;
|
|
}
|
|
|
|
public string GetUrl()
|
|
{
|
|
return "";
|
|
}
|
|
|
|
public ModConfig GetConfig()
|
|
{
|
|
return _config;
|
|
}
|
|
|
|
public string GetLocaleFilesDirectory(ModDeclare pModDeclare)
|
|
{
|
|
return Path.Combine(pModDeclare.FolderPath, "Locales");
|
|
}
|
|
|
|
public void OnLoad(ModDeclare pModDecl, GameObject pGameObject)
|
|
{
|
|
_declare = pModDecl;
|
|
_gameObject = pGameObject;
|
|
ModFolder = pModDecl.FolderPath;
|
|
_config = ModSettings.Load(pModDecl);
|
|
|
|
_harmony = new Harmony(pModDecl.UID);
|
|
_harmony.PatchAll(typeof(ModClass).Assembly);
|
|
LogService.LogInfo($"[{pModDecl.Name}]: Harmony patches applied");
|
|
LogService.LogInfo($"[{pModDecl.Name}]: Press I to toggle Idle Spectator (disable in mod settings)");
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
SpectatorMode.PollInput();
|
|
InterestDirector.Update();
|
|
SpeciesDiscovery.Update();
|
|
StateProbe.Update();
|
|
AutoTest.Update();
|
|
}
|
|
}
|