Exemplo n.º 1
0
 protected override void content()
 {
     MarkerForces comv = RCSBuildAid.VesselForces;
     MomentOfInertia moi = comv.MoI;
     GUILayout.BeginHorizontal (GUI.skin.box);
     {
         GUILayout.BeginVertical ();
         {
             GUILayout.Label ("Mouse");
             GUILayout.Label ("MoI");
             GUILayout.Label ("Ang Acc");
             GUILayout.Label ("Ang Acc");
         }
         GUILayout.EndVertical ();
         GUILayout.BeginVertical ();
         {
             GUILayout.Label (String.Format ("{0}, {1}", Input.mousePosition.x, Input.mousePosition.y));
             GUILayout.Label (moi.value.ToString("0.## tm²"));
             float angAcc = comv.Torque().magnitude / moi.value;
             GUILayout.Label (angAcc.ToString ("0.## r/s²"));
             GUILayout.Label ((angAcc * Mathf.Rad2Deg).ToString ("0.## °/s²"));
         }
         GUILayout.EndVertical ();
     }
     GUILayout.EndHorizontal ();
     DebugSettings.labelMagnitudes =
         GUILayout.Toggle(DebugSettings.labelMagnitudes, "Show vector magnitudes");
     DebugSettings.inFlightAngularInfo =
         GUILayout.Toggle(DebugSettings.inFlightAngularInfo, "In flight angular data");
     DebugSettings.inFlightPartInfo =
         GUILayout.Toggle(DebugSettings.inFlightPartInfo, "In flight vessel tree");
     DebugSettings.startInOrbit =
         GUILayout.Toggle(DebugSettings.startInOrbit, "Launch in orbit");
     if (GUILayout.Button ("Toggle vessel tree window")) {
         if (vesselTreeWindow == null) {
             vesselTreeWindow = gameObject.AddComponent<DebugVesselTree> ();
         } else {
             Destroy (vesselTreeWindow);
         }
     }
     if (GUILayout.Button ("Toggle part list window")) {
         if (partListWindow == null) {
             partListWindow = gameObject.AddComponent<DebugPartList> ();
         } else {
             Destroy (partListWindow);
         }
     }
     if (GUILayout.Button ("More info")) {
         if (debugMiscInfo == null) {
             debugMiscInfo = gameObject.AddComponent<DebugMiscInfo> ();
         } else {
             Destroy (debugMiscInfo);
         }
     }
 }
Exemplo n.º 2
0
        protected override void content()
        {
            /*MarkerForces comv = RCSBuildAid.VesselForces;
             * MomentOfInertia moi = comv.MoI;
             * GUILayout.BeginHorizontal (GUI.skin.box);
             * {
             *  GUILayout.BeginVertical ();
             *  {
             *      GUILayout.Label ("Mouse");
             *      GUILayout.Label ("MoI");
             *      GUILayout.Label ("Ang Acc");
             *      GUILayout.Label ("Ang Acc");
             *  }
             *  GUILayout.EndVertical ();
             *  GUILayout.BeginVertical ();
             *  {
             *      GUILayout.Label (String.Format ("{0}, {1}", Input.mousePosition.x, Input.mousePosition.y));
             *      GUILayout.Label (moi.value.ToString("0.## tm²"));
             *      float angAcc = comv.Torque().magnitude / moi.value;
             *      GUILayout.Label (angAcc.ToString ("0.## r/s²"));
             *      GUILayout.Label ((angAcc * Mathf.Rad2Deg).ToString ("0.## °/s²"));
             *  }
             *  GUILayout.EndVertical ();
             * }
             * GUILayout.EndHorizontal ();*/

            Part part = null;

            if (massInfo || dragInfo)
            {
                foreach (var p in EditorLogic.fetch.ship.parts)
                {
                    if (p.stackIcon.highlightIcon)
                    {
                        part = p;
                        break;
                    }
                }
            }
            if (massInfo)
            {
                if (part != null)
                {
                    GUILayout.BeginVertical(GUI.skin.box);
                    {
                        printMassInfo(part);
                    }
                    GUILayout.EndVertical();
                }
                else
                {
                    if (GUILayout.Button("mouseover a part"))
                    {
                        massInfo = !massInfo;
                    }
                }
            }
            else
            {
                if (GUILayout.Button("mass info"))
                {
                    massInfo = !massInfo;
                }
            }
            if (dragInfo)
            {
                if (part != null)
                {
                    GUILayout.BeginVertical(GUI.skin.box);
                    {
                        printDragInfo(part);
                    }
                    GUILayout.EndVertical();
                }
                else
                {
                    if (GUILayout.Button("mouseover a part"))
                    {
                        dragInfo = !dragInfo;
                    }
                }
            }
            else
            {
                if (GUILayout.Button("drag info"))
                {
                    dragInfo = !dragInfo;
                }
            }
            DebugSettings.labelMagnitudes =
                GUILayout.Toggle(DebugSettings.labelMagnitudes, "Show vector magnitudes");
            DebugSettings.inFlightAngularInfo =
                GUILayout.Toggle(DebugSettings.inFlightAngularInfo, "In flight angular data");
            DebugSettings.inFlightPartInfo =
                GUILayout.Toggle(DebugSettings.inFlightPartInfo, "In flight vessel tree");
            DebugSettings.startInOrbit =
                GUILayout.Toggle(DebugSettings.startInOrbit, "Launch in orbit");
            if (GUILayout.Button("Toggle vessel tree window"))
            {
                if (vesselTreeWindow == null)
                {
                    vesselTreeWindow = gameObject.AddComponent <DebugVesselTree> ();
                }
                else
                {
                    Destroy(vesselTreeWindow);
                }
            }
            if (GUILayout.Button("Toggle part list window"))
            {
                if (partListWindow == null)
                {
                    partListWindow = gameObject.AddComponent <DebugPartList> ();
                }
                else
                {
                    Destroy(partListWindow);
                }
            }
            if (GUILayout.Button("More info"))
            {
                if (debugMiscInfo == null)
                {
                    debugMiscInfo = gameObject.AddComponent <DebugMiscInfo> ();
                }
                else
                {
                    Destroy(debugMiscInfo);
                }
            }
        }
Exemplo n.º 3
0
        protected override void content()
        {
            /*MarkerForces comv = RCSBuildAid.VesselForces;
            MomentOfInertia moi = comv.MoI;
            GUILayout.BeginHorizontal (GUI.skin.box);
            {
                GUILayout.BeginVertical ();
                {
                    GUILayout.Label ("Mouse");
                    GUILayout.Label ("MoI");
                    GUILayout.Label ("Ang Acc");
                    GUILayout.Label ("Ang Acc");
                }
                GUILayout.EndVertical ();
                GUILayout.BeginVertical ();
                {
                    GUILayout.Label (String.Format ("{0}, {1}", Input.mousePosition.x, Input.mousePosition.y));
                    GUILayout.Label (moi.value.ToString("0.## tm²"));
                    float angAcc = comv.Torque().magnitude / moi.value;
                    GUILayout.Label (angAcc.ToString ("0.## r/s²"));
                    GUILayout.Label ((angAcc * Mathf.Rad2Deg).ToString ("0.## °/s²"));
                }
                GUILayout.EndVertical ();
            }
            GUILayout.EndHorizontal ();*/

            if (massInfo) {
                Part part = null;
                foreach (var p in EditorLogic.fetch.ship.parts) {
                    if (p.stackIcon.highlightIcon) {
                        part = p;
                        break;
                    }
                }
                if (part != null) {
                    const float w = 50;
                    GUILayout.BeginVertical (GUI.skin.box);
                    {
                        GUILayout.BeginHorizontal ();
                        {
                            GUILayout.Label ("part", GUILayout.Width (w));
                            GUILayout.Label (part.partInfo.name);
                        }
                        GUILayout.EndHorizontal ();
                        GUILayout.BeginHorizontal ();
                        {
                            GUILayout.Label ("mass", GUILayout.Width (w));
                            GUILayout.Label (part.mass.ToString ("F3"));
                        }
                        GUILayout.EndHorizontal ();
                        var m = part.partInfo.partPrefab.mass;
                        GUILayout.BeginHorizontal ();
                        {
                            GUILayout.Label ("p. mass", GUILayout.Width (w));
                            GUILayout.Label (m.ToString ("F3"));
                        }
                        GUILayout.EndHorizontal ();
                        GUILayout.BeginHorizontal ();
                        {
                            GUILayout.Label ("module", GUILayout.Width (w));
                            GUILayout.Label (part.GetModuleMass (m).ToString ("F3"));
                        }
                        GUILayout.EndHorizontal ();
                        GUILayout.BeginHorizontal ();
                        {
                            GUILayout.Label ("resource", GUILayout.Width (w));
                            GUILayout.Label (part.GetResourceMass ().ToString ("F3"));
                        }
                        GUILayout.EndHorizontal ();
                        GUILayout.BeginHorizontal ();
                        {
                            GUILayout.Label ("childs", GUILayout.Width (w));
                            GUILayout.Label (part.GetPhysicslessChildMassInEditor ().ToString ("F3"));
                        }
                        GUILayout.EndHorizontal ();
                        GUILayout.BeginHorizontal ();
                        {
                            GUILayout.Label ("total", GUILayout.Width (w));
                            GUILayout.Label (part.GetTotalMass ().ToString ("F3"));
                        }
                        GUILayout.EndHorizontal ();
                    }
                    GUILayout.EndVertical ();
                } else {
                    if (GUILayout.Button ("mouseover a part")) {
                        massInfo = !massInfo;
                    }
                }
            } else {
                if (GUILayout.Button ("mass info")) {
                    massInfo = !massInfo;
                }
            }
            DebugSettings.labelMagnitudes =
                GUILayout.Toggle(DebugSettings.labelMagnitudes, "Show vector magnitudes");
            DebugSettings.inFlightAngularInfo =
                GUILayout.Toggle(DebugSettings.inFlightAngularInfo, "In flight angular data");
            DebugSettings.inFlightPartInfo =
                GUILayout.Toggle(DebugSettings.inFlightPartInfo, "In flight vessel tree");
            DebugSettings.startInOrbit =
                GUILayout.Toggle(DebugSettings.startInOrbit, "Launch in orbit");
            if (GUILayout.Button ("Toggle vessel tree window")) {
                if (vesselTreeWindow == null) {
                    vesselTreeWindow = gameObject.AddComponent<DebugVesselTree> ();
                } else {
                    Destroy (vesselTreeWindow);
                }
            }
            if (GUILayout.Button ("Toggle part list window")) {
                if (partListWindow == null) {
                    partListWindow = gameObject.AddComponent<DebugPartList> ();
                } else {
                    Destroy (partListWindow);
                }
            }
            if (GUILayout.Button ("More info")) {
                if (debugMiscInfo == null) {
                    debugMiscInfo = gameObject.AddComponent<DebugMiscInfo> ();
                } else {
                    Destroy (debugMiscInfo);
                }
            }
        }