using System.Collections; using System.Collections.Generic; using System.IO; using UnityEngine; using Raumgleiter.BaseRGDK; using Raumgleiter.Packages.FileExplorer; public class FileSelection : MonoBehaviour { //WorldReference public static FileSelection WorldReference; //Connections [Header("Connections")] public AppManager AppManager; public GameObject StartScreenPanel; public GameObject ExplorerPanel; public Explorer Explorer; // public GameObject iUniformSettings; //Resources //[Header("Resources")] //Attributes //[Header("Attributes")] //Stats //[Header("Stats")] protected bool IsAwoken = false; private string SelectedPath = ""; //Getter public string GetSelectedPath() { return SelectedPath; } //Delegates //------------------------------------------------------------------------------------------------------------------ //awake protected void Awake() { //Already Awoken? if (!IsAwoken) { IsAwoken = true; WorldReference = this; } } //------------------------------------------------------------------------------------------------------------------ //start protected void Start() { } //------------------------------------------------------------------------------------------------------------------ //setup public void SetUp() { } //------------------------------------------------------------------------------------------------------------------ //destroy //*********************************************************************************************************************** //update //*********************************************************************************************************************** //refresh //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //*********************************************************************************************************************** //events public void OnClickOpenExplorer() { OpenExplorer(); } //------------------------------------------------------------------------------------------------------------------ private void OnFilesSelected(List pathOfSelectedFiles) { //Validate if(pathOfSelectedFiles.Count == 0) { //Player pressed abort OpenStartScreen(); return; } //Save Path SelectedPath = pathOfSelectedFiles[0]; //Report that we're done AppManager.OnFileSelectionDone(); } //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //*********************************************************************************************************************** //private, protected private void OpenExplorer() { StartScreenPanel.SetActive(false); ExplorerPanel.SetActive(true); string DropPath = PathsLocal.GetDROP(); //Debug.Log("FileSelection::DropPath:" + DropPath); if (!Directory.Exists(DropPath)) { Directory.CreateDirectory(DropPath); } Explorer.Open( ExplorerMode.Directory, OnFilesSelected, DropPath); } //------------------------------------------------------------------------------------------------------------------ private void OpenStartScreen() { StartScreenPanel.SetActive(true); ExplorerPanel.SetActive(false); } //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //*********************************************************************************************************************** //internal //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //*********************************************************************************************************************** //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //*********************************************************************************************************************** //public //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ //*********************************************************************************************************************** //getter, setter //------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------ }