void Start()
 {
     if (ScoreRegisteredEvent == null)
     {
         ScoreRegisteredEvent = new UnityEvent();
     }
     if (ShuttingDownEvent != null)
     {
         ShuttingDownEvent.AddListener(() => { StartCoroutine("PostLogout"); });
     }
 }
Beispiel #2
0
        public static void ShuttingDownHandler()
        {
            var queue = new ManualEventQueue();

            // create subscriber
            ShuttingDownEvent lastEventHandled = null;
            var subscriber = DelegateEventHandler.OnShuttingDown(evnt => lastEventHandled = evnt);

            queue.Subscribers.Add(subscriber);

            // enqueue and handle event
            queue.BeginShutdown();
            Assert.Null(lastEventHandled);
            Assert.True(queue.HandleNext()); // shutting down event

            // test subscriber
            Assert.NotNull(lastEventHandled);
            Assert.True(queue.HandleNext()); // shut down event
            Assert.True(queue.IsShutDown);
        }