Danro-Jump/Assets/Scripts/Editor/Gameplay/GameplayProgressionOverlayWindow.cs
Danil Iarosh cefb2fd345 Build initial vertical platformer foundation
Подробные изменения:
- Добавлены сцены Bootstrap, MainMenu и Game с текущей вертикальной 9:16 структурой проекта.
- Добавлены runtime-скрипты gameplay-архитектуры: DI через Extenject, спавнер платформ, прогрессия этапов, one-way платформы, игрок, камера и оборудование JumpPad.
- Добавлены ScriptableObject-этапы сложности, weighted-настройки платформ, оборудования, противников и collectibles.
- Добавлены UI Toolkit ресурсы главного меню, preview-материалы, шрифты, спрайты, анимации и игровые prefab-ассеты.
- Перенесена и оформлена новая COM-система для работы с аппаратными портами и StreamingAssets.
- Обновлены проектные гайды, AGENTS.md, правила Git/Git LFS, .gitignore, Unity Packages и ProjectSettings.
- Удалён локальный skill start-required-mcp-servers из репозитория.
2026-05-11 07:41:14 +03:00

110 lines
4.0 KiB
C#

using DanroJump.Gameplay;
using UnityEditor;
using UnityEngine;
namespace DanroJump.Editor.Gameplay
{
public sealed class GameplayProgressionOverlayWindow : EditorWindow
{
[MenuItem("Window/Danro Jump/Gameplay Progression Overlay")]
public static void Open()
{
var window = GetWindow<GameplayProgressionOverlayWindow>("Progression");
window.minSize = new Vector2(320f, 180f);
window.Show();
}
private void OnEnable()
{
EditorApplication.update += Repaint;
}
private void OnDisable()
{
EditorApplication.update -= Repaint;
}
private void OnGUI()
{
var progression = FindFirstObjectByType<GameplayDifficultyProgression>();
var spawner = FindFirstObjectByType<PlatformSpawner>();
GameplayProgressionOverlayGui.Draw(progression, spawner, true);
}
}
[CustomEditor(typeof(GameplayDifficultyProgression))]
public sealed class GameplayDifficultyProgressionEditor : UnityEditor.Editor
{
public override void OnInspectorGUI()
{
DrawDefaultInspector();
EditorGUILayout.Space(10f);
var progression = (GameplayDifficultyProgression)target;
var spawner = FindFirstObjectByType<PlatformSpawner>();
GameplayProgressionOverlayGui.Draw(progression, spawner, false);
}
}
internal static class GameplayProgressionOverlayGui
{
public static void Draw(GameplayDifficultyProgression progression, PlatformSpawner spawner, bool showHeader)
{
if (showHeader)
{
EditorGUILayout.LabelField("Gameplay Progression", EditorStyles.boldLabel);
EditorGUILayout.Space(4f);
}
if (progression == null)
{
EditorGUILayout.HelpBox("GameplayDifficultyProgression не найден в открытой сцене.", MessageType.Warning);
return;
}
DrawStageBlock(
"Этап игрока",
progression.CurrentStageName,
progression.CurrentProgress,
GetPlayModeHint());
EditorGUILayout.Space(8f);
if (spawner == null)
{
EditorGUILayout.HelpBox("PlatformSpawner не найден в открытой сцене.", MessageType.Info);
return;
}
DrawStageBlock(
"Этап генерации платформ",
spawner.CurrentGenerationStage,
spawner.CurrentGenerationStageProgress,
$"Generation Y: {spawner.CurrentGenerationY:0.##} | Distribution: {spawner.CurrentPlatformDistribution:0.##}");
}
private static void DrawStageBlock(string title, string stageName, float progress, string subtitle)
{
EditorGUILayout.BeginVertical(EditorStyles.helpBox);
EditorGUILayout.LabelField(title, EditorStyles.boldLabel);
EditorGUILayout.LabelField("Текущий этап", string.IsNullOrWhiteSpace(stageName) ? "<нет этапа>" : stageName);
EditorGUILayout.LabelField("Прогресс этапа", $"{Mathf.Clamp01(progress) * 100f:0}%");
var rect = GUILayoutUtility.GetRect(18f, 18f, "TextField");
EditorGUI.ProgressBar(rect, Mathf.Clamp01(progress), $"{Mathf.Clamp01(progress):0.00}");
if (!string.IsNullOrWhiteSpace(subtitle))
{
EditorGUILayout.Space(3f);
EditorGUILayout.LabelField(subtitle, EditorStyles.miniLabel);
}
EditorGUILayout.EndVertical();
}
private static string GetPlayModeHint()
{
return EditorApplication.isPlaying ? "Play Mode: данные обновляются runtime-логикой" : "Edit Mode: данные рассчитаны по текущим ссылкам сцены";
}
}
}