using AX.InputSystem; using AX.MessageSystem; using UnityEngine; using UnityEngine.EventSystems; [RequireComponent(typeof(BaseGameObjInfo))] [RequireComponent(typeof(CreateStaticObjID))] public class PointerClickBase : MonoBehaviour,IPointerClickHandler { //点击委托 public delegate void PointerClickHandler(); //点击事件 public event PointerClickHandler OnRightClick; public void OnPointerClick(PointerEventData eventData) { switch (eventData.button) { case PointerEventData.InputButton.Left: break; case PointerEventData.InputButton.Right: var arg = new CmdArgs(); arg.currentCursorPos = Input.mousePosition; RegisterUIInputEvent.RegisterUIInputHistory(gameObject, this.GetType().Name, "rightClick", arg); if (OnRightClick!=null) { OnRightClick(); } break; case PointerEventData.InputButton.Middle: break; } } private void rightClick(CmdArgs arg) { if (GameSettings.othersSettings.playState != PlayState.None) { if (GameSettings.othersSettings.playState == PlayState.Playing) { CursorManager.GetInstance.SetClick(arg); } } if (OnRightClick!=null) { OnRightClick(); } } }