コード例 #1
0
        public void InvokeCompletion()
        {
            EventBinder <Action> onDispose = new EventBinder <Action>(e => OnSoftDispose += e, e => OnSoftDispose -= e);

            onDispose.IsOneTime = true;
            onDispose.SetHandler(() =>
            {
                OnCompletion?.Invoke();

                // Wait for completion timeout to auto navigate to results.
                SynchronizedTimer autoExitTimer = new SynchronizedTimer()
                {
                    Limit = 2f,
                };
                autoExitTimer.OnFinished += Model.ExitGameToResult;
                autoExitTimer.Start();
            });

            SynchronizedTimer initialTimer = new SynchronizedTimer()
            {
                Limit = 0.5f
            };

            initialTimer.OnFinished += InvokeSoftDispose;
            initialTimer.Start();
        }
コード例 #2
0
        /// <summary>
        /// Starts displaying the cover image for the specified mapset.
        /// </summary>
        public void Setup(OnlineMapset mapset)
        {
            Reset();

            this.mapset = mapset;
            if (mapset == null)
            {
                return;
            }

            string cardImage = mapset.CardImage;

            // If the image is already loaded in cacher, just load image immediately.
            if (WebImageCacher.IsCached(cardImage))
            {
                Load(cardImage);
            }
            // Else, load the image after delay to reduce performance implications when scrolling quickly.
            else
            {
                loadDelay = new SynchronizedTimer()
                {
                    Limit = 1f
                };
                loadDelay.OnFinished += () =>
                {
                    loadDelay = null;
                    Load(cardImage);
                };
                loadDelay.Start();
            }
        }
コード例 #3
0
        public NotificationsCenterBase(TimeSpan dueTime, TimeSpan interval, int eventsPerInterval)
        {
            _users = new OrderedDictionary();

            _timer = new SynchronizedTimer(OnTimertick, dueTime, interval);

            _eventsPerInterval = eventsPerInterval;

            Start();
        }
コード例 #4
0
        /// <summary>
        /// Hides the cover image.
        /// </summary>
        public void Reset()
        {
            this.mapset = null;
            Unload();

            if (loadDelay != null)
            {
                loadDelay.Stop();
                loadDelay = null;
            }
        }
コード例 #5
0
        void Awake()
        {
            InitializeModules();

            var timer = new SynchronizedTimer()
            {
                Limit            = 0.01f,
                WaitFrameOnStart = true,
            };

            timer.OnFinished += PostInitialize;
            timer.Start();
        }
コード例 #6
0
        /// <summary>
        /// Waits for a certain amount of time and navigates away to initialize screen.
        /// </summary>
        protected override void OnPostShow()
        {
            base.OnPostShow();

            var timer = new SynchronizedTimer();

            timer.OnFinished += () =>
            {
                if (ScreenNavigator != null)
                {
                    ScreenNavigator.Show <InitializeScreen>();
                }
            };
            timer.Limit = 1f;
            timer.Start();
        }
コード例 #7
0
        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (null != _timer)
                {
                    Stop();
                    _timer.Dispose();
                    _timer = null;
                }

                if (null != _users)
                {
                    _users.Clear();
                    _users = null;
                }
            }
        }
コード例 #8
0
        private void RunDummyTask(ManualTask <DummyCacherData> task, string key)
        {
            var timer = new SynchronizedTimer()
            {
                Limit = 1f
            };

            timer.OnFinished += () =>
            {
                task.SetFinished(new DummyCacherData()
                {
                    Key         = key,
                    IsDestroyed = false
                });
            };
            timer.OnProgress += task.SetProgress;
            timer.Start();
        }