public override bool InheritInteractionsFrom(Gizmo other)
        {
            Command_LoadToTransporter command_LoadToTransporter = (Command_LoadToTransporter)other;

            if (command_LoadToTransporter.transComp.parent.def != this.transComp.parent.def)
            {
                return(false);
            }
            if (this.transporters == null)
            {
                this.transporters = new List <CompTransporter>();
            }
            this.transporters.Add(command_LoadToTransporter.transComp);
            return(false);
        }
Beispiel #2
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            using (IEnumerator <Gizmo> enumerator = base.CompGetGizmosExtra().GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Gizmo g = enumerator.Current;
                    yield return(g);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            if (!LoadingInProgressOrReadyToLaunch)
            {
                Command_LoadToTransporter loadGroup = new Command_LoadToTransporter();
                int selectedTransportersCount       = 0;
                for (int i = 0; i < Find.Selector.NumSelected; i++)
                {
                    Thing thing = Find.Selector.SelectedObjectsListForReading[i] as Thing;
                    if (thing != null && thing.def == parent.def)
                    {
                        CompLaunchable compLaunchable = thing.TryGetComp <CompLaunchable>();
                        if (compLaunchable == null || (compLaunchable.FuelingPortSource != null && compLaunchable.FuelingPortSourceHasAnyFuel))
                        {
                            selectedTransportersCount++;
                        }
                    }
                }
                loadGroup.defaultLabel = "CommandLoadTransporter".Translate(selectedTransportersCount.ToString());
                loadGroup.defaultDesc  = "CommandLoadTransporterDesc".Translate();
                loadGroup.icon         = LoadCommandTex;
                loadGroup.transComp    = this;
                CompLaunchable launchable = Launchable;
                if (launchable != null)
                {
                    if (!launchable.ConnectedToFuelingPort)
                    {
                        loadGroup.Disable("CommandLoadTransporterFailNotConnectedToFuelingPort".Translate());
                    }
                    else if (!launchable.FuelingPortSourceHasAnyFuel)
                    {
                        loadGroup.Disable("CommandLoadTransporterFailNoFuel".Translate());
                    }
                }
                yield return((Gizmo)loadGroup);

                /*Error: Unable to find new state assignment for yield return*/;
            }
            yield return((Gizmo) new Command_Action
            {
                defaultLabel = "CommandCancelLoad".Translate(),
                defaultDesc = "CommandCancelLoadDesc".Translate(),
                icon = CancelLoadCommandTex,
                action = delegate
                {
                    SoundDefOf.Designate_Cancel.PlayOneShotOnCamera();
                    ((_003CCompGetGizmosExtra_003Ec__Iterator0) /*Error near IL_011f: stateMachine*/)._0024this.CancelLoad();
                }
            });

            /*Error: Unable to find new state assignment for yield return*/;
IL_0457:
            /*Error near IL_0458: Unexpected return in MoveNext()*/;
        }
Beispiel #3
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            foreach (Gizmo g in base.CompGetGizmosExtra())
            {
                yield return(g);
            }
            if (this.LoadingInProgressOrReadyToLaunch)
            {
                yield return(new Command_Action
                {
                    defaultLabel = "CommandCancelLoad".Translate(),
                    defaultDesc = "CommandCancelLoadDesc".Translate(),
                    icon = CompTransporter.CancelLoadCommandTex,
                    action = delegate
                    {
                        SoundDefOf.Designate_Cancel.PlayOneShotOnCamera(null);
                        this.$this.CancelLoad();
                    }
                });

                yield return(new Command_Action
                {
                    defaultLabel = "CommandSelectPreviousTransporter".Translate(),
                    defaultDesc = "CommandSelectPreviousTransporterDesc".Translate(),
                    icon = CompTransporter.SelectPreviousInGroupCommandTex,
                    action = delegate
                    {
                        this.$this.SelectPreviousInGroup();
                    }
                });

                yield return(new Command_Action
                {
                    defaultLabel = "CommandSelectAllTransporters".Translate(),
                    defaultDesc = "CommandSelectAllTransportersDesc".Translate(),
                    icon = CompTransporter.SelectAllInGroupCommandTex,
                    action = delegate
                    {
                        this.$this.SelectAllInGroup();
                    }
                });

                yield return(new Command_Action
                {
                    defaultLabel = "CommandSelectNextTransporter".Translate(),
                    defaultDesc = "CommandSelectNextTransporterDesc".Translate(),
                    icon = CompTransporter.SelectNextInGroupCommandTex,
                    action = delegate
                    {
                        this.$this.SelectNextInGroup();
                    }
                });
            }
            else
            {
                Command_LoadToTransporter loadGroup = new Command_LoadToTransporter();
                int selectedTransportersCount       = 0;
                for (int i = 0; i < Find.Selector.NumSelected; i++)
                {
                    Thing thing = Find.Selector.SelectedObjectsListForReading[i] as Thing;
                    if (thing != null && thing.def == this.parent.def)
                    {
                        CompLaunchable compLaunchable = thing.TryGetComp <CompLaunchable>();
                        if (compLaunchable == null || (compLaunchable.FuelingPortSource != null && compLaunchable.FuelingPortSourceHasAnyFuel))
                        {
                            selectedTransportersCount++;
                        }
                    }
                }
                loadGroup.defaultLabel = "CommandLoadTransporter".Translate(selectedTransportersCount.ToString());
                loadGroup.defaultDesc  = "CommandLoadTransporterDesc".Translate();
                loadGroup.icon         = CompTransporter.LoadCommandTex;
                loadGroup.transComp    = this;
                CompLaunchable launchable = this.Launchable;
                if (launchable != null)
                {
                    if (!launchable.ConnectedToFuelingPort)
                    {
                        loadGroup.Disable("CommandLoadTransporterFailNotConnectedToFuelingPort".Translate());
                    }
                    else if (!launchable.FuelingPortSourceHasAnyFuel)
                    {
                        loadGroup.Disable("CommandLoadTransporterFailNoFuel".Translate());
                    }
                }
                yield return(loadGroup);
            }
        }
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            foreach (Gizmo item in base.CompGetGizmosExtra())
            {
                yield return(item);
            }
            if (Shuttle != null && !Shuttle.ShowLoadingGizmos && !Shuttle.permitShuttle)
            {
                yield break;
            }
            if (LoadingInProgressOrReadyToLaunch)
            {
                if (Shuttle == null || !Shuttle.Autoload)
                {
                    Command_Action command_Action = new Command_Action();
                    command_Action.defaultLabel = "CommandCancelLoad".Translate();
                    command_Action.defaultDesc  = "CommandCancelLoadDesc".Translate();
                    command_Action.icon         = CancelLoadCommandTex;
                    command_Action.action       = delegate
                    {
                        SoundDefOf.Designate_Cancel.PlayOneShotOnCamera();
                        CancelLoad();
                    };
                    yield return(command_Action);
                }
                if (!Props.max1PerGroup)
                {
                    Command_Action command_Action2 = new Command_Action();
                    command_Action2.defaultLabel = "CommandSelectPreviousTransporter".Translate();
                    command_Action2.defaultDesc  = "CommandSelectPreviousTransporterDesc".Translate();
                    command_Action2.icon         = SelectPreviousInGroupCommandTex;
                    command_Action2.action       = delegate
                    {
                        SelectPreviousInGroup();
                    };
                    yield return(command_Action2);

                    Command_Action command_Action3 = new Command_Action();
                    command_Action3.defaultLabel = "CommandSelectAllTransporters".Translate();
                    command_Action3.defaultDesc  = "CommandSelectAllTransportersDesc".Translate();
                    command_Action3.icon         = SelectAllInGroupCommandTex;
                    command_Action3.action       = delegate
                    {
                        SelectAllInGroup();
                    };
                    yield return(command_Action3);

                    Command_Action command_Action4 = new Command_Action();
                    command_Action4.defaultLabel = "CommandSelectNextTransporter".Translate();
                    command_Action4.defaultDesc  = "CommandSelectNextTransporterDesc".Translate();
                    command_Action4.icon         = SelectNextInGroupCommandTex;
                    command_Action4.action       = delegate
                    {
                        SelectNextInGroup();
                    };
                    yield return(command_Action4);
                }
                if (Props.canChangeAssignedThingsAfterStarting && (Shuttle == null || !Shuttle.Autoload))
                {
                    Command_LoadToTransporter command_LoadToTransporter = new Command_LoadToTransporter();
                    command_LoadToTransporter.defaultLabel = "CommandSetToLoadTransporter".Translate();
                    command_LoadToTransporter.defaultDesc  = "CommandSetToLoadTransporterDesc".Translate();
                    command_LoadToTransporter.icon         = LoadCommandTex;
                    command_LoadToTransporter.transComp    = this;
                    yield return(command_LoadToTransporter);
                }
                yield break;
            }
            Command_LoadToTransporter command_LoadToTransporter2 = new Command_LoadToTransporter();

            if (Props.max1PerGroup)
            {
                if (Props.canChangeAssignedThingsAfterStarting)
                {
                    command_LoadToTransporter2.defaultLabel = "CommandSetToLoadTransporter".Translate();
                    command_LoadToTransporter2.defaultDesc  = "CommandSetToLoadTransporterDesc".Translate();
                }
                else
                {
                    command_LoadToTransporter2.defaultLabel = "CommandLoadTransporterSingle".Translate();
                    command_LoadToTransporter2.defaultDesc  = "CommandLoadTransporterSingleDesc".Translate();
                }
            }
            else
            {
                int num = 0;
                for (int i = 0; i < Find.Selector.NumSelected; i++)
                {
                    Thing thing = Find.Selector.SelectedObjectsListForReading[i] as Thing;
                    if (thing != null && thing.def == parent.def)
                    {
                        CompLaunchable compLaunchable = thing.TryGetComp <CompLaunchable>();
                        if (compLaunchable == null || (compLaunchable.FuelingPortSource != null && compLaunchable.FuelingPortSourceHasAnyFuel))
                        {
                            num++;
                        }
                    }
                }
                command_LoadToTransporter2.defaultLabel = "CommandLoadTransporter".Translate(num.ToString());
                command_LoadToTransporter2.defaultDesc  = "CommandLoadTransporterDesc".Translate();
            }
            command_LoadToTransporter2.icon      = LoadCommandTex;
            command_LoadToTransporter2.transComp = this;
            CompLaunchable launchable = Launchable;

            if (launchable != null)
            {
                if (!launchable.ConnectedToFuelingPort)
                {
                    command_LoadToTransporter2.Disable("CommandLoadTransporterFailNotConnectedToFuelingPort".Translate());
                }
                else if (!launchable.FuelingPortSourceHasAnyFuel)
                {
                    command_LoadToTransporter2.Disable("CommandLoadTransporterFailNoFuel".Translate());
                }
            }
            yield return(command_LoadToTransporter2);
        }