Enhance AIImages mod with settings support and improved UI for image generation. Update localized strings in English and Russian for better clarity. Refactor code for better organization and maintainability.
This commit is contained in:
@@ -1,19 +1,59 @@
|
||||
using AIImages.Services;
|
||||
using AIImages.Settings;
|
||||
using HarmonyLib;
|
||||
using UnityEngine;
|
||||
using Verse;
|
||||
|
||||
namespace AIImages
|
||||
{
|
||||
/// <summary>
|
||||
/// Main mod class that initializes Harmony patches
|
||||
/// 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 AIImagesMod
|
||||
public static class AIImagesHarmonyPatcher
|
||||
{
|
||||
static AIImagesMod()
|
||||
static AIImagesHarmonyPatcher()
|
||||
{
|
||||
var harmony = new Harmony("Mrleo1nid.aiimages");
|
||||
harmony.PatchAll();
|
||||
Log.Message("[AI Images] Mod initialized successfully");
|
||||
Log.Message("[AI Images] Harmony patches applied successfully");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user