diff --git a/Assemblies/AIImages.dll b/Assemblies/AIImages.dll index cf9e1cb..6c02d36 100644 Binary files a/Assemblies/AIImages.dll and b/Assemblies/AIImages.dll differ diff --git a/Languages/English/Keyed/AIImages.xml b/Languages/English/Keyed/AIImages.xml index a5af5b9..3c26cac 100644 --- a/Languages/English/Keyed/AIImages.xml +++ b/Languages/English/Keyed/AIImages.xml @@ -29,7 +29,11 @@ Color: {0} Stable Diffusion Prompt + Positive Prompt + Negative Prompt Copy Prompt + Copy Positive + Copy Negative Copied! Generate Image diff --git a/Languages/Russian/Keyed/AIImages.xml b/Languages/Russian/Keyed/AIImages.xml index c1f9852..41333ff 100644 --- a/Languages/Russian/Keyed/AIImages.xml +++ b/Languages/Russian/Keyed/AIImages.xml @@ -29,7 +29,11 @@ Цвет: {0} Промпт Stable Diffusion + Позитивный промпт + Негативный промпт Копировать промпт + Копировать позитивный + Копировать негативный Скопировано! Сгенерировать изображение diff --git a/Source/AIImages/Window_AIImage.cs b/Source/AIImages/Window_AIImage.cs index 2aaee78..0aca3d5 100644 --- a/Source/AIImages/Window_AIImage.cs +++ b/Source/AIImages/Window_AIImage.cs @@ -71,6 +71,7 @@ namespace AIImages private Vector2 scrollPosition = Vector2.zero; private Vector2 promptScrollPosition = Vector2.zero; + private Vector2 negativePromptScrollPosition = Vector2.zero; private float copiedMessageTime = 0f; /// @@ -445,58 +446,97 @@ namespace AIImages curY = DrawProgressBar(rect, curY); curY = DrawGenerationButton(rect, curY); - // Промпт секция + // Позитивный промпт секция Text.Font = GameFont.Medium; Widgets.Label( new Rect(rect.x, rect.y + curY, rect.width, 30f), - "AIImages.Prompt.SectionTitle".Translate() + "AIImages.Prompt.PositiveTitle".Translate() ); curY += 35f; - // Получаем промпт + // Получаем позитивный промпт Text.Font = GameFont.Tiny; - string promptText = promptGeneratorService.GeneratePositivePrompt( + string positivePrompt = promptGeneratorService.GeneratePositivePrompt( appearanceData, generationSettings ); // Фиксированная высота для области промпта - float promptBoxHeight = 150f; - float actualPromptHeight = Text.CalcHeight(promptText, rect.width - 20f); + float promptBoxHeight = 100f; + float actualPositiveHeight = Text.CalcHeight(positivePrompt, rect.width - 20f); - Rect promptOuterRect = new Rect(rect.x, rect.y + curY, rect.width, promptBoxHeight); - Rect promptViewRect = new Rect(0f, 0f, rect.width - 20f, actualPromptHeight); + Rect positiveOuterRect = new Rect(rect.x, rect.y + curY, rect.width, promptBoxHeight); + Rect positiveViewRect = new Rect(0f, 0f, rect.width - 20f, actualPositiveHeight); // Рисуем фон - Widgets.DrawBoxSolid(promptOuterRect, new Color(0.1f, 0.1f, 0.1f, 0.5f)); + Widgets.DrawBoxSolid(positiveOuterRect, new Color(0.1f, 0.3f, 0.1f, 0.5f)); // Рисуем промпт с прокруткой Widgets.BeginScrollView( - promptOuterRect.ContractedBy(5f), + positiveOuterRect.ContractedBy(5f), ref promptScrollPosition, - promptViewRect + positiveViewRect ); Widgets.Label( - new Rect(0f, 0f, promptViewRect.width, promptViewRect.height), - promptText + new Rect(0f, 0f, positiveViewRect.width, positiveViewRect.height), + positivePrompt ); Widgets.EndScrollView(); curY += promptBoxHeight + 10f; - // Кнопка копирования промпта + // Негативный промпт секция + Text.Font = GameFont.Medium; + Widgets.Label( + new Rect(rect.x, rect.y + curY, rect.width, 30f), + "AIImages.Prompt.NegativeTitle".Translate() + ); + curY += 35f; + + // Получаем негативный промпт + Text.Font = GameFont.Tiny; + string negativePrompt = promptGeneratorService.GenerateNegativePrompt( + generationSettings + ); + + float actualNegativeHeight = Text.CalcHeight(negativePrompt, rect.width - 20f); + + Rect negativeOuterRect = new Rect(rect.x, rect.y + curY, rect.width, promptBoxHeight); + Rect negativeViewRect = new Rect(0f, 0f, rect.width - 20f, actualNegativeHeight); + + // Рисуем фон (красноватый для негативного) + Widgets.DrawBoxSolid(negativeOuterRect, new Color(0.3f, 0.1f, 0.1f, 0.5f)); + + // Рисуем промпт с прокруткой + Widgets.BeginScrollView( + negativeOuterRect.ContractedBy(5f), + ref negativePromptScrollPosition, + negativeViewRect + ); + Widgets.Label( + new Rect(0f, 0f, negativeViewRect.width, negativeViewRect.height), + negativePrompt + ); + Widgets.EndScrollView(); + + curY += promptBoxHeight + 10f; + + // Кнопки копирования промптов if ( Widgets.ButtonText( new Rect(rect.x, rect.y + curY, rect.width / 2f - 5f, 30f), - "AIImages.Prompt.CopyButton".Translate() + "AIImages.Prompt.CopyPositive".Translate() ) ) { - GUIUtility.systemCopyBuffer = promptText; + string positiveForCopy = promptGeneratorService.GeneratePositivePrompt( + appearanceData, + generationSettings + ); + GUIUtility.systemCopyBuffer = positiveForCopy; copiedMessageTime = 2f; } - // Кнопка обновления данных if ( Widgets.ButtonText( new Rect( @@ -505,6 +545,22 @@ namespace AIImages rect.width / 2f - 5f, 30f ), + "AIImages.Prompt.CopyNegative".Translate() + ) + ) + { + string negativeForCopy = promptGeneratorService.GenerateNegativePrompt( + generationSettings + ); + GUIUtility.systemCopyBuffer = negativeForCopy; + copiedMessageTime = 2f; + } + curY += 35f; + + // Кнопка обновления данных + if ( + Widgets.ButtonText( + new Rect(rect.x, rect.y + curY, rect.width, 30f), "AIImages.Window.Refresh".Translate() ) ) @@ -556,6 +612,28 @@ namespace AIImages // Дополнительный отступ height += 50f; + // Позитивный промпт заголовок + height += 35f; + // Позитивный промпт контент + height += 100f + 10f; + + // Негативный промпт заголовок + height += 35f; + // Негативный промпт контент + height += 100f + 10f; + + // Кнопки копирования + height += 35f; + + // Кнопка обновления + height += 35f; + + // Сообщение о копировании + if (copiedMessageTime > 0f) + { + height += 30f; + } + return height; }