Beispiel #1
0
        public IEnumerator WaitForRay()
        {
            yield return(new WaitForSeconds(1));

            _isRayEnabled = false;
            var target = new TargetHelper(ThisPart);

            target.Update();
            Vector3 endPoint;

            if (target.Destination <= _allowedScanDistance && IsInsight(out endPoint) && IsTargetVisiable())
            {
                ScreenMessages.PostScreenMessage(FlightGlobals.activeTarget.vessel.vesselName + " HAS BEEN SCANNED", 3f, ScreenMessageStyle.UPPER_CENTER);
                if (!_isScienceActivate)
                {
                    var spyScience = ThisPart.GetComponent <ModuleSpyExperiment>();
                    if (spyScience != null)
                    {
                        spyScience.DeployExperiment();
                    }
                    _isScienceActivate = true;
                }
            }
            else
            {
                ScreenMessages.PostScreenMessage("NO DATA, TARGET " + FlightGlobals.activeTarget.vessel.vesselName + " IS OUT OF RANGE  OR VISIBILITY", 3f, ScreenMessageStyle.UPPER_CENTER);
            }
        }
        public IEnumerator WaitForRay()
        {
            yield return(new WaitForSeconds(1f));

            isRayEnabled = false;
            TargetHelper targetHelper = new TargetHelper(part);

            targetHelper.Update();
            Vector3 vector;

            if (targetHelper.Destination <= (float)allowedScanDistance && IsInsight(out vector) && IsTargetVisiable())
            {
                ScreenMessages.PostScreenMessage(FlightGlobals.activeTarget.vessel.vesselName + " HAS BEEN SCANNED", 3f, 0);
                if (!isScienceActivate)
                {
                    ModuleSpyExperiment moduleSpyExperiment = part.GetComponent <ModuleSpyExperiment>();
                    if (moduleSpyExperiment != null)
                    {
                        moduleSpyExperiment.DeployExperiment();
                    }
                    isScienceActivate   = true;
                    moduleSpyExperiment = null;
                }
            }
            else
            {
                ScreenMessages.PostScreenMessage("NO DATA, TARGET " + FlightGlobals.activeTarget.vessel.vesselName + " IS OUT OF RANGE  OR VISIBILITY", 3f, 0);
            }
            yield break;
        }
Beispiel #3
0
 public IEnumerator WaitForRay()
 {
     yield return new WaitForSeconds(1);
     IsRayEnabled = false;
     var target = new TargetHelper(part);
     target.Update();
     Vector3 endPoint;
     if (target.Destination <= AllowedDistance && isInsight(out endPoint) && isTargetVisiable())
     {
         ScreenMessages.PostScreenMessage(FlightGlobals.activeTarget.vessel.vesselName + " HAS BEEN SCANNED", 3f, ScreenMessageStyle.UPPER_CENTER);
         if (!IsScienceActivate)
         {
             var spyScience = part.GetComponent<ModuleSpyExperiment>();
             if (spyScience != null)
                 spyScience.DeployExperiment();
             IsScienceActivate = true;
         }
     }
     else
     {
         ScreenMessages.PostScreenMessage("NO DATA, TARGET " + FlightGlobals.activeTarget.vessel.vesselName + " IS OUT OF RANGE  OR VISIBILITY", 3f, ScreenMessageStyle.UPPER_CENTER);
     }
 }
Beispiel #4
0
        private void GetFlightData()
        {
            if (!_cameraData)
            {
                return;
            }
            if (TargetHelper.IsTargetSelect && ThisPart.vessel.Equals(FlightGlobals.ActiveVessel))
            {
                // DockPort DATA block
                float i = 0;
                _target.Update();

                if (!_target.IsDockPort)
                {
                    GUI.Label(new Rect(TexturePosition.xMin + 2, 34, 100, 40), "Target is not\n a DockPort");
                    if (_target.Destination < 200f)
                    {
                        GUI.Label(new Rect(TexturePosition.xMin + 2, 68, 100, 40), "DockPort is\n available", Styles.GreenLabel11);
                    }
                }
                else
                {
                    GUI.Label(new Rect(TexturePosition.xMin + 2, 34, 100, 40), "DockPort captured", Styles.GreenLabel13);
                }

                // Flight DATA
                var dataFormat   = Math.Abs(_target.Destination) < 1000 ? "{0:f2}" : "{0:f0}";
                var stringOffset = 16;
                GUI.Label(new Rect(TexturePosition.xMax - 70, 34 + i++ *stringOffset, 70, 20), string.Format("Dist:" + dataFormat, _target.Destination), Styles.Label13B);
                i += .2f;

                GUI.Label(new Rect(TexturePosition.xMax - 70, 34 + i++ *stringOffset, 70, 20), string.Format("dX:" + dataFormat, _target.DX));
                GUI.Label(new Rect(TexturePosition.xMax - 70, 34 + i++ *stringOffset, 70, 20), string.Format("dY:" + dataFormat, _target.DY));
                GUI.Label(new Rect(TexturePosition.xMax - 70, 34 + i++ *stringOffset, 70, 20), string.Format("dZ:" + dataFormat, _target.DZ));
                i += .2f;

                if (Math.Abs(_target.SpeedX) > _maxSpeed && Math.Abs(_target.Destination) < 200)
                {
                    GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vX:{_target.SpeedX:f2}", Styles.RedLabel13);
                }
                else
                {
                    GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vX:{_target.SpeedX:f2}", Styles.Label13);
                }

                if (Math.Abs(_target.SpeedY) > _maxSpeed && Math.Abs(_target.Destination) < 200)
                {
                    GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vY:{_target.SpeedY:f2}", Styles.RedLabel13);
                }
                else
                {
                    GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vY:{_target.SpeedY:f2}", Styles.Label13);
                }

                if (Math.Abs(_target.SpeedZ) > _maxSpeed && Math.Abs(_target.Destination) < 200)
                {
                    GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vZ:{_target.SpeedZ:f2}", Styles.RedLabel13);
                }
                else
                {
                    GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vZ:{_target.SpeedZ:f2}", Styles.Label13);
                }
                i += .2f;

                GUI.Label(new Rect(TexturePosition.xMax - 70, 40 + i++ *stringOffset, 70, 20), $"Yaw:{_target.AngleX:f0}°");
                GUI.Label(new Rect(TexturePosition.xMax - 70, 40 + i++ *stringOffset, 70, 20), $"Pitch:{_target.AngleY:f0}°");
                GUI.Label(new Rect(TexturePosition.xMax - 70, 40 + i * stringOffset, 70, 20), $"Roll:{_target.AngleZ:f0}°");
            }
        }
Beispiel #5
0
        private void GetFlightData()
        {
            if (cameraData)
            {
                if (TargetHelper.IsTargetSelect && part.vessel.Equals(FlightGlobals.ActiveVessel))
                {
                    /// DATA block
                    /// <summary>
                    float i = 0;
                    target.Update();

                    if (!target.isDockPort)
                    {
                        GUI.Label(new Rect(texturePosition.xMin + 10, 54, 100, 40),
                                  "Target is not\n a DockPort");
                        if (target.Destination < 200f)
                        {
                            GUI.Label(new Rect(texturePosition.xMin + 10, 84, 96, 40),
                                      "DockPort is\n available", guiStyleGreenLabel);
                        }
                    }

                    /// <summary>
                    /// FlightDATA
                    /// <summary>
                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("Dist:{0:f2}", target.Destination));
                    i += .2f;

                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("dx:{0:f2}", target.DX));
                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("dy:{0:f2}", target.DY));
                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("dz:{0:f2}", target.DZ));
                    i += .2f;

                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("vX:{0:f2}", target.SpeedX));
                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("vY:{0:f2}", target.SpeedY));
                    if (target.SpeedZ < -MaxSpeed)
                    {
                        GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                                  String.Format("vZ:{0:f2}", target.SpeedZ), guiStyleRedLabel);
                    }
                    else
                    {
                        GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                                  String.Format("vZ:{0:f2}", target.SpeedZ));
                    }
                    i += .2f;

                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("Yaw:{0:f0}°", target.AngleX));
                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("Pitch:{0:f0}°", target.AngleY));
                    GUI.Label(new Rect(texturePosition.xMax - 70, 32 + i++ *20, 70, 20),
                              String.Format("Roll:{0:f0}°", target.AngleZ));
                }
            }
        }
 private void GetFlightData()
 {
     if (cameraData)
     {
         if (TargetHelper.IsTargetSelect && part.vessel.Equals(FlightGlobals.ActiveVessel))
         {
             float num = 0f;
             target.Update();
             if (!target.IsDockPort)
             {
                 GUI.Label(new Rect(texturePosition.xMin + 2f, 34f, 100f, 40f), "Target is not\n a DockPort");
                 if (target.Destination < 200f)
                 {
                     GUI.Label(new Rect(texturePosition.xMin + 2f, 68f, 100f, 40f), "DockPort is\n available", Styles.guiStyleGreenLabelSmall);
                 }
             }
             else
             {
                 GUI.Label(new Rect(texturePosition.xMin + 2f, 34f, 100f, 40f), "DockPort captured", Styles.guiStyleGreenLabelStandart);
             }
             string str       = (Math.Abs(target.Destination) < 1000f) ? "{0:f2}" : "{0:f0}";
             int    num2      = 16;
             float  arg_16B_0 = texturePosition.xMax - 70f;
             float  arg_160_0 = 34f;
             float  expr_154  = num;
             num = expr_154 + 1f;
             GUI.Label(new Rect(arg_16B_0, arg_160_0 + expr_154 * (float)num2, 70f, 20f), string.Format("Dist:" + str, target.Destination), Styles.guiStyleLabelWhiteBold);
             num += 0.2f;
             float arg_1D1_0 = texturePosition.xMax - 70f;
             float arg_1C6_0 = 34f;
             float expr_1BA  = num;
             num = expr_1BA + 1f;
             GUI.Label(new Rect(arg_1D1_0, arg_1C6_0 + expr_1BA * (float)num2, 70f, 20f), string.Format("dX:" + str, target.DX));
             float arg_22A_0 = texturePosition.xMax - 70f;
             float arg_21F_0 = 34f;
             float expr_213  = num;
             num = expr_213 + 1f;
             GUI.Label(new Rect(arg_22A_0, arg_21F_0 + expr_213 * (float)num2, 70f, 20f), string.Format("dY:" + str, target.DY));
             float arg_283_0 = texturePosition.xMax - 70f;
             float arg_278_0 = 34f;
             float expr_26C  = num;
             num = expr_26C + 1f;
             GUI.Label(new Rect(arg_283_0, arg_278_0 + expr_26C * (float)num2, 70f, 20f), string.Format("dZ:" + str, target.DZ));
             num += 0.2f;
             if (Math.Abs(target.SpeedX) > maxSpeed && Math.Abs(target.Destination) < 200f)
             {
                 float arg_31C_0 = texturePosition.xMax - 70f;
                 float arg_311_0 = 38f;
                 float expr_305  = num;
                 num = expr_305 + 1f;
                 GUI.Label(new Rect(arg_31C_0, arg_311_0 + expr_305 * (float)num2, 70f, 20f), string.Format("vX:{0:f2}", target.SpeedX), Styles.guiStyleRedLabelNormal);
             }
             else
             {
                 float arg_376_0 = texturePosition.xMax - 70f;
                 float arg_36B_0 = 38f;
                 float expr_35F  = num;
                 num = expr_35F + 1f;
                 GUI.Label(new Rect(arg_376_0, arg_36B_0 + expr_35F * (float)num2, 70f, 20f), string.Format("vX:{0:f2}", target.SpeedX), Styles.guiStyleLabelWhiteNormal);
             }
             if (Math.Abs(target.SpeedY) > maxSpeed && Math.Abs(target.Destination) < 200f)
             {
                 float arg_406_0 = texturePosition.xMax - 70f;
                 float arg_3FB_0 = 38f;
                 float expr_3EF  = num;
                 num = expr_3EF + 1f;
                 GUI.Label(new Rect(arg_406_0, arg_3FB_0 + expr_3EF * (float)num2, 70f, 20f), string.Format("vY:{0:f2}", target.SpeedY), Styles.guiStyleRedLabelNormal);
             }
             else
             {
                 float arg_460_0 = texturePosition.xMax - 70f;
                 float arg_455_0 = 38f;
                 float expr_449  = num;
                 num = expr_449 + 1f;
                 GUI.Label(new Rect(arg_460_0, arg_455_0 + expr_449 * (float)num2, 70f, 20f), string.Format("vY:{0:f2}", target.SpeedY), Styles.guiStyleLabelWhiteNormal);
             }
             if (Math.Abs(target.SpeedZ) > maxSpeed && Math.Abs(target.Destination) < 200f)
             {
                 float arg_4F0_0 = texturePosition.xMax - 70f;
                 float arg_4E5_0 = 38f;
                 float expr_4D9  = num;
                 num = expr_4D9 + 1f;
                 GUI.Label(new Rect(arg_4F0_0, arg_4E5_0 + expr_4D9 * (float)num2, 70f, 20f), string.Format("vZ:{0:f2}", target.SpeedZ), Styles.guiStyleRedLabelNormal);
             }
             else
             {
                 float arg_54A_0 = texturePosition.xMax - 70f;
                 float arg_53F_0 = 38f;
                 float expr_533  = num;
                 num = expr_533 + 1f;
                 GUI.Label(new Rect(arg_54A_0, arg_53F_0 + expr_533 * (float)num2, 70f, 20f), string.Format("vZ:{0:f2}", target.SpeedZ), Styles.guiStyleLabelWhiteNormal);
             }
             num += 0.2f;
             float arg_5AA_0 = texturePosition.xMax - 70f;
             float arg_59F_0 = 40f;
             float expr_593  = num;
             num = expr_593 + 1f;
             GUI.Label(new Rect(arg_5AA_0, arg_59F_0 + expr_593 * (float)num2, 70f, 20f), string.Format("Yaw:{0:f0}°", target.AngleX));
             float arg_5FD_0 = texturePosition.xMax - 70f;
             float arg_5F2_0 = 40f;
             float expr_5E6  = num;
             num = expr_5E6 + 1f;
             GUI.Label(new Rect(arg_5FD_0, arg_5F2_0 + expr_5E6 * (float)num2, 70f, 20f), string.Format("Pitch:{0:f0}°", target.AngleY));
             GUI.Label(new Rect(texturePosition.xMax - 70f, 40f + num * (float)num2, 70f, 20f), string.Format("Roll:{0:f0}°", target.AngleZ));
         }
     }
 }
        private void GetFlightData()
        {
            if (!_cameraData)
            {
                return;
            }
            if (TargetHelper.IsTargetSelect && ThisPart.vessel.Equals(FlightGlobals.ActiveVessel))
            {
                // DockPort DATA block
                float i = 0;
                _target.Update();

                if (!_target.IsDockPort)
                {
                    GUI.Label(new Rect(TexturePosition.xMin + 2, 34, 100, 40), "Target is not\n a DockPort");
                    if (_target.Destination < 200f)
                    {
                        GUI.Label(new Rect(TexturePosition.xMin + 2, 68, 100, 40), "DockPort is\n available", Styles.GreenLabel11);
                    }
                }
                else
                {
                    GUI.Label(new Rect(TexturePosition.xMin + 2, 34, 100, 40), "DockPort captured", Styles.GreenLabel13);
                }

                // Flight DATA
                var dataFormat   = Math.Abs(_target.Destination) < 1000 ? "{0:f2}" : "{0:f0}";
                var stringOffset = 16;

                if (!HighLogic.CurrentGame.Parameters.CustomParams <KURSSettings_2>().altOverlay)
                {
                    if (HighLogic.CurrentGame.Parameters.CustomParams <KURSSettings_1>().showSummaryData)
                    {
                        GUI.Label(new Rect(TexturePosition.xMax - 70, 34 + i++ *stringOffset, 70, 20), string.Format("Dist:" + dataFormat, _target.Destination), Styles.Label13B);

                        GUI.Label(new Rect(TexturePosition.xMax - 70, 34 + i++ *stringOffset, 70, 20),
                                  string.Format("Vel:" + dataFormat, _target.closureRate), Styles.Label13B);

                        i += .2f;
                    }
                    if (HighLogic.CurrentGame.Parameters.CustomParams <KURSSettings_1>().showData)
                    {
                        GUI.Label(new Rect(TexturePosition.xMax - 70, 34 + i++ *stringOffset, 70, 20), string.Format("dX:" + dataFormat, _target.DX));
                        GUI.Label(new Rect(TexturePosition.xMax - 70, 34 + i++ *stringOffset, 70, 20), string.Format("dY:" + dataFormat, _target.DY));
                        GUI.Label(new Rect(TexturePosition.xMax - 70, 34 + i++ *stringOffset, 70, 20), string.Format("dZ:" + dataFormat, _target.DZ));
                        i += .2f;

                        if (Math.Abs(_target.SpeedX) > _maxSpeed && Math.Abs(_target.Destination) < 200)
                        {
                            GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vX:{_target.SpeedX:f2}", Styles.RedLabel13);
                        }
                        else
                        {
                            GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vX:{_target.SpeedX:f2}", Styles.Label13);
                        }

                        if (Math.Abs(_target.SpeedY) > _maxSpeed && Math.Abs(_target.Destination) < 200)
                        {
                            GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vY:{_target.SpeedY:f2}", Styles.RedLabel13);
                        }
                        else
                        {
                            GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vY:{_target.SpeedY:f2}", Styles.Label13);
                        }

                        if (Math.Abs(_target.SpeedZ) > _maxSpeed && Math.Abs(_target.Destination) < 200)
                        {
                            GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vZ:{_target.SpeedZ:f2}", Styles.RedLabel13);
                        }
                        else
                        {
                            GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vZ:{_target.SpeedZ:f2}", Styles.Label13);
                        }
                        i += .2f;

                        GUI.Label(new Rect(TexturePosition.xMax - 70, 40 + i++ *stringOffset, 70, 20), $"Yaw:{_target.AngleX:f0}°");
                        GUI.Label(new Rect(TexturePosition.xMax - 70, 40 + i++ *stringOffset, 70, 20), $"Pitch:{_target.AngleY:f0}°");
                        GUI.Label(new Rect(TexturePosition.xMax - 70, 40 + i++ *stringOffset, 70, 20), $"Roll:{_target.AngleZ:f0}°");
                    }
                }
                else
                {
                    if (HighLogic.CurrentGame.Parameters.CustomParams <KURSSettings_1>().showData)
                    {
                        GUI.Label(new Rect(TexturePosition.xMax - 70, 34 + i++ *stringOffset, 70, 20), string.Format("dX:" + dataFormat, -_target.DPos.x));
                        GUI.Label(new Rect(TexturePosition.xMax - 70, 34 + i++ *stringOffset, 70, 20), string.Format("dY:" + dataFormat, -_target.DPos.y));
                        GUI.Label(new Rect(TexturePosition.xMax - 70, 34 + i++ *stringOffset, 70, 20), string.Format("dZ:" + dataFormat, -_target.DPos.z));
                        i += .2f;

                        if (Math.Abs(_target.Velocity.x) > _maxSpeed && Math.Abs(_target.Destination) < 200)
                        {
                            GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vX:{_target.Velocity.x:f2}", Styles.RedLabel13);
                        }
                        else
                        {
                            GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vX:{_target.Velocity.x:f2}", Styles.Label13);
                        }

                        if (Math.Abs(_target.Velocity.y) > _maxSpeed && Math.Abs(_target.Destination) < 200)
                        {
                            GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vY:{_target.Velocity.y:f2}", Styles.RedLabel13);
                        }
                        else
                        {
                            GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vY:{_target.Velocity.y:f2}", Styles.Label13);
                        }

                        if (Math.Abs(_target.Velocity.z) > _maxSpeed && Math.Abs(_target.Destination) < 200)
                        {
                            GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vZ:{_target.Velocity.z:f2}", Styles.RedLabel13);
                        }
                        else
                        {
                            GUI.Label(new Rect(TexturePosition.xMax - 70, 38 + i++ *stringOffset, 70, 20), $"vZ:{_target.Velocity.z:f2}", Styles.Label13);
                        }
                        i += .2f;

                        GUI.Label(new Rect(TexturePosition.xMax - 70, 40 + i++ *stringOffset, 70, 20), $"Yaw:{_target.AngleY:f0}°");
                        GUI.Label(new Rect(TexturePosition.xMax - 70, 40 + i++ *stringOffset, 70, 20), $"Pitch:{_target.AngleX:f0}°");
                        GUI.Label(new Rect(TexturePosition.xMax - 70, 40 + i * stringOffset, 70, 20), $"Roll:{_target.AngleZ:f0}°");
                    }
                }
            }
        }