コード例 #1
0
ファイル: DesignationDragger.cs プロジェクト: potsh/RimWorld
 public void DraggerOnGUI()
 {
     if (dragging && SelDes != null && SelDes.DragDrawMeasurements)
     {
         IntVec3 intVec = startDragCell - UI.MouseCell();
         intVec.x = Mathf.Abs(intVec.x) + 1;
         intVec.z = Mathf.Abs(intVec.z) + 1;
         if (intVec.x >= 3)
         {
             Vector2 screenPos = (startDragCell.ToUIPosition() + UI.MouseCell().ToUIPosition()) / 2f;
             Vector2 vector    = startDragCell.ToUIPosition();
             screenPos.y = vector.y;
             DrawNumber(screenPos, intVec.x);
         }
         if (intVec.z >= 3)
         {
             Vector2 screenPos2 = (startDragCell.ToUIPosition() + UI.MouseCell().ToUIPosition()) / 2f;
             Vector2 vector2    = startDragCell.ToUIPosition();
             screenPos2.x = vector2.x;
             DrawNumber(screenPos2, intVec.z);
         }
         Text.Font   = GameFont.Small;
         Text.Anchor = TextAnchor.UpperLeft;
     }
 }
コード例 #2
0
ファイル: DebugCell.cs プロジェクト: potsh/RimWorld
 public void OnGUI()
 {
     if (displayString != null)
     {
         Vector2 vector = c.ToUIPosition();
         Rect    rect   = new Rect(vector.x - 20f, vector.y - 20f, 40f, 40f);
         if (new Rect(0f, 0f, (float)UI.screenWidth, (float)UI.screenHeight).Overlaps(rect))
         {
             Widgets.Label(rect, displayString);
         }
     }
 }
コード例 #3
0
 public void DraggerOnGUI()
 {
     if (dragging && SelDes != null && SelDes.DragDrawMeasurements)
     {
         IntVec3 intVec = startDragCell - UI.MouseCell();
         intVec.x = Mathf.Abs(intVec.x) + 1;
         intVec.z = Mathf.Abs(intVec.z) + 1;
         if (intVec.x >= 3)
         {
             Vector2 screenPos = (startDragCell.ToUIPosition() + UI.MouseCell().ToUIPosition()) / 2f;
             screenPos.y = startDragCell.ToUIPosition().y;
             Widgets.DrawNumberOnMap(screenPos, intVec.x, Color.white);
         }
         if (intVec.z >= 3)
         {
             Vector2 screenPos2 = (startDragCell.ToUIPosition() + UI.MouseCell().ToUIPosition()) / 2f;
             screenPos2.x = startDragCell.ToUIPosition().x;
             Widgets.DrawNumberOnMap(screenPos2, intVec.z, Color.white);
         }
     }
 }
コード例 #4
0
        private static void CheckReachability()
        {
            List <DebugMenuOption> list = new List <DebugMenuOption>();

            TraverseMode[] array = (TraverseMode[])Enum.GetValues(typeof(TraverseMode));
            for (int i = 0; i < array.Length; i++)
            {
                TraverseMode traverseMode2 = array[i];
                TraverseMode traverseMode  = traverseMode2;
                list.Add(new DebugMenuOption(traverseMode2.ToString(), DebugMenuOptionMode.Action, delegate
                {
                    DebugTool tool = null;
                    IntVec3 from   = default(IntVec3);
                    Pawn fromPawn  = default(Pawn);
                    tool           = new DebugTool("from...", delegate
                    {
                        from        = UI.MouseCell();
                        fromPawn    = from.GetFirstPawn(Find.CurrentMap);
                        string text = "to...";
                        if (fromPawn != null)
                        {
                            text = text + " (pawn=" + fromPawn.LabelShort + ")";
                        }
                        DebugTools.curTool = new DebugTool(text, delegate
                        {
                            DebugTools.curTool = tool;
                        }, delegate
                        {
                            IntVec3 c = UI.MouseCell();
                            bool flag;
                            IntVec3 intVec;
                            if (fromPawn != null)
                            {
                                flag   = fromPawn.CanReach(c, PathEndMode.OnCell, Danger.Deadly, canBash: false, traverseMode);
                                intVec = fromPawn.Position;
                            }
                            else
                            {
                                flag   = Find.CurrentMap.reachability.CanReach(from, c, PathEndMode.OnCell, traverseMode, Danger.Deadly);
                                intVec = from;
                            }
                            Color color = flag ? Color.green : Color.red;
                            Widgets.DrawLine(intVec.ToUIPosition(), c.ToUIPosition(), color, 2f);
                        });
                    });
                    DebugTools.curTool = tool;
                }));
            }
            Find.WindowStack.Add(new Dialog_DebugOptionListLister(list));
        }