Esempio n. 1
0
    private void DoAddStatusItem(StatusItemGroup.Entry status_item, StatusItemCategory category, bool show_immediate = false)
    {
        GameObject       gameObject      = statusItemsFolder;
        Color            color           = (status_item.item.notificationType != NotificationType.BadMinor && status_item.item.notificationType != NotificationType.Bad && status_item.item.notificationType != NotificationType.DuplicantThreatening) ? statusItemTextColor_regular : statusItemTextColor_bad;
        TextStyleSetting style           = (category != Db.Get().StatusItemCategories.Main) ? StatusItemStyle_Other : StatusItemStyle_Main;
        StatusItemEntry  statusItemEntry = new StatusItemEntry(status_item, category, StatusItemPrefab, gameObject.transform, ToolTipStyle_Property, color, style, show_immediate, OnStatusItemDestroy);

        statusItemEntry.SetSprite(status_item.item.sprite);
        if (category != null)
        {
            int num = -1;
            List <StatusItemEntry> list = oldStatusItems.FindAll((StatusItemEntry e) => e.category == category);
            foreach (StatusItemEntry item in list)
            {
                num = item.GetIndex();
                item.Destroy(true);
                oldStatusItems.Remove(item);
            }
            if (category == Db.Get().StatusItemCategories.Main)
            {
                num = 0;
            }
            if (num != -1)
            {
                statusItemEntry.SetIndex(num);
            }
        }
        statusItems.Add(statusItemEntry);
    }
Esempio n. 2
0
 private string OnPriorityButtonTooltip(PriorityButton b)
 {
     b.tooltip.ClearMultiStringTooltip();
     if ((UnityEngine.Object)identity != (UnityEngine.Object)null)
     {
         Attributes attributes = identity.GetAttributes();
         if (attributes != null)
         {
             if (!consumer.IsPermittedByTraits(b.choreGroup))
             {
                 string newString = string.Format(UI.TOOLTIPS.JOBSSCREEN_CANNOTPERFORMTASK, consumer.GetComponent <MinionIdentity>().GetProperName());
                 b.tooltip.AddMultiStringTooltip(newString, TooltipTextStyle_AbilityNegativeModifier);
                 return(string.Empty);
             }
             b.tooltip.AddMultiStringTooltip(UI.TOOLTIPS.JOBSSCREEN_RELEVANT_ATTRIBUTES, TooltipTextStyle_Ability);
             Klei.AI.Attribute attribute         = b.choreGroup.attribute;
             AttributeInstance attributeInstance = attributes.Get(attribute);
             float             totalValue        = attributeInstance.GetTotalValue();
             TextStyleSetting  styleSetting      = TooltipTextStyle_Ability;
             if (totalValue > 0f)
             {
                 styleSetting = TooltipTextStyle_AbilityPositiveModifier;
             }
             else if (totalValue < 0f)
             {
                 styleSetting = TooltipTextStyle_AbilityNegativeModifier;
             }
             b.tooltip.AddMultiStringTooltip(attribute.Name + " " + attributeInstance.GetTotalValue(), styleSetting);
         }
     }
     return(string.Empty);
 }
 public void DrawText(string text, TextStyleSetting style, Color color, bool override_color = true)
 {
     if (skin.drawWidgets)
     {
         BeginSample("DrawText");
         Pool <LocText> .Entry entry = textWidgets.Draw(currentPos);
         LocText widget = entry.widget;
         Color   color2 = Color.white;
         if ((UnityEngine.Object)widget.textStyleSetting != (UnityEngine.Object)style)
         {
             widget.textStyleSetting = style;
             widget.ApplySettings();
         }
         if ((UnityEngine.Object)style != (UnityEngine.Object)null)
         {
             color2 = style.textColor;
         }
         if (override_color)
         {
             color2 = color;
         }
         widget.color = color2;
         if (widget.text != text)
         {
             widget.text = text;
             widget.KForceUpdateDirty();
         }
         currentPos.x += widget.renderedWidth;
         maxShadowX    = Mathf.Max(currentPos.x, maxShadowX);
         minLineHeight = (int)Mathf.Max((float)minLineHeight, widget.renderedHeight);
         EndSample();
     }
 }
        private void ItemCardStatus(HoverTextDrawer hoverTextDrawer, KSelectable kselectable3)
        {
            // 何故IEnumerable<Entry>を宣言してないのか???
            List <StatusItemGroup.Entry> entries = new List <StatusItemGroup.Entry>();

            foreach (StatusItemGroup.Entry entry in kselectable3.GetStatusItemGroup())
            {
                entries.Add(entry);
            }

            var a = entries.
                    Where((e) => __private_accessor.ShowStatusItemInCurrentOverlay(e.item)).
                    OrderBy((e) => e.category != null && e.category.Id != "Main" ? 0 : 1).
                    Take(SelectToolHoverTextCard.maxNumberOfDisplayedSelectableWarnings);

            foreach (StatusItemGroup.Entry entry in entries)
            {
                Sprite icon = entry.item.sprite?.sprite ?? __this.iconWarning;

                Color            color = __this.Styles_BodyText.Standard.textColor;
                TextStyleSetting style = __this.Styles_BodyText.Standard;
                if (__private_accessor.IsStatusItemWarning(entry))
                {
                    color = __this.HoverTextStyleSettings[1].textColor;
                    style = __this.HoverTextStyleSettings[1];
                }

                hoverTextDrawer.NewLine(26);
                hoverTextDrawer.DrawIcon(icon, color, 18, 2);
                hoverTextDrawer.DrawText(entry.GetName(), style);
            }
        }
Esempio n. 5
0
 public StatusItemEntry(StatusItemGroup.Entry item, StatusItemCategory category, GameObject status_item_prefab, Transform parent, TextStyleSetting tooltip_style, Color color, TextStyleSetting style, bool skip_fade, Action <StatusItemEntry> onDestroy)
 {
     this.item      = item;
     this.category  = category;
     tooltipStyle   = tooltip_style;
     this.onDestroy = onDestroy;
     this.color     = color;
     this.style     = style;
     widget         = Util.KInstantiateUI(status_item_prefab, parent.gameObject, false);
     text           = widget.GetComponentInChildren <LocText>(true);
     SetTextStyleSetting.ApplyStyle(text, style);
     toolTip = widget.GetComponentInChildren <ToolTip>(true);
     image   = widget.GetComponentInChildren <Image>(true);
     item.SetIcon(image);
     widget.SetActive(true);
     toolTip.OnToolTip = OnToolTip;
     button            = widget.GetComponentInChildren <KButton>();
     if (item.item.statusItemClickCallback != null)
     {
         button.onClick += OnClick;
     }
     else
     {
         button.enabled = false;
     }
     fadeStage = (skip_fade ? FadeStage.WAIT : FadeStage.IN);
     SimAndRenderScheduler.instance.Add(this, false);
     Refresh();
     SetColor(1f);
 }
Esempio n. 6
0
 internal DialogButton(string key, string text, string tooltip,
                       ColorStyleSetting backColor, TextStyleSetting foreColor)
 {
     this.backColor = backColor;
     this.key       = key;
     this.text      = text;
     this.tooltip   = tooltip;
     textColor      = foreColor;
 }
    protected void DrawInstructions(HoverTextScreen screen, HoverTextDrawer drawer)
    {
        TextStyleSetting standard = Styles_Instruction.Standard;

        drawer.NewLine(26);
        drawer.DrawIcon(screen.GetSprite("icon_mouse_left"), 20);
        drawer.DrawText(ActionName, standard);
        drawer.AddIndent(8);
        drawer.DrawIcon(screen.GetSprite("icon_mouse_right"), 20);
        drawer.DrawText(backStr, standard);
    }
Esempio n. 8
0
        /// <summary>
        /// Shared routine to spawn UI text objects.
        /// </summary>
        /// <param name="parent">The parent object for the text.</param>
        /// <param name="style">The text style to use.</param>
        /// <param name="contents">The default text.</param>
        /// <returns>The child text object.</returns>
        protected static LocText TextChildHelper(GameObject parent, TextStyleSetting style,
                                                 string contents = "")
        {
            var textChild = PUIElements.CreateUI(parent, "Text");
            var locText   = PUIElements.AddLocText(textChild, style);

            // Font needs to be set before the text
            locText.alignment = TMPro.TextAlignmentOptions.Center;
            locText.text      = contents;
            return(locText);
        }
Esempio n. 9
0
 internal ExtendedThermalTooltip(ThermalTooltipsOptions options)
 {
     this.options   = options;
     Cell           = 0;
     PrimaryElement = null;
     Drawer         = null;
     Style          = null;
     spriteDash     = Assets.GetSprite("dash");
     spriteCold     = Assets.GetSprite("crew_state_temp_down");
     spriteHot      = Assets.GetSprite("crew_state_temp_up");
 }
Esempio n. 10
0
 public void SetStyle(TextStyleSetting newstyle)
 {
     if ((Object)sdfText == (Object)null)
     {
         sdfText = GetComponent <TextMeshProUGUI>();
     }
     if ((Object)currentStyle != (Object)newstyle)
     {
         currentStyle = newstyle;
         style        = currentStyle;
         ApplyStyle(sdfText, style);
     }
 }
Esempio n. 11
0
 public static void ApplyStyle(TextMeshProUGUI sdfText, TextStyleSetting style)
 {
     if ((bool)sdfText && (bool)style)
     {
         sdfText.enableWordWrapping = style.enableWordWrapping;
         sdfText.enableKerning      = true;
         sdfText.extraPadding       = true;
         sdfText.fontSize           = (float)style.fontSize;
         sdfText.color     = style.textColor;
         sdfText.font      = style.sdfFont;
         sdfText.fontStyle = style.style;
     }
 }
Esempio n. 12
0
        static POptions()
        {
            var baseStyle = PUITuning.Fonts.UILightStyle;

            // Initialize the title font style
            TITLE_STYLE = ScriptableObject.CreateInstance <TextStyleSetting>();
            TITLE_STYLE.enableWordWrapping = false;
            TITLE_STYLE.fontSize           = baseStyle.fontSize;
            TITLE_STYLE.sdfFont            = baseStyle.sdfFont;
            TITLE_STYLE.style     = TMPro.FontStyles.Bold;
            TITLE_STYLE.textColor = TITLE_COLOR;
            modOptions            = null;
        }
Esempio n. 13
0
 /// <summary>
 /// Configures a Text Mesh Pro field.
 /// </summary>
 /// <param name="component">The text component to configure.</param>
 /// <param name="style">The desired text color, font, and style.</param>
 /// <param name="alignment">The text alignment.</param>
 /// <returns>The component, for call chaining.</returns>
 internal static TextMeshProUGUI ConfigureField(TextMeshProUGUI component,
                                                TextStyleSetting style, TextAlignmentOptions alignment)
 {
     component.alignment             = alignment;
     component.autoSizeTextContainer = false;
     component.enabled      = true;
     component.color        = style.textColor;
     component.font         = style.sdfFont;
     component.fontSize     = style.fontSize;
     component.fontStyle    = style.style;
     component.overflowMode = TextOverflowModes.Overflow;
     return(component);
 }
Esempio n. 14
0
        /// <summary>
        /// Safely adds a LocText to a game object without throwing an NRE on construction.
        /// </summary>
        /// <param name="obj">The game object to add the LocText.</param>
        /// <param name="setting">The text style.</param>
        /// <returns>The added LocText object.</returns>
        internal static LocText AddLocText(GameObject obj, TextStyleSetting setting = null)
        {
            bool active = obj.activeSelf;

            obj.SetActive(false);
            var text = obj.AddComponent <LocText>();

            // This is enough to let it activate
            text.key = string.Empty;
            text.textStyleSetting = setting ?? PUITuning.Fonts.UIDarkStyle;
            obj.SetActive(active);
            return(text);
        }
Esempio n. 15
0
 internal ExtendedThermalTooltip(ThermalTooltipsOptions options,
                                 BetterInfoCardsCompat compat = null)
 {
     this.options   = options ?? throw new ArgumentNullException("options");
     bicCompat      = compat;
     Cell           = 0;
     PrimaryElement = null;
     Drawer         = null;
     Style          = null;
     spriteDash     = Assets.GetSprite("dash");
     spriteCold     = Assets.GetSprite("crew_state_temp_down");
     spriteHot      = Assets.GetSprite("crew_state_temp_up");
 }
Esempio n. 16
0
            static Fonts()
            {
                FONTS = new Dictionary <string, TMP_FontAsset>(16);
                // List out all fonts shipped with the game
                foreach (var newFont in Resources.FindObjectsOfTypeAll <TMP_FontAsset>())
                {
                    string name = newFont?.name;
                    if (!string.IsNullOrEmpty(name) && !FONTS.ContainsKey(name))
                    {
                        FONTS.Add(name, newFont);
                    }
                }

                // Initialization: UI fonts
                if ((Text = GetFontByName(FONT_TEXT)) == null)
                {
                    PUtil.LogWarning("Unable to find font " + FONT_TEXT);
                }
                if ((UI = GetFontByName(FONT_UI)) == null)
                {
                    PUtil.LogWarning("Unable to find font " + FONT_UI);
                }

                // Initialization: Text style
                DefaultSize   = 14;
                TextDarkStyle = ScriptableObject.CreateInstance <TextStyleSetting>();
                TextDarkStyle.enableWordWrapping = false;
                TextDarkStyle.fontSize           = DefaultSize;
                TextDarkStyle.sdfFont            = Text;
                TextDarkStyle.style               = FontStyles.Normal;
                TextDarkStyle.textColor           = Colors.UITextDark;
                TextLightStyle                    = ScriptableObject.CreateInstance <TextStyleSetting>();
                TextLightStyle.enableWordWrapping = false;
                TextLightStyle.fontSize           = DefaultSize;
                TextLightStyle.sdfFont            = Text;
                TextLightStyle.style              = FontStyles.Normal;
                TextLightStyle.textColor          = Colors.UITextLight;
                UIDarkStyle = ScriptableObject.CreateInstance <TextStyleSetting>();
                UIDarkStyle.enableWordWrapping = false;
                UIDarkStyle.fontSize           = DefaultSize;
                UIDarkStyle.sdfFont            = UI;
                UIDarkStyle.style               = FontStyles.Normal;
                UIDarkStyle.textColor           = Colors.UITextDark;
                UILightStyle                    = ScriptableObject.CreateInstance <TextStyleSetting>();
                UILightStyle.enableWordWrapping = false;
                UILightStyle.fontSize           = DefaultSize;
                UILightStyle.sdfFont            = UI;
                UILightStyle.style              = FontStyles.Normal;
                UILightStyle.textColor          = Colors.UITextLight;
            }
Esempio n. 17
0
        /// <summary>
        /// Derives a font style from an existing style. The font face is copied unchanged,
        /// but the other settings can be optionally modified.
        /// </summary>
        /// <param name="root">The style to use as a template.</param>
        /// <param name="size">The font size, or 0 to use the template size.</param>
        /// <param name="newColor">The font color, or null to use the template color.</param>
        /// <param name="style">The font style, or null to use the template style.</param>
        /// <returns>A copy of the root style with the specified parameters altered.</returns>
        public static TextStyleSetting DeriveStyle(this TextStyleSetting root, int size = 0,
                                                   Color?newColor = null, FontStyles?style = null)
        {
            if (root == null)
            {
                throw new ArgumentNullException(nameof(root));
            }
            var newStyle = ScriptableObject.CreateInstance <TextStyleSetting>();

            newStyle.enableWordWrapping = root.enableWordWrapping;
            newStyle.style     = (style == null) ? root.style : (FontStyles)style;
            newStyle.fontSize  = (size > 0) ? size : root.fontSize;
            newStyle.sdfFont   = root.sdfFont;
            newStyle.textColor = (newColor == null) ? root.textColor : (Color)newColor;
            return(newStyle);
        }
Esempio n. 18
0
        /// <summary>
        /// Called when thermal information needs to be displayed for buildings and other
        /// items in game (like debris).
        /// </summary>
        private static void AddThermalInfoEntities(HoverTextDrawer drawer, string _,
                                                   TextStyleSetting style)
        {
            var instance       = ThermalTooltipsPatches.TooltipInstance;
            var primaryElement = instance?.PrimaryElement;

            if (primaryElement != null)
            {
                float mass = GetAdjustedMass(primaryElement.gameObject, primaryElement.Mass);
                instance.Drawer = drawer;
                instance.Style  = style;
                instance.DisplayThermalInfo(primaryElement.Element, primaryElement.Temperature,
                                            mass);
                instance.PrimaryElement = null;
            }
        }
Esempio n. 19
0
        /// <summary>
        /// Safely adds a LocText to a game object without throwing an NRE on construction.
        /// </summary>
        /// <param name="parent">The game object to add the LocText.</param>
        /// <param name="setting">The text style.</param>
        /// <returns>The added LocText object.</returns>
        internal static LocText AddLocText(GameObject parent, TextStyleSetting setting = null)
        {
            if (parent == null)
            {
                throw new ArgumentNullException("parent");
            }
            bool active = parent.activeSelf;

            parent.SetActive(false);
            var text = parent.AddComponent <LocText>();

            // This is enough to let it activate
            text.key = string.Empty;
            text.textStyleSetting = setting ?? PUITuning.Fonts.UIDarkStyle;
            parent.SetActive(active);
            return(text);
        }
Esempio n. 20
0
        /// <summary>
        /// Retrieves the estimated height of one line of text in the given text style.
        /// </summary>
        /// <param name="style">The text style to use.</param>
        /// <returns>The height in pixels that should be allocated.</returns>
        public static float GetLineHeight(TextStyleSetting style)
        {
            float height = 0.0f;

            if (style == null)
            {
                throw new ArgumentNullException(nameof(style));
            }
            var font = style.sdfFont;

            if (font != null)
            {
                var info = font.fontInfo;
                height = info.LineHeight * style.fontSize / (info.Scale * info.PointSize);
            }
            return(height);
        }
Esempio n. 21
0
        /// <summary>
        /// Safely adds a LocText to a game object without throwing an NRE on construction.
        /// </summary>
        /// <param name="parent">The game object to add the LocText.</param>
        /// <param name="setting">The text style.</param>
        /// <returns>The added LocText object.</returns>
        internal static LocText AddLocText(GameObject parent, TextStyleSetting setting = null)
        {
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }
            bool active = parent.activeSelf;

            parent.SetActive(false);
            var text = parent.AddComponent <LocText>();

            // This is enough to let it activate
            UIDetours.LOCTEXT_KEY.Set(text, string.Empty);
            UIDetours.LOCTEXT_STYLE.Set(text, setting ?? PUITuning.Fonts.UIDarkStyle);
            parent.SetActive(active);
            return(text);
        }
Esempio n. 22
0
        /// <summary>
        /// Retrieves the estimated width of a single string character (uses 'm' as the
        /// standard estimation character) in the given text style.
        /// </summary>
        /// <param name="style">The text style to use.</param>
        /// <returns>The width in pixels that should be allocated.</returns>
        public static float GetEmWidth(TextStyleSetting style)
        {
            float width = 0.0f;

            if (style == null)
            {
                throw new ArgumentNullException(nameof(style));
            }
            var font = style.sdfFont;

            // Use the em width
            if (font != null && font.characterDictionary.TryGetValue('m', out TMP_Glyph em))
            {
                var   info   = font.fontInfo;
                float ptSize = style.fontSize / (info.PointSize * info.Scale);
                width = em.width * ptSize + style.fontSize * 0.01f * font.normalSpacingOffset;
            }
            return(width);
        }
Esempio n. 23
0
        /// <summary>
        /// Called when thermal information needs to be displayed for elements.
        /// </summary>
        private static void AddThermalInfoElements(HoverTextDrawer drawer, string _,
                                                   TextStyleSetting style)
        {
            var instance = ThermalTooltipsPatches.TooltipInstance;
            int cell;

            if (instance != null && Grid.IsValidCell(cell = instance.Cell))
            {
                var   element = Grid.Element[cell];
                float mass    = Grid.Mass[cell];
                if (element != null && mass > 0.0f)
                {
                    instance.Drawer = drawer;
                    instance.Style  = style;
                    instance.DisplayThermalInfo(element, Grid.Temperature[cell], mass);
                }
                instance.Cell = 0;
            }
        }
        /// <summary>
        /// Called when thermal information needs to be displayed for buildings and other
        /// items in game (like debris).
        /// </summary>
        private static void AddThermalInfoEntities(HoverTextDrawer drawer, string _,
                                                   TextStyleSetting style)
        {
            var instance       = ThermalTooltipsPatches.TooltipInstance;
            var primaryElement = instance?.PrimaryElement;

            if (primaryElement != null)
            {
                float mass     = primaryElement.Mass;
                var   building = primaryElement.gameObject.GetComponentSafe <BuildingComplete>();
                // Buildings have 1/5th the expected mass with respect to heat calculations
                if (building != null && !building.Def.IsFoundation)
                {
                    mass *= 0.2f;
                }
                instance.Drawer = drawer;
                instance.Style  = style;
                instance.DisplayThermalInfo(primaryElement.Element, primaryElement.Temperature,
                                            mass);
                instance.PrimaryElement = null;
            }
        }
Esempio n. 25
0
        /// <summary>
        /// Builds a row selection prefab object for this combo box.
        /// </summary>
        /// <param name="style">The text style for the entries.</param>
        /// <param name="entryColor">The color for the entry backgrounds.</param>
        /// <returns>A template for each row in the dropdown.</returns>
        private GameObject BuildRowPrefab(TextStyleSetting style, ColorStyleSetting entryColor)
        {
            var im        = ItemMargin;
            var rowPrefab = PUIElements.CreateUI(null, "RowEntry");
            // Background of the entry
            var bgImage = rowPrefab.AddComponent <KImage>();

            UIDetours.COLOR_STYLE_SETTING.Set(bgImage, entryColor);
            UIDetours.APPLY_COLOR_STYLE.Invoke(bgImage);
            // Checkmark for the front of the entry
            var isSelected = PUIElements.CreateUI(rowPrefab, "Selected");
            var fgImage    = isSelected.AddComponent <Image>();

            fgImage.color          = style.textColor;
            fgImage.preserveAspect = true;
            fgImage.sprite         = PUITuning.Images.Checked;
            // Button for the entry to select it
            var entryButton = rowPrefab.AddComponent <KButton>();

            PButton.SetupButton(entryButton, bgImage);
            UIDetours.FG_IMAGE.Set(entryButton, fgImage);
            // Tooltip for the entry
            rowPrefab.AddComponent <ToolTip>();
            // Text for the entry
            var textContainer = PUIElements.CreateUI(rowPrefab, "Text");

            PUIElements.AddLocText(textContainer, style).SetText(" ");
            // Configure the entire layout in 1 statement! (jk this is awful)
            var group = rowPrefab.AddComponent <RelativeLayoutGroup>();

            group.AnchorYAxis(isSelected).OverrideSize(isSelected, CheckSize).SetLeftEdge(
                isSelected, fraction: 0.0f).SetMargin(isSelected, im).AnchorYAxis(
                textContainer).SetLeftEdge(textContainer, toRight: isSelected).SetRightEdge(
                textContainer, 1.0f).SetMargin(textContainer, new RectOffset(0, im.right,
                                                                             im.top, im.bottom)).LockLayout();
            rowPrefab.SetActive(false);
            return(rowPrefab);
        }
        /// <summary>
        /// Called when thermal information needs to be displayed for buildings and other
        /// items in game (like debris).
        /// </summary>
        private static void AddThermalInfoEntities(HoverTextDrawer drawer, string _,
                                                   TextStyleSetting style)
        {
            var instance       = ThermalTooltipsPatches.TooltipInstance;
            var primaryElement = instance?.PrimaryElement;

            if (primaryElement != null)
            {
                float insulation = 1.0f;
                // Check for insulation
                var building = primaryElement.GetComponent <Building>();
                if (building != null)
                {
                    insulation = building.Def.ThermalConductivity;
                }
                float mass = GetAdjustedMass(primaryElement.gameObject, primaryElement.Mass);
                instance.Drawer = drawer;
                instance.Style  = style;
                instance.DisplayThermalInfo(primaryElement.Element, primaryElement.Temperature,
                                            mass, insulation);
                instance.PrimaryElement = null;
            }
        }
 public void DrawText(string text, TextStyleSetting style)
 {
     DrawText(text, style, Color.white, false);
 }
Esempio n. 28
0
 static TextBlockOptionsEntry()
 {
     WRAP_TEXT_STYLE = PUITuning.Fonts.TextLightStyle.DeriveStyle();
     WRAP_TEXT_STYLE.enableWordWrapping = true;
 }
Esempio n. 29
0
 static OptionsDialog()
 {
     CATEGORY_TITLE_STYLE = PUITuning.Fonts.UILightStyle.DeriveStyle(newColor:
                                                                     CATEGORY_TITLE_COLOR, style: TMPro.FontStyles.Bold);
 }
Esempio n. 30
0
 /// <summary>
 /// Adds a button to the dialog.
 /// </summary>
 /// <param name="key">The key to report if this button is selected.</param>
 /// <param name="text">The button text.</param>
 /// <param name="tooltip">The tooltip to display on the button (optional)</param>
 /// <param name="backColor">The background color to use for the button. If null or
 /// omitted, the last button will be pink and all others will be blue.</param>
 /// <param name="foreColor">The foreground color to use for the button. If null or
 /// omitted, white text with the default game UI font will be used.</param>
 /// <returns>This dialog for call chaining.</returns>
 public PDialog AddButton(string key, string text, string tooltip = null,
                          ColorStyleSetting backColor             = null, TextStyleSetting foreColor = null)
 {
     buttons.Add(new DialogButton(key, text, tooltip, backColor, foreColor));
     return(this);
 }