Exemplo n.º 1
0
    //拖拽释放,没有落在停靠表面的处理
    void DragDropReleaseLostSurface()
    {
        QKDragDropSurface cm_ownersurface = null;

        {
            if (OwnerSurface != null)
            {
                cm_ownersurface = OwnerSurface.GetComponent <QKDragDropSurface>();
            }
        }

        NotifyDragDropCancelling(OwnerSurface, this);

        if (cm_ownersurface != null && cm_ownersurface.FlyOnCancel && UIFlyRoot.Single != null)//飞回
        {
            UIFly cmFly = UIFly.Go(gameObject, m_StartPos, cm_ownersurface.FlyStrength);
            //cmFly.flyFinishedAction = UIFly.FlyFinishedAction.DestroyGameobject;
            cmFly.StartFly(OnFlyEnd);
        }
        else//直接销毁
        {
            if (!m_bkCloneOnDrag)//拖拽的时候没有进行克隆
            {
                NotifyDragDropLeaveItem(m_bkDropSurface, this);//通知旧容器 对象离开
            }
            //通知容器 拖拽取消
            NotifyDragDropCancel(OwnerSurface, this);

            //销毁物体
            NGUITools.Destroy(gameObject);
        }
    }
Exemplo n.º 2
0
    static public UIFly Go(GameObject go, Vector3 pos, float strength)
    {
        UIFly sp = go.GetComponent <UIFly>();

        if (sp == null)
        {
            sp = go.AddComponent <UIFly>();
        }
        sp.target   = pos;
        sp.strength = strength;
        //sp.evt_Finished = null;
        sp.worldSpace        = true;
        sp.InFlyLayer        = true;
        sp.flyFinishedAction = FlyFinishedAction.Nothing;

        return(sp);
    }