public override void DoWindowContents(Rect inRect) { Text.Font = GameFont.Medium; Text.Anchor = TextAnchor.MiddleCenter; // Check for a press of 'Return' and process as a confirmation if so bool pressedReturn = false; if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return) { pressedReturn = true; Event.current.Use(); } // Preview var fullPawnConfirmationRect = inRect.LeftPart(0.4f).ContractedBy(12); var pawnLabelRect = fullPawnConfirmationRect.TopPart(0.08f); string pawnLabel = Pawn.Label; while (Text.CalcSize(pawnLabel).x > pawnLabelRect.width && Text.Font > GameFont.Tiny) { Text.Font--; } pawnLabel = Text.CalcSize(pawnLabel).x <= pawnLabelRect.width ? pawnLabel : pawnLabel.Truncate(pawnLabelRect.width, truncatedLabelCache); Widgets.Label(pawnLabelRect, Pawn.Label); var pawnConfirmationRect = fullPawnConfirmationRect.BottomPart(0.92f); var previewRect = pawnConfirmationRect.TopPartPixels(pawnConfirmationRect.width); GUI.DrawTexture(previewRect, ColonistBar.BGTex); previewRect = previewRect.ContractedBy(6); GUI.DrawTexture(previewRect, PortraitsCache.Get(Pawn, previewRect.size)); var fullOptionRectsArea = inRect.RightPart(0.6f); // Hair/beard options var optionRectsArea = fullOptionRectsArea.TopPart(0.75f); var hairRect = optionRectsArea.LeftHalf().ContractedBy(12); var hairHeadingRect = hairRect.TopPart(0.08f); Widgets.Label(hairHeadingRect, "VanillaFactionsExpandedVikings.Facepaint".Translate()); var hairListRect = hairRect.BottomPart(0.92f); Widgets.DrawMenuSection(hairListRect); hairListRect = hairListRect.ContractedBy(6); var firstListing = new Listing_Standard(); var hairViewRect = new Rect(0, 0, hairListRect.width - 18, hairViewRectHeight); var beardRect = optionRectsArea.RightHalf().ContractedBy(12); var beardHeadingRect = beardRect.TopPart(0.08f); Widgets.Label(beardHeadingRect, "VanillaFactionsExpandedVikings.Facepaint".Translate()); var beardListRect = beardRect.BottomPart(0.92f); Widgets.DrawMenuSection(beardListRect); beardListRect = beardListRect.ContractedBy(6); var secondListing = new Listing_Standard(); var beardViewRect = new Rect(0, 0, beardListRect.width - 18, beardViewRectHeight); Text.Font = GameFont.Small; Text.Anchor = TextAnchor.UpperLeft; CompFacepaint compFacepaint = Pawn.GetComp <CompFacepaint>(); firstListing.BeginScrollView(hairListRect, ref hairScrollVec2, ref hairViewRect); for (int i = 0; i < orderedFacepaintDefs.Count; i++) { var hDef = orderedFacepaintDefs[i]; DrawRow(firstListing, hDef, compFacepaint.colorOne, ref this.newFacepaintCombo.facepaintDefOne); } firstListing.EndScrollView(ref hairViewRect); secondListing.BeginScrollView(beardListRect, ref beardScrollVec2, ref beardViewRect); for (int i = 0; i < orderedFacepaintDefs.Count; i++) { var hDef = orderedFacepaintDefs[i]; DrawRow(secondListing, hDef, compFacepaint.colorTwo, ref this.newFacepaintCombo.facepaintDefTwo); } secondListing.EndScrollView(ref beardViewRect); hairViewRectHeight = firstListing.CurHeight; beardViewRectHeight = secondListing.CurHeight; // Colour selection var fullColourRectsArea = fullOptionRectsArea.BottomPart(0.25f).ContractedBy(12); var colourRectsArea = fullColourRectsArea.TopPart(0.7f); if (coloursTied) { DrawColourChangeSection(colourRectsArea, ref this.newFacepaintCombo.colourOne); } else { DrawColourChangeSection(colourRectsArea.LeftPartPixels(colourRectsArea.width / 2 - 12), ref this.newFacepaintCombo.colourOne); DrawColourChangeSection(colourRectsArea.RightPartPixels(colourRectsArea.width / 2 - 12), ref this.newFacepaintCombo.colourTwo); } var fullCheckboxRectsArea = fullColourRectsArea.BottomPart(0.2f); var customCheckboxRect = fullCheckboxRectsArea.LeftPart(0.45f); Widgets.CheckboxLabeled(customCheckboxRect, "VanillaFactionsExpandedVikings.CustomMode".Translate(), ref colourSliders); var tiedCheckboxRect = fullCheckboxRectsArea.RightPart(0.45f); Widgets.CheckboxLabeled(tiedCheckboxRect, "VanillaFactionsExpandedVikings.ColoursTied".Translate(), ref coloursTied); // Work amount, Reset and Confirm var workConfirmRect = pawnConfirmationRect.BottomPart(0.2f).LeftPart(0.9f).RightPart(8f / 9); var workRect = workConfirmRect.TopHalf(); Text.Anchor = TextAnchor.MiddleCenter; Widgets.Label(workRect, $"{"WorkAmount".Translate()}: {((float) RestyleTicks).ToStringWorkAmount()}"); Text.Anchor = TextAnchor.UpperLeft; var resetConfirmRect = workConfirmRect.BottomHalf(); if (Widgets.ButtonText(resetConfirmRect.LeftPart(0.48f), "Reset".Translate())) { this.newFacepaintCombo = this.initFacepaintCombo; RimWorld.SoundDefOf.Click.PlayOneShotOnCamera(); } if (Widgets.ButtonText(resetConfirmRect.RightPart(0.48f), "Confirm".Translate()) || pressedReturn) { SetHairstyle(); Find.WindowStack.TryRemove(this); } }