public void Init(MusicGenerator managerIN) { mMusicGenerator = managerIN; UIManager uimanager = UIManager.Instance; mGeneratorUIPanel = uimanager.mGeneratorUIPanel; mMeasureEditor = uimanager.mMeasureEditor; mInstrumentPanel = uimanager.mInstrumentPanelUI; mMaxPlayedNotes = MusicGenerator.mMaxInstruments * 4 * 16; //number of instruments, times size of chord * number of steps per measure for (int i = 0; i < mMaxPlayedNotes; i++) //In theory, the max number of notes that might play, given maxInstruments. { mPlayedNotes.Add((Instantiate(mBaseNoteImage, mStaffPlayerTransform) as GameObject).GetComponent <StaffPlayerNote>()); mPlayedNotes[i].transform.position = new Vector3(-10000, -10000, 0); mPlayedNotes[i].gameObject.SetActive(false); mShadowNotes.Add((Instantiate(mBaseShadowImage, mStaffPlayerTransform) as GameObject).GetComponent <StaffPlayerNote>()); mShadowNotes[i].transform.position = new Vector3(-10000, -10000, 0); mShadowNotes[i].gameObject.SetActive(false); mEditorNotes.Add((Instantiate(mBaseEditorNote, mStaffPlayerTransform) as GameObject).GetComponent <StaffPlayerNote>()); mEditorNotes[i].transform.position = new Vector3(-10000, -10000, 0); mEditorNotes[i].gameObject.SetActive(false); mPlacedEditorNotes.Add((Instantiate(mBasePlayedEditorNote, mStaffPlayerTransform) as GameObject).GetComponent <EditorNote>()); mPlacedEditorNotes[i].transform.position = new Vector3(-10000, -10000, 0); mPlacedEditorNotes[i].gameObject.SetActive(false); } mTimeSignatureDropdown.value = (int)mMusicGenerator.mInstrumentSet.mTimeSignature.Signature; //ChangeTimeSignature(eTimeSignature.ThreeFour); }
public void Init() { mMusicGenerator.SetState(eGeneratorState.initializing); mMusicGenerator.mMusicFileConfig.LoadConfig(mMusicGenerator.mDefaultConfig, eGeneratorState.ready); mTooltips = Tooltips.Instance; mTooltips.Init(); mStaffPlayer = StaffPlayerUI.Instance; mInstrumentListPanelUI = InstrumentListPanelUI.Instance; mMeasureEditor = MeasureEditor.Instance; mMeasureEditor.Init(mMusicGenerator); mInstrumentPanelUI = InstrumentPanelUI.Instance; mInstrumentPanelUI.Init(); mAdvancedSettingsPanel = AdvancedSettingsPanel.Instance; mAdvancedSettingsPanel.Init(); mGlobalEffectsPanel = GlobalEffectsPanel.Instance; mGlobalEffectsPanel.Init(mMusicGenerator); mGeneratorUIPanel = MusicGeneratorUIPanel.Instance; mGeneratorUIPanel.Init(mMusicGenerator); mStaffPlayer.Init(mMusicGenerator); mStaffPlayer.ChangeTimeSignature(-1); //mInstrumentListPanelUI.Init(mMusicGenerator); }
public IEnumerator Init() { mMusicGenerator.SetState(eGeneratorState.initializing); yield return(StartCoroutine(mMusicGenerator.mMusicFileConfig.LoadConfig(mMusicGenerator.mDefaultConfig, eGeneratorState.initializing))); mTooltips = Tooltips.Instance; yield return(StartCoroutine(mTooltips.Init())); mStaffPlayer = StaffPlayerUI.Instance; mInstrumentListPanelUI = InstrumentListPanelUI.Instance; mMeasureEditor = MeasureEditor.Instance; mMeasureEditor.Init(mMusicGenerator); mInstrumentPanelUI = InstrumentPanelUI.Instance; mInstrumentPanelUI.Init(); mAdvancedSettingsPanel = AdvancedSettingsPanel.Instance; mAdvancedSettingsPanel.Init(); mGlobalEffectsPanel = GlobalEffectsPanel.Instance; mGlobalEffectsPanel.Init(mMusicGenerator); mGeneratorUIPanel = MusicGeneratorUIPanel.Instance; bool finished = false; yield return(StartCoroutine(mGeneratorUIPanel.Init(mMusicGenerator, (x) => { finished = x; }))); yield return(new WaitUntil(() => finished)); mStaffPlayer.Init(mMusicGenerator); mStaffPlayer.ChangeTimeSignature(-1); mMusicGenerator.SetState(eGeneratorState.ready); //mInstrumentListPanelUI.Init(mMusicGenerator); yield return(null); }
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"); } } }