60 lines
1.8 KiB
C#
60 lines
1.8 KiB
C#
using AIImages.Services;
|
|
using AIImages.Settings;
|
|
using HarmonyLib;
|
|
using UnityEngine;
|
|
using Verse;
|
|
|
|
namespace AIImages
|
|
{
|
|
/// <summary>
|
|
/// Main mod class with settings support
|
|
/// </summary>
|
|
public class AIImagesMod : Mod
|
|
{
|
|
public static AIImagesModSettings Settings { get; private set; }
|
|
|
|
// Singleton сервисы
|
|
public static IPawnDescriptionService PawnDescriptionService { get; private set; }
|
|
public static IPromptGeneratorService PromptGeneratorService { get; private set; }
|
|
public static IStableDiffusionApiService ApiService { get; private set; }
|
|
|
|
public AIImagesMod(ModContentPack content)
|
|
: base(content)
|
|
{
|
|
Settings = GetSettings<AIImagesModSettings>();
|
|
|
|
// Инициализируем сервисы
|
|
PawnDescriptionService = new PawnDescriptionService();
|
|
PromptGeneratorService = new AdvancedPromptGenerator();
|
|
ApiService = new StableDiffusionApiService(Settings.savePath);
|
|
|
|
Log.Message("[AI Images] Mod initialized successfully with settings");
|
|
}
|
|
|
|
public override void DoSettingsWindowContents(Rect inRect)
|
|
{
|
|
AIImagesSettingsUI.DoSettingsWindowContents(inRect, Settings);
|
|
base.DoSettingsWindowContents(inRect);
|
|
}
|
|
|
|
public override string SettingsCategory()
|
|
{
|
|
return "AI Images";
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Static constructor for Harmony patches
|
|
/// </summary>
|
|
[StaticConstructorOnStartup]
|
|
public static class AIImagesHarmonyPatcher
|
|
{
|
|
static AIImagesHarmonyPatcher()
|
|
{
|
|
var harmony = new Harmony("Mrleo1nid.aiimages");
|
|
harmony.PatchAll();
|
|
Log.Message("[AI Images] Harmony patches applied successfully");
|
|
}
|
|
}
|
|
}
|