Пример #1
0
        public bool Initialize(List<string> backgroundSections, List<string> foregroundSections, bool isHorizontal, string buttonText, ButtonTextAlignment alignment, int xPos, int yPos, int width, int height, int fixedSize, int variableSize, Random r, out string reason)
        {
            _xPos = xPos;
            _yPos = yPos;
            _width = width;
            _height = height;
            _fixedSize = fixedSize;
            _variableSize = variableSize;
            _alignment = alignment;

            backgroundImage = new BBUniStretchableImage();
            foregroundImage = new BBUniStretchableImage();

            if (!backgroundImage.Initialize(xPos, yPos, width, height, fixedSize, variableSize, isHorizontal, backgroundSections, r, out reason))
            {
                return false;
            }
            if (!foregroundImage.Initialize(xPos, yPos, width, height, fixedSize, variableSize, isHorizontal, foregroundSections, r, out reason))
            {
                return false;
            }

            _label = new BBLabel();
            if (!_label.Initialize(0, 0, buttonText, Color.White, out reason))
            {
                return false;
            }

            Reset();

            reason = null;
            return true;
        }