Add image type selection feature in AIImages mod, allowing users to choose between portrait and full body images. Update English and Russian localization files to include new labels for image types. Modify UI components to render the image type selector and adjust generation settings accordingly. Update AIImages.dll to reflect these changes.
This commit is contained in:
@@ -793,6 +793,7 @@ namespace AIImages
|
||||
{
|
||||
float curY = rect.y;
|
||||
|
||||
curY = DrawImageTypeSelector(rect, curY);
|
||||
curY = DrawImagePreview(rect, curY);
|
||||
curY = DrawGenerationStatus(rect, curY);
|
||||
curY = DrawProgressBar(rect, curY);
|
||||
@@ -1146,6 +1147,75 @@ namespace AIImages
|
||||
return curY;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Отрисовывает селектор типа изображения (портрет/полное тело)
|
||||
/// </summary>
|
||||
private float DrawImageTypeSelector(Rect rect, float curY)
|
||||
{
|
||||
Text.Font = GameFont.Small;
|
||||
float selectorHeight = 30f;
|
||||
|
||||
// Заголовок
|
||||
Widgets.Label(
|
||||
new Rect(rect.x, curY, rect.width * 0.4f, selectorHeight),
|
||||
"AIImages.ImageType.Label".Translate() + ":"
|
||||
);
|
||||
|
||||
// Радио-кнопки для выбора типа
|
||||
float radioX = rect.x + rect.width * 0.45f;
|
||||
float radioWidth = rect.width * 0.25f;
|
||||
float radioSpacing = 5f;
|
||||
|
||||
// Портрет
|
||||
Rect portraitRect = new Rect(radioX, curY + 2f, radioWidth, selectorHeight - 4f);
|
||||
bool isPortrait = generationSettings.ImageType == Models.ImageType.Portrait;
|
||||
if (
|
||||
Widgets.RadioButtonLabeled(
|
||||
portraitRect,
|
||||
"AIImages.ImageType.Portrait".Translate(),
|
||||
isPortrait
|
||||
) && !isPortrait
|
||||
)
|
||||
{
|
||||
generationSettings.ImageType = Models.ImageType.Portrait;
|
||||
// Обновляем настройки в глобальных настройках
|
||||
AIImagesMod.Settings.imageType = Models.ImageType.Portrait;
|
||||
// При смене на портрет, можно изменить размеры на более квадратные
|
||||
if (generationSettings.Width > generationSettings.Height)
|
||||
{
|
||||
generationSettings.Height = generationSettings.Width;
|
||||
}
|
||||
}
|
||||
|
||||
// Полное тело
|
||||
Rect fullBodyRect = new Rect(
|
||||
radioX + radioWidth + radioSpacing,
|
||||
curY + 2f,
|
||||
radioWidth,
|
||||
selectorHeight - 4f
|
||||
);
|
||||
bool isFullBody = generationSettings.ImageType == Models.ImageType.FullBody;
|
||||
if (
|
||||
Widgets.RadioButtonLabeled(
|
||||
fullBodyRect,
|
||||
"AIImages.ImageType.FullBody".Translate(),
|
||||
isFullBody
|
||||
) && !isFullBody
|
||||
)
|
||||
{
|
||||
generationSettings.ImageType = Models.ImageType.FullBody;
|
||||
// Обновляем настройки в глобальных настройках
|
||||
AIImagesMod.Settings.imageType = Models.ImageType.FullBody;
|
||||
// При смене на полное тело, можно увеличить высоту
|
||||
if (generationSettings.Width >= generationSettings.Height)
|
||||
{
|
||||
generationSettings.Height = (int)(generationSettings.Width * 1.5f);
|
||||
}
|
||||
}
|
||||
|
||||
return curY + selectorHeight + 10f;
|
||||
}
|
||||
|
||||
private float DrawImagePreview(Rect rect, float curY)
|
||||
{
|
||||
if (generatedImage != null)
|
||||
|
||||
Reference in New Issue
Block a user