Exemplo n.º 1
0
    public void ToggleClick_Result()
    {
        Debug.Log("버튼 클릭됨");

        GameObject      obj        = EventSystem.current.currentSelectedGameObject;
        MusicListObject listObject = obj.GetComponent <MusicListObject>();

        // 클릭된 이름의 효과음 재생하여 사용자가 어떤 소리인지 알수있게해줌
        // 재생할 파일명은 PlayerInformation의 SoundFileNameList임.

        //if (toggleItem.item.isOn)
        //{
        //    AudioSource audioSource = GetComponent<AudioSource>();
        //    // 리소스에서 오디오 파일을 불러온다.
        //    AudioClip audioClip = Resources.Load<AudioClip>("EffectSounds/" + toggleItem.soundFileName.text);
        //    audioSource.clip = audioClip;
        //    if (drumType == 0)
        //    {
        //        // 선택된 소리를 기본 소리로 셋팅한다
        //        PlayerInformation.leftDrumSound = audioClip;
        //    }
        //    else
        //    {
        //        // 선택된 소리를 기본 소리로 셋팅한다
        //        PlayerInformation.rightDrumSound = audioClip;
        //    }
        //    // 재생
        //    audioSource.Play();
        //}
    }
    /*
     * 사용자 노래 리스트에서 노래를 선택했을 때
     * 1. 먼저 해당 노래를 게임내부 폴더로 복사한다.
     * 2. 노래 List가 담긴 text파일에 노래를 추가해준다.
     * 3. 노래의 제목을 바꾼다.
     * 4. 버튼 아이템을 만들어 리스트뷰에 추가시켜준다.
     */
    public void ItemClick_Result()
    {
        GameObject      obj        = EventSystem.current.currentSelectedGameObject;
        MusicListObject listObject = obj.GetComponent <MusicListObject>();

        string musicFileName = listObject.musicName.text;

        // 파일 정보를 PlayerInformation의 정보에담는다.
        AddMusicInformation(musicFileName);

        string originalFilePath = musicFolderPath + Path.DirectorySeparatorChar + musicFileName + ".ogg";
        string saveFilePath     = systemPath + Path.DirectorySeparatorChar + "beats" + Path.DirectorySeparatorChar + PlayerInformation.musicCount + ".ogg"; // 여기 카운트 들어갸야함

        Debug.Log(saveFilePath);

        // 파일 복사하는 함수 호출
        CopyMusicFile(originalFilePath, saveFilePath);

        // 리스트뷰에 추가 하는 함수 호출
        AddListViewItem();

        // 창을 닫고 로딩화면을 보여준다.
        AddMusicPanel.SetActive(false);
    }