public EffectsOption(Pair_String_Float generatorValueIN, UpdateAction argUpdateAction, Tooltips tooltipsIN, Component cp, float baseIN) { mBaseValue = baseIN; mUpdateAction = argUpdateAction; mGeneratorValue = generatorValueIN; tooltipsIN.AddUIElement(ref mSlider, cp, mGeneratorValue.First); mResetButton = cp.GetComponentInChildren <Button>(); mResetButton.onClick.AddListener(ResetSlider); Component[] components = cp.gameObject.GetComponentsInChildren(typeof(Transform), true); foreach (Component cp2 in components) { if (cp2.name == generatorValueIN.First + "Output") { mOutput = cp2.GetComponentInChildren <Text>(); } } Init(); }
private void FinishInitialization() { Component[] components = this.GetComponentsInChildren(typeof(Transform), true); foreach (Component cp in components) { if (cp.name == "Mode") { mTooltips.AddUIElement(ref mMode, cp, "Mode"); } if (cp.name == "Scale") { mTooltips.AddUIElement(ref mScale, cp, "Scale"); } if (cp.name == "Tempo") { mTooltips.AddUIElement(ref mTempo, cp, "Tempo"); } if (cp.name == "TempoOutput") { mTempoText = cp.GetComponentInChildren <Text>(); } if (cp.name == "Key") { mTooltips.AddUIElement(ref mKey, cp, "Key"); } if (cp.name == "MasterVol") { mTooltips.AddUIElement(ref mVol, cp, "MasterVol"); } if (cp.name == "ProgressionRate") { mTooltips.AddUIElement(ref mProgressionRateDropdown, cp, "ProgressionRate"); } if (cp.name == "RepeatLength") { mTooltips.AddUIElement(ref mRepeatLength, cp, "RepeatLength"); } if (cp.name == "NewThemeOdds") { mTooltips.AddUIElement(ref mNewThemeOdds, cp, "NewThemeOdds"); } if (cp.name == "RepeatThemeOdds") { mTooltips.AddUIElement(ref mRepeatThemeOdds, cp, "ThemeRepeat"); } if (cp.name == "KeyChange") { mTooltips.AddUIElement(ref mKeyChangeOdds, cp, "KeyChangeOdds"); } if (cp.name == "ProgressionChange") { mTooltips.AddUIElement(ref mProgressionChangeOdds, cp, "ProgressionChangeOdds"); } if (cp.name == "VolumeOutput") { mVolText = cp.GetComponentInChildren <Text>(); } if (cp.name == "RepeatAndThemeOptions") { mTooltips.AddUIElement(ref mRepeatThemeOptions, cp, "ThemeRepeat"); } if (cp.name == "GroupOdds1") { mTooltips.AddUIElement(ref mGroupOdds1, cp, "GroupOdds"); } if (cp.name == "GroupOdds2") { mTooltips.AddUIElement(ref mGroupOdds2, cp, "GroupOdds"); } if (cp.name == "GroupOdds3") { mTooltips.AddUIElement(ref mGroupOdds3, cp, "GroupOdds"); } if (cp.name == "GroupOdds4") { mTooltips.AddUIElement(ref mGroupOdds4, cp, "GroupOdds"); } if (cp.name == "Group1OddsOutput") { mGroupOdds1Text = cp.GetComponentInChildren <Text>(); } if (cp.name == "Group2OddsOutput") { mGroupOdds2Text = cp.GetComponentInChildren <Text>(); } if (cp.name == "Group3OddsOutput") { mGroupOdds3Text = cp.GetComponentInChildren <Text>(); } if (cp.name == "Group4OddsOutput") { mGroupOdds4Text = cp.GetComponentInChildren <Text>(); } if (cp.name == "NewThemeOutput") { mNewThemeOutput = cp.GetComponentInChildren <Text>(); } if (cp.name == "RepeatThemeOutput") { mRepeatThemeOutput = cp.GetComponentInChildren <Text>(); } if (cp.name == "KeyChangeOutput") { mKeyChangeOddsOutput = cp.GetComponentInChildren <Text>(); } if (cp.name == "ProgressionChangeOutput") { mProgressionChangeOutput = cp.GetComponentInChildren <Text>(); } } NonAsyncLoadUI(); GetComponentInParent <CanvasGroup>().interactable = false; GetComponentInParent <CanvasGroup>().blocksRaycasts = false; }
public void Init() { mMusicGenerator = MusicGenerator.Instance; mTooltips = UIManager.Instance.mTooltips; mInstrumentListUI = UIManager.Instance.mInstrumentListPanelUI; mStaffPlayerUI = UIManager.Instance.mStaffPlayer; mMeasureEditor = UIManager.Instance.mMeasureEditor; Component[] components = this.GetComponentsInChildren(typeof(Transform), true); foreach (Component cp in components) { if (cp.name == "Arpeggio") { mTooltips.AddUIElement(ref mArpeggio, cp, "Arpeggio"); } if (cp.name == "Pentatonic") { mTooltips.AddUIElement(ref mPentatonic, cp, "PentatonicLead"); } if (cp.name == "LeadAvoidNotes") { foreach (Toggle toggle in cp.GetComponentsInChildren <Toggle>()) { int x = 0; Int32.TryParse(toggle.name, out x); mTooltips.AddUIElement(ref mLeadAvoidSteps[x], toggle, "LeadAvoids"); } } if (cp.name == "LeadVariation") { mTooltips.AddUIElement <Slider>(ref mLeadVariation, cp, "LeadVariation"); } if (cp.name == "LeadMaxSteps") { mTooltips.AddUIElement(ref mLeadMaxSteps, cp, "LeadMaxSteps"); } if (cp.name == "InstrumentPanel") { mMasterObject = cp.gameObject; } if (cp.name == "PatternRelease") { mTooltips.AddUIElement <Slider>(ref mPatternReleaseSlider, cp, "PatternRelease"); } if (cp.name == "PatternLength") { mTooltips.AddUIElement <Slider>(ref mPatternLengthSlider, cp, "PatternLength"); } if (cp.name == "StrumLength") { mTooltips.AddUIElement <Slider>(ref mStrumLength, cp, "StrumLength"); } if (cp.name == "StrumVariation") { mTooltips.AddUIElement <Slider>(ref mStrumVariation, cp, "StrumVariation"); } if (cp.name == "UseSevenths") { mTooltips.AddUIElement <Toggle>(ref mUseSevenths, cp, "UseSevenths"); } if (cp.name == "OddsOfPlaying") { mTooltips.AddUIElement <Slider>(ref mOddsOfPlayingSlider, cp, "OddsOfPlaying"); } if (cp.name == "MultiplierOdds") { mTooltips.AddUIElement <Slider>(ref mMultiplierSlider, cp, "MultiplierOdds"); } if (cp.name == "VolumeSlider") { mTooltips.AddUIElement <Slider>(ref mVolumeSlider, cp, "Volume"); } if (cp.name == "Mute") { mTooltips.AddUIElement <Toggle>(ref mMuteToggle, cp, "Mute"); } if (cp.name == "Echo") { mTooltips.AddUIElement <Slider>(ref mEchoSlider, cp, "Echo"); } if (cp.name == "EchoDecay") { mTooltips.AddUIElement <Slider>(ref mEchoDecaySlider, cp, "EchoDecay"); } if (cp.name == "EchoDelay") { mTooltips.AddUIElement <Slider>(ref mEchoDelaySlider, cp, "EchoDelay"); } if (cp.name == "Reverb") { mTooltips.AddUIElement <Slider>(ref mReverbSlider, cp, "Reverb"); } if (cp.name == "RoomSize") { mTooltips.AddUIElement <Slider>(ref mRoomSizeSlider, cp, "RoomSize"); } if (cp.name == "Timestep") { mTooltips.AddUIElement <Dropdown>(ref mTimestep, cp, "Timestep"); } if (cp.name == "Flanger") { mTooltips.AddUIElement <Slider>(ref mFlangerSlider, cp, "Flanger"); } if (cp.name == "Distortion") { mTooltips.AddUIElement <Slider>(ref mDistortionSlider, cp, "Distortion"); } if (cp.name == "Chorus") { mTooltips.AddUIElement <Slider>(ref mChorusSlider, cp, "Chorus"); } if (cp.name == "Succession") { mTooltips.AddUIElement <Dropdown>(ref mSuccession, cp, "Succession"); } if (cp.name == "OddsOfPlayingChordNote") { mTooltips.AddUIElement <Slider>(ref mOddsOfPlayingChordNoteSlider, cp, "ChordNote"); } if (cp.name == "Octave1") { mTooltips.AddUIElement <Toggle>(ref mOctave1, cp, "OctavesToUse"); } if (cp.name == "Octave2") { mTooltips.AddUIElement <Toggle>(ref mOctave2, cp, "OctavesToUse"); } if (cp.name == "Octave3") { mTooltips.AddUIElement <Toggle>(ref mOctave3, cp, "OctavesToUse"); } if (cp.name == "Group") { mTooltips.AddUIElement <Dropdown>(ref mGroup, cp, "Group"); } if (cp.name == "Color") { mTooltips.AddUIElement <Dropdown>(ref mColor, cp, "Color"); } if (cp.name == "StereoPan") { mTooltips.AddUIElement <Slider>(ref mStereoPan, cp, "StereoPan"); } if (cp.name == "UsePattern") { mTooltips.AddUIElement <Dropdown>(ref mUsePattern, cp, "Pattern"); } if (cp.name == "FreeMelody") { mTooltips.AddUIElement <Toggle>(ref mFreeMelody, cp, "Lead"); } if (cp.name == "AudioGroupVolume") { mTooltips.AddUIElement <Slider>(ref mAudioGroupVolume, cp, "AudioGroupVolume"); } //output: if (cp.name == "PatternLengthOutput") { mPatternLengthOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "PatternReleaseOutput") { mPatternReleaseOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "StrumLengthOutput") { mStrumLengthOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "StrumVariationOutput") { mStrumVariationOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "LeadVariationOutput") { mLeadVariationOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "LeadMaxStepsOutput") { mLeadMaxStepsOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "OddsOfPlayingOutput") { mOddsOfPlayingValueText = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "MultiplierOutput") { mMultiplierText = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "VolumeOutput") { mVolumeText = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "RoomSizeOutput") { mRoomSizeOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "ReverbOutput") { mReverbOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "EchoOutput") { mEchoOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "EchoDelayOutput") { mEchoDelayOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "EchoDecayOutput") { mEchoDecayOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "FlangerOutput") { mFlangerOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "DistortionOutput") { mDistortionOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "ChorusOutput") { mChorusOutput = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "OddsOfPlayingChordNoteOutput") { mOddsOfPlayingChordNoteText = cp.gameObject.GetComponentInChildren <Text>(); } if (cp.name == "AudioGroupVolumeOutput") { mAudioGroupVolumeOutput = cp.gameObject.GetComponentInChildren <Text>(); } } mMasterObject.SetActive(false); mColor.options.Clear(); for (int i = 0; i < mStaffPlayerUI.mColors.Count; i++) { Texture2D texture = new Texture2D(1, 1); texture.SetPixel(0, 0, mStaffPlayerUI.mColors[i]); texture.Apply(); Dropdown.OptionData data = new Dropdown.OptionData(Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0, 0))); mColor.options.Add(data); } }
public List <Toggle> mExcludedSteps = new List <Toggle>(); //< list of which steps are excluded from chord progressions public void Init() { GetComponentInParent <CanvasGroup>().interactable = false; GetComponentInParent <CanvasGroup>().blocksRaycasts = false; mUIManager = UIManager.Instance; mAnimator = GetComponentInParent <Animator>(); Component[] components = this.GetComponentsInChildren(typeof(Transform), true); mMusicGenerator = MusicGenerator.Instance; Tooltips tooltips = mUIManager.mTooltips; ChordProgressions progressions = mMusicGenerator.mChordProgressions; mTonicInfluence.value = progressions.mData.TonicInfluence; mSubdominantInfluence.value = progressions.mData.SubdominantInfluence; mDominantInfluence.value = progressions.mData.DominantInfluence; mTritoneSubInfluence.value = progressions.mData.TritoneSubInfluence; mGroupRate.value = (int)mMusicGenerator.mGeneratorData.mGroupRate; //sets up our UI elements: foreach (Component cp in components) { if (cp.name == "AsyncLoading") { tooltips.AddUIElement(ref mAsyncLoading, cp, "AsyncLoading"); } if (cp.name == "GroupRate") { tooltips.AddUIElement(ref mGroupRate, cp, "GroupRate"); } if (cp.name == "DynamicStyle") { tooltips.AddUIElement(ref mDynamicStyle, cp, "DynamicStyle"); } if (cp.name == "DominantInfluence") { tooltips.AddUIElement(ref mDominantInfluence, cp, "DominantInfluence"); } if (cp.name == "TonicInfluence") { tooltips.AddUIElement(ref mTonicInfluence, cp, "TonicInfluence"); } if (cp.name == "SubdominantInflunce") { tooltips.AddUIElement(ref mSubdominantInfluence, cp, "SubdominantInfluence"); } if (cp.name == "TritoneSubInf") { tooltips.AddUIElement(ref mTritoneSubInfluence, cp, "TritoneSubstitution"); } if (cp.name == "AscendDescendKey") { tooltips.AddUIElement(ref mAscendDescendKey, cp, "KeyAscendDescend"); } if (cp.name == "VolumeFadeRate") { tooltips.AddUIElement(ref mVolumeFadeRate, cp, "VolumeFadeRate"); } if (cp.name == "DominantInfluenceOutput") { mDominantInfluenceOutput = cp.GetComponentInChildren <Text>(); } if (cp.name == "TonicInfluenceOutput") { mTonicInfluenceOutput = cp.GetComponentInChildren <Text>(); } if (cp.name == "SubdominantInfluenceOutput") { mSubdominantInfluenceOutput = cp.GetComponentInChildren <Text>(); } if (cp.name == "TritoneSubInfOutput") { mTritoneSubInfluenceOutput = cp.GetComponentInChildren <Text>(); } if (cp.name == "AscendDescendKeyOutput") { mAscendDescendKeyOutput = cp.GetComponentInChildren <Text>(); } if (cp.name == "VolumeFadeRateOutput") { mVolumeFadeRateOutput = cp.GetComponentInChildren <Text>(); } } //these ui objects have a bunch of parts. Handled differently: for (int i = 0; i < mExcludedSteps.Count; i++) { Component[] components2 = this.GetComponentsInChildren(typeof(Transform), true); foreach (Component cp2 in components2) { if (cp2.name.Contains("Exclude")) { tooltips.AddTooltip("TonicSubdominantDominantExcludes", cp2.GetComponent <RectTransform>()); } } } }
public void Init(MusicGenerator managerIN) { GetComponentInParent <CanvasGroup>().interactable = false; GetComponentInParent <CanvasGroup>().blocksRaycasts = false; mStaffPlayer = StaffPlayerUI.Instance; mInstrumentPanel = InstrumentPanelUI.Instance; mGeneratorPanel = MusicGeneratorUIPanel.Instance; mAnimator = GetComponentInParent <Animator>(); mMusicGenerator = managerIN; Tooltips tooltips = UIManager.Instance.mTooltips; Component[] components = this.GetComponentsInChildren(typeof(Transform), true); foreach (Component cp in components) { if (cp.name == "CurrentEditorMeasure") { tooltips.AddUIElement <Dropdown>(ref mCurrentMeasure, cp, "CurrentEditorMeasure"); } if (cp.name == "PlayClipDropdown") { tooltips.AddUIElement <Dropdown>(ref mPlayClipDropdown, cp, "PlayClipDropdown"); } if (cp.name == "ShowEditorHints") { tooltips.AddUIElement <Toggle>(ref mShowEditorHints, cp, "ShowEditorHints"); } if (cp.name == "ShowAllInstruments") { tooltips.AddUIElement <Toggle>(ref mShowAllInstruments, cp, "ShowAllInstruments"); } if (cp.name == "NumberOfMeasures") { tooltips.AddUIElement <Dropdown>(ref mNumberOfMeasures, cp, "NumberOfMeasures"); } if (cp.name == "ProgressionRate") { tooltips.AddUIElement <Dropdown>(ref mProgressionRate, cp, "ProgressionRate"); } if (cp.name == "Mode") { tooltips.AddUIElement <Dropdown>(ref mMode, cp, "Mode"); } if (cp.name == "Scale") { tooltips.AddUIElement <Dropdown>(ref mScale, cp, "Scale"); } if (cp.name == "Key") { tooltips.AddUIElement <Dropdown>(ref mKey, cp, "Key"); } if (cp.name == "Tempo") { tooltips.AddUIElement <Slider>(ref mTempo, cp, "Tempo"); } if (cp.name == "ClipRepeat") { tooltips.AddUIElement <Toggle>(ref mClipIsRepeating, cp, "ClipRepeat"); } } }