Beispiel #1
0
        /// <summary>
        /// This method will be triggerd right after the command was enqueued to
        /// the flight computer list.
        /// </summary>
        /// <param name="computer">Current flightcomputer</param>
        public override void CommandEnqueued(FlightComputer computer)
        {
            string KaCAddonLabel = String.Empty;
            double timetoexec    = (this.TimeStamp + this.ExtraDelay) - 180;

            // only insert if we've no negativ time and the option is set
            if (timetoexec - RTUtil.GameTime > 0 && RTSettings.Instance.AutoInsertKaCAlerts == true)
            {
                KaCAddonLabel = "Burn " + computer.Vessel.vesselName + " for ";

                if (this.Duration > 0)
                {
                    KaCAddonLabel += RTUtil.FormatDuration(this.Duration);
                }
                else
                {
                    KaCAddonLabel += this.DeltaV;
                }

                if (RTCore.Instance != null && RTCore.Instance.kacAddon != null)
                {
                    this.KaCItemId = RTCore.Instance.kacAddon.CreateAlarm(AddOns.KerbalAlarmClockAddon.AlarmTypeEnum.Raw, KaCAddonLabel, timetoexec);
                }
            }
        }
Beispiel #2
0
        public IEnumerator onClickAddExtraDelayFromQueuedCommand(ICommand c)
        {
            yield return(null);

            mExtraDelay = RTUtil.FormatDuration(c.Delay + c.ExtraDelay + getBurnTime(c), false);
            RTCore.Instance.StartCoroutine(onClickAddExtraDelay());
        }
Beispiel #3
0
        /// <summary>
        /// This method will be triggerd right after the command was enqueued to
        /// the flight computer list.
        /// </summary>
        /// <param name="computer">Current flightcomputer</param>
        public override void CommandEnqueued(FlightComputer computer)
        {
            var timetoexec = (TimeStamp + ExtraDelay) - 180;

            // only insert if we've no negative time and the option is set
            if (!(timetoexec - RTUtil.GameTime > 0) || !RTSettings.Instance.AutoInsertKaCAlerts)
            {
                return;
            }

            // set kac alarm label
            var kaCAddonLabel = "Burn " + computer.Vessel.vesselName + " for ";

            if (Duration > 0)
            {
                kaCAddonLabel += RTUtil.FormatDuration(this.Duration);
            }
            else
            {
                kaCAddonLabel += this.DeltaV;
            }

            // create the alarm
            if (RTCore.Instance != null && RTCore.Instance.KacAddon != null)
            {
                KaCItemId = RTCore.Instance.KacAddon.CreateAlarm(RemoteTech_KACWrapper.KACWrapper.KACAPI.AlarmTypeEnum.Raw, kaCAddonLabel, timetoexec, computer.Vessel.id);
            }
        }
Beispiel #4
0
        public void Draw()
        {
            if (Event.current.Equals(Event.KeyboardEvent("return")) && GUI.GetNameOfFocusedControl() == "rt_xd")
            {
                RTCore.Instance.StartCoroutine(onClickAddExtraDelay());
            }
            GUILayout.BeginVertical();
            {
                mScrollPosition = GUILayout.BeginScrollView(mScrollPosition, GUILayout.Width(250));
                {
                    {
                        GUILayout.BeginHorizontal(GUI.skin.box);
                        {
                            var s = new StringBuilder();
                            foreach (var c in mFlightComputer.ActiveCommands)
                            {
                                s.Append(c.Description);
                            }
                            GUILayout.Label(s.ToString().TrimEnd(Environment.NewLine.ToCharArray()));
                            GUILayout.FlexibleSpace();
                            RTUtil.Button("x", () => RTCore.Instance.StartCoroutine(OnClickReset()), GUILayout.Width(21), GUILayout.Height(21));
                        }
                        GUILayout.EndHorizontal();

                        foreach (var c in mFlightComputer.QueuedCommands)
                        {
                            GUILayout.BeginHorizontal(GUI.skin.box);
                            {
                                GUILayout.Label(c.Description);
                                GUILayout.FlexibleSpace();
                                GUILayout.BeginVertical();
                                {
                                    RTUtil.Button("x", () => RTCore.Instance.StartCoroutine(OnClickCancel(c)), GUILayout.Width(21), GUILayout.Height(21));
                                    RTUtil.Button(new GUIContent("v", string.Format("Set the signal delay right after this - Current: {0}", RTUtil.FormatDuration(c.Delay + c.ExtraDelay + getBurnTime(c), false))), () => RTCore.Instance.StartCoroutine(onClickAddExtraDelayFromQueuedCommand(c)), GUILayout.Width(21), GUILayout.Height(21));
                                }
                                GUILayout.EndVertical();
                            }
                            GUILayout.EndHorizontal();
                        }
                    }
                }
                GUILayout.EndScrollView();

                GUILayout.Label(Status);
                GUILayout.BeginHorizontal();
                {
                    GUILayout.Label(new GUIContent("Delay (+ signal): " + RTUtil.FormatDuration(mFlightComputer.TotalDelay), "Total delay including signal delay."));
                    GUILayout.FlexibleSpace();
                    GUI.SetNextControlName("rt_xd");
                    RTUtil.TextField(ref mExtraDelay, GUILayout.Width(45));
                    RTUtil.Button(new GUIContent(">", "Add extra signal delay - Example: 125, 125s, 5m20s, 1d6h20m10s"), () => RTCore.Instance.StartCoroutine(onClickAddExtraDelay()), GUILayout.Width(21), GUILayout.Height(21));
                }
                GUILayout.EndHorizontal();
            }
            GUILayout.EndVertical();
        }
Beispiel #5
0
 private string burnLength()
 {
     return(Duration > 0 ? RTUtil.FormatDuration(Duration) : (DeltaV.ToString("F2") + "m/s"));
 }