Ejemplo n.º 1
0
        private void Start()
        {
            // Add a listener to the switch button so we can switch the File Browser mode with it
            if (switchButton != null)
            {
                switchButton.onClick.AddListener(SwitchButton);
            }

            // Add a listener to the inputfield so we can update the extensions
            if (extensionInputField != null)
            {
                extensionInputField.onEndEdit.AddListener(OnSubmitExtensions);
            }

            // Create the File Browser
            fileBrowser = Instantiate(prefabBrowser).GetComponent <SkywardFileBrowser>();

            // Change some settings
            fileBrowser.Settings.RequireFileExtensionInSaveMode = true;
            fileBrowser.Settings.ShowHiddenFiles = true;

            // Set a canvas for the File Browser
            if (setCustomCanvas && customCanvas != null)
            {
                fileBrowser.SetParentCanvas(customCanvas);
            }

            // Set a fake file system so we can simulate the file system of our in-game computer
            if (setFakeFileSystem && FakeFileSystemJSON != null)
            {
                fileBrowser.FakeFileSystem(SfbFileSystem.CreateFromJSON(FakeFileSystemJSON.text));
            }

            // There are multiple examples in the asset, so in order to give each file browser it's own settings file
            fileBrowser.Settings.SettingsSaveFileName = "SfbInGameExampleSettings";

            // Open the File Browser
            OpenFileBrowser(SfbMode.Open, defaultPath, Output, extensions);
        }
Ejemplo n.º 2
0
 public void FakeFileSystem(SfbFileSystem fileSystem)
 {
     if (!fileSystem.IsFake) {
         Debug.LogError("Fake fileSystem must be set as fake");
         return;
     }
     this.fileSystem = fileSystem;
 }
 public void FakeFileSystem(SfbFileSystem fileSystem)
 {
     SfbInternal.FakeFileSystem(fileSystem);
 }