public override void ProcessInput(Event ev)
        {
            base.ProcessInput(ev);
            if (this.refuelables == null)
            {
                this.refuelables = new List <CompRefuelable>();
            }
            if (!this.refuelables.Contains(this.refuelable))
            {
                this.refuelables.Add(this.refuelable);
            }
            int num = int.MaxValue;

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

            for (int j = 0; j < this.refuelables.Count; j++)
            {
                if ((int)this.refuelables[j].TargetFuelLevel <= num)
                {
                    startingValue = (int)this.refuelables[j].TargetFuelLevel;
                    break;
                }
            }
            Func <int, string> textGetter;

            if (this.refuelable.parent.def.building.hasFuelingPort)
            {
                textGetter = ((int x) => "SetPodLauncherTargetFuelLevel".Translate(new object[]
                {
                    x,
                    CompLaunchable.MaxLaunchDistanceAtFuelLevel((float)x)
                }));
            }
            else
            {
                textGetter = ((int x) => "Estate_SetTargetFuelLevel".Translate(new object[]
                {
                    x,
                    Command_SetTargetFuelLevel.GetCurrentPressureLevel(x, num)
                }));
            }
            Dialog_Slider window = new Dialog_Slider(textGetter, 0, num, delegate(int value)
            {
                for (int k = 0; k < this.refuelables.Count; k++)
                {
                    this.refuelables[k].TargetFuelLevel = (float)value;
                }
            }, startingValue);

            Find.WindowStack.Add(window);
        }
Exemplo n.º 2
0
        public override void ProcessInput(Event ev)
        {
            base.ProcessInput(ev);
            if (refuelables == null)
            {
                refuelables = new List <CompRefuelableMulti>();
            }
            if (!refuelables.Contains(refuelable))
            {
                refuelables.Add(refuelable);
            }
            int num = int.MaxValue;

            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(x))));
            Dialog_Slider      window     = new Dialog_Slider(textGetter, 0, num, delegate(int value)
            {
                for (int k = 0; k < refuelables.Count; k++)
                {
                    refuelables[k].TargetFuelLevel = value;
                }
            }, startingValue);

            Find.WindowStack.Add(window);
        }