Example #1
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            var gizmos = base.GetGizmos();

            // StorageTabVisible is not virtual, so check if we need to still apply it
            if (!base.StorageTabVisible && this.StorageTabVisible)
            {
                foreach (Gizmo g2 in StorageSettingsClipboard.CopyPasteGizmosFor(this.GetStoreSettings()))
                {
                    yield return(g2);
                }
            }

            /*
             * Kind of a hack, because we don't want the assign owner gizmo that simply using base.GetGizmos() would give us. Instead iterate through all the gizmos
             * produced by base classes of Building_Grave and only return them if they're not labeled 'Assign colonist'.
             */
            foreach (Gizmo giz in gizmos)
            {
                if ((giz as Command_Action)?.defaultLabel != "CommandGraveAssignColonistLabel".Translate())
                {
                    yield return(giz);
                }
            }
        }
Example #2
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            //yield return new Command_Action() {
            //  icon = GizmoShadeFor(zoneType),
            //  defaultLabel = Static.GizmoShadeLabel,
            //  defaultDesc = Static.GizmoShadeDesc,
            //  activateSound = SoundDefOf.Click,
            //  action = () => {
            //    color = NextZoneColor;
            //    for (int c = 0; c < Cells.Count; c++) {
            //      Map.mapDrawer.MapMeshDirty(Cells[c], MapMeshFlag.Zone);
            //    }
            //  }
            //};

            foreach (Gizmo giz in base.GetGizmos())
            {
                yield return(giz);
            }

            foreach (Gizmo giz in StorageSettingsClipboard.CopyPasteGizmosFor(settings))
            {
                yield return(giz);
            }
        }
Example #3
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (var g in base.GetGizmos())
            {
                yield return(g);
            }
            foreach (Gizmo g2 in StorageSettingsClipboard.CopyPasteGizmosFor(settings))
            {
                yield return(g2);
            }
            yield return(new Command_Action
            {
                icon = ContentFinder <Texture2D> .Get("UI/Commands/SetTargetFuelLevel"),
                defaultLabel = "SmartHopper_SetTargetAmount".Translate(),
                action = () => Find.WindowStack.Add(new Dialog_OutputMinMax(OutputSettings)),
            });

            if (this.def.GetModExtension <ModExtension_Settings>()?.GetByName <bool>("pickupFromGround") ?? false)
            {
                yield return(new Command_Toggle
                {
                    icon = ContentFinder <Texture2D> .Get("UI/PickupFromGround"),
                    defaultLabel = "SmartHopper_PickupFromGround".Translate(),
                    toggleAction = () => this.pickupFromGround = !this.pickupFromGround,
                    isActive = () => this.pickupFromGround
                });
            }
        }
Example #4
0
 public override IEnumerable <Gizmo> CompGetGizmosExtra()
 {
     foreach (Gizmo g in StorageSettingsClipboard.CopyPasteGizmosFor(FuelSettings))
     {
         yield return(g);
     }
     yield break;
 }
 public override IEnumerable <Gizmo> CompGetGizmosExtra()
 {
     return(base.CompGetGizmosExtra().Concat(
                Option(this.parent as IStorageSetting)
                .Select(s => s.StorageSettings)
                .Select(x => StorageSettingsClipboard.CopyPasteGizmosFor(x))
                .GetOrDefault(Enumerable.Empty <Gizmo>())));
 }
Example #6
0
 public override IEnumerable <Gizmo> GetGizmos()
 {
     foreach (Gizmo g in base.GetGizmos())
     {
         yield return(g);
     }
     foreach (Gizmo g2 in StorageSettingsClipboard.CopyPasteGizmosFor(this.settings))
     {
         yield return(g2);
     }
     yield break;
 }
        public static void Copy(Building_Shelf shelf)
        {
            StorageSettingsClipboard.Copy(shelf.settings);
            StockingSettingsClipboard.copiedShelf = shelf;
            StockingSettingsClipboard.copied      = true;

            //As both this and StorageSettingsClipboard are static without constructors
            //  I have a timing issue setting up callbacks. I will do so during the first copy
            if (!setupCallback)
            {
                SetupCallback();
            }
        }
Example #8
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            //Log.Message( string.Format( "{0}.GetGizmos()", this.ThingID ) );
            var copyPasteGizmos = StorageSettingsClipboard.CopyPasteGizmosFor(settings);

            foreach (var gizmo in copyPasteGizmos)
            {
                yield return(gizmo);
            }
            foreach (var gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }
        }
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo g in base.GetGizmos())
            {
                yield return(g);
            }
            foreach (Gizmo g2 in StorageSettingsClipboard.CopyPasteGizmosFor(settings))
            {
                yield return(g2);
            }
            if (Prefs.DevMode)
            {
                yield return(new Command_Action
                {
                    icon = ContentFinder <Texture2D> .Get("UI/Buttons/Drop", true),
                    defaultLabel = "DEBUG: Drop all items",
                    defaultDesc = "Drops all items stored in internal storage and disallows the item in storage. WARNING: Some items will be lost if storage exceeds ~300 stacks.",
                    action = () => DropAll(),
                    activateSound = SoundDefOf.Click,
                });

                yield return(new Command_Action
                {
                    defaultLabel = "DEBUG: Add 1 million of current item",
                    defaultDesc = "If no item stored, adds Steel.",
                    action = delegate
                    {
                        if (storedDef == null)
                        {
                            storedDef = ThingDefOf.Steel;
                        }
                        ThingCount += 1000000;
                    },
                    activateSound = SoundDefOf.Click,
                });

                yield return(new Command_Action
                {
                    defaultLabel = "DEBUG: Reset without dropping items",
                    action = delegate
                    {
                        storedDef = null;
                        ThingCount = 0;
                    },
                    activateSound = SoundDefOf.Click,
                });
            }
        }
 public override IEnumerable <Gizmo> GetGizmos()
 {
     foreach (var g in base.GetGizmos())
     {
         yield return(g);
     }
     foreach (Gizmo g2 in StorageSettingsClipboard.CopyPasteGizmosFor(settings))
     {
         yield return(g2);
     }
     yield return(new Command_Action
     {
         icon = ContentFinder <Texture2D> .Get("UI/Commands/SetTargetFuelLevel"),
         defaultLabel = "SmartHopper_SetTargetAmount".Translate(),
         action = () => Find.WindowStack.Add(new Dialog_OutputMinMax(OutputSettings)),
     });
 }
Example #11
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (var g in base.GetGizmos())
            {
                yield return(g);
            }
            foreach (Gizmo g2 in StorageSettingsClipboard.CopyPasteGizmosFor(settings))
            {
                yield return(g2);
            }
            yield return(new Command_Toggle()
            {
                isActive = () => this.active,
                toggleAction = () => this.active = !this.active,
                defaultLabel = "PRF.AutoMachineTool.Puller.SwitchActiveLabel".Translate(),
                defaultDesc = "PRF.AutoMachineTool.Puller.SwitchActiveDesc".Translate(),
                icon = RS.PlayIcon
            });

            yield return(new Command_Toggle()
            {
                isActive = () => this.takeForbiddenItems,
                toggleAction = () => this.takeForbiddenItems = !this.takeForbiddenItems,
                defaultLabel = "PRF.Puller.TakeForbiddenItems".Translate(),
                defaultDesc = "PRF.Puller.TakeForbiddenItemsDesc".Translate(),
                icon = TexCommand.ForbidOff
            });

            if (this.OutputSides)
            {
                yield return(new Command_Action()
                {
                    action = () => this.right = !this.right,
                    defaultLabel = "PRF.AutoMachineTool.Puller.SwitchOutputSideLabel".Translate(),
                    defaultDesc = "PRF.AutoMachineTool.Puller.SwitchOutputSideDesc".Translate(),
                    icon = RS.OutputDirectionIcon
                });
            }
        }
Example #12
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo g in base.GetGizmos())
            {
                yield return(g);
            }
            yield return(new Command_Action
            {
                defaultLabel = "CommandThingSetOwnerLabel".Translate(),
                icon = ContentFinder <Texture2D> .Get("UI/Commands/AssignOwner", true),
                defaultDesc = "ArmorRacks_ArmorRackSetOwnerDescription".Translate(),
                action = delegate()
                {
                    Find.WindowStack.Add(new Dialog_AssignBuildingOwner(this.GetComp <CompAssignableToPawn_ArmorRacks>()));
                },
                hotKey = KeyBindingDefOf.Misc3
            });

            foreach (Gizmo g2 in StorageSettingsClipboard.CopyPasteGizmosFor(Settings))
            {
                yield return(g2);
            }
        }
Example #13
0
 public override IEnumerable <Gizmo> CompGetGizmosExtra()
 {
     foreach (Gizmo gizmo in StorageSettingsClipboard.CopyPasteGizmosFor(settings))
     {
         yield return(gizmo);
     }
     if (loaded)
     {
         if (SoftWarmBedsSettings.manuallyUnmakeBed)
         {
             Props.commandTexture = Props.beddingDef.graphicData.texPath;
             foreach (Gizmo gizmo in base.CompGetGizmosExtra())
             {
                 yield return(gizmo);
             }
         }
         else
         {
             Command_Action unmake = new Command_Action
             {
                 defaultLabel  = Props.commandLabelKey.Translate(),
                 defaultDesc   = Props.commandDescKey.Translate(),
                 icon          = LoadedBedding.uiIcon,
                 iconAngle     = LoadedBedding.uiIconAngle,
                 iconOffset    = LoadedBedding.uiIconOffset,
                 iconDrawScale = GenUI.IconDrawScale(LoadedBedding),
                 action        = delegate()
                 {
                     Unmake();
                 }
             };
             yield return(unmake);
         }
     }
     yield break;
 }
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }
            foreach (Gizmo item in StorageSettingsClipboard.CopyPasteGizmosFor(allowedCorpseFilterSettings))
            {
                yield return(item);
            }
            if (Prefs.DevMode)
            {
                yield return(new Command_Action
                {
                    defaultLabel = "DEBUG: Empty",
                    action = delegate
                    {
                        corpseRemainingMass = 0;
                    }
                });

                yield return(new Command_Action
                {
                    defaultLabel = "DEBUG: -10kg",
                    action = delegate
                    {
                        corpseRemainingMass = (corpseRemainingMass > 10) ? (corpseRemainingMass - 10) : 0;
                    }
                });

                yield return(new Command_Action
                {
                    defaultLabel = "DEBUG: -1kg",
                    action = delegate
                    {
                        corpseRemainingMass = (corpseRemainingMass > 1) ? (corpseRemainingMass - 1) : 0;
                    }
                });

                yield return(new Command_Action
                {
                    defaultLabel = "DEBUG: +1kg",
                    action = delegate
                    {
                        if (Empty)
                        {
                            corpseInitialMass = ThingDefOf.Human.BaseMass;
                        }

                        corpseRemainingMass = (corpseInitialMass - corpseRemainingMass > 1) ? (corpseRemainingMass + 1) : corpseInitialMass;
                    }
                });

                yield return(new Command_Action
                {
                    defaultLabel = "DEBUG: +10kg",
                    action = delegate
                    {
                        if (Empty)
                        {
                            corpseInitialMass = ThingDefOf.Human.BaseMass;
                        }

                        corpseRemainingMass = (corpseInitialMass - corpseRemainingMass > 10) ? (corpseRemainingMass + 10) : corpseInitialMass;
                    }
                });

                yield return(new Command_Action
                {
                    defaultLabel = "DEBUG: Load Corpse",
                    action = delegate
                    {
                        corpseInitialMass = ThingDefOf.Human.BaseMass;
                        corpseRemainingMass = corpseInitialMass;
                    }
                });
            }
        }
Example #15
0
        // Token: 0x06007DD8 RID: 32216 RVA: 0x00054920 File Offset: 0x00052B20
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }
            IEnumerator <Gizmo> enumerator = null;

            if (this.CanExtractShell)
            {
                AERIALChangeableProjectile compChangeableProjectile = this.gun.TryGetComp <AERIALChangeableProjectile>();
                yield return(new Command_Action
                {
                    defaultLabel = "CommandExtractShell".Translate(),
                    defaultDesc = "CommandExtractShellDesc".Translate(),
                    icon = compChangeableProjectile.loadedShells[compChangeableProjectile.loadedShells.Count - 1].uiIcon,
                    iconAngle = compChangeableProjectile.loadedShells[compChangeableProjectile.loadedShells.Count - 1].uiIconAngle,
                    iconOffset = compChangeableProjectile.loadedShells[compChangeableProjectile.loadedShells.Count - 1].uiIconOffset,
                    iconDrawScale = GenUI.IconDrawScale(compChangeableProjectile.loadedShells[compChangeableProjectile.loadedShells.Count - 1]),
                    action = delegate()
                    {
                        this.ExtractShell();
                    }
                });
            }
            AERIALChangeableProjectile compChangeableProjectile2 = this.gun.TryGetComp <AERIALChangeableProjectile>();

            if (compChangeableProjectile2 != null)
            {
                StorageSettings storeSettings = compChangeableProjectile2.GetStoreSettings();
                foreach (Gizmo gizmo2 in StorageSettingsClipboard.CopyPasteGizmosFor(storeSettings))
                {
                    yield return(gizmo2);
                }
                enumerator = null;
            }
            if (this.CanSetForcedTarget)
            {
                Command_VerbTarget command_VerbTarget = new Command_VerbTarget();
                command_VerbTarget.defaultLabel = "CommandSetForceAttackTarget".Translate();
                command_VerbTarget.defaultDesc  = "CommandSetForceAttackTargetDesc".Translate();
                command_VerbTarget.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Attack", true);

                command_VerbTarget.verb       = this.AttackVerb;
                command_VerbTarget.hotKey     = KeyBindingDefOf.Misc4;
                command_VerbTarget.drawRadius = false;
                if (base.Spawned && this.IsMortarOrProjectileFliesOverhead && base.Position.Roofed(base.Map))
                {
                    command_VerbTarget.Disable("CannotFire".Translate() + ": " + "Roofed".Translate().CapitalizeFirst());
                }

                yield return(command_VerbTarget);
            }
            if (this.forcedTarget.IsValid)
            {
                Command_Action command_Action = new Command_Action();
                command_Action.defaultLabel = "CommandStopForceAttack".Translate();
                command_Action.defaultDesc  = "CommandStopForceAttackDesc".Translate();
                command_Action.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Halt", true);

                command_Action.action = delegate()
                {
                    this.ResetForcedTarget();
                    SoundDefOf.Tick_Low.PlayOneShotOnCamera(null);
                };
                if (!this.forcedTarget.IsValid)
                {
                    command_Action.Disable("CommandStopAttackFailNotForceAttacking".Translate());
                }
                command_Action.hotKey = KeyBindingDefOf.Misc5;
                yield return(command_Action);
            }
            if (this.CanToggleHoldFire)
            {
                yield return(new Command_Toggle
                {
                    defaultLabel = "CommandHoldFire".Translate(),
                    defaultDesc = "CommandHoldFireDesc".Translate(),
                    icon = ContentFinder <Texture2D> .Get("UI/Commands/HoldFire", true),
                    hotKey = KeyBindingDefOf.Misc6,
                    toggleAction = delegate()
                    {
                        this.holdFire = !this.holdFire;
                        if (this.holdFire)
                        {
                            this.ResetForcedTarget();
                        }
                    },
                    isActive = (() => this.holdFire)
                });
            }
            yield break;
            yield break;
        }