78 lines
2.0 KiB
C#
78 lines
2.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using TMPro;
|
|
using TriLibCore.SFB;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
using UnityEngine.UI;
|
|
using XRLib.UI;
|
|
|
|
namespace Studio.UI
|
|
{
|
|
public class Panel_NewProjectInfo : PanelBase
|
|
{
|
|
public TMP_InputField InputField_ProjectName;
|
|
public TMP_InputField InputField_ProjectRoute;
|
|
public TMP_InputField InputField_ProjectTemplate;
|
|
public Button Button_FileExplorer;
|
|
public Button Button_Dropdown;
|
|
public Button Button_Create;
|
|
|
|
public Action onClickFileExplorer;
|
|
public Action onClickCreate;
|
|
|
|
private string defaultPath = $"C:\\Users\\{Environment.UserName}";
|
|
|
|
public override void AfterAwake()
|
|
{
|
|
Button_FileExplorer.onClick.AddListener(OnClickFileExplorer);
|
|
Button_Create.onClick.AddListener(OnClickCreate);
|
|
|
|
InputField_ProjectRoute.text = defaultPath;
|
|
}
|
|
|
|
private void OnClickFileExplorer()
|
|
{
|
|
var paths = StandaloneFileBrowser.OpenFolderPanel("Select Folder", defaultPath, false);
|
|
|
|
if (paths.Count > 0 && !string.IsNullOrEmpty(paths[0].Name))
|
|
{
|
|
InputField_ProjectRoute.text = paths[0].Name;
|
|
}
|
|
onClickFileExplorer?.Invoke();
|
|
}
|
|
|
|
private void OnClickCreate()
|
|
{
|
|
onClickCreate?.Invoke();
|
|
}
|
|
|
|
public void Open()
|
|
{
|
|
SetActive(true);
|
|
}
|
|
|
|
public void Close()
|
|
{
|
|
SetActive(false);
|
|
}
|
|
public string GetProjectName()
|
|
{
|
|
var name = InputField_ProjectName.text;
|
|
return name;
|
|
}
|
|
public string GetProjectRoute()
|
|
{
|
|
var route = InputField_ProjectRoute.text;
|
|
return route;
|
|
}
|
|
public string GetProjectTemplate()
|
|
{
|
|
var template = InputField_ProjectTemplate.text;
|
|
return template;
|
|
}
|
|
|
|
}
|
|
}
|