private void PlayRandomomponent(ComponentInstance zComponentInstance) { if (_playMode == RandomComponentPlayMode.Random) { int num = _shuffleBag.get(); _selectedAudioClip = _audioClips[num]; } else { int num2 = -1; if (!_shareRandomNoRepeatHistory) { num2 = GetNextRandomNoRepeatIndex(); } else { RandomAudioClipComponent randomAudioClipComponent = base.ComponentHolder as RandomAudioClipComponent; if ((bool)randomAudioClipComponent) { num2 = randomAudioClipComponent.GetNextRandomNoRepeatIndex(); } } if (num2 < 0) { return; } _selectedAudioClip = _audioClips[num2]; } if (_selectedAudioClip != null) { base.AudioClip = _selectedAudioClip; base.PlayInternal(zComponentInstance, 0f, 0.5f, dontPlayComponents: false); } }
public override void PlayInternal(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents) { if (!CheckMIDI(zComponentInstance)) { return; } base.PlayInternal(zComponentInstance, target, curve, dontPlayComponents: true); if (_switchComponentSwitchType == SwitchComponentSwitchType.OnPlay && _defferedSelectedComponent != null) { _selectedComponent = _defferedSelectedComponent; _defferedSelectedComponent = null; } if (_useGlobalSwitch && _globalSwitch != null) { GlobalSwitch globalSwitch = EventManager.Instance._globalParameterManager._globalSwitches.FindItem(_globalSwitch); if (globalSwitch != null) { GlobalSwitchContainer globalSwitchContainer = GetGlobalSwitchContainer(globalSwitch.GetActiveSwitch()); if (globalSwitchContainer != null) { _selectedComponent = globalSwitchContainer._components[0]; } } } if (_selectedComponent != null) { if (_activeMusicTimeSettings != null && IsMusicSyncEnabled() && _syncToMusicOnFirstPlay && !_musicTimeResetOnPlay) { _componentInstance._instance.SetPlayScheduledAdditive(_activeMusicTimeSettings.GetDelay(this), 0.0); } _selectedComponent.PlayInternal(zComponentInstance, 0f, 0.5f); } }
private void PlayRandomomponent(ComponentInstance zComponentInstance) { if (_playMode == RandomComponentPlayMode.Random) { int index = _shuffleBag.get(); _selectedComponent = _components[index]; } else { int num = -1; if (!_shareRandomNoRepeatHistory) { num = GetNextRandomNoRepeatIndex(); } else { RandomComponent randomComponent = base.ComponentHolder as RandomComponent; if ((bool)randomComponent) { num = randomComponent.GetNextRandomNoRepeatIndex(); } } if (num < 0) { return; } _selectedComponent = _components[num]; } if (_selectedComponent != null) { _selectedComponent.PlayInternal(zComponentInstance, 0f, 0.5f); } }
public override void PlayInternal(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents) { if (CheckMIDI(zComponentInstance)) { if (!IsPlaying() && _resetOnFirstPlay) { _playingComponentIndex = 0; _prevPlayingComponentIndex = 0; } if (!_syncAdvanceBetweenInstances && _sequenceAdvanceMode != 0) { _playingComponentIndex = 0; } _onlyStopOnce = true; _advanceEventTriggered = false; _stopInProgress = false; base.PlayInternal(zComponentInstance, _fadeInTime, _fadeInCurve, dontPlayComponents: true); double playScheduledDelay = (double)_transitionOffset + base._random.NextDouble() * (double)_transitionOffsetRandomization; double playScheduled = 0.0; if (_activeMusicTimeSettings != null && IsMusicSyncEnabled() && _syncToMusicOnFirstPlay && !_musicTimeResetOnPlay) { playScheduled = _activeMusicTimeSettings.GetDelay(this); } _componentInstance._instance.SetPlayScheduledAdditive(playScheduled, playScheduledDelay); PlayNextEntry(); } }
public override void PlayInternal(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents = false) { if (CheckMIDI(zComponentInstance)) { finishedPlayingOncePerFrame = false; base.PlayInternal(zComponentInstance, target, curve, dontPlayComponents); } }
public override void PlayInternal(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents) { if (sampleFileInstance != null) { sampleFileInstance._position = 0; base.PlayInternal(zComponentInstance, target, curve, dontPlayComponents); } }
public override void PlayInternal(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents) { if (CheckMIDI(zComponentInstance)) { base.PlayInternal(zComponentInstance, _fadeInTime, _fadeInCurve, dontPlayComponents: true); _waitToStop = false; PlayStage(Stage.Intro); PlayStage(Stage.Loop); } }
public override void PlayInternal(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents) { if (CheckMIDI(zComponentInstance)) { if (_delayOnFirstPlay) { float num = _loopDelay + UnityEngine.Random.Range(_delayRandomization, _delayMaxRandomization); zComponentInstance._instance.SetPlayScheduledAdditive(num, 0.0); } PlayRandomomponent(zComponentInstance); } }
public override void PlayInternal(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents) { if (CheckMIDI(zComponentInstance)) { if (_dialogAudioLoadedFrom == DialogAudioLoadedFrom.CustomAudioClipLoader && FabricManager.Instance._customAudioClipLoader != null) { StartCoroutine(LoadPlayCoroutine(zComponentInstance, target, curve, dontPlayComponents)); return; } Load(); base.PlayInternal(zComponentInstance, target, curve, dontPlayComponents); } }
public override void PlayInternal(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents) { if (CheckMIDI(zComponentInstance)) { double offset = 0.0; if (_activeMusicTimeSettings != null) { offset = _activeMusicTimeSettings.GetDelay(); midiSequencer.SetTempo((uint)_activeMusicTimeSettings._bpm); midiSequencer.Looping = _loop; } midiSequencer.Play(offset); base.PlayInternal(zComponentInstance, _fadeInTime, _fadeInCurve, dontPlayComponents: true); } }
public override void PlayInternal(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents) { if (CheckMIDI(zComponentInstance)) { if (!_loadOnStart) { SetComponentActive(isActive: true); _currentState = AudioComponentState.WaitingToPlay; StartCoroutine(LoadPlayCoroutine(zComponentInstance, target, curve, dontPlayComponents)); } else { PlayInternalWait(zComponentInstance, target, curve, dontPlayComponents); } } }
public override EventStatus OnProcessEvent(Event zEvent, ComponentInstance zInstance) { EventStatus result = EventStatus.Failed_Uknown; if (zEvent.EventAction == EventAction.SetSwitch) { if (_switchComponentSwitchType == SwitchComponentSwitchType.OnSwitch) { List <ComponentInstance> list = FindInstances(zEvent.parentGameObject, createIfNoneFound: false); if (list != null && list.Count > 0) { for (int i = 0; i < list.Count; i++) { ComponentInstance componentInstance = list[i]; ((SwitchComponent)componentInstance._instance).SetSwitch((string)zEvent._parameter); result = EventStatus.Handled; } } else { SetSwitch((string)zEvent._parameter); result = EventStatus.Handled; } } else { List <ComponentInstance> list2 = FindInstances(zEvent.parentGameObject, createIfNoneFound: false); if (list2 != null && list2.Count > 0) { for (int j = 0; j < list2.Count; j++) { ComponentInstance componentInstance2 = list2[j]; ((SwitchComponent)componentInstance2._instance).SetDefferedSwitch((string)zEvent._parameter); result = EventStatus.Handled; } } else { SetDefferedSwitch((string)zEvent._parameter); result = EventStatus.Handled; } } } return(result); }
private IEnumerator LoadPlayCoroutine(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents) { int languageIndex = FabricManager.Instance.GetLanguageIndex(); if (languageIndex >= 0) { LanguageProperties language = FabricManager.Instance.GetLanguagePropertiesByIndex(languageIndex); if (language != null) { _loadPlayCoroutineActive = true; yield return(StartCoroutine(FabricManager.Instance._customAudioClipLoader.LoadAudioClip(_audioClipReference, language))); base.AudioClip = FabricManager.Instance._customAudioClipLoader._audioClip; base.PlayInternal(zComponentInstance, target, curve, dontPlayComponents); _loadPlayCoroutineActive = false; } } }
bool GlobalSwitch.IListener.OnSwitch(GlobalSwitch.Switch _switch) { for (int i = 0; i < _componentInstances.Length; i++) { ComponentInstance componentInstance = _componentInstances[i]; if (componentInstance == null) { continue; } GlobalSwitchContainer globalSwitchContainer = GetGlobalSwitchContainer(_switch); if (globalSwitchContainer == null) { continue; } Component component = globalSwitchContainer._components[0]; if (!(component != null) || !(component != _selectedComponent)) { continue; } bool isComponentActive = _isComponentActive; if (_selectedComponent != null) { _selectedComponent.StopInternal(stopInstances: false, forceStop: false, 0f, 0.5f); } _selectedComponent = component; if (_startOnSwitch && isComponentActive && !IsMusicSyncEnabled()) { _componentInstance._instance.ResetPlayScheduled(); _selectedComponent.PlayInternal(_componentInstance, 0f, 0.5f); if (_componentStatus == ComponentStatus.Stopping) { StopInternal(stopInstances: false, forceStop: false, _fadeParameter.GetTimeRemaining(FabricTimer.Get()), _fadeOutCurve); } } if (HasValidEventNotifier()) { NotifyEvent(EventNotificationType.OnSwitch, _selectedComponent); } } return(true); }
public override void PlayInternal(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents) { if (!CheckMIDI(zComponentInstance)) { return; } base.PlayInternal(zComponentInstance, target, curve, dontPlayComponents: true); if (!(_defaultComponent != null)) { return; } if (_activeMusicTimeSettings != null) { if (_syncToMusicOnFirstPlay && !_musicTimeResetOnPlay) { _componentInstance._instance.SetPlayScheduledAdditive(_activeMusicTimeSettings.GetDelay(this), 0.0); } _activeMusicTimeSettings._onBeatDetected += OnBeat; _activeMusicTimeSettings._onBarDetected += OnBar; } _defaultComponent.PlayInternal(zComponentInstance, 0f, 0.5f); _currentlyPlayingComponent = _defaultComponent; }
public override void PlayInternal(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents) { if (CheckMIDI(zComponentInstance) && _components.Count != 0) { if (_selectedComponent != null) { _selectedComponent.Stop(); } base.PlayInternal(zComponentInstance, target, curve, dontPlayComponents: true); float num = 0f; if (_delayOnFirstPlay) { num = _delay + UnityEngine.Random.Range(_delayRandomization, _delayMaxRandomization); _componentInstance._instance.SetPlayScheduledAdditive(num, 0.0); } PlayRandomomponent(zComponentInstance); if (_looped && _playMode == RandomComponentPlayMode.RandomNoRepeat && _triggerMode == RandomComponentTriggerMode.Retrigger) { _retriggerTime = 0f; _retriggerTime = num; } _status = ComponentStatus.Playing; } }
public override EventStatus OnProcessEvent(Event zEvent, ComponentInstance zInstance) { EventStatus result = EventStatus.Failed_Uknown; if (zEvent.EventAction == EventAction.SetSwitch) { List <ComponentInstance> list = FindInstances(zEvent.parentGameObject, createIfNoneFound: false); if (list != null && list.Count > 0) { for (int i = 0; i < list.Count; i++) { ComponentInstance componentInstance = list[i]; ((MusicComponent)componentInstance._instance).SetBestMatchTransition((string)zEvent._parameter); result = EventStatus.Handled; } } else { SetBestMatchTransition((string)zEvent._parameter); result = EventStatus.Handled; } } return(result); }
private IEnumerator LoadPlayCoroutine(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents) { string filename = GetAudioClipReferenceFilename(); if (_languageSupported) { int languageIndex = FabricManager.Instance.GetLanguageIndex(); if (languageIndex >= 0) { LanguageProperties languagePropertiesByIndex = FabricManager.Instance.GetLanguagePropertiesByIndex(languageIndex); if (languagePropertiesByIndex != null) { filename = filename.Replace("LANGUAGE", languagePropertiesByIndex._languageFolder); } } } www = new WWW(filename); while (!www.isDone) { yield return(new WaitForSeconds(0.1f)); } base.AudioClip = WWWAudioExtensions.GetAudioClip(www, _is3D, _isStreaming, _audioType); PlayInternalWait(zComponentInstance, target, curve, dontPlayComponents); }
public override EventStatus OnProcessEvent(Event zEvent, ComponentInstance zInstance) { EventStatus result = EventStatus.Failed_Uknown; if (zEvent.EventAction == EventAction.AdvanceSequence && _sequenceType == SequenceComponentType.PlayOnAdvance) { List <ComponentInstance> list = null; if (_syncAdvanceBetweenInstances) { list = new List <ComponentInstance>(_componentInstances.Length); for (int i = 0; i < _componentInstances.Length; i++) { list.Add(_componentInstances[i]); } } else { list = FindInstances(zEvent.parentGameObject, createIfNoneFound: false); } if (list != null && list.Count > 0) { for (int j = 0; j < list.Count; j++) { ComponentInstance componentInstance = list[j]; if (!((SequenceComponent)componentInstance._instance)._stopInProgress) { if ((_playlistPlayToEnd[_prevPlayingComponentIndex] || IsMusicSyncEnabled()) && _currentlyPlayingComponent != null && _currentlyPlayingComponent.IsPlaying()) { ((SequenceComponent)componentInstance._instance)._advanceEventTriggered = true; continue; } ((SequenceComponent)componentInstance._instance).PlayNextEntry(); result = EventStatus.Handled; if (HasValidEventNotifier()) { NotifyEvent(EventNotificationType.OnSequenceAdvance, _currentlyPlayingComponent); } } else { result = EventStatus.Not_Handled_Stopped; } } } else { PlayNextEntry(); result = EventStatus.Handled; } } else if (zEvent.EventAction == EventAction.ResetSequence) { List <ComponentInstance> list2 = FindInstances(zEvent.parentGameObject, createIfNoneFound: false); if (list2 != null && list2.Count > 0) { for (int k = 0; k < list2.Count; k++) { ComponentInstance componentInstance2 = list2[k]; ((SequenceComponent)componentInstance2._instance).ResetSequence(); result = EventStatus.Handled; } } else { ResetSequence(); result = EventStatus.Handled; } } return(result); }
public override void PlayInternal(ComponentInstance zComponentInstance, float target, float curve, bool dontPlayComponents) { Load(); base.PlayInternal(zComponentInstance, target, curve, dontPlayComponents); }