Ejemplo n.º 1
0
 public void ConfirmButtonPressed() //Project - New - Confirm
 {
     project          = new Project();
     audioFileBytes   = File.ReadAllBytes(songFile.FullName);
     songAudioClip    = AudioLoader.LoadFromBuffer(audioFileBytes, songFile.Extension);
     project.songName = songFile.Name;
     project.charts   = new Chart[4];
     for (int i = 0; i < 4; i++)
     {
         project.charts[i] = new Chart
         {
             difficulty = i,
             level      = "1"
         }
     }
     ;
     stage.musicSource.clip = songAudioClip;
     infoPanelButton.SetActive(true);
     chartsPanelButton.SetActive(true);
     newProjectPanel.SetActive(false);
     infoPanel.SetActive(true);
     currentInStage = -1;
     InfoInitialization();
     LvlInputFieldInit();
     if (songAudioClip == null)
     {
         MessageScreen.Activate(
             new[] { "Failed to load audio", "读取音频失败" },
             new[] { "Please select another audio file", "请选择其他的音频文件" },
             new[] { "Load another audio file", "读取其他的音频文件" },
             ChangeMusicFile);
     }
 }
Ejemplo n.º 2
0
 private void NewSongSelected()
 {
     songFile          = new FileInfo(directorySelectorController.selectedItemFullName);
     songNameText.text = songFile.Name;
     project.songName  = songNameText.text;
     directorySelectorController.DeactivateSelection();
     audioFileBytes = File.ReadAllBytes(songFile.FullName);
     songAudioClip  = AudioLoader.LoadFromBuffer(audioFileBytes, songFile.Extension);
     if (songAudioClip == null)
     {
         MessageScreen.Activate(
             new[] { "Failed to load audio", "读取音频失败" },
             new[] { "Please select another audio file", "请选择其他的音频文件" },
             new[] { "Load another audio file", "读取其他的音频文件" },
             ChangeMusicFile);
         return;
     }
     stage.musicSource.clip    = songAudioClip;
     stage.timeSlider.value    = 0.0f;
     stage.timeSlider.maxValue = songAudioClip.length;
     stage.OnSliderValueChanged();
 }
Ejemplo n.º 3
0
    public IEnumerator ProjectToLoadSelected(string fileName = null)
    {
        string   projectFullDir = fileName ?? directorySelectorController.selectedItemFullName;
        string   audioType      = null;
        FileInfo projectFile;

        directorySelectorController.DeactivateSelection();
        dragAndDropFileName = null;
        yield return(StartCoroutine(projectSL.LoadProjectFromFile(res => project = res,
                                                                  res => audioFileBytes = res, res => audioType = res, projectFullDir)));

        songAudioClip = AudioLoader.LoadFromBuffer(audioFileBytes, audioType);
        infoPanelButton.SetActive(true);
        chartsPanelButton.SetActive(true);
        songAudioClip?.LoadAudioData();
        stage.musicSource.clip = songAudioClip;
        editPanelButton.SetActive(false);
        projectFile     = new FileInfo(projectFullDir);
        projectFileName = projectFile.Name.Remove(projectFile.Name.Length - 7, 7);
        projectFolder   = projectFile.FullName.Remove(projectFile.FullName.Length - projectFile.Name.Length, projectFile.Name.Length);
        filePanel.SetActive(false);
        currentInStage = -1;
        InfoInitialization();
        LvlInputFieldInit();
        if (songAudioClip == null)
        {
            MessageScreen.Activate(
                new[] { "Failed to load audio", "读取音频失败" },
                new[] { "Please select another audio file", "请选择其他的音频文件" },
                new[] { "Load another audio file", "读取其他的音频文件" },
                ChangeMusicFile);
        }
        yield return(new WaitForSeconds(3.0f));

        projectSL.loadCompleteText.SetActive(false);
    }