示例#1
0
 public Value(DataCollectorProperty dc)
 {
     dc_ = dc;
 }
            IDataCollector createDataCollector(string name, Configuration.Options options, string connector)
            {
                IDataCollector dataCollector = null;

                switch (name)
                {
                case "hydrogen":
                    dataCollector = new DataCollectorGasTank("hydrogentank", "Hydrogen", options, connector);
                    break;

                case "oxygen":
                    dataCollector = new DataCollectorGasTank("oxygentank", "Oxygen", options, connector);
                    break;

                case "inventory":
                    dataCollector = new DataCollectorInventory(options, "", connector);
                    break;

                case "cargo":
                    dataCollector = new DataCollectorInventory(options, $"{Default.MyObjectBuilder}_CargoContainer", connector);
                    break;

                case "battery":
                    dataCollector = new DataCollectorBattery(options, connector);
                    break;

                case "solar":
                    dataCollector = new DataCollectorPowerProducer <IMySolarPanel>("solar", "", options, connector);
                    break;

                case "windturbine":
                    dataCollector = new DataCollectorPowerProducer <IMyPowerProducer>("windturbine", $"{Default.MyObjectBuilder}_WindTurbine", options, connector);
                    break;

                case "reactor":
                    dataCollector = new DataCollectorReactor(options, connector);
                    break;

                case "generator":
                    dataCollector = new DataCollectorGenerator(options, connector);
                    break;

                case "powerproducer":
                    dataCollector = new DataCollectorPowerProducer <IMyPowerProducer>("powerproducer", "", options, connector);
                    break;

                case "airvent":
                    dataCollector = new DataCollectorAirVent(options, connector);
                    break;

                case "jumpdrive":
                    dataCollector = new DataCollectorJumpDrive(options, connector);
                    break;

                case "landinggear":
                    dataCollector = new DataCollectorLandingGear(options, connector);
                    break;

                case "connector":
                    dataCollector = new DataCollectorConnector(options, connector);
                    break;

                case "shipcontroller":
                    dataCollector = new DataCollectorShipController(options, connector);
                    break;

                case "production":
                    dataCollector = new DataCollectorProduction <IMyProductionBlock>("production", "", Unit.None, options, connector);
                    break;

                case "refinery":
                    dataCollector = new DataCollectorProduction <IMyRefinery>("refinery", "", Unit.Gram, options, connector);
                    break;

                case "assembler":
                    dataCollector = new DataCollectorProduction <IMyAssembler>("assembler", "", Unit.None, options, connector);
                    break;

                case "piston":
                    dataCollector = new DataCollectorPiston(options, connector);
                    break;

                case "thruster":
                    dataCollector = new DataCollectorThruster(options, connector);
                    break;

                case "onoff":
                    dataCollector = new DataCollectorProperty("OnOff", "", options, connector);
                    break;

                case "property":
                    dataCollector = new DataCollectorProperty("property", "", options, connector);
                    break;
                }

                if (dataCollector != null)
                {
                    Created++;
                    Manager.JobManager.queueJob((dataCollector as VISObject).getConstructionJob());
                    dataCollectors_.Add(dataCollector);
                    return(dataCollector);
                }
                else
                {
                    log(Console.LogType.Error, $"Invalid data collector name {name}");
                }

                return(null);
            }