// <summary>
 // Receives regular notification of drag & drop events
 // pertaining to this object when an object is being
 // dragged.  This is called on potential drop targets
 // when an object is dragged over them.  It is also
 // called on the object(s) being dragged/dropped.
 // </summary>
 // <param name="parms">The EZDragDropParams structure which holds information about the event.</param>
 public void OnEZDragDrop_Internal(EZDragDropParams parms)
 {
     if (dragDropDelegate != null)
     {
         dragDropDelegate(parms);
     }
 }
Example #2
0
    public void DragDrop(EZDragDropParams a_sDragDropParams)
    {
        if (a_sDragDropParams.evt == EZDragDropEvent.Dropped && a_sDragDropParams.dragObj.DropTarget != null)
        {
            ImageSlot imageSlot = a_sDragDropParams.dragObj.Data as ImageSlot;
            if (imageSlot != null && !(imageSlot.c_oItem is ITEM))
            {
                return;
            }
            UIListItemContainer component = a_sDragDropParams.dragObj.DropTarget.GetComponent <UIListItemContainer>();
            if (component == null)
            {
                return;
            }
            ImageSlot imageSlot2 = component.Data as ImageSlot;
            if (imageSlot2 == null)
            {
                return;
            }
            if (imageSlot2.c_bDisable)
            {
                return;
            }
            G_ID windowID = (G_ID)imageSlot2.WindowID;
            if (windowID == G_ID.INVENTORY_DLG)
            {
                Inventory_Dlg inventory_Dlg = NrTSingleton <FormsManager> .Instance.GetForm(G_ID.INVENTORY_DLG) as Inventory_Dlg;

                if (inventory_Dlg != null)
                {
                }
            }
        }
    }
Example #3
0
 public void EditorDragDrop(EZDragDropParams dragDropParams)
 {
     if (dragDropParams.evt == EZDragDropEvent.Begin)
     {
         this.SetJoystickEnable(true);
         this.vStickDir = this.control.transform.localPosition - this.vStickPos;
         float num = Vector3.Distance(this.control.transform.localPosition, this.vStickPos);
         if (num > this.fLimitDistance)
         {
             Vector3 vector = this.vStickPos + this.vStickDir.normalized * this.fLimitDistance;
             this.control.SetLocation(vector.x, -vector.y);
         }
     }
     else if (dragDropParams.evt == EZDragDropEvent.Dropped)
     {
         this.SetJoystickEnable(false);
     }
     else if (dragDropParams.evt == EZDragDropEvent.Cancelled)
     {
         this.SetJoystickEnable(false);
     }
     else if (dragDropParams.evt == EZDragDropEvent.Update)
     {
         this.vStickDir = this.control.transform.localPosition - this.vStickPos;
         float num2 = Vector3.Distance(this.control.transform.localPosition, this.vStickPos);
         if (num2 > this.fLimitDistance)
         {
             Vector3 vector2 = this.vStickPos + this.vStickDir.normalized * this.fLimitDistance;
             this.control.SetLocation(vector2.x, -vector2.y);
         }
     }
 }
 public void OnEZDragDrop(EZDragDropParams parms)
 {
     if (this.dragDropDelegate != null)
     {
         this.dragDropDelegate(parms);
     }
 }
Example #5
0
    public void CancelDrag()
    {
        if (this == null || !this.isDragging)
        {
            return;
        }
        EZDragDropParams eZDragDropParams = new EZDragDropParams(EZDragDropEvent.Cancelled, this.host, default(POINTER_INFO));

        if (this.dropTarget != null)
        {
            this.dropTarget.SendMessage("OnEZDragDrop", eZDragDropParams, SendMessageOptions.DontRequireReceiver);
        }
        if (this.dragDropDelegate != null)
        {
            this.dragDropDelegate(eZDragDropParams);
        }
        this.dropTarget  = null;
        this.dropHandled = false;
        this.isDragging  = false;
        AnimatePosition.Do(this.host.gameObject, EZAnimation.ANIM_MODE.To, this.dragOriginOffset, EZAnimation.GetInterpolator(this.host.CancelDragEasing), this.host.CancelDragDuration, 0f, null, new EZAnimation.CompletionDelegate(this.FinishCancelDrag));
        if (UIManager.Exists())
        {
            NrTSingleton <UIManager> .Instance.Detarget(this.host);
        }
    }
Example #6
0
    /// <summary>
    /// Cancels any pending drag and drop operation.
    /// </summary>
    public void CancelDrag()
    {
        if (!isDragging)
        {
            return;
        }

        // Notify everyone involved:
        EZDragDropParams parms = new EZDragDropParams(EZDragDropEvent.Cancelled, host, default(POINTER_INFO));

        OnEZDragDrop_Internal(parms);

        dropTarget  = null;
        dropHandled = false;
        isDragging  = false;
        isCanceling = true;

        if (useDefaultCancelDragAnim)
        {
            DoDefaultCancelDrag();
        }

        // Since we are detargeting, send a release off event:
        POINTER_INFO ptr = default(POINTER_INFO);

        ptr.evt = POINTER_INFO.INPUT_EVENT.RELEASE_OFF;
        host.OnInput(ptr);

        if (UIManager.Exists())
        {
            UIManager.instance.Detarget(host);
        }
    }
Example #7
0
    public void OnEZDragDrop(EZDragDropParams parms)
    {
        if (this == null)
        {
            return;
        }
        if (this.host == null)
        {
            return;
        }
        EZDragDropEvent evt = parms.evt;

        if (evt == EZDragDropEvent.Begin)
        {
            if (this.host.transform == null)
            {
                return;
            }
            Transform transform = this.host.transform;
            if (transform == null)
            {
                return;
            }
            this.dragOrigin  = transform.localPosition;
            this.isDragging  = true;
            this.dropHandled = false;
            this.dragPlane.SetNormalAndPosition(transform.TransformDirection(transform.forward * -1f), transform.position);
            Ray   ray = parms.ptr.camera.ScreenPointToRay(parms.ptr.camera.WorldToScreenPoint(transform.position));
            float num;
            this.dragPlane.Raycast(ray, out num);
            this.dragOriginOffset = ray.origin + ray.direction * (num - this.host.DragOffset);
            if (transform.parent != null)
            {
                this.dragOriginOffset = transform.parent.InverseTransformPoint(this.dragOriginOffset);
            }
            this.touchCompensationOffset = new Vector3(-this.host.MouseOffset, this.host.MouseOffset, 0f);
        }
        if (this.dragDropDelegate != null)
        {
            this.dragDropDelegate(parms);
        }
        if (parms.evt == EZDragDropEvent.Dropped && parms.dragObj.Equals(this.host))
        {
            if (this.dropHandled)
            {
                this.isDragging = false;
                this.dropTarget = null;
            }
            else
            {
                this.CancelDrag();
            }
        }
    }
Example #8
0
	// <summary>
	// Receives regular notification of drag & drop events
	// pertaining to this object when an object is being
	// dragged.  This is called on potential drop targets
	// when an object is dragged over them.  It is also
	// called on the object(s) being dragged/dropped.
	// </summary>
	// <param name="parms">The EZDragDropParams structure which holds information about the event.</param>
	public void OnEZDragDrop_Internal(EZDragDropParams parms)
	{
		dragDropHelper.OnEZDragDrop_Internal(parms);
	}
Example #9
0
	// <summary>
	// Receives regular notification of drag & drop events
	// pertaining to this object when an object is being
	// dragged.  This is called on potential drop targets
	// when an object is dragged over them.  It is also
	// called on the object(s) being dragged/dropped.
	// </summary>
	// <param name="parms">The EZDragDropParams structure which holds information about the event.</param>
	public void OnEZDragDrop_Internal(EZDragDropParams parms)
	{
		if (dragDropDelegate != null)
			dragDropDelegate(parms);
	}
	public void OnEZDragDrop_Internal(EZDragDropParams parms) { }
Example #11
0
	/// <summary>
	/// Receives regular notification of drag & drop events
	/// pertaining to this object when an object is being
	/// dragged.  This is called on potential drop targets
	/// when an object is dragged over them.  It is also
	/// called on the object(s) being dragged/dropped.
	/// </summary>
	/// <param name="parms">The EZDragDropParams structure which holds information about the event.</param>
	public void OnEZDragDrop_Internal(EZDragDropParams parms)
	{
		//if (dragDrop_InternalDel != null)
		//	dragDrop_InternalDel(ref parms.ptr);

		switch (parms.evt)
		{
			case EZDragDropEvent.Begin:
				// First check to see if we are in mid-cancel:
				if (isCanceling)
					return;

				// Set initial flags:
				isDragging = true;
				dropHandled = false;

				// Save our initial local position:
				Transform transform = host.transform;
				dragOrigin = transform.localPosition;

				// Setup our drag plane:
				Transform camTrans = parms.ptr.camera.transform;
				dragPlane.SetNormalAndPosition(camTrans.forward * -1f, transform.position);

				// Find our offset drag origin:
				float dist;
				Ray ray = parms.ptr.camera.ScreenPointToRay(parms.ptr.camera.WorldToScreenPoint(transform.position));
				dragPlane.Raycast(ray, out dist);
				dragOriginOffset = ray.origin + ray.direction * (dist - host.DragOffset);
				if (transform.parent != null)
					dragOriginOffset = transform.parent.InverseTransformPoint(dragOriginOffset);

#if DONT_CENTER_OBJECT
				// Find the offset of the actual touch position
				// from our object center so that our object
				// doesn't just "jump" to be centered at the
				// touch position:
				dragPlane.Raycast(parms.ptr.ray, out dist);
				touchCompensationOffset = transform.position - (parms.ptr.ray.origin + parms.ptr.ray.direction * dist);
#endif
				break;
		}

		if (dragDropDelegate != null)
			dragDropDelegate(parms);

		if (dropTarget != null)
			dropTarget.SendMessage("OnEZDragDrop", parms, SendMessageOptions.DontRequireReceiver);

		// Notify our own GameObject:
		host.gameObject.SendMessage("OnEZDragDrop", parms, SendMessageOptions.DontRequireReceiver);

		// See if this was a good or bad drop of this object:
		if (parms.evt == EZDragDropEvent.Dropped && parms.dragObj.Equals(host))
		{
			if (dropHandled)
			{
				// A successful drop!
				isDragging = false;
				dropTarget = null;
			}
			else
			{
				// A failed drop:
				CancelDrag();
			}
		}
	}
Example #12
0
	/// <summary>
	/// Cancels any pending drag and drop operation.
	/// </summary>
	public void CancelDrag()
	{
		if (!isDragging)
			return;

		// Notify everyone involved:
		EZDragDropParams parms = new EZDragDropParams(EZDragDropEvent.Cancelled, host, default(POINTER_INFO));
		OnEZDragDrop_Internal(parms);

		dropTarget = null;
		dropHandled = false;
		isDragging = false;
		isCanceling = true;

		if(useDefaultCancelDragAnim)
			DoDefaultCancelDrag();

		// Since we are detargeting, send a release off event:
		POINTER_INFO ptr = default(POINTER_INFO);
		ptr.evt = POINTER_INFO.INPUT_EVENT.RELEASE_OFF;
		host.OnInput(ptr);

		if (UIManager.Exists())
 			UIManager.instance.Detarget(host);
	}
 public void OnEZDragDrop(EZDragDropParams parms)
 {
     this.dragDropHelper.OnEZDragDrop(parms);
 }
Example #14
0
 public void OnEZDragDrop_Internal(EZDragDropParams parms)
 {
 }
 // <summary>
 // Receives regular notification of drag & drop events
 // pertaining to this object when an object is being
 // dragged.  This is called on potential drop targets
 // when an object is dragged over them.  It is also
 // called on the object(s) being dragged/dropped.
 // </summary>
 // <param name="parms">The EZDragDropParams structure which holds information about the event.</param>
 public void OnEZDragDrop_Internal(EZDragDropParams parms)
 {
     dragDropHelper.OnEZDragDrop_Internal(parms);
 }
Example #16
0
    /// <summary>
    /// Receives regular notification of drag & drop events
    /// pertaining to this object when an object is being
    /// dragged.  This is called on potential drop targets
    /// when an object is dragged over them.  It is also
    /// called on the object(s) being dragged/dropped.
    /// </summary>
    /// <param name="parms">The EZDragDropParams structure which holds information about the event.</param>
    public void OnEZDragDrop_Internal(EZDragDropParams parms)
    {
        //if (dragDrop_InternalDel != null)
        //	dragDrop_InternalDel(ref parms.ptr);

        switch (parms.evt)
        {
        case EZDragDropEvent.Begin:
            // First check to see if we are in mid-cancel:
            if (isCanceling)
            {
                return;
            }

            // Set initial flags:
            isDragging  = true;
            dropHandled = false;

            // Save our initial local position:
            Transform transform = host.transform;
            dragOrigin = transform.localPosition;

            // Setup our drag plane:
            Transform camTrans = parms.ptr.camera.transform;
            dragPlane.SetNormalAndPosition(camTrans.forward * -1f, transform.position);

            // Find our offset drag origin:
            float dist;
            Ray   ray = parms.ptr.camera.ScreenPointToRay(parms.ptr.camera.WorldToScreenPoint(transform.position));
            dragPlane.Raycast(ray, out dist);
            dragOriginOffset = ray.origin + ray.direction * (dist - host.DragOffset);
            if (transform.parent != null)
            {
                dragOriginOffset = transform.parent.InverseTransformPoint(dragOriginOffset);
            }

#if DONT_CENTER_OBJECT
            // Find the offset of the actual touch position
            // from our object center so that our object
            // doesn't just "jump" to be centered at the
            // touch position:
            dragPlane.Raycast(parms.ptr.ray, out dist);
            touchCompensationOffset = transform.position - (parms.ptr.ray.origin + parms.ptr.ray.direction * dist);
#endif
            break;
        }

        if (dragDropDelegate != null)
        {
            dragDropDelegate(parms);
        }

        if (dropTarget != null)
        {
            dropTarget.SendMessage("OnEZDragDrop", parms, SendMessageOptions.DontRequireReceiver);
        }

        // Notify our own GameObject:
        host.gameObject.SendMessage("OnEZDragDrop", parms, SendMessageOptions.DontRequireReceiver);

        // See if this was a good or bad drop of this object:
        if (parms.evt == EZDragDropEvent.Dropped && parms.dragObj.Equals(host))
        {
            if (dropHandled)
            {
                // A successful drop!
                isDragging = false;
                dropTarget = null;
            }
            else
            {
                // A failed drop:
                CancelDrag();
            }
        }
    }
	public void DragDrop(EZDragDropParams a_sDragDropParams)
	{
	}