Exemple #1
0
 extern public static ErrorCodes XGrabPointer(
     IntPtr display,
     IntPtr grab_window,
     bool owner_events, int event_mask,
     GrabMode pointer_mode,
     GrabMode keyboard_mode,
     IntPtr confine_to,
     IntPtr cursor,
     int time
     );
    /// <summary>
    /// Returns a cursor. Sets the _mode. Sets the _activeGraSquare (if there is one).
    /// </summary>
    /// <param name="location">The point to check. (0, 0) is upper left of the form</param>
    /// <returns>An approbiate Cursor or the default Cursor (the cached cursor of the Form)</returns>
    private Cursor checkForActiveRegionChangeCursor(Point location)
    {
        Console.WriteLine("checkForActiveRegionChangeCursor() " + location);

        //over Grabsqares?
        GrabSquare gs = null;
        bool       isInsideGrabSquare = false;

        for (int i = 0; i < _grabSquares.Count; i++)
        {
            gs = _grabSquares[i];
            isInsideGrabSquare = gs.isInside(location);
            if (isInsideGrabSquare)
            {
                break;
            }
        }

        if (isInsideGrabSquare)
        {
            //change forms cursor
            _activeGrabSquare = gs;
            _mouseOverMode    = GrabMode.DRAG;
            return(_activeGrabSquare._cursor);
        }
        //over Rectangle himself?
        if (_rectangle.Contains(location))
        {
            _activeGrabSquare = null;
            _lastMovePosition = location;
            _mouseOverMode    = GrabMode.MOVE;
            return(_insideCursor);
        }
        else
        {
            _activeGrabSquare = null;
            _mouseOverMode    = GrabMode.NONE;
            return(_defaultCursor);
        }
    }
Exemple #3
0
    // Use this for initialization
    void Start()
    {
        block_prefab = new List <GameObject>();
        block_prefab.Add(Resources.Load("BookShelfBlock", typeof(GameObject)) as GameObject);
        block_prefab.Add(Resources.Load("DirtBlock", typeof(GameObject)) as GameObject);
        block_prefab.Add(Resources.Load("GrassBlock", typeof(GameObject)) as GameObject);
        block_prefab.Add(Resources.Load("WoolBlock", typeof(GameObject)) as GameObject);
        block_prefab.Add(Resources.Load("ChestBlock", typeof(GameObject)) as GameObject);
        block_prefab.Add(Resources.Load("BrickBlock", typeof(GameObject)) as GameObject);
        block_prefab.Add(Resources.Load("HayBlock", typeof(GameObject)) as GameObject);
        block_prefab.Add(Resources.Load("PumpkinBlock", typeof(GameObject)) as GameObject);
        block_prefab.Add(Resources.Load("TntBlock", typeof(GameObject)) as GameObject);

        block_panel.SetActive(false);
        geometry_panel.SetActive(false);
        toggle_panel.SetActive(false);

        grabMode = GrabMode.Empty;

        /*blockToggle = null;
         *
         * blocks = new List<GameObject>();
         */
    }
Exemple #4
0
 public extern static int XGrabKeyboard(IntPtr display, IntPtr window, bool owner_events,
                                        GrabMode pointer_mode, GrabMode keyboard_mode, IntPtr timestamp);
Exemple #5
0
 extern internal static ErrorCodes GrabKeyboard(Display display, IntPtr grab_window,
     bool owner_events, GrabMode pointer_mode, GrabMode keyboard_mode, int time);
Exemple #6
0
 public static int XGrabButton(IntPtr display, int button, uint modifiers, IntPtr grab_window, bool owner_events, EventMask event_mask, GrabMode pointer_mode, GrabMode keyboard_mode, IntPtr confine_to, IntPtr cursor);
Exemple #7
0
 public extern static int XGrabKeyboard(IntPtr display, IntPtr window, bool owner_events,
     GrabMode pointer_mode, GrabMode keyboard_mode, IntPtr timestamp);
Exemple #8
0
		internal extern static int XGrabPointer(IntPtr display, IntPtr window, bool owner_events, EventMask event_mask, GrabMode pointer_mode, GrabMode keyboard_mode, IntPtr confine_to, IntPtr cursor, IntPtr timestamp);
 public void onMouseDown(MouseEventArgs e)
 {
     _lastMovePosition = e.Location; //initialize for move
     _mode             = _mouseOverMode;
 }
 public void SetGrabImageMode(GrabMode mode)
 {
 }
Exemple #11
0
 public static extern Status XGrabKey(IntPtr display, KeyCode keycode, KeyButtonMask modifiers, Window grab_window,
                                      bool owner_events, GrabMode pointer_mode, GrabMode keyboard_mode);
Exemple #12
0
 extern public static ErrorCodes XGrabKeyboard(IntPtr display, IntPtr grab_window,
     bool owner_events, GrabMode pointer_mode, GrabMode keyboard_mode, int time);
Exemple #13
0
 public static extern Status XGrabPointer(IntPtr display, Window grab_window, bool owner_events, EventMask event_mask,
                                          GrabMode pointer_mode, GrabMode keyboard_mode, Window confine_to, Cursor cursor, ulong time);
Exemple #14
0
 public static extern Status XGrabButton(IntPtr display, Button button, KeyButtonMask modifiers, Window grab_window,
                                         bool owner_events, EventMask event_mask, GrabMode pointer_mode, GrabMode keyboard_mode, Window confine_to, FontCursor cursor);
Exemple #15
0
 extern public static int XGrabKeyboard(IntPtr display, IntPtr grab_window,
                                        bool owner_events, GrabMode pointer_mode, GrabMode keyboard_mode, int time);
Exemple #16
0
    void Update()
    {
        Transform  camera = Camera.main.transform;
        Ray        ray    = new Ray(camera.position, Vector3.Normalize(camera.rotation * Vector3.forward));
        RaycastHit hit;

        mount_panel.text = setMountPanel();

        if (cubeCanvas != null && geometryTargetObj != null)
        {
            cubeCanvas.transform.rotation = Quaternion.identity;
            cubeCanvas.transform.position = geometryTargetObj.transform.position;
            cubeCanvas.transform.Translate(0, 0, -0.05f);
        }

        if (left_hand.isActiveAndEnabled && right_hand.isActiveAndEnabled)
        {
            if (left_hand.GetLeapHand().GrabStrength > 0.99 && right_hand.GetLeapHand().GrabStrength > 0.99)
            {
                grabMode = GrabMode.Both;
            }
            else if (left_hand.GetLeapHand().GrabStrength > 0.99)
            {
                grabMode = GrabMode.LeftOnly;
            }
            else if (right_hand.GetLeapHand().GrabStrength > 0.99)
            {
                grabMode = GrabMode.RightOnly;
            }
            else
            {
                grabMode = GrabMode.Empty;
            }
        }

        switch (grabMode)
        {
        case GrabMode.Empty:
            if (Physics.Raycast(ray, out hit))            // Hit
            {
                if (hitObject == hit.collider.gameObject) // 같은 블럭
                {
                    if (grabMode == GrabMode.Empty)
                    {
                        hitObject.transform.localScale = new Vector3(1f, 1f, 1f);
                    }

                    if (!cubeAlphaObj.activeSelf)
                    {
                        countdown = timeToSelect;
                        cubeAlphaObj.SetActive(true);
                    }
                    else
                    {
                        countdown -= Time.deltaTime;
                        if (countdown < 0.0f)
                        {
                            cubeCanvas.SetActive(true);
                            countdown = timeToSelect;
                        }
                    }
                }
                else if (hitObject != null)     // 다른 블럭
                {
                    if (blockToggle.isOn)
                    {
                        //nothing
                    }
                    else
                    {
                        cubeAlphaObj.SetActive(false);
                        cubeCanvas.SetActive(false);
                        cubeAlphaObj = null;
                        cubeCanvas   = null;
                        blockToggle  = null;
                        hitObject    = hit.collider.gameObject;
                        cubeAlphaObj = hitObject.transform.GetChild(6).gameObject;
                        cubeCanvas   = hitObject.transform.GetChild(7).gameObject;
                        blockToggle  = cubeCanvas.transform.GetChild(0).GetChild(0).GetComponent <Toggle>();
                    }
                }
                else     // null 블럭
                {
                    hitObject    = hit.collider.gameObject;
                    cubeAlphaObj = hitObject.transform.GetChild(6).gameObject;
                    cubeCanvas   = hitObject.transform.GetChild(7).gameObject;
                    blockToggle  = cubeCanvas.transform.GetChild(0).GetChild(0).GetComponent <Toggle>();
                }
            }
            else     // no Hit
            {
                hitObject.transform.localScale = new Vector3(1f, 1f, 1f);
                if (hitObject != null)     // previous hit block exist
                {
                    if (blockToggle.isOn)
                    {
                        //nothing
                    }
                    else
                    {
                        //hitObject = null, effect = false&null
                        hitObject = null;
                        cubeAlphaObj.SetActive(false);
                        cubeCanvas.SetActive(false);
                        cubeAlphaObj = null;
                        cubeCanvas   = null;
                    }
                }
                else
                {
                }
            }
            break;

        case GrabMode.LeftOnly:
            Debug.Log("left");
            if (Vector3.Distance(hitObject.gameObject.transform.position, UnityVectorExtension.ToVector3(left_hand.GetLeapHand().Fingers[0].TipPosition)) < 0.15f && !blockToggle.isOn)
            {
                hitObject.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
                Vector3 newPosition = UnityVectorExtension.ToVector3(left_hand.GetLeapHand().Fingers[0].TipPosition);

                hitObject.transform.position = new Vector3(truncate(newPosition.x), truncate(newPosition.y), truncate(newPosition.z));
            }
            break;

        case GrabMode.RightOnly:
            Debug.Log("right");
            if (Vector3.Distance(hitObject.gameObject.transform.position, UnityVectorExtension.ToVector3(right_hand.GetLeapHand().Fingers[0].TipPosition)) < 0.15f && !blockToggle.isOn)
            {
                hitObject.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
                Vector3 newPosition = UnityVectorExtension.ToVector3(right_hand.GetLeapHand().Fingers[0].TipPosition);

                hitObject.transform.position = new Vector3(truncate(newPosition.x), truncate(newPosition.y), truncate(newPosition.z));
            }
            break;

        case GrabMode.Both:
            if (Vector3.Dot(UnityVectorExtension.ToVector3(left_hand.GetLeapHand().PalmNormal), Vector3.up) > 0 && Vector3.Dot(UnityVectorExtension.ToVector3(right_hand.GetLeapHand().PalmNormal), Vector3.up) > 0)
            {
                block_panel.SetActive(true);
            }
            //float palm_distance = Vector3.Distance(UnityVectorExtension.ToVector3(left_hand.GetLeapHand().PalmPosition), UnityVectorExtension.ToVector3(right_hand.GetLeapHand().PalmPosition));
            //hitObject.transform.localScale = new Vector3(truncate(palm_distance), truncate(palm_distance), truncate(palm_distance));
            break;
        }
    }
Exemple #17
0
 public extern static int XGrabButton(IntPtr display,
     int button, uint modifiers, Window grab_window,
     Bool owner_events, EventMask event_mask,
     GrabMode pointer_mode, GrabMode keyboard_mode,
     Window confine_to, Cursor cursor);
Exemple #18
0
 extern internal static ErrorCodes GrabKeyboard(Display display, IntPtr grab_window,
                                                bool owner_events, GrabMode pointer_mode, GrabMode keyboard_mode, int time);
Exemple #19
0
 public static int XGrabButton(IntPtr display, int button, uint modifiers, IntPtr grab_window, bool owner_events, EventMask event_mask, GrabMode pointer_mode, GrabMode keyboard_mode, IntPtr confine_to, IntPtr cursor);
 public void onMouseUp(MouseEventArgs e)
 {
     _mode  = GrabMode.NONE;
     _color = doNothingColor;
     _parent.needRepaint();
 }
Exemple #21
0
 public void SetGrabImageMode(GrabMode mode)
 {
 }
Exemple #22
0
 public extern static int XGrabKey(IntPtr display, int keycode, uint modifiers,
     Window grab_window, bool owner_events, GrabMode pointer_mode, GrabMode keyboard_mode);
Exemple #23
0
 public static extern GrabMode WM_GrabInput(GrabMode mode);
Exemple #24
0
		internal static int XGrabPointer(IntPtr display, IntPtr window, bool owner_events, EventMask event_mask, GrabMode pointer_mode, GrabMode keyboard_mode, IntPtr confine_to, IntPtr cursor, IntPtr timestamp)
		{
			DebugHelper.TraceWriteLine ("XGrabPointer");
			return _XGrabPointer(display, window, owner_events, event_mask, pointer_mode, keyboard_mode, confine_to, cursor, timestamp);
		}
Exemple #25
0
 public static extern GrabMode WM_GrabInput(GrabMode mode);
Exemple #26
0
 extern internal static ErrorCodes GrabPointer(Display display, IntPtr grab_window,
     bool owner_events, int event_mask, GrabMode pointer_mode, GrabMode keyboard_mode,
     IntPtr confine_to, IntPtr cursor, int time);
Exemple #27
0
 public extern static int XGrabButton(IntPtr display,
                                      int button, uint modifiers, Window grab_window,
                                      Bool owner_events, EventMask event_mask,
                                      GrabMode pointer_mode, GrabMode keyboard_mode,
                                      Window confine_to, Cursor cursor);
Exemple #28
0
 public extern static int XGrabPointer(IntPtr display, IntPtr window, bool owner_events, EventMask event_mask, GrabMode pointer_mode, GrabMode keyboard_mode, IntPtr confine_to, IntPtr cursor, IntPtr timestamp);
Exemple #29
0
 public extern static int XGrabKey(IntPtr display, int keycode, uint modifiers,
                                   Window grab_window, bool owner_events, GrabMode pointer_mode, GrabMode keyboard_mode);