Ejemplo n.º 1
0
        //Save
        public void SaveSong(object arg)
        {
            string curPath = _dataPath + "/" + GameRegistry.GetString("CUR_SONG");

            Directory.CreateDirectory(curPath);
            if (!File.Exists(_dataPath + "/" + GameRegistry.GetString("CUR_SONG") + "/" + Path.GetFileName(_curSong.songPath)))
            {
                string newPath = GameRegistry.GetString("CUR_SONG") + "/" + Path.GetFileName(_curSong.songPath);
                File.Copy(_dataPath + "/" + _curSong.songPath, _dataPath + "/" + newPath);
                _curSong.songPath = newPath;
            }
            File.WriteAllBytes(curPath + "/Song.SongData", _curSong.getSongData());
        }
Ejemplo n.º 2
0
        public void CreateSong(Song song)
        {
            string curPath = _dataPath + "/" + GameRegistry.GetString("CUR_SONG");

            Directory.CreateDirectory(curPath);
            if (!File.Exists(_dataPath + "/" + GameRegistry.GetString("CUR_SONG") + "/" + Path.GetFileName(song.songPath)))
            {
                string newPath = GameRegistry.GetString("CUR_SONG") + "/" + Path.GetFileName(song.songPath);
                File.Copy(_dataPath + "/" + song.songPath, _dataPath + "/" + newPath);
                song.songPath = newPath;
            }
            File.WriteAllBytes(curPath + "/Song.SongData", song.getSongData());
            SceneManager.LoadScene("songEditor");
        }
Ejemplo n.º 3
0
 void Start()
 {
     //Set the Data path
     _dataPath = Application.dataPath + "/Songs/";
     //Cache the audio source
     _src = GetComponent <AudioSource>();
     if (GameRegistry.GetString("CUR_SONG") == null)
     {
         GameRegistry.SetValue("CUR_SONG", "SongName");
     }
     byte[] songData = File.ReadAllBytes(_dataPath + GameRegistry.GetString("CUR_SONG") + "/Song.SongData");
     _song = Song.loadSong(songData);
     EventManager.StartListening("loadSong", SongReady);
     StartCoroutine(_song.LoadAudioClip("loadSong"));
     _loadTimer = Time.time;
     //_src.clip = _song.song;
     //_songLength = _src.clip.length;
 }
Ejemplo n.º 4
0
        //Load the song and wait for completion
        void Start()
        {
            //trackConfigWindow.CloseWindow();
            _dataPath = Application.dataPath + "/Songs";
            //if (GameRegistry.GetString("CUR_SONG") == null)
            //	GameRegistry.SetValue("CUR_SONG", "SongName");
            _mode = TimelineMode.sec;
            string curPath = _dataPath + "/" + GameRegistry.GetString("CUR_SONG", "SongName");

            _curSong = Song.loadSong(File.ReadAllBytes(curPath + "/Song.SongData"));
            Debug.Log(_curSong.songPath);
            //_curSong.songPath = "/SongName/Song.wav";
            //File.WriteAllBytes(_dataPath + "/SongName/Song.SongData", _curSong.getSongData());
            _audio             = GetComponent <AudioSource>();
            _audio.playOnAwake = false;
            _audio.Stop();
            EventManager.StartListening("songLoaded", SongReady);
            _loadStartTime = Time.time;
            StartCoroutine(_curSong.LoadAudioClip("songLoaded"));
            Debug.Log("Loading Song...");
        }
Ejemplo n.º 5
0
 public Song(string songPath, int trackCount)
 {
     this.info       = new SongInfo("no title", "no artist", "no album", "no year", "normal", GameRegistry.GetString("UserName"));
     this.songPath   = songPath;
     this.trackCount = trackCount;
     FillTracks(trackCount);
 }