public static void DrawPsycheCard(Rect rect, Pawn pawn)
 {
     if (PsycheHelper.PsychologyEnabled(pawn))
     {
         GUI.BeginGroup(rect);
         Text.Font = GameFont.Small;
         Rect rect2 = new Rect(20f, 20f, rect.width - 20f, rect.height - 20f);
         Rect rect3 = rect2.ContractedBy(10f);
         Rect rect4 = rect3;
         Rect rect5 = rect3;
         rect4.width *= 0.6f;
         rect5.x      = rect4.xMax + 17f;
         rect5.xMax   = rect3.xMax;
         GUI.color    = new Color(1f, 1f, 1f, 0.5f);
         Widgets.DrawLineVertical(rect4.xMax, 0f, rect.height);
         GUI.color = Color.white;
         if (Prefs.DevMode)
         {
             Rect rect6 = new Rect(0f, 5f, rect3.width, 22f);
             PsycheCardUtility.DrawDebugOptions(rect6, pawn);
         }
         PsycheCardUtility.DrawPersonalityNodes(rect4, pawn);
         PsycheCardUtility.DrawSexuality(rect5, pawn, true);
         GUI.EndGroup();
     }
 }
Example #2
0
        public static void InlineDoubleMessageNC(string left, string right, Listing_Standard listing, bool capOff)
        {
            left.Insert(0, " ");
            right.Insert(0, " ");

            var grongo = Text.CalcHeight(left, listing.ColumnWidth / 2);
            var gronk  = Text.CalcHeight(right, listing.ColumnWidth / 2 - 5f);

            var rect = listing.GetRect(Mathf.Max(grongo, gronk));

            var leftRect = rect.LeftPart(.5f);

            Widgets.Label(leftRect, left);
            var rightRect = rect.RightPart(.5f);

            rightRect.x += 5;
            Widgets.Label(rightRect, right);

            var color = GUI.color;

            GUI.color = color * new Color(1f, 1f, 1f, 0.4f);
            Widgets.DrawLineVertical(rect.center.x, rect.y, rect.height);
            if (capOff)
            {
                Widgets.DrawLineHorizontal(rect.x, rect.y + rect.height, rect.width);
            }
            GUI.color = color;
        }
Example #3
0
        public override void DoWindowContents(Rect inRect)
        {
            GameFont cache = Text.Font;

            Text.Font = GameFont.Small;

            GUI.BeginGroup(inRect);

            var leftColumn  = new Rect(0f, 0f, Mathf.FloorToInt((inRect.width - 10f) * 0.65f), inRect.height);
            var rightColumn = new Rect(leftColumn.x + leftColumn.width + 10f, 0f, inRect.width - 10f - leftColumn.width, inRect.height);

            GUI.BeginGroup(leftColumn);
            DrawLeftColumn(leftColumn.AtZero());
            GUI.EndGroup();

            GUI.BeginGroup(rightColumn);
            DrawRightColumn(rightColumn.AtZero());
            GUI.EndGroup();

            Widgets.DrawLineVertical(leftColumn.x + leftColumn.width + 5f, 3f, inRect.height - 6f);

            GUI.EndGroup();

            Text.Font = cache;
        }
Example #4
0
        public override void DoWindowContents(Rect inRect)
        {
            GameFont   fontBefore   = Text.Font;
            TextAnchor anchorBefore = Text.Anchor;

            DrawHeader();
            DrawSettlementStats(0, 80);
            //set 1 = settlement, set 2 = production
            DrawButtons(370, 336, 145, 25, 1);

            if (settlement != null)
            {
                //Upgrades
                DrawFacilities(0, 295);
                DrawDescription(150, 80, 370, 220);

                //Divider
                Widgets.DrawLineVertical(530, 0, 564);

                //ProDuctTion
                DrawProductionHeader(550, 0);
                DrawButtons(560, 40, 100, 24, 2);
                DrawEconomicStats(687, 0, 139, 15);
                //lowerProDucTion
                Widgets.DrawLineHorizontal(601, 80, 422);
                DrawProductionHeaderLower(550, 80, 5);
            }

            Text.Font   = fontBefore;
            Text.Anchor = anchorBefore;
        }
        public override void OTabOnGUI(Rect rect)
        {
            Text.Font = GameFont.Small;

            Rect inRect = rect.ContractedBy(Margin);

            try
            {
                GUI.BeginGroup(inRect);

                SelectionRect = new Rect(0f, 0f, 300f, inRect.height);
                DisplayRect   = new Rect(SelectionRect.width + Margin, 0f, inRect.width - SelectionRect.width - Margin,
                                         inRect.height);

                DrawSelectionArea(SelectionRect);
                DrawDisplayArea(DisplayRect);
                Widgets.DrawLineVertical(SelectionRect.xMax + Margin / 2f, 0f, inRect.height);
            }
            catch (Exception e)
            {
                Log.Error("Exception while drawing Help OTab: \n" + e.ToString());
            }
            finally
            {
                GUI.EndGroup();
            }
        }
        public void DrawHorizontalHeader(Rect rect, PawnTable table, out Rect labelRect)
        {
            // get offset rect
            labelRect = GetLabelRect(rect);

            // draw label, slightly greyed out to contrast with work types
            GUI.color = new Color(1f, 1f, 1f, .8f);
            Widgets.Label(labelRect, Label.Truncate(labelRect.width, TruncationCache));
            GUI.color = Color.white;

            // get bottom center of label, offset left to align with boxes
            var start  = new Vector2(labelRect.center.x - 2f, labelRect.yMax);
            var length = rect.yMax - start.y;

            // make sure we're not at a whole pixel
            if (start.x - (int)start.x < 1e-4)
            {
                start.x += .5f;
            }

            // draw the lines - two separate lines give a clearer edge than one 2px line...
            GUI.color = new Color(1f, 1f, 1f, 0.3f);
            Widgets.DrawLineVertical(Mathf.FloorToInt(start.x), start.y, length);
            Widgets.DrawLineVertical(Mathf.CeilToInt(start.x), start.y, length);
            GUI.color = Color.white;
        }
Example #7
0
        private void DrawModuleTab(Rect inRect, Category selectCategory)
        {
            Rect scrollVertRectFact = new Rect(0, 0, inRect.x, DefDatabase <MKStationModuleDef> .DefCount * 35);

            GUI.color = MenuSectionBGBorderColor;
            Widgets.DrawLineVertical(245, inRect.y, 465);
            Widgets.DrawLineHorizontal(0, inRect.y, inRect.width);
            GUI.color = Color.white;

            Text.Anchor = TextAnchor.MiddleCenter;
            Rect rect2      = new Rect(inRect.x + 10, 0, 230, 30);
            Rect sliderRect = new Rect(inRect.x, inRect.y + 10, inRect.width, inRect.height);

            Widgets.BeginScrollView(sliderRect, ref slider, scrollVertRectFact, true);
            foreach (var module in DefDatabase <MKStationModuleDef> .AllDefsListForReading.Where(x => x.ModuleCategory == selectCategory))
            {
                Color bColor = canUse.ContainsKey(module) ? Color.gray : Color.white;
                if (DrawCustomButton(rect2, module.LabelCap, bColor))
                {
                    currentModule = module;
                }
                rect2.y += 35;
            }
            Widgets.EndScrollView();
            Text.Anchor = TextAnchor.UpperLeft;

            Rect rect3 = new Rect(inRect.x + 240, inRect.y + 10, 470, 455);

            if (currentModule != null)
            {
                DrawModuleInfo(rect3, currentModule);
            }
        }
Example #8
0
        private void DrawExpandedSettings(Rect canvas, [NotNull] TableItem <EventItem> ev)
        {
            float columnWidth     = Mathf.FloorToInt(canvas.width / 2f) - 26f;
            float columnHeight    = (BaseExpandedLineSpan - 1) * RowLineHeight;
            var   leftColumnRect  = new Rect(canvas.x, canvas.y, columnWidth, columnHeight);
            var   rightColumnRect = new Rect(canvas.x + leftColumnRect.width + 52f, canvas.y, columnWidth, columnHeight);
            var   embedRect       = new Rect(canvas.x, canvas.y + columnHeight, canvas.width, canvas.height - columnHeight);

            Widgets.DrawLineVertical(Mathf.FloorToInt(canvas.width / 2f), 0f, columnHeight - 5f);

            GUI.BeginGroup(leftColumnRect);
            DrawLeftExpandedSettingsColumn(leftColumnRect.AtZero(), ev);
            GUI.EndGroup();

            GUI.BeginGroup(rightColumnRect);
            DrawRightExpandedSettingsColumn(rightColumnRect.AtZero(), ev);
            GUI.EndGroup();

            if (!ev.Data.HasSettingsEmbed)
            {
                return;
            }

            GUI.BeginGroup(embedRect);
            ev.Data.SettingsEmbed !.Draw(embedRect.AtZero(), RowLineHeight);
            GUI.EndGroup();
        }
        public static void Draw(ref Listing_Standard listing)
        {
            var standard = new Listing_Standard();
            var rect     = new Rect(0, listing.curY, listing.ColumnWidth, 99999);

            GUI.BeginGroup(rect);
            rect = rect.AtZero();
            standard.Begin(rect);
            standard.ColumnWidth = (standard.ColumnWidth - 18) / 3;

            float maxHeight = DrawCategory(ref standard, PerformanceCategory.Optimizes);

            maxHeight = Mathf.Max(maxHeight, DrawCategory(ref standard, PerformanceCategory.Overrides));
            maxHeight = Mathf.Max(maxHeight, DrawCategory(ref standard, PerformanceCategory.Removes));

            // make sure the horizontal line looks exactly like gapline, and covers the entire table
            var color = GUI.color;

            GUI.color = color * new Color(1f, 1f, 1f, 0.4f);

            Widgets.DrawLineHorizontal(listing.curX, standard.curY + 33, (standard.ColumnWidth + 34) * 3);
            Widgets.DrawLineHorizontal(listing.curX, maxHeight, (standard.ColumnWidth + 34) * 3);
            Widgets.DrawLineVertical(listing.curX + (standard.ColumnWidth + 18) * 2, standard.curY, maxHeight);
            Widgets.DrawLineVertical(listing.curX + (standard.ColumnWidth + 18) * 1, standard.curY, maxHeight);

            GUI.color = color;

            standard.End();
            GUI.EndGroup();

            listing.curY += maxHeight;
        }
Example #10
0
        public static void DrawAltitudeMeter(AerialVehicleInFlight aerialVehicle)
        {
            try
            {
                Rect rect       = new Rect(AltitudeScreenPos, MeterSize);
                Rect windowRect = new Rect(rect)
                {
                    width  = rect.width * 3 + 10,
                    height = WindowHeight + InfoWindoHeight
                };
                float elevation = (MeterSize.y - (aerialVehicle.Elevation / MaximumAltitude * MeterSize.y)).Clamp(MaxAltitudeScreenHeight, MeterSize.y - MinAltitudeScreenHeight);
                Find.WindowStack.ImmediateWindow(aerialVehicle.GetHashCode(), windowRect, WindowLayer.GameUI, delegate()
                {
                    var anchor = Text.Anchor;
                    var font   = Text.Font;
                    var color  = GUI.color;

                    Rect viewRect     = rect.AtZero();
                    windowRect.x      = rect.width + 5;
                    windowRect.y      = 5;
                    windowRect.height = WindowHeight;

                    GUI.BeginScrollView(windowRect, new Vector2(windowRect.x, elevation - WindowHeight / 2), viewRect, GUIStyle.none, GUIStyle.none);

                    GUI.DrawTexture(viewRect, VehicleTex.AltitudeMeter);

                    if (elevation <= MaximumAltitude)
                    {
                        Rect lineRect = new Rect(0, windowRect.y + elevation, viewRect.width, 1f);
                        GUI.DrawTexture(lineRect, elevation >= MeterSize.y / 2 ? BaseContent.BlackTex : BaseContent.WhiteTex);
                    }

                    GUI.color = WindowBGBorderColor;
                    Widgets.DrawLineHorizontal(0, windowRect.y + elevation + MeterSize.y / 2, viewRect.width);
                    Widgets.DrawLineVertical(viewRect.width, windowRect.y, MeterSize.y);
                    GUI.color = color;

                    Text.Font        = GameFont.Small;
                    float textHeight = Text.CalcHeight(aerialVehicle.Elevation.ToString(), viewRect.width);
                    Rect labelRect   = new Rect(viewRect.width + 5, windowRect.y + elevation - textHeight / 2, viewRect.width - 5, textHeight);
                    Widgets.DrawMenuSection(labelRect);

                    Text.Font            = GameFont.Tiny;
                    Text.Anchor          = TextAnchor.MiddleCenter;
                    int elevationRounded = Mathf.RoundToInt(aerialVehicle.Elevation);
                    GUI.Label(labelRect, elevationRounded.ToString(), Text.CurFontStyle);

                    GUI.EndScrollView(false);

                    Text.Anchor = anchor;
                    Text.Font   = font;
                    GUI.color   = color;
                }, true, false, 0);
            }
            catch (Exception ex)
            {
                SmashLog.Error($"Exception thrown while trying to draw <type>AltitudeMeter</type> for {aerialVehicle?.Label ?? "NULL"}. Exception=\"{ex.Message}\"");
            }
        }
Example #11
0
        public static void DrawCurveMeasures(Rect rect, Rect viewRect, Rect graphRect, int xLabelsCount, int yLabelsCount, bool xIntegersOnly, bool yIntegersOnly)
        {
            Text.Font = GameFont.Small;
            Color color  = new Color(0.45f, 0.45f, 0.45f);
            Color color2 = new Color(0.7f, 0.7f, 0.7f);

            GUI.BeginGroup(rect);
            CalculateMeasureStartAndInc(out float start, out float inc, out int count, viewRect.xMin, viewRect.xMax, xLabelsCount, xIntegersOnly);
            Text.Anchor = TextAnchor.UpperCenter;
            string b = string.Empty;

            for (int i = 0; i < count; i++)
            {
                float  x    = start + inc * (float)i;
                string text = x.ToString("F0");
                if (!(text == b))
                {
                    b = text;
                    Vector2 vector = CurveToScreenCoordsInsideScreenRect(graphRect, viewRect, new Vector2(x, 0f));
                    float   x2     = vector.x;
                    float   num    = x2 + 60f;
                    float   num2   = rect.height - 30f;
                    GUI.color = color;
                    Widgets.DrawLineVertical(num, num2, 5f);
                    GUI.color = color2;
                    Rect rect2 = new Rect(num - 31f, num2 + 2f, 60f, 30f);
                    Text.Font = GameFont.Tiny;
                    Widgets.Label(rect2, text);
                    Text.Font = GameFont.Small;
                }
            }
            CalculateMeasureStartAndInc(out float start2, out float inc2, out int count2, viewRect.yMin, viewRect.yMax, yLabelsCount, yIntegersOnly);
            string b2 = string.Empty;

            Text.Anchor = TextAnchor.UpperRight;
            for (int j = 0; j < count2; j++)
            {
                float  y     = start2 + inc2 * (float)j;
                string text2 = y.ToString("F0");
                if (!(text2 == b2))
                {
                    b2 = text2;
                    Vector2 vector2 = CurveToScreenCoordsInsideScreenRect(graphRect, viewRect, new Vector2(0f, y));
                    float   y2      = vector2.y;
                    float   num3    = y2 + (graphRect.y - rect.y);
                    GUI.color = color;
                    Widgets.DrawLineHorizontal(55f, num3, 5f + graphRect.width);
                    GUI.color = color2;
                    Rect rect3 = new Rect(0f, num3 - 10f, 55f, 20f);
                    Text.Font = GameFont.Tiny;
                    Widgets.Label(rect3, text2);
                    Text.Font = GameFont.Small;
                }
            }
            GUI.EndGroup();
            GUI.color   = new Color(1f, 1f, 1f);
            Text.Anchor = TextAnchor.UpperLeft;
        }
Example #12
0
        public override void DoWindowContents(Rect fillRect)
        {
            Rect filterRect = fillRect.LeftPart(0.60f);
            Rect listRect   = fillRect.RightPart(0.39f);

            GUI.color = Color.grey;
            Widgets.DrawLineVertical(listRect.x - 3, 0, listRect.height);
            GUI.color = Color.white;

            DoFilter(filterRect);
            DoList(listRect);
        }
Example #13
0
        public void OutlineRect(ref Rect rectToOutline)
        {
            Widgets.DrawLineHorizontal(rectToOutline.x, rectToOutline.y, rectToOutline.width);
            Widgets.DrawLineHorizontal(rectToOutline.x, rectToOutline.y + rectToOutline.height, rectToOutline.width);
            Widgets.DrawLineVertical(rectToOutline.x, rectToOutline.y, rectToOutline.height);
            Widgets.DrawLineVertical(rectToOutline.x + rectToOutline.width - 1f, rectToOutline.y, rectToOutline.height);

            rectToOutline.x      += 3;
            rectToOutline.y      += 3;
            rectToOutline.width  -= 6;
            rectToOutline.height -= 6;
        }
        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);
        }
Example #15
0
        private void DrawArmor(Rect rect)
        {
            if (mkStation.ContainedArmor == null)
            {
                Text.Anchor = TextAnchor.MiddleCenter;
                Widgets.Label(rect, "StationInspectorInfo_NOARMOR".Translate());
                Text.Anchor = TextAnchor.UpperLeft;

                return;
            }

            GUI.color = MenuSectionBGBorderColor;
            Widgets.DrawLineVertical(280, rect.y, rect.height);
            Widgets.DrawLineVertical(870, rect.y, rect.height); //110
            Widgets.DrawLineHorizontal(0, 360, 280);
            Widgets.DrawLineHorizontal(0, rect.y, rect.width);
            GUI.color = Color.white;

            Rect leftRect = new Rect(rect.x + 10, rect.y + 10, 1100, 680);
            Rect head     = new Rect(leftRect.x + 32, leftRect.y - 10, 192, 192);
            Rect body     = new Rect(leftRect.x, leftRect.y + 55, 256, 256);

            GUI.DrawTexture(body, BodyPart);
            GUI.DrawTexture(head, HeadPart);

            Rect coreInfoRect = new Rect(leftRect.x, 370, 270, 310);

            DrawCore(coreInfoRect);

            Rect moduleRect = new Rect(300, rect.y, 130, 630);

            foreach (var slot in mkStation.ContainedArmor.Slots)
            {
                DrawSlot(moduleRect, slot);
                moduleRect.x += 140;
            }

            Rect          fullInfoRect = new Rect(875, rect.y + 5, 195, rect.height - 10);
            StringBuilder builder      = new StringBuilder();

            foreach (var armorSlot in mkStation.ContainedArmor.Slots)
            {
                foreach (var slot in armorSlot.Modules)
                {
                    if (slot.Module != null)
                    {
                        builder.AppendLine(slot.Module.StatDescription());
                    }
                }
            }
            Widgets.LabelScrollable(fullInfoRect, $"{"Station_FullInfo".Translate(builder.ToString())}", ref fullInfo);
        }
Example #16
0
        private void DrawThresholds(Rect rect)
        {
            if (_thresholds == null)
            {
                return;
            }

            GUIPlus.SetColor(Theme.BarThresholdColor.Value);
            foreach (var threshold in _thresholds.Where(threshold => threshold > 0f))
            {
                Widgets.DrawLineVertical(Mathf.Round(rect.x + (rect.width * threshold)), rect.y, rect.height);
            }
            GUIPlus.ResetColor();
        }
        public void NestedOutdent()
        {
            if (indentSizes.Count > 0)
            {
                float size = indentSizes.Pop();
                Outdent(size);
                totalIndent -= size;
                SetWidthForIndent();

                //Draw vertical line marking indention
                float startHeight = indentHeights.Pop();
                GUI.color = Color.grey;
                Widgets.DrawLineVertical(curX, startHeight, curY - startHeight - verticalSpacing);                //TODO columns?
                GUI.color = Color.white;
            }
        }
Example #18
0
        private void DrawExpandedSettings(Rect canvas, [NotNull] TableSettingsItem <ThingItem> item)
        {
            float columnWidth     = Mathf.FloorToInt(canvas.width / 2f) - 26f;
            var   leftColumnRect  = new Rect(canvas.x, canvas.y, columnWidth, canvas.height);
            var   rightColumnRect = new Rect(canvas.x + leftColumnRect.width + 52f, canvas.y, columnWidth, canvas.height);

            Widgets.DrawLineVertical(Mathf.FloorToInt(canvas.width / 2f), 0f, canvas.height - 5f);

            GUI.BeginGroup(leftColumnRect);
            DrawLeftExpandedSettingsColumn(leftColumnRect.AtZero(), item);
            GUI.EndGroup();

            GUI.BeginGroup(rightColumnRect);
            DrawRightExpandedSettingsColumn(rightColumnRect.AtZero(), item);
            GUI.EndGroup();
        }
Example #19
0
        private static void DrawColumnHeader(ref Rect inRect, string name, string desc, SortBy value, float width)
        {
            if (!columns[(int)value]) // If our column is currently collapsed
            {
                if (value != SortBy.Name)
                {
                    width = ARBITRARY_CLOSED_OFFSET;
                }
                name = "";
            }

            var rect = inRect.LeftPartPixels(width);

            Widgets.Label(rect, name);

            if (Analyzer.SortBy == value)
            {
                Widgets.DrawHighlight(rect);
            }

            if (Widgets.ButtonInvisible(rect))
            {                                  // sort by 'max'
                if (Event.current.button == 0) // left click, change sort by
                {
                    if (Analyzer.SortBy == value)
                    {
                        Analyzer.SortBy = DEFAULT_SORTBY;
                    }
                    else
                    {
                        Analyzer.SortBy = value;
                    }
                }
                else // middle / right, close the tab
                {
                    columns[(int)value] = !columns[(int)value];
                }
            }
            TooltipHandler.TipRegion(rect, desc);

            if (value != SortBy.Name)
            {
                inRect.AdjustHorizonallyBy(width);

                Widgets.DrawLineVertical(inRect.x, rect.y, rect.height);
            }
        }
Example #20
0
        private void DrawQuestCard(Rect inRect)
        {
            GUI.color = MenuSectionBGBorderColor;
            Widgets.DrawBox(new Rect(318, 534, 646, 150));
            GUI.color = Color.white;

            if (currentQuest != null)
            {
                if (currentQuest.Options != null)
                {
                    int  sliderLength       = currentQuest.Options.Count * 40;
                    Rect buttonRect         = new Rect(0, 0, 622, sliderLength);
                    Rect scrollVertRectFact = new Rect(0, 0, inRect.x, sliderLength);
                    Widgets.BeginScrollView(new Rect(332, 540, 622, 115), ref commButtonsQuestsSlider, scrollVertRectFact, false);
                    DoButtonsQuest(buttonRect);
                    Widgets.EndScrollView();
                }

                Widgets.LabelScrollable(new Rect(330, inRect.y, 620, 230), currentQuest.Description, ref commInfoQuestSlider, false, false);

                GUI.color = MenuSectionBGBorderColor;
                Widgets.DrawLineHorizontal(318, 298, 646);
                Widgets.DrawLineVertical(641, 298, 236);
                Widgets.DrawLineHorizontal(330, 330, 290);
                Widgets.DrawLineHorizontal(660, 330, 290);
                GUI.color = Color.white;

                Text.Anchor = TextAnchor.MiddleCenter;
                Widgets.Label(new Rect(330, 310, 300, 20), "QuestRewards".Translate(rewardCost));
                Text.Anchor = TextAnchor.UpperLeft;
                if (currentQuest.Rewards != null)
                {
                    int  questSliderLength     = currentQuest.Rewards.Count * 30;
                    Rect rewardsRect           = new Rect(0, 0, 323, questSliderLength);
                    Rect scrollRewVertRectFact = new Rect(0, 0, inRect.x, questSliderLength);
                    Widgets.BeginScrollView(new Rect(330, 340, 300, 180), ref questRewardSlider, scrollRewVertRectFact, false);
                    DrawQuestRewards(rewardsRect, currentQuest);
                    Widgets.EndScrollView();
                }

                Rect rectAdd = new Rect(660, 340, 300, 180);
                Text.Anchor = TextAnchor.MiddleCenter;
                Widgets.Label(new Rect(660, 310, 300, 20), string.IsNullOrEmpty(currentQuest.AdditionalQuestContentString) ? "AdditionalQuestContent".Translate().ToString() : currentQuest.AdditionalQuestContentString);
                Text.Anchor = TextAnchor.UpperLeft;
                currentQuest.DrawAdditionalOptions(rectAdd);
            }
        }
Example #21
0
        private void DrawBackgroundGrid()
        {
            var color = GUI.color;

            GUI.color = new Color(0.3f, 0.3f, 0.3f, 1f);
            for (int i = 0; i < 29; i++)
            {
                if (i < 25)
                {
                    Widgets.DrawLineHorizontal(GridSpacing.x, GridSpacing.y + GridSpacing.y * i, LeftWindowEdge - 1 - GridSpacing.x);
                    Widgets.Label(new Rect(GridSpacing.x - 20f, GridSpacing.y + GridSpacing.y * i - 10f, 20f, 20f), i.ToString());
                }
                Widgets.DrawLineVertical(GridSpacing.x + GridSpacing.x * i, GridSpacing.y, BottomWindowEdge - 1 - GridSpacing.y);
                Widgets.Label(new Rect(GridSpacing.x + GridSpacing.x * i - 5f, GridSpacing.y - 20f, 20f, 20f), i.ToString());
            }
            GUI.color = color;
        }
Example #22
0
        public override void DoHeader(Rect rect, PawnTable table)
        {
            // make sure we're at the correct font size
            Text.Font = GameFont.Tiny;

            // get offset rect
            var labelRect = GetLabelRect(rect);

            // draw label, slightly greyed out to contrast with work types
            GUI.color = new Color(1f, 1f, 1f, .8f);
            Widgets.Label(labelRect, Label.Truncate(labelRect.width, TruncationCache));
            GUI.color = Color.white;

            // get bottom center of label, offset left to align with boxes
            var start  = new Vector2(labelRect.center.x - 2f, labelRect.yMax);
            var length = rect.yMax - start.y;

            // make sure we're not at a whole pixel
            if (start.x - (int)start.x < 1e-4)
            {
                start.x += .5f;
            }

            // draw the lines - two separate lines give a clearer edge than one 2px line...
            GUI.color = new Color(1f, 1f, 1f, 0.3f);
            Widgets.DrawLineVertical(Mathf.FloorToInt(start.x), start.y, length);
            Widgets.DrawLineVertical(Mathf.CeilToInt(start.x), start.y, length);
            GUI.color = Color.white;

            // handle interactions (click + scroll)
            HeaderInteractions(labelRect, table);

            // mouseover stuff
            Widgets.DrawHighlightIfMouseover(labelRect);
            TooltipHandler.TipRegion(labelRect, GetHeaderTip(table));

            // sort icon
            if (table.SortingBy == def)
            {
                Texture2D sortIcon    = (!table.SortingDescending) ? SortingIcon : SortingDescendingIcon;
                Rect      bottomRight = new Rect(rect.xMax - sortIcon.width - 1f, rect.yMax - sortIcon.height - 1f,
                                                 sortIcon.width, sortIcon.height);
                GUI.DrawTexture(bottomRight, sortIcon);
            }
        }
Example #23
0
        /// <summary>
        ///     Draws the table according to the internal state of the worker.
        /// </summary>
        /// <remarks>
        ///     There is no <see cref="Rect"/> parameter as this class stitches
        ///     its state together from "events" implementors must call when
        ///     relevant.
        /// </remarks>
        public void Draw()
        {
            GUI.color = new Color(1f, 1f, 1f, 0.15f);
            Widgets.DrawLineVertical(_modifierRect.x - 8f, _modifierRect.y + 10f, _modifierRect.height - 20f);
            GUI.color = Color.white;

            GUI.BeginGroup(_selectorRect);
            DrawSelectorMenu(_selectorRect.AtZero());
            GUI.EndGroup();

            GUI.BeginGroup(_modifierRect);
            DrawMutatorMenu(_modifierRect.AtZero());
            GUI.EndGroup();

            GUI.BeginGroup(_tableRect);
            Worker?.Draw(_tableRect.AtZero());
            GUI.EndGroup();
        }
        public override void DoHeader(Rect rect, PawnTable table)
        {
            base.DoHeader(rect, table);
            Text.Font = GameFont.Small;
            if (this.cachedWorkLabelSize == default(Vector2))
            {
                this.cachedWorkLabelSize = Text.CalcSize(this.def.workType.labelShort);
            }
            Rect labelRect = this.GetLabelRect(rect);

            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(labelRect, this.def.workType.labelShort);
            GUI.color = new Color(1f, 1f, 1f, 0.3f);
            Widgets.DrawLineVertical(labelRect.center.x, labelRect.yMax - 3f, rect.y + 50f - labelRect.yMax + 3f);
            Widgets.DrawLineVertical(labelRect.center.x + 1f, labelRect.yMax - 3f, rect.y + 50f - labelRect.yMax + 3f);
            GUI.color   = Color.white;
            Text.Anchor = TextAnchor.UpperLeft;
        }
        public override void DoHeader(Rect rect, PawnTable table)
        {
            // todo; cache labelRect instead of size?
            Rect labelRect = GetHeaderLabelRect(rect);

            base.DoHeader(labelRect, table);

            // vertical line
            if (!MoveDown)
            {
                var lineStart = new Vector2(Mathf.FloorToInt(rect.center.x), labelRect.yMax);
                // note that two 1px lines give a much crisper line than one 2px line. Obv.
                GUI.color = new Color(1f, 1f, 1f, .3f);
                Widgets.DrawLineVertical(lineStart.x, lineStart.y, 20f);
                Widgets.DrawLineVertical(lineStart.x + 1, lineStart.y, 20f);
                GUI.color = Color.white;
            }
        }
Example #26
0
        private void DrawFactionCard(Rect rect)
        {
            if (currentFaction != null)
            {
                Text.Font   = GameFont.Medium;
                Text.Anchor = TextAnchor.UpperCenter;
                GUI.color   = currentFaction.Faction.PlayerRelationKind.GetColor();
                Widgets.Label(new Rect(rect.x, rect.y - 10, rect.width + 10, 40), currentFaction.Faction.Name);
                GUI.color = Color.white;
                Widgets.DrawLineHorizontal(rect.x + (rect.x / 2), rect.y + 20, 280);
                Text.Anchor = TextAnchor.UpperLeft;
                Text.Font   = GameFont.Small;
                rect.y     += 30;

                Widgets.LabelScrollable(new Rect(rect.x, rect.y, rect.width, 180), currentFaction.Faction.def.description, ref commInfoSlider, false, false);

                Rect rect2 = new Rect(rect.x, rect.y + 200, rect.width / 2, 20);
                Widgets.Label(rect2, "FactionInteractionDef".Translate(currentFaction.Faction.def.LabelCap));
                rect2.y += 22;
                Widgets.Label(rect2, $"{currentFaction.Faction.def.leaderTitle.CapitalizeFirst()}: {currentFaction.Faction.leader.Name}");
                rect2.y += 30;
                StringBuilder builder = new StringBuilder();
                foreach (Faction item in Find.FactionManager.AllFactionsInViewOrder)
                {
                    if (item != currentFaction.Faction && (!item.IsPlayer && !item.def.hidden) && currentFaction.Faction.HostileTo(item))
                    {
                        builder.Append("HostileTo".Translate(item.Name));
                        builder.AppendLine();
                    }
                }
                Widgets.LabelScrollable(new Rect(rect2.x, rect2.y, rect2.width, 285), builder.ToString(), ref commSlider);

                Rect rect3 = new Rect((rect.x + rect.width / 2) + 10, rect.y + 200, rect.width / 2, 285);
                GUI.color = CommCardBGColor;
                Widgets.DrawLineVertical(rect.x + rect.width / 2, rect3.y, 285);
                GUI.color = Color.white;
                int  sliderLength       = currentFaction.Options.Count * 30;
                Rect buttonRect         = new Rect(0, 0, rect3.width, sliderLength);
                Rect scrollVertRectFact = new Rect(0, 0, rect3.x, sliderLength);
                Widgets.BeginScrollView(rect3, ref commButtonsQuestsSlider, scrollVertRectFact, false);
                DrawInteractionButtons(buttonRect);
                Widgets.EndScrollView();
            }
        }
Example #27
0
        public override void DoHeader(Rect rect, PawnTable table)
        {
            base.DoHeader(rect, table);
            Text.Font = GameFont.Small;
            if (cachedWorkLabelSize == default)
            {
                cachedWorkLabelSize = Text.CalcSize(CastDef.skillDef.defName);
            }
            Rect labelRect = GetLabelRect(rect);

            MouseoverSounds.DoRegion(labelRect);
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(labelRect, CastDef.skillDef.defName);
            GUI.color = new Color(1f, 1f, 1f, 0.3f);
            Widgets.DrawLineVertical(labelRect.center.x, labelRect.yMax - 3f, rect.y + 50f - labelRect.yMax + 3f);
            Widgets.DrawLineVertical(labelRect.center.x + 1f, labelRect.yMax - 3f, rect.y + 50f - labelRect.yMax + 3f);
            GUI.color   = Color.white;
            Text.Anchor = TextAnchor.UpperLeft;
        }
Example #28
0
        public void Draw(Rect rect)
        {
            Rect leftRect = new Rect(rect)
            {
                width = rect.width / 3
            };
            Rect rightRect = new Rect(rect)
            {
                xMin = leftRect.xMax
            };

            Widgets.DrawLineVertical(leftRect.xMax, leftRect.y + 24f, rect.height - 24f);

            leftRect.xMax -= 10f;
            DoLeft(leftRect);

            rightRect.xMin += 10f;
            DoRight(rightRect);
        }
 public static void DrawPsycheMenuCard(Rect rect, Pawn pawn)
 {
     if (PsycheHelper.PsychologyEnabled(pawn))
     {
         GUI.BeginGroup(rect);
         Text.Font = GameFont.Small;
         Rect rect2 = new Rect(10f, 10f, rect.width - 10f, rect.height - 10f);
         Rect rect4 = rect2;
         Rect rect5 = rect2;
         rect4.width *= 0.6f;
         rect4.xMin  -= 20f;
         rect5.x      = rect4.xMax + 17f;
         rect5.xMax   = rect.xMax;
         GUI.color    = new Color(1f, 1f, 1f, 0.5f);
         Widgets.DrawLineVertical(rect4.xMax, 0f, rect.height);
         GUI.color = Color.white;
         PsycheCardUtility.DrawPersonalityNodes(rect4, pawn);
         PsycheCardUtility.DrawSexuality(rect5, pawn, false);
         GUI.EndGroup();
     }
 }
        private static void DrawColumnHeader(ref Rect inRect, Column c)
        {
            Widgets.DrawOptionBackground(inRect, false);

            var rect = inRect.LeftPartPixels(NUMERIC_WIDTH);

            if (c.total != 0)
            {
                Widgets.Label(rect.TopHalf(), c.Name);
                Widgets.Label(rect.BottomHalf(), $"{c.total:0.000}ms");
            }
            else
            {
                Widgets.Label(rect, (c.sortBy == SortBy.Name ? "    " : "") + c.Name);
            }

            if (Analyzer.SortBy == c.sortBy)
            {
                Widgets.DrawHighlight(rect);
            }

            if (Widgets.ButtonInvisible(rect))
            {
                if (Event.current.button == 0) // left click, change sort by
                {
                    Analyzer.SortBy = Analyzer.SortBy == c.sortBy ? DEFAULT_SORTBY : c.sortBy;
                }
            }

            TooltipHandler.TipRegion(rect, c.Desc);

            if (c.sortBy != SortBy.Name)
            {
                inRect.AdjustHorizonallyBy(NUMERIC_WIDTH);

                GUI.color = Color.grey;
                Widgets.DrawLineVertical(inRect.x, rect.y, rect.height);
                GUI.color = Color.white;
            }
        }