какашки мне в кармашки
This commit is contained in:
1 parent
7fba61f7a0
commit
cbda26dfc0
335 files changed
+51926
-7266
No files matched your search
@@ -12,11 +12,23 @@ public static class MainMenuSceneBuilder
|
||||
{
|
||||
private static DefaultControls.Resources uiResources;
|
||||
private static Font standardFont;
|
||||
private static Font handwrittenFont;
|
||||
|
||||
[MenuItem("Tools/Build Main Menu Scene")]
|
||||
public static string BuildScene()
|
||||
{
|
||||
standardFont = Resources.GetBuiltinResource<Font>("LegacyRuntime.ttf");
|
||||
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;
|
||||
|
||||
uiResources = new DefaultControls.Resources
|
||||
{
|
||||
@@ -31,11 +43,11 @@ public static class MainMenuSceneBuilder
|
||||
// Создаем новую пустую сцену
|
||||
Scene newScene = EditorSceneManager.NewScene(NewSceneSetup.EmptyScene, NewSceneMode.Single);
|
||||
|
||||
// 1. Камера
|
||||
// 1. Камера (Абсолютно черный фон)
|
||||
GameObject camGo = new GameObject("Main Camera");
|
||||
Camera cam = camGo.AddComponent<Camera>();
|
||||
cam.clearFlags = CameraClearFlags.SolidColor;
|
||||
cam.backgroundColor = new Color(0.035f, 0.05f, 0.075f, 1f);
|
||||
cam.backgroundColor = Color.black;
|
||||
camGo.AddComponent<UniversalAdditionalCameraData>();
|
||||
camGo.AddComponent<AudioListener>();
|
||||
camGo.tag = "MainCamera";
|
||||
@@ -46,7 +58,7 @@ public static class MainMenuSceneBuilder
|
||||
eventSysGo.AddComponent<EventSystem>();
|
||||
eventSysGo.AddComponent<InputSystemUIInputModule>();
|
||||
|
||||
// 3. Canvas
|
||||
// 3. Canvas (1920x1080)
|
||||
GameObject canvasGo = new GameObject("Canvas");
|
||||
Canvas canvas = canvasGo.AddComponent<Canvas>();
|
||||
canvas.renderMode = RenderMode.ScreenSpaceOverlay;
|
||||
@@ -64,118 +76,164 @@ public static class MainMenuSceneBuilder
|
||||
GameObject managerGo = new GameObject("MainMenuManager");
|
||||
MainMenuManager manager = managerGo.AddComponent<MainMenuManager>();
|
||||
|
||||
// 5. Задний фон Canvas
|
||||
CreateImage("Background_Dark", canvasGo.transform,
|
||||
new Color(0.025f, 0.04f, 0.065f, 1f),
|
||||
// 5. Задний фон: Чистый глубокий черный цвет
|
||||
CreateImage("Background_Black", canvasGo.transform,
|
||||
Color.black,
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
|
||||
// Декоративная подложка с мягким сине-зеленым свечением
|
||||
CreateImage("Decor_Tint", canvasGo.transform,
|
||||
new Color(0.00f, 0.45f, 0.60f, 0.06f),
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
// ==========================================
|
||||
// 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));
|
||||
|
||||
// Декоративная неоновая полоса слева
|
||||
CreateImage("AccentLine_Left", canvasGo.transform,
|
||||
new Color(0.00f, 0.85f, 0.95f, 0.70f),
|
||||
new Vector2(0f, 0f), new Vector2(0f, 1f),
|
||||
new Vector2(6f, 0f), new Vector2(3f, 0f));
|
||||
MenuEcholocationRadar echoRadar = radarRoot.AddComponent<MenuEcholocationRadar>();
|
||||
echoRadar.maxSimultaneousWaves = 4;
|
||||
echoRadar.waveMaxRadius = 1600f; // Расходится на весь экран
|
||||
echoRadar.waveSpeed = 240f;
|
||||
echoRadar.waveSpawnInterval = 1.7f;
|
||||
echoRadar.initialThickness = 14f;
|
||||
echoRadar.maxThickness = 52f;
|
||||
echoRadar.waveBaseColor = new Color(1.00f, 0.85f, 0.10f, 0.85f); // Яркий желтый
|
||||
echoRadar.waveCoreColor = new Color(1.00f, 0.98f, 0.55f, 1.00f); // Светло-желтое ядро
|
||||
echoRadar.beaconColor = new Color(1.00f, 0.88f, 0.15f, 1.00f);
|
||||
|
||||
// Копирайт / версия в правом нижнем углу
|
||||
CreateText("Version_Text", canvasGo.transform,
|
||||
"Версия 1.0.0 | Лаборатория 'Эхо'",
|
||||
14, FontStyle.Normal, TextAnchor.MiddleRight,
|
||||
new Color(0.40f, 0.52f, 0.62f, 0.75f),
|
||||
new Vector2(0.70f, 0.02f), new Vector2(0.98f, 0.06f), Vector2.zero, Vector2.zero);
|
||||
// Визуальный корпус излучателя (Желтые концентрические кольца)
|
||||
GameObject reticleOuter = CreateImage("Radar_ReticleOuter", radarRoot.transform,
|
||||
new Color(1.00f, 0.85f, 0.10f, 0.20f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(180f, 180f), Vector2.zero);
|
||||
Outline reticleOutline = reticleOuter.AddComponent<Outline>();
|
||||
reticleOutline.effectColor = new Color(1.00f, 0.85f, 0.10f, 0.35f);
|
||||
reticleOutline.effectDistance = new Vector2(1.5f, -1.5f);
|
||||
|
||||
// 6. Заголовок игры (Логотип и подзаголовок)
|
||||
CreateImage("Radar_ReticleInner", radarRoot.transform,
|
||||
new Color(1.00f, 0.85f, 0.10f, 0.08f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(90f, 90f), Vector2.zero);
|
||||
|
||||
// Крестовина сонара
|
||||
CreateImage("Crosshair_H", radarRoot.transform,
|
||||
new Color(1.00f, 0.85f, 0.10f, 0.25f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(220f, 1.5f), Vector2.zero);
|
||||
|
||||
CreateImage("Crosshair_V", radarRoot.transform,
|
||||
new Color(1.00f, 0.85f, 0.10f, 0.25f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(1.5f, 220f), Vector2.zero);
|
||||
|
||||
// Пульсирующая точка в центре
|
||||
GameObject beaconObj = CreateImage("Radar_BeaconDot", radarRoot.transform,
|
||||
new Color(1.00f, 0.92f, 0.20f, 1.0f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(14f, 14f), Vector2.zero);
|
||||
echoRadar.radarBeaconDot = beaconObj.GetComponent<Image>();
|
||||
echoRadar.radarReticle = reticleOuter.GetComponent<Image>();
|
||||
|
||||
// (Никакого лишнего текста в радаре нет)
|
||||
|
||||
// ==========================================
|
||||
// 7. НАЗВАНИЕ ИГРЫ: "Synthesia" В ЦЕНТРЕ (РУКОПИСНЫЙ ШРИФТ)
|
||||
// ==========================================
|
||||
GameObject headerContainer = CreateEmptyRect("Header_Container", canvasGo.transform,
|
||||
new Vector2(0.08f, 0.64f), new Vector2(0.55f, 0.90f), Vector2.zero, Vector2.zero);
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(1100f, 200f), new Vector2(0f, 210f));
|
||||
|
||||
CreateText("Title_Text", headerContainer.transform,
|
||||
"ECHO // PROTOCOL",
|
||||
48, FontStyle.Bold, TextAnchor.MiddleLeft,
|
||||
new Color(0.92f, 0.97f, 1f, 1f),
|
||||
new Vector2(0f, 0.40f), new Vector2(1f, 1f), Vector2.zero, Vector2.zero);
|
||||
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);
|
||||
|
||||
CreateText("Subtitle_Text", headerContainer.transform,
|
||||
"ТАКТИЧЕСКИЙ СТЕЛС-ЭКШЕН • СЕКРЕТНЫЙ ОБЪЕКТ",
|
||||
16, FontStyle.Normal, TextAnchor.MiddleLeft,
|
||||
new Color(0.00f, 0.85f, 0.95f, 0.85f),
|
||||
new Vector2(0f, 0.12f), new Vector2(1f, 0.40f), Vector2.zero, Vector2.zero);
|
||||
// Теплый желтый ореол свечения
|
||||
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);
|
||||
|
||||
CreateImage("Header_Divider", headerContainer.transform,
|
||||
new Color(0.00f, 0.85f, 0.95f, 0.45f),
|
||||
new Vector2(0f, 0.02f), new Vector2(0.85f, 0.05f), Vector2.zero, Vector2.zero);
|
||||
Shadow titleShadow = titleObj.AddComponent<Shadow>();
|
||||
titleShadow.effectColor = new Color(0.12f, 0.10f, 0.00f, 0.80f);
|
||||
titleShadow.effectDistance = new Vector2(4f, -4f);
|
||||
|
||||
// 7. Основная панель кнопок меню (MainMenuPanel)
|
||||
// ==========================================
|
||||
// 8. КНОПКИ В ЦЕНТРЕ (БОЛЬШИЕ, ЯРКИЕ ЖЕЛТЫЕ, ОЧЕВИДНО НЕ ЧЕРНЫЕ)
|
||||
// ==========================================
|
||||
GameObject mainMenuPanel = CreateEmptyRect("MainMenuPanel", canvasGo.transform,
|
||||
new Vector2(0.08f, 0.18f), new Vector2(0.38f, 0.60f), Vector2.zero, Vector2.zero);
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(620f, 380f), new Vector2(0f, -110f));
|
||||
|
||||
VerticalLayoutGroup menuLayout = mainMenuPanel.AddComponent<VerticalLayoutGroup>();
|
||||
menuLayout.childAlignment = TextAnchor.UpperLeft;
|
||||
menuLayout.spacing = 18f;
|
||||
menuLayout.childAlignment = TextAnchor.MiddleCenter;
|
||||
menuLayout.spacing = 24f;
|
||||
menuLayout.childControlWidth = true;
|
||||
menuLayout.childControlHeight = false;
|
||||
menuLayout.childControlHeight = true;
|
||||
menuLayout.childForceExpandWidth = true;
|
||||
menuLayout.childForceExpandHeight = false;
|
||||
|
||||
// Кнопка "ИГРАТЬ"
|
||||
Button playBtn = CreateStyledButton("Button_Play", mainMenuPanel.transform,
|
||||
"► ИГРАТЬ",
|
||||
new Color(0.08f, 0.22f, 0.32f, 0.95f),
|
||||
new Color(0.00f, 0.65f, 0.85f, 1.0f),
|
||||
new Color(0.04f, 0.14f, 0.22f, 1.0f),
|
||||
new Color(0.90f, 0.98f, 1.0f, 1.0f),
|
||||
66f, 24);
|
||||
// Яркий золотисто-желтый цвет кнопок с глубоким черным текстом (очевидно не черные)
|
||||
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);
|
||||
|
||||
// Кнопка "НАСТРОЙКИ"
|
||||
Button settingsBtn = CreateStyledButton("Button_Settings", mainMenuPanel.transform,
|
||||
"⚙ НАСТРОЙКИ",
|
||||
new Color(0.07f, 0.12f, 0.18f, 0.90f),
|
||||
new Color(0.18f, 0.38f, 0.52f, 1.0f),
|
||||
new Color(0.04f, 0.08f, 0.12f, 1.0f),
|
||||
new Color(0.85f, 0.92f, 0.98f, 1.0f),
|
||||
62f, 22);
|
||||
// Кнопка 1: "ИГРАТЬ"
|
||||
Button playBtn = CreateBigMenuButton("Button_Play", mainMenuPanel.transform,
|
||||
"ИГРАТЬ",
|
||||
yellowBtnNormal,
|
||||
yellowBtnHover,
|
||||
yellowBtnPress,
|
||||
blackBtnText,
|
||||
90f, 34);
|
||||
|
||||
// Кнопка "ВЫХОД"
|
||||
Button quitBtn = CreateStyledButton("Button_Quit", mainMenuPanel.transform,
|
||||
"✖ ВЫХОД ИЗ ИГРЫ",
|
||||
new Color(0.18f, 0.08f, 0.10f, 0.90f),
|
||||
new Color(0.55f, 0.16f, 0.22f, 1.0f),
|
||||
new Color(0.10f, 0.04f, 0.06f, 1.0f),
|
||||
new Color(0.95f, 0.85f, 0.85f, 1.0f),
|
||||
62f, 22);
|
||||
// Кнопка 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);
|
||||
|
||||
// ==========================================
|
||||
// 8. Панель настроек (SettingsPanel)
|
||||
// 9. ПАНЕЛЬ НАСТРОЕК (В ЧЕРНО-ЖЕЛТОМ СТИЛЕ)
|
||||
// ==========================================
|
||||
GameObject settingsPanel = CreateEmptyRect("SettingsPanel", canvasGo.transform,
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
|
||||
// Затемняющий фон
|
||||
CreateImage("Backdrop_Dim", settingsPanel.transform,
|
||||
new Color(0.01f, 0.02f, 0.03f, 0.78f),
|
||||
new Color(0.0f, 0.0f, 0.0f, 0.92f),
|
||||
Vector2.zero, Vector2.one, Vector2.zero, Vector2.zero);
|
||||
|
||||
// Модальное окно
|
||||
// Модальное окно настроек
|
||||
GameObject settingsCard = CreateImage("Settings_Card", settingsPanel.transform,
|
||||
new Color(0.05f, 0.08f, 0.12f, 0.98f),
|
||||
new Color(0.04f, 0.04f, 0.04f, 0.98f),
|
||||
new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f),
|
||||
new Vector2(920f, 720f), Vector2.zero);
|
||||
new Vector2(920f, 740f), Vector2.zero);
|
||||
|
||||
Outline panelOutline = settingsCard.AddComponent<Outline>();
|
||||
panelOutline.effectColor = new Color(0.00f, 0.85f, 0.95f, 0.50f);
|
||||
panelOutline.effectColor = new Color(1.00f, 0.85f, 0.10f, 0.55f);
|
||||
panelOutline.effectDistance = new Vector2(2f, -2f);
|
||||
|
||||
// Заголовок панели настроек
|
||||
CreateText("Settings_Header", settingsCard.transform,
|
||||
"НАСТРОЙКИ СИСТЕМЫ",
|
||||
"НАСТРОЙКИ",
|
||||
28, FontStyle.Bold, TextAnchor.MiddleCenter,
|
||||
new Color(0.90f, 0.97f, 1.0f, 1.0f),
|
||||
new Color(1.00f, 0.85f, 0.10f, 1.0f),
|
||||
new Vector2(0.05f, 0.90f), new Vector2(0.95f, 0.98f), Vector2.zero, Vector2.zero);
|
||||
|
||||
CreateImage("Settings_Divider", settingsCard.transform,
|
||||
new Color(0.00f, 0.85f, 0.95f, 0.35f),
|
||||
new Color(1.00f, 0.85f, 0.10f, 0.40f),
|
||||
new Vector2(0.05f, 0.89f), new Vector2(0.95f, 0.895f), Vector2.zero, Vector2.zero);
|
||||
|
||||
// Контейнер списка настроек
|
||||
@@ -183,7 +241,7 @@ public static class MainMenuSceneBuilder
|
||||
new Vector2(0.06f, 0.14f), new Vector2(0.94f, 0.87f), Vector2.zero, Vector2.zero);
|
||||
|
||||
VerticalLayoutGroup settingsLayout = settingsList.AddComponent<VerticalLayoutGroup>();
|
||||
settingsLayout.spacing = 16f;
|
||||
settingsLayout.spacing = 15f;
|
||||
settingsLayout.childAlignment = TextAnchor.UpperCenter;
|
||||
settingsLayout.childControlWidth = true;
|
||||
settingsLayout.childControlHeight = false;
|
||||
@@ -191,16 +249,16 @@ public static class MainMenuSceneBuilder
|
||||
settingsLayout.childForceExpandHeight = false;
|
||||
|
||||
// --- Раздел: Звук ---
|
||||
CreateCategoryHeader("HEADER_AUDIO", settingsList.transform, "— АУДИО И ЗВУК —");
|
||||
CreateCategoryHeader("HEADER_AUDIO", settingsList.transform, "— ЗВУК И ЭХОЛОКАЦИЯ —");
|
||||
|
||||
var volumeRow = CreateSliderRow("Row_Volume", settingsList.transform, "Общая громкость", 0f, 1f, 1f, "%");
|
||||
var volumeRow = CreateSliderRow("Row_Volume", settingsList.transform, "Громкость звука", 0f, 1f, 1f, "%");
|
||||
Slider volSlider = volumeRow.slider;
|
||||
Text volText = volumeRow.valueText;
|
||||
|
||||
Toggle muteToggle = CreateToggleRow("Row_Mute", settingsList.transform, "Отключить звук (Mute)");
|
||||
|
||||
// --- Раздел: Графика ---
|
||||
CreateCategoryHeader("HEADER_GRAPHICS", settingsList.transform, "— ГРАФИКА И ДИСПЛЕЙ —");
|
||||
CreateCategoryHeader("HEADER_GRAPHICS", settingsList.transform, "— ГРАФИКА —");
|
||||
|
||||
Dropdown qualityDropdown = CreateDropdownRow("Row_Quality", settingsList.transform, "Качество графики");
|
||||
Toggle fullscreenToggle = CreateToggleRow("Row_Fullscreen", settingsList.transform, "Полноэкранный режим");
|
||||
@@ -225,45 +283,46 @@ public static class MainMenuSceneBuilder
|
||||
bottomLayout.childForceExpandWidth = true;
|
||||
bottomLayout.childForceExpandHeight = true;
|
||||
|
||||
Button resetBtn = CreateStyledButton("Button_ResetDefaults", bottomButtonsRow.transform,
|
||||
"Сбросить настройки",
|
||||
new Color(0.18f, 0.12f, 0.14f, 0.95f),
|
||||
new Color(0.35f, 0.18f, 0.22f, 1.0f),
|
||||
new Color(0.12f, 0.06f, 0.08f, 1.0f),
|
||||
new Color(0.95f, 0.85f, 0.85f, 1.0f),
|
||||
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,
|
||||
50f, 18);
|
||||
|
||||
Button backBtn = CreateStyledButton("Button_Back", bottomButtonsRow.transform,
|
||||
"✔ НАЗАД В МЕНЮ",
|
||||
new Color(0.08f, 0.22f, 0.30f, 0.95f),
|
||||
new Color(0.00f, 0.65f, 0.85f, 1.0f),
|
||||
new Color(0.05f, 0.14f, 0.20f, 1.0f),
|
||||
new Color(0.90f, 0.98f, 1.0f, 1.0f),
|
||||
50f, 20);
|
||||
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);
|
||||
|
||||
// ==========================================
|
||||
// 9. Панель загрузки (LoadingPanel)
|
||||
// 10. ПАНЕЛЬ ЗАГРУЗКИ (LOADING PANEL)
|
||||
// ==========================================
|
||||
GameObject loadingPanel = CreateImage("LoadingPanel", canvasGo.transform,
|
||||
new Color(0.02f, 0.03f, 0.05f, 0.97f),
|
||||
new Color(0f, 0f, 0f, 0.98f),
|
||||
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),
|
||||
new Vector2(600f, 200f), Vector2.zero);
|
||||
new Vector2(640f, 220f), Vector2.zero);
|
||||
|
||||
CreateText("Loading_Title", loadingContainer.transform,
|
||||
"ЗАГРУЗКА МИССИИ...",
|
||||
28, FontStyle.Bold, TextAnchor.MiddleCenter,
|
||||
new Color(0.00f, 0.85f, 0.95f, 1.0f),
|
||||
new Vector2(0f, 0.60f), new Vector2(1f, 1f), Vector2.zero, Vector2.zero);
|
||||
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);
|
||||
|
||||
GameObject sliderObj = DefaultControls.CreateSlider(uiResources);
|
||||
sliderObj.name = "Loading_ProgressBar";
|
||||
sliderObj.transform.SetParent(loadingContainer.transform, false);
|
||||
RectTransform sliderRt = sliderObj.GetComponent<RectTransform>();
|
||||
sliderRt.anchorMin = new Vector2(0.05f, 0.35f);
|
||||
sliderRt.anchorMax = new Vector2(0.95f, 0.55f);
|
||||
sliderRt.anchorMin = new Vector2(0.05f, 0.38f);
|
||||
sliderRt.anchorMax = new Vector2(0.95f, 0.52f);
|
||||
sliderRt.offsetMin = Vector2.zero;
|
||||
sliderRt.offsetMax = Vector2.zero;
|
||||
|
||||
@@ -273,68 +332,86 @@ public static class MainMenuSceneBuilder
|
||||
if (fillTransform != null)
|
||||
{
|
||||
Image fillImg = fillTransform.GetComponent<Image>();
|
||||
if (fillImg != null) fillImg.color = new Color(0.00f, 0.85f, 0.95f, 1f);
|
||||
if (fillImg != null) fillImg.color = new Color(1.00f, 0.85f, 0.10f, 1f);
|
||||
}
|
||||
|
||||
GameObject loadingPercent = CreateText("Loading_Text", loadingContainer.transform,
|
||||
"0%",
|
||||
"Загрузка...",
|
||||
18, FontStyle.Normal, TextAnchor.MiddleCenter,
|
||||
new Color(0.80f, 0.90f, 1.0f, 0.9f),
|
||||
new Color(0.95f, 0.95f, 0.95f, 0.9f),
|
||||
new Vector2(0f, 0f), new Vector2(1f, 0.30f), Vector2.zero, Vector2.zero);
|
||||
Text loadingText = loadingPercent.GetComponent<Text>();
|
||||
|
||||
// ==========================================
|
||||
// 10. Привязка ссылок к MainMenuManager
|
||||
// 11. ПРИВЯЗКА К MAINMENUMANAGER
|
||||
// ==========================================
|
||||
manager.headerContainer = headerContainer;
|
||||
manager.mainMenuPanel = mainMenuPanel;
|
||||
manager.settingsPanel = settingsPanel;
|
||||
manager.loadingPanel = loadingPanel;
|
||||
manager.gameSceneName = "SampleScene";
|
||||
|
||||
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;
|
||||
manager.gameSceneName = "SampleScene";
|
||||
|
||||
// Привязываем кнопки через UnityEvent
|
||||
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(backBtn.onClick, manager.CloseSettings);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(resetBtn.onClick, manager.ResetToDefaults);
|
||||
UnityEditor.Events.UnityEventTools.AddPersistentListener(backBtn.onClick, manager.CloseSettings);
|
||||
|
||||
// Изначальная видимость панелей
|
||||
headerContainer.SetActive(true);
|
||||
mainMenuPanel.SetActive(true);
|
||||
// По умолчанию активны главное меню и радар
|
||||
settingsPanel.SetActive(false);
|
||||
loadingPanel.SetActive(false);
|
||||
mainMenuPanel.SetActive(true);
|
||||
headerContainer.SetActive(true);
|
||||
|
||||
// 11. Сохранение сцены и Build Settings
|
||||
// Сохраняем сцену MainMenu
|
||||
string scenePath = "Assets/Scenes/MainMenu.unity";
|
||||
EditorSceneManager.SaveScene(newScene, scenePath);
|
||||
Debug.Log("[MainMenuSceneBuilder] Сцена создана: " + scenePath);
|
||||
Debug.Log("[MainMenuSceneBuilder] Сцена Synthesia MainMenu успешно создана: " + scenePath);
|
||||
|
||||
List<EditorBuildSettingsScene> buildScenes = new List<EditorBuildSettingsScene>();
|
||||
buildScenes.Add(new EditorBuildSettingsScene(scenePath, true));
|
||||
buildScenes.Add(new EditorBuildSettingsScene("Assets/Scenes/SampleScene.unity", true));
|
||||
EditorBuildSettings.scenes = buildScenes.ToArray();
|
||||
// Добавляем в Build Settings при необходимости
|
||||
EnsureSceneInBuildSettings(scenePath, 0);
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
|
||||
return "SUCCESS: MainMenu created and configured!";
|
||||
return "SUCCESS: Minimalist Black & Yellow MainMenu 'Synthesia' successfully built!";
|
||||
}
|
||||
|
||||
#region Хелперы создания UI элементов
|
||||
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
|
||||
|
||||
private static GameObject CreateEmptyRect(string name, Transform parent, Vector2 anchorMin, Vector2 anchorMax, Vector2 sizeDelta, Vector2 anchoredPosition)
|
||||
{
|
||||
@@ -353,32 +430,41 @@ public static class MainMenuSceneBuilder
|
||||
GameObject go = CreateEmptyRect(name, parent, anchorMin, anchorMax, sizeDelta, anchoredPosition);
|
||||
Image img = go.AddComponent<Image>();
|
||||
img.color = color;
|
||||
img.sprite = uiResources.background;
|
||||
img.type = Image.Type.Sliced;
|
||||
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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
GameObject go = CreateEmptyRect(name, parent, anchorMin, anchorMax, sizeDelta, anchoredPosition);
|
||||
Text t = go.AddComponent<Text>();
|
||||
t.font = standardFont;
|
||||
t.font = font != null ? font : standardFont;
|
||||
t.text = text;
|
||||
t.fontSize = fontSize;
|
||||
t.fontStyle = style;
|
||||
t.alignment = alignment;
|
||||
t.color = color;
|
||||
t.horizontalOverflow = HorizontalWrapMode.Wrap;
|
||||
t.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
t.verticalOverflow = VerticalWrapMode.Overflow;
|
||||
return go;
|
||||
}
|
||||
|
||||
private static Button CreateStyledButton(string name, Transform parent, string label, Color normalColor, Color highlightedColor, Color pressedColor, Color textColor, float height, int fontSize)
|
||||
private static Button CreateBigMenuButton(string name, Transform parent, string label, Color normalColor, Color highlightedColor, Color pressedColor, Color textColor, float height, int fontSize)
|
||||
{
|
||||
GameObject btnObj = DefaultControls.CreateButton(uiResources);
|
||||
btnObj.name = name;
|
||||
btnObj.transform.SetParent(parent, false);
|
||||
|
||||
RectTransform rt = btnObj.GetComponent<RectTransform>();
|
||||
if (rt != null)
|
||||
{
|
||||
rt.sizeDelta = new Vector2(rt.sizeDelta.x, height);
|
||||
}
|
||||
|
||||
LayoutElement layout = btnObj.AddComponent<LayoutElement>();
|
||||
layout.minHeight = height;
|
||||
layout.preferredHeight = height;
|
||||
@@ -387,6 +473,15 @@ public static class MainMenuSceneBuilder
|
||||
img.color = normalColor;
|
||||
img.type = Image.Type.Sliced;
|
||||
|
||||
// Выразительная окантовка кнопки
|
||||
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);
|
||||
|
||||
Button btn = btnObj.GetComponent<Button>();
|
||||
ColorBlock colors = btn.colors;
|
||||
colors.normalColor = normalColor;
|
||||
@@ -406,6 +501,8 @@ public static class MainMenuSceneBuilder
|
||||
text.fontStyle = FontStyle.Bold;
|
||||
text.color = textColor;
|
||||
text.alignment = TextAnchor.MiddleCenter;
|
||||
text.horizontalOverflow = HorizontalWrapMode.Overflow;
|
||||
text.verticalOverflow = VerticalWrapMode.Overflow;
|
||||
}
|
||||
|
||||
return btn;
|
||||
@@ -421,72 +518,49 @@ public static class MainMenuSceneBuilder
|
||||
Text t = go.AddComponent<Text>();
|
||||
t.font = standardFont;
|
||||
t.text = text;
|
||||
t.fontSize = 17;
|
||||
t.fontSize = 16;
|
||||
t.fontStyle = FontStyle.Bold;
|
||||
t.alignment = TextAnchor.MiddleLeft;
|
||||
t.color = new Color(0.00f, 0.85f, 0.95f, 0.95f);
|
||||
t.color = new Color(1.00f, 0.85f, 0.10f, 0.95f);
|
||||
}
|
||||
|
||||
private struct SliderRow
|
||||
private static (Slider slider, Text valueText) CreateSliderRow(string name, Transform parent, string label, float min, float max, float def, string unitSuffix)
|
||||
{
|
||||
public Slider slider;
|
||||
public Text valueText;
|
||||
}
|
||||
|
||||
private static SliderRow CreateSliderRow(string name, Transform parent, string label, float min, float max, float def, string unit)
|
||||
{
|
||||
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 42f), Vector2.zero);
|
||||
GameObject row = CreateEmptyRect(name, parent, Vector2.zero, Vector2.one, new Vector2(0f, 44f), Vector2.zero);
|
||||
LayoutElement layout = row.AddComponent<LayoutElement>();
|
||||
layout.minHeight = 42f;
|
||||
layout.preferredHeight = 42f;
|
||||
layout.minHeight = 44f;
|
||||
layout.preferredHeight = 44f;
|
||||
|
||||
HorizontalLayoutGroup hLayout = row.AddComponent<HorizontalLayoutGroup>();
|
||||
hLayout.spacing = 18f;
|
||||
hLayout.childAlignment = TextAnchor.MiddleLeft;
|
||||
hLayout.childControlWidth = false;
|
||||
hLayout.childControlHeight = true;
|
||||
hLayout.childForceExpandWidth = false;
|
||||
hLayout.childForceExpandHeight = true;
|
||||
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);
|
||||
|
||||
// Метка названия
|
||||
GameObject lblGo = CreateEmptyRect("Label", row.transform, Vector2.zero, Vector2.one, new Vector2(280f, 42f), Vector2.zero);
|
||||
LayoutElement lblLayout = lblGo.AddComponent<LayoutElement>();
|
||||
lblLayout.minWidth = 280f;
|
||||
lblLayout.preferredWidth = 280f;
|
||||
Text lbl = lblGo.AddComponent<Text>();
|
||||
lbl.font = standardFont;
|
||||
lbl.text = label;
|
||||
lbl.fontSize = 18;
|
||||
lbl.alignment = TextAnchor.MiddleLeft;
|
||||
lbl.color = new Color(0.85f, 0.92f, 0.98f, 1f);
|
||||
|
||||
// Slider
|
||||
GameObject sliderObj = DefaultControls.CreateSlider(uiResources);
|
||||
sliderObj.name = "Slider";
|
||||
sliderObj.transform.SetParent(row.transform, false);
|
||||
LayoutElement sliderLayout = sliderObj.AddComponent<LayoutElement>();
|
||||
sliderLayout.minWidth = 360f;
|
||||
sliderLayout.preferredWidth = 360f;
|
||||
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;
|
||||
|
||||
Slider slider = sliderObj.GetComponent<Slider>();
|
||||
slider.minValue = min;
|
||||
slider.maxValue = max;
|
||||
slider.value = def;
|
||||
|
||||
// Значение текстом
|
||||
GameObject valGo = CreateEmptyRect("ValueText", row.transform, Vector2.zero, Vector2.one, new Vector2(90f, 42f), Vector2.zero);
|
||||
LayoutElement valLayout = valGo.AddComponent<LayoutElement>();
|
||||
valLayout.minWidth = 90f;
|
||||
valLayout.preferredWidth = 90f;
|
||||
Text valText = valGo.AddComponent<Text>();
|
||||
valText.font = standardFont;
|
||||
valText.text = unit == "%" ? $"{Mathf.RoundToInt(def * 100)}%" : $"{def:F1}{unit}";
|
||||
valText.fontSize = 18;
|
||||
valText.fontStyle = FontStyle.Bold;
|
||||
valText.alignment = TextAnchor.MiddleCenter;
|
||||
valText.color = new Color(0.00f, 0.85f, 0.95f, 1f);
|
||||
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);
|
||||
}
|
||||
|
||||
return new SliderRow { slider = slider, valueText = valText };
|
||||
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>());
|
||||
}
|
||||
|
||||
private static Toggle CreateToggleRow(string name, Transform parent, string label)
|
||||
@@ -496,39 +570,22 @@ public static class MainMenuSceneBuilder
|
||||
layout.minHeight = 40f;
|
||||
layout.preferredHeight = 40f;
|
||||
|
||||
HorizontalLayoutGroup hLayout = row.AddComponent<HorizontalLayoutGroup>();
|
||||
hLayout.spacing = 18f;
|
||||
hLayout.childAlignment = TextAnchor.MiddleLeft;
|
||||
hLayout.childControlWidth = false;
|
||||
hLayout.childControlHeight = true;
|
||||
hLayout.childForceExpandWidth = false;
|
||||
hLayout.childForceExpandHeight = true;
|
||||
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);
|
||||
|
||||
// Метка названия
|
||||
GameObject lblGo = CreateEmptyRect("Label", row.transform, Vector2.zero, Vector2.one, new Vector2(280f, 40f), Vector2.zero);
|
||||
LayoutElement lblLayout = lblGo.AddComponent<LayoutElement>();
|
||||
lblLayout.minWidth = 280f;
|
||||
lblLayout.preferredWidth = 280f;
|
||||
Text lbl = lblGo.AddComponent<Text>();
|
||||
lbl.font = standardFont;
|
||||
lbl.text = label;
|
||||
lbl.fontSize = 18;
|
||||
lbl.alignment = TextAnchor.MiddleLeft;
|
||||
lbl.color = new Color(0.85f, 0.92f, 0.98f, 1f);
|
||||
|
||||
// Toggle
|
||||
GameObject toggleObj = DefaultControls.CreateToggle(uiResources);
|
||||
toggleObj.name = "Toggle";
|
||||
toggleObj.transform.SetParent(row.transform, false);
|
||||
LayoutElement toggleLayout = toggleObj.AddComponent<LayoutElement>();
|
||||
toggleLayout.minWidth = 50f;
|
||||
toggleLayout.preferredWidth = 50f;
|
||||
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;
|
||||
|
||||
Text toggleLabel = toggleObj.GetComponentInChildren<Text>();
|
||||
if (toggleLabel != null) toggleLabel.text = "";
|
||||
Text defaultLabel = toggleObj.GetComponentInChildren<Text>();
|
||||
if (defaultLabel != null) Object.DestroyImmediate(defaultLabel.gameObject);
|
||||
|
||||
Toggle toggle = toggleObj.GetComponent<Toggle>();
|
||||
return toggle;
|
||||
return toggleObj.GetComponent<Toggle>();
|
||||
}
|
||||
|
||||
private static Dropdown CreateDropdownRow(string name, Transform parent, string label)
|
||||
@@ -538,41 +595,22 @@ public static class MainMenuSceneBuilder
|
||||
layout.minHeight = 44f;
|
||||
layout.preferredHeight = 44f;
|
||||
|
||||
HorizontalLayoutGroup hLayout = row.AddComponent<HorizontalLayoutGroup>();
|
||||
hLayout.spacing = 18f;
|
||||
hLayout.childAlignment = TextAnchor.MiddleLeft;
|
||||
hLayout.childControlWidth = false;
|
||||
hLayout.childControlHeight = true;
|
||||
hLayout.childForceExpandWidth = false;
|
||||
hLayout.childForceExpandHeight = true;
|
||||
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);
|
||||
|
||||
// Метка названия
|
||||
GameObject lblGo = CreateEmptyRect("Label", row.transform, Vector2.zero, Vector2.one, new Vector2(280f, 44f), Vector2.zero);
|
||||
LayoutElement lblLayout = lblGo.AddComponent<LayoutElement>();
|
||||
lblLayout.minWidth = 280f;
|
||||
lblLayout.preferredWidth = 280f;
|
||||
Text lbl = lblGo.AddComponent<Text>();
|
||||
lbl.font = standardFont;
|
||||
lbl.text = label;
|
||||
lbl.fontSize = 18;
|
||||
lbl.alignment = TextAnchor.MiddleLeft;
|
||||
lbl.color = new Color(0.85f, 0.92f, 0.98f, 1f);
|
||||
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;
|
||||
|
||||
// Dropdown
|
||||
GameObject dropdownObj = DefaultControls.CreateDropdown(uiResources);
|
||||
dropdownObj.name = "Dropdown";
|
||||
dropdownObj.transform.SetParent(row.transform, false);
|
||||
LayoutElement ddLayout = dropdownObj.AddComponent<LayoutElement>();
|
||||
ddLayout.minWidth = 420f;
|
||||
ddLayout.preferredWidth = 420f;
|
||||
Image img = ddObj.GetComponent<Image>();
|
||||
if (img != null) img.color = new Color(0.12f, 0.12f, 0.12f, 1f);
|
||||
|
||||
Dropdown dropdown = dropdownObj.GetComponent<Dropdown>();
|
||||
Text caption = dropdown.captionText;
|
||||
if (caption != null) caption.font = standardFont;
|
||||
Text item = dropdown.itemText;
|
||||
if (item != null) item.font = standardFont;
|
||||
|
||||
return dropdown;
|
||||
return ddObj.GetComponent<Dropdown>();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
Reference in new issue
Block a user