using System;
using System.Collections;
using UnityEngine;
using wf;

public class YotogiSkillIconDrag : UIDragDropItem
{
	public void Awake()
	{
		this.widget_ = base.GetComponent<UIWidget>();
		this.box_collider_ = base.GetComponent<BoxCollider>();
		this.button_ = base.GetComponent<UIButton>();
	}

	protected override void StartDragging()
	{
		if (UICamera.currentKey != KeyCode.Mouse0)
		{
			return;
		}
		base.StartDragging();
	}

	protected override void OnDragDropMove(Vector2 delta)
	{
		base.OnDragDropMove(delta);
	}

	protected override void OnDragDropStart()
	{
		this.back_up_depth_ = this.widget_.depth;
		this.backup_pos_ = base.transform.localPosition;
		this.widget_.depth = this.back_up_depth_ * 10;
		base.OnDragDropStart();
	}

	protected override void OnDragDropRelease(GameObject surface)
	{
		base.OnDragDropRelease(surface);
		this.widget_.depth = this.back_up_depth_;
		YotogiSkillIconDrag component = surface.GetComponent<YotogiSkillIconDrag>();
		if (component != null && surface != base.gameObject)
		{
			this.button_.PlaySoundClick();
			if (this.call_back_ != null)
			{
				this.call_back_(base.gameObject, surface);
			}
			this.MoveReset();
			component.MoveReset();
		}
		else
		{
			this.MoveReset();
		}
	}

	public void MoveReset()
	{
		this.box_collider_.enabled = false;
		Hashtable hashtable = TweenHash.EaseOutQuint(TweenHash.Type.Position, Vector3.zero, 0.3f);
		hashtable.Add("oncomplete", "OnMoveReset");
		hashtable.Add("oncompletetarget", base.gameObject);
		iTween.MoveTo(base.gameObject, hashtable);
	}

	public void SetOnOnDragChangeCallback(YotogiSkillIconDrag.OnDragChangeCallback event_function)
	{
		this.call_back_ = event_function;
	}

	public void OnMoveReset()
	{
		this.box_collider_.enabled = true;
	}

	private UIWidget widget_;

	private int back_up_depth_;

	private Vector3 backup_pos_;

	private BoxCollider box_collider_;

	private UIButton button_;

	private YotogiSkillIconDrag.OnDragChangeCallback call_back_;

	public delegate void OnDragChangeCallback(GameObject my_obj, GameObject target);
}
