using Cysharp.Threading.Tasks; using System; using System.Collections.Generic; using UnityEngine; using UVC.Core; using UVC.UI.Commands; using UVC.UI.Menu; using UVC.UI.Tooltip; using UVC.UI.Window.PropertyWindow; namespace Simulator { [DefaultExecutionOrder(90)] public class SimulatorSceneMain : SingletonScene { [SerializeField] private TopMenuController GNB; [SerializeField] private PropertyWindow propertyWindow; public Action Initialized; /// /// 초기 화 메서드입니다. /// Awake 메서드에서 호출되며, MonoBehaviour가 생성될 때 한 번만 실행됩니다. /// protected override void Init() { if (!TooltipManager.Instance.IsInitialized) TooltipManager.Instance.Initialize(); SimulatorAppMain.Instance.Initialized += OnAppInitialized; } private async void OnAppInitialized() { await requestDataAsync(); SetupLNB(); SetupPropertyWindow(); if (Initialized != null) { Initialized.Invoke(); } } private async UniTask requestDataAsync() { Debug.Log("requestDataAsync"); //UILoading.Show(); //UILoading.Hide(); } private void SetupLNB() { if (GNB == null) { Debug.LogError("SideMenuController is not assigned in SceneMain."); return; } GNB.AddMenuItem(new MenuItemData("menu", "menu", new DebugLogCommand("[FactorySample] 프로젝트 설정 선택됨"), subMenuItems: new List { new MenuItemData("simulation", "시뮬레이션", subMenuItems: new List { new MenuItemData("simulation_create", "시뮬레이션 생성", new DebugLogCommand("시뮬레이션 생성")), new MenuItemData("simulation_open", "시뮬레이션 열기", new DebugLogCommand("시뮬레이션 열기")), new MenuItemData("simulation_save", "시뮬레이션 저장", new DebugLogCommand("시뮬레이션 저장")), new MenuItemData("simulation_save_as", "시뮬레이션 복제", new DebugLogCommand("시뮬레이션 복제")), new MenuItemData("simulation_delete", "시뮬레이션 삭제", new DebugLogCommand("시뮬레이션 삭제")), new MenuItemData("simulation_history", "시뮬레이션 이력", new DebugLogCommand("시뮬레이션 이력")) }), new MenuItemData("scenario", "시나리오", subMenuItems: new List { new MenuItemData("scenario_create", "시나리오 생성", new DebugLogCommand("시나리오 생성")), new MenuItemData("scenario_run", "시나리오 실행", new DebugLogCommand("시나리오 실행")), new MenuItemData("scenario_save_as", "시나리오 복제", new DebugLogCommand("시나리오 복제")), new MenuItemData("scenario_delete", "시나리오 삭제", new DebugLogCommand("시나리오 삭제")), new MenuItemData("scenario_history", "시나리오 이력", new DebugLogCommand("시나리오 이력")) }), new MenuItemData("scenario", "WHAT-IF 분석", subMenuItems: new List { new MenuItemData("whatif_create", "WHAT-IF 생성", new DebugLogCommand("WHAT-IF 생성")), new MenuItemData("whatif_run", "WHAT-IF 실행", new DebugLogCommand("WHAT-IF 실행")), new MenuItemData("whatif_save_as", "WHAT-IF 복제", new DebugLogCommand("WHAT-IF 복제")), new MenuItemData("whatif_delete", "WHAT-IF 삭제", new DebugLogCommand("WHAT-IF 삭제")), new MenuItemData("whatif_history", "WHAT-IF 이력", new DebugLogCommand("WHAT-IF 이력")) }), new MenuItemData("visible", "보기", subMenuItems: new List { new MenuItemData("explorer_window", "탐색창", new ActionCommand(()=> Debug.Log("탐색창"))), new MenuItemData("property_window", "속성창", new ActionCommand(()=> { if(propertyWindow.IsVisible) propertyWindow.Hide(); else propertyWindow.Show(); })), }), new MenuItemData("help", "도움말", subMenuItems: new List { new MenuItemData("guide", "가이드", new ActionCommand(()=> Debug.Log("가이드"))), }), })); GNB.Initialize(); } private void SetupPropertyWindow() { propertyWindow.LoadProperties(new List { new StringProperty("prop1", "String Property", "Initial Value") { Description = "This is a sample string property.", Tooltip = "Enter a string value here.", IsReadOnly = false }, new IntProperty("prop2", "Int Property", 42, true) { Description = "This is a sample integer property.", Tooltip = "Enter an integer value here.", IsReadOnly = false }, new IntRangeProperty("prop2_range", "Int Range Property", new Tuple(0, 100)) { Description = "This is a sample integer range property.", Tooltip = "Select an integer value within the range here.", IsReadOnly = false }, new FloatRangeProperty("prop3_range", "Float Range Property", new Tuple(0.0f, 1.0f)) { Description = "This is a sample float range property.", Tooltip = "Select a float value within the range here.", IsReadOnly = false }, new FloatProperty("prop3", "Float Property", 0.5f, true) { Description = "This is a sample float property.", Tooltip = "Enter an float value here.", IsReadOnly = false }, new BoolProperty("prop4", "Boolean Property", true) { Description = "This is a sample boolean property.", Tooltip = "Toggle the boolean value here.", IsReadOnly = false }, new ColorProperty("prop5", "Color Property", Color.red) { Description = "This is a sample color property.", Tooltip = "Select a color here.", IsReadOnly = true }, new Vector2Property("prop6_vec2", "Vector2 Property", new Vector2(1, 2)) { Description = "This is a sample Vector2 property.", Tooltip = "Enter a Vector2 value here.", IsReadOnly = true }, new Vector3Property("prop6_vec3", "Vector3 Property", new Vector3(1, 2, 3)) { Description = "This is a sample Vector3 property.", Tooltip = "Enter a Vector3 value here.", IsReadOnly = true }, new DateProperty("prop6_date", "Date Property", System.DateTime.Now) { //Description = "This is a sample date property.", Tooltip = "Select a date here.", IsReadOnly = true }, new DateTimeProperty("prop6_datetime", "DateTime Property", System.DateTime.Now) { Description = "This is a sample date-time property.", Tooltip = "Select a date and time here.", IsReadOnly = true }, new DateRangeProperty("prop6_daterange", "Date Range Property", new Tuple(DateTime.Now.AddDays(-7), DateTime.Now)) { Description = "This is a sample date range property.", Tooltip = "Select a date range here.", IsReadOnly = true }, new DateTimeRangeProperty("prop6_datetimerange", "DateTime Range Property", new Tuple(DateTime.Now.AddHours(-1), DateTime.Now)) { Description = "This is a sample date-time range property.", Tooltip = "Select a date-time range here.", IsReadOnly = true }, new EnumProperty("prop6", "Enum Property", SampleEnum.Option1) { Description = "This is a sample enum property.", Tooltip = "Select an option here.", IsReadOnly = true }, new ListProperty("prop7", "List Property", new List { "Item1", "Item2", "Item3" }, "Item1") { Description = "This is a sample list property.", Tooltip = "Manage the list items here.", IsReadOnly = true }, new RadioGroupProperty("prop8", "Radio Group Property", new List { "Option1", "Option2", "Option3" }, "Option1") { Description = "This is a sample radio group property.", Tooltip = "Select one option here.", IsReadOnly = true } }); propertyWindow.PropertyValueChanged += (sender, e) => { Debug.Log($"Property Id:{e.PropertyId}, type:{e.PropertyType}, newValue: {e.NewValue}"); }; } enum SampleEnum { Option1, Option2, Option3 } } }