Exemple #1
0
 public void OnTrackDataCreated(TrackData trackData)
 {
     TrackDataManager.instance.onTrackDataComplete -= new TrackDataManager.OnTrackDataComplete(this.OnTrackDataCreated);
     this.originalFilePath  = trackData.originalFilePath;
     this.originalTrackName = trackData.originalTrackName;
     this.originalArtist    = trackData.originalArtist;
     this.trackId           = trackData.trackId;
     this.duration          = trackData.duration;
     this.bpm              = trackData.bpm;
     this.locationMode     = trackData.locationMode;
     this.beatStrucureJSON = trackData.beatStrucureJSON;
     this.trackDataState   = TrackDataState.Ready;
     onTrackDataReady?.Invoke(this);
 }
Exemple #2
0
 public void PopulateTrackDataFromAudioFile(
     string filePath,
     LocationMode locationMode,
     Game gameType)
 {
     this.trackDataState = TrackDataState.Loading;
     TrackDataManager.instance.onTrackDataComplete += new TrackDataManager.OnTrackDataComplete(OnTrackDataCreated);
     if (TrackDataManager.instance.DoesTrackDataExist(filePath, locationMode, gameType))
     {
         this.LoadTrackData(new TrackId(filePath).trackId, locationMode);
     }
     else
     {
         TrackDataManager.instance.PopulateTrackDataFromAudioFile(filePath, locationMode, filePath);
     }
 }
Exemple #3
0
        public void LoadTrackData(string trackId, LocationMode locationMode)
        {
            string str = "";

            switch (locationMode)
            {
            case LocationMode.PlayerData:
            case LocationMode.Editor:
                string path = Paths.TrackDataFolder(locationMode) + trackId + ".trackdata.txt";
                if (File.Exists(path))
                {
                    str = File.ReadAllText(path);
                }
                break;
            }
            if (str != "")
            {
                TrackData trackData = JsonConvert.DeserializeObject <TrackData>(str);
                this.originalTrackName = trackData.originalTrackName;
                this.trackId           = trackData.trackId;
                this.duration          = trackData.duration;
                this.bpm              = trackData.bpm;
                this.locationMode     = locationMode;
                this.beatStrucureJSON = trackData.beatStrucureJSON;
                this.originalFilePath = trackData.originalFilePath;
                this.originalArtist   = trackData.originalArtist;
                this.LoadBeatStructure();
                if (this.onTrackDataReady != null)
                {
                    this.onTrackDataReady(this);
                }
                this.trackDataState = TrackDataState.Ready;
            }
            else
            {
                this.trackDataState = TrackDataState.Failed;
            }
        }