示例#1
0
 public ClickReturn(ClickActions clickAction, ClickTypes clickType, Vector3 clickPosition, GameObject clickedObject)
 {
     ClickAction   = clickAction;
     ClickType     = clickType;
     ClickPosition = clickPosition;
     ClickedObject = clickedObject;
 }
        public override bool Test()
        {
            ClickTypes currentTouchState = 0;

            for (int i = 0; i < Input.touchCount; i++)
            {
                Touch touch = Input.GetTouch(i);

                if (touch.phase == TouchPhase.Began)
                {
                    currentTouchState |= ClickTypes.Down;
                }
                if (touch.phase == TouchPhase.Ended)
                {
                    currentTouchState |= ClickTypes.Release;
                    if (touch.tapCount > 0)
                    {
                        currentTouchState |= ClickTypes.Release;
                    }
                }

                // Don't bother checking for a zone match if there wasn't a touchtype match
                if ((currentTouchState & touchType) == 0)
                {
                    continue;
                }

                // Here in case the screen gets resized after initialization.
                if (Screen.width != screenWidthAtLastRecalc)
                {
                    UpdateZoneRects();
                }

                // Check for zone match
                int touchThirdCol = (touch.position.x < colOneThird) ? 0 : (touch.position.x < colTwoThird) ? 1 : 2;
                int touchThirdRow = (touch.position.y < rowOneThird) ? 0 : (touch.position.x < rowTwoThird) ? 1 : 2;

                return
                    ((((TouchZones)touchZones == TouchZones.BottomLeft) && touchThirdCol == 0 && touchThirdRow == 0) ||
                     (((TouchZones)touchZones == TouchZones.BottomMid) && touchThirdCol == 1 && touchThirdRow == 0) ||
                     (((TouchZones)touchZones == TouchZones.BottomRight) && touchThirdCol == 2 && touchThirdRow == 0) ||

                     (((TouchZones)touchZones == TouchZones.CenterLeft) && touchThirdCol == 0 && touchThirdRow == 1) ||
                     (((TouchZones)touchZones == TouchZones.CenterMid) && touchThirdCol == 1 && touchThirdRow == 1) ||
                     (((TouchZones)touchZones == TouchZones.CenterRight) && touchThirdCol == 2 && touchThirdRow == 1) ||

                     (((TouchZones)touchZones == TouchZones.TopLeft) && touchThirdCol == 0 && touchThirdRow == 2) ||
                     (((TouchZones)touchZones == TouchZones.TopMid) && touchThirdCol == 1 && touchThirdRow == 2) ||
                     (((TouchZones)touchZones == TouchZones.TopRight) && touchThirdCol == 2 && touchThirdRow == 2) ||

                     (((TouchZones)touchZones == TouchZones.LeftHalf) && touch.position.x < colHalf) ||
                     (((TouchZones)touchZones == TouchZones.RightHalf) && touch.position.x > colHalf));
            }
            return(false);
        }
示例#3
0
        public ReturnInput getinput()
        {
            int             touchex         = -1;
            int             touchey         = -1;
            bool            pressed         = false;
            TouchCollection touchCollection = TouchPanel.GetState();

            NavigationType navigation = NavigationType.none;

            foreach (TouchLocation touch1 in touchCollection) // for loop and checkign each touch
            {
                touchex = (int)touch1.Position.X;
                touchey = (int)touch1.Position.Y;
                pressed = true;
            }
            ClickTypes action = ClickTypes.none;

            if (pressed)
            {
                action = ClickTypes.open;
            }
            return(new ReturnInput(new Vector2(touchex, touchey), action, navigation));
        }
示例#4
0
        public ReturnInput getinput()
        {
            MouseState     mouse      = Mouse.GetState();
            ClickTypes     clicktype  = ClickTypes.none;
            NavigationType navigation = NavigationType.none;

            if (mouse.LeftButton == ButtonState.Pressed)
            {
                clicktype = ClickTypes.open;
            }
            else if (mouse.RightButton == ButtonState.Pressed)
            {
                clicktype = ClickTypes.mark;
            }

            KeyboardState keyboard = Keyboard.GetState();

            if (keyboard.IsKeyDown(Keys.Escape))
            {
                navigation = NavigationType.exit;
            }

            return(new ReturnInput(new Vector2(mouse.X, mouse.Y), clicktype, navigation));
        }
 public InputSelectorTouchArea(ClickTypes _touchType)
 {
     touchType = _touchType;
 }
示例#6
0
 public PlayerKey(ClickTypes ClickType, KeyEventArgs Key, int BetweenClick)
 {
     this.ClickType    = ClickType;
     this.Key          = Key;
     this.BetweenClick = BetweenClick;
 }
示例#7
0
 public AiActivate(GameObject performer, GameObject usedObject, GameObject targetObject, Intent intent, ClickTypes clickType) : base(performer, usedObject, targetObject, intent)
 {
     this.clickType = clickType;
 }
示例#8
0
 public ReturnInput(Vector2 cursor, ClickTypes clicktype, NavigationType navigation)
 {
     this.cursor     = cursor;
     this.clicktype  = clicktype;
     this.navigation = navigation;
 }