/// <summary> /// This function is called after all of the XmlSkinnable fields have been filled /// with appropriate data. /// Use this to do any construction work other than simple data member assignments, /// for example, initializing new reference types, extra calculations, etc.. /// </summary> public override sealed void FinalizeConstruction() { base.FinalizeConstruction(); if (_fontName == null) { _fontName = string.Empty; } if (_fontName != "" && _fontName != "-") { _font = GUIFontManager.GetFont(_fontName); } GUILocalizeStrings.LocalizeLabel(ref _labelText); if (_labelText == null) { _labelText = string.Empty; } if (_labelText.IndexOf("#") >= 0) { _containsProperty = true; } CachedLabel(); }
public override void FinalizeConstruction() { base.FinalizeConstruction(); _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _focusedTextureName); _imageFocused.ParentControl = this; _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _nonFocusedTextureName); _imageNonFocused.ParentControl = this; _imageAlternativeFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _alternativeFocusTextureName); _imageAlternativeFocused.ParentControl = this; _imageAlternativeNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _alternativeNonFocusTextureName); _imageAlternativeNonFocused.ParentControl = this; GUILocalizeStrings.LocalizeLabel(ref _label); _shadow = (_shadowAngle > 0) || (_shadowDistance > 0); _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName, _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_MIDDLE, false, _shadowAngle, _shadowDistance, _shadowColor); _labelControl.TextAlignment = _textAlignment; _labelControl.TextVAlignment = _textVAlignment; _labelControl.DimColor = DimColor; _labelControl.ParentControl = this; }
/// <summary> /// This function is called after all of the XmlSkinnable fields have been filled /// with appropriate data. /// Use this to do any construction work other than simple data member assignments, /// for example, initializing new reference types, extra calculations, etc.. /// </summary> public override sealed void FinalizeConstruction() { base.FinalizeConstruction(); GUILocalizeStrings.LocalizeLabel(ref _label); // The labelTail is used to fill the backend of a scrolling label for both wrapping and non-wrapping labels // The wrapString is the text that joins the back to the front of a wrapping label (not used if the label should not wrap). if (_userWrapString.Length > 0) { _labelTail = "" + _userWrapString[_userWrapString.Length - 1]; _wrapString = _userWrapString.Substring(0, _userWrapString.Length - 1); } _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName, _label, _textColor, _textAlignment, _textVAlignment, false, _shadowAngle, _shadowDistance, _shadowColor) { CacheFont = false, ParentControl = this }; _labelControl.SetAnimations(Animations); if (_fontName != "" && _fontName != "-") { _font = GUIFontManager.GetFont(_fontName); } if (_label.IndexOf("#", System.StringComparison.Ordinal) >= 0) { _containsProperty = true; } }
public override void FinalizeConstruction() { base.FinalizeConstruction(); int x1 = 16; int y1 = 16; GUIGraphicsContext.ScalePosToScreenResolution(ref x1, ref y1); _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _textureFocusName); _imageFocused.ParentControl = this; _imageFocused.DimColor = DimColor; _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _textureNoFocusName); _imageNonFocused.ParentControl = this; _imageNonFocused.DimColor = DimColor; _imageBackground = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _backgroundTextureName); _imageBackground.ParentControl = this; _imageBackground.DimColor = DimColor; _imageLeft = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _leftTextureWidth, _leftTextureHeight, _leftTextureName); _imageLeft.DimColor = DimColor; _imageLeft.ParentControl = this; _imageLeftFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _leftTextureFocusWidth, _leftTextureFocusHeight, _leftFocusName); _imageLeftFocus.ParentControl = this; _imageLeftFocus.DimColor = DimColor; _imageRight = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _rightTextureWidth, _rightTextureHeight, _rightTextureName); _imageRight.ParentControl = this; _imageRight.DimColor = DimColor; _imageRightFocus = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _rightTextureFocusWidth, _rightTextureFocusHeight, _rightFocusName); _imageRightFocus.ParentControl = this; _imageRightFocus.DimColor = DimColor; if (_fontName != "" && _fontName != "-") { _font = GUIFontManager.GetFont(_fontName); } GUILocalizeStrings.LocalizeLabel(ref _label); _imageFocused.Filtering = false; _imageNonFocused.Filtering = false; _imageBackground.Filtering = false; _imageLeft.Filtering = false; _imageLeftFocus.Filtering = false; _imageRight.Filtering = false; _imageRightFocus.Filtering = false; _labelControl = new GUILabelControl(_parentControlId); _labelControl.CacheFont = true; _labelControl.ParentControl = this; _labelControl.SetShadow(_shadowAngle, _shadowDistance, _shadowColor); }
/// <summary> /// This method gets called when the control is created and all properties has been set /// It allows the control to do any initialization /// </summary> public override sealed void FinalizeConstruction() { base.FinalizeConstruction(); _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _focusedTextureName); _imageFocused.ParentControl = this; _imageFocused.Filtering = false; _imageFocused.DimColor = DimColor; _imageFocused.SetBorder(_strBorderTF, _borderPositionTF, _borderTextureRepeatTF, _borderTextureRotateTF, _borderTextureFileNameTF, _borderColorKeyTF, _borderHasCornersTF, _borderCornerTextureRotateTF); _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _nonFocusedTextureName); _imageNonFocused.ParentControl = this; _imageNonFocused.Filtering = false; _imageNonFocused.DimColor = DimColor; _imageNonFocused.SetBorder(_strBorderTNF, _borderPositionTNF, _borderTextureRepeatTNF, _borderTextureRotateTNF, _borderTextureFileNameTNF, _borderColorKeyTNF, _borderHasCornersTNF, _borderCornerTextureRotateTNF); GUILocalizeStrings.LocalizeLabel(ref _label); if (_scrollStartDelay < 0) { _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName, _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false, _shadowAngle, _shadowDistance, _shadowColor); ((GUILabelControl)_labelControl).TextAlignment = _textAlignment; ((GUILabelControl)_labelControl).TextVAlignment = _textVAlignment; } else { _labelControl = new GUIFadeLabel(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, _shadowAngle, _shadowDistance, _shadowColor, _userWrapString); ((GUIFadeLabel)_labelControl).TextAlignment = _textAlignment; ((GUIFadeLabel)_labelControl).TextVAlignment = _textVAlignment; ((GUIFadeLabel)_labelControl).AllowScrolling = false; ((GUIFadeLabel)_labelControl).AllowFadeIn = false; } _labelControl.ParentControl = this; _labelControl.DimColor = DimColor; checkMark = new GUICheckMarkControl(0, 0, _positionX + _width - _checkMarkWidth, _positionY, _checkMarkWidth, _checkMarkHeight, _checkMarkFocusTextureName, _checkMarkNoFocusTextureName, _checkMarkWidth, _checkMarkHeight, Alignment.ALIGN_LEFT) { ParentControl = this, DimColor = DimColor }; }
private static void AddSubitemsToControl(XmlNode subItemsNode, GUIControl control) { XmlNodeList subNodes = subItemsNode.SelectNodes("subitems/subitem/text()"); foreach (XmlNode subNode in subNodes) { string strSubItem = subNode.Value; if (Char.IsDigit(strSubItem[0])) { GUILocalizeStrings.LocalizeLabel(ref strSubItem); } control.AddSubItem(strSubItem); } }
/// <summary> /// This method gets called when the control is created and all properties has been set /// It allows the control todo any initialization /// </summary> public override void FinalizeConstruction() { base.FinalizeConstruction(); _imageCheckMarkFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _checkMarkWidth, _checkMarkHeight, _checkMarkFocusTextureName); _imageCheckMarkFocused.ParentControl = this; _imageCheckMarkFocused.DimColor = DimColor; _imageCheckMarkNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _checkMarkWidth, _checkMarkHeight, _checkMarkNoFocusTextureName); _imageCheckMarkNonFocused.ParentControl = this; _imageCheckMarkNonFocused.DimColor = DimColor; if (_fontName != "" && _fontName != "-") { _font = GUIFontManager.GetFont(_fontName); } GUILocalizeStrings.LocalizeLabel(ref _label); }
public static object SkinSetString(params object[] args) { // args[0] - setting name // args[1] - (optional) new value // args[2] - (optional) keyboard prompt string newValue = ""; // Set the setting to the specified string. If no value is specified then present the keyboard to input the value. if (args.Length == 2) { int condition = GUIInfoManager.TranslateSingleString("skin.setstring(" + args[0] + ")"); newValue = args[1].ToString(); GUIInfoManager.SetString(condition, newValue, 0); } else { // No value was provided for the skin setting. Display a keyboard and ask for a value. string prompt = ""; if (args.Length >= 3) { newValue = args[1].ToString(); prompt = args[2].ToString(); GUILocalizeStrings.LocalizeLabel(ref prompt); } // Get the current value to initialize the keyboard. int condition = GUIInfoManager.TranslateSingleString("skin.setstring(" + args[0] + "," + newValue + "," + prompt + ")"); string userInput = GUIInfoManager.GetString(condition, 0); if (GetUserInputString(ref userInput, prompt)) { GUIInfoManager.SetString(condition, userInput, 0); } else { // Keyboard cancelled; no value supplied and no input was entered into the keyboard. } } return(newValue); }
public override sealed void FinalizeConstruction() { base.FinalizeConstruction(); _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _focusedTextureName); _imageFocused.ParentControl = this; _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _nonFocusedTextureName); _imageNonFocused.ParentControl = this; _imageAlternativeFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _alternativeFocusTextureName); _imageAlternativeFocused.ParentControl = this; _imageAlternativeNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _alternativeNonFocusTextureName); _imageAlternativeNonFocused.ParentControl = this; GUILocalizeStrings.LocalizeLabel(ref _label); if (_scrollStartDelay < 0) { _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName, _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_MIDDLE, false, _shadowAngle, _shadowDistance, _shadowColor); ((GUILabelControl)_labelControl).TextAlignment = _textAlignment; ((GUILabelControl)_labelControl).TextVAlignment = _textVAlignment; } else { _labelControl = new GUIFadeLabel(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, _shadowAngle, _shadowDistance, _shadowColor, _userWrapString); ((GUIFadeLabel)_labelControl).TextAlignment = _textAlignment; ((GUIFadeLabel)_labelControl).TextVAlignment = _textVAlignment; ((GUIFadeLabel)_labelControl).AllowScrolling = false; ((GUIFadeLabel)_labelControl).AllowFadeIn = false; } _labelControl.ParentControl = this; _labelControl.DimColor = DimColor; }
/// <summary> /// This method gets called when the control is created and all properties has been set /// It allows the control todo any initialization /// </summary> public override void FinalizeConstruction() { base.FinalizeConstruction(); _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _focusedTextureName); _imageFocused.ParentControl = this; _imageFocused.Filtering = false; _imageFocused.DimColor = DimColor; _imageFocused.SetBorder(_strBorderTF, _borderPositionTF, _borderTextureRepeatTF, _borderTextureRotateTF, _borderTextureFileNameTF, _borderColorKeyTF, _borderHasCornersTF, _borderCornerTextureRotateTF); _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _nonFocusedTextureName); _imageNonFocused.ParentControl = this; _imageNonFocused.Filtering = false; _imageNonFocused.DimColor = DimColor; _imageNonFocused.SetBorder(_strBorderTNF, _borderPositionTNF, _borderTextureRepeatTNF, _borderTextureRotateTNF, _borderTextureFileNameTNF, _borderColorKeyTNF, _borderHasCornersTNF, _borderCornerTextureRotateTNF); GUILocalizeStrings.LocalizeLabel(ref _label); _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName, _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false, _shadowAngle, _shadowDistance, _shadowColor); _labelControl.ParentControl = this; _labelControl.DimColor = DimColor; _labelControl.TextAlignment = _textAlignment; _labelControl.TextVAlignment = _textVAlignment; checkMark = new GUICheckMarkControl(0, 0, _positionX + _width - _checkMarkWidth, _positionY, _checkMarkWidth, _checkMarkHeight, _checkMarkFocusTextureName, _checkMarkNoFocusTextureName, _checkMarkWidth, _checkMarkWidth, Alignment.ALIGN_LEFT); checkMark.ParentControl = this; checkMark.DimColor = DimColor; }
/// <summary> /// This method gets called when the control is created and all properties has been set /// It allows the control to do any initialization /// </summary> public override void FinalizeConstruction() { base.FinalizeConstruction(); _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _focusedTextureName); _imageFocused.ParentControl = this; _imageFocused.Filtering = false; _imageFocused.DimColor = DimColor; _imageFocused.ColourDiffuse = ColourDiffuse; _imageFocused.SetBorder(_strBorderTF, _borderPositionTF, _borderTextureRepeatTF, _borderTextureRotateTF, _borderTextureFileNameTF, _borderColorKeyTF, _borderHasCornersTF, _borderCornerTextureRotateTF); TileFillTF = _textureFocusTileFill; _imageFocused.MaskFileName = _focusedTextureMask; _imageFocused.OverlayFileName = _overlayTF; _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _nonFocusedTextureName); _imageNonFocused.ParentControl = this; _imageNonFocused.Filtering = false; _imageNonFocused.DimColor = DimColor; _imageNonFocused.ColourDiffuse = ColourDiffuse; _imageNonFocused.SetBorder(_strBorderTNF, _borderPositionTNF, _borderTextureRepeatTNF, _borderTextureRotateTNF, _borderTextureFileNameTNF, _borderColorKeyTNF, _borderHasCornersTNF, _borderCornerTextureRotateTNF); TileFillTNF = _textureNoFocusTileFill; _imageNonFocused.MaskFileName = _nonFocusedTextureMask; _imageNonFocused.OverlayFileName = _overlayTNF; if (_hoverFilename != string.Empty) { GUIGraphicsContext.ScaleRectToScreenResolution(ref _hoverX, ref _hoverY, ref _hoverWidth, ref _hoverHeight); _hoverImage = LoadAnimationControl(_parentControlId, _controlId, _hoverX, _hoverY, _hoverWidth, _hoverHeight, _hoverFilename); _hoverImage.ParentControl = this; _hoverImage.DimColor = DimColor; _hoverImage.ColourDiffuse = ColourDiffuse; _hoverImage.SetBorder(_strBorderH, _borderPositionH, _borderTextureRepeatH, _borderTextureRotateH, _borderTextureFileNameH, _borderColorKeyH, _borderHasCornersH, _borderCornerTextureRotateH); TileFillH = _hoverTileFill; _hoverImage.MaskFileName = _hoverMask; _hoverImage.OverlayFileName = _overlayH; } GUILocalizeStrings.LocalizeLabel(ref _label); // Use a GUIFadeLabel if a valid scrollStartDelay is specified, otherwise use a GUILabelControl (default) if (_scrollStartDelay < 0) { _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName, _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false, _shadowAngle, _shadowDistance, _shadowColor); ((GUILabelControl)_labelControl).TextAlignment = _textAlignment; ((GUILabelControl)_labelControl).TextVAlignment = _textVAlignment; } else { _labelControl = new GUIFadeLabel(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, _shadowAngle, _shadowDistance, _shadowColor, _userWrapString); ((GUIFadeLabel)_labelControl).TextAlignment = _textAlignment; ((GUIFadeLabel)_labelControl).TextVAlignment = _textVAlignment; ((GUIFadeLabel)_labelControl).AllowScrolling = false; ((GUIFadeLabel)_labelControl).AllowFadeIn = false; } _labelControl.DimColor = DimColor; _labelControl.ParentControl = this; }
/// <summary> /// This method gets called when the control is created and all properties has been set /// It allows the control todo any initialization /// </summary> public override void FinalizeConstruction() { base.FinalizeConstruction(); _imageFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _focusedTextureName); _imageFocused.ParentControl = this; _imageFocused.Filtering = false; _imageFocused.DimColor = DimColor; _imageFocused.SetBorder(_strBorderTF, _borderPositionTF, _borderTextureRepeatTF, _borderTextureRotateTF, _borderTextureFileNameTF, _borderColorKeyTF, _borderHasCornersTF, _borderCornerTextureRotateTF); _imageNonFocused = LoadAnimationControl(_parentControlId, _controlId, _positionX, _positionY, _width, _height, _nonFocusedTextureName); _imageNonFocused.ParentControl = this; _imageNonFocused.Filtering = false; _imageNonFocused.DimColor = DimColor; _imageNonFocused.SetBorder(_strBorderTNF, _borderPositionTNF, _borderTextureRepeatTNF, _borderTextureRotateTNF, _borderTextureFileNameTNF, _borderColorKeyTNF, _borderHasCornersTNF, _borderCornerTextureRotateTNF); GUILocalizeStrings.LocalizeLabel(ref _label); if (_scrollStartDelay < 0) { _labelControl = new GUILabelControl(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName, _label, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, false, _shadowAngle, _shadowDistance, _shadowColor); ((GUILabelControl)_labelControl).ParentControl = this; ((GUILabelControl)_labelControl).DimColor = DimColor; ((GUILabelControl)_labelControl).TextAlignment = _textAlignment; ((GUILabelControl)_labelControl).TextVAlignment = _textVAlignment; } else { _labelControl = new GUIFadeLabel(_parentControlId, 0, _positionX, _positionY, _width, _height, _fontName, _textColor, Alignment.ALIGN_LEFT, VAlignment.ALIGN_TOP, _shadowAngle, _shadowDistance, _shadowColor, _userWrapString); ((GUIFadeLabel)_labelControl).TextAlignment = _textAlignment; ((GUIFadeLabel)_labelControl).TextVAlignment = _textVAlignment; ((GUIFadeLabel)_labelControl).AllowScrolling = false; ((GUIFadeLabel)_labelControl).AllowFadeIn = false; } string spinFontName = _fontName; if (_spinTextInButton) { // When the spin control font name is null the spin control will not render the text. // _spinTextInButton will render the spin control text in the button label. spinFontName = null; } _spinControl = new GUISpinControl(GetID, 0, _positionX + _width - _spinWidth, _positionY, _spinWidth, _spinHeight, _upTextureName, _downTextureName, _upTextureNameFocus, _downTextureNameFocus, spinFontName, _textColor, _spinType, _spinAlignment); _spinControl.ParentControl = this; _spinControl.DimColor = DimColor; _spinControl.ShowRange = _showRange; _spinControl.Digits = _digits; _spinControl.SetReverse(_reverse); _spinControl.Orientation = _orientation; _spinControl.CycleItems = _cycleItems; _spinControl.SetShadow(_shadowAngle, _shadowDistance, _shadowColor); _spinControl.PrefixText = _prefixText; _spinControl.SuffixText = _suffixText; _spinControl.TextOffsetX = _spinTextOffsetX; _spinControl.TextOffsetY = _spinTextOffsetY; // Pass all of the subitems to the spin control. for (int i = 0; i < SubItemCount; ++i) { _spinControl.AddSubItem(GetSubItem(i)); } for (int i = 0; i < SubItemCount; ++i) { RemoveSubItem(i); } }