Ejemplo n.º 1
0
        // Open a file browser to save and load files
        private void OpenFileBrowser(FileBrowserMode browserMode)
        {
            if (browserMode == FileBrowserMode.Save && String.IsNullOrEmpty(input_qr_string.text))
            {
                Debug.Log("Could not start file browser becuase QR has not been generated");
                message.text = "Generate QR Code First";
                return;
            }
            // Create the file browser and name it
            GameObject fileBrowserObject = Instantiate(FileBrowserPrefab, transform);

            fileBrowserObject.name = "FileBrowser";

            // Set the mode to save or load
            FileBrowser fileBrowserScript = fileBrowserObject.GetComponent <FileBrowser>();

            fileBrowserScript.SetupFileBrowser(PortraitMode ? ViewMode.Portrait : ViewMode.Landscape);
            if (browserMode == FileBrowserMode.Save)
            {
                fileBrowserScript.SaveFilePanel(this, "SaveImageFromPath", input_qr_string.text, PNG);
            }
            else
            {
                fileBrowserScript.OpenFilePanel(this, "LoadImageFromPath", FileExtension);
            }
        }
Ejemplo n.º 2
0
        // Open a file browser to save and load files
        private void OpenFileBrowser(FileBrowserMode fileBrowserMode, string startPath)
        {
            // Create the file browser and name it
            GameObject fileBrowserObject = Instantiate(FileBrowserPrefab, transform);

            fileBrowserObject.name = "FileBrowser";


            // Set the mode to save or load
            FileBrowser fileBrowserScript = fileBrowserObject.GetComponent <FileBrowser>();

            if (startPath == "")
            {
                fileBrowserScript.SetupFileBrowser(PortraitMode ? ViewMode.Portrait : ViewMode.Landscape);
            }
            else
            {
                fileBrowserScript.SetupFileBrowser(PortraitMode ? ViewMode.Portrait : ViewMode.Landscape, startPath);
            }

            if (fileBrowserMode == FileBrowserMode.Load)
            {
                fileBrowserScript.OpenFilePanel(FileExtensions);
                // Subscribe to OnFileSelect event (call LoadFileUsingPath using path)
                fileBrowserScript.OnFileSelect += LoadFileUsingPath;
            }
        }
Ejemplo n.º 3
0
        // Open a file browser to save and load files
        private void OpenFileBrowser(FileBrowserMode fileBrowserMode)
        {
            string startFolder = "";

            if (Application.platform == RuntimePlatform.Android && (GameObject.Find("BGMManager").GetComponent <BGMManager>().saveKey == "[system]CharacterSheet" || GameObject.Find("BGMManager").GetComponent <BGMManager>().saveKey == "[system]消去ファイルCS"))
            {
                startFolder = Application.persistentDataPath;
            }
            if (Application.platform == RuntimePlatform.IPhonePlayer && (GameObject.Find("BGMManager").GetComponent <BGMManager>().saveKey == "[system]CharacterSheet" || GameObject.Find("BGMManager").GetComponent <BGMManager>().saveKey == "[system]CharacterIllstPath"))
            {
                startFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + "/Documents";
            }
            if (GameObject.Find("BGMManager").GetComponent <BGMManager>().saveKey == "[system]消去ファイル")
            {
                string path = Application.persistentDataPath + "/scenario"; if (Directory.Exists(path))
                {
                    startFolder = path;
                }
            }
#if UNITY_STANDALONE_WIN || UNITY_EDITOR
#else
            if (GameObject.Find("BGMManager").GetComponent <BGMManager>().saveKey == "[system]進行中シナリオ")
            {
                string path = Application.persistentDataPath + "/scenario"; if (Directory.Exists(path))
                {
                    startFolder = path;
                }
                else
                {
                    GameObject.Find("TitleManager").GetComponent <TitleManager>().SelectButton.SetActive(true);
                    GameObject.Find("TitleManager").GetComponent <TitleManager>().DeleteButton.SetActive(true);
                    GameObject obj = GameObject.Find("JumpButton").GetComponent <ScenarioWebView>().errorObject;
                    obj.SetActive(true);
                    obj.GetComponentInChildren <Text>().text         = "<size=32>まずは投稿サイトからシナリオをDLしましょう!</size>";
                    obj.GetComponent <RectTransform>().localPosition = new Vector3(0, -370, 0);
                    return;
                }
            }
#endif
            // Create the file browser and name it
            GameObject fileBrowserObject = Instantiate(FileBrowserPrefab, transform);
            fileBrowserObject.name = "FileBrowser";
            // Set the mode to save or load
            FileBrowser fileBrowserScript = fileBrowserObject.GetComponent <FileBrowser>();
            fileBrowserScript.SetupFileBrowser(PortraitMode ? ViewMode.Portrait : ViewMode.Landscape, startFolder);
            if (fileBrowserMode == FileBrowserMode.Save)
            {
                fileBrowserScript.SaveFilePanel("NoName", FileExtensions);
                // Subscribe to OnFileSelect event (call SaveFileUsingPath using path)
                fileBrowserScript.OnFileSelect += SaveFileUsingPath;
            }
            else
            {
                fileBrowserScript.OpenFilePanel(FileExtensions);
                // Subscribe to OnFileSelect event (call LoadFileUsingPath using path)
                fileBrowserScript.OnFileSelect += LoadFileUsingPath;
            }
        }
Ejemplo n.º 4
0
    // Open a file browser to save and load files
    private void OpenFileBrowser(FileBrowserMode fileBrowserMode)
    {
        // Create the file browser and name it
        GameObject fileBrowserObject = Instantiate(FileBrowserPrefab, transform);

        fileBrowserObject.name = "FileBrowser";
        // Set the mode to save or load
        GracesGames.SimpleFileBrowser.Scripts.FileBrowser fileBrowserScript = fileBrowserObject.GetComponent <GracesGames.SimpleFileBrowser.Scripts.FileBrowser>();
        fileBrowserScript.SetupFileBrowser(PortraitMode ? ViewMode.Portrait : ViewMode.Landscape);
        if (fileBrowserMode == FileBrowserMode.Save)
        {
            fileBrowserScript.SaveFilePanel(this, "SaveFileUsingPath", "Microbe Plotter", FileExtension);
        }
        else
        {
            fileBrowserScript.OpenFilePanel(this, "LoadFileUsingPath", FileExtension);
        }
    }
Ejemplo n.º 5
0
        // Open a file browser to save and load files
        private void OpenFileBrowser(FileBrowserMode fileBrowserMode)
        {
            // Create the file browser and name it
            GameObject fileBrowserObject = Instantiate(FileBrowserPrefab, transform);

            fileBrowserObject.transform.localScale = fileBrowserObject.transform.localScale * 0.75f;
            fileBrowserObject.name = "FileBrowser";
            // Set the mode to save or load
            FileBrowser fileBrowserScript = fileBrowserObject.GetComponent <FileBrowser>();

            fileBrowserScript.SetupFileBrowser(PortraitMode ? ViewMode.Portrait : ViewMode.Landscape);
            if (fileBrowserMode == FileBrowserMode.Save)
            {
                fileBrowserScript.SaveFilePanel(this, "SaveFileUsingPath", "DemoText", FileExtension);
            }
            else
            {
                fileBrowserScript.OpenFilePanel(this, "LoadFileUsingPath", FileExtension);
            }
        }
Ejemplo n.º 6
0
        // Open a file browser to save and load files
        private void OpenFileBrowser(FileBrowserMode fileBrowserMode)
        {
            // Create the file browser and name it
            GameObject fileBrowserObject = Instantiate(FileBrowserPrefab, transform);

            fileBrowserObject.name = "FileBrowser";
            // Set the mode to save or load
            FileBrowser fileBrowserScript = fileBrowserObject.GetComponent <FileBrowser>();

            fileBrowserScript.SetupFileBrowser(PortraitMode ? ViewMode.Portrait : ViewMode.Landscape, GameObject.Find("Canvas"));
            if (fileBrowserMode == FileBrowserMode.Save)
            {
                fileBrowserScript.SaveFilePanel("DemoText", FileExtensions);
                // Subscribe to OnFileSelect event (call SaveFileUsingPath using path) [updated to UnityEvent ~K]
                fileBrowserScript.OnFileSelect.AddListener(SaveFileUsingPath);
            }
            else
            {
                fileBrowserScript.OpenFilePanel(FileExtensions);
                // Subscribe to OnFileSelect event (call LoadFileUsingPath using path) [updated to UnityEvent ~K]
                fileBrowserScript.OnFileSelect.AddListener(LoadFileUsingPath);
            }
        }