private Rectangle GetOriginalBoxRect(EffectBox box) { if (box.HasParent && box.parent is EffectBox) { return(GetOriginalBoxRect(box.parent as EffectBox)); } return(box.OriginalRect); }
public Button(int x, int y, int width, int height, Texture2D texture, SpriteFont font, IsClickableObject[] objs, bool isThrowButton = false) : base(x, y, width, height, texture, null) { this.font = font; this.isThrowButton = isThrowButton; if (objs != null) { foreach (IsClickableObject obj in objs) { click += obj.onClick; } } if (!isThrowButton) { box = new EffectBox(x - BUTTON_RANGE, y - BUTTON_RANGE, (2 * BUTTON_RANGE) + width, (2 * BUTTON_RANGE) + height, Vector2.Zero, this); } else { box = new EffectBox(x - 5, y - 5, width + 10, height + 10, Vector2.Zero, this); } }