2026-10-19 20:14:24 +03:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.UI;
|
|
|
|
|
|
using UnityEngine.EventSystems;
|
|
|
|
|
|
using UnityEngine.InputSystem.UI;
|
|
|
|
|
|
using UnityEngine.Rendering.Universal;
|
|
|
|
|
|
using UnityEditor;
|
|
|
|
|
|
using UnityEditor.SceneManagement;
|
|
|
|
|
|
using UnityEngine.SceneManagement;
|
|
|
|
|
|
|
|
|
|
|
|
public static class MainMenuSceneBuilder
|
|
|
|
|
|
{
|
|
|
|
|
|
private static DefaultControls.Resources uiResources;
|
|
|
|
|
|
private static Font standardFont;
|
2026-10-21 22:17:24 +03:00
|
|
|
|
private static Font handwrittenFont;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
|
|
|
|
|
[MenuItem("Tools/Build Main Menu Scene")]
|
|
|
|
|
|
public static string BuildScene()
|
|
|
|
|
|
{
|
|
|
|
|
|
standardFont = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
|
2026-10-21 22:17:24 +03:00
|
|
|
|
if (standardFont == null)
|
|
|
|
|
|
standardFont = Resources.GetBuiltinResource<Font>("Arial.ttf");
|
|
|
|
|
|
|
|
|
|
|
|
// Загрузка рукописного шрифта для названия Synthesia
|
|
|
|
|
|
handwrittenFont = AssetDatabase.LoadAssetAtPath<Font>("Assets/Fonts/SegoeScriptBold.ttf");
|
|
|
|
|
|
if (handwrittenFont == null)
|
|
|
|
|
|
handwrittenFont = AssetDatabase.LoadAssetAtPath<Font>("Assets/Fonts/Inkfree.ttf");
|
|
|
|
|
|
if (handwrittenFont == null)
|
|
|
|
|
|
handwrittenFont = AssetDatabase.LoadAssetAtPath<Font>("Assets/Fonts/MonotypeCorsiva.ttf");
|
|
|
|
|
|
if (handwrittenFont == null)
|
|
|
|
|
|
handwrittenFont = standardFont;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
|
|
|
|
|
uiResources = new DefaultControls.Resources
|
|
|
|
|
|
{
|
|
|
|
|
|
standard = AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/UISprite.psd"),
|
|
|
|
|
|
background = AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/Background.psd"),
|
|
|
|
|
|
knob = AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/Knob.psd"),
|
|
|
|
|
|
checkmark = AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/Checkmark.psd"),
|
|
|
|
|
|
dropdown = AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/DropdownArrow.psd"),
|
|
|
|
|
|
mask = AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/UIMask.psd")
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
// Создаем новую пустую сцену
|
|
|
|
|
|
Scene newScene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// 1. Камера (Абсолютно черный фон)
|
2026-10-19 20:14:24 +03:00
|
|
|
|
GameObject camGo = new GameObject("Main Camera");
|
|
|
|
|
|
Camera cam = camGo.AddComponent<Camera>();
|
|
|
|
|
|
cam.clearFlags = CameraClearFlags.SolidColor;
|
2026-10-21 22:17:24 +03:00
|
|
|
|
cam.backgroundColor = Color.black;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
camGo.AddComponent<UniversalAdditionalCameraData>();
|
|
|
|
|
|
camGo.AddComponent<AudioListener>();
|
|
|
|
|
|
camGo.tag = "MainCamera";
|
|
|
|
|
|
camGo.transform.position = new Vector3(0, 0, -10);
|
|
|
|
|
|
|
|
|
|
|
|
// 2. EventSystem
|
|
|
|
|
|
GameObject eventSysGo = new GameObject("EventSystem");
|
|
|
|
|
|
eventSysGo.AddComponent<EventSystem>();
|
|
|
|
|
|
eventSysGo.AddComponent<InputSystemUIInputModule>();
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// 3. Canvas (1920x1080)
|
2026-10-19 20:14:24 +03:00
|
|
|
|
GameObject canvasGo = new GameObject("Canvas");
|
|
|
|
|
|
Canvas canvas = canvasGo.AddComponent<Canvas>();
|
|
|
|
|
|
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
|
|
|
|
|
canvas.pixelPerfect = true;
|
|
|
|
|
|
|
|
|
|
|
|
CanvasScaler scaler = canvasGo.AddComponent<CanvasScaler>();
|
|
|
|
|
|
scaler.uiScaleMode = CanvasScaler.ScaleMode.ScaleWithScreenSize;
|
|
|
|
|
|
scaler.referenceResolution = new Vector2(1920, 1080);
|
|
|
|
|
|
scaler.screenMatchMode = CanvasScaler.ScreenMatchMode.MatchWidthOrHeight;
|
|
|
|
|
|
scaler.matchWidthOrHeight = 0.5f;
|
|
|
|
|
|
|
|
|
|
|
|
canvasGo.AddComponent<GraphicRaycaster>();
|
|
|
|
|
|
|
|
|
|
|
|
// 4. Менеджер Главного Меню
|
|
|
|
|
|
GameObject managerGo = new GameObject("MainMenuManager");
|
|
|
|
|
|
MainMenuManager manager = managerGo.AddComponent<MainMenuManager>();
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// 5. Задний фон: Чистый глубокий черный цвет
|
|
|
|
|
|
CreateImage("Background_Black", canvasGo.transform,
|
|
|
|
|
|
Color.black,
|
2026-10-19 20:14:24 +03:00
|
|
|
|
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// ==========================================
|
|
|
|
|
|
// 6. АНИМИРОВАННЫЕ ЖЕЛТЫЕ ВОЛНЫ ЭХОЛОКАЦИИ В ПРАВОМ НИЖНЕМ УГЛУ
|
|
|
|
|
|
// ==========================================
|
|
|
|
|
|
GameObject radarRoot = CreateEmptyRect("Corner_Echolocation_Radar", canvasGo.transform,
|
|
|
|
|
|
new Vector2(1f, 0f), new Vector2(1f, 0f),
|
|
|
|
|
|
new Vector2(280f, 280f), new Vector2(-140f, 140f));
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
MenuEcholocationRadar echoRadar = radarRoot.AddComponent<MenuEcholocationRadar>();
|
2026-10-23 15:44:09 +03:00
|
|
|
|
echoRadar.maxSimultaneousWaves = 3;
|
|
|
|
|
|
echoRadar.waveMaxRadius = 1800f; // Расходится на весь экран
|
|
|
|
|
|
echoRadar.waveSpeed = 180f;
|
|
|
|
|
|
echoRadar.waveSpawnInterval = 2.4f;
|
|
|
|
|
|
echoRadar.initialThickness = 110f;
|
|
|
|
|
|
echoRadar.maxThickness = 360f;
|
|
|
|
|
|
echoRadar.waveBaseColor = new Color(1.00f, 0.82f, 0.18f, 0.40f); // Теплая янтарная дымка
|
|
|
|
|
|
echoRadar.waveCoreColor = new Color(1.00f, 0.94f, 0.50f, 0.65f); // Мягкое золотистое ядро
|
|
|
|
|
|
echoRadar.beaconColor = new Color(1.00f, 0.88f, 0.20f, 0.85f);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-23 15:44:09 +03:00
|
|
|
|
// Без лишних рамок/квадратов в углу — только чистые волны эхолокации
|
|
|
|
|
|
echoRadar.radarBeaconDot = null;
|
|
|
|
|
|
echoRadar.radarReticle = null;
|
2026-10-21 22:17:24 +03:00
|
|
|
|
|
|
|
|
|
|
// ==========================================
|
|
|
|
|
|
// 7. НАЗВАНИЕ ИГРЫ: "Synthesia" В ЦЕНТРЕ (РУКОПИСНЫЙ ШРИФТ)
|
|
|
|
|
|
// ==========================================
|
2026-10-19 20:14:24 +03:00
|
|
|
|
GameObject headerContainer = CreateEmptyRect("Header_Container", canvasGo.transform,
|
2026-10-21 22:17:24 +03:00
|
|
|
|
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
|
|
|
|
|
new Vector2(1100f, 200f), new Vector2(0f, 210f));
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
GameObject titleObj = CreateTextWithFont("Title_Synthesia", headerContainer.transform,
|
|
|
|
|
|
"Synthesia",
|
|
|
|
|
|
handwrittenFont,
|
|
|
|
|
|
110, FontStyle.Bold, TextAnchor.MiddleCenter,
|
|
|
|
|
|
new Color(1.0f, 1.0f, 1.0f, 1.0f),
|
|
|
|
|
|
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// Теплый желтый ореол свечения
|
|
|
|
|
|
Outline titleGlow = titleObj.AddComponent<Outline>();
|
|
|
|
|
|
titleGlow.effectColor = new Color(1.00f, 0.85f, 0.10f, 0.50f);
|
|
|
|
|
|
titleGlow.effectDistance = new Vector2(2.5f, -2.5f);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
Shadow titleShadow = titleObj.AddComponent<Shadow>();
|
|
|
|
|
|
titleShadow.effectColor = new Color(0.12f, 0.10f, 0.00f, 0.80f);
|
|
|
|
|
|
titleShadow.effectDistance = new Vector2(4f, -4f);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// ==========================================
|
|
|
|
|
|
// 8. КНОПКИ В ЦЕНТРЕ (БОЛЬШИЕ, ЯРКИЕ ЖЕЛТЫЕ, ОЧЕВИДНО НЕ ЧЕРНЫЕ)
|
|
|
|
|
|
// ==========================================
|
2026-10-19 20:14:24 +03:00
|
|
|
|
GameObject mainMenuPanel = CreateEmptyRect("MainMenuPanel", canvasGo.transform,
|
2026-10-21 22:17:24 +03:00
|
|
|
|
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
|
|
|
|
|
new Vector2(620f, 380f), new Vector2(0f, -110f));
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
|
|
|
|
|
VerticalLayoutGroup menuLayout = mainMenuPanel.AddComponent<VerticalLayoutGroup>();
|
2026-10-21 22:17:24 +03:00
|
|
|
|
menuLayout.childAlignment = TextAnchor.MiddleCenter;
|
|
|
|
|
|
menuLayout.spacing = 24f;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
menuLayout.childControlWidth = true;
|
2026-10-21 22:17:24 +03:00
|
|
|
|
menuLayout.childControlHeight = true;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
menuLayout.childForceExpandWidth = true;
|
|
|
|
|
|
menuLayout.childForceExpandHeight = false;
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// Яркий золотисто-желтый цвет кнопок с глубоким черным текстом (очевидно не черные)
|
|
|
|
|
|
Color yellowBtnNormal = new Color(0.95f, 0.78f, 0.12f, 1.00f);
|
|
|
|
|
|
Color yellowBtnHover = new Color(1.00f, 0.90f, 0.35f, 1.00f);
|
|
|
|
|
|
Color yellowBtnPress = new Color(0.78f, 0.62f, 0.08f, 1.00f);
|
|
|
|
|
|
Color blackBtnText = new Color(0.06f, 0.06f, 0.06f, 1.00f);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// Кнопка 1: "ИГРАТЬ"
|
|
|
|
|
|
Button playBtn = CreateBigMenuButton("Button_Play", mainMenuPanel.transform,
|
|
|
|
|
|
"ИГРАТЬ",
|
|
|
|
|
|
yellowBtnNormal,
|
|
|
|
|
|
yellowBtnHover,
|
|
|
|
|
|
yellowBtnPress,
|
|
|
|
|
|
blackBtnText,
|
|
|
|
|
|
90f, 34);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// Кнопка 2: "НАСТРОЙКИ"
|
|
|
|
|
|
Button settingsBtn = CreateBigMenuButton("Button_Settings", mainMenuPanel.transform,
|
|
|
|
|
|
"НАСТРОЙКИ",
|
|
|
|
|
|
yellowBtnNormal,
|
|
|
|
|
|
yellowBtnHover,
|
|
|
|
|
|
yellowBtnPress,
|
|
|
|
|
|
blackBtnText,
|
|
|
|
|
|
90f, 34);
|
|
|
|
|
|
|
|
|
|
|
|
// Кнопка 3: "ВЫХОД"
|
|
|
|
|
|
Button quitBtn = CreateBigMenuButton("Button_Quit", mainMenuPanel.transform,
|
|
|
|
|
|
"ВЫХОД",
|
|
|
|
|
|
yellowBtnNormal,
|
|
|
|
|
|
yellowBtnHover,
|
|
|
|
|
|
yellowBtnPress,
|
|
|
|
|
|
blackBtnText,
|
|
|
|
|
|
90f, 34);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
|
|
|
|
|
// ==========================================
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// 9. ПАНЕЛЬ НАСТРОЕК (В ЧЕРНО-ЖЕЛТОМ СТИЛЕ)
|
2026-10-19 20:14:24 +03:00
|
|
|
|
// ==========================================
|
|
|
|
|
|
GameObject settingsPanel = CreateEmptyRect("SettingsPanel", canvasGo.transform,
|
|
|
|
|
|
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
|
|
|
|
|
|
|
|
|
|
|
// Затемняющий фон
|
|
|
|
|
|
CreateImage("Backdrop_Dim", settingsPanel.transform,
|
2026-10-21 22:17:24 +03:00
|
|
|
|
new Color(0.0f, 0.0f, 0.0f, 0.92f),
|
2026-10-19 20:14:24 +03:00
|
|
|
|
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// Модальное окно настроек
|
2026-10-19 20:14:24 +03:00
|
|
|
|
GameObject settingsCard = CreateImage("Settings_Card", settingsPanel.transform,
|
2026-10-21 22:17:24 +03:00
|
|
|
|
new Color(0.04f, 0.04f, 0.04f, 0.98f),
|
2026-10-19 20:14:24 +03:00
|
|
|
|
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
2026-10-21 22:17:24 +03:00
|
|
|
|
new Vector2(920f, 740f), Vector2.zero);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
|
|
|
|
|
Outline panelOutline = settingsCard.AddComponent<Outline>();
|
2026-10-21 22:17:24 +03:00
|
|
|
|
panelOutline.effectColor = new Color(1.00f, 0.85f, 0.10f, 0.55f);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
panelOutline.effectDistance = new Vector2(2f, -2f);
|
|
|
|
|
|
|
|
|
|
|
|
CreateText("Settings_Header", settingsCard.transform,
|
2026-10-21 22:17:24 +03:00
|
|
|
|
"НАСТРОЙКИ",
|
2026-10-19 20:14:24 +03:00
|
|
|
|
28, FontStyle.Bold, TextAnchor.MiddleCenter,
|
2026-10-21 22:17:24 +03:00
|
|
|
|
new Color(1.00f, 0.85f, 0.10f, 1.0f),
|
2026-10-19 20:14:24 +03:00
|
|
|
|
new Vector2(0.05f, 0.90f), new Vector2(0.95f, 0.98f), Vector2.zero, Vector2.zero);
|
|
|
|
|
|
|
|
|
|
|
|
CreateImage("Settings_Divider", settingsCard.transform,
|
2026-10-21 22:17:24 +03:00
|
|
|
|
new Color(1.00f, 0.85f, 0.10f, 0.40f),
|
2026-10-19 20:14:24 +03:00
|
|
|
|
new Vector2(0.05f, 0.89f), new Vector2(0.95f, 0.895f), Vector2.zero, Vector2.zero);
|
|
|
|
|
|
|
|
|
|
|
|
// Контейнер списка настроек
|
|
|
|
|
|
GameObject settingsList = CreateEmptyRect("Settings_List", settingsCard.transform,
|
|
|
|
|
|
new Vector2(0.06f, 0.14f), new Vector2(0.94f, 0.87f), Vector2.zero, Vector2.zero);
|
|
|
|
|
|
|
|
|
|
|
|
VerticalLayoutGroup settingsLayout = settingsList.AddComponent<VerticalLayoutGroup>();
|
2026-10-21 22:17:24 +03:00
|
|
|
|
settingsLayout.spacing = 15f;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
settingsLayout.childAlignment = TextAnchor.UpperCenter;
|
|
|
|
|
|
settingsLayout.childControlWidth = true;
|
|
|
|
|
|
settingsLayout.childControlHeight = false;
|
|
|
|
|
|
settingsLayout.childForceExpandWidth = true;
|
|
|
|
|
|
settingsLayout.childForceExpandHeight = false;
|
|
|
|
|
|
|
|
|
|
|
|
// --- Раздел: Звук ---
|
2026-10-21 22:17:24 +03:00
|
|
|
|
CreateCategoryHeader("HEADER_AUDIO", settingsList.transform, "— ЗВУК И ЭХОЛОКАЦИЯ —");
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
var volumeRow = CreateSliderRow("Row_Volume", settingsList.transform, "Громкость звука", 0f, 1f, 1f, "%");
|
2026-10-19 20:14:24 +03:00
|
|
|
|
Slider volSlider = volumeRow.slider;
|
|
|
|
|
|
Text volText = volumeRow.valueText;
|
|
|
|
|
|
|
|
|
|
|
|
Toggle muteToggle = CreateToggleRow("Row_Mute", settingsList.transform, "Отключить звук (Mute)");
|
|
|
|
|
|
|
|
|
|
|
|
// --- Раздел: Графика ---
|
2026-10-21 22:17:24 +03:00
|
|
|
|
CreateCategoryHeader("HEADER_GRAPHICS", settingsList.transform, "— ГРАФИКА —");
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
|
|
|
|
|
Dropdown qualityDropdown = CreateDropdownRow("Row_Quality", settingsList.transform, "Качество графики");
|
|
|
|
|
|
Toggle fullscreenToggle = CreateToggleRow("Row_Fullscreen", settingsList.transform, "Полноэкранный режим");
|
|
|
|
|
|
Dropdown resolutionDropdown = CreateDropdownRow("Row_Resolution", settingsList.transform, "Разрешение экрана");
|
|
|
|
|
|
|
|
|
|
|
|
// --- Раздел: Управление ---
|
|
|
|
|
|
CreateCategoryHeader("HEADER_CONTROLS", settingsList.transform, "— УПРАВЛЕНИЕ —");
|
|
|
|
|
|
|
|
|
|
|
|
var sensRow = CreateSliderRow("Row_Sensitivity", settingsList.transform, "Чувствительность мыши", 0.2f, 3.0f, 1.0f, "x");
|
|
|
|
|
|
Slider sensSlider = sensRow.slider;
|
|
|
|
|
|
Text sensText = sensRow.valueText;
|
|
|
|
|
|
|
|
|
|
|
|
// Нижняя строка кнопок в панели настроек
|
|
|
|
|
|
GameObject bottomButtonsRow = CreateEmptyRect("Settings_BottomButtons", settingsCard.transform,
|
|
|
|
|
|
new Vector2(0.06f, 0.03f), new Vector2(0.94f, 0.12f), Vector2.zero, Vector2.zero);
|
|
|
|
|
|
|
|
|
|
|
|
HorizontalLayoutGroup bottomLayout = bottomButtonsRow.AddComponent<HorizontalLayoutGroup>();
|
|
|
|
|
|
bottomLayout.spacing = 30f;
|
|
|
|
|
|
bottomLayout.childAlignment = TextAnchor.MiddleCenter;
|
|
|
|
|
|
bottomLayout.childControlWidth = true;
|
|
|
|
|
|
bottomLayout.childControlHeight = true;
|
|
|
|
|
|
bottomLayout.childForceExpandWidth = true;
|
|
|
|
|
|
bottomLayout.childForceExpandHeight = true;
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
Button resetBtn = CreateBigMenuButton("Button_ResetDefaults", bottomButtonsRow.transform,
|
|
|
|
|
|
"Сброс",
|
|
|
|
|
|
new Color(0.35f, 0.15f, 0.15f, 1.0f),
|
|
|
|
|
|
new Color(0.50f, 0.20f, 0.20f, 1.0f),
|
|
|
|
|
|
new Color(0.65f, 0.25f, 0.25f, 1.0f),
|
|
|
|
|
|
Color.white,
|
2026-10-19 20:14:24 +03:00
|
|
|
|
50f, 18);
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
Button backBtn = CreateBigMenuButton("Button_Back", bottomButtonsRow.transform,
|
|
|
|
|
|
"Применить и выйти",
|
|
|
|
|
|
new Color(0.95f, 0.78f, 0.12f, 1.0f),
|
|
|
|
|
|
new Color(1.00f, 0.90f, 0.35f, 1.0f),
|
|
|
|
|
|
new Color(0.78f, 0.62f, 0.08f, 1.0f),
|
|
|
|
|
|
new Color(0.06f, 0.06f, 0.06f, 1.0f),
|
|
|
|
|
|
50f, 18);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
|
|
|
|
|
// ==========================================
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// 10. ПАНЕЛЬ ЗАГРУЗКИ (LOADING PANEL)
|
2026-10-19 20:14:24 +03:00
|
|
|
|
// ==========================================
|
|
|
|
|
|
GameObject loadingPanel = CreateImage("LoadingPanel", canvasGo.transform,
|
2026-10-21 22:17:24 +03:00
|
|
|
|
new Color(0f, 0f, 0f, 0.98f),
|
2026-10-19 20:14:24 +03:00
|
|
|
|
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
|
|
|
|
|
|
|
|
|
|
|
GameObject loadingContainer = CreateEmptyRect("Loading_Container", loadingPanel.transform,
|
|
|
|
|
|
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
2026-10-21 22:17:24 +03:00
|
|
|
|
new Vector2(640f, 220f), Vector2.zero);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
CreateTextWithFont("Loading_Title", loadingContainer.transform,
|
|
|
|
|
|
"Synthesia",
|
|
|
|
|
|
handwrittenFont,
|
|
|
|
|
|
52, FontStyle.Bold, TextAnchor.MiddleCenter,
|
|
|
|
|
|
new Color(1.00f, 0.85f, 0.10f, 1.0f),
|
|
|
|
|
|
new Vector2(0f, 0.65f), new Vector2(1f, 1f), Vector2.zero, Vector2.zero);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
|
|
|
|
|
GameObject sliderObj = DefaultControls.CreateSlider(uiResources);
|
|
|
|
|
|
sliderObj.name = "Loading_ProgressBar";
|
|
|
|
|
|
sliderObj.transform.SetParent(loadingContainer.transform, false);
|
|
|
|
|
|
RectTransform sliderRt = sliderObj.GetComponent<RectTransform>();
|
2026-10-21 22:17:24 +03:00
|
|
|
|
sliderRt.anchorMin = new Vector2(0.05f, 0.38f);
|
|
|
|
|
|
sliderRt.anchorMax = new Vector2(0.95f, 0.52f);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
sliderRt.offsetMin = Vector2.zero;
|
|
|
|
|
|
sliderRt.offsetMax = Vector2.zero;
|
|
|
|
|
|
|
|
|
|
|
|
Slider loadingSlider = sliderObj.GetComponent<Slider>();
|
|
|
|
|
|
loadingSlider.interactable = false;
|
|
|
|
|
|
Transform fillTransform = sliderObj.transform.Find("Fill Area/Fill");
|
|
|
|
|
|
if (fillTransform != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
Image fillImg = fillTransform.GetComponent<Image>();
|
2026-10-21 22:17:24 +03:00
|
|
|
|
if (fillImg != null) fillImg.color = new Color(1.00f, 0.85f, 0.10f, 1f);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
GameObject loadingPercent = CreateText("Loading_Text", loadingContainer.transform,
|
2026-10-21 22:17:24 +03:00
|
|
|
|
"Загрузка...",
|
2026-10-19 20:14:24 +03:00
|
|
|
|
18, FontStyle.Normal, TextAnchor.MiddleCenter,
|
2026-10-21 22:17:24 +03:00
|
|
|
|
new Color(0.95f, 0.95f, 0.95f, 0.9f),
|
2026-10-19 20:14:24 +03:00
|
|
|
|
new Vector2(0f, 0f), new Vector2(1f, 0.30f), Vector2.zero, Vector2.zero);
|
|
|
|
|
|
Text loadingText = loadingPercent.GetComponent<Text>();
|
|
|
|
|
|
|
|
|
|
|
|
// ==========================================
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// 11. ПРИВЯЗКА К MAINMENUMANAGER
|
2026-10-19 20:14:24 +03:00
|
|
|
|
// ==========================================
|
|
|
|
|
|
manager.headerContainer = headerContainer;
|
|
|
|
|
|
manager.mainMenuPanel = mainMenuPanel;
|
|
|
|
|
|
manager.settingsPanel = settingsPanel;
|
|
|
|
|
|
manager.loadingPanel = loadingPanel;
|
|
|
|
|
|
manager.loadingSlider = loadingSlider;
|
|
|
|
|
|
manager.loadingText = loadingText;
|
|
|
|
|
|
manager.volumeSlider = volSlider;
|
|
|
|
|
|
manager.volumeValueText = volText;
|
|
|
|
|
|
manager.muteToggle = muteToggle;
|
|
|
|
|
|
manager.qualityDropdown = qualityDropdown;
|
|
|
|
|
|
manager.fullscreenToggle = fullscreenToggle;
|
|
|
|
|
|
manager.resolutionDropdown = resolutionDropdown;
|
|
|
|
|
|
manager.sensitivitySlider = sensSlider;
|
|
|
|
|
|
manager.sensitivityValueText = sensText;
|
2026-10-21 22:17:24 +03:00
|
|
|
|
manager.gameSceneName = "SampleScene";
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// Привязываем кнопки через UnityEvent
|
2026-10-19 20:14:24 +03:00
|
|
|
|
UnityEditor.Events.UnityEventTools.AddPersistentListener(playBtn.onClick, manager.PlayGame);
|
|
|
|
|
|
UnityEditor.Events.UnityEventTools.AddPersistentListener(settingsBtn.onClick, manager.OpenSettings);
|
|
|
|
|
|
UnityEditor.Events.UnityEventTools.AddPersistentListener(quitBtn.onClick, manager.QuitGame);
|
|
|
|
|
|
UnityEditor.Events.UnityEventTools.AddPersistentListener(resetBtn.onClick, manager.ResetToDefaults);
|
2026-10-21 22:17:24 +03:00
|
|
|
|
UnityEditor.Events.UnityEventTools.AddPersistentListener(backBtn.onClick, manager.CloseSettings);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// По умолчанию активны главное меню и радар
|
2026-10-19 20:14:24 +03:00
|
|
|
|
settingsPanel.SetActive(false);
|
|
|
|
|
|
loadingPanel.SetActive(false);
|
2026-10-21 22:17:24 +03:00
|
|
|
|
mainMenuPanel.SetActive(true);
|
|
|
|
|
|
headerContainer.SetActive(true);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// Сохраняем сцену MainMenu
|
2026-10-19 20:14:24 +03:00
|
|
|
|
string scenePath = "Assets/Scenes/MainMenu.unity";
|
|
|
|
|
|
EditorSceneManager.SaveScene(newScene, scenePath);
|
2026-10-21 22:17:24 +03:00
|
|
|
|
Debug.Log("[MainMenuSceneBuilder] Сцена Synthesia MainMenu успешно создана: " + scenePath);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// Добавляем в Build Settings при необходимости
|
|
|
|
|
|
EnsureSceneInBuildSettings(scenePath, 0);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
return "SUCCESS: Minimalist Black & Yellow MainMenu 'Synthesia' successfully built!";
|
2026-10-19 20:14:24 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
private static void EnsureSceneInBuildSettings(string scenePath, int targetIndex)
|
|
|
|
|
|
{
|
|
|
|
|
|
List<EditorBuildSettingsScene> list = new List<EditorBuildSettingsScene>(EditorBuildSettings.scenes);
|
|
|
|
|
|
for (int i = 0; i < list.Count; i++)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (list[i].path == scenePath)
|
|
|
|
|
|
{
|
|
|
|
|
|
if (i != targetIndex && targetIndex < list.Count)
|
|
|
|
|
|
{
|
|
|
|
|
|
var item = list[i];
|
|
|
|
|
|
list.RemoveAt(i);
|
|
|
|
|
|
list.Insert(targetIndex, item);
|
|
|
|
|
|
EditorBuildSettings.scenes = list.ToArray();
|
|
|
|
|
|
}
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (targetIndex >= 0 && targetIndex <= list.Count)
|
|
|
|
|
|
list.Insert(targetIndex, new EditorBuildSettingsScene(scenePath, true));
|
|
|
|
|
|
else
|
|
|
|
|
|
list.Add(new EditorBuildSettingsScene(scenePath, true));
|
|
|
|
|
|
|
|
|
|
|
|
EditorBuildSettings.scenes = list.ToArray();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#region Хелперы UI
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
|
|
|
|
|
private static GameObject CreateEmptyRect(string name, Transform parent, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta, Vector2 anchoredPosition)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameObject go = new GameObject(name, typeof(RectTransform));
|
|
|
|
|
|
go.transform.SetParent(parent, false);
|
|
|
|
|
|
RectTransform rt = go.GetComponent<RectTransform>();
|
|
|
|
|
|
rt.anchorMin = anchorMin;
|
|
|
|
|
|
rt.anchorMax = anchorMax;
|
|
|
|
|
|
rt.sizeDelta = sizeDelta;
|
|
|
|
|
|
rt.anchoredPosition = anchoredPosition;
|
|
|
|
|
|
return go;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static GameObject CreateImage(string name, Transform parent, Color color, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta, Vector2 anchoredPosition)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameObject go = CreateEmptyRect(name, parent, anchorMin, anchorMax, sizeDelta, anchoredPosition);
|
|
|
|
|
|
Image img = go.AddComponent<Image>();
|
|
|
|
|
|
img.color = color;
|
|
|
|
|
|
return go;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static GameObject CreateText(string name, Transform parent, string text, int fontSize, FontStyle style, TextAnchor alignment, Color color, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta, Vector2 anchoredPosition)
|
2026-10-21 22:17:24 +03:00
|
|
|
|
{
|
|
|
|
|
|
return CreateTextWithFont(name, parent, text, standardFont, fontSize, style, alignment, color, anchorMin, anchorMax, sizeDelta, anchoredPosition);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static GameObject CreateTextWithFont(string name, Transform parent, string text, Font font, int fontSize, FontStyle style, TextAnchor alignment, Color color, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta, Vector2 anchoredPosition)
|
2026-10-19 20:14:24 +03:00
|
|
|
|
{
|
|
|
|
|
|
GameObject go = CreateEmptyRect(name, parent, anchorMin, anchorMax, sizeDelta, anchoredPosition);
|
|
|
|
|
|
Text t = go.AddComponent<Text>();
|
2026-10-21 22:17:24 +03:00
|
|
|
|
t.font = font != null ? font : standardFont;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
t.text = text;
|
|
|
|
|
|
t.fontSize = fontSize;
|
|
|
|
|
|
t.fontStyle = style;
|
|
|
|
|
|
t.alignment = alignment;
|
|
|
|
|
|
t.color = color;
|
2026-10-21 22:17:24 +03:00
|
|
|
|
t.horizontalOverflow = HorizontalWrapMode.Overflow;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
t.verticalOverflow = VerticalWrapMode.Overflow;
|
|
|
|
|
|
return go;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
private static Button CreateBigMenuButton(string name, Transform parent, string label, Color normalColor, Color highlightedColor, Color pressedColor, Color textColor, float height, int fontSize)
|
2026-10-19 20:14:24 +03:00
|
|
|
|
{
|
|
|
|
|
|
GameObject btnObj = DefaultControls.CreateButton(uiResources);
|
|
|
|
|
|
btnObj.name = name;
|
|
|
|
|
|
btnObj.transform.SetParent(parent, false);
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
RectTransform rt = btnObj.GetComponent<RectTransform>();
|
|
|
|
|
|
if (rt != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
rt.sizeDelta = new Vector2(rt.sizeDelta.x, height);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-19 20:14:24 +03:00
|
|
|
|
LayoutElement layout = btnObj.AddComponent<LayoutElement>();
|
|
|
|
|
|
layout.minHeight = height;
|
|
|
|
|
|
layout.preferredHeight = height;
|
|
|
|
|
|
|
|
|
|
|
|
Image img = btnObj.GetComponent<Image>();
|
|
|
|
|
|
img.color = normalColor;
|
|
|
|
|
|
img.type = Image.Type.Sliced;
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
// Выразительная окантовка кнопки
|
|
|
|
|
|
Outline btnOutline = btnObj.AddComponent<Outline>();
|
|
|
|
|
|
btnOutline.effectColor = new Color(1.00f, 0.95f, 0.60f, 0.70f);
|
|
|
|
|
|
btnOutline.effectDistance = new Vector2(2f, -2f);
|
|
|
|
|
|
|
|
|
|
|
|
Shadow btnShadow = btnObj.AddComponent<Shadow>();
|
|
|
|
|
|
btnShadow.effectColor = new Color(0.00f, 0.00f, 0.00f, 0.50f);
|
|
|
|
|
|
btnShadow.effectDistance = new Vector2(3f, -3f);
|
|
|
|
|
|
|
2026-10-19 20:14:24 +03:00
|
|
|
|
Button btn = btnObj.GetComponent<Button>();
|
|
|
|
|
|
ColorBlock colors = btn.colors;
|
|
|
|
|
|
colors.normalColor = normalColor;
|
|
|
|
|
|
colors.highlightedColor = highlightedColor;
|
|
|
|
|
|
colors.pressedColor = pressedColor;
|
|
|
|
|
|
colors.selectedColor = highlightedColor;
|
|
|
|
|
|
colors.colorMultiplier = 1f;
|
|
|
|
|
|
colors.fadeDuration = 0.12f;
|
|
|
|
|
|
btn.colors = colors;
|
|
|
|
|
|
|
|
|
|
|
|
Text text = btnObj.GetComponentInChildren<Text>();
|
|
|
|
|
|
if (text != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
text.font = standardFont;
|
|
|
|
|
|
text.text = label;
|
|
|
|
|
|
text.fontSize = fontSize;
|
|
|
|
|
|
text.fontStyle = FontStyle.Bold;
|
|
|
|
|
|
text.color = textColor;
|
|
|
|
|
|
text.alignment = TextAnchor.MiddleCenter;
|
2026-10-21 22:17:24 +03:00
|
|
|
|
text.horizontalOverflow = HorizontalWrapMode.Overflow;
|
|
|
|
|
|
text.verticalOverflow = VerticalWrapMode.Overflow;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return btn;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static void CreateCategoryHeader(string name, Transform parent, string text)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameObject go = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 32f), Vector2.zero);
|
|
|
|
|
|
LayoutElement layout = go.AddComponent<LayoutElement>();
|
|
|
|
|
|
layout.minHeight = 32f;
|
|
|
|
|
|
layout.preferredHeight = 32f;
|
|
|
|
|
|
|
|
|
|
|
|
Text t = go.AddComponent<Text>();
|
|
|
|
|
|
t.font = standardFont;
|
|
|
|
|
|
t.text = text;
|
2026-10-21 22:17:24 +03:00
|
|
|
|
t.fontSize = 16;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
t.fontStyle = FontStyle.Bold;
|
|
|
|
|
|
t.alignment = TextAnchor.MiddleLeft;
|
2026-10-21 22:17:24 +03:00
|
|
|
|
t.color = new Color(1.00f, 0.85f, 0.10f, 0.95f);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
private static (Slider slider, Text valueText) CreateSliderRow(string name, Transform parent, string label, float min, float max, float def, string unitSuffix)
|
2026-10-19 20:14:24 +03:00
|
|
|
|
{
|
2026-10-21 22:17:24 +03:00
|
|
|
|
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 44f), Vector2.zero);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
LayoutElement layout = row.AddComponent<LayoutElement>();
|
2026-10-21 22:17:24 +03:00
|
|
|
|
layout.minHeight = 44f;
|
|
|
|
|
|
layout.preferredHeight = 44f;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
CreateText("Label", row.transform, label, 16, FontStyle.Normal, TextAnchor.MiddleLeft,
|
|
|
|
|
|
new Color(0.92f, 0.92f, 0.92f, 1f), new Vector2(0f, 0f), new Vector2(0.40f, 1f), Vector2.zero, Vector2.zero);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
|
|
|
|
|
GameObject sliderObj = DefaultControls.CreateSlider(uiResources);
|
|
|
|
|
|
sliderObj.name = "Slider";
|
|
|
|
|
|
sliderObj.transform.SetParent(row.transform, false);
|
2026-10-21 22:17:24 +03:00
|
|
|
|
RectTransform sliderRt = sliderObj.GetComponent<RectTransform>();
|
|
|
|
|
|
sliderRt.anchorMin = new Vector2(0.42f, 0.20f);
|
|
|
|
|
|
sliderRt.anchorMax = new Vector2(0.82f, 0.80f);
|
|
|
|
|
|
sliderRt.offsetMin = Vector2.zero;
|
|
|
|
|
|
sliderRt.offsetMax = Vector2.zero;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
|
|
|
|
|
Slider slider = sliderObj.GetComponent<Slider>();
|
|
|
|
|
|
slider.minValue = min;
|
|
|
|
|
|
slider.maxValue = max;
|
|
|
|
|
|
slider.value = def;
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
Transform fill = sliderObj.transform.Find("Fill Area/Fill");
|
|
|
|
|
|
if (fill != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var img = fill.GetComponent<Image>();
|
|
|
|
|
|
if (img != null) img.color = new Color(1.00f, 0.85f, 0.10f, 1f);
|
|
|
|
|
|
}
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
GameObject valueTextObj = CreateText("ValueText", row.transform,
|
|
|
|
|
|
unitSuffix == "%" ? $"{Mathf.RoundToInt(def * 100)}%" : $"{def:F1}{unitSuffix}",
|
|
|
|
|
|
15, FontStyle.Bold, TextAnchor.MiddleRight,
|
|
|
|
|
|
new Color(1.00f, 0.85f, 0.10f, 1f), new Vector2(0.84f, 0f), new Vector2(1f, 1f), Vector2.zero, Vector2.zero);
|
|
|
|
|
|
|
|
|
|
|
|
return (slider, valueTextObj.GetComponent<Text>());
|
2026-10-19 20:14:24 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static Toggle CreateToggleRow(string name, Transform parent, string label)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 40f), Vector2.zero);
|
|
|
|
|
|
LayoutElement layout = row.AddComponent<LayoutElement>();
|
|
|
|
|
|
layout.minHeight = 40f;
|
|
|
|
|
|
layout.preferredHeight = 40f;
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
CreateText("Label", row.transform, label, 16, FontStyle.Normal, TextAnchor.MiddleLeft,
|
|
|
|
|
|
new Color(0.92f, 0.92f, 0.92f, 1f), new Vector2(0f, 0f), new Vector2(0.70f, 1f), Vector2.zero, Vector2.zero);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
|
|
|
|
|
GameObject toggleObj = DefaultControls.CreateToggle(uiResources);
|
|
|
|
|
|
toggleObj.name = "Toggle";
|
|
|
|
|
|
toggleObj.transform.SetParent(row.transform, false);
|
2026-10-21 22:17:24 +03:00
|
|
|
|
RectTransform rt = toggleObj.GetComponent<RectTransform>();
|
|
|
|
|
|
rt.anchorMin = new Vector2(0.85f, 0.15f);
|
|
|
|
|
|
rt.anchorMax = new Vector2(1f, 0.85f);
|
|
|
|
|
|
rt.offsetMin = Vector2.zero;
|
|
|
|
|
|
rt.offsetMax = Vector2.zero;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
Text defaultLabel = toggleObj.GetComponentInChildren<Text>();
|
|
|
|
|
|
if (defaultLabel != null) Object.DestroyImmediate(defaultLabel.gameObject);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
return toggleObj.GetComponent<Toggle>();
|
2026-10-19 20:14:24 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static Dropdown CreateDropdownRow(string name, Transform parent, string label)
|
|
|
|
|
|
{
|
|
|
|
|
|
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 44f), Vector2.zero);
|
|
|
|
|
|
LayoutElement layout = row.AddComponent<LayoutElement>();
|
|
|
|
|
|
layout.minHeight = 44f;
|
|
|
|
|
|
layout.preferredHeight = 44f;
|
|
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
CreateText("Label", row.transform, label, 16, FontStyle.Normal, TextAnchor.MiddleLeft,
|
|
|
|
|
|
new Color(0.92f, 0.92f, 0.92f, 1f), new Vector2(0f, 0f), new Vector2(0.40f, 1f), Vector2.zero, Vector2.zero);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
GameObject ddObj = DefaultControls.CreateDropdown(uiResources);
|
|
|
|
|
|
ddObj.name = "Dropdown";
|
|
|
|
|
|
ddObj.transform.SetParent(row.transform, false);
|
|
|
|
|
|
RectTransform rt = ddObj.GetComponent<RectTransform>();
|
|
|
|
|
|
rt.anchorMin = new Vector2(0.42f, 0.10f);
|
|
|
|
|
|
rt.anchorMax = new Vector2(1f, 0.90f);
|
|
|
|
|
|
rt.offsetMin = Vector2.zero;
|
|
|
|
|
|
rt.offsetMax = Vector2.zero;
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
Image img = ddObj.GetComponent<Image>();
|
|
|
|
|
|
if (img != null) img.color = new Color(0.12f, 0.12f, 0.12f, 1f);
|
2026-10-19 20:14:24 +03:00
|
|
|
|
|
2026-10-21 22:17:24 +03:00
|
|
|
|
return ddObj.GetComponent<Dropdown>();
|
2026-10-19 20:14:24 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|