Ejemplo n.º 1
0
        private void DrawEmailMessage(Rect rect, ref int y, EmailMessage message)
        {
            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Medium;

            Rect r         = new Rect(10, y, rect.width - 20, 120);
            Rect titleRect = new Rect(15, y, rect.width - 20, 50);

            Widgets.Label(titleRect, message.Subject);
            Text.Font = GameFont.Tiny;
            Rect rect2 = new Rect(15, y + 26, rect.width - 20, 20);

            Widgets.Label(rect2, "EmailMessage_From".Translate(message.From));
            rect2.y += 15;
            Widgets.Label(rect2, "EmailMessage_To".Translate(message.To));
            rect2.y += 25;

            Text.Anchor = TextAnchor.MiddleCenter;
            if (message.Answers != null)
            {
                for (int i = 0; i < Mathf.Min(4, message.Answers.Count); i++)
                {
                    EmailMessageOption answer = message.Answers[i];

                    if (DrawCustomButton(new Rect(rect2.x, rect2.y, 200, rect2.height), answer.Label, message.Answered ? Color.gray : Color.white))
                    {
                        if (message.Answered)
                        {
                            return;
                        }

                        message.Answered = true;
                        answer.DoAction(message, QuestsManager.Communications.PlayerBox, message.Faction?.leader);
                    }
                    rect2.x += 220;
                }
            }

            if (DrawCustomButton(new Rect(15, rect2.y + 25, 200, rect2.height), "DeleteMessage".Translate(), Color.white))
            {
                communications.PlayerBox.DeleteMessage(message);
            }

            Text.Anchor = TextAnchor.UpperLeft;

            Text.Font = GameFont.Small;
            if (Mouse.IsOver(r))
            {
                Widgets.DrawBox(r);
            }

            string str = $"{message.Message.Substring(0, message.Message.Length > 150 ? 150 : message.Message.Length)}...";

            TooltipHandler.TipRegion(r, str);

            GUI.color = message.MessageRead ? CommCardBGColor : CommCardBGColorNotRead;
            Widgets.DrawHighlight(r);
            GUI.color = Color.white;

            if (Widgets.ButtonInvisible(r))
            {
                currentMessage             = message;
                currentMessage.MessageRead = true;
            }
            y += 130;
        }
Ejemplo n.º 2
0
 public abstract void DoAction(EmailMessage message, EmailBox box, Pawn speaker);
Ejemplo n.º 3
0
        private void InteractionPage(Rect inRect)
        {
            Rect rect2 = inRect;

            rect2.y      = 590;
            rect2.height = 60;
            GUI.color    = MenuSectionBGBorderColor;
            Widgets.DrawLineHorizontal(0, rect2.y, rect2.width);
            GUI.color = Color.white;

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Rect rect3 = rect2;

            rect3.y      = 600;
            rect3.height = 50;
            rect3.width  = 280;
            rect3.x      = 20;
            DrawBottomInterButtons(ref rect3, "InteractionInterTab".Translate(), () => { interTab = InterTab.Interaction; });
            rect3.x     = 330;
            rect3.width = 300;
            DrawBottomInterButtons(ref rect3, "MessagesInterTab".Translate(), () => { interTab = InterTab.Messages; currentMessage = null; });
            rect3.x     = 660;
            rect3.width = 280;
            DrawBottomInterButtons(ref rect3, "AllianceInterTab".Translate(), () => interTab = InterTab.Alliance);

            switch (interTab)
            {
            case InterTab.Interaction:
                DrawInteraction(inRect);
                break;

            case InterTab.Messages:
                DrawEmailBox(inRect);
                break;

            case InterTab.Alliance:
                DrawAllianceMainPage(inRect);
                break;
            }

            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.UpperLeft;
        }