Example #1
0
 /// <inheritdoc/>
 public Task PushAsync(PopupPage page, bool animate = true)
 {
     Pushing?.Invoke(this, new PopupNavigationEventArgs(page, animate));
     _stack.Push(page);
     Pushed?.Invoke(this, new PopupNavigationEventArgs(page, animate));
     return(Task.CompletedTask);
 }
 private void Update()
 {
     //TODO in reality, Inputs would be detected elsewhere
     // and passed into the player class. We're doing it here
     // for simplification of example
     if (Input.GetMouseButtonDown(0))
     {
         Pushing?.Invoke();
         _abilityLoadout.UseEquippedAbility(CurrentTarget);
     }
 }
        public Task PushAsync(PopupPage page, bool animate = true)
        {
            lock (_locker)
            {
                if (_popupStack.Contains(page))
                {
                    return(Task.CompletedTask);
                    //throw new InvalidOperationException("The page has been pushed already. Pop or remove the page before to push it again");
                }

                Pushing?.Invoke(this, new PopupNavigationEventArgs(page, animate));

                _popupStack.Add(page);

                var task = InvokeThreadSafe(async() =>
                {
                    animate = CanBeAnimated(animate);

                    if (animate)
                    {
                        page.PreparingAnimation();
                        await AddAsync(page);
                        await page.AppearingAnimation();
                    }
                    else
                    {
                        await AddAsync(page);
                    }

                    page.AppearingTransactionTask = null;

                    Pushed?.Invoke(this, new PopupNavigationEventArgs(page, animate));
                });

                page.AppearingTransactionTask = task;

                return(task);
            }
        }
Example #4
0
 // Start is called before the first frame update
 void Start()
 {
     push     = GameObject.FindWithTag("Block").GetComponent <Pushing>();
     animator = GetComponent <Animator>();
 }
 private void RaisePushing()
 {
     Pushing?.Invoke(this, EventArgs.Empty);
 }