コード例 #1
0
ファイル: ModuleSPU.cs プロジェクト: mihailov-vf/RemoteTech
        /*
         * PartModule overridden methods
         */

        public override void OnStart(StartState state)
        {
            if (state != StartState.Editor)
            {
                if (vessel == null)
                {
                    RTLog.Notify("ModuleSPU: OnStart : No vessel!", RTLogLevel.LVL2);
                    return;
                }

                RTLog.Notify($"ModuleSPU: OnStart [{VesselName}]");

                GameEvents.onVesselWasModified.Add(OnVesselModified);
                GameEvents.onPartUndock.Add(OnPartUndock);
                GameEvents.onPartActionUICreate.Add(OnPartActionUiCreate);
                GameEvents.onPartActionUIDismiss.Add(OnPartActionUiDismiss);
                VesselId = vessel.id;
                if (RTCore.Instance != null)
                {
                    RTCore.Instance.Satellites.Register(vessel, this);
                    if (FlightComputer == null)
                    {
                        FlightComputer = new FlightComputer.FlightComputer(this);
                    }
                }
            }

            Fields["GUI_Status"].guiActive = ShowGUI_Status;
        }
コード例 #2
0
        public PIDControllerFragment(FlightComputer.FlightComputer fc, Action queue)
        {
            mFlightComputer = fc;
            mOnClickQueue   = queue;

            LoadFlightPIDValues();
        }
コード例 #3
0
 public FlightComputerWindow(FlightComputer.FlightComputer fc)
     : base(Guid.NewGuid(), "FlightComputer", new Rect(100, 100, 0, 0), WindowAlign.Floating)
 {
     mSavePosition   = true;
     mFlightComputer = fc;
     mAttitude       = new AttitudeFragment(fc, () => mQueueEnabled = !mQueueEnabled);
     mRover          = new RoverFragment(fc, () => mQueueEnabled = !mQueueEnabled);
     mQueue          = new QueueFragment(fc);
     mQueueEnabled   = false;
 }
コード例 #4
0
 public FlightComputerWindow(FlightComputer.FlightComputer fc)
     : base(Guid.NewGuid(), "FlightComputer", new Rect(100, 100, 0, 0), WindowAlign.Floating)
 {
     mSavePosition = true;
     mFlightComputer = fc;
     mAttitude = new AttitudeFragment(fc, () => mQueueEnabled = !mQueueEnabled);
     mRover = new RoverFragment(fc, () => mQueueEnabled = !mQueueEnabled);
     mQueue = new QueueFragment(fc);
     mQueueEnabled = false;
 }
コード例 #5
0
 public FlightComputerWindow(FlightComputer.FlightComputer fc)
     : base(Guid.NewGuid(), appTitle, new Rect(100, 100, 0, 0), WindowAlign.Floating)
 {
     mSavePosition   = true;
     mFlightComputer = fc;
     mAttitude       = new AttitudeFragment(fc, () => OnQueue());
     mRover          = new RoverFragment(fc, () => OnQueue());
     mPower          = new PowerFragment(fc, () => OnQueue());
     mPID            = new PIDControllerFragment(fc, () => OnQueue());
     mQueue          = new QueueFragment(fc);
     mQueueEnabled   = false;
 }
コード例 #6
0
ファイル: ModuleSPU.cs プロジェクト: icedown/RemoteTech
 public override void OnStart(StartState state)
 {
     if (state != StartState.Editor)
     {
         GameEvents.onVesselWasModified.Add(OnVesselModified);
         GameEvents.onPartUndock.Add(OnPartUndock);
         GameEvents.onPartActionUICreate.Add(onPartActionUICreate);
         mRegisteredId = vessel.id; 
         RTCore.Instance.Satellites.Register(vessel, this);
         if (FlightComputer == null)
             FlightComputer = new FlightComputer.FlightComputer(this);
     }
     Fields["GUI_Status"].guiActive = ShowGUI_Status;
 }
コード例 #7
0
ファイル: ModuleSPU.cs プロジェクト: windvlaag/RemoteTech
 public override void OnStart(StartState state)
 {
     if (state != StartState.Editor)
     {
         GameEvents.onVesselWasModified.Add(OnVesselModified);
         GameEvents.onPartUndock.Add(OnPartUndock);
         mRegisteredId = vessel.id;
         RTCore.Instance.Satellites.Register(vessel, this);
         if (FlightComputer == null)
         {
             FlightComputer = new FlightComputer.FlightComputer(this);
         }
     }
     Fields["GUI_Status"].guiActive = ShowGUI_Status;
 }
コード例 #8
0
ファイル: ModuleSPU.cs プロジェクト: windvlaag/RemoteTech
 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     try
     {
         if (HighLogic.fetch && HighLogic.LoadedSceneIsFlight)
         {
             if (FlightComputer == null)
             {
                 FlightComputer = new FlightComputer.FlightComputer(this);
             }
             FlightComputer.load(node);
         }
     }
     catch (Exception e) { print(e); };
 }
コード例 #9
0
ファイル: API.cs プロジェクト: jvdnbus/SSAT2
        //exposed method called by other mods, passing a ConfigNode to RemoteTech
        public static bool QueueCommandToFlightComputer(ConfigNode externalData)
        {
            if (RTCore.Instance == null)
            {
                return(false);
            }
            //check we were actually passed a config node
            if (externalData == null)
            {
                return(false);
            }
            // check our min values
            if (!externalData.HasValue("GUIDString") && !externalData.HasValue("Executor") && !externalData.HasValue("ReflectionType"))
            {
                return(false);
            }

            try
            {
                Guid externalVesselId = new Guid(externalData.GetValue("GUIDString"));
                // you can only push a new external command if the vessel guid is the current active vessel
                if (FlightGlobals.ActiveVessel.id != externalVesselId)
                {
                    RTLog.Verbose("Passed Guid is not the active Vessels guid", RTLogLevel.API);
                    return(false);
                }

                // maybe we should look if this vessel hasLocal control or not. If so, we can execute the command
                // immediately

                // get the flight computer
                FlightComputer.FlightComputer computer = RTCore.Instance.Satellites[externalVesselId].FlightComputer;

                var extCmd = FlightComputer.Commands.ExternalAPICommand.FromExternal(externalData);

                computer.Enqueue(extCmd);
                return(true);
            }
            catch (Exception ex)
            {
                RTLog.Verbose(ex.Message, RTLogLevel.API);
            }

            return(false);
        }
コード例 #10
0
ファイル: ModuleSPU.cs プロジェクト: mihailov-vf/RemoteTech
 public override void OnLoad(ConfigNode node)
 {
     base.OnLoad(node);
     try
     {
         if (HighLogic.fetch && HighLogic.LoadedSceneIsFlight)
         {
             if (FlightComputer == null)
             {
                 FlightComputer = new FlightComputer.FlightComputer(this);
             }
             FlightComputer.Load(node);
         }
     }
     catch (Exception e)
     {
         RTLog.Notify("An exception occurred in ModuleSPU.OnLoad(): ", RTLogLevel.LVL4, e);
         print(e);
     };
 }
コード例 #11
0
 public AttitudeFragment(FlightComputer.FlightComputer fc, Action queue)
 {
     mFlightComputer = fc;
     mOnClickQueue   = queue;
 }
コード例 #12
0
        public override void OnSave(ConfigNode node)
        {
            base.OnSave(node);
            try
            {
                if (HighLogic.fetch && HighLogic.LoadedSceneIsFlight)
                {
                    if (FlightComputer == null)
                        FlightComputer = new FlightComputer.FlightComputer(this);
                    FlightComputer.Save(node);
                }

            }
            catch (Exception e)
            {
                RTLog.Notify("An exception occurred in ModuleSPU.OnSave(): ", RTLogLevel.LVL4, e);
                print(e);
            }
        }
コード例 #13
0
 public RoverFragment(FlightComputer.FlightComputer fc, Action queue)
 {
     mFlightComputer = fc;
     mOnClickQueue   = queue;
 }
コード例 #14
0
        /*
         * PartModule overridden methods
         */
        public override void OnStart(StartState state)
        {
            if (state != StartState.Editor)
            {
                if (vessel == null)
                {
                    RTLog.Notify("ModuleSPU: OnStart : No vessel!", RTLogLevel.LVL2);
                    return;
                }

                RTLog.Notify($"ModuleSPU: OnStart [{VesselName}]");

                GameEvents.onVesselWasModified.Add(OnVesselModified);
                GameEvents.onPartUndock.Add(OnPartUndock);
                GameEvents.onPartActionUICreate.Add(OnPartActionUiCreate);
                GameEvents.onPartActionUIDismiss.Add(OnPartActionUiDismiss);
                VesselId = vessel.id;
                if(RTCore.Instance != null)
                {
                    RTCore.Instance.Satellites.Register(vessel, this);
                    if (FlightComputer == null)
                        FlightComputer = new FlightComputer.FlightComputer(this);
                }
            }

            Fields["GUI_Status"].guiActive = ShowGUI_Status;
        }
コード例 #15
0
ファイル: QueueFragment.cs プロジェクト: icedown/RemoteTech
 public QueueFragment(FlightComputer.FlightComputer fc)
 {
     mFlightComputer = fc;
     Delay = 0;
 }
コード例 #16
0
ファイル: ModuleSPU.cs プロジェクト: hashashin/RemoteTech-XF
        public override void OnSave(ConfigNode node)
        {
            base.OnSave(node);
            try
            {
                if (HighLogic.fetch && HighLogic.LoadedSceneIsFlight)
                {
                    if (FlightComputer == null)
                        FlightComputer = new FlightComputer.FlightComputer(this);
                    FlightComputer.Save(node);
                }

            }
            catch (Exception e) { print(e); }
        }
コード例 #17
0
 public PowerFragment(FlightComputer.FlightComputer fc, Action queue)
 {
     mFlightComputer = fc;
     mOnClickQueue   = queue;
     mPowerMode      = PowerModes.Normal;
 }
コード例 #18
0
 public AttitudeFragment(FlightComputer.FlightComputer fc, Action queue)
 {
     mFlightComputer = fc;
     mOnClickQueue = queue;
 }
コード例 #19
0
 public QueueFragment(FlightComputer.FlightComputer fc)
 {
     mFlightComputer = fc;
     Delay           = 0;
 }