Exemple #1
0
        public override void DoSettingsWindowContents(Rect rect)
        {
            Listing_Standard list = new Listing_Standard()
            {
                ColumnWidth = rect.width
            };

            list.Begin(rect);
            list.Gap();
            {
                Rect leftRect = list.GetRect(Text.LineHeight).LeftHalf().Rounded();

                Widgets.CheckboxLabeled(leftRect, Static.Label_ArcadeJoyBool, ref JoySettings.ArcadesGiveXp);
                if (Mouse.IsOver(leftRect))
                {
                    Widgets.DrawHighlight(leftRect);
                }
                TooltipHandler.TipRegion(leftRect, Static.ToolTip_ArcadeJoyBool);
            }
            list.Gap();
            {
                Rect fullRect  = list.GetRect(Text.LineHeight);
                Rect leftRect  = fullRect.LeftHalf().Rounded();
                Rect rightRect = fullRect.RightHalf().Rounded();

                Widgets.Label(leftRect, "AJO_Label_ArcadeJoyGain".Translate(JoySettings.ArcadeXpMultiplier));
                if (Mouse.IsOver(leftRect))
                {
                    Widgets.DrawHighlight(leftRect);
                }
                TooltipHandler.TipRegion(leftRect, Static.ToolTip_ArcadeJoyGain);
                IntSlider(rightRect, ref JoySettings.ArcadeXpMultiplier, 1, 3);
            }
            list.End();
        }
 public static GenUI.AnonymousStackElement GetStandardRewardStackElement(string label, Action <Rect> iconDrawer, Func <string> tipGetter, Action onClick = null)
 {
     return(new GenUI.AnonymousStackElement
     {
         drawer = delegate(Rect rect)
         {
             Widgets.DrawHighlight(rect);
             Rect rect2 = new Rect(rect.x + 6f, rect.y + 1f, rect.width - 12f, rect.height - 2f);
             if (Mouse.IsOver(rect))
             {
                 Widgets.DrawHighlight(rect);
                 if (tipGetter != null)
                 {
                     TooltipHandler.TipRegion(rect, new TipSignal(tipGetter, 0x56AAA7E ^ (int)rect.x ^ (int)rect.y));
                 }
             }
             Rect obj = new Rect(rect2.x, rect2.y, 22f, 22f);
             iconDrawer(obj);
             Rect rect3 = rect2;
             rect3.xMin += 24f;
             Widgets.Label(rect3, label);
             if (onClick != null && Widgets.ButtonInvisible(rect))
             {
                 onClick();
             }
         },
         width = Text.CalcSize(label).x + 12f + 22f + 2f
     });
 }
        public void DrawHeader()
        {
            //Draw Settlement Header Highlight
            Widgets.DrawHighlight(new Rect(0, 0, 520, 60));
            Widgets.DrawBox(new Rect(0, 0, 520, 60));

            //Draw town level and shadow backing
            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.DrawShadowAround(new Rect(5, 15, 30, 30));
            Widgets.Label(new Rect(5, 15, 30, 30), settlement.settlementLevel.ToString());

            //Draw town name
            Text.Anchor = TextAnchor.MiddleLeft;
            Widgets.Label(new Rect(40, 0, 520, 30), settlement.name);

            //Draw town title
            Text.Font = GameFont.Tiny;
            Widgets.Label(new Rect(50, 25, 150, 20), settlement.title);             //returnSettlement().title);

            //Draw town location flabor text
            Text.Font = GameFont.Tiny;
            Widgets.Label(new Rect(55, 40, 470, 20), "Located".Translate() + " " + HillinessUtility.GetLabel(Find.WorldGrid.tiles[settlement.mapLocation].hilliness) + " " + "LandOf".Translate() + " " + Find.WorldGrid.tiles[settlement.mapLocation].biome.LabelCap.ToLower());             //returnSettlement().title);

            //Draw header Settings button
            if (Widgets.ButtonImage(new Rect(495, 5, 20, 20), texLoad.iconCustomize))
            {             //if click faction customize button
                Find.WindowStack.Add(new settlementCustomizeWindowFC(settlement));
                //Log.Message("Settlement customize clicked");
            }
        }
Exemple #4
0
        void DrawModRow(Rect modRect, ModCategory mod)
        {
            GUI.BeginGroup(modRect);

            if (modRect.Contains(Event.current.mousePosition))
            {
                Widgets.DrawHighlight(modRect);
            }

            var imageRect = new Rect(
                Margin, modRect.height / 2f - ArrowImageSize.y / 2f,
                ArrowImageSize.x, ArrowImageSize.y);

            Texture2D texture = mod.Expanded ? Icon.HelpMenuArrowUp : Icon.HelpMenuArrowDown;

            GUI.DrawTexture(imageRect, texture);

            var labelRect = new Rect(
                imageRect.xMax + Margin, 0f,
                modRect.width - ArrowImageSize.x - Margin * 2, EntryHeight);

            Text.Anchor = TextAnchor.MiddleLeft;
            GUI.color   = Color.yellow;
            Widgets.Label(labelRect, mod.ModName);
            GUI.color   = Color.white;
            Text.Anchor = TextAnchor.UpperLeft;

            if (Widgets.InvisibleButton(modRect))
            {
                mod.Expanded = !mod.Expanded;
            }
            GUI.EndGroup();
        }
        private void DoRow(Rect rect, Pawn p)
        {
            GUI.BeginGroup(rect);
            Rect rect2 = rect.AtZero();

            CaravanThingsTabUtility.DoAbandonButton(rect2, p, base.SelCaravan);
            rect2.width -= 24f;
            Widgets.InfoCardButton(rect2.width - 24f, (rect.height - 24f) / 2f, p);
            rect2.width -= 24f;
            CaravanThingsTabUtility.DoOpenSpecificTabButton(rect2, p, ref specificSocialTabForPawn);
            rect2.width -= 24f;
            if (Mouse.IsOver(rect2))
            {
                Widgets.DrawHighlight(rect2);
            }
            Rect rect3 = new Rect(4f, (rect.height - 27f) / 2f, 27f, 27f);

            Widgets.ThingIcon(rect3, p);
            Rect bgRect = new Rect(rect3.xMax + 4f, 8f, 100f, 18f);

            GenMapUI.DrawPawnLabel(p, bgRect, 1f, 100f, null, GameFont.Small, alwaysDrawBg: false, alignCenter: false);
            if (p.Downed)
            {
                GUI.color = new Color(1f, 0f, 0f, 0.5f);
                Widgets.DrawLineHorizontal(0f, rect.height / 2f, rect.width);
                GUI.color = Color.white;
            }
            GUI.EndGroup();
        }
Exemple #6
0
        // Token: 0x06000039 RID: 57 RVA: 0x00003F04 File Offset: 0x00002104
        private static void DrawTimeAssignmentSelectorFor(Rect rect, TimeAssignmentDef ta)
        {
            rect = rect.ContractedBy(2f);
            GUI.DrawTexture(rect, ta.ColorTexture);
            if (Widgets.ButtonInvisible(rect))
            {
                TimeAssignmentSelector.selectedAssignment = ta;
                SoundDefOf.Tick_High.PlayOneShotOnCamera();
            }

            GUI.color = Color.white;
            if (Mouse.IsOver(rect))
            {
                Widgets.DrawHighlight(rect);
            }

            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleCenter;
            GUI.color   = Color.white;
            Widgets.Label(rect, ta.LabelCap);
            Text.Anchor = TextAnchor.UpperLeft;
            if (TimeAssignmentSelector.selectedAssignment == ta)
            {
                Widgets.DrawBox(rect, 2);
            }
        }
Exemple #7
0
        private static float DrawRecord(float x, float y, float width, RecordDef record, Pawn pawn)
        {
            float  num  = width * 0.45f;
            string text = ((record.type != 0) ? pawn.records.GetValue(record).ToString("0.##") : pawn.records.GetAsInt(record).ToStringTicksToPeriod());
            Rect   rect = new Rect(8f, y, width, Text.CalcHeight(text, num));

            if (Mouse.IsOver(rect))
            {
                Widgets.DrawHighlight(rect);
            }
            Rect rect2 = rect;

            rect2.width -= num;
            Widgets.Label(rect2, record.LabelCap);
            Rect rect3 = rect;

            rect3.x     = rect2.xMax;
            rect3.width = num;
            Widgets.Label(rect3, text);
            if (Mouse.IsOver(rect))
            {
                TooltipHandler.TipRegion(rect, new TipSignal(() => record.description, record.GetHashCode()));
            }
            return(rect.height);
        }
Exemple #8
0
        private void DrawWarRect(Rect rect, ref int y, War war)
        {
            Text.Anchor = TextAnchor.UpperLeft;
            Text.Font   = GameFont.Small;

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

            Widgets.Label(titleRect, war.WarName);
            Text.Font = GameFont.Tiny;
            Rect rect2 = new Rect(15, y + 22, rect.width - 30, 50);

            Widgets.Label(rect2, "WarManager_Factions".Translate(war.WarGoalDef.LabelCap, war.AssaultFactions.Count, war.AttackedAlliance == null ? "WarManager_NoAlliance".Translate().ToString() : war.AttackedAlliance.Name, war.DefendingFactions.Count,
                                                                 war.DefendAlliance == null ? "WarManager_NoAlliance".Translate().ToString() : war.DefendAlliance.Name));

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

            if (Widgets.ButtonInvisible(r))
            {
                if (war != currentWar)
                {
                    currentWar = war;
                    stat       = currentWar.StatWorker.GetStat();
                }
            }

            GUI.color = war.WarGoalDef.MenuColor;
            Widgets.DrawHighlight(r);
            GUI.color = Color.white;

            Widgets.DrawHighlightIfMouseover(r);

            y += 85;
        }
Exemple #9
0
        public static void DrawLevelBar(Rect rect, CompVampire compVampire)
        {
            if (rect.height > 70f)
            {
                float num = (rect.height - 70f) / 2f;
                rect.height = 70f;
                rect.y     += num;
            }
            if (Mouse.IsOver(rect))
            {
                Widgets.DrawHighlight(rect);
            }
            TooltipHandler.TipRegion(rect, new TipSignal(() => XPTipString(compVampire), rect.GetHashCode()));
            float num2 = 14f;

            if (rect.height < 50f)
            {
                num2 *= Mathf.InverseLerp(0f, 50f, rect.height);
            }
            Text.Anchor = TextAnchor.UpperLeft;
            Rect rect3 = new Rect(rect.x, rect.y + rect.height / 2f, rect.width, rect.height);

            rect3 = new Rect(rect3.x, rect3.y, rect3.width, rect3.height - num2);

            Color colorToUse    = new Color(1.0f, 0.91f, 0f);
            Color colorToUseTwo = new Color(0.4f, 0.1f, 0.1f);

            Widgets.FillableBar(rect3, (float)compVampire.XPTillNextLevelPercent, SolidColorMaterials.NewSolidColorTexture(colorToUse), SolidColorMaterials.NewSolidColorTexture(colorToUseTwo), false);
        }
Exemple #10
0
 private void DoMessageDetails(Rect detailsRect, Rect outRect)
 {
     if (EditWindow_Log.selectedMessage != null)
     {
         Rect rect = detailsRect;
         rect.height = 7f;
         Rect rect2 = detailsRect;
         rect2.yMin = rect.yMax;
         GUI.DrawTexture(rect, EditWindow_Log.StackTraceBorderTex);
         if (Mouse.IsOver(rect))
         {
             Widgets.DrawHighlight(rect);
         }
         if (Event.current.type == EventType.MouseDown && Mouse.IsOver(rect))
         {
             this.borderDragging = true;
             Event.current.Use();
         }
         if (this.borderDragging)
         {
             float   num           = outRect.height + Mathf.Round(3.5f);
             Vector2 mousePosition = Event.current.mousePosition;
             EditWindow_Log.detailsPaneHeight = num - mousePosition.y;
         }
         if (Event.current.rawType == EventType.MouseUp)
         {
             this.borderDragging = false;
         }
         GUI.DrawTexture(rect2, EditWindow_Log.StackTraceAreaTex);
         string text = EditWindow_Log.selectedMessage.text + "\n" + EditWindow_Log.selectedMessage.StackTrace;
         GUI.SetNextControlName(EditWindow_Log.MessageDetailsControlName);
         Widgets.TextAreaScrollable(rect2, text, ref EditWindow_Log.detailsScrollPosition, true);
     }
 }
Exemple #11
0
 private void DrawDaysUntilRot(Rect rect, TransferableOneWay trad)
 {
     if (trad.HasAnyThing && trad.ThingDef.IsNutritionGivingIngestible)
     {
         int num = 2147483647;
         for (int i = 0; i < trad.things.Count; i++)
         {
             CompRottable compRottable = trad.things[i].TryGetComp <CompRottable>();
             if (compRottable != null)
             {
                 num = Mathf.Min(num, compRottable.ApproxTicksUntilRotWhenAtTempOfTile(this.drawDaysUntilRotForTile));
             }
         }
         if (num < 36000000)
         {
             if (Mouse.IsOver(rect))
             {
                 Widgets.DrawHighlight(rect);
             }
             float num2 = (float)((float)num / 60000.0);
             GUI.color = Color.yellow;
             Widgets.Label(rect, num2.ToString("0.#"));
             GUI.color = Color.white;
             TooltipHandler.TipRegion(rect, "DaysUntilRotTip".Translate());
         }
     }
 }
Exemple #12
0
        public static void DrawCompabilities(Rect rect, Pawn pawn, ref float curY)
        {
            GUI.BeginGroup(rect);
            float y = 0.0f;

            Widgets.ListSeparator(ref y, rect.width, "ReligionInfo_Compabilities".Translate());
            float height = CompReligion.ReligionCompability.Compabilities.Count() * 24f;

            Widgets.BeginScrollView(new Rect(0.0f, y, rect.width, rect.height), ref scrollPosition, new Rect(0.0f, y, rect.width, height), true);
            foreach (KeyValuePair <Religion, float> kvp in CompReligion.ReligionCompability.Compabilities)
            {
                Rect rectRow = new Rect(0.0f, y, rect.width, 24f);
                if (Mouse.IsOver(rectRow))
                {
                    Widgets.DrawHighlight(rectRow);
                }
                //StringBuilder stringBuilder = CompabilityReason(kvp.Key, pawn);
                //if (stringBuilder != null)
                //    TooltipHandler.TipRegion(rectRow, new TipSignal(stringBuilder.ToString(), 7770));
                Widgets.Label(rectRow, kvp.Key.Label);
                Widgets.Label(new Rect(rectRow.x + 210f, rectRow.y, rectRow.width, rectRow.height), kvp.Value.ToString());
                y += 24f;
            }
            curY += y;
            Widgets.EndScrollView();
            GUI.EndGroup();
        }
Exemple #13
0
        public static bool DrawTableHeader(Rect backgroundRect, Rect iconRect, Texture2D icon, bool vertical = false)
        {
            if (vertical)
            {
                backgroundRect.y += backgroundRect.width;
                GUIUtility.RotateAroundPivot(-90f, backgroundRect.position);
            }

            GUI.color = new Color(0.62f, 0.65f, 0.66f);
            Widgets.DrawHighlight(backgroundRect);
            GUI.color = Color.white;

            if (Mouse.IsOver(backgroundRect))
            {
                GUI.color = Color.grey;
                Widgets.DrawLightHighlight(backgroundRect);
                GUI.color = Color.white;
            }

            GUI.DrawTexture(iconRect, icon);
            bool pressed = Widgets.ButtonInvisible(backgroundRect);

            if (vertical)
            {
                GUI.matrix = Matrix4x4.identity;
            }

            return(pressed);
        }
Exemple #14
0
        private static void DrawScrollBoxEntry(Rect inRect, Rect outRect, WorkPackageDef def, bool alternate)
        {
            try
            {
                if (inRect.Contains(Event.current.mousePosition) && outRect.Contains(Event.current.mousePosition))
                {
                    Widgets.DrawHighlight(inRect);
                    TooltipHandler.TipRegion(inRect, def.Tooltip);
                }
                else if (alternate)
                {
                    Widgets.DrawAltRect(inRect);
                }

                GUI.BeginGroup(inRect);
                Rect labelRect = new Rect(0f, 0f, inRect.width, inRect.height);
                Text.Anchor = TextAnchor.MiddleCenter;
                Widgets.Label(labelRect, def.label);
                Text.Anchor = TextAnchor.UpperLeft;
            }
            finally
            {
                GUI.EndGroup();
                Text.Anchor = TextAnchor.UpperLeft;
            }
        }
        // All C# based mod settings can go here.  If better organization
        //   is desired, we can set up some ContainerRow classes that are
        //   organized by XML?  But that's a lot of work.
        private static void CSharpSettings(Listing_Standard list)
        {
            // Style: do your section of settings and then list.GapLine();
            Rect rect = list.GetRect(30);

            Widgets.DrawRectFast(rect, Color.gray);
            var tmp    = Text.Font;
            var tmpAnc = Text.Anchor;

            Text.Font   = GameFont.Medium;
            Text.Anchor = TextAnchor.MiddleCenter;

            Widgets.Label(rect, "PRF_Settings_C_Lite_Header".Translate());
            Text.Font   = tmp;
            Text.Anchor = tmpAnc;

            list.Gap();

            rect = list.GetRect(20);
            if (Mouse.IsOver(rect))
            {
                Widgets.DrawHighlight(rect);
            }
            TooltipHandler.TipRegion(rect, "PRF_Settings_C_Lite_ToolTip".Translate());
            Widgets.CheckboxLabeled(rect, "PRF_Settings_C_Lite_Label".Translate(), ref PRF_LiteMode);
            list.Gap();

            if (PRF_LiteMode != PRF_LiteMode_last)
            {
                PRF_CustomizeDefs.ToggleLiteMode(PRF_LiteMode);
            }
            PRF_LiteMode_last = PRF_LiteMode;
        }
        private void DrawModRow(Rect modRect, ModCategory mod)
        {
            try
            {
                GUI.BeginGroup(modRect);

                if (modRect.Contains(Event.current.mousePosition))
                {
                    Widgets.DrawHighlight(modRect);
                }

                Rect      imageRect = new Rect(Margin, modRect.height / 2f - ArrowImageSize.y / 2f, ArrowImageSize.x, ArrowImageSize.y);
                Texture2D texture   = mod.Expanded ? ArrowUpTex : ArrowDownTex;
                GUI.DrawTexture(imageRect, texture);

                Rect labelRect = new Rect(imageRect.xMax + Margin, 0f, modRect.width - ArrowImageSize.x - Margin * 2, EntryHeight);
                Text.Anchor = TextAnchor.MiddleLeft;
                GUI.color   = Color.yellow;
                Text.Font   = GameFont.Medium;
                Widgets.Label(labelRect, mod.ModName);
                Text.Font   = GameFont.Small;
                GUI.color   = Color.white;
                Text.Anchor = TextAnchor.UpperLeft;

                if (Widgets.InvisibleButton(modRect))
                {
                    mod.Expanded = !mod.Expanded;
                }
            }
            finally
            {
                GUI.EndGroup();
            }
        }
        public void LabelHighlight(string label, float maxHeight = -1f, string tooltip = null)
        {
            float num  = Text.CalcHeight(label, base.ColumnWidth);
            bool  flag = false;

            if (maxHeight >= 0f && num > maxHeight)
            {
                num  = maxHeight;
                flag = true;
            }
            Rect rect = base.GetRect(num);

            if (flag)
            {
                Vector2 labelScrollbarPosition = this.GetLabelScrollbarPosition(this.curX, this.curY);
                Widgets.LabelScrollable(rect, label, ref labelScrollbarPosition, false, true);
                this.SetLabelScrollbarPosition(this.curX, this.curY, labelScrollbarPosition);
            }
            else
            {
                Widgets.Label(rect, label);
            }
            if (!tooltip.NullOrEmpty())
            {
                if (Mouse.IsOver(rect))
                {
                    Widgets.DrawHighlight(rect);
                }
                TooltipHandler.TipRegion(rect, tooltip);
            }
            base.Gap(this.verticalSpacing);
        }
        private void DrawHelpCategoryRow(Rect catRect, HelpCategoryDef cat)
        {
            try
            {
                GUI.BeginGroup(catRect);

                if (catRect.Contains(Event.current.mousePosition))
                {
                    Widgets.DrawHighlight(catRect);
                }

                Rect      imageRect = new Rect(Margin * 2, catRect.height / 2f - ArrowImageSize.y / 2f, ArrowImageSize.x, ArrowImageSize.y);
                Texture2D texture   = cat.Expanded ? ArrowUpTex : ArrowDownTex;
                GUI.DrawTexture(imageRect, texture);

                Rect labelRect = new Rect(imageRect.xMax + Margin, 0f, catRect.width - imageRect.width - Margin * 3, catRect.height);
                Text.Anchor = TextAnchor.MiddleLeft;
                Widgets.Label(labelRect, cat.LabelCap);
                Text.Anchor = TextAnchor.UpperLeft;

                GUI.color = Color.gray;
                Widgets.DrawLineHorizontal(0f, 0f, catRect.width);
                GUI.color = Color.white;

                if (Widgets.InvisibleButton(catRect))
                {
                    cat.Expanded = !cat.Expanded;
                }
            }
            finally
            {
                Text.Anchor = TextAnchor.UpperLeft;
                GUI.EndGroup();
            }
        }
Exemple #19
0
        public bool CheckboxLabeled(string label, ref bool checkOn, bool dev, ref float modifier, string tooltip = null, bool disabled = false, bool highlight = false, Texture2D texChecked = null, Texture2D texUnchecked = null, bool placeCheckboxNearText = false, bool extend = false)
        {
            float lineHeight = Text.LineHeight;
            Rect  rect       = this.GetRect(lineHeight, null, extend);

            if (dev)
            {
                Rect r = rect.RightPart(0.25f);
                rect = rect.LeftPart(0.75f);
                if (Widgets.ButtonText(r.LeftHalf(), "-"))
                {
                    modifier--;
                }
                if (Widgets.ButtonText(r.RightHalf(), "+"))
                {
                    modifier++;
                }
            }
            if (!tooltip.NullOrEmpty() || highlight)
            {
                if (Mouse.IsOver(rect))
                {
                    Widgets.DrawHighlight(rect);
                }
                if (!tooltip.NullOrEmpty())
                {
                    TooltipHandler.TipRegion(rect, tooltip);
                }
            }
            AdeptusWidgets.CheckboxLabeled(rect, label, ref checkOn, disabled, texChecked, texUnchecked, placeCheckboxNearText);
            this.Gap(this.verticalSpacing);
            return(checkOn);
        }
        private static void DoAreaRow(Rect rect, Area area)
        {
            if (Mouse.IsOver(rect))
            {
                area.MarkForDraw();
                GUI.color = area.Color;
                Widgets.DrawHighlight(rect);
                GUI.color = Color.white;
            }
            GUI.BeginGroup(rect);
            WidgetRow widgetRow = new WidgetRow(0f, 0f);

            widgetRow.Icon(area.ColorTexture);
            widgetRow.Gap(4f);
            float width = rect.width - widgetRow.FinalX - 4f - Text.CalcSize("Rename".Translate()).x - 16f - 4f - Text.CalcSize("InvertArea".Translate()).x - 16f - 4f - 24f;

            widgetRow.Label(area.Label, width);
            if (widgetRow.ButtonText("Rename".Translate()))
            {
                Find.WindowStack.Add(new Dialog_RenameArea(area));
            }
            if (widgetRow.ButtonText("InvertArea".Translate()))
            {
                area.Invert();
            }
            if (widgetRow.ButtonIcon(TexButton.DeleteX, null, GenUI.SubtleMouseoverColor))
            {
                area.Delete();
            }
            GUI.EndGroup();
        }
        private void OperationModeRadioButton(Listing_Standard listing, float labelInset, string label, QuickstartSettings settings, QuickstartSettings.QuickstartMode assignedMode, string tooltip)
        {
            const float labelTopMargin = -4f;
            const float fontSize       = 16f;
            float       lineHeight     = Text.LineHeight;
            var         entryRect      = listing.GetRect(lineHeight + listing.verticalSpacing);
            var         labelRect      = new Rect(entryRect.x + labelInset, entryRect.y + labelTopMargin, entryRect.width - labelInset, entryRect.height - labelTopMargin);
            var         rowRect        = new Rect(entryRect.x, entryRect.y, entryRect.width, entryRect.height);

            if (tooltip != null)
            {
                if (Mouse.IsOver(rowRect))
                {
                    Widgets.DrawHighlight(rowRect);
                }
                TooltipHandler.TipRegion(rowRect, tooltip);
            }
            if (Widgets.ButtonInvisible(rowRect))
            {
                if (settings.OperationMode != assignedMode)
                {
                    SoundDefOf.Click.PlayOneShotOnCamera();
                    QuickstartController.Settings.OperationMode = assignedMode;
                }
            }
            Widgets.RadioButton(entryRect.x, entryRect.y, settings.OperationMode == assignedMode);

            Text.Font = GameFont.Medium;
            var emphasizedLabel = string.Format("<size={0}>{1}</size>", fontSize, label);

            Widgets.Label(labelRect, emphasizedLabel);
            Text.Font = GameFont.Small;
        }
Exemple #22
0
        private void DrawLockedMissionTab(Rect rect, MissionDef def, StoryControlDef SCD)
        {
            rect = rect.ContractedBy(1f);
            if (Mouse.IsOver(rect) || selectedLockedMission == def)
            {
                Widgets.DrawHighlight(rect);
            }
            float     offset = (rect.height - 24f) * 0.5f;
            WidgetRow tab    = new WidgetRow(rect.x + offset, rect.y + offset);

            tab.Label(def.LabelCap);
            if (Widgets.ButtonInvisible(rect))
            {
                SoundDefOf.Click.PlayOneShotOnCamera(null);
                selectedLockedMission = def;
                SelectedMission       = null;
            }
            bool mouseOver = Mouse.IsOver(rect);

            /*
             * if (mouseOver || selectedLockedMission == def)
             * {
             *  Color color = SCD.borderColor.ToColor;
             *  Color half = color;
             *  half.a = 0.5f;
             *  GUI.color = mouseOver ? half : color;
             *  Widgets.DrawBox(rect, 1);
             *  GUI.color = Color.white;
             * }
             */
        }
Exemple #23
0
        public float Draw(float x, float y, float width, bool selected, Action clickedCallback)
        {
            float num  = (float)(width * 0.44999998807907104);
            Rect  rect = new Rect(8f, y, width, Text.CalcHeight(this.ValueString, num));

            if (selected)
            {
                Widgets.DrawHighlightSelected(rect);
            }
            else if (Mouse.IsOver(rect))
            {
                Widgets.DrawHighlight(rect);
            }
            Rect rect2 = rect;

            rect2.width -= num;
            Widgets.Label(rect2, this.LabelCap);
            Rect rect3 = rect;

            rect3.x     = rect2.xMax;
            rect3.width = num;
            Widgets.Label(rect3, this.ValueString);
            if (this.stat != null)
            {
                StatDef localStat = this.stat;
                TooltipHandler.TipRegion(rect, new TipSignal(() => localStat.LabelCap + ": " + localStat.description, this.stat.GetHashCode()));
            }
            if (Widgets.ButtonInvisible(rect, false))
            {
                clickedCallback();
            }
            return(rect.height);
        }
Exemple #24
0
        private void DrawMissionTab(Rect rect, Mission mission, StoryControlDef SCD, int num)
        {
            mission.Notify_Seen();
            rect = rect.ContractedBy(1f);
            if (Mouse.IsOver(rect) || SelectedMission == mission)
            {
                Widgets.DrawHighlight(rect);
            }
            float     offset = (rect.height - 24f) * 0.5f;
            WidgetRow tab    = new WidgetRow(rect.x + offset, rect.y + offset);
            MOState   state  = mission.LatestState;

            if (mission.def.repeatable)
            {
                tab.Icon(ContentFinder <Texture2D> .Get(SCD.repeatableIconPath, false));
            }
            else if (state == MOState.Active)
            {
                tab.Icon(ContentFinder <Texture2D> .Get(SCD.activeIconPath, false));
            }
            else if (state == MOState.Finished)
            {
                tab.Icon(ContentFinder <Texture2D> .Get(SCD.finishedIconPath, false));
            }
            else if (state == MOState.Failed)
            {
                tab.Icon(ContentFinder <Texture2D> .Get(SCD.failedIconPath, false));
            }
            tab.Gap(5f);
            string  label       = mission.def.LabelCap;
            Vector2 labelSize   = Text.CalcSize(label);
            float   width       = rect.width - tab.FinalX;
            float   labelHeight = Text.CalcHeight(label, width);

            offset = (rect.height - labelHeight) * 0.5f;
            Rect labelRect = new Rect(tab.FinalX, rect.y + offset, width, rect.height);

            Widgets.Label(labelRect, label);

            if (Widgets.ButtonInvisible(rect, true))
            {
                SoundDefOf.Click.PlayOneShotOnCamera(null);
                selectedLockedMission = null;
                this.SelectedMission  = mission;
                SetActiveObjective();
            }

            /*
             * bool mouseOver = Mouse.IsOver(rect);
             * if (mouseOver || this.SelectedMission == mission)
             * {
             *  Color color = SCD.borderColor.ToColor;
             *  Color half = color;
             *  half.a = 0.5f;
             *  GUI.color = mouseOver ? half : color;
             *  Widgets.DrawBox(rect, 1);
             *  GUI.color = Color.white;
             * }
             */
        }
        private static void DoAreaRow(Rect rect, Area area)
        {
            if (Mouse.IsOver(rect))
            {
                area.MarkForDraw();
                GUI.color = area.Color;
                Widgets.DrawHighlight(rect);
                GUI.color = Color.white;
            }
            GUI.BeginGroup(rect);
            WidgetRow widgetRow = new WidgetRow(0f, 0f, UIDirection.RightThenUp, 99999f, 4f);

            widgetRow.Icon(area.ColorTexture, null);
            widgetRow.Gap(4f);
            widgetRow.Label(area.Label, 220f);
            if (widgetRow.ButtonText("Rename".Translate(), null, true, false))
            {
                Find.WindowStack.Add(new Dialog_RenameArea(area));
            }
            if (widgetRow.ButtonText("InvertArea".Translate(), null, true, false))
            {
                area.Invert();
            }
            WidgetRow arg_D3_0       = widgetRow;
            Texture2D deleteX        = TexButton.DeleteX;
            Color?    mouseoverColor = new Color?(GenUI.SubtleMouseoverColor);

            if (arg_D3_0.ButtonIcon(deleteX, null, mouseoverColor))
            {
                area.Delete();
            }
            GUI.EndGroup();
        }
Exemple #26
0
            public void CheckboxNonLabeled(ref bool checkOn, string tooltip = null, bool leftAligned = false)
            {
                var rect = GetRect(Text.LineHeight);

                if (!tooltip.NullOrEmpty())
                {
                    if (Mouse.IsOver(rect))
                    {
                        Widgets.DrawHighlight(rect);
                    }
                    TooltipHandler.TipRegion(rect, (TipSignal)tooltip);
                }

                float x;

                if (leftAligned)
                {
                    x = rect.x;
                }
                else
                {
                    x = rect.x + rect.width - 24f;
                }

                Widgets.Checkbox(x, rect.y, ref checkOn);

                Gap(verticalSpacing);
            }
        private static void DrawFavouriteStar(Rect rect, PersistentColony colony)
        {
            var favoured = colony.ColonyData.Favoured;

            var size          = rect.size.x;
            var starRect      = new Rect(rect.x, rect.y, size, size);
            var starImageRect = new Rect(starRect.x + size * 0.1f, starRect.y + size * 0.05f, starRect.width * 0.9f, starRect.height * 0.9f);

            if (!favoured)
            {
                Widgets.DrawAltRect(starRect);
            }
            else
            {
                Widgets.DrawHighlight(starRect);
            }

            Widgets.DrawHighlightIfMouseover(starRect);

            if (ButtonTextureHover(starRect, starImageRect, FavouriteStar, FavouriteStarToBe,
                                   Color.gray, favoured ? Color.red : Color.green, GenUI.MouseoverColor, favoured))
            {
                colony.ColonyData.Favoured = !favoured;
                _sorted = null; // Reset favourites list
            }

            TooltipHandler.TipRegion(starRect, !favoured ? "FilUnderscore.PersistentRimWorlds.Colony.Favourite.Add".Translate() :
                                     "FilUnderscore.PersistentRimWorlds.Colony.Favourite.Remove".Translate());
        }
Exemple #28
0
        private void DoGeneralRect(Rect rect)
        {
            string generalLabel = I18n.GeneralSettingsLabel;

            Widgets.Label(rect, generalLabel.Bolded());
            Widgets.DrawLightHighlight(rect);
            if (Widgets.ButtonInvisible(rect))
            {
                SoundDefOf.Click.PlayOneShotOnCamera();
                if (selected == GeneralSettingsContent)
                {
                    selected = Drawer.Empty;
                }
                else
                {
                    selected = GeneralSettingsContent;
                }
            }

            if (selected == GeneralSettingsContent)
            {
                Widgets.DrawHighlightSelected(rect);
            }
            else if (Mouse.IsOver(rect))
            {
                Widgets.DrawHighlight(rect);
            }
        }
        public bool SelectableDef(string name, bool selected, Action deleteCallback)
        {
            Text.Font = GameFont.Tiny;
            float width = this.listingRect.width - 21f;

            Text.Anchor = TextAnchor.MiddleLeft;
            Rect rect = new Rect(this.curX, this.curY, width, 21f);

            if (selected)
            {
                Widgets.DrawHighlight(rect);
            }
            if (Mouse.IsOver(rect))
            {
                Widgets.DrawBox(rect, 1);
            }
            Text.WordWrap = false;
            Widgets.Label(rect, name);
            Text.WordWrap = true;
            if (deleteCallback != null)
            {
                Rect butRect = new Rect(rect.xMax, rect.y, 21f, 21f);
                if (Widgets.ButtonImage(butRect, TexButton.DeleteX, Color.white, GenUI.SubtleMouseoverColor))
                {
                    deleteCallback();
                }
            }
            Text.Anchor = TextAnchor.UpperLeft;
            this.curY  += 21f;
            return(Widgets.ButtonInvisible(rect, false));
        }
Exemple #30
0
        public void OnGUI(float positionX, ref float positionY, float width)
        {
            bool   disabled = this.Disabled;
            float  num      = (!this.Indent) ? 0f : Dialog_InterfaceOptions.IndentSize;
            string label    = this.Label;
            float  num2     = Text.CalcHeight(label, width - BooleanPreference.LabelMargin - num);
            Rect   rect     = new Rect(positionX - 4f + num, positionY - 3f, width + 6f - num, num2 + 5f);

            if (Mouse.IsOver(rect))
            {
                Widgets.DrawHighlight(rect);
            }
            Rect rect2 = new Rect(positionX + num, positionY, width - BooleanPreference.LabelMargin - num, num2);

            if (disabled)
            {
                GUI.color = Dialog_InterfaceOptions.DisabledControlColor;
            }
            GUI.Label(rect2, label);
            GUI.color = Color.white;
            if (this.Tooltip != null)
            {
                TipSignal tip = new TipSignal(() => this.Tooltip.Translate(), this.TooltipId);
                TooltipHandler.TipRegion(rect2, tip);
            }
            bool valueForDisplay = this.ValueForDisplay;

            Widgets.Checkbox(new Vector2(positionX + width - BooleanPreference.CheckboxWidth, positionY - 2f), ref valueForDisplay, 24f, disabled);
            this.Value = valueForDisplay;
            positionY += num2;
        }