您的位置:首页 > 产品设计 > UI/UE

NGUI(三)背包系统页面

2015-07-31 22:45 381 查看

NGUI(三)背包系统页面



MyDragDropItem:

using UnityEngine;
using System.Collections;

public class MyDragDropItem : UIDragDropItem {

	// Use this for initialization
    protected override void OnDragDropRelease(GameObject surface)
    {
        base.OnDragDropRelease(surface);
        if (surface.tag=="cell")
        {
            this.transform.parent = surface.transform;
            this.transform.localPosition = Vector3.zero;

        }
        else if(surface.tag=="MyDragDropItems")
        {
            Transform parent = surface.transform.parent;
            surface.transform.parent = this.transform.parent;
            surface.transform.localPosition = Vector3.zero;

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


Knapsack:

using UnityEngine;
using System.Collections;

public class Knapsack : MonoBehaviour {

    public GameObject[] cells;

	// Use this for initialization
	void Start () {
	
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: