예제 #1
0
 /// <summary>
 /// Allows you to hide a banner ad, instead of destroying it altogether.
 /// </summary>
 public void Hide(bool destroy = false)
 {
     this.m_showing = false;
     loaded         = false;
     OnHide?.Invoke(this, new HideEventArgs(m_placementId));
     OnUnload?.Invoke(this, new EventArgs());
 }
예제 #2
0
            public override void OnScrolled(RecyclerView recyclerView, int dx, int dy)
            {
                base.OnScrolled(recyclerView, dx, dy);

                var visibleItemCount  = recyclerView.ChildCount;
                var totalItemCount    = recyclerView.GetAdapter().ItemCount;
                var pastVisiblesItems = LayoutManager.FindFirstVisibleItemPosition();

                if ((visibleItemCount + pastVisiblesItems) >= totalItemCount && !IsLoading && dy > 0)
                {
                    LoadMoreEvent?.Invoke(this, null);
                }

                if (scrolledDistance > HIDE_THRESHOLD && controlsVisible)
                {
                    OnHide?.Invoke(this, null);
                    controlsVisible  = false;
                    scrolledDistance = 0;
                }

                else if (scrolledDistance < -HIDE_THRESHOLD && !controlsVisible)
                {
                    OnShow?.Invoke(this, null);
                    controlsVisible  = true;
                    scrolledDistance = 0;
                }

                if ((controlsVisible && dy > 0) || (!controlsVisible && dy < 0))
                {
                    scrolledDistance += dy;
                }
            }
    public override void HideElement()
    {
        OnHideComplete.AddListener(ResetAll);
        StopAllCoroutines();

        switch (componentsToAnimate_HIDE)
        {
        case (ComponentsToAnimate.Transform):
            StartCoroutine(AnimateTransform_HIDE());
            break;

        case (ComponentsToAnimate.Graphic):
            StartCoroutine(AnimateGraphic_HIDE());
            break;

        case (ComponentsToAnimate.Both):
            StartCoroutine(AnimateTransformAndGraphic_HIDE());
            break;
        }

        if (OnHide != null)
        {
            OnHide.Invoke();
        }
    }
        /// <summary>
        /// Makes the element not render and disables all of its functionality. (still takes up space)
        /// </summary>
        public virtual void Hide()
        {
            Visible = false;
            _parent = Parent ?? _parent;
            Remove();

            OnHide?.Invoke(this);
        }
예제 #5
0
        public virtual void Hide()
        {
            if (m_Visible)
            {
                Transition(false);
            }

            OnHide?.Invoke();
        }
예제 #6
0
        public void HideMenu()
        {
            if (ShownMenus.Count > 0)
            {
                ShownMenus.Pop();
            }

            OnHide?.Invoke();
        }
예제 #7
0
 private void SetCountdown()
 {
     if (Countdown == null)
     {
         Countdown           = new Timer(Time);
         Countdown.Elapsed  += (s, a) => OnHide?.Invoke();
         Countdown.AutoReset = false;
     }
 }
예제 #8
0
        /// <summary>
        /// Hides the debug menu
        /// </summary>
        public void Hide()
        {
            rootObject.SetActive(false);

            if (OnHide != null)
            {
                OnHide.Invoke();
            }
        }
예제 #9
0
파일: Home.cs 프로젝트: fhart/GGJ2019
    public void ExitHome()
    {
        hero.EnableMovement();
        homeCanvas.gameObject.SetActive(false);
        audioSource.clip = closeDoor;
        audioSource.Play();

        OnHide?.Invoke();
    }
예제 #10
0
 public void Hide()
 {
     foreach (var gobj in items)
     {
         gobj.SetActive(false);
     }
     _active = false;
     OnHide?.Invoke();
 }
예제 #11
0
    public void ExitStore()
    {
        hero.EnableMovement();
        storeCanvas.gameObject.SetActive(false);
        selectionBorder.gameObject.SetActive(false);
        audioSource.clip = closeDoor;
        audioSource.Play();

        OnHide?.Invoke();
    }
예제 #12
0
 private void HideBullet()
 {
     // If a bullet waits to hide but collides with a character,
     // we need to prevent double hiding
     if (isHided == false)
     {
         isHided = true;
         OnHide?.Invoke(gameObject);
     }
 }
예제 #13
0
 public void Hide()
 {
     Shown = false;
     if (StateHasChanged == null)
     {
         throw new ArgumentNullException(nameof(StateHasChanged));
     }
     StateHasChanged.Invoke();
     OnHide?.Invoke();
 }
예제 #14
0
    protected virtual void StartHiding()
    {
        float a = (Time.time - time_start_action) / time_action;

        UpdateAlphaRender(render, 1 - a);
        if (!hiding && a >= 0.5f)
        {
            colliderTakeDamage.enabled = false;
            OnHide?.Invoke();
            hiding = true;
        }
    }
예제 #15
0
파일: Popup.cs 프로젝트: RomanNure/GoTrip
        public bool ForceHide()
        {
            OnHide?.Invoke();

            foreach (InputView input in Inputs)
            {
                input.Unfocus();
            }

            this.IsVisible = false;
            return(true);
        }
예제 #16
0
        /// <summary>
        /// Makes the element not render and disables all of its functionality.
        /// </summary>
        public virtual void Hide()
        {
            if (!Visible)
            {
                return;
            }

            Visible = false;
            _parent = Parent;
            Remove();

            OnHide?.Invoke(this);
        }
예제 #17
0
 protected void Awake()
 {
     CullState      = false;
     _rectTransform = GetComponent <RectTransform>();
     GetComponent <MaskableGraphic>().onCullStateChanged.AddListener((state) =>
     {
         if (state)
         {
             OnHide?.Invoke(itemIndex);
         }
         CullState = state;
     });
 }
예제 #18
0
 public void Hide()
 {
     foreach (var cell in Field.Cells)
     {
         if (cell.Data is NestCellData)
         {
             PoolManager.Instance.NestCellPool.Push(cell as NestCell);
         }
         else
         {
             PoolManager.Instance.EnviromentCellPool.Push(cell as EnviromentCell);
         }
     }
     Field.Clear();
     OnHide?.Invoke();
 }
예제 #19
0
        private void Init()
        {
            controls = new Controls();
            controls.Enable();

            controls.Player.CrouchSwitch.performed += ctx => onCrouchSwitch?.Invoke();
            controls.Player.Action.performed       += ctx => onAction?.Invoke();
            controls.Player.SwitchCamera.performed += ctx => onSwitchCamera?.Invoke();
            controls.Player.Reload.performed       += ctx => onReload?.Invoke();
            controls.Player.Kick.performed         += ctx => onKick?.Invoke();
            controls.UI.Cheats.performed           += ctx => onCheats?.Invoke();
            controls.UI.Pause.performed            += ctx => onPause?.Invoke();
            controls.UI.Hide.performed             += ctx => onHide?.Invoke();

            Load();
        }
예제 #20
0
        public async Task Show(string title, string content, NotificationType type)
        {
            OnShow?.Invoke(new Notification()
            {
                Title   = title,
                Content = content,
                Type    = type
            });
            await Task.Delay(5000);

            try
            {
                OnHide?.Invoke();
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e);
            }
        }
예제 #21
0
        private void MaskBorder_Tapped(object sender, TappedRoutedEventArgs e)
        {
            ToggleShareBtnAnimation(false);
            var batch = _compositor.CreateScopedBatch(CompositionBatchTypes.Animation);

            ToggleInfoGridAnimation(false);
            batch.Completed += (s, ex) =>
            {
                var innerBatch = _compositor.CreateScopedBatch(CompositionBatchTypes.Animation);
                innerBatch.Completed += (ss, exx) =>
                {
                    OnHide?.Invoke();
                    ToggleDetailGridAnimation(false);
                    PhotoDetailImageViewModel = null;
                };
                innerBatch.End();
            };
            batch.End();
        }
예제 #22
0
    private IEnumerator FadeOut()
    {
        yield return(null);

        float deltaTime = Mathf.Clamp(Time.time - timestamp, 0f, transition);

        canvasGroup.alpha = Mathf.Lerp(1f, 0f, deltaTime / transition);

        if (canvasGroup.alpha > 0f)
        {
            StartCoroutine(FadeOut());
        }
        else
        {
            canvasGroup.alpha          = 0f;
            canvasGroup.blocksRaycasts = false;

            OnHide?.Invoke();
            OnHide = null;
        }
    }
예제 #23
0
        public static void HideDialogWindow(string id)
        {
            UDialogManager manager = Instance;

            if (manager.db.TryGetValue(id, out UDialogMessage msg))
            {
                msg.Kill();

                manager.db.Remove(id);

                if (OnHide != null)
                {
                    OnHide.Invoke();
                }
                manager.OnHideDialog.Invoke();
            }

            if (manager.db.Keys.Count == 0)
            {
                manager.Background.gameObject.SetActive(false);
            }
        }
예제 #24
0
        internal async Task Hide(bool force = false)
        {
            if (!_isOverlayShow)
            {
                return;
            }

            await Task.Delay(HideMillisecondsDelay);

            if (!force && !IsContainTrigger(TriggerType.Click) && (_isPreventHide || _mouseInOverlay || _isChildOverlayShow))
            {
                return;
            }

            _isOverlayFirstRender        = true;
            _isWaitForOverlayFirstRender = false;
            _isOverlayHiding             = true;

            _overlayCls = Trigger.GetOverlayLeaveClass();

            await Trigger.OnOverlayHiding.InvokeAsync(true);

            await UpdateParentOverlayState(false);

            StateHasChanged();

            // wait for leave animation
            await Task.Delay(WaitForHideAnimMilliseconds);

            _isOverlayShow   = false;
            _isOverlayHiding = false;

            await Trigger.OnVisibleChange.InvokeAsync(false);

            StateHasChanged();

            OnHide?.Invoke();
        }
예제 #25
0
 private void HideToast(object source, ElapsedEventArgs args)
 {
     OnHide?.Invoke();
 }
예제 #26
0
 /// <summary>
 /// Is invoked from animator
 /// </summary>
 public void Hide()
 {
     OnHide?.Invoke(this);
     gameObject.SetActive(false);
 }
예제 #27
0
 public void Hide()
 {
     OnHide?.Invoke();
 }
예제 #28
0
 private static void HideMessage()
 {
     OnHide?.Invoke(Instance.text.text);
     SetActive(false);
 }
예제 #29
0
    /// <summary>
    /// Change the visibilty of the menu instantly without playing animation.
    /// </summary>
    /// <param name="visible">Should this menu be visible or not?</param>
    /// <param name="trivial">If true, sounds won't play and events won't fire</param>
    public override void ChangeVisibilityImmediate(bool visible, bool trivial = false)
    {
        forceVisibilityCall = true;

        if (!Initialized)
        {
            InitializeElements();
        }
        if (!gameObject.activeSelf)
        {
            gameObject.SetActive(true);
        }

        if (!UseSimpleActivation)
        {
            foreach (UIElement e in AnimatedElements)
            {
                if (e == null || !e.MenuDependent)
                {
                    continue;
                }

                e.ChangeVisibilityImmediate(visible);
            }
        }
        else
        {
            gameObject.SetActive(visible);
        }

        if (Visible != visible && !trivial)
        {
            if (SFXManager.Instance)
            {
                SFXManager.Instance.PlayClip(visible ? ShowingClip : HidingClip);
            }
            else if (ShowingClip || HidingClip)
            {
                Debug.LogError("You're trying to play sounds with no SFXManager in the scene. Please add one via Tools>ZUI>Creation Window...>Setup", gameObject);
            }
        }

        Visible = visible;

        if (!trivial)
        {
            if (visible)
            {
                if (OnShow != null)
                {
                    OnShow.Invoke();
                }
                if (OnShowComplete != null)
                {
                    OnShowComplete.Invoke();
                }
            }
            else if (!visible)
            {
                if (OnHide != null)
                {
                    OnHide.Invoke();
                }
                if (OnHideComplete != null)
                {
                    OnHideComplete.Invoke();
                }
            }
        }

        if (DeactivateWhileInvisible && !visible)
        {
            DeactivateMe(false);
        }
    }
예제 #30
0
    /// <summary>
    /// Change the visibilty of the menu by playing the desired animation.
    /// </summary>
    /// <param name="visible">Should this menu be visible or not?</param>
    /// <param name="trivial">If true, sounds won't play and events won't fire</param>
    public override void ChangeVisibility(bool visible, bool trivial = false)
    {
        forceVisibilityCall = true;

        if (!Initialized)
        {
            InitializeElements();
        }
        if (!gameObject.activeSelf)
        {
            ChangeVisibilityImmediate(Visible, true);
            gameObject.SetActive(true);
        }

        if (!UseSimpleActivation)
        {
            foreach (UIElement e in AnimatedElements)
            {
                if (e == null || !e.MenuDependent)
                {
                    continue;
                }

                e.ChangeVisibility(visible);
            }
        }
        else
        {
            gameObject.SetActive(visible);
        }

        if (Visible != visible && !trivial)
        {
            if (SFXManager.Instance)
            {
                SFXManager.Instance.PlayClip(visible ? ShowingClip : HidingClip);
            }
            else if (ShowingClip || HidingClip)
            {
                Debug.LogError("You're trying to play sounds with no SFXManager in the scene. Please add one via Tools>ZUI>Creation Window...>Setup", gameObject);
            }
        }

        Visible = visible;

        if (!trivial)
        {
            if (completeEventEnum != null)
            {
                StopCoroutine(completeEventEnum);
            }

            if (visible)
            {
                if (OnShow != null)
                {
                    OnShow.Invoke();
                }
                if (OnShowComplete != null)
                {
                    completeEventEnum = FireEventAfter(OnShowComplete, showingTime);
                }
            }
            else if (!visible)
            {
                if (OnHide != null)
                {
                    OnHide.Invoke();
                }
                //Only start waiting to fire the hide complete event if the element will not deactivate (because if it's deactivated before firing then the event won't fire)..
                //...and fire it in DeactivateMe function instead
                if (OnHideComplete != null && !DeactivateWhileInvisible)
                {
                    completeEventEnum = FireEventAfter(OnHideComplete, hidingTime);
                }
            }

            //Since coroutines can only start on active objects, then don't try starting them if the object isn't active.
            if (gameObject.activeInHierarchy && completeEventEnum != null)
            {
                StartCoroutine(completeEventEnum);
            }
        }

        if (DeactivateWhileInvisible)
        {
            if (!visible)
            {
                Invoke("DeactivateMe", hidingTime);
            }
            else
            {
                CancelInvoke("DeactivateMe");
            }
        }
    }