private async Task HideInternalAsync()
        {
            if (_listItem == null)
            {
                _animating = false;
                return;
            }

            var innerBatch = _compositor.CreateScopedBatch(CompositionBatchTypes.Animation);

            await ToggleListItemAnimationAsync(false);

            innerBatch.Completed += (ss, exx) =>
            {
                if (_listItem != null)
                {
                    _listItem.GetVisual().Opacity = 1f;
                    _listItem = null;
                }

                OnHidden?.Invoke(this, new EventArgs());
                ToggleDetailGridAnimation(false);
                FlipperControl.DisplayIndex = (int)DownloadStatus.Pending;

                _animating = false;
            };
            innerBatch.End();
        }
Example #2
0
        public static void Hide()
        {
            if (menuView_ != null)
            {
                ObjectPoolManager.Recycle(menuView_);
                menuView_ = null;
            }

            OnHidden.Invoke();
        }
Example #3
0
        private static void HandlePopupRecycled()
        {
            if (popup_ == null)
            {
                return;
            }

            popup_.OnRecycled -= HandlePopupRecycled;
            popup_             = null;
            OnHidden.Invoke();
        }
Example #4
0
        IEnumerator ShowUntilTrigger()
        {
            while (_show)
            {
                yield return(null);
            }
            _animator.SetTrigger(Hide);

            yield return(new WaitForSeconds(_animator.GetCurrentAnimatorStateInfo(0).length));

            OnHidden?.Invoke();
        }
        protected override async Task OnAfterRenderAsync(bool firstRender)
        {
            if (firstRender)
            {
                HasRender = true;
                if (Target != null)
                {
                    if (!IsDropdown)
                    {
                        await BlazorStrap.Interop.AddEventAsync(_objectRef, Target, EventType.Click);
                    }
                    if (MouseOver)
                    {
                        await BlazorStrap.Interop.AddEventAsync(_objectRef, Target, EventType.Mouseenter);

                        await BlazorStrap.Interop.AddEventAsync(_objectRef, Target, EventType.Mouseleave);
                    }

                    EventsSet = true;
                }
            }
            else
            {
                if (!_called)
                {
                    return;
                }
                _called = false;
                // Since there is no transition without a we run into a issue where rapid calls break the popover.
                // The delay allows the popover time to clean up
                await Task.Delay(100);

                if (Shown)
                {
                    if (OnShown.HasDelegate)
                    {
                        await OnShown.InvokeAsync(this);
                    }
                }
                else
                {
                    if (OnHidden.HasDelegate)
                    {
                        await OnHidden.InvokeAsync(this);
                    }
                }
            }
        }
        public StackViewLayout(Transform layout, IBackgroundView background)
        {
            _background = background;
            Layout      = layout;

            OnClosed.Where(x => x == _activeView).
            Subscribe(HideView).
            AddTo(LifeTime);

            OnHidden.Where(x => x == _activeView).
            Subscribe(HideView).
            AddTo(LifeTime);

            OnShown.Where(x => x != _activeView).
            Subscribe(ActivateView).
            AddTo(LifeTime);
        }
Example #7
0
        public override async Task HideAsync()
        {
            if (OnHide.HasDelegate)
            {
                await OnHide.InvokeAsync(this);
            }
            Shown = false;
            await BlazorStrap.Interop.SetStyleAsync(MyRef, "display", "name");

            await BlazorStrap.Interop.RemoveClassAsync(MyRef, "show");

            await BlazorStrap.Interop.RemovePopoverAsync(MyRef, DataId);

            if (OnHidden.HasDelegate)
            {
                _ = Task.Run(() => { _ = OnHidden.InvokeAsync(this); });
            }
        }
 private void hide()
 {
     _base.SetActive(false);
     OnHidden?.Invoke();
     _displaying = false;
 }
Example #9
0
        private void Init()
        {
            // Make the menu fit within the parent's object.
            Anchor = AnchorType.Fill;
            Offset = Offset.Zero;

            var blocker = CreateChild <Blocker>("blocker", 0);

            {
                blocker.OnTriggered += CloseMenu;
            }
            holder = CreateChild("holder", 1);
            {
                holder.Size = new Vector2(ContainerWidth, 0f);

                aniHolder = holder.CreateChild("ani-holder", 0);
                {
                    aniHolder.Anchor = AnchorType.Fill;
                    aniHolder.Offset = Offset.Zero;

                    canvasGroup       = aniHolder.RawObject.AddComponent <CanvasGroup>();
                    canvasGroup.alpha = 0f;

                    shadow = aniHolder.CreateChild <UguiSprite>("shadow", 0);
                    {
                        shadow.Anchor     = AnchorType.Fill;
                        shadow.Offset     = new Offset(-7f);
                        shadow.SpriteName = "glow-circle-16";
                        shadow.ImageType  = Image.Type.Sliced;
                        shadow.Color      = Color.black;
                    }
                    listContainer = aniHolder.CreateChild <UguiListView>("list", 1);
                    {
                        listContainer.Anchor = AnchorType.Fill;
                        listContainer.Offset = Offset.Zero;
                        listContainer.Background.SpriteName = "circle-16";
                        listContainer.Background.ImageType  = Image.Type.Sliced;
                        listContainer.Background.Color      = new Color(0f, 0f, 0f, 0.75f);

                        listContainer.Initialize(OnCreateMenuItem, OnUpdateMenuItem);
                        listContainer.CellSize = ItemSize;
                        listContainer.Corner   = GridLayoutGroup.Corner.UpperLeft;
                        listContainer.Axis     = GridLayoutGroup.Axis.Vertical;
                    }
                }
            }

            showAni = new Anime();
            showAni.AddEvent(0f, () => Active           = true);
            showAni.AnimateFloat(a => canvasGroup.alpha = a)
            .AddTime(0f, () => canvasGroup.alpha)
            .AddTime(0.25f, 1f)
            .Build();
            showAni.AnimateFloat(y => aniHolder.Y = y)
            .AddTime(0f, MoveAniAmount, EaseType.QuadEaseOut)
            .AddTime(0.25f, 0f)
            .Build();

            hideAni = new Anime();
            hideAni.AnimateFloat(a => canvasGroup.alpha = a)
            .AddTime(0f, () => canvasGroup.alpha)
            .AddTime(0.25f, 0f)
            .Build();
            hideAni.AnimateFloat(y => aniHolder.Y = y)
            .AddTime(0f, 0f, EaseType.QuadEaseOut)
            .AddTime(0.25f, MoveAniAmount)
            .Build();
            hideAni.AddEvent(hideAni.Duration, () =>
            {
                OnHidden?.Invoke(this);
                Active = false;
            });
        }
Example #10
0
 public void OnShownOut()
 {
     OnHidden?.Invoke();
     gameObject.SetActive(false);
 }