예제 #1
0
        //TODO load docking module config from sub-config nodes in the module node
        private void updateBottomDockModule(bool start)
        {
            bool bottomNodeActive = bottomDockModule.model != null;

            if (bottomNodeActive && bottomDockPartModule == null)
            {
                ConfigNode bottomModuleNode = new ConfigNode("MODULE");
                bottomModuleNode.AddValue("name", "ModuleDockingNode");
                bottomModuleNode.AddValue("referenceAttachNode", bottomDockNode);
                bottomModuleNode.AddValue("useReferenceAttachNode", true);
                bottomModuleNode.AddValue("nodeTransformName", bottomDockName);
                bottomModuleNode.AddValue("controlTransformName", bottomDockName + "Control");
                bottomModuleNode.AddValue("nodeType", "size0, size1");
                bottomModuleNode.AddValue("captureRange", "0.1");
                bottomDockPartModule = (ModuleDockingNode)part.AddModule(bottomModuleNode);
                if (start)
                {
                    bottomDockPartModule.OnStart(StartState.Editor);
                }
                bottomDockPartModule.referenceNode = part.FindAttachNode(bottomDockNode);
            }
            else if (!bottomNodeActive && bottomDockPartModule != null)
            {
                part.RemoveModule(bottomDockPartModule);
            }
            if (bottomNodeActive)
            {
                SSTUMultiDockingPort.updateDockingModuleFieldNames(bottomDockPartModule, "Bottom Port");
            }
        }
 //TODO load docking module config from sub-config nodes in the module node
 private void updateTopDockModule(bool start)
 {
     bool topNodeActive = topDockModule.model != null;
     if (topNodeActive && topDockPartModule == null)
     {
         ConfigNode topModuleNode = new ConfigNode("MODULE");
         topModuleNode.AddValue("name", "ModuleDockingNode");
         topModuleNode.AddValue("referenceAttachNode", topDockNode);
         topModuleNode.AddValue("useReferenceAttachNode", true);
         topModuleNode.AddValue("nodeTransformName", topDockName);
         topModuleNode.AddValue("controlTransformName", topDockName + "Control");
         topModuleNode.AddValue("nodeType", "size0, size1");
         topModuleNode.AddValue("captureRange", "0.1");
         topDockPartModule = (ModuleDockingNode)part.AddModule(topModuleNode);
         if (start) { topDockPartModule.OnStart(StartState.Editor); }
         topDockPartModule.referenceNode = part.FindAttachNode(topDockNode);
     }
     else if (!topNodeActive && topDockPartModule != null)
     {
         part.RemoveModule(topDockPartModule);
     }
     if (topNodeActive)
     {
         SSTUMultiDockingPort.updateDockingModuleFieldNames(topDockPartModule, "Top Port");
     }
 }