Ejemplo n.º 1
0
        void showSelectedPart(lineType type, Part part)
        {
            if (app.DEBUG)
            {
                app.Log("GUI.showSelectedPart(" + type.ToString() + ", " + part.name + ")", false);
            }

            app.UnHighlightParts(app.goodFuelLines);
            app.UnHighlightParts(app.goodStruts);
            app.UnHighlightParts(app.badFuelLines);
            app.UnHighlightParts(app.badStruts);
            selectedStrut = part;

            switch (type)
            {
            case lineType.goodFuel:
                app.HighlightSinglePart(XKCDColors.Amethyst, app.goodFuelLineColor, part);
                break;

            case lineType.goodStrut:
                app.HighlightSinglePart(XKCDColors.OffWhite, app.goodStrutColor, part);
                break;

            case lineType.badFuel:
                app.HighlightSinglePart(XKCDColors.Amethyst, app.badFuelLineColor, part);
                break;

            case lineType.badStrut:
                app.HighlightSinglePart(XKCDColors.OffWhite, app.badStrutColor, part);
                break;
            }
        }
Ejemplo n.º 2
0
        void showSelectedPart(lineType type, Part part)
        {
            if (app.DEBUG)
            {
                app.Log("GUI.showSelectedPart(" + type.ToString() + ", " + part.name + ")", false);
            }

            app.UnHighlightParts(app.goodFuelLines);
            app.UnHighlightParts(app.goodStruts);
            app.UnHighlightParts(app.badFuelLines);
            app.UnHighlightParts(app.badStruts);
            selectedStrut = part;

            switch (type)
            {
            case lineType.goodFuel:
                app.HighlightSinglePart(XKCDColors.Amethyst, app.goodFuelLineColor, part);
                break;

            case lineType.goodStrut:
                app.HighlightSinglePart(XKCDColors.OffWhite, app.goodStrutColor, part);
                break;

            case lineType.badFuel:
                app.HighlightSinglePart(XKCDColors.Amethyst, app.badFuelLineColor, part);
                break;

            case lineType.badStrut:
                app.HighlightSinglePart(XKCDColors.OffWhite, app.badStrutColor, part);
                break;
            }

            if (HighLogic.LoadedSceneIsEditor)
            {
                var camera = EditorLogic.fetch.editorCamera;
                var sphCam = camera.GetComponent <SPHCamera>();
                var vabCam = camera.GetComponent <VABCamera>();

                // WHY THE EFF DOES IKSPCamera not declare PlaceCamera, SQUAD!?
                if (sphCam.enabled && sphCam != null)
                {
                    sphCam.PlaceCamera(part.transform.position, app.camOffsetDistance);
                }
                else if (vabCam.enabled && vabCam != null)
                {
                    vabCam.PlaceCamera(part.transform.position, app.camOffsetDistance);
                }
                else
                {
                    Debug.LogError("StrutFinder: Unable to locate a valid editor camera component.");
                }
            }
            else if (HighLogic.LoadedSceneIsFlight)
            {
                if (MapView.MapIsEnabled || (CameraManager.Instance.currentCameraMode == CameraManager.CameraMode.IVA))
                {
                    return;
                }

                var camera = FlightCamera.fetch;
                camera.SetTargetPart(part);
                camera.SetDistance(app.camOffsetDistance);
            }
        }