private static void Postfix(Rect rect, Pawn pawn, Action randomizeCallback) { CompSkillPoints spcomp = pawn.TryGetComp <CompSkillPoints>(); if (spcomp == null) { return; } float width = Base.panelAddedWidth - margin; float x = CharacterCardUtility.PawnCardSize(pawn).x; if (randomizeCallback != null) // this is how the game checks if we're in the character creation screen (shrug) { x += 175f; } Rect extraRect = new Rect(x + margin, rect.y, width, 100f); ITab_Skills.DrawRankInfo(extraRect, pawn); }
private static bool Prefix(Pawn p, ref Vector2 offset) { if (Current.ProgramState != ProgramState.Playing || Current.Game == null || !p.IsColonist) { return(true); } CompSkillPoints spcomp = p.TryGetComp <CompSkillPoints>(); if (spcomp == null) { return(true); } FieldInfo sdiloc = AccessTools.Field(typeof(SkillUI), "skillDefsInListOrderCached"); List <SkillDef> skillDefsInListOrderCached = sdiloc.GetValue(null) as List <SkillDef>; float y = 0; bool drawBox = true; foreach (SkillDef skill in skillDefsInListOrderCached) { // highlight rows if set if (SkillPointsSettings.highlightAlternate && drawBox) { Rect box = new Rect(0 + offset.x, y + offset.y, skillWidth + skillHeight, skillHeight); Widgets.DrawBoxSolid(box, Base.alternateRowColor); } drawBox = !drawBox; // draw buttons SkillRecord rec = p.skills.GetSkill(skill); if (!rec.TotallyDisabled && rec.Level < 20) { // level up (+) button Rect levelUpRect = new Rect(offset.x, y + gap + offset.y, buttonHeight, buttonHeight); bool clicked = Widgets.ButtonText(levelUpRect, "+"); if (clicked) { Base.DoSkillLevelUp(p, rec); } // autolevel radio button //Rect autoLevelRect = new Rect(skillWidth + gap + offset.x, y + gap + offset.y, buttonHeight, buttonHeight); if (!autoChecked.ContainsKey(rec)) { autoChecked.Add(rec, false); } bool newCheck = autoChecked[rec]; Widgets.Checkbox(new Vector2(skillWidth + checkGap + offset.x, y + checkGap + offset.y), ref newCheck, size: checkHeight); if (newCheck) { List <SkillRecord> keys = autoChecked.Keys.ToList(); foreach (SkillRecord sr in keys) { autoChecked[sr] = false; } autoChecked[rec] = true; Text.Font = GameFont.Tiny; Rect autoLabel = new Rect(skillWidth + checkGap + offset.x + checkHeight + margin, y + checkGap + offset.y, 150f, Text.LineHeight); Widgets.Label(autoLabel, "Auto-level " + skill.LabelCap); Text.Font = GameFont.Small; } else { autoChecked[rec] = false; } } y += skillRowHeight; } bool manualCheck = Base.IsOnManual(p); Widgets.Checkbox(new Vector2(skillWidth + checkGap + offset.x, y + checkGap + offset.y), ref manualCheck, size: checkHeight, disabled: manualCheck); Rect manualLabel = new Rect(skillWidth + checkGap + offset.x + checkHeight + margin, y + checkGap + offset.y, 100f, Text.LineHeight); Text.Font = GameFont.Tiny; Widgets.Label(manualLabel, "Manual"); Text.Font = GameFont.Small; // shift actual skill drawing to the right offset.x += buttonHeight; return(true); }