public bool Initialize(string buttonText, ButtonTextAlignment alignment, StretchableImageType background, StretchableImageType foreground, int xPos, int yPos, int width, int height, Random r, out string reason)
{
_xPos = xPos;
_yPos = yPos;
_width = width;
_height = height;
_alignment = alignment;
_backgroundImage = new BBStretchableImage();
_foregroundImage = new BBStretchableImage();
if (!_backgroundImage.Initialize(xPos, yPos, width, height, background, r, out reason))
{
return false;
}
if (!_foregroundImage.Initialize(xPos, yPos, width, height, foreground, r, out reason))
{
return false;
}
_label = new BBLabel();
if (!_label.Initialize(0, 0, string.Empty, Color.White, out reason))
{
return false;
}
SetText(buttonText);
Reset();
_timeSinceClick = 10; //10 seconds will exceed any double-click max interval
_doubleClicked = false;
reason = null;
return true;
}