public static Beatmap DMap_to_SMap(DynamixBeatmapData dMap) { if (dMap is null) { return(null); } var data = new Beatmap { BPM = (int)Mathf.Max(dMap.m_barPerMin * 4, 1), Shift = dMap.m_timeOffset, Level = 1, Ratio = 1.5f, Tag = "Normal", CreatedTime = System.DateTime.Now.Ticks, Timings = new List <Beatmap.Timing>(), Stages = new List <Beatmap.Stage> { new Beatmap.Stage() // Bottom { Duration = float.MaxValue, Rotation = 0f, Speed = 1f, Time = 0f, Width = 1f, Height = 2f / 3f, X = 0.5f, Y = 0f, Widths = { }, Heights = { }, Positions = { }, Rotations = { }, }, new Beatmap.Stage() // Right { Duration = float.MaxValue, Rotation = -90f, Speed = 1f, Time = 0f, Width = 2f / 3f, Height = 0.5f, X = 1f, Y = 1f / 3f, Widths = { }, Heights = { }, Positions = { }, Rotations = { }, }, new Beatmap.Stage() // Left { Duration = float.MaxValue, Rotation = 90f, Speed = 1f, Time = 0f, Width = 2f / 3f, Height = 0.5f, X = 0f, Y = 1f / 3f, Widths = { }, Heights = { }, Positions = { }, Rotations = { }, }, }, Tracks = new List <Beatmap.Track> { new Beatmap.Track() // Bottom { Duration = float.MaxValue, Time = 0f, StageIndex = 0, Width = 1f, X = 0.5f, HasTray = false, Color = 9, Angle = 0f, Speed = 1f, Xs = { }, Widths = { }, Colors = { }, Angles = { }, }, new Beatmap.Track() // Right { Duration = float.MaxValue, Time = 0f, StageIndex = 1, Width = 1f, Speed = 1f, X = 0.5f, HasTray = dMap.m_rightRegion == "MIXER", Color = 9, Angle = 0f, Xs = { }, Widths = { }, Colors = { }, Angles = { }, }, new Beatmap.Track() // Left { Duration = float.MaxValue, Time = 0f, StageIndex = 2, Width = 1f, Speed = 1f, X = 0.5f, HasTray = dMap.m_leftRegion == "MIXER", Color = 9, Angle = 0f, Xs = { }, Widths = { }, Colors = { }, Angles = { }, }, }, Notes = null, }; var notes = new List <Beatmap.Note>(); notes.AddRange(GetNoteDataFromDynamix(dMap.m_notes, 0, -dMap.m_timeOffset, 60f / dMap.m_barPerMin)); notes.AddRange(GetNoteDataFromDynamix(dMap.m_notesRight, 1, -dMap.m_timeOffset, 60f / dMap.m_barPerMin)); notes.AddRange(GetNoteDataFromDynamix(dMap.m_notesLeft, 2, -dMap.m_timeOffset, 60f / dMap.m_barPerMin, true)); data.Notes = notes; data.SortNotesByTime(); return(data); }
public static DynamixBeatmapData SMap_to_DMap(Beatmap source) { var dMap = new DynamixBeatmapData(); if (source.Tracks.Count < 3) { return(dMap); } source.SortNotesByTime(); dMap.m_path = ""; dMap.m_barPerMin = Mathf.Max(1f, source.BPM / 4f); dMap.m_timeOffset = 0f; dMap.m_mapID = "Dynamix Beatmap"; dMap.m_leftRegion = source.Tracks[2].HasTray ? "MIXER" : "PAD"; dMap.m_rightRegion = source.Tracks[1].HasTray ? "MIXER" : "PAD"; dMap.m_notes = new Notes() { m_notes = new List <Notes.CMapNoteAsset>() }; dMap.m_notesLeft = new Notes() { m_notes = new List <Notes.CMapNoteAsset>() }; dMap.m_notesRight = new Notes() { m_notes = new List <Notes.CMapNoteAsset>() }; float timeMuti = dMap.m_barPerMin / 60f; for (int i = 0; i < source.Notes.Count; i++) { var note = source.Notes[i]; Notes notes = note.TrackIndex == 0 ? dMap.m_notes : note.TrackIndex == 1 ? dMap.m_notesRight : dMap.m_notesLeft; float w = note.Width * (note.TrackIndex == 0 ? 5.6f : 6.5f); float noteX = note.TrackIndex == 2 ? 1f - note.X : note.X; float pos = (note.TrackIndex == 0 ? (noteX * 5.6f - 0.3f) : noteX * 6f) - w * 0.5f; var noteType = (NoteType)note.ItemType; notes.m_notes.Add(new Notes.CMapNoteAsset() { m_id = notes.m_notes.Count, m_subId = noteType == NoteType.Hold ? notes.m_notes.Count + 1 : -1, m_type = GetDynamixType(noteType), m_time = note.Time * timeMuti, m_width = w, m_position = pos, }); if (noteType == NoteType.Hold) { notes.m_notes.Add(new Notes.CMapNoteAsset() { m_id = notes.m_notes.Count, m_subId = -1, m_type = "SUB", m_time = (note.Time + note.Duration) * timeMuti, m_width = w, m_position = pos, }); } } return(dMap); }