示例#1
0
    void Awake()
    {
        ini_ControlPoint_1_Position = transform.GetChild(0).gameObject.transform.position;

        dragitemcontroller = GameObject.Find("DragItemController").GetComponent <DragItemController>();

        ori = transform.parent.parent.GetChild(1).gameObject;

        movement = GameObject.Find("Movement").GetComponent <Movement>();

        RooficonHeight = Mathf.Abs(transform.GetChild(0).transform.position.y - transform.GetChild(2).transform.position.y);
        RooficonWide   = Mathf.Abs(transform.GetChild(0).transform.position.x - transform.GetChild(2).transform.position.x);
    }
示例#2
0
    void Start()
    {
        dragitemcontroller = GameObject.Find("DragItemController").GetComponent <DragItemController>();
        movement           = GameObject.Find("Movement").GetComponent <Movement>();

        RooficonHeight = Mathf.Abs(bodyControlPointList[0].transform.position.y - bodyControlPointList[bodyControlPointList.Count - 1].transform.position.y);
        RooficonWide   = Mathf.Abs(bodyControlPointList[0].transform.position.x - bodyControlPointList[bodyControlPointList.Count - 1].transform.position.x);
        ini_ControlPoint_1_Position = bodyControlPointList[0].transform.position;

        basedRoofIcon = new BasedRoofIcon();
        basedRoofIcon.CreateBasedRoofIcon(this, "BasedRoofIcon_mesh", bodyControlPointList, tailControlPointList, ini_ControlPoint_1_Position);

        ControlPoint_1_position = bodyControlPointList[0].transform.position;
        ControlPoint_2_position = bodyControlPointList[1].transform.position;
        ControlPoint_3_position = bodyControlPointList[2].transform.position;

        //tail
        ControlPoint_4_position = tailControlPointList[0].transform.position;
        ControlPoint_5_position = tailControlPointList[1].transform.position;
    }
 protected override void Start()
 {
     base.Start();
     dragItemController = GameObject.Find("DragItemController").GetComponent <DragItemController>();
 }
示例#4
0
    /// <summary>
    /// Drop the item onto the specified object.
    /// </summary>

    protected virtual void OnDragDropRelease(GameObject surface)
    {
        if (!cloneOnDrag)
        {
            // Re-enable the collider
            if (mButton != null)
            {
                mButton.isEnabled = true;
            }
            else if (mCollider != null)
            {
                mCollider.enabled = true;
            }
            else if (mCollider2D != null)
            {
                mCollider2D.enabled = true;
            }

            // Is there a droppable container?
            UIDragDropContainer container = surface ? NGUITools.FindInParents <UIDragDropContainer>(surface) : null;

            if (container != null)
            {
                // Container found -- parent this object to the container
                mTrans.parent = (container.reparentTarget != null) ? container.reparentTarget : container.transform;

                Vector3 pos = mTrans.localPosition;
                pos.z = 0f;
                mTrans.localPosition = pos;
            }
            else
            {
                // No valid container under the mouse -- revert the item's parent
                mTrans.parent = mParent;
            }

            // Update the grid and table references
            mParent = mTrans.parent;
            mGrid   = NGUITools.FindInParents <UIGrid>(mParent);
            mTable  = NGUITools.FindInParents <UITable>(mParent);

            // Re-enable the drag scroll view script
            if (mDragScrollView != null)
            {
                StartCoroutine(EnableDragScrollView());
            }

            // Notify the widgets that the parent has changed
            NGUITools.MarkParentAsChanged(gameObject);

            if (mTable != null)
            {
                mTable.repositionNow = true;
            }
            if (mGrid != null)
            {
                mGrid.repositionNow = true;
            }
            // We're now done
            OnDragDropEnd();
        }
        else
        {
            NGUITools.Destroy(gameObject);
        }
        if (GameObject.Find("DragItemController"))
        {
            DragItemController item = GameObject.Find("DragItemController").GetComponent <DragItemController>();
            item.SetObjInWindows();
            item.chooseDragObject = null;
        }
    }
示例#5
0
    /// <summary>
    /// Perform any logic related to starting the drag & drop operation.
    /// </summary>

    protected virtual void OnDragDropStart()
    {
        // Automatically disable the scroll view
        if (mDragScrollView != null)
        {
            mDragScrollView.enabled = false;
        }

        // Disable the collider so that it doesn't intercept events
        if (mButton != null)
        {
            mButton.isEnabled = false;
        }
        else if (mCollider != null)
        {
            mCollider.enabled = false;
        }
        else if (mCollider2D != null)
        {
            mCollider2D.enabled = false;
        }

        mParent = mTrans.parent;
        mRoot   = NGUITools.FindInParents <UIRoot>(mParent);
        mGrid   = NGUITools.FindInParents <UIGrid>(mParent);
        mTable  = NGUITools.FindInParents <UITable>(mParent);

        // Re-parent the item
        if (UIDragDropRoot.root != null)
        {
            mTrans.parent = UIDragDropRoot.root;
        }

        Vector3 pos = mTrans.localPosition;

        pos.z = 0f;
        mTrans.localPosition = pos;

        TweenPosition tp = GetComponent <TweenPosition>();

        if (tp != null)
        {
            tp.enabled = false;
        }

        SpringPosition sp = GetComponent <SpringPosition>();

        if (sp != null)
        {
            sp.enabled = false;
        }

        // Notify the widgets that the parent has changed
        NGUITools.MarkParentAsChanged(gameObject);

        if (mTable != null)
        {
            mTable.repositionNow = true;
        }
        if (mGrid != null)
        {
            mGrid.repositionNow = true;
        }

        if (GameObject.Find("DragItemController"))
        {
            DragItemController item = GameObject.Find("DragItemController").GetComponent <DragItemController>();
            item.chooseDragObject = gameObject;
        }
    }
示例#6
0
 void Start()
 {
     dragitemcontroller = GameObject.Find("DragItemController").GetComponent <DragItemController>();
 }
示例#7
0
 void Start()
 {
     dragitemcontroller = GameObject.Find("DragItemController").GetComponent <DragItemController> ();
     hotSpot            = new Vector2(16, 16);
 }