public void PushBackAction(BackAction backAction, GameObject backActionTarget = null)
    {
        BackActionData backActionData = default(BackActionData);

        backActionData.m_backAction       = backAction;
        backActionData.m_backActionTarget = backActionTarget;
        this.m_backActionStack.Push(backActionData);
    }
Example #2
0
    public void PushBackAction(BackAction backAction, GameObject backActionTarget = null)
    {
        BackActionData item = default(BackActionData);

        item.m_backAction       = backAction;
        item.m_backActionTarget = backActionTarget;
        this.m_backActionStack.Push(item);
    }
Example #3
0
        public bool OnPressed(GlobalAction action)
        {
            if (action == GlobalAction.Back)
            {
                BackAction.Invoke();
                return(true);
            }

            return(false);
        }
Example #4
0
 /// <summary>
 /// 通过项的Transform信息和一个float计时器来设置项的隐藏方式。
 /// </summary>
 /// <param name="action"></param>
 public void Back(BackAction <Transform, float> action)
 {
     foreach (var g in group)
     {
         if (g.GetComponent <BackInfo>() == null)
         {
             g.gameObject.AddComponent <BackInfo>();
         }
         backActionT  = null;
         backActionTF = action;
         g.GetComponent <BackInfo>().SetAction(action);
     }
 }
Example #5
0
        public bool OnPressed(GlobalAction action)
        {
            switch (action)
            {
            case GlobalAction.Back:
                BackAction.Invoke();
                return(true);

            case GlobalAction.Select:
                SelectAction.Invoke();
                return(true);
            }

            return(false);
        }
Example #6
0
        public Popup(float contentWidth, float contentHeight) : base()
        {
            _y            = -Height;
            ContentHeight = contentHeight;

            _popupWidth        = contentWidth;
            _headerHeight      = HeaderHeightRatio * Height;
            _footerHeight      = FooterHeightRatio * Height;
            _radius            = Height / 25;
            _popupX            = (Width - _popupWidth) / 2;
            _popupY            = (Height - (_headerHeight + _footerHeight + ContentHeight)) / 2;
            _secondButtonX     = _popupX + _popupWidth * ButtonWidthRatio;
            _secondButtonWidth = _popupWidth * (1 - ButtonWidthRatio);
            _popupHeight       = _headerHeight + ContentHeight + _footerHeight;


            _titleBlock = new TextBlock(_popupX + _popupWidth / 2, _popupY + _headerHeight / 2, Title, _headerHeight / 2, new SKColor(255, 255, 255));
            AddChild(_titleBlock);

            var leftButton = new PopupLeftButton(_popupX, _popupY + _headerHeight + ContentHeight,
                                                 _popupWidth * ButtonWidthRatio, _footerHeight, _popupWidth, _popupHeight, _radius);

            _rightButton = new PopupRightButton(_secondButtonX, _popupY + _headerHeight + ContentHeight, _secondButtonWidth, _footerHeight, _popupWidth, _popupHeight, _radius, ActionName);

            Title      = "Popup title";
            ActionName = "Action";

            AddChild(leftButton);
            AddChild(_rightButton);

            _container = new CenteredContainer(_popupX, _popupY + _headerHeight, contentHeight, contentWidth);
            AddChild(_container);

            leftButton.Activated += () =>
            {
                HideLeft();
                BackAction?.Invoke();
            };

            _rightButton.Activated += () =>
            {
                HideRight();
                NextAction?.Invoke();
            };

            DeclareTappable(this);
        }
Example #7
0
        public bool OnPressed(GlobalAction action)
        {
            switch (action)
            {
            case GlobalAction.SelectPrevious:
                InternalButtons.SelectPrevious();
                return(true);

            case GlobalAction.SelectNext:
                InternalButtons.SelectNext();
                return(true);

            case GlobalAction.Back:
                BackAction.Invoke();
                return(true);

            case GlobalAction.Select:
                SelectAction.Invoke();
                return(true);
            }

            return(false);
        }
Example #8
0
        public bool OnPressed(KeyBindingPressEvent <GlobalAction> e)
        {
            switch (e.Action)
            {
            case GlobalAction.SelectPrevious:
                InternalButtons.SelectPrevious();
                return(true);

            case GlobalAction.SelectNext:
                InternalButtons.SelectNext();
                return(true);

            case GlobalAction.Back:
                BackAction.Invoke();
                return(true);

            case GlobalAction.Select:
                SelectAction.Invoke();
                return(true);
            }

            return(false);
        }
Example #9
0
        public bool OnPressed(GlobalAction action)
        {
            switch (action)
            {
            case GlobalAction.SelectPrevious:
                if (selectionIndex == -1 || selectionIndex == 0)
                {
                    setSelected(InternalButtons.Count - 1);
                }
                else
                {
                    setSelected(selectionIndex - 1);
                }
                return(true);

            case GlobalAction.SelectNext:
                if (selectionIndex == -1 || selectionIndex == InternalButtons.Count - 1)
                {
                    setSelected(0);
                }
                else
                {
                    setSelected(selectionIndex + 1);
                }
                return(true);

            case GlobalAction.Back:
                BackAction.Invoke();
                return(true);

            case GlobalAction.Select:
                SelectAction.Invoke();
                return(true);
            }

            return(false);
        }
Example #10
0
 /// <summary>
 /// 通过项的Transform信息和一个float计时器来设置项的隐藏方式。
 /// </summary>
 /// <param name="action"></param>
 public void SetAction(BackAction <Transform, float> action)
 {
     time         = 0f;
     BackMathedT  = null;
     BackMathedTF = action;
 }
Example #11
0
 /// <summary>
 /// Invokes BackAction to go back
 /// </summary>
 public void Back()
 {
     BackAction?.Invoke();
 }
 /// <summary>
 /// Invokes BackAction to go back
 /// </summary>
 public void BackToList()
 {
     BackAction?.Invoke();
 }
Example #13
0
 private void btnBack_Click(object sender, EventArgs e)
 {
     BackAction?.Invoke();
 }