Exemplo n.º 1
0
    void GotFile(FileSelector.Status status, string path)
    {
        GameManager.paths[this.pathNum] = path;
        windowOpen = false;

        this.menu.SetActive(true);
    }
Exemplo n.º 2
0
    void GotFile(FileSelector.Status status, string path)
    {
        InitGame.path = path;
        windowOpen    = false;

        this.menu.SetActive(true);
    }
Exemplo n.º 3
0
    private void LoadData(FileSelector.Status status, string filePath)
    {
        Options.enabled = true;
        if (status != FileSelector.Status.Successful)
        {
            return;
        }
        foreach (var d in dots)
        {
            Destroy(d);
        }
        dots.Clear();
        var text  = File.ReadAllText(filePath);
        var lines = text.Split(newLineDelimiter);

        axisKeys = lines[0].Split(commaDelimiter);
        for (int i = 1; i < lines.Length; i++)
        {
            var values = lines[i].Split(commaDelimiter);
            var vals   = new float[values.Length];
            for (int j = 0; j < values.Length; j++)
            {
                if (values[j].Length > 0)
                {
                    vals[j] = float.Parse(values[j]);
                    GameObject dot = (GameObject)Instantiate(Dot);
                    dot.GetComponent <DotController>().Values = vals;
                    dots.Add(dot);
                }
            }
        }
    }
Exemplo n.º 4
0
    void gotSplatmapFile(FileSelector.Status status, string path)
    {
        if (path.Length != 0)
        {
            WWW       www = new WWW("file://" + path);
            Texture2D tex = new Texture2D(1, 1);
            www.LoadImageIntoTexture(tex);

            mr.sharedMaterial.SetTexture("_MainTex", tex);
        }
    }
Exemplo n.º 5
0
    void gotHeightmapFile(FileSelector.Status status, string path)
    {
        if (path != "")
        {
            WWW www = new WWW("file://" + path);
            www.LoadImageIntoTexture(heightmap);

            calculateMesh();
            mr.sharedMaterial.SetTexture("_HeightMap", heightmap);
        }
    }
Exemplo n.º 6
0
 public void Search_file_load(FileSelector.Status status, string path)
 {
     if (status != FileSelector.Status.Successful)
     {
         fondu.SetActive(false);
         return;
     }
     pathfile  = path;
     load_deck = true;
     Deck_Scene(0);
 }
 /// <summary>
 /// Callback function which is called when a path was selected in the FileSelector. used for files to load
 /// </summary>
 /// <param name="status">the return status of the fileSelector</param>
 /// <param name="path">the selected Path</param>
 private void GotFileToLoad(FileSelector.Status status, string path)
 {
     if (status == FileSelector.Status.Cancelled)
     {
         _outstandingObjectsToLoad.Remove(_outstandingObjectsToLoad.First());
     }
     else if (status == FileSelector.Status.Successful)
     {
         _lastUsedDirectory = Path.GetDirectoryName(path);
         Settings.LoadSettings(_outstandingObjectsToLoad.First(), path);
         _outstandingObjectsToLoad.Remove(_outstandingObjectsToLoad.First());
     }
     _fileSelectorIsShowed = false;
 }
 /// <summary>
 /// Callback function which is called when a path was selected in the FileSelector. used for files to save
 /// </summary>
 /// <param name="status">the return status of the fileSelector</param>
 /// <param name="path">the selected Path</param>
 private void GotFileToSave(FileSelector.Status status, string path)
 {
     if (status == FileSelector.Status.Cancelled || String.IsNullOrEmpty(path))
     {
         _outstandingObjectsToSave.Remove(_outstandingObjectsToSave.First());
     }
     else if (status == FileSelector.Status.Successful)
     {
         string extension = Path.GetExtension(path).ToLower();
         if (extension != ".xml")
         {
             path += ".xml";
         }
         _lastUsedDirectory = Path.GetDirectoryName(path);
         Settings.SaveSetting(_outstandingObjectsToSave.First(), path);
         _outstandingObjectsToSave.Remove(_outstandingObjectsToSave.First());
     }
     _fileSelectorIsShowed = false;
 }
Exemplo n.º 9
0
    // Получаем путь к файлу, записываем в .txt, дальше см. функции
    void GotFile(FileSelector.Status status, string path)
    {
        this.path       = path;
        this.windowOpen = false;


        if (importing_mesh == true && closed == false)
        {
#if !UNITY_EDITOR && UNITY_ANDROID
            obj_destination_path = sd_card_path + "/" + destinationFileName;
            //  t1.text = javaClass.Call<bool>("FileExists", obj_destination_path).ToString();
            if (javaClass.Call <bool>("FileExists", obj_destination_path) == false)
            {
                javaClass.Call("CopyFile", absoluteFilePathInSystem, obj_destination_path);
                models.Add(obj_destination_path);
                //запись в файл

                // foreach (string model in models) {
                //  javaClass.Call("WriteFile", savedModelsFile_path, model);
                //  }
                using (StreamWriter outputFile = new StreamWriter(savedModelsFile_path))
                {
                    foreach (string model in models)
                    {
                        outputFile.WriteLine(model);
                    }
                }
                Impor_mtl();
                SCREENSHOT();
            }
            else
            {
                javaClass.Call("CopyFile", absoluteFilePathInSystem, obj_destination_path);
            }
#endif

            obj_destination_path = System.IO.Path.Combine(modelsFolder_path, destinationFileName);
            /// чтобы не заполнял одим и тем же
            if (File.Exists(obj_destination_path) == false)
            {
                System.IO.File.Copy(path, obj_destination_path, true);
                models.Add(obj_destination_path);
                ///Записывает в файл
                using (StreamWriter outputFile = new StreamWriter(savedModelsFile_path)) {
                    foreach (string model in models)
                    {
                        outputFile.WriteLine(model);
                    }
                }
                Impor_mtl();
                /// Чтобы не плодить скриншоты
                SCREENSHOT();
            }
            else
            {
                System.IO.File.Copy(path, obj_destination_path, true);
                Impor_mtl();
            }
        }

        //Импорт текстуры
        if (importing_mesh == false && closed == false)
        {
#if !UNITY_EDITOR && UNITY_ANDROID
            png_destination_path = sd_card_path + "/" + destinationFileName;
            RebuiltMTL(png_destination_path);
            if (javaClass.Call <bool>("FileExists", png_destination_path) == false)
            {
                javaClass.Call("CopyFile", absoluteFilePathInSystem, png_destination_path);
                textures.Add(png_destination_path);

                using (StreamWriter outputFile = new StreamWriter(savedTexturesFile_path))
                {
                    foreach (string texture in textures)
                    {
                        outputFile.WriteLine(texture);
                    }
                }
            }
#endif

            png_destination_path = System.IO.Path.Combine(texturesFolder_path, destinationFileName);
            RebuiltMTL(png_destination_path);

            if (File.Exists(png_destination_path) == false)
            {
                System.IO.File.Copy(path, png_destination_path, true);
                textures.Add(png_destination_path);

                using (StreamWriter outputFile = new StreamWriter(savedTexturesFile_path)) {
                    foreach (string texture in textures)
                    {
                        outputFile.WriteLine(texture);
                    }
                }
            }
        }
        //	background3.SetActive (false);
        background2.SetActive(false);
    }
Exemplo n.º 10
0
 //This is called when the FileSelector window closes for any reason.
 //'Status' is an enumeration that tells us why the window closed and if 'path' is valid.
 void GotFile(FileSelector.Status status, string path)
 {
     Debug.Log("File Status : " + status + ", Path : " + path);
     this.path       = path;
     this.windowOpen = false;
 }