public void Save() { int[] NodePerTrack = new int[trackNb]; for (int i = 0; i < NodePerTrack.Length; i++) { NodePerTrack[i] = 0; } //Save for (int j = 0; j < parentBeats.childCount; j++) { PrimaryBeat beat = parentBeats.GetChild(j).GetComponent <PrimaryBeat>(); for (int i = 0; i < beat.nodes.Length; i++) { for (int k = 0; k < beat.nodes[i].Length; k++) { if (beat.nodes[i][k]) { NodePerTrack[i]++; } } } } SongInfo.Partition newPartition = new SongInfo.Partition(); newPartition.tracks = new SongInfo.Track[trackNb]; for (int i = 0; i < trackNb; i++) { newPartition.tracks[i] = new SongInfo.Track(); newPartition.tracks[i].notes = new SongInfo.Note[NodePerTrack[i]]; } //Indice note for (int i = 0; i < NodePerTrack.Length; i++) { NodePerTrack[i] = 0; } //Transfert des notes for (int j = 0; j < parentBeats.childCount; j++) { PrimaryBeat beat = parentBeats.GetChild(j).GetComponent <PrimaryBeat>(); for (int i = 0; i < beat.nodes.Length; i++) { for (int k = 0; k < beat.nodes[i].Length; k++) { if (beat.nodes[i][k]) { newPartition.tracks[i].notes[NodePerTrack[i]] = new SongInfo.Note(j + k * 0.25f, 0); NodePerTrack[i]++; } } } } PlayersPartition[CurrentIdPartition] = newPartition; SongInfoCustom.Instance.currentSong.partitions[CurrentIdPartition] = newPartition; EditorUtility.CopySerialized(SongInfoCustom.Instance.currentSong, SongInfoCustom.Instance.currentSong); AssetDatabase.Refresh(); AssetDatabase.SaveAssets(); }
public void resetNodePosition() { for (int j = 0; j < parentBeats.childCount; j++) { PrimaryBeat beat = parentBeats.GetChild(j).GetComponent <PrimaryBeat>(); for (int i = 0; i < trackNb; i++) { for (int k = 0; k < beat.nodes[i].Length; k++) { if (beat.nodes[i][k]) { beat.nodes[i][k].position = new Vector3(j * crotchetSize + GetSubNodePosX(k), OffsetYTracks[i], -2); } } } } }
private void Awake() { parentBeat = transform.parent.GetComponent<PrimaryBeat>(); }