示例#1
0
        public override void ProcessInput(Event ev)
        {
            base.ProcessInput(ev);
            if (refuelables == null)
            {
                refuelables = new List <CompRefuelable>();
            }
            if (!refuelables.Contains(refuelable))
            {
                refuelables.Add(refuelable);
            }
            int num = 2147483647;

            for (int i = 0; i < refuelables.Count; i++)
            {
                if ((int)refuelables[i].Props.fuelCapacity < num)
                {
                    num = (int)refuelables[i].Props.fuelCapacity;
                }
            }
            int startingValue = num / 2;

            for (int j = 0; j < refuelables.Count; j++)
            {
                if ((int)refuelables[j].TargetFuelLevel <= num)
                {
                    startingValue = (int)refuelables[j].TargetFuelLevel;
                    break;
                }
            }
            Func <int, string> textGetter = (!refuelable.parent.def.building.hasFuelingPort) ? ((Func <int, string>)((int x) => "SetTargetFuelLevel".Translate(x))) : ((Func <int, string>)((int x) => "SetPodLauncherTargetFuelLevel".Translate(x, CompLaunchable.MaxLaunchDistanceAtFuelLevel((float)x))));
            Dialog_Slider      window     = new Dialog_Slider(textGetter, 0, num, delegate(int value)
            {
                for (int k = 0; k < refuelables.Count; k++)
                {
                    refuelables[k].TargetFuelLevel = (float)value;
                }
            }, startingValue);

            Find.WindowStack.Add(window);
        }
示例#2
0
 public virtual IEnumerable <FloatMenuOption> GetTransportPodsFloatMenuOptions(IEnumerable <IThingHolder> pods, CompLaunchable representative, Site site)
 {
     foreach (FloatMenuOption f in TransportPodsArrivalAction_VisitSite.GetFloatMenuOptions(representative, pods, site))
     {
         yield return(f);
     }
 }
示例#3
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            foreach (Gizmo item in base.CompGetGizmosExtra())
            {
                yield return(item);
            }
            if (Shuttle != null && !Shuttle.ShowLoadingGizmos)
            {
                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);
        }
示例#4
0
        public virtual IEnumerable <FloatMenuOption> GetTransportPodsFloatMenuOptions(IEnumerable <IThingHolder> pods, CompLaunchable representative, Site site)
        {
            using (IEnumerator <FloatMenuOption> enumerator = TransportPodsArrivalAction_VisitSite.GetFloatMenuOptions(representative, pods, site).GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    FloatMenuOption f = enumerator.Current;
                    yield return(f);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            yield break;
IL_00c5:
            /*Error near IL_00c6: Unexpected return in MoveNext()*/;
        }