Exemplo n.º 1
0
    private void OnExitBtnClicked()
    {
        note       = null;
        longNote   = null;
        circleNote = null;

        this.gameObject.SetActive(false);
    }
Exemplo n.º 2
0
    public void Init(RecorderCircleNote input)
    {
        circleNote = input;

        isLongNoteToggle.gameObject.SetActive(false);

        isLongNoteToggle.isOn = false;

        beatTxt2.gameObject.SetActive(false);

        inputField2.gameObject.SetActive(false);

        beatTxt1.text = "Beat : ";

        inputField1.text = input.beat.ToString();
    }
Exemplo n.º 3
0
    private void SpawnNotes()
    {
        notesPool = new GameObject(this.gameObject.name + " NotesPool");

        // Next index for the array "singleNote".
        int indexOfNextNote = 0;

        // Check if there are still notes in the track, and check if the next note is within the bounds we intend to show on screen.
        while (indexOfNextNote < singleNote.Count)
        {
            // Instantiate a new music note. (Search "Object Pooling" for more information if you wish to minimize the delay when instantiating game objects.)
            // We don't care about the position and rotation because we will set them later in MusicNote.Initialize(...).
            RecorderCircleNote musicNote = ((GameObject)Instantiate(RecordConductor.instance.musicCircleNotePrefab, startPos.transform.position, startPos.transform.rotation)).GetComponent <RecorderCircleNote>();

            musicNote.Initialize(RecordConductor.instance, this, startPos, endPos, singleNote[indexOfNextNote]);

            musicNote.transform.SetParent(notesPool.transform);

            // Update the next index.
            indexOfNextNote++;
        }
    }
Exemplo n.º 4
0
    private void OnConfirmBtnClicked()
    {
        if (isLongNoteToggle.isOn)
        {
            float startBeatToSave = float.Parse(inputField1.text);

            float endBeatToSave = float.Parse(inputField2.text);

            if (!CanAddBeat(startBeatToSave) || !CanAddBeat(endBeatToSave))
            {
                return;
            }


            if (note != null)
            {
                note.recorder.DeleteNote(note.beat);

                note.recorder.longNoteStart.Add(startBeatToSave);

                note.recorder.longNoteEnd.Add(endBeatToSave);

                note.recorder.UpdateNote();
            }
            else if (longNote != null)
            {
                longNote.recorder.DeleteLongNote(longNote.startNote.GetComponent <RecorderNote>().beat, longNote.endNote.GetComponent <RecorderNote>().beat);

                longNote.recorder.longNoteStart.Add(startBeatToSave);

                longNote.recorder.longNoteEnd.Add(endBeatToSave);

                longNote.recorder.UpdateNote();
            }
        }
        else
        {
            float beatToSave = float.Parse(inputField1.text);

            if (!CanAddBeat(beatToSave))
            {
                return;
            }

            if (note != null)
            {
                note.recorder.DeleteNote(note.beat);

                note.recorder.singleNote.Add(beatToSave);

                note.recorder.UpdateNote();
            }
            else if (longNote != null)
            {
                longNote.recorder.DeleteLongNote(longNote.startNote.GetComponent <RecorderNote>().beat, longNote.endNote.GetComponent <RecorderNote>().beat);

                longNote.recorder.singleNote.Add(beatToSave);

                longNote.recorder.UpdateNote();
            }
            else if (circleNote != null)
            {
                circleNote.recorder.DeleteNote(circleNote.beat);

                circleNote.recorder.singleNote.Add(beatToSave);

                circleNote.recorder.UpdateNote();
            }
        }



        note       = null;
        longNote   = null;
        circleNote = null;

        this.gameObject.SetActive(false);
    }