当前位置: 首页>>代码示例>>C#>>正文


C# SharedObjects类代码示例

本文整理汇总了C#中SharedObjects的典型用法代码示例。如果您正苦于以下问题:C# SharedObjects类的具体用法?C# SharedObjects怎么用?C# SharedObjects使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SharedObjects类属于命名空间,在下文中一共展示了SharedObjects类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StageValues

        public StageValues(SharedObjects shared)
        {
            this.shared = shared;
            partSet = new PartSet(partHash);

            InitializeSuffixes();
        }
开发者ID:KSP-KOS,项目名称:KOS,代码行数:7,代码来源:StageValues.cs

示例2: Execute

 public override void Execute(SharedObjects shared)
 {
     double argument = GetDouble(PopValueAssert(shared));
     AssertArgBottomAndConsume(shared);
     double result = Math.Log(argument);
     ReturnValue = result;
 }
开发者ID:KSP-KOS,项目名称:KOS,代码行数:7,代码来源:Math.cs

示例3: Execute

 public override void Execute(SharedObjects shared)
 {
     double degrees = GetDouble(shared.Cpu.PopValue());
     double radians = DegreesToRadians(degrees);
     double result = Math.Cos(radians);
     shared.Cpu.PushStack(result);
 }
开发者ID:WazWaz,项目名称:KOS,代码行数:7,代码来源:Trigonometry.cs

示例4: OrbitInfo

 public OrbitInfo(Orbitable orb, SharedObjects sharedObj)
 {
     orbit = orb.Orbit;
     shared = sharedObj;
     name = orb.GetName();
     InitializeSuffixes();
 }
开发者ID:Whitecaribou,项目名称:KOS,代码行数:7,代码来源:OrbitInfo.cs

示例5: Construct

 public static PartValue Construct(global::Part part, SharedObjects shared)
 {
     foreach (PartModule module in part.Modules)
     {
         ModuleEngines mEng = module as ModuleEngines;
         if (mEng != null)
             return new EngineValue(part, new ModuleEngineAdapter(mEng), shared);
         ModuleEnginesFX mEngFX = module as ModuleEnginesFX;
         if (mEngFX != null)
             return new EngineValue(part, new ModuleEngineAdapter(mEngFX), shared);
         ModuleDockingNode mDock = module as ModuleDockingNode;
         if (mDock != null)
             return new DockingPortValue(mDock, shared);
         ModuleEnviroSensor mSense = module as ModuleEnviroSensor;
         if (mSense != null)
             return new SensorValue(part, mSense, shared);
         var gimbalModule  = module as ModuleGimbal;
         if (gimbalModule != null)
             return new GimbalValue(gimbalModule,shared);
         
     }
     
     // Fallback if none of the above: then just a normal part:
     return new PartValue(part, shared);
 }
开发者ID:Whitecaribou,项目名称:KOS,代码行数:25,代码来源:PartValueFactory.cs

示例6: AddTo

        public override void AddTo(SharedObjects shared)
        {
            Shared = shared;

            if (Shared.Vessel == null)
            {
                SafeHouse.Logger.LogWarning("FlightControlManager.AddTo Skipped: shared.Vessel== null");
                return;
            }

            if (Shared.Vessel.rootPart == null)
            {
                SafeHouse.Logger.LogWarning("FlightControlManager.AddTo Skipped: shared.Vessel.rootPart == null");
                return;
            }

            SafeHouse.Logger.Log("FlightControlManager.AddTo " + Shared.Vessel.id);

            currentVessel = shared.Vessel;
            currentVessel.OnPreAutopilotUpdate += OnFlyByWire;

            AddNewFlightParam("throttle", Shared);
            AddNewFlightParam("steering", Shared);
            AddNewFlightParam("wheelthrottle", Shared);
            AddNewFlightParam("wheelsteering", Shared);

            shared.BindingMgr.AddSetter("SASMODE", value => SelectAutopilotMode((string)value));
            shared.BindingMgr.AddGetter("SASMODE", () => currentVessel.Autopilot.Mode.ToString().ToUpper());
        }
开发者ID:space-is-hard,项目名称:KOS,代码行数:29,代码来源:FlightControlManager.cs

示例7: Execute

        public override void Execute(SharedObjects shared)
        {
            string listType = shared.Cpu.PopValue().ToString();
            ListValue list = new ListValue();

            switch (listType)
            {
                case "bodies":
                    foreach (var body in FlightGlobals.fetch.bodies)
                    {
                        list.Add(new BodyTarget(body, shared.Vessel));
                    }
                    break;
                case "targets":
                    foreach (var vessel in FlightGlobals.Vessels)
                    {
                        if (vessel == shared.Vessel) continue;
                        list.Add(new VesselTarget(vessel, shared.Vessel));
                    }
                    break;
                case "resources":
                case "parts":
                case "engines":
                case "sensors":
                case "elements":
                    list = VesselUtils.PartList(shared.Vessel, listType);
                    break;
            }

            shared.Cpu.PushStack(list);
        }
开发者ID:WazWaz,项目名称:KOS,代码行数:31,代码来源:BuildList.cs

示例8: Execute

 public override void Execute(SharedObjects shared)
 {
     string bodyName = PopValueAssert(shared).ToString();
     AssertArgBottomAndConsume(shared);
     var result = new BodyTarget(bodyName, shared);
     ReturnValue = result;
 }
开发者ID:space-is-hard,项目名称:KOS,代码行数:7,代码来源:Suffixed.cs

示例9: Construct

        public static PartModuleFields Construct(PartModule mod, SharedObjects shared)
        {
            var moduleGimbal = mod as ModuleGimbal;
            if (moduleGimbal != null)
                return new GimbalFields(moduleGimbal, shared);

            var processor = mod as kOSProcessor;

            if (processor != null) {
                return new kOSProcessorFields(processor, shared);
            }

            if (mod.moduleName.Equals(RemoteTechAntennaModuleFields.RTAntennaModule)) {
                return new RemoteTechAntennaModuleFields(mod, shared);
            }

            var scienceExperimentFields = ScienceExperimentFieldsFactory.Construct(mod, shared);

            if (scienceExperimentFields != null)
            {
                return scienceExperimentFields;
            }

            return new PartModuleFields(mod, shared);
        }
开发者ID:CalebJ2,项目名称:KOS,代码行数:25,代码来源:PartModuleFieldsFactory.cs

示例10: GeoCoordinates

 /// <summary>
 ///   Build a GeoCoordinates from any arbitrary lat/long pair of doubles.
 /// </summary>
 /// <param name="sharedObj">to know the current CPU's running vessel</param>
 /// <param name="lat">latitude</param>
 /// <param name="lng">longitude</param>
 public GeoCoordinates(SharedObjects sharedObj, double lat, double lng)
 {
     Lat = lat;
     Lng = lng;
     Shared = sharedObj;
     Body = Shared.Vessel.GetOrbit().referenceBody;
 }
开发者ID:EbbiDos,项目名称:KOS,代码行数:13,代码来源:GeoCoordinates.cs

示例11: DeepCopy

        public static SteeringManager DeepCopy(SteeringManager oldInstance, SharedObjects shared)
        {
            SteeringManager instance = SteeringManagerProvider.GetInstance(shared);
            instance.ShowAngularVectors = oldInstance.ShowAngularVectors;
            instance.ShowFacingVectors = oldInstance.ShowFacingVectors;
            instance.ShowRCSVectors = oldInstance.ShowRCSVectors;
            instance.ShowThrustVectors = oldInstance.ShowThrustVectors;
            instance.ShowSteeringStats = oldInstance.ShowSteeringStats;
            instance.WriteCSVFiles = oldInstance.WriteCSVFiles;
            instance.MaxStoppingTime = oldInstance.MaxStoppingTime;

            instance.pitchPI.Ts = oldInstance.pitchPI.Ts;
            instance.yawPI.Ts = oldInstance.yawPI.Ts;
            instance.rollPI.Ts = oldInstance.rollPI.Ts;
            instance.pitchPI.Loop = PIDLoop.DeepCopy(oldInstance.pitchPI.Loop);
            instance.yawPI.Loop = PIDLoop.DeepCopy(oldInstance.yawPI.Loop);
            instance.rollPI.Loop = PIDLoop.DeepCopy(oldInstance.rollPI.Loop);

            instance.pitchRatePI = PIDLoop.DeepCopy(oldInstance.pitchRatePI);
            instance.yawRatePI = PIDLoop.DeepCopy(oldInstance.yawRatePI);
            instance.rollRatePI = PIDLoop.DeepCopy(oldInstance.rollRatePI);

            instance.PitchTorqueAdjust = oldInstance.PitchTorqueAdjust;
            instance.PitchTorqueFactor = oldInstance.PitchTorqueFactor;
            instance.RollTorqueAdjust = oldInstance.RollTorqueAdjust;
            instance.RollTorqueFactor = oldInstance.RollTorqueFactor;
            instance.YawTorqueAdjust = oldInstance.YawTorqueAdjust;
            instance.YawTorqueFactor = oldInstance.YawTorqueFactor;
            return instance;
        }
开发者ID:Whitecaribou,项目名称:KOS,代码行数:30,代码来源:SteeringManager.cs

示例12: Execute

 public override void Execute(SharedObjects shared)
 {
     double ang2 = GetDouble(shared.Cpu.PopValue());
     double ang1 = GetDouble(shared.Cpu.PopValue());
     double result = kOS.Utilities.Utils.DegreeFix( ang2 - ang1, -180 );
     shared.Cpu.PushStack(result);
 }
开发者ID:EbbiDos,项目名称:KOS,代码行数:7,代码来源:Trigonometry.cs

示例13: MessageQueueStructure

        public MessageQueueStructure(MessageQueue messageQueue, SharedObjects sharedObjects)
        {
            this.messageQueue = messageQueue;
            this.sharedObjects = sharedObjects;

            InitializeSuffixes();
        }
开发者ID:KSP-KOS,项目名称:KOS,代码行数:7,代码来源:MessageQueueStructure.cs

示例14: EngineValue

        public EngineValue(global::Part part, MultiModeEngine engine, SharedObjects sharedObj)
            : base(part, sharedObj)
        {
            MMengine = engine;

            var moduleEngines = part.Modules.GetModules<ModuleEngines>();
            if (moduleEngines.Count == 2)
            {
                var modEngine1 = moduleEngines.Where(e => e.engineID == MMengine.primaryEngineID).FirstOrDefault();
                if (modEngine1 != null)
                    engine1 = new ModuleEngineAdapter(modEngine1);
                else
                    throw new KOSException("Attempted to build a MultiModeEngine with no engine matching Primary ID");
                var modEngine2 = moduleEngines.Where(e => e.engineID == MMengine.secondaryEngineID).FirstOrDefault();
                if (modEngine2 != null)
                    engine2 = new ModuleEngineAdapter(modEngine2);
                else
                    throw new KOSException("Attempted to build a MultiModeEngine with no engine matching Secondary ID");
            }
            else
            {
                throw new KOSException(string.Format("Attempted to build a MultiModeEngine with {0} engine modules defined instead of 2", moduleEngines.Count));
            }

            MultiMode = true;

            findGimbal();

            EngineInitializeSuffixes();
        }
开发者ID:CalebJ2,项目名称:KOS,代码行数:30,代码来源:EngineValue.cs

示例15: Execute

        public override void Execute(SharedObjects shared)
        {
            var list = new ListValue();

            string alarmTypes = PopValueAssert(shared).ToString();
            AssertArgBottomAndConsume(shared);

            if (!KACWrapper.APIReady)
            {
                ReturnValue = list;
                throw new KOSUnavailableAddonException("listAlarms()", "Kerbal Alarm Clock");
            }

            //Get the list of alarms from the KAC Object
            KACWrapper.KACAPI.KACAlarmList alarms = KACWrapper.KAC.Alarms;

            foreach (KACWrapper.KACAPI.KACAlarm alarm in alarms)
            {
                // if its not my alarm or a general alarm, ignore it
                if (!string.IsNullOrEmpty(alarm.VesselID) && alarm.VesselID != shared.Vessel.id.ToString())
                {
                    continue;
                }
                
                if (alarmTypes.ToUpperInvariant() == "ALL" || alarm.AlarmTime.ToString() == alarmTypes)
                    list.Add(new KACAlarmWrapper(alarm));
            }
            ReturnValue = list;
        }
开发者ID:Whitecaribou,项目名称:KOS,代码行数:29,代码来源:KACFunctions.cs


注:本文中的SharedObjects类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。