private void DrawSkill(CustomPawn customPawn, SkillRecord skill, Rect rect) { int level = skill.Level; bool disabled = customPawn.IsSkillDisabled(skill.def); if (!disabled) { float barSize = (level > 0 ? (float)level : 0) / 20f; FillableBar(rect, barSize, Textures.TextureSkillBarFill); int baseLevel = customPawn.GetSkillModifier(skill.def); float baseBarSize = (baseLevel > 0 ? (float)baseLevel : 0) / 20f; FillableBar(rect, baseBarSize, Textures.TextureSkillBarFill); GUI.color = new Color(0.25f, 0.25f, 0.25f); Widgets.DrawBox(rect, 1); GUI.color = Style.ColorText; if (Widgets.ButtonInvisible(rect, false)) { Vector2 pos = Event.current.mousePosition; float x = pos.x - rect.x; int value = 0; if (Mathf.Floor(x / rect.width * 20f) == 0) { if (x <= 1) { value = 0; } else { value = 1; } } else { value = Mathf.CeilToInt(x / rect.width * 20f); } SoundDefOf.TickTiny.PlayOneShotOnCamera(); SetSkillLevel(customPawn, skill, value); } } string label; if (disabled) { GUI.color = ColorSkillDisabled; label = "-"; } else { label = GenString.ToStringCached(level); } Text.Anchor = TextAnchor.MiddleLeft; rect.x = rect.x + 3; rect.y = rect.y + 1; Widgets.Label(rect, label); GUI.color = Color.white; Text.Anchor = TextAnchor.UpperLeft; }