예제 #1
0
        public override void PostDrawExtraSelectionOverlays()
        {
            // Draw range circle
            if (range > 0f)
            {
                float CircleRadius = 0f;

                //CircleRadius = ((IsMiniStation)?():());
                if (IsMiniStation)
                {
                    CircleRadius = 1;
                }
                else
                {
                    CircleRadius = (range / 2) + 1;
                }

                GenDraw.DrawRadiusRing(this.parent.Position, CircleRadius);
            }

            // Not drawing if bench is empty or has no power
            if ((Registry.NullOrEmpty()) || (!GotThePower))
            {
                return;
            }

            // selected spot comp
            Comp_LTF_TpSpot comp = CurrentSpot?.TryGetComp <Comp_LTF_TpSpot>();

            if (comp == null)
            {
                return;
            }

            // not drawing lines with spot without power/facility
            if ((comp.requiresPower && !comp.HasPower))
            {
                return;
            }
            if ((comp.requiresBench && !comp.HasPoweredFacility))
            {
                return;
            }

            // Line from workstation to spot (in range)
            GenDraw.DrawLineBetween(this.parent.TrueCenter(), CurrentSpot.TrueCenter(), comp.WayColoring);
            if (comp.IsLinked)
            {
                // Line from spot to spot
                GenDraw.DrawLineBetween(CurrentSpot.TrueCenter(), comp.twin.TrueCenter(), comp.WayColoring);
                // Wish we could make it more noticeable
            }
        }
예제 #2
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            if (HasQuality)
            {
                Texture2D qualityMat  = ToolsGizmo.Quality2Mat(compQuality);
                float     qualitySize = ToolsGizmo.Quality2Size(compQuality);

                yield return(new Command_Action
                {
                    //icon = ContentFinder<Texture2D>.Get("UI/Commands/CancelRegistry", true),
                    icon = qualityMat,
                    iconDrawScale = qualitySize,
                    defaultLabel = "Quality matters",
                    defaultDesc = QualityLog(),
                    action = delegate
                    {
                        Tools.Warn("rip quality button", prcDebug);
                    }
                });
            }

            if (GotThePower)
            {
                {
                    Texture2D myMat   = MyGizmo.EmptyStatus2Gizmo(IsEmpty, IsFull);
                    String    myLabel = "Registry";
                    String    Grammar = ((MoreThanOne) ? ("s") : (""));
                    String    myDesc  = Tools.CapacityString(Registry.Count, FacilityCapacity) + ' ' + TpSpotName + ".";

                    if (IsEmpty || IsFull)
                    {
                        myDesc += ".Registry is " + ((IsEmpty) ? ("empty") : ("full"));
                        if (IsEmpty)
                        {
                            myDesc += "\nBuild a " + TpSpotName + " in its range.";
                        }
                        if (IsFull)
                        {
                            myDesc += "\nNo additional " + TpSpotName + " will be managed.";
                        }
                    }
                    myDesc += "\nLists " + Registry.Count + " teleporter" + Grammar;
                    yield return(new Command_Action
                    {
                        icon = myMat,
                        defaultLabel = myLabel,
                        defaultDesc = myDesc,
                        action = new Action(this.ShowReport),
                    });
                }

                if (HasSpot)
                {
                    Comp_LTF_TpSpot comp = CurrentSpot?.TryGetComp <Comp_LTF_TpSpot>();
                    if (comp != null)
                    {
                        if (comp.ValidWay)
                        {
                            String    WayName = comp.WayNaming;
                            Texture2D myGizmo = null;

                            //if (comp.StatusReady && comp.IsLinked && !comp.compTwin.StatusChillin)

                            /*
                             * if (comp.StatusReady && comp.IsLinked)
                             *  myGizmo = comp.WayGizmoing;
                             * else
                             *  myGizmo = comp.IssueGizmoing;
                             */
                            myGizmo = comp.WayGizmoing;

                            if (comp.IsLinked)
                            {
                                if (comp.compTwin.StatusChillin)
                                {
                                    myGizmo = comp.compTwin.IssueGizmoing;
                                }
                            }

                            String myLabel = "Cast " + WayName;
                            String myDesc  = comp.WayDescription;
                            //+ "\n" + comp.StatusLogNoUpdate;
                            //Action todo = ShowReport;
                            Action todo = delegate
                            {
                                Tools.Warn("rip action on no way", prcDebug);
                            };

                            if (comp.IsOrphan || comp.StatusChillin || comp.compTwin.StatusChillin)
                            {
                                if (comp.IsOrphan)
                                {
                                    myDesc = "Selected spot is orphan. You need to link it to another.";
                                }
                                else if (comp.StatusChillin)
                                {
                                    myDesc = "Selected spot has some cooldown.";
                                }
                                else if (comp.compTwin.StatusChillin)
                                {
                                    myDesc = "Selected spot twin has some cooldown.";
                                }
                            }
                            else if (comp.MyWay == Comp_LTF_TpSpot.Way.Out)
                            {
                                todo = comp.OrderOut;
                            }
                            else if (comp.MyWay == Comp_LTF_TpSpot.Way.In)
                            {
                                todo = comp.OrderIn;
                            }
                            //todo = comp.compTwin.OrderOut;
                            //todo = comp.OrderIn;
                            else if (comp.MyWay == Comp_LTF_TpSpot.Way.Swap)
                            {
                                todo = comp.OrderSwap;
                            }

                            /*
                             * else if (comp.MyWay == Comp_LTF_TpSpot.Way.No)
                             *  todo = ShowReport;
                             */

                            yield return(new Command_Action
                            {
                                icon = myGizmo,
                                defaultLabel = myLabel,
                                defaultDesc = myDesc,
                                action = new Action(todo),
                            });
                        }
                        else
                        {
                            Tools.Warn("gizmo should not be this way", prcDebug);
                        }
                    }
                    else
                    {
                        Tools.Warn("gizmo should not be this way", prcDebug);
                    }
                }

                Tools.Warn("Gizmo browse records", prcDebug);
                if (MoreThanOne)
                {
                    Texture2D myMat   = MyGizmo.NextTpGz;
                    String    myLabel = Tools.CapacityString(GizmoIndex + 1, Registry.Count) +
                                        Tools.PosStr(CurrentSpot.Position);
                    //String Grammar = ((MoreThanOne) ? ("s") : (""));
                    String myDesc = "Browse " + Registry.Count + " records";
                    yield return(new Command_Action
                    {
                        icon = myMat,
                        defaultLabel = myLabel,
                        defaultDesc = myDesc,
                        action = new Action(NextIndex),
                    });
                }
            }

            if (Prefs.DevMode)
            {
                // Debug process
                yield return(new Command_Action
                {
                    icon = ((prcDebug) ? (MyGizmo.DebugOnGz) : (MyGizmo.DebugOffGz)),
                    defaultLabel = "prc: " + Tools.DebugStatus(prcDebug),
                    defaultDesc = "process debug",
                    action = delegate
                    {
                        prcDebug = Tools.WarnBoolToggle(prcDebug, "debug " + building.Label);
                    }
                });

                // Debug gfx
                yield return(new Command_Action
                {
                    icon = ((gfxDebug) ? (MyGizmo.DebugOnGz) : (MyGizmo.DebugOffGz)),
                    defaultLabel = "gfx: " + Tools.DebugStatus(gfxDebug),
                    defaultDesc = "gfx debug",
                    action = delegate
                    {
                        gfxDebug = Tools.WarnBoolToggle(gfxDebug, "debug " + building.Label);
                    }
                });

                //debug log + hax activate
                if (prcDebug)
                {
                    yield return new Command_Action
                           {
                               //icon = ContentFinder<Texture2D>.Get("UI/Commands/HaxReady", true),
                               icon         = MyGizmo.DebugLogGz,
                               defaultLabel = "hax " + Tools.DebugStatus(Hax),
                               defaultDesc  = "$5,000 for you advert here.",
                               action       = delegate
                               {
                                   Hax = Tools.WarnBoolToggle(Hax, "hax " + building.Label);
                               }
                           }
                }
                ;
                // Hax Progress
                if (prcDebug && Hax)
                {
                }
                // Hax quality
                if (prcDebug && Hax && HasQuality)
                {
                    if (!ToolsQuality.BestQuality(compQuality))
                    {
                        yield return new Command_Action
                               {
                                   defaultLabel = compQuality.Quality.GetLabelShort() + "->" + ToolsQuality.BetterQuality(compQuality),
                                   defaultDesc  = "Better quality",
                                   //icon = ContentFinder<Texture2D>.Get("UI/Commands/HaxReady", true),
                                   icon   = MyGizmo.HaxBetterGz,
                                   action = delegate
                                   {
                                       BetterQuality();
                                   }
                               }
                    }
                    ;

                    if (!ToolsQuality.WorstQuality(compQuality))
                    {
                        yield return new Command_Action
                               {
                                   defaultDesc  = "Worse quality",
                                   defaultLabel = compQuality.Quality.GetLabelShort() + "->" + ToolsQuality.WorseQuality(compQuality),
                                   icon         = MyGizmo.HaxWorseGz,
                                   action       = delegate
                                   {
                                       WorseQuality();
                                   }
                               }
                    }
                    ;
                }
            }
        }