Refactor AIImages UI layout for improved positioning and consistency. Remove ShotType settings and related code to simplify prompt generation. Update models to include new properties for hair and apparel definitions, enhancing data handling for character appearance.

This commit is contained in:
Leonid Pershin
2025-10-26 18:23:40 +03:00
parent 0f60721162
commit 6715544952
8 changed files with 100 additions and 99 deletions

View File

@@ -269,8 +269,8 @@ namespace AIImages
{
float imageSize = Mathf.Min(rect.width, 400f);
Rect imageRect = new Rect(
(rect.width - imageSize) / 2f,
curY,
rect.x + (rect.width - imageSize) / 2f,
rect.y + curY,
imageSize,
imageSize
);
@@ -282,8 +282,8 @@ namespace AIImages
// Placeholder для изображения
float placeholderSize = Mathf.Min(rect.width, 300f);
Rect placeholderRect = new Rect(
(rect.width - placeholderSize) / 2f,
curY,
rect.x + (rect.width - placeholderSize) / 2f,
rect.y + curY,
placeholderSize,
placeholderSize
);
@@ -299,7 +299,10 @@ namespace AIImages
{
Text.Font = GameFont.Small;
float statusHeight = Text.CalcHeight(generationStatus, rect.width);
Widgets.Label(new Rect(0f, curY, rect.width, statusHeight), generationStatus);
Widgets.Label(
new Rect(rect.x, rect.y + curY, rect.width, statusHeight),
generationStatus
);
curY += statusHeight + 10f;
}
@@ -307,7 +310,7 @@ namespace AIImages
Text.Font = GameFont.Small;
if (
Widgets.ButtonText(
new Rect(0f, curY, rect.width, 35f),
new Rect(rect.x, rect.y + curY, rect.width, 35f),
isGenerating
? "AIImages.Generation.Generating".Translate()
: "AIImages.Generation.Generate".Translate()
@@ -321,7 +324,7 @@ namespace AIImages
// Промпт секция
Text.Font = GameFont.Medium;
Widgets.Label(
new Rect(0f, curY, rect.width, 30f),
new Rect(rect.x, rect.y + curY, rect.width, 30f),
"AIImages.Prompt.SectionTitle".Translate()
);
curY += 35f;
@@ -334,7 +337,7 @@ namespace AIImages
);
float promptHeight = Mathf.Min(Text.CalcHeight(promptText, rect.width), 150f);
Rect promptRect = new Rect(0f, curY, rect.width, promptHeight);
Rect promptRect = new Rect(rect.x, rect.y + curY, rect.width, promptHeight);
// Рисуем промпт в скроллируемой области если он длинный
Widgets.DrawBoxSolid(promptRect, new Color(0.1f, 0.1f, 0.1f, 0.5f));
@@ -344,7 +347,7 @@ namespace AIImages
// Кнопка копирования промпта
if (
Widgets.ButtonText(
new Rect(0f, curY, rect.width / 2f - 5f, 30f),
new Rect(rect.x, rect.y + curY, rect.width / 2f - 5f, 30f),
"AIImages.Prompt.CopyButton".Translate()
)
)
@@ -356,7 +359,12 @@ namespace AIImages
// Кнопка обновления данных
if (
Widgets.ButtonText(
new Rect(rect.width / 2f + 5f, curY, rect.width / 2f - 5f, 30f),
new Rect(
rect.x + rect.width / 2f + 5f,
rect.y + curY,
rect.width / 2f - 5f,
30f
),
"AIImages.Window.Refresh".Translate()
)
)
@@ -370,7 +378,7 @@ namespace AIImages
curY += 35f;
GUI.color = new Color(0f, 1f, 0f, copiedMessageTime / 2f);
Widgets.Label(
new Rect(0f, curY, rect.width, 25f),
new Rect(rect.x, rect.y + curY, rect.width, 25f),
"AIImages.Prompt.Copied".Translate()
);
GUI.color = Color.white;