NGUI 背包系统的拖拽

来源:互联网 发布:采购办公软件 编辑:程序博客网 时间:2024/06/05 20:31

1.使用拖拽脚本进行拖拽

2.通过重写脚本

using UnityEngine;
using System.Collections;


public class MyDraDropitem : UIDragDropItem {


    protected override void OnDragDropRelease(GameObject surface)
    {
        base.OnDragDropRelease(surface);
        if (surface .transform.childCount>0)
        {


        }
        else
        {


        }
        this.transform.parent = surface.transform;
        this.transform.localPosition = Vector3.zero;
    }




}



3.通过节点

using UnityEngine;
using System.Collections;


public class Knapsack : MonoBehaviour {


public GameObject[] cells;

}

数组来确定cell的 位置

http://www.taikr.com/course/34/learn#lesson/1228

0 0
原创粉丝点击