Пример #1
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo c in this.< GetGizmos > __BaseCallProxy0())
            {
                yield return(c);
            }
            if (this.def.Minifiable && base.Faction == Faction.OfPlayer)
            {
                yield return(InstallationDesignatorDatabase.DesignatorFor(this.def));
            }
            Command buildCopy = BuildCopyCommandUtility.BuildCopyCommand(this.def, base.Stuff);

            if (buildCopy != null)
            {
                yield return(buildCopy);
            }
            if (base.Faction == Faction.OfPlayer)
            {
                foreach (Command facility in BuildFacilityCommandUtility.BuildFacilityCommands(this.def))
                {
                    yield return(facility);
                }
            }
            yield break;
        }
Пример #2
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }
            if (((def.BuildableByPlayer && def.passability != Traversability.Impassable && !def.IsDoor) || def.building.forceShowRoomStats) && Gizmo_RoomStats.GetRoomToShowStatsFor(this) != null && Find.Selector.SingleSelectedObject == this)
            {
                yield return(new Gizmo_RoomStats(this));
            }
            Gizmo selectMonumentMarkerGizmo = QuestUtility.GetSelectMonumentMarkerGizmo(this);

            if (selectMonumentMarkerGizmo != null)
            {
                yield return(selectMonumentMarkerGizmo);
            }
            if (def.Minifiable && base.Faction == Faction.OfPlayer)
            {
                yield return(InstallationDesignatorDatabase.DesignatorFor(def));
            }
            Command command = BuildCopyCommandUtility.BuildCopyCommand(def, base.Stuff);

            if (command != null)
            {
                yield return(command);
            }
            if (base.Faction == Faction.OfPlayer)
            {
                foreach (Command item in BuildFacilityCommandUtility.BuildFacilityCommands(def))
                {
                    yield return(item);
                }
            }
        }
Пример #3
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (var c in base.GetGizmos())
            {
                yield return(c);
            }

            if (def.Minifiable && Faction == Faction.OfPlayer)
            {
                yield return(InstallationDesignatorDatabase.DesignatorFor(def));
            }

            var buildCopy = BuildCopyCommandUtility.BuildCopyCommand(def, Stuff);

            if (buildCopy != null)
            {
                yield return(buildCopy);
            }

            if (Faction == Faction.OfPlayer)
            {
                foreach (var facility in BuildFacilityCommandUtility.BuildFacilityCommands(def))
                {
                    yield return(facility);
                }
            }
        }
Пример #4
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            using (IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Gizmo c = enumerator.Current;
                    yield return(c);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (def.Minifiable && base.Faction == Faction.OfPlayer)
            {
                yield return((Gizmo)InstallationDesignatorDatabase.DesignatorFor(def));

                /*Error: Unable to find new state assignment for yield return*/;
            }
            Command buildCopy = BuildCopyCommandUtility.BuildCopyCommand(def, base.Stuff);

            if (buildCopy != null)
            {
                yield return((Gizmo)buildCopy);

                /*Error: Unable to find new state assignment for yield return*/;
            }
            if (base.Faction == Faction.OfPlayer)
            {
                using (IEnumerator <Command> enumerator2 = BuildFacilityCommandUtility.BuildFacilityCommands(def).GetEnumerator())
                {
                    if (enumerator2.MoveNext())
                    {
                        Command facility = enumerator2.Current;
                        yield return((Gizmo)facility);

                        /*Error: Unable to find new state assignment for yield return*/;
                    }
                }
            }
            yield break;
IL_020c:
            /*Error near IL_020d: Unexpected return in MoveNext()*/;
        }
Пример #5
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                bool flag = false;

                switch (num)
                {
                case 0u:
                    enumerator = base.< GetGizmos > __BaseCallProxy0().GetEnumerator();
                    num        = 4294967293u;
                    break;

                case 1u:
                    break;

                case 2u:
                    goto IL_114;

                case 3u:
                    goto IL_160;

                case 4u:
                    goto IL_195;

                default:
                    return(false);
                }
                try
                {
                    switch (num)
                    {
                    }
                    if (enumerator.MoveNext())
                    {
                        c             = enumerator.Current;
                        this.$current = c;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator != null)
                        {
                            enumerator.Dispose();
                        }
                    }
                }
                if (this.def.Minifiable && base.Faction == Faction.OfPlayer)
                {
                    this.$current = InstallationDesignatorDatabase.DesignatorFor(this.def);
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);
                }
IL_114:
                buildCopy = BuildCopyCommandUtility.BuildCopyCommand(this.def, base.Stuff);
                if (buildCopy != null)
                {
                    this.$current = buildCopy;
                    if (!this.$disposing)
                    {
                        this.$PC = 3;
                    }
                    return(true);
                }
IL_160:
                if (base.Faction != Faction.OfPlayer)
                {
                    goto IL_20C;
                }
                enumerator2 = BuildFacilityCommandUtility.BuildFacilityCommands(this.def).GetEnumerator();
                num         = 4294967293u;
                try
                {
IL_195:
                    switch (num)
                    {
                    }
                    if (enumerator2.MoveNext())
                    {
                        facility      = enumerator2.Current;
                        this.$current = facility;
                        if (!this.$disposing)
                        {
                            this.$PC = 4;
                        }
                        flag = true;
                        return(true);
                    }
                }
                finally
                {
                    if (!flag)
                    {
                        if (enumerator2 != null)
                        {
                            enumerator2.Dispose();
                        }
                    }
                }
IL_20C:
                this.$PC = -1;
                return(false);
            }
Пример #6
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            Command_Action mineMode = new Command_Action()
            {
                icon          = this.icon,
                defaultLabel  = this.defaultLabel,
                defaultDesc   = defaultDesc,
                hotKey        = KeyBindingDefOf.Misc10,
                activateSound = SoundDefOf.Click,
                action        = delegate()
                {
                    Find.WindowStack.Add(MakeModeMenu(this));
                },
            };

            // Only allow this option if stonecutting has been researched
            // The default behavior is to allow resources, but not blocks
            if (!QuarryDefOf.Stonecutting.IsFinished)
            {
                mineMode.Disable(Static.ReportGizmoLackingResearch);
            }
            yield return(mineMode);

            yield return(new Command_Toggle()
            {
                icon = Static.DesignationHaul,
                defaultLabel = Static.LabelHaulMode,
                defaultDesc = HaulDescription,
                hotKey = KeyBindingDefOf.Misc11,
                activateSound = SoundDefOf.Click,
                isActive = () => autoHaul,
                toggleAction = () => { autoHaul = !autoHaul; },
            });

            yield return(new Command_Action
            {
                defaultLabel = Static.CommandBedSetOwnerLabel,
                icon = ContentFinder <Texture2D> .Get("UI/Commands/AssignOwner", true),
                defaultDesc = Static.CommandSetOwnerDesc,
                action = delegate
                {
                    Find.WindowStack.Add(new Dialog_AssignBuildingOwner(this.TryGetComp <CompAssignableToPawn>()));
                },
                hotKey = KeyBindingDefOf.Misc3
            });

            /*
             * if (base.GetGizmos() != null)
             * {
             *  Log.Message("do base.GetGizmos()");
             *  foreach (Command c in base.GetGizmos())
             *  {
             *      Log.Message(string.Format("base.GetGizmos() {0}",c));
             *      yield return c;
             *  }
             * }
             */

            IEnumerator <Gizmo> enumerator = null;

            if (((this.def.BuildableByPlayer && this.def.passability != Traversability.Impassable && !this.def.IsDoor) || this.def.building.forceShowRoomStats) && Gizmo_RoomStats.GetRoomToShowStatsFor(this) != null && Find.Selector.SingleSelectedObject == this)
            {
                yield return(new Gizmo_RoomStats(this));
            }
            if (this.def.Minifiable && base.Faction == Faction.OfPlayer)
            {
                yield return(InstallationDesignatorDatabase.DesignatorFor(this.def));
            }
            Command command = BuildCopyCommandUtility.BuildCopyCommand(this.def, base.Stuff);

            if (command != null)
            {
                yield return(command);
            }
            if (base.Faction == Faction.OfPlayer)
            {
                foreach (Command command2 in BuildFacilityCommandUtility.BuildFacilityCommands(this.def))
                {
                    yield return(command2);
                }
                IEnumerator <Command> enumerator2 = null;
            }
            if (forbiddable != null)
            {
                foreach (Gizmo item in forbiddable.CompGetGizmosExtra())
                {
                    yield return(item);
                }
                ;
            }
            yield break;
            Log.Message("post base.GetGizmos()");
        }
Пример #7
0
        // RimWorld.Building_Grave
        //public override Graphic Graphic


        public override IEnumerable <Gizmo> GetGizmos()
        {
            if (this.AllComps != null)
            {
                for (int i = 0; i < AllComps.Count; i++)
                {
                    foreach (Gizmo item in AllComps[i].CompGetGizmosExtra())
                    {
                        yield return(item);
                    }
                }
            }

            if (((def.BuildableByPlayer && def.passability != Traversability.Impassable && !def.IsDoor) || def.building.forceShowRoomStats) && Gizmo_RoomStats.GetRoomToShowStatsFor(this) != null && Find.Selector.SingleSelectedObject == this)
            {
                yield return(new Gizmo_RoomStats(this));
            }
            if (def.Minifiable && base.Faction == Faction.OfPlayer)
            {
                yield return(InstallationDesignatorDatabase.DesignatorFor(def));
            }
            Command command = BuildCopyCommandUtility.BuildCopyCommand(def, base.Stuff);

            if (command != null)
            {
                yield return(command);
            }
            if (base.Faction == Faction.OfPlayer)
            {
                foreach (Command item in BuildFacilityCommandUtility.BuildFacilityCommands(def))
                {
                    yield return(item);
                }
            }

            var p = Corpse?.InnerPawn ?? (Pawn)(innerContainer.FirstOrDefault()) ?? null;

            if ((p?.IsVampire() ?? false) || (p?.HasVampireHediffs() ?? false))
            {
                foreach (Gizmo y in HarmonyPatches.GraveGizmoGetter(p, this))
                {
                    yield return(y);
                }
            }

            if (this.GetComps <CompVampBed>().FirstOrDefault() is CompVampBed vbed)
            {
                if (vbed.Bed != null)
                {
                    if (vbed.Bed.def.building.bed_humanlike && base.Faction == Faction.OfPlayer)
                    {
                        Command_Toggle command_Toggle0 = new Command_Toggle();
                        command_Toggle0.defaultLabel = "ROMV_VampiresOnly".Translate();
                        command_Toggle0.defaultDesc  = "ROMV_VampiresOnlyDesc".Translate();
                        command_Toggle0.icon         = TexButton.ROMV_VampiresOnly;
                        command_Toggle0.isActive     = (() => vbed.VampiresOnly);
                        command_Toggle0.toggleAction = delegate
                        {
                            vbed.VampiresOnly = !vbed.VampiresOnly;
                        };
                        command_Toggle0.hotKey = KeyBindingDefOf.Misc2;
                        yield return(command_Toggle0);

                        Command_Toggle command_Toggle = new Command_Toggle();
                        command_Toggle.defaultLabel = "CommandBedSetForPrisonersLabel".Translate();
                        command_Toggle.defaultDesc  = "CommandBedSetForPrisonersDesc".Translate();
                        command_Toggle.icon         = ContentFinder <Texture2D> .Get("UI/Commands/ForPrisoners");

                        command_Toggle.isActive     = (() => vbed.Bed.ForPrisoners);
                        command_Toggle.toggleAction = delegate
                        {
                            AccessTools.Method(typeof(Building_Bed), "ToggleForPrisonersByInterface").Invoke(vbed.Bed, null);
                        };
                        if (!((bool)(AccessTools.Method(typeof(Building_Bed), "RoomCanBePrisonCell").Invoke(vbed.Bed, new object[] { this.GetRoom() }))) && !vbed.Bed.ForPrisoners)
                        {
                            command_Toggle.Disable("CommandBedSetForPrisonersFailOutdoors".Translate());
                        }
                        command_Toggle.hotKey       = KeyBindingDefOf.Misc3;
                        command_Toggle.turnOffSound = null;
                        command_Toggle.turnOnSound  = null;
                        yield return(command_Toggle);

                        Command_Toggle command_Toggle2 = new Command_Toggle();
                        command_Toggle2.defaultLabel = "CommandBedSetAsMedicalLabel".Translate();
                        command_Toggle2.defaultDesc  = "CommandBedSetAsMedicalDesc".Translate();
                        command_Toggle2.icon         = ContentFinder <Texture2D> .Get("UI/Commands/AsMedical");

                        command_Toggle2.isActive     = (() => vbed.Bed.Medical);
                        command_Toggle2.toggleAction = delegate
                        {
                            vbed.Bed.Medical = !vbed.Bed.Medical;
                        };
                        command_Toggle2.hotKey = KeyBindingDefOf.Misc2;
                        yield return(command_Toggle2);

                        if (!vbed.Bed.ForPrisoners && !vbed.Bed.Medical)
                        {
                            Command_Action command_Action = new Command_Action();
                            command_Action.defaultLabel = "CommandThingSetOwnerLabel".Translate();
                            command_Action.icon         = ContentFinder <Texture2D> .Get("UI/Commands/AssignOwner");

                            command_Action.defaultDesc = "CommandBedSetOwnerDesc".Translate();
                            command_Action.action      = delegate
                            {
                                Find.WindowStack.Add(new Dialog_AssignBuildingOwner(vbed.Bed.CompAssignableToPawn));
                            };
                            command_Action.hotKey = KeyBindingDefOf.Misc3;
                            yield return(command_Action);
                        }
                    }
                }
            }
        }