public static BeatMapData ConvertBSDataToEditorData(BeatSaberJSONClass fromBeatSaber)
        {
            BeatMapData bmd = new BeatMapData();

            bmd.beatsPerMinute = fromBeatSaber.info.beatsPerMinute;
            bmd.mapArtist      = fromBeatSaber.info.authorName;
            bmd.songArtist     = fromBeatSaber.info.songSubName;
            bmd.songName       = fromBeatSaber.info.songName;
            bmd.songOffset     = fromBeatSaber.info.difficultyLevels[0].offset / 100;
            List <NoteDetails> notes = new List <NoteDetails>();

            foreach (BSNote bsNote in fromBeatSaber.level._notes)
            {
                NoteDetails note = new NoteDetails();
                if (bsNote._type == 0)
                {
                    note.color = Note.NoteColor.LEFT;
                }
                else
                {
                    note.color = Note.NoteColor.RIGHT;
                }
                note.slashDirection = BSNote.GetSlashDirection(bsNote._cutDirection);
                note.gridPosition   = new Vector2(bsNote._lineIndex, bsNote._lineLayer);
                note.timeToSpawn    = bsNote._time;
                notes.Add(note);
            }
            bmd.notes = notes.ToArray();
            return(bmd);
        }
Exemple #2
0
        public BeatSaberJSONClass LoadFromDisk(string path, string fileName, string audioClipName)
        {
            BeatSaberJSONClass beatSaberMap = Utilities.LoadFromDisk(path, fileName);

            song           = Utilities.StartAudioInitialize(path + flatMenu.selectedLoadSongFileName);
            audioIsLoading = true;
            Debug.Log("Audio loading - " + path + audioClipName);
            return(beatSaberMap);
        }
Exemple #3
0
 public void LoadSelectedMap()
 {
     SetCurrentState(EditorState.PlaybackLoad);
     Debug.LogWarning("Loading selected map");
     string[] location = flatMenu.GetSelectedMapFullPath();
     json        = LoadFromDisk(location[0], location[1], location[2]);
     beatMapData = BeatSaberJSONClass.ConvertBSDataToEditorData(json);
     // Load from disk continues from update method when audio is loaded //
 }
        public static BeatSaberJSONClass ConvertUnityDataToBSData(BeatMapData data)
        {
            BeatSaberJSONClass bsaberJSON = new BeatSaberJSONClass();

            bsaberJSON.info = new InfoJSON();
            bsaberJSON.info.beatsPerMinute = (int)data.beatsPerMinute;
            bsaberJSON.info.authorName     = data.mapArtist;
            bsaberJSON.info.songSubName    = data.songArtist;
            bsaberJSON.info.songName       = data.songName;
            // TODO merge with existing info if any //
            bsaberJSON.info.difficultyLevels    = new DifficultyLevel[1];
            bsaberJSON.info.difficultyLevels[0] = DifficultyLevel.Generate(data.difficulty,
                                                                           data.songFileName, (int)data.songOffset);
            List <BSNote> notes = new List <BSNote>();

            for (int count = 0; count < data.notes.Length; count++)
            {
                if (!data.notes[count].inverted)
                {
                    BSNote bSNote = new BSNote();
                    if (data.notes[count].color == Note.NoteColor.LEFT)
                    {
                        bSNote._type = 0;
                    }
                    else
                    {
                        bSNote._type = 1;
                    }
                    bSNote._cutDirection = BSNote.GetBSaberCutDirection(data.notes[count].slashDirection);
                    bSNote._lineIndex    = (int)data.notes[count].gridPosition.x;
                    bSNote._lineLayer    = (int)data.notes[count].gridPosition.y;
                    bSNote._time         = data.notes[count].timeToSpawn;
                    notes.Add(bSNote);
                }
            }
            BeatMap.Log("Notes exported with count " + notes.Count);
            LevelJSON level = new LevelJSON();

            level._beatsPerMinute = (int)data.beatsPerMinute;
            level._version        = "1.0";
            level._beatsPerBar    = 16;
            level._noteJumpSpeed  = 10;
            level._shufflePeriod  = .5f;
            level._notes          = notes.ToArray();
            bsaberJSON.level      = level;
            return(bsaberJSON);
        }
Exemple #5
0
 public void Initialize(BeatSaberJSONClass data, NoteMode noteMode, EditorState requestedState)
 {
     Initialize(BeatSaberJSONClass.ConvertBSDataToEditorData(data), noteMode, requestedState);
 }