예제 #1
0
 private void Update()
 {
     if (eventQueue.Count > 0 && OnForwardedEvent != null)
     {
         UIEventArgsBase args = eventQueue.Dequeue();
         OnForwardedEvent(args);
     }
 }
예제 #2
0
 private void FadeInEventHandler(UIEventArgsBase args)
 {
     if (args != null)
     {
         Type targetType = args.target;
         if (targetType == this.GetType())
         {
             PlayAnimation(animator, "fadeInEndGameUI");
         }
     }
 }
예제 #3
0
 private void StartPanEventHandler(UIEventArgsBase args)
 {
     if (args != null)
     {
         Type targetType = args.target;
         if (targetType.ToString() == "IntroCameraPan")
         {
             StartCoroutine(RemoveOverlayAndActivatePlayers(1));
         }
     }
 }
예제 #4
0
 private void StartPanEventHandler(UIEventArgsBase args)
 {
     if (args != null)
     {
         Type targetType = args.target;
         if (targetType == this.GetType())
         {
             StartCoroutine(RemoveOverlayAndActivatePlayers(clip.length));
         }
     }
 }
예제 #5
0
 private void EndGameEventHandler(UIEventArgsBase args)
 {
     if (args != null)
     {
         Type targetType = args.target;
         if (targetType == this.GetType())
         {
             EndGameCanvas.SetActive(true);
         }
     }
 }
예제 #6
0
 private void ActivatePlayersEventHandler(UIEventArgsBase args)
 {
     if (args != null)
     {
         Type targetType = args.target;
         if (targetType == this.GetType())
         {
             player1.SetActive(true);
             player2.SetActive(true);
         }
     }
 }
예제 #7
0
    /// <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);
    }
예제 #8
0
 // 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);
             }
         }
     }
 }
예제 #9
0
    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;
                    }
                }
            }
        }
    }