No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

NesterStateWidget.cs 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. using System.Collections.Generic;
  3. namespace Unity.VisualScripting
  4. {
  5. public abstract class NesterStateWidget<TNesterState> : StateWidget<TNesterState>
  6. where TNesterState : class, INesterState
  7. {
  8. protected NesterStateWidget(StateCanvas canvas, TNesterState state) : base(canvas, state) { }
  9. protected override IEnumerable<DropdownOption> contextOptions
  10. {
  11. get
  12. {
  13. var childReference = reference.ChildReference(state, false);
  14. if (state.childGraph != null)
  15. {
  16. yield return new DropdownOption((Action)(() => window.reference = childReference), "Open");
  17. yield return new DropdownOption((Action)(() => GraphWindow.OpenTab(childReference)), "Open in new window");
  18. }
  19. foreach (var baseOption in base.contextOptions)
  20. {
  21. yield return baseOption;
  22. }
  23. }
  24. }
  25. protected override void OnDoubleClick()
  26. {
  27. if (state.graph.zoom == 1)
  28. {
  29. var childReference = reference.ChildReference(state, false);
  30. if (childReference != null)
  31. {
  32. if (e.ctrlOrCmd)
  33. {
  34. GraphWindow.OpenTab(childReference);
  35. }
  36. else
  37. {
  38. window.reference = childReference;
  39. }
  40. }
  41. e.Use();
  42. }
  43. else
  44. {
  45. base.OnDoubleClick();
  46. }
  47. }
  48. }
  49. }