Inheritance: System.Web.UI.UserControl
コード例 #1
0
 protected void FileSelectedCallback(string pathImage)
 {
     m_fileBrowser = null;
     path = pathImage;
     showUploadBtn = true;
     showAllFilesBtn = true;
 }
コード例 #2
0
    protected void FileSelected(string path)
    {
        fileBrowser = null;

        if (path != null)
        {
            Debug.Log(path);
            if(path.Contains(".mp3"))
            {
                Debug.Log(path);
                using (Mp3FileReader reader = new Mp3FileReader(path))
                {
                    Debug.Log("Reached");
                    path = path.Replace(".mp3", ".wav");
                    WaveFileWriter.CreateWaveFile(path , reader);
                }
            }
            path = "file://" + path;
            WWW wtf = new WWW(path);

            //Wait for wtf to finish
            while (!wtf.isDone)
            {
            }
            SceneManager.getInstance.setClip(wtf.GetAudioClip(false));
        }
    }
コード例 #3
0
 // init function
 void Start()
 {
     this.folderPath.text = "No folder selected";
     this.launchButton.gameObject.SetActive(false);
     this.browseButton.gameObject.SetActive(true);
     this.fileBrowser = new FileBrowser(Application.dataPath);
 }
コード例 #4
0
 void onActionChosen(string path)
 {
     fileBrowser = null;
     if (path != null)
     {
         actionFileName = path;
     }
     setMenuVisible(true);
 }
コード例 #5
0
 public void openBrowser()
 {
     fb = new FileBrowser();
     active = true;
     foreach (Button b in Disparadores)
     {
         b.interactable = false;
     }
 }
コード例 #6
0
ファイル: FileBrowserGUI.cs プロジェクト: JPEGtheDev/TheGame
 protected static void FileSelectedCallback(string path)
 {
     m_fileBrowser = null;
     if (path == null)
     {
         return;
     }
     string[] split = path.Trim().Replace("/", " ").Replace("\\", " ").Split(default(string[]), System.StringSplitOptions.RemoveEmptyEntries);
     GUISelector.FilePath = split [split.Length - 1];
 }
コード例 #7
0
    void OnGUI()
    {
        if (showOptions)
        {
            Time.timeScale = 0.0f;

            GUI.skin = metalGUISkin;

            GUILayout.BeginArea(new Rect(Screen.width * 0.33f, Screen.height * 0.1f, Screen.width * 0.33f, Screen.height * 0.8f));
            //GUILayout.BeginScrollView(new Vector2(Screen.width * 0.33f, Screen.height * 0.1f), GUILayout.Width(Screen.width * 0.33f), GUILayout.Height(Screen.height * 0.8f));

                GUILayout.BeginVertical("Options", GUI.skin.box);
                    GUILayout.Space(30);
                    groupActions = GUILayout.Toggle(groupActions, "Group actions?");

                    GUILayout.Space(15);
                    GUILayout.Label("URL of the JaCO web service:");
                    jacoURI = GUILayout.TextField(jacoURI);

                    GUILayout.Space(15);
                    GUILayout.Label("Folder with the .TGF files:");

                    //GUILayout.BeginHorizontal();
                    baseFolder = GUILayout.TextField(baseFolder);
                    //GUILayout.FlexibleSpace();
                    if (GUILayout.Button("Select New Folder", GUILayout.ExpandWidth(false))) {
                        m_fileBrowser = new FileBrowser(new Rect(Screen.width * 0.25f, Screen.height * 0.1f, Screen.width * 0.5f, Screen.height * 0.8f), "Choose Folder...", FileSelectedCallback);
                        m_fileBrowser.BrowserType = FileBrowserType.Directory;
                        m_fileBrowser.SelectionPattern = "*";
                        m_fileBrowser.DirectoryImage = m_directoryImage;
                        m_fileBrowser.FileImage = m_fileImage;
                    }
                    //GUILayout.EndHorizontal();

                    GUILayout.Space(15);
                        GUILayout.BeginVertical();
                            GUILayout.BeginHorizontal();
                                GUILayout.FlexibleSpace();
                                if (GUILayout.Button("OK"))
                                {
                                    showOptions = false;
                                    Time.timeScale = 1.0f;
                                }
                                GUILayout.FlexibleSpace();
                            GUILayout.EndHorizontal();
                        GUILayout.EndVertical();
                GUILayout.EndVertical();

            //GUILayout.EndScrollView();
            GUILayout.EndArea();

            if (m_fileBrowser != null)
                m_fileBrowser.OnGUI();
        }
    }
コード例 #8
0
 // Use this for initialization
 void Start()
 {
     fb = new FileBrowser(@"/Users/Johnny/Google Drive/Documents/ProSense/ProSense/Unity Rotation Test Files/");
       fb.guiSkin = skins[0];
       fb.fileTexture = file;
       fb.directoryTexture = folder;
       fb.backTexture = back;
       fb.driveTexture = drive;
       fb.showSearch = true;
       fb.searchRecursively = true;
 }
コード例 #9
0
    protected void OnGUIMain()
    {
        GUI.enabled = !(m_showingUrlWindow || m_showingBrowserWindow);
        GUI.Label(new Rect(10,Screen.height * 0.08f,Screen.width,50),"Select Tomb Raider II level file (*.tr2)" ,  m_TextStyle);

        if (GUI.Button(new Rect(10,Screen.height - 80, 150, 35),  "Load Level From Web"))
        {
            m_showingUrlWindow = true;
        }
        else if (GUI.Button(new Rect(170,Screen.height - 80, 150, 35),  "Browse Level"))
        {
            string m_currentDir = PlayerPrefs.GetString("Level_Path");
            if(m_currentDir == null )
            {
                m_currentDir = Directory.GetCurrentDirectory();
            }
            else if(!Directory.Exists(m_currentDir))
            {
                m_currentDir = Directory.GetCurrentDirectory();
            }
            m_fileBrowser = new FileBrowser(new Rect(Screen.width * 0.1f, 0, Screen.width - Screen.width * 0.5f, Screen.height - 10),"Select level file (*.tr2) ",m_currentDir, FileSelectedCallback);
            m_fileBrowser.SelectionPattern = "*." + Settings.DefaultTR2FileExtension.Trim(new char[]{' '});
            m_fileBrowser.DirectoryImage = m_directoryImage;
            m_fileBrowser.FileImage = m_fileImage;
            m_showingBrowserWindow = true;
        }
        else if(GUI.Button(new Rect(330,Screen.height - 80, 150, 35),  "Load Demo"))
        {
            Settings.LevelFileLocalPath = Application.persistentDataPath + "/Resources/HILTOP.TR2";
        #if UNITY_EDITOR
            Settings.LevelFileLocalPath = Application.dataPath + "/Resources/HILTOP.TR2";
        #endif
            Settings.LoadDemoLevel = true;
            m_showLevelLoaingMessage = true;

        }

        if(GUI.Button(new Rect(Screen.width - 110,Screen.height - 35, 100, 30), "Exit"))
        {
            Application.Quit();
        }

        if(m_showingUrlWindow)
        {
            GUI.enabled = m_showingUrlWindow;
            GUI.Window(0,m_windowRect, Windowf, "Load Level from url");
        }

        if(m_showLevelLoaingMessage)
        {
            GUI.Label(new Rect(Screen.width - 150,50, 100, 50), "Loading...", m_TextStyle2);
            m_LoadLevel = true;
        }
    }
コード例 #10
0
 protected void FileSelectedCallback(string path)
 {
     m_showingBrowserWindow = false;
     m_fileBrowser = null;
     if(path != null)
     {
         m_currentDir = Directory.GetParent(path).FullName;
         if(Directory.Exists(m_currentDir))
         {
             Settings.LevelFileLocalPath = path;
             Debug.Log("m_currentDir " + m_currentDir);
             PlayerPrefs.SetString("Level_Path",m_currentDir);
             m_showLevelLoaingMessage = true;
         }
     }
 }
コード例 #11
0
ファイル: startScene.cs プロジェクト: westernknight/PileCards
    public void LoadExcel()
    {
        es.enabled = false;

        fb = new FileBrowser(Directory.GetCurrentDirectory());
        fb.guiSkin = skins[0]; //set the starting skin
        //set the various textures
        fb.fileTexture = file;
        fb.directoryTexture = folder;
        fb.backTexture = back;
        fb.driveTexture = drive;
        fb.searchPattern = "*.xls";
        //show the search bar
        fb.showSearch = false;
        //search recursively (setting recursive search may cause a long delay)
        fb.searchRecursively = true;
    }
コード例 #12
0
 protected void OnGUIMain()
 {
     GUILayout.BeginHorizontal();
     GUILayout.Label("Text File", GUILayout.Width(100));
     GUILayout.FlexibleSpace();
     GUILayout.Label(m_textPath ?? "none selected");
     //GUILayout.TextArea (m_content ?? "NULL");
     if (GUILayout.Button("...", GUILayout.ExpandWidth(false))) {
         m_fileBrowser = new FileBrowser(
             new Rect(100, 100, 600, 500),
             "选择战斗录像txt",
             FileSelectedCallback
             );
         m_fileBrowser.SelectionPattern = "*.txt";
         m_fileBrowser.DirectoryImage = m_directoryImage;
         m_fileBrowser.FileImage = m_fileImage;
     }
     GUILayout.EndHorizontal();
 }
コード例 #13
0
    protected void FileSelectedCallback(string path)
    {
        m_fileBrowser = null;
        m_textPath = path;

        FileReadWriteManager fileManager = new FileReadWriteManager();
        string content = fileManager.ReadTextFile (m_textPath);

        recordManager = new RecordManager(content);

        //Console.WriteLine("finish reading...");

        //dispatch events
        if (RecordLoaded != null)
        {
            RecordLoaded(this, EventArgs.Empty);
        }

        Destroy(this);
    }
コード例 #14
0
ファイル: ScenarioLoader.cs プロジェクト: ssontag55/Oilmap-3D
    protected void FileSelectedCallback(string path)
    {
        if(path == null || path == "")
        {
            Application.LoadLevel(0);
            return;
        }
        m_fileBrowser = null;
        switch(currentPattern)
        {
            case 0:
                scenarioPath = path;
                 m_fileBrowser = new FileBrowser(
                    new Rect(100, 100, 600, 500),
                    "Choose ZNP File",
                    FileSelectedCallback
                );
                currentPattern++;
                m_fileBrowser.CurrentDirectory = scenarioPath+hardDirectories[currentPattern];
               	m_fileBrowser.BrowserType = FileBrowserType.File;
               	m_fileBrowser.SelectionPattern = selectPatterns[currentPattern];
               	RegisterScenarioDirectory();
            break;
            case 1:
                currentPattern++;

                string gridFile = ZNPRead.ReadZNP(path);
                LoadBathymetry(scenarioPath + "/GRIDS/"+gridFile.Replace(".GRD",".DEP"));
                zmpPath = path.Replace(".ZNP",".ZMP");
                zmlPath = path.Replace(".ZNP",".ZML");
                LoadSpill();
            break;

            default:
            break;
        }

        if(currentPattern >= selectPatterns.Length)
            Destroy(gameObject);
        Debug.Log("Selected Directory: " +path);
    }
コード例 #15
0
ファイル: FileBrowserGUI.cs プロジェクト: JPEGtheDev/TheGame
    public static void OnGUIMain()
    {
        GUI.skin = Resources.Load("GUI Assets/generic") as GUISkin;

        m_fileBrowser = new FileBrowser(
                new Rect(0, 100, Screen.width, Screen.height * .5f),
                    GUISelector.message,
                    FileSelectedCallback
        );
        m_fileBrowser.SelectionPattern = "*" + GUISelector.FileType;
        m_fileBrowser.DirectoryImage = m_directoryImage;
        m_fileBrowser.FileImage = m_fileImage;
        if (GUISelector.FileType == ".xml")
        {

            m_fileBrowser.CurrentDirectory = Application.persistentDataPath + "/Scenarios";
        }
        if (GUISelector.FileType == ".dat")
        {

            m_fileBrowser.CurrentDirectory = Application.persistentDataPath + "/SaveGames";
        }
    }
コード例 #16
0
    protected void FileSelectedCallback(string path, string directory)
    {
        m_fileBrowser = null;

        lastUsedDirectorytxt = directory;
        filePathtxt = path;

        if(path != null)
         	{

         	 	// load parameters text file into string
            string rawFileString = File.ReadAllText(filePathtxt);
            string[] rawSplit = rawFileString.Split('|');
            string amplitudeListString = rawSplit[1];
            string frequencyStartString = rawSplit[2];
            string frequencyListString = rawSplit[3];
            string rgbColorScaleFactorsString = rawSplit[4];

            // copy over amplitudes
            for(int i = 0; i < audioDirector.scalingPerDecadeArray.Length; i++)
                audioDirector.scalingPerDecadeArray[i] = float.Parse( amplitudeListString.Split(',')[i] );

         		// copy over frequency start index
         		audioDirector.sampleStartIndex = int.Parse( frequencyStartString.Trim() );

         		// copy over frequency distribution
         		for(int i = 0; i < audioDirector.samplesPerDecadeArray.Length; i++)
         			audioDirector.samplesPerDecadeArray[i] = int.Parse( frequencyListString.Split(',')[i] );

         		// copy over rgb scale values
         		audioDirector.rScale = float.Parse( rgbColorScaleFactorsString.Split(',')[0] );
         		audioDirector.gScale = float.Parse( rgbColorScaleFactorsString.Split(',')[1] );
         		audioDirector.bScale = float.Parse( rgbColorScaleFactorsString.Split(',')[2] );
         	}

        //isActive = false;
    }
コード例 #17
0
ファイル: LoadMenu.cs プロジェクト: papakaliati/ConsoleDraw
        public LoadMenu(Dictionary <String, String> fileTypes, Window parentWindow)
            : base("Load Menu", Math.Min(6, Console.WindowHeight - 22), (Console.WindowWidth / 2) - 30, 60, 20, parentWindow)
        {
            FileTypes = fileTypes;

            fileSelect            = new FileBrowser(PostionX + 2, PostionY + 2, Width - 4, 13, FileInfo.Path, "fileSelect", this, true, "txt");
            fileSelect.ChangeItem = delegate() { UpdateCurrentlySelectedFileName(); };
            fileSelect.SelectFile = delegate() { LoadFile(); };

            var openLabel = new Label("Open", PostionX + 16, PostionY + 2, "openLabel", this);

            openTxtBox = new TextBox(PostionX + 16, PostionY + 7, "openTxtBox", this, 31)
            {
                Selectable = false
            };

            fileTypeDropdown            = new Dropdown(PostionX + 18, PostionY + 40, FileTypes.Select(x => x.Value).ToList(), "fileTypeDropdown", this, 17);
            fileTypeDropdown.OnUnselect = delegate() { UpdateFileTypeFilter(); };

            loadBtn          = new Button(PostionX + 18, PostionY + 2, "Load", "loadBtn", this);
            loadBtn.Action   = delegate() { LoadFile(); };
            cancelBtn        = new Button(PostionX + 18, PostionY + 9, "Cancel", "cancelBtn", this);
            cancelBtn.Action = delegate() { ExitWindow(); };

            Inputs.Add(fileSelect);
            Inputs.Add(loadBtn);
            Inputs.Add(cancelBtn);
            Inputs.Add(openLabel);
            Inputs.Add(openTxtBox);
            Inputs.Add(fileTypeDropdown);

            CurrentlySelected = fileSelect;

            Draw();
            MainLoop();
        }
コード例 #18
0
ファイル: FileLoader.cs プロジェクト: Zuvix/eZosit
    IEnumerator ShowLoadDialogCoroutine(string path, string tooltip, string type)
    {
        // Show a load file dialog and wait for a response from user
        // Load file/folder: file, Initial path: default (Documents), Title: "Load File", submit button text: "Load"
        FileBrowser.Filter[] filters = new FileBrowser.Filter[1];
        filters[0] = new FileBrowser.Filter("JSON files", ".json");
        FileBrowser.SetFilters(true, filters);
        FileBrowser.SetDefaultFilter(".json");
        yield return(FileBrowser.WaitForLoadDialog(false, path, tooltip, "Otvor"));

        // Dialog is closed
        // Print whether a file is chosen (FileBrowser.Success)
        // and the path to the selected file (FileBrowser.Result) (null, if FileBrowser.Success is false)
        Debug.Log(FileBrowser.Success + " " + FileBrowser.Result);

        if (FileBrowser.Success)
        {
            // If a file was chosen, read its bytes via FileBrowserHelpers
            // Contrary to File.ReadAllBytes, this function works on Android 10+, as well
            //byte[] bytes = FileBrowserHelpers.ReadBytesFromFile(FileBrowser.Result)
            string fileName = FileBrowserHelpers.GetFilename(FileBrowser.Result);
            ImageSerializer.Instance.LoadData(FileBrowser.Result);
        }
    }
コード例 #19
0
    public void ImportFile()
    {
        string initLocation = "./Results";

#if UNITY_EDITOR
        initLocation = "./Builds/Results";
#endif
        FileBrowser.ShowLoadDialog(
            delegate(string path)
        {
            string txt       = System.IO.File.ReadAllText(path);
            ReplayClass temp = JsonUtility.FromJson <ReplayClass>(txt);

            ReplayInfo.Add(temp);
            //ReplayM.GenerateUIItem(temp.Params.Power, temp.WinAreaNumber, int.Parse(stringList[stringList.Length - 1].Replace("n", "")));
            ReplayM.GenerateUIItem(temp.Name);
        },                                                                                              // 按下成功時
            delegate() { Debug.Log("Canceled"); },                                                      // 取消
            false,                                                                                      // 是否選擇資料夾
            initLocation,                                                                               // 初始位置
            "選擇檔案",                                                                                     // Title 顯示名稱
            "選擇"                                                                                        // submit 按鈕名稱
            );
    }
コード例 #20
0
    public void SelectAudioFile()
    {
        waveformCurrentTexture.fillAmount = 0;
        string path = FileBrowser.OpenSingleFile("Select Audio Asset", "", extensions);

        Directory.CreateDirectory(tempDataPath);
        tempAudioFilePath = null;
        if (string.IsNullOrEmpty(path))
        {
            waveformTexture.color        = new Color(waveformTexture.color.r, waveformTexture.color.g, waveformTexture.color.b, 0);
            waveformCurrentTexture.color = new Color(waveformCurrentTexture.color.r, waveformCurrentTexture.color.g, waveformCurrentTexture.color.b, 0);
            return;
        }
        tempAudioFilePath = path;
        File.Copy(path, tempDataPath + Path.GetFileName(path), true);
        if (!string.IsNullOrEmpty(path))
        {
            var attr = File.GetAttributes(tempDataPath + Path.GetFileName(path));
            attr = attr & ~FileAttributes.ReadOnly;
            File.SetAttributes(tempDataPath + Path.GetFileName(path), attr);
        }
        LoadAudioFile(path);
        //Alpha added at LoadFiles
    }
コード例 #21
0
    private IEnumerator ShowLoadDialogCoroutine()
    {
        _controller.Active = false;
        yield return(FileBrowser.WaitForLoadDialog(title: "Select Model"));

        if (FileBrowser.Success)
        {
            _fileToReduce = FileBrowser.Result;
            _loadingTask  = Task.Run(async() =>
            {
                _scripts = await _client.GetScriptsAsync();

                if (_scripts == null || !_scripts.Any())
                {
                    _snackBar.ShowError("Connectivity problems!");
                }
                else
                {
                    _showFilter = true;
                }
            });
        }
        _controller.Active = true;
    }
コード例 #22
0
    // Open a file browser to save and load files
    private IEnumerator OpenFileBrowserRoutine()
    {
        // Create the file browser and name it
        yield return(new WaitForSeconds(2f));

        if (gazed && !explorerOpened)
        {
            explorerOpened = true;
            GetComponent <ImageManager>().RemoveTexture();
            nextSlideButton.SetActive(false);
            nextSlideButton.transform.GetChild(0).transform.gameObject.SetActive(false);
            previousSlideButton.SetActive(false);
            previousSlideButton.transform.GetChild(0).transform.gameObject.SetActive(false);

            FileOpenButton.SetActive(false);
            GameObject fileBrowserObject = Instantiate(FileBrowserPrefab, transform);
            fileBrowserObject.name = "FileBrowser";

            FileBrowser fileBrowserScript = fileBrowserObject.GetComponent <FileBrowser>();
            fileBrowserScript.SetupFileBrowser();
            fileBrowserScript.OpenFilePanel(FileExtensions);
            fileBrowserScript.OnFileSelect += LoadFileUsingPath;
        }
    }
コード例 #23
0
ファイル: SoruOku.aspx.cs プロジェクト: serhatgunes/CengP
    protected void Page_Load(object sender, EventArgs e)
    {
        lblAnswer.Visible = false;
        string     id        = Request.QueryString["mesajid"];
        string     kdurum    = "1";
        string     kdurumres = "message/okundu.png";
        SqlCommand com       = new SqlCommand("UPDATE mesajlar SET durum='" + kdurum + "', durumres='" + kdurumres + "' where mesajid=@mesajid", con);

        com.Parameters.Add("@mesajid", System.Data.SqlDbType.Int).Value = id;
        con.Open();
        com.ExecuteNonQuery();
        com.Dispose();
        con.Close();

        FillAuthorList();
        Fill();
        Foto();
        if (!IsPostBack)
        {
            FileBrowser f1 = new FileBrowser();
            f1.BasePath = "../ckfinder";
            f1.SetupCKEditor(txtAnswer);
        }
    }
コード例 #24
0
 void Browse()
 {
     FileBrowser.ShowLoadDialog((path) => ifFilePath.text = path, () => { }, folderMode, initialPath, title, buttonText);
 }
コード例 #25
0
 // Description:  The method called when a file is chosen in the file browser
 // PRE:          This method will only be called by the filebrowser when a user selects a file
 // POST:         The file path will be set for the scene and the background image will load
 protected void FileSelectedCallback(string path)
 {
     m_fileBrowser = null;
     m_textPath = path;
     this.m_browserEnabled = false;
     LoadImage();
 }
コード例 #26
0
    //// Using CrossPath FileBrowser
    // Open single file
    public void OpenSingleFile()
    {
        string fbFilePath = FileBrowser.OpenSingleFile("txt");

        Debug.Log("Selected File: " + fbFilePath);
    }
 private void Browse_Click(object sender, RoutedEventArgs e)
 {
     // Create browser control if not already created.
     if (browser == null)
     {
         browser = new FileBrowser()
         {
             FileExtensions = new System.Collections.ObjectModel.ObservableCollection<string>() { 
                 ".png",".jpg", ".jpeg"
             },
             StartupRelativeUrl = "Images"
         };
         browser.CancelClicked += new EventHandler(browser_CancelClicked);
         browser.UrlChosen += new EventHandler<FileChosenEventArgs>(browser_UrlChosen);
     }
     BuilderApplication.Instance.ShowWindow(ESRI.ArcGIS.Mapping.Builder.Resources.Strings.BrowseForImage, browser, true);
 }
コード例 #28
0
 public void OpenSoundFileBrowser()
 {
     FileBrowser.SetFilters(true, new FileBrowser.Filter("Sound Files", ".wav", ".ogg"));
     StartCoroutine(ShowLoadDialogCoroutine(SOUND));
 }
コード例 #29
0
    public void SaveGame()
    {
        const string extension = "xml";
        DateTime     dateTime  = DateTime.Now;
        string       timeStamp = dateTime.ToString("yyyyMMdd-HHmmss");
        string       path      = string.Empty;

        if (string.IsNullOrEmpty(Master.Instance.DefaultSaveLocation))
        {
            path = FileBrowser.SaveFile(LocalizationManager.Instance.GetLocalizedValue("filebrowser_select_save_location"), string.Empty, "CGSave_" + timeStamp, extension);
        }
        else
        {
            path = $"{Master.Instance.DefaultSaveLocation}/CGSave_{timeStamp}.{extension}";
        }

        if (path.Length == 0)
        {
            ShowPopUp(LocalizationManager.Instance.GetLocalizedValue("popup_no_folder_selected"));
            Debug.Log(LocalizationManager.Instance.GetLocalizedValue("popup_no_folder_selected"));
            return;
        }

        // Először kiírja a jelenlegi neurálnet adatokat egy tömbbe
        m_GeneticAlgorithm.SaveNeuralNetworks();

        Save.SelectionMethod     = Configuration.SelectionMethod;
        Save.MutationChance      = Configuration.MutationChance;
        Save.MutationRate        = Configuration.MutationRate;
        Save.CarCount            = Configuration.CarCount;
        Save.LayersCount         = Configuration.LayersCount;
        Save.NeuronPerLayerCount = Configuration.NeuronPerLayerCount;
        Save.Navigator           = Configuration.Navigator;
        Save.TrackNumber         = Configuration.TrackNumber;
        Save.SavedCarNetworks    = m_GeneticAlgorithm.SavedCarNetworks;
        Save.Seed = RandomHelper.Seed;

        if (Master.Instance.CreateDemoSave)
        {
            Save.GenerationCount = 0;
            Save.MaxFitness      = new List <float>();
            Save.MedianFitness   = new List <float>();
        }
        else
        {
            Save.GenerationCount = m_GeneticAlgorithm.GenerationCount;
            Save.MaxFitness      = MaxFitness;
            Save.MedianFitness   = MedianFitness;
        }

        //using (FileStream file = File.Create(path))
        //{
        //    XmlSerializer writer = new XmlSerializer(typeof(GameSave));
        //    writer.Serialize(file, Save);
        //}

        XmlSerializer serializer = new XmlSerializer(typeof(GameSave));

        using (FileStream writer = new FileStream(path, FileMode.Create))
        {
            // Serialize the object, and close the TextWriter
            serializer.Serialize(writer, Save);
        }

        ShowPopUp(LocalizationManager.Instance.GetLocalizedValue("popup_save_file") + path);
        Debug.Log(LocalizationManager.Instance.GetLocalizedValue("popup_save_file") + path);
    }
コード例 #30
0
	private void InitializeGUI()
	{
		Methods.GUI.InitializeStyles();
#if !FINAL
		fileBrowser = new FileBrowser { backTexture = back, directoryTexture = directory, driveTexture = drive, fileTexture = file, confirmStyle = Data.GUI.Button.Small, cancelStyle = Data.GUI.Button.Small };
#endif
		guiInitialized = true;
	}
コード例 #31
0
    void Start()
    {
        browser = GetComponent<FileBrowser>();
        browserDefaultDirectory = "C:/Users/" + System.Environment.UserName + "/Pictures";
        if (File.Exists(browserDefaultDirectory))
        {
            if (File.Exists(browserDefaultDirectory + "/Camera Roll"))
            {
                browserDefaultDirectory += "/Camera Roll";
            }
        }
        else
        {
        #if UNITY_EDITOR || UNITY_STANDALONE_WIN
            browserDefaultDirectory = System.Environment.CurrentDirectory;
        #elif UNITY_ANDROID
            browserDefaultDirectory = "/";
        #endif
            //browserDefaultDirectory = Application.persistentDataPath;
        }

        if (inputKiller != null)
        {
            TabletServerSide.inputKiller = inputKiller;
        }
        browser.DefaultDirectory = browserDefaultDirectory;
    }
 protected void FileSelectedCallback(string path)
 {
     fileBrowser = null;
     if (path == null)
     {
         return;
     }
     texturePath = Path.GetDirectoryName(path);
     textureFile[targetMatno][targetPropName] = Path.GetFileName(path);
     ChangeTex(texturePath, textureFile[targetMatno][targetPropName]);
 }
 private void OpenFileBrowser(int matno, string propName)
 {
     targetMatno = matno;
     targetPropName = propName;
     fileBrowser = new FileBrowser(
         new Rect(0, 0, fileBrowserRect.width, fileBrowserRect.height),
         "テクスチャファイル選択",
         FileSelectedCallback
     );
     fileBrowser.SelectionPatterns = new string[] { "*.tex", "*.png" };
     if (String.IsNullOrEmpty(texturePath))
     {
         fileBrowser.CurrentDirectory = texturePath;
     }
 }
コード例 #34
0
ファイル: startScene.cs プロジェクト: westernknight/PileCards
    void OnGUI()
    {
        if (fb != null)
        {

            if (fb.draw())
            {
                if (fb.outputFile!=null)
                {

                    excelPath = fb.outputFile.Directory.FullName+"/"+fb.outputFile.Name;

                    Debug.Log(excelPath);
                    AnylizeJsonFile(excelPath);

                }
                fb = null;
                es.enabled = true;
            }

        }
    }
コード例 #35
0
ファイル: Examples.cs プロジェクト: joni-mikkola/chartreader
        public void OpenFoldersAsync()
        {
            //Debug.Log("OpenFoldersAsync");

            FileBrowser.OpenFoldersAsync("Open Folders", string.Empty, true, (string[] paths) => { writePaths(paths); });
        }
コード例 #36
0
 protected void OnGUIMain()
 {
     // track parameters file broswing
     GUILayout.BeginHorizontal();
     GUILayout.Label("Press button to select a parameters file", GUILayout.Width(100));
     GUILayout.FlexibleSpace();
     GUILayout.Label(filePathtxt ?? "none selected");
     if( GUILayout.Button("Browse Parameters File!", GUILayout.ExpandWidth(false)) )
     {
         m_fileBrowser = new FileBrowser( new Rect(100, 100, 600, 500), "Choose Parameters File", FileSelectedCallback, lastUsedDirectorytxt);
         m_fileBrowser.SelectionPattern = "*.txt";
         m_fileBrowser.DirectoryImage = m_directoryImage;
         m_fileBrowser.FileImage = m_fileImage;
         mostRecentExtension = "txt";
     }
     GUILayout.EndHorizontal();
 }
コード例 #37
0
ファイル: ScenarioLoader.cs プロジェクト: ssontag55/Oilmap-3D
    protected void OnGUI()
    {
        UIScalingCS.ScaleUI();
        if(theSkin)
            GUI.skin = theSkin;

        if(badDirectory)
        {
            DirectoryDoesntExist();
            return;
        }

        if(!selection)
            GUI.Box(new Rect(412,200,200,20), "Oilmap Scenario Loader");

        if(!selection && GUI.Button(new Rect(412,384,200,50), "Set New Working Directory"))
        {
            selection = true;
        }
        if(!selection && GUI.Button(new Rect(412,434,200,50), "Load Previous Working Directory"))
        {
            selection = true;
            docHistory = true;
            if(File.Exists(Application.persistentDataPath+"/config.cfg"))
            {
                GetScenarioList();

                /*scenarioPath = GetMostRecentScenario();
                m_fileBrowser = new FileBrowser(
                    new Rect(100, 100, 600, 500),
                    "Choose Text File",
                    FileSelectedCallback
                );
                currentPattern++;
                m_fileBrowser.CurrentDirectory = scenarioPath+hardDirectories[currentPattern];
               	m_fileBrowser.BrowserType = FileBrowserType.File;
               	m_fileBrowser.SelectionPattern = selectPatterns[currentPattern];
               	*/
            }
            else
            {
                docHistory = false;
            }
        }
        if(selection)
        {
            if(docHistory)
            {
                if(scenarioList != null && scenarioList.Length > 0)
                {
                    scrollPos = GUI.BeginScrollView(new Rect(256,64,512,768),scrollPos,new Rect(0,0,512,50.0f*scenarioList.Length));
                    float yIndex = 0.0f;
                    for(int i = 0; i < scenarioList.Length; i++)
                    {
                        if(GUI.Button(new Rect(0,yIndex,512,50),scenarioList[i]))
                        {
                            docHistory = false;
                            scenarioPath = scenarioList[i];
                            m_fileBrowser = new FileBrowser(
                            new Rect(100, 100, 600, 500),
                            "Choose ZNP File",
                   			FileSelectedCallback
                            );
                            currentPattern++;
                            if(!Directory.Exists(scenarioPath+hardDirectories[currentPattern]))
                                badDirectory=true;
                            else
                            {
                                m_fileBrowser.CurrentDirectory = scenarioPath+hardDirectories[currentPattern];
               					m_fileBrowser.BrowserType = FileBrowserType.File;
               					m_fileBrowser.SelectionPattern = selectPatterns[currentPattern];
                                RegisterScenarioDirectory();
                            }
                        }
                        yIndex+= 50.0f;
                    }
                    GUI.EndScrollView();
                }
            }
            else
            {
                if (m_fileBrowser != null) {
                    m_fileBrowser.OnGUI();
                } else {
               	 OnGUIMain();
                }
            }
        }
    }
コード例 #38
0
 public void SetAudioDirectory(string directory)
 {
     initDirectory = directory;
     FileBrowser.AddQuickLink(Path.GetFileName(initDirectory), initDirectory, null);
 }
コード例 #39
0
 public void OpenJsonFileBrowser()
 {
     FileBrowser.SetFilters(true, new FileBrowser.Filter("Json", ".json"));
     StartCoroutine(ShowLoadDialogCoroutine(JSON));
 }
コード例 #40
0
 private void button5_Click(object sender, EventArgs e)
 {
     Config.uksoilfolder = FileBrowser.GetFolder();
     textBox4.Text       = Config.uksoilfolder;
     flag = true;
 }
コード例 #41
0
ファイル: MainWindow.cs プロジェクト: gecambridge/ConsoleDraw
        public MainWindow() : base(0, 0, Console.WindowWidth, Console.WindowHeight, null)
        {
            var oneBtn = new Button(2, 2, "Button One", "oneBtn", this)
            {
                Action = delegate() { new Alert("You Clicked Button One", this, ConsoleColor.White); }
            };
            var twoBtn = new Button(4, 2, "Button Two", "twoBtn", this)
            {
                Action = delegate() { new Alert("You Clicked Button Two", this, ConsoleColor.White); }
            };
            var threeBtn = new Button(6, 2, "Long Alert", "threeoBtn", this)
            {
                Action = delegate() { new Alert("A web browser (commonly referred to as a browser) is a software application for retrieving, presenting and traversing information resources on the World Wide", this, ConsoleColor.White); }
            };

            var displayAlertBtn = new Button(2, 20, "Display Alert", "displayAlertBtn", this)
            {
                Action = delegate() { new Alert("This is an Alert!", this, ConsoleColor.White); }
            };
            var displayConfirmBtn = new Button(4, 20, "Display Confirm", "displayConfirmBtn", this)
            {
                Action = delegate() { new Confirm("This is a Confirm!", this, ConsoleColor.White); }
            };
            var exitBtn = new Button(6, 20, "Exit", "exitBtn", this)
            {
                Action = delegate() { ExitWindow(); }
            };

            var displaySettingBtn = new Button(2, 40, "Display Settings", "displaySettingsBtn", this)
            {
                Action = delegate() { new SettingsWindow(this); }
            };
            var displaySaveBtn = new Button(4, 40, "Display Save Menu", "displaySaveMenuBtn", this)
            {
                Action = delegate() { new SaveMenu("Untitled.txt", Directory.GetCurrentDirectory(), "Test Data", this); }
            };
            var displayLoadBtn = new Button(6, 40, "Display Load Menu", "displayLoadMenuBtn", this)
            {
                Action = delegate() { new LoadMenu(Directory.GetCurrentDirectory(), new Dictionary <string, string>()
                    {
                        { "txt", "Text Document" }, { "*", "All Files" }
                    }, this); }
            };

            var oneCheckBox      = new CheckBox(10, 2, "oneCheckBox", this);
            var oneCheckBoxLabel = new Label("Check Box One", 10, 6, "oneCheckBoxLabel", this);
            var twoCheckBox      = new CheckBox(12, 2, "twoCheckBox", this)
            {
                Checked = true
            };
            var twoCheckBoxLabel   = new Label("Check Box Two", 12, 6, "twoCheckBoxLabel", this);
            var threeCheckBox      = new CheckBox(14, 2, "threeCheckBox", this);
            var threeCheckBoxLabel = new Label("Check Box Three", 14, 6, "threeCheckBoxLabel", this);

            var groupOneLabel       = new Label("Radio Button Group One", 9, 25, "oneCheckBoxLabel", this);
            var oneRadioBtnGroupOne = new RadioButton(10, 25, "oneRadioBtnGroupOne", "groupOne", this)
            {
                Checked = true
            };
            var oneRadioBtnGroupOneLabel   = new Label("Radio Button One", 10, 29, "oneCheckBoxLabel", this);
            var twoRadioBtnGroupOne        = new RadioButton(12, 25, "twoRadioBtnGroupOne", "groupOne", this);
            var twoRadioBtnGroupOneLabel   = new Label("Radio Button Two", 12, 29, "oneCheckBoxLabel", this);
            var threeRadioBtnGroupOne      = new RadioButton(14, 25, "threeRadioBtnGroupOne", "groupOne", this);
            var threeRadioBtnGroupOneLabel = new Label("Radio Button Three", 14, 29, "oneCheckBoxLabel", this);

            var groupTwoLabel       = new Label("Radio Button Group Two", 9, 50, "oneCheckBoxLabel", this);
            var oneRadioBtnGroupTwo = new RadioButton(10, 50, "oneRadioBtnGroupTwo", "groupTwo", this)
            {
                Checked = true
            };
            var twoRadioBtnGroupTwo   = new RadioButton(12, 50, "twoRadioBtnGroupTwo", "groupTwo", this);
            var threeRadioBtnGroupTwo = new RadioButton(14, 50, "threeRadioBtnGroupTwo", "groupTwo", this);

            var textAreaLabel = new Label("Text Area", 16, 2, "textAreaLabel", this);
            var textArea      = new TextArea(17, 2, 60, 6, "txtArea", this);

            textArea.BackgroundColour = ConsoleColor.DarkGray;

            var txtBoxLabel = new Label("Text Box", 24, 2, "txtBoxLabel", this);
            var txtBox      = new TextBox(24, 11, "txtBox", this);

            var fileSelect = new FileBrowser(26, 2, 40, 10, Directory.GetCurrentDirectory(), "fileSelect", this, true);

            Inputs.Add(oneBtn);
            Inputs.Add(twoBtn);
            Inputs.Add(threeBtn);
            Inputs.Add(oneCheckBox);
            Inputs.Add(oneCheckBoxLabel);
            Inputs.Add(twoCheckBox);
            Inputs.Add(twoCheckBoxLabel);
            Inputs.Add(threeCheckBox);
            Inputs.Add(threeCheckBoxLabel);

            Inputs.Add(displayAlertBtn);
            Inputs.Add(displayConfirmBtn);
            Inputs.Add(exitBtn);

            Inputs.Add(groupOneLabel);
            Inputs.Add(oneRadioBtnGroupOne);
            Inputs.Add(oneRadioBtnGroupOneLabel);
            Inputs.Add(twoRadioBtnGroupOne);
            Inputs.Add(twoRadioBtnGroupOneLabel);
            Inputs.Add(threeRadioBtnGroupOne);
            Inputs.Add(threeRadioBtnGroupOneLabel);

            Inputs.Add(displaySettingBtn);
            Inputs.Add(displaySaveBtn);
            Inputs.Add(displayLoadBtn);

            Inputs.Add(groupTwoLabel);
            Inputs.Add(oneRadioBtnGroupTwo);
            Inputs.Add(twoRadioBtnGroupTwo);
            Inputs.Add(threeRadioBtnGroupTwo);

            Inputs.Add(textAreaLabel);
            Inputs.Add(textArea);

            Inputs.Add(txtBoxLabel);
            Inputs.Add(txtBox);

            Inputs.Add(fileSelect);

            CurrentlySelected = oneBtn;

            Draw();
            MainLoop();
        }
コード例 #42
0
 //TODO: Change look of file browser
 public void ChooseSong()
 {
     fileBrowser = new FileBrowser(new Rect(100, 100, 500, 600), "Choose Song", FileSelected);
     //fileBrowser.SelectionPattern = "*.mp3";
 }
コード例 #43
0
 private void button3_Click(object sender, EventArgs e)
 {
     Config.workspace = FileBrowser.GetFolder();
     textBox1.Text    = Config.workspace;
     flag             = true;
 }
コード例 #44
0
    public void ImportTexture(string tile)
    {
        string path = FileBrowser.OpenSingleFile("Select Texture", "", extensions);

        Directory.CreateDirectory(tempDataPath);
        if (!string.IsNullOrEmpty(path))
        {
            WWW www = new WWW("file:///" + path);
            File.Copy(path, tempDataPath + Path.GetFileName(path), true);
            if (!string.IsNullOrEmpty(path))
            {
                var attr = File.GetAttributes(tempDataPath + Path.GetFileName(path));
                attr = attr & ~FileAttributes.ReadOnly;
                File.SetAttributes(tempDataPath + Path.GetFileName(path), attr);
            }
            switch (tile)
            {
            case "FRONT":
                buttonImportFront.GetComponentInChildren <RawImage>().texture = www.texture;
                SetSkyboxTexture("_FrontTex", www.texture, skyboxMatSixClone);
                SetSkyboxTexture("_MainTex", www.texture, skyboxMatOneClone);
                tempTextureFrontPath = tempDataPath + Path.GetFileName(path);
                break;

            case "BACK":
                buttonImportBack.GetComponentInChildren <RawImage>().texture = www.texture;
                SetSkyboxTexture("_BackTex", www.texture, skyboxMatSixClone);
                tempTextureBackPath = tempDataPath + Path.GetFileName(path);
                break;

            case "LEFT":
                buttonImportLeft.GetComponentInChildren <RawImage>().texture = www.texture;
                SetSkyboxTexture("_LeftTex", www.texture, skyboxMatSixClone);
                tempTextureLeftPath = tempDataPath + Path.GetFileName(path);
                break;

            case "RIGHT":
                buttonImportRight.GetComponentInChildren <RawImage>().texture = www.texture;
                SetSkyboxTexture("_RightTex", www.texture, skyboxMatSixClone);
                tempTextureRightPath = tempDataPath + Path.GetFileName(path);
                break;

            case "UP":
                buttonImportUp.GetComponentInChildren <RawImage>().texture = www.texture;
                SetSkyboxTexture("_UpTex", www.texture, skyboxMatSixClone);
                tempTextureUpPath = tempDataPath + Path.GetFileName(path);
                break;

            case "DOWN":
                buttonImportDown.GetComponentInChildren <RawImage>().texture = www.texture;
                SetSkyboxTexture("_DownTex", www.texture, skyboxMatSixClone);
                tempTextureDownPath = tempDataPath + Path.GetFileName(path);
                break;
            }
        }
        else
        {
            switch (tile)
            {
            case "FRONT":
                tempTextureFrontPath = null;
                buttonImportFront.GetComponentInChildren <RawImage>().texture = fallbackButtonTexture;
                SetSkyboxTexture("_FrontTex", fallbackTexture, skyboxMatSixClone);
                SetSkyboxTexture("_MainTex", fallbackTexture, skyboxMatOneClone);
                break;

            case "BACK":
                tempTextureBackPath = null;
                buttonImportBack.GetComponentInChildren <RawImage>().texture = fallbackButtonTexture;
                SetSkyboxTexture("_BackTex", fallbackTexture, skyboxMatSixClone);
                break;

            case "LEFT":
                tempTextureLeftPath = null;
                buttonImportLeft.GetComponentInChildren <RawImage>().texture = fallbackButtonTexture;
                SetSkyboxTexture("_LeftTex", fallbackTexture, skyboxMatSixClone);
                break;

            case "RIGHT":
                tempTextureRightPath = null;
                buttonImportRight.GetComponentInChildren <RawImage>().texture = fallbackButtonTexture;
                SetSkyboxTexture("_RightTex", fallbackTexture, skyboxMatSixClone);
                break;

            case "UP":
                tempTextureUpPath = null;
                buttonImportUp.GetComponentInChildren <RawImage>().texture = fallbackButtonTexture;
                SetSkyboxTexture("_UpTex", fallbackTexture, skyboxMatSixClone);
                break;

            case "DOWN":
                tempTextureDownPath = null;
                buttonImportDown.GetComponentInChildren <RawImage>().texture = fallbackButtonTexture;
                SetSkyboxTexture("_DownTex", fallbackTexture, skyboxMatSixClone);
                break;
            }
        }
    }
コード例 #45
0
 private void button4_Click(object sender, EventArgs e)
 {
     Config.soilhabitat = FileBrowser.GetFile();
     textBox3.Text      = Config.soilhabitat;
     flag = true;
 }
コード例 #46
0
 protected void FileSelectedCallback(string path)
 {
     m_fileBrowser = null;
     if (!path.Equals(""))
         baseFolder = path;
 }
コード例 #47
0
    // Open single folder
    public void OpenSingleFolder()
    {
        string fbFolderPath = FileBrowser.OpenSingleFolder();

        Debug.Log("Selected Folder: " + fbFolderPath);
    }
コード例 #48
0
 public void GetImagesFolderPath()
 {
     FileBrowser.AddQuickLink(null, "Users", "C:\\Users");
     FileBrowser.ShowLoadDialog(null, null, true, null, "Load", "Select");
     StartCoroutine(GetImagesFolder());
 }
コード例 #49
0
        public MainWindow()
            : base(0, 0, Console.WindowWidth, Console.WindowHeight, null)
        {
            timer          = new Timer();
            timer.Elapsed += new ElapsedEventHandler(UpdateCurrentPosition);
            timer.Interval = 1000;

            #region Elementy Interfejsu Inicjalizacja

            currentPlaylistBrowser = new FileBrowser(5, 33, 90, 32, controller.CurrentSongsToString, "currentPlaylistBrowser", this, true);
            playlistsBrowser       = new FileBrowser(22, 3, 26, 11, controller.PlaylistsToString, "playlistsBrowser", this, true);
            libraryBrowser         = new FileBrowser(6, 3, 26, 12, controller.LibrariesToString, "libraryBrowser", this, true);

            libraryTextBox   = new Label("Biblioteka", 3, 10, "libraryTextBox", this);
            playlistTextBox  = new Label("Playlisty", 19, 10, "playlistTextBox", this);
            musicTextBox     = new Label("Utwory", 3, 77, "musicTextBox", this);
            currentSongLabel = new Label("Aktualna Piosenka", 41, 55, "currentSong", this);
            currentSongLabel.BackgroundColour = ConsoleColor.DarkGray;

            //openWindow = new Button(1, 33, "Dodaj utwor", "addTrackBtn", this) { Action = delegate () { new AddTrackToPlaylistWindow(openWindow.ParentWindow); } };

            addNewLibraryBtn = new Button(5, 3, "Dodaj biblioteke", "addNewLibraryBtn", this)
            {
                Action = delegate() { new AddNewLibraryWindow(addNewLibraryBtn.ParentWindow); }
            };
            addNewPlaylistBtn = new Button(21, 3, "Dodaj playliste", "addNewPlaylistBtn", this)
            {
                Action = delegate() { new AddNewPlaylistWindow(addNewPlaylistBtn.ParentWindow); }
            };


            //artistLabel = new Label("Artysta", 4, 37, "artistLabel", this);
            //nameLabel = new Label("Nazwa utworu", 4, 55, "nameLabel", this);
            //albumLabel = new Label("Album", 4, 85, "albumLabel", this);
            //rankLabel = new Label("Ocena", 4, 105, "rankLabel", this);

            artistLabelBtn = new Button(4, 37, "Artysta", "artistBtn", this)
            {
                Action = delegate() { Sort("Author"); }
            };
            nameLabelBtn = new Button(4, 55, "Nazwa utworu", "titleBtn", this)
            {
                Action = delegate() { Sort("Title"); }
            };
            albumLabelBtn = new Button(4, 95, "Album", "albumBtn", this)
            {
                Action = delegate() { Sort("Album"); }
            };
            //rankBtn = new Button(4, 105, "Ocena", "rankBtn", this);

            //artistLabel.BackgroundColour = ConsoleColor.DarkGray;
            //albumLabel.BackgroundColour = ConsoleColor.DarkGray;
            //nameLabel.BackgroundColour = ConsoleColor.DarkGray;
            //rankLabel.BackgroundColour = ConsoleColor.DarkGray;

            artistLabelBtn.BackgroundColour = ConsoleColor.DarkGray;
            albumLabelBtn.BackgroundColour  = ConsoleColor.DarkGray;
            nameLabelBtn.BackgroundColour   = ConsoleColor.DarkGray;
            //rankBtn.BackgroundColour = ConsoleColor.DarkGray;

            controlsLabel = new Label("Sterowanie", 40, 65, "controlLabel", this);

            repeatAllBtn = new Button(44, 13, "Repeat All", "stopBtn", this)
            {
                Action = delegate() { ChangeRepeatAllStatement(); }
            };
            shufflePlayBtn = new Button(44, 3, "Random", "stopBtn", this)
            {
                Action = delegate() { ChangeRandomPlayStatement(); }
            };

            stopBtn = new Button(44, 55, "  ■  ", "stopBtn", this)
            {
                Action = delegate() { Stop(); }
            };
            playBtn = new Button(44, 75, "  >  ", "playBtn", this)
            {
                Action = delegate() { Play(); }
            };
            pouseBtn = new Button(44, 65, "  ||  ", "pouseBtn", this)
            {
                Action = delegate() { Pause(); }
            };

            nextTrackBtn = new Button(44, 85, "  >|  ", "nextTrackBtn", this)
            {
                Action = delegate() { NextTrack(); }
            };

            volumeDownBtn = new Button(44, 110, " - ", "volumeDown", this)
            {
                Action = delegate() { VolumeDown(); }
            };
            volumeUpBtn = new Button(44, 123, " + ", "volumeDown", this)
            {
                Action = delegate() { VolumeUp(); }
            };
            volumeLabel = new Label(controller.CurrentVolumeToString, 44, 117, "volumeLabel", this);
            //volumeLabel.SetText(controller.CurrentVolume());

            previousTrackBtn = new Button(44, 45, "  |<  ", "previousTrackBtn", this)
            {
                Action = delegate() { PreviousTrack(); }
            };

            startLabel = new Label("0:00", 42, 4, "startLabel", this);
            endLabel   = new Label("0:00", 42, 123, "endLabel", this);

            #endregion

            DrawUIContainers();


            AddAllInputs();

            CurrentlySelected = playBtn;
            Draw();
            MainLoop();
        }
コード例 #50
0
    // Description:  Called to invoke the file browser object only once
    // PRE:          N/A
    // POST:         The file browser object will be created
    protected void OnGUIMain()
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label("Background", GUILayout.Width(100));
        GUILayout.FlexibleSpace();
        GUILayout.Label(m_textPath ?? "none selected");
        if (GUILayout.Button("...", GUILayout.ExpandWidth(false)))
        {
            this.m_browserEnabled = true;
            m_fileBrowser = new FileBrowser(
                new Rect(100, 100, 600, 500),
                "Choose Image File",
                FileSelectedCallback
            );

            m_fileBrowser.DirectoryImage = m_directoryImage;
            m_fileBrowser.FileImage = m_fileImage;
        }
        GUILayout.EndHorizontal();
    }
コード例 #51
0
 void Start()
 {
     FileBrowser.SetFilters(true, new FileBrowser.Filter("Obj", ".obj"));
     FileBrowser.HideDialog();
 }
コード例 #52
0
    protected void FileSelectedCallback(string path, string directory)
    {
        m_fileBrowser = null;

        // handle mp3 file
        if( mostRecentExtension == "mp3")
        {
            lastUsedDirectorymp3 = directory;
            filePathmp3 = path;

             if(filePathmp3 != null)
            {
                mp3Importer = (MP3Import)GetComponent("MP3Import");
                mp3Importer.StartImport(filePathmp3);

                audioDirector.audioSourceArray[0].Stop();
                audioDirector.audioSourceArray[0] = null;

                audioDirector.audioSourceArray[0] = mp3Importer.audioSource;
                audioDirector.audioSourceArray[0].Play();
                audioDirector.currentlyPlayingFileName = Path.GetFileName(path);

                // fix for low pass filter not working on loaded songs
                audioListener.enabled = false;
                audioListener.enabled = true;

                // fixes memory leaked cause by unsed audio clips (occurs when loading new songs)
                Resources.UnloadUnusedAssets();

            }
        } // handle parameters file
        else if( mostRecentExtension == "txt")
        {
            lastUsedDirectorytxt = directory;
            filePathtxt = path;

            // load parameters text file into string
            string rawFileString = File.ReadAllText(filePathtxt);
            string[] rawSplit = rawFileString.Split('|');
            string amplitudeListString = rawSplit[1];
            string frequencyStartString = rawSplit[2];
            string frequencyListString = rawSplit[3];
            string rgbColorScaleFactorsString = rawSplit[4];

            // copy over amplitudes
            for(int i = 0; i < audioDirector.scalingPerDecadeArray.Length; i++)
                audioDirector.scalingPerDecadeArray[i] = float.Parse( amplitudeListString.Split(',')[i] );

         		// copy over frequency start index
         		audioDirector.sampleStartIndex = int.Parse( frequencyStartString.Trim() );

         		// copy over frequency distribution
         		for(int i = 0; i < audioDirector.samplesPerDecadeArray.Length; i++)
         			audioDirector.samplesPerDecadeArray[i] = int.Parse( frequencyListString.Split(',')[i] );

         		// copy over rgb scale values
         		audioDirector.rScale = float.Parse( rgbColorScaleFactorsString.Split(',')[0] );
         		audioDirector.gScale = float.Parse( rgbColorScaleFactorsString.Split(',')[1] );
         		audioDirector.bScale = float.Parse( rgbColorScaleFactorsString.Split(',')[2] );

        }

        //isActive = false;
    }
コード例 #53
0
 private void button7_Click(object sender, EventArgs e)
 {
     rootAdddress  = FileBrowser.GetFolder();
     textBox2.Text = rootAdddress;
 }
コード例 #54
0
 public NewFolder(FileBrowser browser)
 {
     InitializeComponent();
     BindingContext = this;
     Browser        = browser;
 }
コード例 #55
0
 public void SetFileBrowser(FileBrowser browser)
 {
     FileBrowser = browser;
 }
コード例 #56
0
    public void LoadGame()
    {
        const string extension    = "xml";
        const string oldExtension = "SAVE";

        ExtensionFilter[] extensions = new ExtensionFilter[1] {
            new ExtensionFilter("saveFilter", oldExtension, extension)
        };

        string path = FileBrowser.OpenSingleFile(LocalizationManager.Instance.GetLocalizedValue("filebrowser_select_to_load"), string.Empty, extensions);

        Debug.Log(LocalizationManager.Instance.GetLocalizedValue("popup_selected_file") + path);
        ShowPopUp(LocalizationManager.Instance.GetLocalizedValue("popup_selected_file") + path);

        if (string.IsNullOrEmpty(path))
        {
            Debug.LogError(LocalizationManager.Instance.GetLocalizedValue("popup_no_file_selected"));
            ShowPopUp(LocalizationManager.Instance.GetLocalizedValue("popup_no_file_selected"));
            return;
        }

        if (!File.Exists(path) || (!Path.GetExtension(path).Equals(".xml") && !Path.GetExtension(path).Equals(".SAVE")))
        {
            ShowPopUp(LocalizationManager.Instance.GetLocalizedValue("popup_wrong_file"));
            Debug.LogError(LocalizationManager.Instance.GetLocalizedValue("popup_wrong_file"));
            return;
        }

        if (Path.GetExtension(path).Equals(".xml"))
        {
            try
            {
                XmlSerializer serializer = new XmlSerializer(typeof(GameSave));
                using (Stream reader = new FileStream(path, FileMode.Open))
                {
                    // Call the Deserialize method to restore the object's state.
                    Save = (GameSave)serializer.Deserialize(reader);
                }
            }
            catch (Exception)
            {
                ShowPopUp(LocalizationManager.Instance.GetLocalizedValue("popup_not_compatible_save"));
                Debug.LogError(LocalizationManager.Instance.GetLocalizedValue("popup_not_compatible_save"));
                return;
            }
        }
        else if (Path.GetExtension(path).Equals(".SAVE"))
        {
            try
            {
                using (FileStream file = File.Open(path, FileMode.Open))
                {
                    BinaryFormatter bf = new BinaryFormatter();
                    Save = (GameSave)bf.Deserialize(file);
                }
            }
            catch (Exception)
            {
                ShowPopUp(LocalizationManager.Instance.GetLocalizedValue("popup_not_compatible_save"));
                Debug.LogError(LocalizationManager.Instance.GetLocalizedValue("popup_not_compatible_save"));
                return;
            }
        }

        Configuration.SelectionMethod     = Save.SelectionMethod;
        Configuration.MutationChance      = Save.MutationChance;
        Configuration.MutationRate        = Save.MutationRate;
        Configuration.CarCount            = Save.CarCount;
        Configuration.LayersCount         = Save.LayersCount;
        Configuration.NeuronPerLayerCount = Save.NeuronPerLayerCount;
        Configuration.Navigator           = Save.Navigator;
        Configuration.IsPopulated         = true;
        Configuration.TrackNumber         = LoadTrackNumber;
        MedianFitness     = Save.MedianFitness;
        MaxFitness        = Save.MaxFitness;
        RandomHelper.Seed = Save.Seed;

        GotOptionValues = true;
        IsLoad          = true;

        Master.Instance.StartNewGame(true);
        Master.Instance.MainMenuCanvas.SetActive(false);
        Master.Instance.BgLights.SetActive(false);

        ShowPopUp(LocalizationManager.Instance.GetLocalizedValue("popup_game_loaded"));
        Debug.Log(LocalizationManager.Instance.GetLocalizedValue("popup_game_loaded"));
    }
コード例 #57
0
 public void OpenFoldersAsync()
 {
     //FileBrowser.OpenFoldersAsync((string[] paths) => { writePaths(paths); }, "Open folders", "c:", true);
     FileBrowser.OpenFoldersAsync((string[] paths) => { writePaths(paths); });
 }
コード例 #58
0
ファイル: ScenarioLoader.cs プロジェクト: ssontag55/Oilmap-3D
 protected void OnGUIMain()
 {
     GUILayout.BeginHorizontal();
         GUILayout.Label("Select Working Directory", GUILayout.Width(100));
         GUILayout.FlexibleSpace();
         GUILayout.Label(scenarioPath ?? "none selected");
         if (GUILayout.Button("...", GUILayout.ExpandWidth(false))) {
             m_fileBrowser = new FileBrowser(
                 new Rect(100, 100, 600, 500),
                 "Click Select to set the Working Directory",
                 FileSelectedCallback
             );
             if(currentPattern == 0)
            		m_fileBrowser.BrowserType = FileBrowserType.Directory;
            	else
            	{
            		m_fileBrowser.CurrentDirectory = scenarioPath+hardDirectories[currentPattern];
            		m_fileBrowser.BrowserType = FileBrowserType.File;
            		//m_fileBrowser.SetNewDirectory(scenarioPath);
            	}
             m_fileBrowser.SelectionPattern = selectPatterns[currentPattern];
             m_fileBrowser.DirectoryImage = m_directoryImage;
             m_fileBrowser.FileImage = m_fileImage;
         }
     GUILayout.EndHorizontal();
 }
コード例 #59
0
 public void ReadMp3Sounds()
 {
     FileBrowser.SetFilters(false, new FileBrowser.Filter("Sounds", ".mp3"));
     FileBrowser.SetDefaultFilter(".mp3");
     StartCoroutine(ShowLoadDialogCoroutine());
 }
コード例 #60
0
 public void OpenFileWindow()
 {
     FileBrowser.SetFilters(false, new FileBrowser.Filter("Models", ".obj"));
     FileBrowser.ShowLoadDialog(OnFileSelected, OnFileSelectionCanceled);
 }