public override void DoWindowContents(Rect inRect) { try { if (this.rerenderPawn) { this.dresserDto.Pawn.Drawer.renderer.graphics.ResolveAllGraphics(); PortraitsCache.SetDirty(this.dresserDto.Pawn); this.rerenderPawn = false; } Text.Font = GameFont.Medium; Widgets.Label(new Rect(0f, 0f, this.InitialSize.y / 2f + 45f, 50f), "ChangeMirror.MirrorLabel".Translate()); float portraitBuffer = 30f; Rect portraitRect = WidgetUtil.AddPortraitWidget(portraitBuffer, 150f, this.dresserDto); float editorLeft = portraitRect.xMax + portraitBuffer; float editorTop = 30f + WidgetUtil.SelectionRowHeight; float editorWidth = 325f; WidgetUtil.AddSelectorWidget(portraitRect.xMax + portraitBuffer, 10f, editorWidth, null, this.dresserDto.EditorTypeSelectionDto); switch ((CurrentEditorEnum)this.dresserDto.EditorTypeSelectionDto.SelectedItem) { case CurrentEditorEnum.ChangeMirrorApparelColor: WidgetUtil.AddAppararelColorSelectionWidget(editorLeft, editorTop, editorWidth, this.dresserDto.ApparelSelectionsContainer); break; case CurrentEditorEnum.ChangeMirrorBody: bool isShowing = false; float top = editorTop; if (this.dresserDto.BodyTypeSelectionDto != null && this.dresserDto.BodyTypeSelectionDto.Count > 1) { WidgetUtil.AddSelectorWidget(editorLeft, top, editorWidth, "ChangeMirror.BodyType".Translate() + ":", this.dresserDto.BodyTypeSelectionDto); top += WidgetUtil.SelectionRowHeight + 20f; isShowing = true; } if (this.dresserDto.HeadTypeSelectionDto != null && this.dresserDto.HeadTypeSelectionDto.Count > 1) { WidgetUtil.AddSelectorWidget(editorLeft, top, editorWidth, "ChangeMirror.HeadType".Translate() + ":", this.dresserDto.HeadTypeSelectionDto); top += WidgetUtil.SelectionRowHeight + 20f; isShowing = true; } if (this.dresserDto.SkinColorSliderDto != null) { WidgetUtil.AddSliderWidget(editorLeft, top, editorWidth, "ChangeMirror.SkinColor".Translate() + ":", this.dresserDto.SkinColorSliderDto); isShowing = true; } if (!isShowing) { GUI.Label(new Rect(editorLeft, top, editorWidth, 40), "ChangeMirror.NoEditableAttributes".Translate()); } if (Settings.ShowGenderAgeChange) { GUI.Label(new Rect(editorLeft, 300f, editorWidth, 40f), "ChangeMirror.GenderChangeWarning".Translate(), WidgetUtil.MiddleCenter); top = 340f; WidgetUtil.AddSelectorWidget(editorLeft, top, editorWidth, "ChangeMirror.Gender".Translate() + ":", this.dresserDto.GenderSelectionDto); top += WidgetUtil.SelectionRowHeight + 5; long ageBio = this.dresserDto.Pawn.ageTracker.AgeBiologicalTicks; if (AddLongInput(editorLeft, top, 120, 80, "ChangeMirror.AgeBiological".Translate() + ":", ref ageBio, MAX_AGE, TICKS_PER_YEAR)) { this.dresserDto.Pawn.ageTracker.AgeBiologicalTicks = ageBio; rerenderPawn = true; if (ageBio > this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks) { this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks = ageBio; } } top += WidgetUtil.SelectionRowHeight + 5; long ageChron = this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks; if (AddLongInput(editorLeft, top, 120, 80, "ChangeMirror.AgeChronological".Translate() + ":", ref ageChron, MAX_AGE, TICKS_PER_YEAR)) { this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks = ageChron; } } break; case CurrentEditorEnum.ChangeMirrorHair: const float listboxHeight = 250f; if (this.dresserDto.HairStyleSelectionDto != null) { //bool showHairColor = this.dresserDto.HairColorSelectionDto != null; float height = listboxHeight; /*if (!showHairColor) * { * height += 250; * }*/ WidgetUtil.AddListBoxWidget(editorLeft, editorTop, editorWidth, height, "ChangeMirror.HairStyle".Translate() + ":", this.dresserDto.HairStyleSelectionDto); //if (showHairColor) //{ WidgetUtil.AddColorSelectorWidget(editorLeft, editorTop + listboxHeight + 10f, editorWidth, this.dresserDto.HairColorSelectionDto, this.dresserDto.HairColorSelectionDto.ColorPresetsDTO); //} } break; case CurrentEditorEnum.ChangeMirrorAlienSkinColor: if (this.dresserDto.AlienSkinColorPrimary != null) { GUI.color = Color.white; Text.Font = GameFont.Medium; GUI.Label(new Rect(editorLeft, editorTop, editorWidth, 30), "ChangeMirror.AlienPrimarySkinColor".Translate()); Text.Font = GameFont.Small; WidgetUtil.AddColorSelectorWidget(editorLeft, editorTop + 40, editorWidth, this.dresserDto.AlienSkinColorPrimary, null); } if (this.dresserDto.AlienSkinColorSecondary != null) { GUI.color = Color.white; Text.Font = GameFont.Medium; GUI.Label(new Rect(editorLeft, editorTop + 260, editorWidth, 30), "ChangeMirror.AlienSecondarySkinColor".Translate()); Text.Font = GameFont.Small; WidgetUtil.AddColorSelectorWidget(editorLeft, editorTop + 300, editorWidth, this.dresserDto.AlienSkinColorSecondary, null); } break; /*case CurrentEditorEnum.ChangeDresserAlienHairColor: * if (this.dresserDto.AlienHairColorPrimary != null) * { * GUI.color = Color.white; * Text.Font = GameFont.Medium; * GUI.Label(new Rect(editorLeft, editorTop, editorWidth, 30), "ChangeMirror.AlienPrimaryHairColor".Translate()); * Text.Font = GameFont.Small; * * WidgetUtil.AddColorSelectorWidget(editorLeft, editorTop + 40, editorWidth, this.dresserDto.AlienHairColorPrimary, null); * } * * if (this.dresserDto.AlienHairColorSecondary != null) * { * GUI.color = Color.white; * Text.Font = GameFont.Medium; * GUI.Label(new Rect(editorLeft, editorTop + 260, editorWidth, 30), "ChangeMirror.AlienSecondaryHairColor".Translate()); * Text.Font = GameFont.Small; * * WidgetUtil.AddColorSelectorWidget(editorLeft, editorTop + 300, editorWidth, this.dresserDto.AlienHairColorSecondary, null); * } * break;*/ } Text.Anchor = TextAnchor.MiddleLeft; Text.Font = GameFont.Small; GUI.Label(new Rect(0, 75, this.InitialSize.y / 2f, 50f), GUI.tooltip); Text.Font = GameFont.Medium; Text.Anchor = TextAnchor.UpperLeft; float xWidth = 150; float xBuffer = (this.InitialSize.x - xWidth) / 2; Rect bottomButtonsRect = new Rect(editorLeft, this.InitialSize.y - WidgetUtil.SelectionRowHeight - 36, xWidth, WidgetUtil.SelectionRowHeight); GUI.BeginGroup(bottomButtonsRect); Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Small; GUI.color = Color.white; if (Widgets.ButtonText(new Rect(0, 0, 60, WidgetUtil.SelectionRowHeight), "Reset".Translate())) { this.ResetToDefault(); this.ApparelWithColorChange.Clear(); } if (Widgets.ButtonText(new Rect(90, 0, 60, WidgetUtil.SelectionRowHeight), "Save".Translate())) { this.saveChangedOnExit = true; this.Close(); } GUI.EndGroup(); } catch (Exception e) { Log.Error(this.GetType().Name + " closed due to: " + e.GetType().Name + " " + e.Message); Messages.Message(this.GetType().Name + " closed due to: " + e.GetType().Name + " " + e.Message, MessageTypeDefOf.NegativeEvent); base.Close(); } finally { Text.Anchor = TextAnchor.UpperLeft; GUI.color = Color.white; } }
public override void DoWindowContents(Rect inRect) { try { if (this.rerenderPawn) { this.dresserDto.Pawn.Drawer.renderer.graphics.ResolveAllGraphics(); PortraitsCache.SetDirty(this.dresserDto.Pawn); this.rerenderPawn = false; } Text.Font = GameFont.Medium; Widgets.Label( new Rect(0f, 0f, this.InitialSize.y / 2f + 45f, 50f), "FacialStuffEditor.FaceStylerTitle".Translate()); float portraitBuffer = 30f; Rect portraitRect = WidgetUtil.AddPortraitWidget(portraitBuffer, 150f, this.dresserDto); float editorLeft = portraitRect.xMax + portraitBuffer; float editorTop = 30f + WidgetUtil.SelectionRowHeight; float editorWidth = 325f; float top = editorTop; WidgetUtil.AddSelectorWidget( editorLeft, top, editorWidth, "FacialStuffEditor.BodyType".Translate() + ":", this.dresserDto.BodyTypeSelectionDto); top += WidgetUtil.SelectionRowHeight + 20f; WidgetUtil.AddSelectorWidget( editorLeft, top, editorWidth, "FacialStuffEditor.HeadType".Translate() + ":", this.dresserDto.HeadTypeSelectionDto); top += WidgetUtil.SelectionRowHeight + 20f; WidgetUtil.AddSliderWidget( editorLeft, top, editorWidth, "FacialStuffEditor.SkinColor".Translate() + ":", this.dresserDto.SkinColorSliderDto); if (Controller.settings.ShowGenderAgeChange) { GUI.Label( new Rect(editorLeft, 300f, editorWidth, 40f), "FacialStuffEditor.GenderChangeWarning".Translate(), WidgetUtil.MiddleCenter); top = 340f; WidgetUtil.AddSelectorWidget( editorLeft, top, editorWidth, "FacialStuffEditor.Gender".Translate() + ":", this.dresserDto.GenderSelectionDto); top += WidgetUtil.SelectionRowHeight + 5; long ageBio = this.dresserDto.Pawn.ageTracker.AgeBiologicalTicks; if (this.AddLongInput( editorLeft, top, 120, 80, "FacialStuffEditor.AgeBiological".Translate() + ":", ref ageBio, MAX_AGE, TICKS_PER_YEAR)) { this.dresserDto.Pawn.ageTracker.AgeBiologicalTicks = ageBio; this.rerenderPawn = true; if (ageBio > this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks) { this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks = ageBio; } } top += WidgetUtil.SelectionRowHeight + 5; long ageChron = this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks; if (this.AddLongInput( editorLeft, top, 120, 80, "FacialStuffEditor.AgeChronological".Translate() + ":", ref ageChron, MAX_AGE, TICKS_PER_YEAR)) { this.dresserDto.Pawn.ageTracker.AgeChronologicalTicks = ageChron; } } Text.Anchor = TextAnchor.MiddleLeft; Text.Font = GameFont.Small; GUI.Label(new Rect(0, 75, this.InitialSize.y / 2f, 50f), GUI.tooltip); Text.Font = GameFont.Medium; Text.Anchor = TextAnchor.UpperLeft; float xWidth = 150; float xBuffer = (this.InitialSize.x - xWidth) / 2; Rect bottomButtonsRect = new Rect( editorLeft, this.InitialSize.y - WidgetUtil.SelectionRowHeight - 36, xWidth, WidgetUtil.SelectionRowHeight); GUI.BeginGroup(bottomButtonsRect); Text.Anchor = TextAnchor.MiddleCenter; Text.Font = GameFont.Small; GUI.color = Color.white; if (Widgets.ButtonText( new Rect(0, 0, 60, WidgetUtil.SelectionRowHeight), "FacialStuffEditor.Reset".Translate())) { this.ResetToDefault(); } if (Widgets.ButtonText( new Rect(90, 0, 60, WidgetUtil.SelectionRowHeight), "FacialStuffEditor.Save".Translate())) { this.saveChangedOnExit = true; this.Close(); } GUI.EndGroup(); } catch (Exception e) { Log.Error(this.GetType().Name + " closed due to: " + e.GetType().Name + " " + e.Message); Messages.Message(this.GetType().Name + " closed due to: " + e.GetType().Name + " " + e.Message, MessageSound.Negative); this.Close(); } finally { Text.Anchor = TextAnchor.UpperLeft; GUI.color = Color.white; } }