Implement AI Images gallery feature in RimWorld mod, allowing users to view, delete, and manage generated images. Update UI components to include a gallery button and enhance image management functionality. Add localization strings for gallery features in English and Russian. Update AIImages.dll to reflect these changes.

This commit is contained in:
Leonid Pershin
2025-10-31 18:20:39 +03:00
parent 1b35cb6a44
commit a99fa16763
8 changed files with 799 additions and 36 deletions

View File

@@ -1293,8 +1293,8 @@ namespace AIImages
? "AIImages.Generation.Cancel".Translate()
: "AIImages.Generation.Generate".Translate();
// Основная кнопка генерации (занимает 70% ширины)
float buttonWidth = rect.width * 0.7f;
// Основная кнопка генерации (занимает 40% ширины)
float buttonWidth = rect.width * 0.4f;
if (Widgets.ButtonText(new Rect(rect.x, curY, buttonWidth, 35f), buttonLabel))
{
if (isGenerating)
@@ -1303,9 +1303,25 @@ namespace AIImages
StartGeneration();
}
// Отладочная кнопка (занимает 25% ширины)
float debugButtonWidth = rect.width * 0.25f;
float debugButtonX = rect.x + buttonWidth + 10f;
// Кнопка галереи
float galleryButtonWidth = rect.width * 0.35f;
float galleryButtonX = rect.x + buttonWidth + 10f;
int imageCount = PawnPortraitHelper.GetPortraitCount(pawn);
string galleryLabel = "AIImages.Gallery.OpenGallery".Translate();
if (imageCount > 0)
{
galleryLabel += " " + "AIImages.Gallery.ImagesCount".Translate(imageCount);
}
if (Widgets.ButtonText(new Rect(galleryButtonX, curY, galleryButtonWidth, 35f), galleryLabel))
{
var galleryWindow = new Window_AIGallery(pawn);
Find.WindowStack.Add(galleryWindow);
}
// Отладочная кнопка (занимает 20% ширины)
float debugButtonWidth = rect.width * 0.2f;
float debugButtonX = galleryButtonX + galleryButtonWidth + 10f;
if (Widgets.ButtonText(new Rect(debugButtonX, curY, debugButtonWidth, 35f), "Debug"))
{
DebugAllPawns();