public override void Draw(IGuiContainer container, Vector2 position) { if (Event.current.type == EventType.mouseDrag) { foreach (Action <Vector2> callback in mMouseDragCallbacks) { callback(Event.current.mousePosition); } } GUIContent buttonContent = BuildButtonContent(); Vector2 size = this.Size; Rect coords = new Rect(position.x, position.y, size.x, size.y); bool buttonClicked = false; IGuiStyle style = this.GetButtonStyle(); if (style != null) { GUIStyle style2 = style.GenerateUnityGuiStyle(this.Enabled); buttonClicked = GUI.RepeatButton(coords, buttonContent, style2); } else { buttonClicked = GUI.RepeatButton(coords, buttonContent); } if (buttonClicked && this.Enabled) { OnPressed(); } }
public override void Draw(IGuiContainer container, Vector2 position) { GUIContent buttonContent = BuildButtonContent(); Vector2 size = this.Size; Rect coords = new Rect(position.x, position.y, size.x, size.y); bool buttonClicked = false; IGuiStyle style = this.GetButtonStyle(); if (style != null) { GUIStyle style2 = style.GenerateUnityGuiStyle(mEnabled); buttonClicked = GUI.Button(coords, buttonContent, style2); } else { buttonClicked = GUI.Button(coords, buttonContent); } if (buttonClicked && mEnabled) { OnPressed(); } }