Skip to content

Commit

Permalink
Long time no see, everybody!
Browse files Browse the repository at this point in the history
  • Loading branch information
HolySkyMin committed Jan 6, 2018
1 parent 9906e96 commit fdccbf4
Show file tree
Hide file tree
Showing 7 changed files with 535 additions and 55 deletions.
37 changes: 5 additions & 32 deletions ScrObjAnalyzer/DataParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public DataParser()

}

public string ParseToTWx(int twxMode, List<ListData> data, List<BPMData> bpm, byte[] color)
public string ParseToTWx(int twxMode, List<ListData> data, List<BPMData> bpm, byte[] color, Metadata meta)
{
List<Note> NoteList = new List<Note>();
int bpmIndex = -1;
Expand All @@ -36,7 +36,7 @@ public string ParseToTWx(int twxMode, List<ListData> data, List<BPMData> bpm, by
double start = data[i].StartPos + 1;

Note note = new Note();
note.CreateNote(data[i].ID, size, color, mode, flick, data[i].Time, data[i].Tick, data[i].Speed, start, data[i].EndPos + 1.0, new int[] { 0 });
note.CreateNote(data[i].ID, size, data[i].NoteColor, mode, flick, data[i].Time, data[i].Tick, data[i].Speed, start, data[i].EndPos + 1.0, new int[] { 0 });
NoteList.Add(note);
if (data[i].Type.Equals(5) || data[i].Type.Equals(7))
{
Expand All @@ -46,15 +46,15 @@ public string ParseToTWx(int twxMode, List<ListData> data, List<BPMData> bpm, by
else if (data[i].EndType.Equals(2)) { newflick = 3; }
else if (data[i].EndType.Equals(3)) { newflick = 2; }
Note tail = new Note();
tail.CreateNote(data[i].ID + 1, size, color, mode, newflick, data[i].Time + (data[i].TickDistance * bpm[bpmIndex].SecPerTick), data[i].Tick + data[i].TickDistance, data[i].Speed, start, data[i].EndPos + 1, new int[] { data[i].ID });
tail.CreateNote(data[i].ID + 1, size, data[i].SubColor[0], mode, newflick, data[i].Time + (data[i].TickDistance * bpm[bpmIndex].SecPerTick), data[i].Tick + data[i].TickDistance, data[i].Speed, start, data[i].EndPos + 1, new int[] { data[i].ID });
NoteList.Add(tail);
}
else if (data[i].Type.Equals(6))
{
for (int j = 1; j < data[i].SubPos.Count; j++)
{
Note sub = new Note();
sub.CreateNote(data[i].ID + j, size, color, mode, 0, data[i].Time + (data[i].SubTick[j] * bpm[bpmIndex].SecPerTick), data[i].Tick + data[i].SubTick[j], data[i].Speed, data[i].SubPos[j] + 1, data[i].SubPos[j] + 1, new int[] { data[i].ID + j - 1 });
sub.CreateNote(data[i].ID + j, size, data[i].SubColor[j - 1], mode, 0, data[i].Time + (data[i].SubTick[j] * bpm[bpmIndex].SecPerTick), data[i].Tick + data[i].SubTick[j], data[i].Speed, data[i].SubPos[j] + 1, data[i].SubPos[j] + 1, new int[] { data[i].ID + j - 1 });
if (j.Equals(data[i].SubPos.Count - 1))
{
int newflick = 0;
Expand All @@ -70,6 +70,7 @@ public string ParseToTWx(int twxMode, List<ListData> data, List<BPMData> bpm, by
}

NoteData notedata = new NoteData();
notedata.metadata = meta;
notedata.notes = NoteList.ToArray();

string json = JsonMapper.ToJson(notedata);
Expand All @@ -82,42 +83,14 @@ private double ConvertStartPos(int twxMode, double value)

if (twxMode.Equals(2))
{
/*
if (value.Equals(-1)) { start = 0.666666; }
else if (value.Equals(0)) { start = 1.222222; }
else if (value.Equals(1)) { start = 1.777777; }
else if (value.Equals(2)) { start = 2.333333; }
*/
start = (11.0 / 9.0) + ((5.0 / 9.0) * value);
}
else if (twxMode.Equals(4))
{
/*
if (value.Equals(-2)) { start = 0.555555; }
else if (value.Equals(-1)) { start = 1.111111; }
else if (value.Equals(0)) { start = 1.666666; }
else if (value.Equals(1)) { start = 2.222222; }
else if (value.Equals(2)) { start = 2.777777; }
else if (value.Equals(3)) { start = 3.333333; }
else if (value.Equals(4)) { start = 3.888888; }
else if (value.Equals(5)) { start = 4.444444; }
*/
start = (15.0 / 9.0) + ((5.0 / 9.0) * value);
}
else if (twxMode.Equals(6))
{
/*
if (value.Equals(-2)) { start = 1.0; }
else if (value.Equals(-1)) { start = 1.555555; }
else if (value.Equals(0)) { start = 2.111111; }
else if (value.Equals(1)) { start = 2.666666; }
else if (value.Equals(2)) { start = 3.222222; }
else if (value.Equals(3)) { start = 3.777777; }
else if (value.Equals(4)) { start = 4.333333; }
else if (value.Equals(5)) { start = 4.888888; }
else if (value.Equals(6)) { start = 5.444444; }
else if (value.Equals(7)) { start = 6.0; }
*/
start = (19.0 / 9.0) + ((5.0 / 9.0) * value);
}

Expand Down
Loading

0 comments on commit fdccbf4

Please sign in to comment.