123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- using System;
- using System.Collections;
- using UnityEngine;
- using wf;
- public class YotogiOldSkillIconDrag : 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_;
- YotogiOldSkillIconDrag component = surface.GetComponent<YotogiOldSkillIconDrag>();
- 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(YotogiOldSkillIconDrag.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 YotogiOldSkillIconDrag.OnDragChangeCallback call_back_;
- public delegate void OnDragChangeCallback(GameObject my_obj, GameObject target);
- }
|