Example #1
0
    private void AddNewMelody(int targetIndex = -1)
    {
        GameObject newDiagram = Instantiate <GameObject>(MelodyDiagramTemplate, ScrollContainer);

        newDiagram.transform.SetSiblingIndex(targetIndex >= 0 ? targetIndex : ScrollContainer.childCount - 3);
        MelodyDiagram diagram = newDiagram.GetComponent <MelodyDiagram>();

        diagram.Initialize(OnMelodyRemoved, OnMelodyDuplicated, AddNewElement, MoveElement);
        melodies.Add(diagram);
    }
Example #2
0
 private void OnMelodyDuplicated(MelodyDiagram diagram)
 {
     AddNewMelody(diagram.CurrentMelody);
 }
Example #3
0
 private void OnMelodyRemoved(MelodyDiagram diagram)
 {
     melodies.Remove(diagram);
 }