暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

TilePaletteContextMenuHandler.cs 865B

12345678910111213141516171819202122232425262728293031
  1. using System;
  2. using UnityEngine.UIElements;
  3. namespace UnityEditor.Tilemaps
  4. {
  5. internal class TilePaletteContextMenuHandler : MouseManipulator
  6. {
  7. private readonly Action m_ContextClick;
  8. public TilePaletteContextMenuHandler(Action contextClick)
  9. {
  10. m_ContextClick = contextClick;
  11. activators.Add(new ManipulatorActivationFilter { button = MouseButton.RightMouse });
  12. }
  13. protected override void RegisterCallbacksOnTarget()
  14. {
  15. target.RegisterCallback<ContextClickEvent>(OnContextClick);
  16. }
  17. protected override void UnregisterCallbacksFromTarget()
  18. {
  19. target.UnregisterCallback<ContextClickEvent>(OnContextClick);
  20. }
  21. private void OnContextClick(ContextClickEvent evt)
  22. {
  23. m_ContextClick?.Invoke();
  24. }
  25. }
  26. }