PhotoWindowDragMove.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. using System;
  2. using UnityEngine;
  3. public class PhotoWindowDragMove : UIDragDropItem
  4. {
  5. public void Awake()
  6. {
  7. this.uiCamera = GameObject.Find("UI Root/Camera").GetComponent<Camera>();
  8. this.uiPanel = base.GetComponent<UIPanel>();
  9. }
  10. protected override void Update()
  11. {
  12. base.Update();
  13. if (this.mDragging && !NInput.GetMouseButton(0))
  14. {
  15. base.StopDragging(null);
  16. }
  17. if (0 < this.updateDraw)
  18. {
  19. this.updateDraw--;
  20. if (this.uiPanel != null && this.updateDraw % 2 == 0)
  21. {
  22. this.uiPanel.SetDirty();
  23. }
  24. }
  25. }
  26. protected override void StartDragging()
  27. {
  28. if (UICamera.currentKey != KeyCode.Mouse0)
  29. {
  30. return;
  31. }
  32. base.StartDragging();
  33. }
  34. protected override void OnDragDropMove(Vector2 delta)
  35. {
  36. base.OnDragDropMove(delta);
  37. }
  38. protected override void OnDragDropStart()
  39. {
  40. base.OnDragDropStart();
  41. this.updateDraw = 1;
  42. }
  43. protected override void OnDragDropRelease(GameObject surface)
  44. {
  45. base.OnDragDropRelease(surface);
  46. this.updateDraw = 6;
  47. }
  48. protected override Transform TaregetTrans
  49. {
  50. get
  51. {
  52. return this.WindowTransform;
  53. }
  54. }
  55. public Transform WindowTransform;
  56. private UIPanel uiPanel;
  57. private int updateDraw;
  58. private Camera uiCamera;
  59. }