当前位置: 首页>>代码示例>>C#>>正文


C# Rect.ContractedBy方法代码示例

本文整理汇总了C#中UnityEngine.Rect.ContractedBy方法的典型用法代码示例。如果您正苦于以下问题:C# Rect.ContractedBy方法的具体用法?C# Rect.ContractedBy怎么用?C# Rect.ContractedBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.Rect的用法示例。


在下文中一共展示了Rect.ContractedBy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ButtonTextSubtle

 public static bool ButtonTextSubtle(Rect rect, string label, float barPercent = 0f, float textLeftMargin = -1f, SoundDef mouseoverSound = null)
 {
     var mouseOver = false;
     if (Mouse.IsOver(rect))
     {
         mouseOver = true;
         GUI.color = GenUI.MouseoverColor;
     }
     if (mouseoverSound != null)
     {
         MouseoverSounds.DoRegion(rect, mouseoverSound);
     }
     Widgets.DrawAtlas(rect, ButtonSubtleAtlas);
     GUI.color = Color.white;
     if (barPercent > 0.001f)
     {
         var rect2 = rect.ContractedBy(1f);
         Widgets.FillableBar(rect2, barPercent, ButtonBarTex, null, false);
     }
     var innerRect = new Rect(rect);
     if (mouseOver)
     {
         innerRect.x += 2f;
         innerRect.y -= 2f;
     }
     Text.Anchor = TextAnchor.MiddleCenter;
     Text.Font = GameFont.Small;
     Text.WordWrap = false;
     Widgets.Label(innerRect, label);
     Text.Anchor = TextAnchor.UpperLeft;
     Text.WordWrap = true;
     return Widgets.ButtonInvisible(rect);
 }
开发者ID:RWA-Team,项目名称:RimworldAscension,代码行数:33,代码来源:RA_Widgets.cs

示例2: FillWindow

 protected override void FillWindow(Rect inRect)
 {
     Vector2 vector = new Vector2(inRect.width - 16f, 36f);
     Vector2 vector2 = new Vector2(100f, vector.y - 2f);
     inRect.height -= 45f;
     float num = vector.y + 3f;
     List<FileInfo> list = BlueprintFiles.AllFiles.ToList();
     float height = (float)list.Count * num;
     Rect viewRect = new Rect(0f, 0f, inRect.width - 16f, height);
     Rect outRect = new Rect(inRect.AtZero());
     outRect.height -= this.bottomAreaHeight;
     Widgets.BeginScrollView(outRect, ref this.scrollPosition, viewRect);
     float num2 = 0f;
     int num3 = 0;
     foreach (FileInfo current in list)
     {
         Rect rect = new Rect(0f, num2, vector.x, vector.y);
         if (num3 % 2 == 0)
         {
             Widgets.DrawAltRect(rect);
         }
         Rect position = rect.ContractedBy(1f);
         GUI.BeginGroup(position);
         string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(current.Name);
         GUI.color = Dialog_Blueprint.ManualSaveTextColor;
         Rect rect2 = new Rect(15f, 0f, position.width, position.height);
         Text.Anchor = TextAnchor.MiddleLeft;
         Text.Font = GameFont.Small;
         Widgets.Label(rect2, fileNameWithoutExtension);
         GUI.color = Color.white;
         Rect rect3 = new Rect(270f, 0f, 200f, position.height);
         GUI.color = Color.white;
         Text.Anchor = TextAnchor.UpperLeft;
         Text.Font = GameFont.Small;
         float num4 = vector.x - 2f - vector2.x - vector2.y;
         Rect rect4 = new Rect(num4, 0f, vector2.x, vector2.y);
         if (Widgets.TextButton(rect4, this.interactButLabel, true, false))
         {
             this.DoMapEntryInteraction(Path.GetFileNameWithoutExtension(current.Name));
         }
         Rect rect5 = new Rect(num4 + vector2.x + 5f, 0f, vector2.y, vector2.y);
         if (Widgets.ImageButton(rect5, TexButton.DeleteX))
         {
             FileInfo localFile = current;
             Find.LayerStack.Add(new Dialog_Confirm("ConfirmDelete".Translate(new object[]
             {
                 fileNameWithoutExtension
             }), delegate
             {
                 localFile.Delete();
             }, true));
         }
         TooltipHandler.TipRegion(rect5, "DeleteThisSavegame".Translate());
         GUI.EndGroup();
         num2 += vector.y + 3f;
         num3++;
     }
     Widgets.EndScrollView();
     this.DoSpecialSaveLoadGUI(inRect.AtZero());
 }
开发者ID:ProfoundDarkness,项目名称:MD2-Source,代码行数:60,代码来源:Dialog_Blueprint.cs

示例3: DoWindowContents

        public override void DoWindowContents(Rect inRect)
        {
            base.DoWindowContents(inRect);

            Rect infoPaneRect = new Rect(0, currentY, inRect.width, 60f);
            Rect infoLabelRect = infoPaneRect.ContractedBy(4f);

            base.currentY += infoPaneRect.yMax + 10f;
            Widgets.DrawMenuSection(infoPaneRect);
            //Hardcoded because I can't think how to do it :L
            string info = string.Concat(new object[]{
                parent.Speed.Label,
                ": ",
                (parent.Speed.Value).ToString("0.0"),
                "x\n",
                parent.Efficiency.Label,
                ": ",
                (parent.Efficiency.Value).ToString("0.0"),
                "x"
            });

            Text.Anchor = TextAnchor.MiddleLeft;
            Widgets.Label(infoLabelRect, info);
            Text.Anchor = TextAnchor.UpperLeft;

            Rect rect = new Rect(0, base.currentY, inRect.width, inRect.height - base.currentY - (CloseButSize.y + padding));
            base.currentY += rect.yMax;
            parent.UpgradeManager.OnGUI(rect);

            base.ResetVariables();
        }
开发者ID:ProfoundDarkness,项目名称:MD2-Source,代码行数:31,代码来源:Dialog_UpgradeManager.cs

示例4: OTabOnGUI

        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();
            }
        }
开发者ID:DAOWAce,项目名称:CommunityCoreLibrary,代码行数:27,代码来源:OTab_ModHelp.cs

示例5: DoAreaSelector

 // RimWorld.AreaAllowedGUI
 private static void DoAreaSelector( Rect rect, ref Area areaAllowed, Area area )
 {
     rect = rect.ContractedBy( 1f );
     GUI.DrawTexture( rect, area == null ? BaseContent.GreyTex : area.ColorTexture );
     Text.Anchor = TextAnchor.MiddleLeft;
     string text = AreaUtility.AreaAllowedLabel_Area( area );
     Rect rect2 = rect;
     rect2.xMin += 3f;
     rect2.yMin += 2f;
     Widgets.Label( rect2, text );
     if ( areaAllowed == area )
     {
         Widgets.DrawBox( rect, 2 );
     }
     if ( Mouse.IsOver( rect ) )
     {
         if ( area != null )
         {
             area.MarkForDraw();
         }
         if ( Input.GetMouseButton( 0 ) &&
              areaAllowed != area )
         {
             areaAllowed = area;
             SoundDefOf.DesignateDragStandardChanged.PlayOneShotOnCamera();
         }
     }
     TooltipHandler.TipRegion( rect, text );
 }
开发者ID:Reflexial,项目名称:Hardcore-SK,代码行数:30,代码来源:AreaAllowedGUI.cs

示例6: DoZoneSelector

 // RimWorld.AreaAllowedGUI
 private static void DoZoneSelector( Rect rect, ref Zone_Stockpile zoneAllowed, Zone_Stockpile zone, Texture2D tex)
 {
     rect = rect.ContractedBy( 1f );
     GUI.DrawTexture( rect, tex );
     Text.Anchor = TextAnchor.MiddleLeft;
     string label = zone?.label ?? "Any stockpile";
     Rect innerRect = rect;
     innerRect.xMin += 3f;
     innerRect.yMin += 2f;
     Widgets.Label( innerRect, label );
     if( zoneAllowed == zone )
     {
         Widgets.DrawBox( rect, 2 );
     }
     if( Mouse.IsOver( rect ) )
     {
         if( zone != null )
         {
             if ( zone.AllSlotCellsList() != null && zone.AllSlotCellsList().Count > 0 )
                 Find.CameraDriver.JumpTo( zone.AllSlotCellsList().FirstOrDefault() );
         }
         if( Input.GetMouseButton( 0 ) &&
              zoneAllowed != zone )
         {
             zoneAllowed = zone;
             SoundDefOf.DesignateDragStandardChanged.PlayOneShotOnCamera();
         }
     }
     TooltipHandler.TipRegion( rect, label );
     Text.Anchor = TextAnchor.UpperLeft;
 }
开发者ID:FluffierThanThou,项目名称:RW_Manager,代码行数:32,代码来源:StockpileGUI.cs

示例7: OTabOnGUI

 public override void OTabOnGUI(Rect fillRect)
 {
     Rect position = fillRect.ContractedBy(10f);
     GUI.BeginGroup(position);
     Rect position2 = new Rect(0f, 0f, position.width, 40f);
     GUI.BeginGroup(position2);
     Text.Font = GameFont.Small;
     GUI.color = Color.white;
     Text.Anchor = TextAnchor.UpperLeft;
     Rect rect = new Rect(5f, 5f, 140f, 30f);
     Widgets.LabelCheckbox(rect, "ManualPriorities".Translate(), ref Find.Map.playSettings.useWorkPriorities, false);
     float num = position2.width / 3f;
     float num2 = position2.width * 2f / 3f;
     Rect rect2 = new Rect(num - 50f, 5f, 160f, 30f);
     Rect rect3 = new Rect(num2 - 50f, 5f, 160f, 30f);
     GUI.color = new Color(1f, 1f, 1f, 0.5f);
     Text.Anchor = TextAnchor.UpperCenter;
     Text.Font = GameFont.Tiny;
     Widgets.Label(rect2, "<= " + "HigherPriority".Translate());
     Widgets.Label(rect3, "LowerPriority".Translate() + " =>");
     Text.Font = GameFont.Small;
     Text.Anchor = TextAnchor.UpperLeft;
     GUI.EndGroup();
     Rect position3 = new Rect(0f, 40f, position.width, position.height - 40f);
     GUI.BeginGroup(position3);
     Text.Font = GameFont.Small;
     GUI.color = Color.white;
     Rect outRect = new Rect(0f, 50f, position3.width, position3.height - 50f);
     this.workColumnSpacing = (position3.width - 16f - 175f) / (float)OTab_Droid_Work.VisibleWorkTypeDefsInPriorityOrder.Count;
     float num3 = 175f;
     int num4 = 0;
     foreach (WorkTypeDef current in OTab_Droid_Work.VisibleWorkTypeDefsInPriorityOrder)
     {
         Vector2 vector = Text.CalcSize(current.labelShort);
         float num5 = num3 + 15f;
         Rect rect4 = new Rect(num5 - vector.x / 2f, 0f, vector.x, vector.y);
         if (num4 % 2 == 1)
         {
             rect4.y += 20f;
         }
         if (rect4.Contains(Event.current.mousePosition))
         {
             Widgets.DrawHighlight(rect4);
         }
         Text.Anchor = TextAnchor.MiddleCenter;
         Widgets.Label(rect4, current.labelShort);
         WorkTypeDef localDef = current;
         TooltipHandler.TipRegion(rect4, new TipSignal(() => localDef.gerundLabel + "\n\n" + localDef.description, localDef.GetHashCode()));
         GUI.color = new Color(1f, 1f, 1f, 0.3f);
         Widgets.DrawLineVertical(num5, rect4.yMax - 3f, 50f - rect4.yMax + 3f);
         Widgets.DrawLineVertical(num5 + 1f, rect4.yMax - 3f, 50f - rect4.yMax + 3f);
         GUI.color = Color.white;
         num3 += this.workColumnSpacing;
         num4++;
     }
     DrawRows(outRect);
     GUI.EndGroup();
     GUI.EndGroup();
 }
开发者ID:Leucetius,项目名称:MD2-Source,代码行数:59,代码来源:OTab_Droid_Work.cs

示例8: GizmoOnGUI

        public override GizmoResult GizmoOnGUI(Vector2 topLeft)
        {
            var gizmoRect = new Rect(topLeft.x, topLeft.y, Width, Height);
            Widgets.DrawWindowBackground(gizmoRect);

            var gizmoRect_margined = gizmoRect.ContractedBy(5f);

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

            // header text
            var headerTextRect = gizmoRect_margined;
            headerTextRect.height = gizmoRect_margined.height / 3;
            headerTextRect.width = headerTextRect.height + 40;
            Widgets.Label(headerTextRect, "Block:");

            // melee block icon
            // NOTE: mouse over texture shows description
            //TooltipHandler.TipRegion(buttonRect, "gdfgdfgdfgdfgdfgf");
            var meleeBlock_IconRect = headerTextRect;
            meleeBlock_IconRect.y += headerTextRect.height;
            meleeBlock_IconRect.width = meleeBlock_IconRect.height;
            Widgets.DrawTextureFitted(meleeBlock_IconRect, meleeBlock_Icon, 0.9f);

            Text.Anchor = TextAnchor.MiddleLeft;

            // melee block hit chance label
            var meleeBlock_LabelRect = meleeBlock_IconRect;
            meleeBlock_LabelRect.x += meleeBlock_IconRect.width;
            meleeBlock_LabelRect.width = 40;
            Widgets.Label(meleeBlock_LabelRect, " " + (25 + shield.wearer.skills.GetSkill(SkillDefOf.Melee).level * 2) + "%");

            // ranged block icon
            var rangedBlock_IconRect = meleeBlock_IconRect;
            rangedBlock_IconRect.y += meleeBlock_IconRect.height;
            Widgets.DrawTextureFitted(rangedBlock_IconRect, rangedBlock_Icon, 0.9f);

            // ranged block hit chance label
            var rangedBlock_LabelRect = meleeBlock_LabelRect;
            rangedBlock_LabelRect.y += meleeBlock_LabelRect.height;
            Widgets.Label(rangedBlock_LabelRect, " " + (50 + shield.wearer.skills.GetSkill(SkillDefOf.Melee).level * 2) + "%");

            var healthMeterRect = rangedBlock_IconRect;
            healthMeterRect.x += rangedBlock_IconRect.width + rangedBlock_LabelRect.width;
            healthMeterRect.width = gizmoRect_margined.xMax - healthMeterRect.x;
            var fillPercent = shield.HitPoints / Mathf.Max(1f, shield.MaxHitPoints);
            // NOTE: Widgets.FillableBarLabeled?
            Widgets.FillableBar(healthMeterRect, fillPercent, FullTex, EmptyTex, false);

            var iconRect = new Rect(healthMeterRect.xMax - (healthMeterRect.xMax - healthMeterRect.x) / 2 - ShieldIcon_Size/2, gizmoRect_margined.y - ShieldIcon_Size / 5, ShieldIcon_Size, ShieldIcon_Size);
            Widgets.ThingIcon(iconRect, shield);

            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(healthMeterRect, shield.HitPoints + " / " + shield.MaxHitPoints);

            Text.Anchor = TextAnchor.UpperLeft;
            return new GizmoResult(GizmoState.Clear);
        }
开发者ID:RWA-Team,项目名称:RimworldAscension,代码行数:58,代码来源:Shield.cs

示例9: DoWindowContents

        public override void DoWindowContents( Rect inRect )
        {
            // set up rects
            Rect filterRect = new Rect( inRect.ContractedBy( 6f ) );
            filterRect.height -= 2 * (Utilities.ListEntryHeight + Utilities.Margin);
            Rect zoneRect = new Rect(filterRect.xMin, filterRect.yMax + Utilities.Margin, filterRect.width, Utilities.ListEntryHeight);
            Rect buttonRect = new Rect( filterRect.xMin, zoneRect.yMax + Utilities.Margin, ( filterRect.width - Utilities.Margin ) / 2f, Utilities.ListEntryHeight );

            // draw thingfilter
            filterUI.DoThingFilterConfigWindow( filterRect, ref FilterScrollPosition, Trigger.ThresholdFilter );

            // draw zone selector
            StockpileGUI.DoStockpileSelectors(zoneRect, ref Trigger.stockpile);

            // draw operator button
            if ( Widgets.TextButton( buttonRect, Trigger.OpString ) )
            {
                List<FloatMenuOption> list = new List<FloatMenuOption>
                {
                    new FloatMenuOption( "Lower than", delegate { Trigger.Op = Trigger_Threshold.Ops.LowerThan; } ),
                    new FloatMenuOption( "Equal to", delegate { Trigger.Op = Trigger_Threshold.Ops.Equals; } ),
                    new FloatMenuOption( "Greater than", delegate { Trigger.Op = Trigger_Threshold.Ops.HigherThan; } )
                };
                Find.WindowStack.Add( new FloatMenu( list ) );
            }
            

            // move operator button canvas for count input
            buttonRect.x = buttonRect.xMax + Utilities.Margin;

            // if current input is invalid color the element red
            Color oldColor = GUI.color;
            if ( !Input.IsInt() )
            {
                GUI.color = new Color( 1f, 0f, 0f );
            }
            else
            {
                Trigger.Count = int.Parse( Input );
                if ( Trigger.Count > Trigger.MaxUpperThreshold )
                {
                    Trigger.MaxUpperThreshold = Trigger.Count;
                }
            }

            // draw the input field
            Input = Widgets.TextField( buttonRect, Input );
            GUI.color = oldColor;

            // close on enter
            if ( Event.current.type == EventType.KeyDown &&
                 Event.current.keyCode == KeyCode.Return )
            {
                Event.current.Use();
                Find.WindowStack.TryRemove( this );
            }
        }
开发者ID:Reflexial,项目名称:Hardcore-SK,代码行数:57,代码来源:Window_TriggerThresholdDetails.cs

示例10: GizmoOnGUI

        public override GizmoResult GizmoOnGUI(Vector2 topLeft)
        {
            var result = base.GizmoOnGUI(topLeft);

            Rect all = new Rect(topLeft.x, topLeft.y, this.Width, Gizmo.Height);
            Rect middle = all.ContractedBy(5f);
            GUI.color = Color.white;
            Text.Anchor = TextAnchor.MiddleCenter;
            Widgets.Label(middle, parentContainer.Priority.Label());
            Text.Anchor = TextAnchor.UpperLeft;

            return result;
        }
开发者ID:achan1989,项目名称:Dehydration,代码行数:13,代码来源:CommandGizmo_ChangeWaterFillPriority.cs

示例11: GizmoOnGUI

        public override GizmoResult GizmoOnGUI(Vector2 topLeft)
        {
            var result = base.GizmoOnGUI(topLeft);

            Rect all = new Rect(topLeft.x, topLeft.y, this.Width, Gizmo.Height);
            Rect middle = all.ContractedBy(5f);
            GUI.color = Color.white;
            Text.Anchor = TextAnchor.MiddleCenter;
            Text.Font = GameFont.Medium;
            Widgets.Label(middle, string.Format("{0}%", parentContainer.ManualFillToPercent));
            Text.Font = GameFont.Tiny;
            Text.Anchor = TextAnchor.UpperLeft;

            return result;
        }
开发者ID:achan1989,项目名称:Dehydration,代码行数:15,代码来源:CommandGizmo_ChangeWaterFillage.cs

示例12: FillTab

        protected override void FillTab()
        {
            Rect mainRect = new Rect(0, 0, size.x, size.y);
            Rect useRect = mainRect.ContractedBy(borderMargin);
            currentY = 0f;
            List<CrematoriusTarget> targets = ((Crematorius)SelPawn).GetTargets.OrderBy((CrematoriusTarget t) => t.NaturalPriority).ThenBy((CrematoriusTarget t) => t.Label).ToList();

            try
            {
                GUI.BeginGroup(useRect);
                foreach (var target in targets)
                {
                    DrawItemRow(target, currentY);
                    currentY += ItemSize.y + itemMargin;
                }
            }
            finally
            {
                GUI.EndGroup();
            }
        }
开发者ID:Leucetius,项目名称:MD2-Source,代码行数:21,代码来源:ITab_CrematoriusControl.cs

示例13: DrawGUIOverlay

        public void DrawGUIOverlay()
        {
            if (!this.droid.SpawnedInWorld || Find.FogGrid.IsFogged(this.droid.Position))
            {
                return;
            }

            Vector3 vector = GenWorldUI.LabelDrawPosFor(this.droid, -0.6f);
            float num = vector.y;
            if (DroidUIOverlay.ShouldDrawOverlayOnMap(this.droid))
            {
                Text.Font = GameFont.Tiny;
                float num2 = Text.CalcSize(this.droid.Nickname).x;
                if (num2 < 20f)
                {
                    num2 = 20f;
                }
                Rect rect = new Rect(vector.x - num2 / 2f - 4f, vector.y, num2 + 8f, 12f);
                GUI.DrawTexture(rect, TexUI.GrayTextBG);
                if (this.droid.health.summaryHealth.SummaryHealthPercent < 0.999f)
                {
                    Rect screenRect = rect.ContractedBy(1f);
                    Widgets.FillableBar(screenRect, this.droid.health.summaryHealth.SummaryHealthPercent, PawnUIOverlay.HealthTex, BaseContent.ClearTex, false);
                }
                GUI.color = PawnNameColorUtility.PawnNameColorOf(this.droid);
                Text.Anchor = TextAnchor.UpperCenter;
                Widgets.Label(new Rect(vector.x - num2 / 2f, vector.y - 2f, num2, 999f), this.droid.Nickname);
                if (this.droid.playerController != null && this.droid.playerController.Drafted)
                {
                    Widgets.DrawLineHorizontal(vector.x - num2 / 2f, vector.y + 11f, num2);
                }
                GUI.color = Color.white;
                Text.Anchor = TextAnchor.UpperLeft;
                num += 12f;
            }
        }
开发者ID:ProfoundDarkness,项目名称:MD2-Source,代码行数:36,代码来源:DroidUIOverlay.cs

示例14: DoWindowContents

 public override void DoWindowContents(Rect inRect)
 {
     Rect filterRect = new Rect(inRect.ContractedBy(6f));
     filterRect.height -= 30f;
     ThingFilterUiSearchable filterUi = new ThingFilterUiSearchable();
     filterUi.DoThingFilterConfigWindow(filterRect, ref FilterScrollPosition, Trigger.ThresholdFilter, null, 4);
     Rect buttonRect = new Rect(filterRect.xMin, filterRect.yMax + 3, (filterRect.width - 6) / 2, 25f);
     if (Widgets.TextButton(buttonRect, Trigger.OpString))
     {
         List<FloatMenuOption> list = new List<FloatMenuOption>
         {
             new FloatMenuOption("Lower than", delegate { Trigger.Op = TriggerThreshold.Ops.LowerThan; }),
             new FloatMenuOption("Equal to", delegate { Trigger.Op = TriggerThreshold.Ops.Equals; }),
             new FloatMenuOption("Greater than", delegate { Trigger.Op = TriggerThreshold.Ops.HigherThan; })
         };
         Find.WindowStack.Add(new FloatMenu(list));
     }
     buttonRect.x = buttonRect.xMax + 3f;
     Color oldColor = GUI.color;
     if (!Input.IsInt())
     {
         GUI.color = new Color(1f, 0f, 0f);
     }
     else
     {
         Trigger.Count = int.Parse(Input);
         if (Trigger.Count > Trigger.MaxUpperThreshold) Trigger.MaxUpperThreshold = Trigger.Count;
     }
     Input = Widgets.TextField(buttonRect, Input);
     GUI.color = oldColor;
     if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return)
     {
         Event.current.Use();
         Find.WindowStack.TryRemove(this);
     }
 }
开发者ID:isistoy,项目名称:RW_Manager,代码行数:36,代码来源:WindowTriggerThresholdDetails.cs

示例15: DrawPawnRow

        protected override void DrawPawnRow( Rect rect, Pawn p )
        {
            // sizes for stuff

            float heightOffset = ( rect.height - iconSize ) / 2;
            float widthOffset = ( 50 - iconSize ) / 2;

            GUI.BeginGroup( rect );
            var curX = 175f;

            if ( p.training.IsCompleted( TrainableDefOf.Obedience ) )
            {
                var rect2 = new Rect( curX, 0f, 90f, rect.height );
                Rect rect3 = rect2.ContractedBy( 2f );
                string label = p.playerSettings.master == null
                                   ? "NoneLower".Translate()
                                   : p.playerSettings.master.LabelShort;
                Text.Font = GameFont.Small;
                if ( Widgets.ButtonText( rect3, label ) )
                {
                    TrainableUtility.OpenMasterSelectMenu( p );
                }
            }
            curX += 90f;

            if ( Widgets_PetFollow.PetFollowAvailable )
            {
                Rect draftedRect = new Rect( curX, 0f, 25f, 30f );
                Rect hunterRect = new Rect( curX + 25f, 0f, 25f, 30f );
                curX += 50f;

                if ( p.CanFollow() )
                {
                    Rect draftedIconRect =
                        new Rect( 0f, 0f, iconSize, iconSize ).CenteredOnYIn( draftedRect ).CenteredOnXIn( draftedRect );
                    Rect hunterIconRect =
                        new Rect( 0f, 0f, iconSize, iconSize ).CenteredOnYIn( hunterRect ).CenteredOnXIn( hunterRect );

                    // handle drafted follow
                    bool followDrafted = p.FollowsDrafted();
                    string draftedTip = followDrafted
                                            ? "Fluffy.PetFollow.FollowingDrafted".Translate()
                                            : "Fluffy.PetFollow.NotFollowingDrafted".Translate();
                    TooltipHandler.TipRegion( draftedRect, draftedTip );

                    if ( followDrafted )
                        GUI.DrawTexture( draftedIconRect, WorkBoxCheckTex );

                    if ( Mouse.IsOver( draftedRect ) )
                        Widgets.DrawHighlight( draftedIconRect );

                    if ( Widgets.ButtonInvisible( draftedRect ) )
                    {
                        p.FollowsDrafted( !followDrafted );
                        if ( followDrafted )
                            SoundDefOf.CheckboxTurnedOff.PlayOneShotOnCamera();
                        else
                            SoundDefOf.CheckboxTurnedOn.PlayOneShotOnCamera();
                    }

                    // handle hunter follow
                    bool followHunter = p.FollowsHunter();
                    string hunterTip = followHunter
                                           ? "Fluffy.PetFollow.FollowingHunter".Translate()
                                           : "Fluffy.PetFollow.NotFollowingHunter".Translate();
                    TooltipHandler.TipRegion( hunterRect, hunterTip );

                    if ( followHunter )
                        GUI.DrawTexture( hunterIconRect, WorkBoxCheckTex );

                    if ( Mouse.IsOver( hunterRect ) )
                        Widgets.DrawHighlight( hunterIconRect );

                    if ( Widgets.ButtonInvisible( hunterRect ) )
                    {
                        p.FollowsHunter( !followHunter );
                        if ( followHunter )
                            SoundDefOf.CheckboxTurnedOff.PlayOneShotOnCamera();
                        else
                            SoundDefOf.CheckboxTurnedOn.PlayOneShotOnCamera();
                    }
                }
            }

            var recta = new Rect( curX + widthOffset, heightOffset, iconSize, iconSize );
            Texture2D labelSex = GenderTextures[(int) p.gender];
            TipSignal tipSex = p.gender.ToString();
            GUI.DrawTexture( recta, labelSex );
            TooltipHandler.TipRegion( recta, tipSex );
            curX += 50f;

            var rectb = new Rect( curX + widthOffset, heightOffset, iconSize, iconSize );
            Texture2D labelAge = p.RaceProps.lifeStageAges.Count > 3
                                     ? LifeStageTextures[3]
                                     : LifeStageTextures[p.ageTracker.CurLifeStageIndex];
            TipSignal tipAge = p.ageTracker.CurLifeStage.LabelCap + ", " + p.ageTracker.AgeBiologicalYears;
            GUI.DrawTexture( rectb, labelAge );
            TooltipHandler.TipRegion( rectb, tipAge );
            curX += 50f;

//.........这里部分代码省略.........
开发者ID:FluffierThanThou,项目名称:RW_EnhancedTabs,代码行数:101,代码来源:MainTabWindow_Animals.cs


注:本文中的UnityEngine.Rect.ContractedBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。