public Initialize ( int x, int y, string label, Color color, string &reason ) : bool | ||
x | int | |
y | int | |
label | string | |
color | Color | |
reason | string | |
return | bool |
public StarSystem(string name, int id, int x, int y, Color color, string description, Random r) { this.Sprite = SpriteManager.GetSprite("Star", r); this.name = name; this.x = x; this.y = y; this.size = 1; ID = id; Color = color; exploredBy = new List<Empire>(); planets = new List<Planet>(); //type = StarType.NORMAL; string reason; StarName = new BBLabel(); StarName.Initialize(0, 0, name, Color.White, out reason); EmpiresWithFleetAdjacentLastTurn = new List<Empire>(); EmpiresWithFleetAdjacentThisTurn = new List<Empire>(); EmpiresWithPlanetsInThisSystem = new List<Empire>(); OwnerPercentage = new Dictionary<Empire, float>(); }
public bool Initialize(int xPos, int yPos, int width, int min, int max, int initialAmount, Random r, out string reason) { _enabled = true; _upButtonEnabled = true; _width = width; _upButton = new BBButton(); _downButton = new BBButton(); _valueLabel = new BBLabel(); if (!_upButton.Initialize("ScrollUpBGButton", "ScrollUpFGButton", string.Empty, ButtonTextAlignment.LEFT, xPos + width - 16, yPos, 16, 16, r, out reason)) { return false; } if (!_downButton.Initialize("ScrollDownBGButton", "ScrollDownFGButton", string.Empty, ButtonTextAlignment.LEFT, xPos, yPos, 16, 16, r, out reason)) { return false; } if (!_valueLabel.Initialize(xPos + width - 20, yPos, string.Empty, Color.White, out reason)) { return false; } _valueLabel.SetAlignment(true); _minimum = min; _maximum = max; Value = initialAmount; CheckAmount(); //Just in case _incrementAmount = 1; return true; }
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; }
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; }
public bool Initialize(string backgroundSprite, string foregroundSprite, string buttonText, string font, ButtonTextAlignment alignment, int xPos, int yPos, int width, int height, Random r, out string reason, int xTextOffset = 0, int yTextOffset = 0) { _backgroundSprite = SpriteManager.GetSprite(backgroundSprite, r); _foregroundSprite = SpriteManager.GetSprite(foregroundSprite, r); if (backgroundSprite == null || foregroundSprite == null) { reason = string.Format("One of those sprites does not exist in sprites.xml: \"{0}\" or \"{1}\"", backgroundSprite, foregroundSprite); return false; } _xPos = xPos; _yPos = yPos; _width = width; _height = height; _xTextOffset = xTextOffset; _yTextOffset = yTextOffset; _alignment = alignment; _label = new BBLabel(); if (string.IsNullOrEmpty(font)) { if (!_label.Initialize(0, 0, buttonText, Color.White, out reason)) { return false; } } else { if (!_label.Initialize(0, 0, buttonText, Color.White, font, out reason)) { return false; } } SetText(buttonText); Reset(); reason = null; return true; }