Exemple #1
0
    private SongCreationManager.SC_InputFieldAndSlider mGlobalPitchVelocityHandler = null; //!< The handler for setting the @link DefVel Note Velocity@endlink for all of the @link Music::PITCH pitches@endlink in the @link Music::CombinedNote note@endlink being represented.

    private void Awake()
    {
        // Initialize the lists.
        mPitches = new List <SC_PitchDrumDisplayPanel>();
        mDrums   = new List <SC_PitchDrumDisplayPanel>();

        // Get the display panels.
        mMelodyDisplay     = transform.GetChild(1).GetChild(0).GetChild(0);
        mPercussionDisplay = transform.GetChild(3).GetChild(0).GetChild(0);

        // Set up the global pitch velocity.
        mGlobalPitchVelocityHandler = transform.GetChild(6).gameObject.AddComponent <SongCreationManager.SC_InputFieldAndSlider>();
        mGlobalPitchVelocityHandler.SetReferenceToInputField(transform.GetChild(5).GetComponent <InputField>());
        mGlobalPitchVelocityHandler.SetAsInt(true);
        mGlobalPitchVelocityHandler.SetValue(70f);
        mGlobalPitchVelocityHandler.ValueChanged.AddListener(OnGlobalPitchVelocityChanged);

        // Set up the global drum velocity.
        mGlobalDrumVelocityHandler = transform.GetChild(9).gameObject.AddComponent <SongCreationManager.SC_InputFieldAndSlider>();
        mGlobalDrumVelocityHandler.SetReferenceToInputField(transform.GetChild(8).GetComponent <InputField>());
        mGlobalDrumVelocityHandler.SetAsInt(true);
        mGlobalDrumVelocityHandler.SetValue(70f);
        mGlobalDrumVelocityHandler.ValueChanged.AddListener(OnGlobalDrumVelocityChanged);

        // Set up the offset panel
        mOffsetPanel = transform.GetChild(11).gameObject.AddComponent <SC_LengthOffsetSelectionPanel>();
        mOffsetPanel.SetSelected(new Music.NoteLength(Music.NOTE_LENGTH_BASE.NONE));

        // Get the done button and add its listener.
        mDoneButton = transform.GetChild(12).GetChild(0).GetComponent <Button>();
        mDoneButton.onClick.AddListener(OnDoneButtonClicked);
        mDoneButton.gameObject.SetActive(false);

        // Get the Add Pitch Button and set its listener
        mAddPitchButton = transform.GetChild(12).GetChild(1).GetComponent <Button>();
        mAddPitchButton.onClick.AddListener(OnAddPitchButtonClicked);

        // Get the Add Drum Button and set its listener.
        mAddDrumButton = transform.GetChild(12).GetChild(2).GetComponent <Button>();
        mAddDrumButton.onClick.AddListener(OnAddDrumButtonClicked);

        // Get the cancel button and set its listener.
        mCancelButton = transform.GetChild(12).GetChild(3).GetComponent <Button>();
        mCancelButton.onClick.AddListener(OnCancelButtonClicked);

        NoteDialogFinished = new NoteDialogFinishedEvent();
    }
    private Text mSelectedDrumDisplay = null;                                   //!< The text that displays the selected @link Music::DRUM drums@endlink.

    /*************************************************************************//**
    * @}
    * @defgroup SC_ADDUnity Unity Functions
    * @ingroup DocSC_ADD
    * These are functions automatically called by Unity.
    * @{
    *****************************************************************************/

    /**
     * @brief Initializes the dialog.
     */
    private void Awake()
    {
        // Get the display for showing selected drums.
        mSelectedDrumDisplay      = transform.GetChild(0).GetChild(0).GetComponent <Text>();
        mSelectedDrumDisplay.text = "Added Drums: ";

        // Get the display for showing the toggle switches
        mDrumToggleDisplay = transform.GetChild(1).GetChild(0).GetChild(0).gameObject;

        // Get the velocity handler.
        mVelocityHandler = transform.GetChild(4).gameObject.AddComponent <SongCreationManager.SC_InputFieldAndSlider>();
        mVelocityHandler.SetReferenceToInputField(transform.GetChild(3).gameObject.GetComponent <InputField>());
        mVelocityHandler.SetAsInt(true);
        mVelocityHandler.SetValue(70);

        // Get the buttons.
        mCancelButton = transform.GetChild(5).GetChild(1).GetComponent <Button>();
        mCancelButton.onClick.AddListener(OnCancelButtonClicked);
        mDoneButton = transform.GetChild(5).GetChild(0).GetComponent <Button>();
        mDoneButton.onClick.AddListener(OnDoneButtonClicked);
        mDoneButton.gameObject.SetActive(false);

        // Set up the toggle switches.
        mDrumToggles = new List <Toggle>();
        for (int i = 0; i < Music.MAX_SUPPORTED_DRUMS; i++)
        {
            // Create the toggle switch.
            GameObject newToggleObj = Instantiate(Resources.Load <GameObject>(TOGGLE_PREFAB_PATH));
            Toggle     tog          = newToggleObj.GetComponent <Toggle>();
            tog.isOn = false;
            tog.transform.SetParent(mDrumToggleDisplay.transform, false);
            tog.onValueChanged.AddListener(OnDrumSelected);
            tog.transform.GetChild(1).GetComponent <Text>().text = Music.DrumToString(i);

            // Add the toggle switch to the list.
            mDrumToggles.Add(tog);
        }

        // Set up the selected drums.
        mSelectedDrums = new List <Music.DRUM>();

        // Set up the event.
        AddDrumDialogFinished = new AddDrumDialogFinishedEvent();
    }
    private Text mPitchDisplay = null;                                       //!< The text displaying the represented @link Music::PITCH pitch@endlink/@link Music::DRUM drum@endlink.

    /*************************************************************************//**
    * @}
    * @defgroup SC_PDDPUnityFunctions Unity Functions
    * @ingroup DocSC_PDDP
    * These are functions that are automatically called by Unity.
    * @{
    *****************************************************************************/

    /**
     * @brief Gets references to the objects in the panel.
     */
    private void Awake()
    {
        // Get the label for the represented pitch/drum.
        mPitchDisplay = transform.GetChild(0).GetComponent <Text>();

        // Get the length/modifier panel and its children.
        mLengthAndModifiersPanel = transform.GetChild(1).gameObject;
        mLengthPanel             = mLengthAndModifiersPanel.transform.GetChild(0).gameObject;
        mDotModifierPanel        = mLengthAndModifiersPanel.transform.GetChild(1).gameObject;
        mTripletModifierPanel    = mLengthAndModifiersPanel.transform.GetChild(2).gameObject;

        // Get the Note Velocity Slider
        mNoteVelocityHandler = transform.GetChild(3).gameObject.AddComponent <SongCreationManager.SC_InputFieldAndSlider>();
        mNoteVelocityHandler.SetReferenceToInputField(transform.GetChild(2).GetComponent <InputField>());
        mNoteVelocityHandler.SetAsInt(true);
        mNoteVelocityHandler.ValueChanged.AddListener(OnNoteVelocityChanged);

        // Get the Remove Button.
        mRemoveButton = transform.GetChild(4).GetComponent <Button>();
        mRemoveButton.onClick.AddListener(OnRemoveButtonClicked);
    }