public float DrawCustomBodyPart(float cursor, CustomBodyPart customPart)
        {
            cursor += ContentPadding.y;
            Vector2 boxSize = SizeElement;

            if (scrollView.ScrollbarsVisible)
            {
                boxSize.x -= ScrollView.ScrollbarSize;
            }
            Rect elementBox = new Rect(ContentPadding.x, cursor, boxSize.x, boxSize.y);

            // Draw background box.
            GUI.color = BackgroundBoxColor;
            GUI.DrawTexture(elementBox, BaseContent.WhiteTex);

            GUI.BeginGroup(elementBox);

            // Draw body part name.
            GUI.color = Page_ConfigureStartingPawnsCarefully.TextColor;
            Widgets.Label(new Rect(8, 6, boxSize.x - 16, 24), customPart.PartName);

            // Draw field.
            Rect fieldRect = new Rect(16, 30, boxSize.x - 32, 28);

            GUI.color = Color.white;
            Widgets.DrawAtlas(fieldRect, Textures.TextureFieldAtlas);
            GUI.color = Page_ConfigureStartingPawnsCarefully.TextColor;

            // Draw the hediff label.
            GUI.color = customPart.LabelColor;
            Rect labelRect = new Rect(fieldRect.x, fieldRect.y + 1, fieldRect.width, fieldRect.height);

            Widgets.Label(labelRect, customPart.ChangeName);
            if (customPart.HasTooltip)
            {
                TooltipHandler.TipRegion(labelRect, customPart.Tooltip);
            }
            GUI.color = Page_ConfigureStartingPawnsCarefully.TextColor;

            // Delete the option.
            Rect buttonRect = new Rect(boxSize.x - 21, 3, 18, 18);

            GUI.color = buttonRect.Contains(Event.current.mousePosition) ? Page_ConfigureStartingPawnsCarefully.ButtonHighlightColor : Page_ConfigureStartingPawnsCarefully.ButtonColor;
            GUI.DrawTexture(buttonRect, Textures.TextureButtonDelete);
            if (Widgets.ButtonInvisible(buttonRect, false))
            {
                SoundDefOf.TickTiny.PlayOneShotOnCamera();
                partRemovalList.Add(customPart);
            }
            GUI.color = Color.white;

            GUI.EndGroup();

            return(cursor + boxSize.y);
        }
Пример #2
0
        public void RemoveCustomBodyParts(CustomBodyPart part)
        {
            Implant implant = part as Implant;
            Injury  injury  = part as Injury;

            if (implant != null)
            {
                implants.Remove(implant);
            }
            if (injury != null)
            {
                injuries.Remove(injury);
            }
            bodyParts.Remove(part);
            SyncBodyParts();
        }
Пример #3
0
        public float DrawCustomBodyPart(float cursor, CustomBodyPart customPart, Field field)
        {
            bool willScroll = scrollView.ScrollbarsVisible;
            Rect entryRect  = RectItem;

            entryRect.y     = entryRect.y + cursor;
            entryRect.width = entryRect.width - (willScroll ? 16 : 0);
            GUI.color       = Style.ColorPanelBackgroundItem;
            GUI.DrawTexture(entryRect, BaseContent.WhiteTex);

            // Draw background box.
            GUI.BeginGroup(entryRect);

            // Draw field
            Rect fieldRect = RectField;

            fieldRect.width = fieldRect.width - (willScroll ? 16 : 0);
            field.Rect      = fieldRect;
            if (customPart.BodyPartRecord != null)
            {
                field.Label = labelTrimmer.TrimLabelIfNeeded(new HealthPanelLabelProvider(customPart.PartName, customPart.ChangeName, customPart.LabelColor));
                field.Color = Color.white;
            }
            else
            {
                field.Label = labelTrimmer.TrimLabelIfNeeded(customPart.ChangeName);
                field.Color = customPart.LabelColor;
            }

            if (customPart.HasTooltip)
            {
                field.Tip = customPart.Tooltip;
            }
            else
            {
                field.Tip = null;
            }
            field.Draw();

            // Delete the option.
            Rect deleteRect = RectButtonDelete;

            if (willScroll)
            {
                deleteRect.x = deleteRect.x - 16;
            }
            Style.SetGUIColorForButton(deleteRect);
            GUI.DrawTexture(deleteRect, Textures.TextureButtonDelete);
            if (Widgets.ButtonInvisible(deleteRect, false))
            {
                SoundDefOf.Tick_Tiny.PlayOneShotOnCamera();
                partRemovalList.Add(customPart);
            }

            GUI.color   = Color.white;
            Text.Anchor = TextAnchor.UpperLeft;

            GUI.EndGroup();

            return(cursor + RectItem.height + HeightEntrySpacing);
        }