/** * @brief Sets up the SC_PitchDrumDisplayPanel as a display panel for a @link Music::DRUM drum@endlink. * @param[in] aDrum The @link Music::DRUM drum@endlink that is being represented. * @param[in] aNoteVelocity @copydoc SC_PitchDrumDisplayPanel::mNoteVelocity */ public void InitializeAsDrumDisplay(Music.DRUM aDrum, int aNoteVelocity) { // Set that the panel is representing drums. mIsDrum = true; // Set the drum mDrum = aDrum; // Set the pitch display text. mPitchDisplay.text = "Drum:\n" + Music.DrumToString(aDrum); // Hide the length/modifiers panel. mLengthAndModifiersPanel.SetActive(false); // Set the velocity value. mNoteVelocity = aNoteVelocity; mNoteVelocityHandler.SetValue(aNoteVelocity); }
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 mSelectedPitchDisplay = null; //!< The text that displays the selected @link Music::PITCH pitches@endlink. /*************************************************************************//** * @} * @defgroup SC_APDUnity Unity Functions * @ingroup DocSC_APD * These are functions automatically called by Unity. * @{ *****************************************************************************/ /** * @brief Initializes the dialog. */ private void Awake() { // Get the display for showing selected pitches. mSelectedPitchDisplay = transform.GetChild(0).GetChild(0).GetComponent <Text>(); mSelectedPitchDisplay.text = "Added Pitches: "; // Get the display for showing the toggle switches mPitchToggleDisplay = 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.SetValue(70); // Get the length selector. mLengthSelector = transform.GetChild(6).gameObject.AddComponent <SC_LengthOffsetSelectionPanel>(); mLengthSelector.SetSelected(new Music.NoteLength(Music.NOTE_LENGTH_BASE.Q)); // Get the buttons. mCancelButton = transform.GetChild(7).GetChild(1).GetComponent <Button>(); mCancelButton.onClick.AddListener(OnCancelButtonClicked); mDoneButton = transform.GetChild(7).GetChild(0).GetComponent <Button>(); mDoneButton.onClick.AddListener(OnDoneButtonClicked); mDoneButton.gameObject.SetActive(false); // Set up the toggle switches. mPitchToggles = new List <Toggle>(); for (int i = 0; i < Music.MAX_SUPPORTED_NOTES + 1; 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(mPitchToggleDisplay.transform, false); tog.onValueChanged.AddListener(OnPitchSelected); tog.transform.GetChild(1).GetComponent <Text>().text = Music.NoteToString(i); // Add the toggle switch to the list. mPitchToggles.Add(tog); } // Set up the selected pitches. mSelectedPitches = new List <Music.PITCH>(); // Set up the event. AddPitchDialogFinished = new AddPitchDialogFinishedEvent(); }
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(); }