Add functionality to clear all generated portrait images in AIImages mod. Implement UI button for clearing images and add confirmation dialog. Update localized strings in English and Russian for new feature. Update AIImages.dll to reflect these changes.
This commit is contained in:
@@ -366,6 +366,14 @@ namespace AIImages
|
||||
|
||||
listingStandard.Label("AIImages.Settings.SavePath".Translate() + ":");
|
||||
settings.savePath = listingStandard.TextEntry(settings.savePath);
|
||||
|
||||
listingStandard.Gap(12f);
|
||||
|
||||
// Кнопка очистки всех изображений
|
||||
if (listingStandard.ButtonText("AIImages.Settings.ClearAllImages".Translate()))
|
||||
{
|
||||
ClearAllGeneratedImages(settings);
|
||||
}
|
||||
}
|
||||
|
||||
private static void TestApiConnection(
|
||||
@@ -476,5 +484,23 @@ namespace AIImages
|
||||
selectedValue = availableValues[0];
|
||||
}
|
||||
}
|
||||
|
||||
private static void ClearAllGeneratedImages(AIImagesModSettings settings)
|
||||
{
|
||||
Find.WindowStack.Add(
|
||||
Dialog_MessageBox.CreateConfirmation(
|
||||
"AIImages.Settings.ClearAllImagesConfirm".Translate(),
|
||||
delegate
|
||||
{
|
||||
int deletedCount = PawnPortraitHelper.ClearAllPortraits(settings.savePath);
|
||||
Messages.Message(
|
||||
"AIImages.Settings.ClearAllImagesSuccess".Translate(deletedCount),
|
||||
MessageTypeDefOf.PositiveEvent
|
||||
);
|
||||
},
|
||||
destructive: true
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user