From fa84184e7bf47fb9606e0001cc6f0c9d6e774c3c Mon Sep 17 00:00:00 2001 From: geondo55 <102933884+geondo55@users.noreply.github.com> Date: Mon, 21 Jul 2025 15:03:41 +0900 Subject: [PATCH 1/3] =?UTF-8?q?=EB=B0=B1=EC=97=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Prefabs/UI/PRF_QuickStartItem.prefab | 65 +++++++++++++++++++ .../Studio/UI/Elements/UI_QuickStartItem.cs | 16 +++-- .../Studio/UI/Panel/Panel_OpenProjectInfo.cs | 38 +++++++++-- 3 files changed, 108 insertions(+), 11 deletions(-) diff --git a/Assets/Resources/Prefabs/UI/PRF_QuickStartItem.prefab b/Assets/Resources/Prefabs/UI/PRF_QuickStartItem.prefab index 669caf1c..6e7c5a5c 100644 --- a/Assets/Resources/Prefabs/UI/PRF_QuickStartItem.prefab +++ b/Assets/Resources/Prefabs/UI/PRF_QuickStartItem.prefab @@ -150,6 +150,8 @@ GameObject: - component: {fileID: 1094340256984082610} - component: {fileID: 8340526939583729682} - component: {fileID: 7129880062156813569} + - component: {fileID: 713724719131404728} + - component: {fileID: 144084811267613343} m_Layer: 5 m_Name: PRF_QuickStartItem m_TagString: Untagged @@ -228,3 +230,66 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: Text_Name: {fileID: 8232507227673836802} +--- !u!114 &713724719131404728 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5094190157828326286} + m_Enabled: 0 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e19747de3f5aca642ab2be37e372fb86, type: 3} + m_Name: + m_EditorClassIdentifier: + m_EffectColor: {r: 0.48235294, g: 0.7254902, b: 1, a: 0.40392157} + m_EffectDistance: {x: 1, y: -1} + m_UseGraphicAlpha: 1 +--- !u!114 &144084811267613343 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 5094190157828326286} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 9085046f02f69544eb97fd06b6048fe2, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Navigation: + m_Mode: 3 + m_WrapAround: 0 + m_SelectOnUp: {fileID: 0} + m_SelectOnDown: {fileID: 0} + m_SelectOnLeft: {fileID: 0} + m_SelectOnRight: {fileID: 0} + m_Transition: 1 + m_Colors: + m_NormalColor: {r: 1, g: 1, b: 1, a: 1} + m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1} + m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1} + m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608} + m_ColorMultiplier: 1 + m_FadeDuration: 0.1 + m_SpriteState: + m_HighlightedSprite: {fileID: 0} + m_PressedSprite: {fileID: 0} + m_SelectedSprite: {fileID: 0} + m_DisabledSprite: {fileID: 0} + m_AnimationTriggers: + m_NormalTrigger: Normal + m_HighlightedTrigger: Highlighted + m_PressedTrigger: Pressed + m_SelectedTrigger: Selected + m_DisabledTrigger: Disabled + m_Interactable: 1 + m_TargetGraphic: {fileID: 8340526939583729682} + toggleTransition: 1 + graphic: {fileID: 0} + m_Group: {fileID: 0} + onValueChanged: + m_PersistentCalls: + m_Calls: [] + m_IsOn: 0 diff --git a/Assets/Scripts/Studio/UI/Elements/UI_QuickStartItem.cs b/Assets/Scripts/Studio/UI/Elements/UI_QuickStartItem.cs index 543364a3..9bf2b3a5 100644 --- a/Assets/Scripts/Studio/UI/Elements/UI_QuickStartItem.cs +++ b/Assets/Scripts/Studio/UI/Elements/UI_QuickStartItem.cs @@ -7,21 +7,29 @@ using XRLib.UI; namespace Studio.UI { - public class UI_QuickStartItem : UIBase, IPointerDownHandler + public class UI_QuickStartItem : UIBase { public TextMeshProUGUI Text_Name; - + public Toggle toggle; public Action onClickButton; + public Outline outline; public void Init(string name, Action clickEvent) { + toggle = GetComponent(); + toggle.group = transform.parent.GetComponent(); + outline = GetComponent(); + toggle.onValueChanged.AddListener(OnClickEvent); + Text_Name.text = name; onClickButton = clickEvent; } - public void OnPointerDown(PointerEventData eventData) + public void OnClickEvent(bool isOn) { - onClickButton?.Invoke(); + outline.enabled = isOn; + if(isOn) + onClickButton?.Invoke(); } } } diff --git a/Assets/Scripts/Studio/UI/Panel/Panel_OpenProjectInfo.cs b/Assets/Scripts/Studio/UI/Panel/Panel_OpenProjectInfo.cs index e731e6f5..d7138fa0 100644 --- a/Assets/Scripts/Studio/UI/Panel/Panel_OpenProjectInfo.cs +++ b/Assets/Scripts/Studio/UI/Panel/Panel_OpenProjectInfo.cs @@ -18,10 +18,12 @@ namespace Studio.UI { private GameObject recentProjectItemPrefab; + private List outlines = new(); public TMP_InputField InputField_ProjectRoute; + public Outline projectRouteOutline; public Button Button_FileExplorer; //public Button Button_Server; - public RectTransform RecentProjects; + public ToggleGroup RecentProjects; public Action onClickFileExplorer; public Action onClickServer; @@ -33,13 +35,21 @@ namespace Studio.UI public Action onClickOpen; + private Color warningOutlineColor = new Color32(0xFF, 0x00, 0x00, 0xFF); + private Color32 selectedOutlineColor = new Color32(0x7B, 0xB9, 0xFF, 0xFF); + public override void AfterAwake() { recentProjectItemPrefab = Resources.Load("Prefabs/UI/PRF_QuickStartItem"); + projectRouteOutline = InputField_ProjectRoute.GetComponent(); + InputField_ProjectRoute.onSelect.AddListener(OnSelectProjectRoute); + InputField_ProjectRoute.onDeselect.AddListener(OnDeselectProjectRoute); InputField_ProjectRoute.onEndEdit.AddListener(OnEndEditProjectRoute); Button_FileExplorer.onClick.AddListener(OnClickFileExplorer); Button_Open.onClick.AddListener(OnClickOpen); + outlines.Add(projectRouteOutline); + // Test for (int i = 0; i < 3; i++) { @@ -47,10 +57,24 @@ namespace Studio.UI } } + private void OnSelectProjectRoute(string input) + { + RecentProjects.SetAllTogglesOff(); + projectRouteOutline.effectColor = selectedOutlineColor; + projectRouteOutline.enabled = true; + } + + private void OnDeselectProjectRoute(string input) + { + projectRouteOutline.enabled = false; + } + private void OnEndEditProjectRoute(string input) { if (!IsPathVaild(input)) { + projectRouteOutline.effectColor = warningOutlineColor; + projectRouteOutline.enabled = true; InputFieldHighlight(InputField_ProjectRoute); Footer.gameObject.SetActive(false); Text_ProjectName.text = string.Empty; @@ -100,8 +124,9 @@ namespace Studio.UI public void CreateRecentProjectItem() { - UI_QuickStartItem item = Instantiate(recentProjectItemPrefab, RecentProjects).GetComponent(); + UI_QuickStartItem item = Instantiate(recentProjectItemPrefab, RecentProjects.transform).GetComponent(); item.Init(name, OnClickItem); + outlines.Add(item.outline); } private void OnClickItem() @@ -143,16 +168,15 @@ namespace Studio.UI } private IEnumerator Blink(TMP_InputField inputField) { - var inputFieldOutline = inputField.GetComponent(); - Color tempColor = inputFieldOutline.effectColor; + Color tempColor = warningOutlineColor; var count = 0; - while (count < 1) + while (count < 2) { while (tempColor.a < 1f) { tempColor.a = Mathf.Clamp(tempColor.a + 0.1f, 0f, 1f); - inputFieldOutline.effectColor = tempColor; + projectRouteOutline.effectColor = tempColor; yield return new WaitForSeconds(0.02f); } yield return new WaitForSeconds(0.1f); @@ -160,7 +184,7 @@ namespace Studio.UI while (tempColor.a > 0f) { tempColor.a = Mathf.Clamp(tempColor.a - 0.1f, 0f, 1f); - inputFieldOutline.effectColor = tempColor; + projectRouteOutline.effectColor = tempColor; yield return new WaitForSeconds(0.02f); } yield return new WaitForSeconds(0.1f); From 2232142a1a5da7ef2eee6a106ca6be2e36c13085 Mon Sep 17 00:00:00 2001 From: geondo55 <102933884+geondo55@users.noreply.github.com> Date: Tue, 22 Jul 2025 16:04:03 +0900 Subject: [PATCH 2/3] =?UTF-8?q?Quick=20Start=20=ED=8C=A8=EB=84=90=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EC=B5=9C=EA=B7=BC=20=EC=98=A4=ED=94=88=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EB=AA=A9=EB=A1=9D=20=EB=B6=88=EB=9F=AC=EC=98=A4?= =?UTF-8?q?=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Prefabs/AAA/Panel_Start.prefab | 177 ++---------------- .../Prefabs/UI/PRF_QuickStartItem.prefab | 4 +- .../Scripts/Studio/Managers/ProjectManager.cs | 6 +- .../Studio/UI/Elements/UI_QuickStartItem.cs | 18 +- .../Studio/UI/Panel/Panel_OpenProjectInfo.cs | 168 +++++++++-------- 5 files changed, 128 insertions(+), 245 deletions(-) diff --git a/Assets/Prefabs/AAA/Panel_Start.prefab b/Assets/Prefabs/AAA/Panel_Start.prefab index d1f76710..a492eef0 100644 --- a/Assets/Prefabs/AAA/Panel_Start.prefab +++ b/Assets/Prefabs/AAA/Panel_Start.prefab @@ -212,6 +212,7 @@ GameObject: m_Component: - component: {fileID: 8437882087950305944} - component: {fileID: 3711770782896488384} + - component: {fileID: 5326816195190135268} m_Layer: 5 m_Name: RecentProjects m_TagString: Untagged @@ -264,6 +265,19 @@ MonoBehaviour: m_ChildScaleWidth: 0 m_ChildScaleHeight: 0 m_ReverseArrangement: 0 +--- !u!114 &5326816195190135268 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 458907986517640396} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2fafe2cfe61f6974895a912c3755e8f1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_AllowSwitchOff: 0 --- !u!1 &703085024844562267 GameObject: m_ObjectHideFlags: 0 @@ -1226,163 +1240,6 @@ MonoBehaviour: m_hasFontAssetChanged: 0 m_baseMaterial: {fileID: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0} ---- !u!1 &1832714327733579061 -GameObject: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - serializedVersion: 6 - m_Component: - - component: {fileID: 355806425362008241} - - component: {fileID: 7624702482975016712} - - component: {fileID: 4834582946643161024} - - component: {fileID: 2989564741201914090} - m_Layer: 5 - m_Name: Placeholder - m_TagString: Untagged - m_Icon: {fileID: 0} - m_NavMeshLayer: 0 - m_StaticEditorFlags: 0 - m_IsActive: 1 ---- !u!224 &355806425362008241 -RectTransform: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1832714327733579061} - m_LocalRotation: {x: -0, y: -0, z: -0, w: 1} - m_LocalPosition: {x: 0, y: 0, z: 0} - m_LocalScale: {x: 1, y: 1, z: 1} - m_ConstrainProportionsScale: 0 - m_Children: [] - m_Father: {fileID: 983045090952497384} - m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} - m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 1, y: 1} - m_AnchoredPosition: {x: 0, y: 0} - m_SizeDelta: {x: 0, y: 0} - m_Pivot: {x: 0.5, y: 0.5} ---- !u!222 &7624702482975016712 -CanvasRenderer: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1832714327733579061} - m_CullTransparentMesh: 1 ---- !u!114 &4834582946643161024 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1832714327733579061} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} - m_Name: - m_EditorClassIdentifier: - m_Material: {fileID: 0} - m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 - m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} - m_Maskable: 1 - m_OnCullStateChanged: - m_PersistentCalls: - m_Calls: [] - m_text: Input Project Route - m_isRightToLeft: 0 - m_fontAsset: {fileID: 11400000, guid: 4f170a218dfffe4489dc7ddd54bc15cf, type: 2} - m_sharedMaterial: {fileID: 6975767319296004534, guid: 4f170a218dfffe4489dc7ddd54bc15cf, type: 2} - m_fontSharedMaterials: [] - m_fontMaterial: {fileID: 0} - m_fontMaterials: [] - m_fontColor32: - serializedVersion: 2 - rgba: 2150773298 - m_fontColor: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 0.5} - m_enableVertexGradient: 0 - m_colorMode: 3 - m_fontColorGradient: - topLeft: {r: 1, g: 1, b: 1, a: 1} - topRight: {r: 1, g: 1, b: 1, a: 1} - bottomLeft: {r: 1, g: 1, b: 1, a: 1} - bottomRight: {r: 1, g: 1, b: 1, a: 1} - m_fontColorGradientPreset: {fileID: 0} - m_spriteAsset: {fileID: 0} - m_tintAllSprites: 0 - m_StyleSheet: {fileID: 0} - m_TextStyleHashCode: -1183493901 - m_overrideHtmlColors: 0 - m_faceColor: - serializedVersion: 2 - rgba: 4294967295 - m_fontSize: 16 - m_fontSizeBase: 16 - m_fontWeight: 400 - m_enableAutoSizing: 0 - m_fontSizeMin: 18 - m_fontSizeMax: 72 - m_fontStyle: 0 - m_HorizontalAlignment: 1 - m_VerticalAlignment: 512 - m_textAlignment: 65535 - m_characterSpacing: 0 - m_wordSpacing: 0 - m_lineSpacing: 0 - m_lineSpacingMax: 0 - m_paragraphSpacing: 0 - m_charWidthMaxAdj: 0 - m_TextWrappingMode: 0 - m_wordWrappingRatios: 0.4 - m_overflowMode: 0 - m_linkedTextComponent: {fileID: 0} - parentLinkedComponent: {fileID: 0} - m_enableKerning: 0 - m_ActiveFontFeatures: 6e72656b - m_enableExtraPadding: 1 - checkPaddingRequired: 0 - m_isRichText: 1 - m_EmojiFallbackSupport: 1 - m_parseCtrlCharacters: 1 - m_isOrthographic: 1 - m_isCullingEnabled: 0 - m_horizontalMapping: 0 - m_verticalMapping: 0 - m_uvLineOffset: 0 - m_geometrySortingOrder: 0 - m_IsTextObjectScaleStatic: 0 - m_VertexBufferAutoSizeReduction: 0 - m_useMaxVisibleDescender: 1 - m_pageToDisplay: 1 - m_margin: {x: 0, y: 0, z: 0, w: 0} - m_isUsingLegacyAnimationComponent: 0 - m_isVolumetricText: 0 - m_hasFontAssetChanged: 0 - m_baseMaterial: {fileID: 0} - m_maskOffset: {x: 0, y: 0, z: 0, w: 0} ---- !u!114 &2989564741201914090 -MonoBehaviour: - m_ObjectHideFlags: 0 - m_CorrespondingSourceObject: {fileID: 0} - m_PrefabInstance: {fileID: 0} - m_PrefabAsset: {fileID: 0} - m_GameObject: {fileID: 1832714327733579061} - m_Enabled: 1 - m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3} - m_Name: - m_EditorClassIdentifier: - m_IgnoreLayout: 1 - m_MinWidth: -1 - m_MinHeight: -1 - m_PreferredWidth: -1 - m_PreferredHeight: -1 - m_FlexibleWidth: -1 - m_FlexibleHeight: -1 - m_LayoutPriority: 1 --- !u!1 &2180362969977750842 GameObject: m_ObjectHideFlags: 0 @@ -1916,7 +1773,6 @@ RectTransform: m_LocalScale: {x: 1, y: 1, z: 1} m_ConstrainProportionsScale: 0 m_Children: - - {fileID: 355806425362008241} - {fileID: 1435990374165154572} m_Father: {fileID: 4178944374956037702} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} @@ -3253,7 +3109,7 @@ MonoBehaviour: m_TargetGraphic: {fileID: 864169242389839687} m_TextViewport: {fileID: 983045090952497384} m_TextComponent: {fileID: 2308701154462166673} - m_Placeholder: {fileID: 4834582946643161024} + m_Placeholder: {fileID: 0} m_VerticalScrollbar: {fileID: 0} m_VerticalScrollbarEventHandler: {fileID: 0} m_LayoutGroup: {fileID: 0} @@ -6166,6 +6022,7 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: InputField_ProjectRoute: {fileID: 0} + projectRouteOutline: {fileID: 0} Button_FileExplorer: {fileID: 0} RecentProjects: {fileID: 0} Text_ProjectName: {fileID: 0} @@ -6186,7 +6043,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 0 + m_IsActive: 1 --- !u!224 &1175600972014329731 RectTransform: m_ObjectHideFlags: 0 diff --git a/Assets/Resources/Prefabs/UI/PRF_QuickStartItem.prefab b/Assets/Resources/Prefabs/UI/PRF_QuickStartItem.prefab index 6e7c5a5c..a000a3ef 100644 --- a/Assets/Resources/Prefabs/UI/PRF_QuickStartItem.prefab +++ b/Assets/Resources/Prefabs/UI/PRF_QuickStartItem.prefab @@ -230,6 +230,8 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: Text_Name: {fileID: 8232507227673836802} + toggle: {fileID: 0} + outline: {fileID: 0} --- !u!114 &713724719131404728 MonoBehaviour: m_ObjectHideFlags: 0 @@ -242,7 +244,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: e19747de3f5aca642ab2be37e372fb86, type: 3} m_Name: m_EditorClassIdentifier: - m_EffectColor: {r: 0.48235294, g: 0.7254902, b: 1, a: 0.40392157} + m_EffectColor: {r: 0.48235294, g: 0.7254902, b: 1, a: 1} m_EffectDistance: {x: 1, y: -1} m_UseGraphicAlpha: 1 --- !u!114 &144084811267613343 diff --git a/Assets/Scripts/Studio/Managers/ProjectManager.cs b/Assets/Scripts/Studio/Managers/ProjectManager.cs index 6e6d43d0..70e7fb9c 100644 --- a/Assets/Scripts/Studio/Managers/ProjectManager.cs +++ b/Assets/Scripts/Studio/Managers/ProjectManager.cs @@ -104,6 +104,7 @@ namespace Studio.Manage ResetProjectSettingData(); var assetManager = ManagerHub.instance.Get(); + var canvas_Popup = CanvasManager.instance.GetCanvas(); assetManager.ClearFolderPathList(); assetManager.InitRessourceAsset(); @@ -112,6 +113,8 @@ namespace Studio.Manage curProjectTemplate = string.Empty; List assetDatas = new List(); curProjectData = CreateProjectData(assetDatas); + string fullPath = Path.Combine(curProjectPath, curProjectName + ".ocs"); + canvas_Popup.panel_openprojectinfo.AddRecentProject(fullPath); } public void OpenProejctSettingData(string filePath) { @@ -120,7 +123,6 @@ namespace Studio.Manage var sceneSettingService = ManagerHub.instance.Get(); ResetProjectSettingData(); - if (File.Exists(filePath)) { string json = File.ReadAllText(filePath); @@ -135,6 +137,8 @@ namespace Studio.Manage assetManager.CombineAssetFolderPaths(curProjectData.assetManagerData.localAssetsPaths); assetManager.SetAssetManager(curProjectData.assetManagerData); + + canvas_Popup.panel_openprojectinfo.AddRecentProject(filePath); } else { diff --git a/Assets/Scripts/Studio/UI/Elements/UI_QuickStartItem.cs b/Assets/Scripts/Studio/UI/Elements/UI_QuickStartItem.cs index 9bf2b3a5..509a8e00 100644 --- a/Assets/Scripts/Studio/UI/Elements/UI_QuickStartItem.cs +++ b/Assets/Scripts/Studio/UI/Elements/UI_QuickStartItem.cs @@ -11,25 +11,27 @@ namespace Studio.UI { public TextMeshProUGUI Text_Name; public Toggle toggle; - public Action onClickButton; + public Action onClickEvent; public Outline outline; - public void Init(string name, Action clickEvent) + private string path; + + public void Init(string path, Action clickEvent) { + this.path = path; toggle = GetComponent(); toggle.group = transform.parent.GetComponent(); - outline = GetComponent(); + outline = GetComponent(); toggle.onValueChanged.AddListener(OnClickEvent); - - Text_Name.text = name; - onClickButton = clickEvent; + Text_Name.text = path; + onClickEvent = clickEvent; } public void OnClickEvent(bool isOn) { outline.enabled = isOn; - if(isOn) - onClickButton?.Invoke(); + if (isOn) + onClickEvent?.Invoke(path); } } } diff --git a/Assets/Scripts/Studio/UI/Panel/Panel_OpenProjectInfo.cs b/Assets/Scripts/Studio/UI/Panel/Panel_OpenProjectInfo.cs index d7138fa0..48b6826a 100644 --- a/Assets/Scripts/Studio/UI/Panel/Panel_OpenProjectInfo.cs +++ b/Assets/Scripts/Studio/UI/Panel/Panel_OpenProjectInfo.cs @@ -1,11 +1,14 @@ -using Newtonsoft.Json; +using Newtonsoft.Json; using Ookii.Dialogs; using Studio.Core; +using Studio.Manage; using Studio.Util; using System; using System.Collections; using System.Collections.Generic; using System.IO; +using System.Linq; +using System.Text.RegularExpressions; using TMPro; using TriLibCore.SFB; using UnityEngine; @@ -17,7 +20,8 @@ namespace Studio.UI public class Panel_OpenProjectInfo : PanelBase { private GameObject recentProjectItemPrefab; - + private List recentProjectPathList = new(); + private const int maxRecentProjectCount = 3; private List outlines = new(); public TMP_InputField InputField_ProjectRoute; public Outline projectRouteOutline; @@ -35,52 +39,98 @@ namespace Studio.UI public Action onClickOpen; - private Color warningOutlineColor = new Color32(0xFF, 0x00, 0x00, 0xFF); + private const string projectPathsSaveKey = "RecentProjectPaths"; + private Color32 warningOutlineColor = new Color32(0xFF, 0x00, 0x00, 0xFF); private Color32 selectedOutlineColor = new Color32(0x7B, 0xB9, 0xFF, 0xFF); - + private Color32 defaultOutlineColor; + public override void AfterAwake() { recentProjectItemPrefab = Resources.Load("Prefabs/UI/PRF_QuickStartItem"); - projectRouteOutline = InputField_ProjectRoute.GetComponent(); - InputField_ProjectRoute.onSelect.AddListener(OnSelectProjectRoute); - InputField_ProjectRoute.onDeselect.AddListener(OnDeselectProjectRoute); - InputField_ProjectRoute.onEndEdit.AddListener(OnEndEditProjectRoute); + projectRouteOutline = InputField_ProjectRoute.GetComponent(); + defaultOutlineColor = projectRouteOutline.effectColor; + InputField_ProjectRoute.onSelect.AddListener(OnSelectSearchProjectRoute); + InputField_ProjectRoute.onValueChanged.AddListener(OnValueChangedSearchProjectRoute); Button_FileExplorer.onClick.AddListener(OnClickFileExplorer); Button_Open.onClick.AddListener(OnClickOpen); - outlines.Add(projectRouteOutline); + LoadRecentProjects(); + SetRecentProjectItems(); + } - // Test - for (int i = 0; i < 3; i++) + private void LoadRecentProjects() + { + if (PlayerPrefs.HasKey(projectPathsSaveKey)) { - CreateRecentProjectItem(); + string json = PlayerPrefs.GetString(projectPathsSaveKey); + recentProjectPathList = JsonConvert.DeserializeObject>(json); } } - private void OnSelectProjectRoute(string input) + private void SetRecentProjectItems() + { + foreach (Transform child in RecentProjects.transform) + { + Destroy(child.gameObject); + } + outlines.Clear(); + outlines.Add(projectRouteOutline); + foreach (string path in recentProjectPathList) + { + CreateRecentProjectItem(path); + } + } + + public void CreateRecentProjectItem(string path) + { + UI_QuickStartItem item = Instantiate(recentProjectItemPrefab, RecentProjects.transform).GetComponent(); + item.Init(path, OnClickItem); + outlines.Add(item.outline); + } + + private void OnClickItem(string path) + { + projectRouteOutline.effectColor = defaultOutlineColor; + Footer.gameObject.SetActive(true); + Text_ProjectName.text = Path.GetFileNameWithoutExtension(path); + } + + public void AddRecentProject(string newPath) + { + recentProjectPathList.Remove(newPath); + recentProjectPathList.Insert(0, newPath); + + if (recentProjectPathList.Count > maxRecentProjectCount) + recentProjectPathList.RemoveAt(recentProjectPathList.Count - 1); + + SaveRecentProjects(); + SetRecentProjectItems(); + } + + private void SaveRecentProjects() + { + string json = JsonConvert.SerializeObject(recentProjectPathList); + PlayerPrefs.SetString(projectPathsSaveKey, json); + PlayerPrefs.Save(); + } + + private void OnSelectSearchProjectRoute(string input) { RecentProjects.SetAllTogglesOff(); - projectRouteOutline.effectColor = selectedOutlineColor; - projectRouteOutline.enabled = true; + OnValueChangedSearchProjectRoute(input); } - private void OnDeselectProjectRoute(string input) - { - projectRouteOutline.enabled = false; - } - - private void OnEndEditProjectRoute(string input) + private void OnValueChangedSearchProjectRoute(string input) { if (!IsPathVaild(input)) { projectRouteOutline.effectColor = warningOutlineColor; - projectRouteOutline.enabled = true; - InputFieldHighlight(InputField_ProjectRoute); Footer.gameObject.SetActive(false); Text_ProjectName.text = string.Empty; return; } + projectRouteOutline.effectColor = selectedOutlineColor; Footer.gameObject.SetActive(true); var name = Path.GetFileNameWithoutExtension(input); Text_ProjectName.text = name; @@ -111,33 +161,25 @@ namespace Studio.UI if (paths.Count > 0 && !string.IsNullOrEmpty(paths[0].Name)) { + RecentProjects.SetAllTogglesOff(); + OnValueChangedSearchProjectRoute(paths[0].Name); InputField_ProjectRoute.text = paths[0].Name; InputField_ProjectRoute.onEndEdit?.Invoke(InputField_ProjectRoute.text); } onClickFileExplorer?.Invoke(); } - private void OnClickServer() - { - onClickServer?.Invoke(); - } - - public void CreateRecentProjectItem() - { - UI_QuickStartItem item = Instantiate(recentProjectItemPrefab, RecentProjects.transform).GetComponent(); - item.Init(name, OnClickItem); - outlines.Add(item.outline); - } - - private void OnClickItem() - { - Footer.gameObject.SetActive(true); - Text_ProjectName.text = "test Name"; - } - private void OnClickOpen() { - onClickOpen?.Invoke(); + if (File.Exists(GetProjectRoute())) + { + onClickOpen?.Invoke(); + } + else + { + CanvasManager.instance.GetCanvas().panel_toastmessage.ActivateMessage("프로젝트가 존재하지 않습니다."); + Footer.gameObject.SetActive(false); + } } public void Open() @@ -149,48 +191,24 @@ namespace Studio.UI { SetActive(false); } + public string GetProjectRoute() { - var route = InputField_ProjectRoute.text; - return route; + var target = outlines.FirstOrDefault(o => o.enabled && o.effectColor == selectedOutlineColor); + if (target == null) + return null; + var route = target.GetComponentInChildren().text; + var cleanRoute = Regex.Replace(route, @"\p{Z}|\p{C}", ""); + return cleanRoute; } + private bool IsPathVaild(string path) { - if(path == string.Empty || !File.Exists(path)) + if (path == string.Empty || !File.Exists(path)) { return false; } return true; } - private void InputFieldHighlight(TMP_InputField inputField) - { - CoroutineRunner.instance.StartCoroutine(Blink(inputField)); - } - private IEnumerator Blink(TMP_InputField inputField) - { - Color tempColor = warningOutlineColor; - var count = 0; - - while (count < 2) - { - while (tempColor.a < 1f) - { - tempColor.a = Mathf.Clamp(tempColor.a + 0.1f, 0f, 1f); - projectRouteOutline.effectColor = tempColor; - yield return new WaitForSeconds(0.02f); - } - yield return new WaitForSeconds(0.1f); - - while (tempColor.a > 0f) - { - tempColor.a = Mathf.Clamp(tempColor.a - 0.1f, 0f, 1f); - projectRouteOutline.effectColor = tempColor; - yield return new WaitForSeconds(0.02f); - } - yield return new WaitForSeconds(0.1f); - - count++; - } - } } } From 89bee012b94d03cb9fc5408c9bf3e40e268797cd Mon Sep 17 00:00:00 2001 From: geondo55 <102933884+geondo55@users.noreply.github.com> Date: Wed, 23 Jul 2025 11:17:49 +0900 Subject: [PATCH 3/3] =?UTF-8?q?Quick=20Start=20=ED=8C=A8=EB=84=90=20?= =?UTF-8?q?=EB=94=94=EC=9E=90=EC=9D=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Prefabs/AAA/Panel_Start.prefab | 4 ++-- Assets/Scenes/0.30.0.unity | 16 ++++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/Assets/Prefabs/AAA/Panel_Start.prefab b/Assets/Prefabs/AAA/Panel_Start.prefab index a492eef0..4b7e05d4 100644 --- a/Assets/Prefabs/AAA/Panel_Start.prefab +++ b/Assets/Prefabs/AAA/Panel_Start.prefab @@ -2269,7 +2269,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5} - m_AnchoredPosition: {x: -195, y: 233} + m_AnchoredPosition: {x: -177.4, y: 233} m_SizeDelta: {x: 150, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &8272817071417235799 @@ -4746,7 +4746,7 @@ RectTransform: m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 1, y: 0} m_AnchorMax: {x: 1, y: 0} - m_AnchoredPosition: {x: -195, y: 745} + m_AnchoredPosition: {x: -177, y: 745} m_SizeDelta: {x: 150, y: 30} m_Pivot: {x: 0.5, y: 0.5} --- !u!222 &6841321008823380815 diff --git a/Assets/Scenes/0.30.0.unity b/Assets/Scenes/0.30.0.unity index a416e348..8f4f8760 100644 --- a/Assets/Scenes/0.30.0.unity +++ b/Assets/Scenes/0.30.0.unity @@ -3084,6 +3084,22 @@ PrefabInstance: propertyPath: m_IsActive value: 1 objectReference: {fileID: 0} + - target: {fileID: 6597791563779182049, guid: 7dc4728378d41514e97175c1e1256bba, type: 3} + propertyPath: m_AnchorMax.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6597791563779182049, guid: 7dc4728378d41514e97175c1e1256bba, type: 3} + propertyPath: m_AnchorMin.y + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6597791563779182049, guid: 7dc4728378d41514e97175c1e1256bba, type: 3} + propertyPath: m_AnchoredPosition.x + value: 0 + objectReference: {fileID: 0} + - target: {fileID: 6597791563779182049, guid: 7dc4728378d41514e97175c1e1256bba, type: 3} + propertyPath: m_AnchoredPosition.y + value: 0 + objectReference: {fileID: 0} - target: {fileID: 8097777418585433427, guid: 7dc4728378d41514e97175c1e1256bba, type: 3} propertyPath: m_AnchoredPosition.x value: -50.398438