Пример #1
0
        void LateUpdate()
        {
            if (!MatchManager.Instance.IsMatchRunning)
            {
                return;
            }
            var em    = World.DefaultGameObjectInjectionWorld.EntityManager;
            var query = em.CreateEntityQuery(ComponentType.ReadOnly <MatchState>());
            var ticks = query.GetSingleton <MatchState>().Time;

            if (ticks == 0)
            {
                ObjectUtility.SetActive(_text, false);
                return;
            }
            var seconds = Mathf.FloorToInt(ticks * Time.fixedDeltaTime);

            if (_seconds == seconds)
            {
                return;
            }
            _seconds = seconds;
            var minutes = seconds / 60;

            seconds    = seconds % 60;
            _text.text = $"{minutes:D2}:{seconds:D2}";
            ObjectUtility.SetActive(_text, true);
        }
Пример #2
0
        void UpdateActive()
        {
            var isLoading = IsLoading;

            foreach (var view in ViewObjects)
            {
                ObjectUtility.SetActive(view, isLoading);
            }
            if (Tasks.Count > 0)
            {
                Tasks.RemoveAll(t => t.IsCompleted);
            }
        }