private void Update() { if (eventQueue.Count > 0 && OnForwardedEvent != null) { UIEventArgsBase args = eventQueue.Dequeue(); OnForwardedEvent(args); } }
private void FadeInEventHandler(UIEventArgsBase args) { if (args != null) { Type targetType = args.target; if (targetType == this.GetType()) { PlayAnimation(animator, "fadeInEndGameUI"); } } }
private void StartPanEventHandler(UIEventArgsBase args) { if (args != null) { Type targetType = args.target; if (targetType.ToString() == "IntroCameraPan") { StartCoroutine(RemoveOverlayAndActivatePlayers(1)); } } }
private void StartPanEventHandler(UIEventArgsBase args) { if (args != null) { Type targetType = args.target; if (targetType == this.GetType()) { StartCoroutine(RemoveOverlayAndActivatePlayers(clip.length)); } } }
private void EndGameEventHandler(UIEventArgsBase args) { if (args != null) { Type targetType = args.target; if (targetType == this.GetType()) { EndGameCanvas.SetActive(true); } } }
private void ActivatePlayersEventHandler(UIEventArgsBase args) { if (args != null) { Type targetType = args.target; if (targetType == this.GetType()) { player1.SetActive(true); player2.SetActive(true); } } }
/// <summary> /// Enqueue args for new events, which get continously sent/raised. /// The receiver differentiates, whether or not the event is for them by checking the args' source/target etc. /// </summary> /// <param name="eventArgs">UIEventArgsBase type</param> public void EnqueueEvent(UIEventArgsBase eventArgs) { // FIXME: LH: this is a bit of a hack, but issue due to timing- // this start might not always be called before other Starts(), who want // to already enqueue. So we do it twice? if (eventQueue == null) { eventQueue = new Queue <UIEventArgsBase>(); } eventQueue.Enqueue(eventArgs); }
// FIXME: LH: copy-pasting, can probably be generified in some way private void ForwardedEventHandler(UIEventArgsBase args) { if (args != null) { UIAnimationEventArgs animationArgs = args as UIAnimationEventArgs; if (animationArgs != null) { Type targetType = animationArgs.target; if (targetType == this.GetType()) { PlayAnimation(animationArgs.animatorRef, animationArgs.animationID); } } } }
private void ForwardedEventHandler(UIEventArgsBase args) { if (args != null) { UIAudioEventArgs audioArgs = args as UIAudioEventArgs; if (audioArgs != null) { Type targetType = audioArgs.target; if (targetType == this.GetType()) { switch (audioArgs.audioEventType) { case AUDIO_EVENT_TYPE.PLAY_AUDIO: PlayAudio(audioArgs.clip); latestClip = audioArgs.clip; break; case AUDIO_EVENT_TYPE.STOP_AUDIO: audioSource.Stop(); looping = false; break; case AUDIO_EVENT_TYPE.ENABLE_AUDIO_LOOPING: // This doesnt seem to work //audioSource.loop = true; looping = true; break; case AUDIO_EVENT_TYPE.DISABLE_AUDIO_LOOPING: //audioSource.loop = false; looping = false; break; case AUDIO_EVENT_TYPE.FADE_IN_AUDIO: StartCoroutine(StartFade(audioMixer, mixerTrackName, musicFadeInDuration, 1)); break; case AUDIO_EVENT_TYPE.FADE_OUT_AUDIO: StartCoroutine(StartFade(audioMixer, mixerTrackName, musicFadeOutDuration, 0)); break; default: break; } } } } }