public NoteData(int index, byte lane, byte type, float time, int chainBehind, int chainForword) { this.index = index; this.lane = lane; this.type = type; this.time = time; this.chainBehind = chainBehind; this.chainForward = chainForword; this.isEnable = true; this.slideLine = null; }
public void OnSlideLineTapped(Vector3 point, NoteData fromNote, NoteData toNote, SlideLine slideLine) { if (this.GetMode() != (byte)NotesSelectManager.MODE.SLIDE_VIA) { return; } byte lane; if (point.x <= this.notesManager.lane_width * -3) { lane = 0; } else if (point.x >= this.notesManager.lane_width * 3) { lane = 6; } else { lane = (byte)(Math.Round(point.x / this.notesManager.lane_width, MidpointRounding.AwayFromZero) + 3); } float time = soundManager.GetTime() + (notesManager.to - point.y) / ((notesManager.to - notesManager.from) / notesManager.speed); NoteData note = new NoteData(notesManager.GetIndex(), lane, (byte)NoteData.NOTE.SLIDE_VIA, time, toNote.index, fromNote.index); notesManager.AddNote(note); fromNote.chainBehind = note.index; toNote.chainForward = note.index; slideLine.SetToNote(note); }
void LaunchNotes(NoteData note) { List <int> launchedSlideLines = new List <int>(); Transform childTransform = this.slideLinesParent.transform; foreach (Transform child in childTransform.transform) { SlideLine line = child.gameObject.GetComponent <SlideLine>(); launchedSlideLines.Add(line.index); } bool doDraw; switch (note.type) { case (byte)NoteData.NOTE.SINGLE: Notes fromNote = Instantiate(singlenotesPrefab).gameObject.GetComponent <Notes>(); fromNote.transform.parent = notesParent.transform; fromNote.Launch(this, this.soundManager, this.editManager, note); break; case (byte)NoteData.NOTE.SLIDE_PRESS: fromNote = Instantiate(slidenotesPressPrefab).gameObject.GetComponent <Notes>(); fromNote.transform.parent = notesParent.transform; fromNote.Launch(this, this.soundManager, this.editManager, note); doDraw = true; for (int k = 0; k < launchedSlideLines.Count; k++) { if (note.index == launchedSlideLines[k]) { doDraw = false; } } if (doDraw) { for (int j = 0; j < this.notes.Count; j++) { if (note.chainBehind == notes[j].index) { SlideLine slideLine = Instantiate(slidelinesPrefab).gameObject.GetComponent <SlideLine>(); slideLine.transform.parent = slideLinesParent.transform; slideLine.Launch(note.index, this, this.soundManager, note, notes[j]); note.slideLine = slideLine; launchedSlideLines.Add(slideLine.index); break; } } } break; case (byte)NoteData.NOTE.SLIDE_VIA: fromNote = Instantiate(slidenotesViaPrefab).gameObject.GetComponent <Notes>(); fromNote.transform.parent = notesParent.transform; fromNote.Launch(this, this.soundManager, this.editManager, note); doDraw = true; for (int k = 0; k < launchedSlideLines.Count; k++) { if (note.index == launchedSlideLines[k]) { doDraw = false; } } if (doDraw) { for (int j = 0; j < this.notes.Count; j++) { if (note.chainBehind == notes[j].index) { SlideLine slideLine = Instantiate(slidelinesPrefab).gameObject.GetComponent <SlideLine>(); slideLine.transform.parent = slideLinesParent.transform; slideLine.Launch(note.index, this, this.soundManager, note, notes[j]); note.slideLine = slideLine; launchedSlideLines.Add(slideLine.index); break; } } } doDraw = true; for (int k = 0; k < launchedSlideLines.Count; k++) { if (note.chainForward == launchedSlideLines[k]) { doDraw = false; } } if (doDraw) { for (int j = 0; j < this.notes.Count; j++) { if (note.chainForward == notes[j].index) { SlideLine slideLine = Instantiate(slidelinesPrefab).gameObject.GetComponent <SlideLine>(); slideLine.transform.parent = slideLinesParent.transform; slideLine.Launch(notes[j].index, this, this.soundManager, notes[j], note); launchedSlideLines.Add(slideLine.index); break; } } } break; case (byte)NoteData.NOTE.SLIDE_RELEASE: fromNote = Instantiate(slidenotesReleasePrefab).gameObject.GetComponent <Notes>(); fromNote.transform.parent = notesParent.transform; fromNote.Launch(this, this.soundManager, this.editManager, note); doDraw = true; for (int k = 0; k < launchedSlideLines.Count; k++) { if (note.chainForward == launchedSlideLines[k]) { doDraw = false; } } if (doDraw) { for (int j = 0; j < this.notes.Count; j++) { if (note.chainForward == notes[j].index) { SlideLine slideLine = Instantiate(slidelinesPrefab).gameObject.GetComponent <SlideLine>(); slideLine.transform.parent = slideLinesParent.transform; slideLine.Launch(notes[j].index, this, this.soundManager, notes[j], note); launchedSlideLines.Add(slideLine.index); break; } } } break; case (byte)NoteData.NOTE.FLICK: fromNote = Instantiate(flicknotesPrefab).gameObject.GetComponent <Notes>(); fromNote.transform.parent = notesParent.transform; GameObject grandchild = fromNote.transform.Find("Wrap").transform.Find("Arrow").gameObject; grandchild.GetComponent <LookAtCamera>().targetCamera = mainCamera; fromNote.Launch(this, this.soundManager, this.editManager, note); if (note.chainForward != -1) { doDraw = true; for (int k = 0; k < launchedSlideLines.Count; k++) { if (note.chainForward == launchedSlideLines[k]) { doDraw = false; } } if (doDraw) { for (int j = 0; j < this.notes.Count; j++) { if (note.chainForward == notes[j].index) { SlideLine slideLine = Instantiate(slidelinesPrefab).gameObject.GetComponent <SlideLine>(); slideLine.transform.parent = slideLinesParent.transform; slideLine.Launch(notes[j].index, this, this.soundManager, notes[j], note); launchedSlideLines.Add(slideLine.index); break; } } } } break; } }