Exemplo n.º 1
0
        private void Init()
        {
            this.state = UIInputState.IDLE;

            transitions = new Dictionary <UIInputStateTransition, UIInputState> {
                { new UIInputStateTransition(UIInputState.IDLE, UIInputStateAction.BEGIN), UIInputState.WAITING_FOR_USER },
                { new UIInputStateTransition(UIInputState.WAITING_FOR_USER, UIInputStateAction.END), UIInputState.IDLE }
            };
        }
Exemplo n.º 2
0
        protected virtual void Update()
        {
            if (indicatorMovingLerp.Timer.Running)
            {
                if (indicatorMovingLerp.Timer.UpdateEnd)
                {
                    selectedIndicator.position        = indicatorMovingLerp.Value;
                    indicatorMovingLerp.Timer.Running = false;
                }
                else
                {
                    selectedIndicator.position = indicatorMovingLerp.CurvedValue(indicatorMoveCurve);
                    return;
                }
            }

            UIInputState state = UpdateInput();

            switch (state)
            {
            case UIInputState.Up:
                if (selected.Up(ref selected))
                {
                    MoveIndicator(selected.transform.position);
                }
                break;

            case UIInputState.Down:
                if (selected.Down(ref selected))
                {
                    MoveIndicator(selected.transform.position);
                }
                break;

            case UIInputState.Left:
                if (selected.Left(ref selected) && selected.Type == SelectableType.Button)
                {
                    MoveIndicator(selected.transform.position);
                }
                break;

            case UIInputState.Right:
                if (selected.Right(ref selected) && selected.Type == SelectableType.Button)
                {
                    MoveIndicator(selected.transform.position);
                }
                break;

            case UIInputState.Submit:
                selected.Submit();
                break;

            case UIInputState.Cancel:
                Deactivate();
                break;
            }
        }
 public UIInputStateTransition(UIInputState state, UIInputStateAction command)
 {
     this.state   = state;
     this.command = command;
 }
Exemplo n.º 4
0
 public TouchGesture(UIInputState state = UIInputState.NotApplied, UITouchGesture action = UITouchGesture.NotApplied)
 {
     TouchDevice = state;
     TouchAction = action;
 }
Exemplo n.º 5
0
 public UIInputState ProcessTransition(UIInputStateAction command)
 {
     state = GetNextTransition(command);
     return(state);
 }