public override void DoWindowContents(Rect inRect) { if (QuestPawn != null && !QuestPawn.Dialogs.Contains(Dialog)) { Close(); } GUI.color = Color.white; Text.Font = GameFont.Medium; Rect titleRect = inRect; titleRect.y = 10; titleRect.x = 10; titleRect.width = 690; Text.Anchor = TextAnchor.UpperCenter; Widgets.Label(titleRect, Dialog.CardLabel); Text.Font = GameFont.Small; Text.Anchor = TextAnchor.UpperLeft; Rect mainRect = new Rect(10, 40, 680, 280); Widgets.LabelScrollable(mainRect, Dialog.Description, ref scroll); Text.Anchor = TextAnchor.MiddleCenter; int sliderLength = Dialog.Options.Count * 30; Rect optionsRect = new Rect(0, 0, 680, 25); Rect scrollRewVertRectFact = new Rect(0, 0, 700, sliderLength); Widgets.BeginScrollView(new Rect(10, 340, 690, 180), ref scroll2, scrollRewVertRectFact, false); for (int i = 0; i < Dialog.Options.Count; i++) { CommOption option = Dialog.Options[i]; if (DrawCustomButton(optionsRect, $"{option.Label}", Color.white, option)) { option.DoAction(Dialog, Speaker, Defendant); } optionsRect.y += 30; } Widgets.EndScrollView(); Text.Anchor = TextAnchor.UpperLeft; GUI.color = CommCardBGColor; Widgets.DrawLineHorizontal(0, 327, inRect.width); Widgets.DrawLineHorizontal(20, 37, 660); Widgets.DrawLineHorizontal(0, 530, inRect.width); Widgets.DrawLineVertical(340, 530, 170); GUI.color = Color.white; Rect pawnRect = new Rect(10, 540, 330, 150); DrawPawnCard(Speaker, pawnRect); pawnRect.x = 350; DrawPawnCard(Defendant, pawnRect); }
private bool DrawCustomButton(Rect rect, string label, Color textColor, CommOption option) { GUI.color = textColor; Widgets.Label(rect, label); GUI.color = CommCardBGColor; Widgets.DrawHighlight(rect); GUI.color = CommBorderColor; Widgets.DrawBox(rect); GUI.color = Color.white; Widgets.DrawHighlightIfMouseover(rect); TooltipHandler.TipRegion(rect, option.Description); return(Widgets.ButtonInvisible(rect)); }
private void DoButtonsComms(Rect rect) { Text.Anchor = TextAnchor.MiddleCenter; Rect startRect = rect; startRect.height = 35; for (int i = 0; i < currentDialog.Options.Count; i++) { CommOption option = currentDialog.Options[i]; if (DrawCustomButton(startRect, option.Label, option.TextColor)) { option.DoAction(currentDialog, speaker, defendant); } startRect.y += 40; } Text.Anchor = TextAnchor.UpperLeft; }