示例#1
0
    public void SetOnClickListener(OnClickHandler handler)
    {
        var buttonComponent = this.GetComponent <Button>();

        buttonComponent.onClick.RemoveAllListeners();
        buttonComponent.onClick.AddListener(() => { handler(this.EventDto); });
    }
示例#2
0
 /// <summary>
 /// button构造函数
 /// </summary>
 /// <param name="nt">普通状态下材质</param>
 /// <param name="mt">鼠标移入时图片</param>
 /// <param name="pt">鼠标按下时图片</param>
 /// <param name="text">文字</param>
 /// <param name="bc">点击委托</param>
 /// <param name="x">绝对位置X</param>
 /// <param name="y">绝对位置Y</param>
 /// <param name="width">宽度</param>
 /// <param name="height">高度</param>
 public Button(Texture2D nt, Texture2D mt, Texture2D pt, string text, OnClickHandler bc,
                           int x, int y, int width, int height)
     : base(x, y, width, height)
 {
     NormalTexture = nt;
     CurrentTexture = NormalTexture;
     MoveInTexture = mt;
     PressTexture = pt;
     OnClick += new OnClickHandler(bc);
     this.text = text;
 }
示例#3
0
 public void OnPointerClick(PointerEventData eventData)
 {
     OnClickHandler?.Invoke(eventData);
 }
示例#4
0
 /// <summary>Set the menu we're populating with the recent files</summary>
 public void SetTargetMenu(ToolStripMenuItem menu, OnClickHandler on_click)
 {
     m_menu     = menu;
     m_on_click = on_click;
 }
示例#5
0
 public RecentFiles(ToolStripMenuItem menu, OnClickHandler on_click) : this()
 {
     SetTargetMenu(menu, on_click);
 }
示例#6
0
    // private Rigidbody rb;

    // private Vector3 screenPoint;
    //private Vector3 offset;
    // private Vector3 curPosition;
    // private Vector3 curScreenPoint;

    // private float speed = 25f;
    // private float hor;
    // private float ver;

    private void Start()
    {
        clickHandler = GetComponentInParent <OnClickHandler>();
        MR           = GetComponent <MeshRenderer>();
        // rb = GetComponent<Rigidbody>();
    }
 public void addClickListener(OnClickHandler action)
 {
     click += action;
 }
示例#8
0
 public void OnClick(object sender, EventArgs e)
 {
     OnClickHandler?.Invoke(sender, e);
 }