Merge pull request 'Quick Start 패널에서 최근 오픈 파일 목록 불러오기' (#222) from pgd/20250721_2 into main
Reviewed-on: http://220.90.135.190:3000/UVCXR/Studio/pulls/222
This commit was merged in pull request #222.
This commit is contained in:
@@ -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}
|
||||
@@ -2413,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
|
||||
@@ -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}
|
||||
@@ -4890,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
|
||||
@@ -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
|
||||
|
||||
@@ -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,68 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Text_Name: {fileID: 8232507227673836802}
|
||||
toggle: {fileID: 0}
|
||||
outline: {fileID: 0}
|
||||
--- !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: 1}
|
||||
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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -104,6 +104,7 @@ namespace Studio.Manage
|
||||
ResetProjectSettingData();
|
||||
|
||||
var assetManager = ManagerHub.instance.Get<AssetManager>();
|
||||
var canvas_Popup = CanvasManager.instance.GetCanvas<Canvas_Popup>();
|
||||
assetManager.ClearFolderPathList();
|
||||
assetManager.InitRessourceAsset();
|
||||
|
||||
@@ -112,6 +113,8 @@ namespace Studio.Manage
|
||||
curProjectTemplate = string.Empty;
|
||||
List<AssetData> assetDatas = new List<AssetData>();
|
||||
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<SceneStartSettingManager>();
|
||||
|
||||
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
|
||||
{
|
||||
|
||||
@@ -7,21 +7,31 @@ 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<string> onClickEvent;
|
||||
public Outline outline;
|
||||
|
||||
public Action onClickButton;
|
||||
private string path;
|
||||
|
||||
public void Init(string name, Action clickEvent)
|
||||
public void Init(string path, Action<string> clickEvent)
|
||||
{
|
||||
Text_Name.text = name;
|
||||
onClickButton = clickEvent;
|
||||
this.path = path;
|
||||
toggle = GetComponent<Toggle>();
|
||||
toggle.group = transform.parent.GetComponent<ToggleGroup>();
|
||||
outline = GetComponent<Outline>();
|
||||
toggle.onValueChanged.AddListener(OnClickEvent);
|
||||
Text_Name.text = path;
|
||||
onClickEvent = clickEvent;
|
||||
}
|
||||
|
||||
public void OnPointerDown(PointerEventData eventData)
|
||||
public void OnClickEvent(bool isOn)
|
||||
{
|
||||
onClickButton?.Invoke();
|
||||
outline.enabled = isOn;
|
||||
if (isOn)
|
||||
onClickEvent?.Invoke(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,11 +20,14 @@ namespace Studio.UI
|
||||
public class Panel_OpenProjectInfo : PanelBase
|
||||
{
|
||||
private GameObject recentProjectItemPrefab;
|
||||
|
||||
private List<string> recentProjectPathList = new();
|
||||
private const int maxRecentProjectCount = 3;
|
||||
private List<Outline> 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,30 +39,98 @@ namespace Studio.UI
|
||||
|
||||
public Action onClickOpen;
|
||||
|
||||
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<GameObject>("Prefabs/UI/PRF_QuickStartItem");
|
||||
InputField_ProjectRoute.onEndEdit.AddListener(OnEndEditProjectRoute);
|
||||
projectRouteOutline = InputField_ProjectRoute.GetComponent<Outline>();
|
||||
defaultOutlineColor = projectRouteOutline.effectColor;
|
||||
InputField_ProjectRoute.onSelect.AddListener(OnSelectSearchProjectRoute);
|
||||
InputField_ProjectRoute.onValueChanged.AddListener(OnValueChangedSearchProjectRoute);
|
||||
Button_FileExplorer.onClick.AddListener(OnClickFileExplorer);
|
||||
Button_Open.onClick.AddListener(OnClickOpen);
|
||||
|
||||
// Test
|
||||
for (int i = 0; i < 3; i++)
|
||||
LoadRecentProjects();
|
||||
SetRecentProjectItems();
|
||||
}
|
||||
|
||||
private void LoadRecentProjects()
|
||||
{
|
||||
if (PlayerPrefs.HasKey(projectPathsSaveKey))
|
||||
{
|
||||
CreateRecentProjectItem();
|
||||
string json = PlayerPrefs.GetString(projectPathsSaveKey);
|
||||
recentProjectPathList = JsonConvert.DeserializeObject<List<string>>(json);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEndEditProjectRoute(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<UI_QuickStartItem>();
|
||||
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();
|
||||
OnValueChangedSearchProjectRoute(input);
|
||||
}
|
||||
|
||||
private void OnValueChangedSearchProjectRoute(string input)
|
||||
{
|
||||
if (!IsPathVaild(input))
|
||||
{
|
||||
InputFieldHighlight(InputField_ProjectRoute);
|
||||
projectRouteOutline.effectColor = warningOutlineColor;
|
||||
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;
|
||||
@@ -87,32 +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).GetComponent<UI_QuickStartItem>();
|
||||
item.Init(name, OnClickItem);
|
||||
}
|
||||
|
||||
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<Canvas_Popup>().panel_toastmessage.ActivateMessage("프로젝트가 존재하지 않습니다.");
|
||||
Footer.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void Open()
|
||||
@@ -124,49 +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<TextMeshProUGUI>().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)
|
||||
{
|
||||
var inputFieldOutline = inputField.GetComponent<Outline>();
|
||||
Color tempColor = inputFieldOutline.effectColor;
|
||||
var count = 0;
|
||||
|
||||
while (count < 1)
|
||||
{
|
||||
while (tempColor.a < 1f)
|
||||
{
|
||||
tempColor.a = Mathf.Clamp(tempColor.a + 0.1f, 0f, 1f);
|
||||
inputFieldOutline.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);
|
||||
inputFieldOutline.effectColor = tempColor;
|
||||
yield return new WaitForSeconds(0.02f);
|
||||
}
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user