Example #1
0
        internal void DeleteGroupCenter()
        {
            if (selectedObjectPrevious == selectedGroup)
            {
                selectedObjectPrevious = null;
            }

            InputLockManager.RemoveControlLock("KKShipLock");
            InputLockManager.RemoveControlLock("KKEVALock");
            InputLockManager.RemoveControlLock("KKCamModes");


            if (KerbalKonstructs.camControl.active)
            {
                KerbalKonstructs.camControl.disable();
            }


            if (selectedGroup == StaticsEditorGUI.GetActiveGroup())
            {
                StaticsEditorGUI.SetActiveGroup(null);
            }

            selectedGroup.DeleteGroupCenter();

            selectedGroup = null;


            StaticsEditorGUI.ResetLocalGroupList();
            this.Close();
        }
Example #2
0
        public void CreatePreviewInstance(StaticModel model)
        {
            StaticInstance instance = new StaticInstance();

            GroupCenter groupCenter = StaticsEditorGUI.GetCloesedCenter(FlightGlobals.ActiveVessel.transform.position);

            if (groupCenter == null)
            {
                MiscUtils.HUDMessage("No Local GroupCenter found. Create one, then try again");
            }
            //instance.mesh = GameObject.Instantiate(model.prefab);
            instance.RadiusOffset    = (float)FlightGlobals.ActiveVessel.altitude;
            instance.CelestialBody   = KerbalKonstructs.instance.GetCurrentBody();
            instance.Group           = groupCenter.Group;
            instance.RadialPosition  = KerbalKonstructs.instance.GetCurrentBody().transform.InverseTransformPoint(FlightGlobals.ActiveVessel.transform.position);
            instance.RotationAngle   = 0f;
            instance.Orientation     = Vector3.up;
            instance.VisibilityRange = 25000f;
            instance.configPath      = KerbalKonstructs.newInstancePath + "/" + model.name + "-instances.cfg";
            instance.configUrl       = null;

            instance.model = model;

            instance.Orientate();
            instance.Activate();
            KerbalKonstructs.SelectInstance(instance, true);
            currPreview = instance;
        }
        internal void DeleteInstance()
        {
            if (StaticsEditorGUI.instance.snapTargetInstance == selectedInstance)
            {
                StaticsEditorGUI.instance.snapTargetInstance = null;
            }
            if (StaticsEditorGUI.instance.selectedObjectPrevious == selectedInstance)
            {
                StaticsEditorGUI.instance.selectedObjectPrevious = null;
            }
            if (selectedObjectPrevious == selectedInstance)
            {
                selectedObjectPrevious = null;
            }


            if (selectedInstance.hasLauchSites)
            {
                LaunchSiteManager.DeleteLaunchSite(selectedInstance.launchSite);
            }


            KerbalKonstructs.instance.DeleteInstance(selectedInstance);
            selectedInstance = null;

            StaticsEditorGUI.ResetInstancesList();

            return;
        }
Example #4
0
        public override void Draw()
        {
            if (MapView.MapIsEnabled)
            {
                return;
            }

            if (!StaticsEditorGUI.IsOpen())
            {
                this.Close();
            }

            drawGroupSelector();
        }
        public override void Draw()
        {
            if (MapView.MapIsEnabled)
            {
                return;
            }

            if (!StaticsEditorGUI.IsOpen() || !EditorGUI.instance.IsOpen() || !EditorGUI.grasColorEnabled || EditorGUI.selectedInstance == null)
            {
                this.Close();
            }

            if (EditorGUI.selectedInstance != selectedInstance)
            {
                selectedInstance = EditorGUI.selectedInstance;
                selectedInstance.HighlightObject(Color.clear);
                SetupFields();
            }

            drawGrasColorUI();
        }