示例#1
0
        public UIButton(CCSprite sprite)
        {
            _sprite            = sprite;
            sprite.AnchorPoint = CCPoint.AnchorUpperLeft;
            AddChild(sprite);

            var clickListener = new CCEventListenerMouse();

            clickListener.OnMouseUp = (ev) =>
            {
                if (sprite.IsClickOnMe(ev) && OnClick != null)
                {
                    OnClick.Invoke(ev);
                }
            };
            AddEventListener(clickListener);
        }