コード例 #1
0
ファイル: map_node_pool.cs プロジェクト: raux/Principia
            public void RenderMarkers(DisposableIterator apsis_iterator,
                                      MapObject.ObjectType type,
                                      NodeSource source,
                                      Vessel vessel,
                                      CelestialBody celestial)
            {
                for (; !apsis_iterator.IteratorAtEnd();
                     apsis_iterator.IteratorIncrement())
                {
                    QP apsis = apsis_iterator.IteratorGetDiscreteTrajectoryQP();
                    MapNodeProperties node_properties;
                    node_properties.object_type    = type;
                    node_properties.vessel         = vessel;
                    node_properties.celestial      = celestial;
                    node_properties.world_position = (Vector3d)apsis.q;
                    node_properties.velocity       = (Vector3d)apsis.p;
                    node_properties.source         = source;
                    node_properties.time           = apsis_iterator.IteratorGetDiscreteTrajectoryTime();

                    if (pool_index_ == nodes_.Count)
                    {
                        nodes_.Add(MakePoolNode());
                    }
                    else if (properties_[nodes_[pool_index_]].object_type != type)
                    {
                        // Do not reuse a node for different types, as this results in
                        // overlapping labels on KSP 1.3, e.g. a closest approach marker that
                        // also says "Ap" and "DN".
                        nodes_[pool_index_].Terminate();
                        properties_.Remove(nodes_[pool_index_]);
                        nodes_[pool_index_] = MakePoolNode();
                    }
                    properties_[nodes_[pool_index_++]] = node_properties;
                }
            }
コード例 #2
0
ファイル: map_node_pool.cs プロジェクト: bradediger/Principia
            public void RenderMarkers(DisposableIterator apsis_iterator,
                                      MapObject.ObjectType type,
                                      NodeSource source,
                                      Vessel vessel,
                                      CelestialBody celestial)
            {
                // We render at most 64 markers of one type and one provenance (e.g., at
                // most 64 perilunes for the prediction of the active vessel).  This is
                // more than is readable, and keeps the size of the map node pool under
                // control.
                for (int i = 0; i < 64 && !apsis_iterator.IteratorAtEnd();
                     ++i, apsis_iterator.IteratorIncrement())
                {
                    QP apsis = apsis_iterator.IteratorGetDiscreteTrajectoryQP();
                    MapNodeProperties node_properties = new MapNodeProperties {
                        visible        = true,
                        object_type    = type,
                        vessel         = vessel,
                        celestial      = celestial,
                        world_position = (Vector3d)apsis.q,
                        velocity       = (Vector3d)apsis.p,
                        source         = source,
                        time           = apsis_iterator.IteratorGetDiscreteTrajectoryTime()
                    };

                    if (pool_index_ == nodes_.Count)
                    {
                        nodes_.Add(MakePoolNode());
                    }
                    else if (properties_[nodes_[pool_index_]].object_type != type ||
                             properties_[nodes_[pool_index_]].source != source)
                    {
                        // KSP attaches labels to its map nodes, but never detaches them.
                        // If the node changes type, we end up with an arbitrary combination of
                        // labels Ap, Pe, AN, DN.
                        // If the node changes source, the colour of the icon label is not
                        // updated to match the icon (making it unreadable in some cases).
                        // Recreating the node entirely takes a long time (approximately
                        // 𝑁 * 70 μs, where 𝑁 is the total number of map nodes in existence),
                        // instead we manually get rid of the labels.
                        foreach (var component in
                                 nodes_[pool_index_].transform.GetComponentsInChildren <
                                     TMPro.TextMeshProUGUI>())
                        {
                            if (component.name == "iconLabel(Clone)")
                            {
                                UnityEngine.Object.Destroy(component.gameObject);
                            }
                        }
                        // Ensure that KSP thinks the type changed, and reattaches icon
                        // labels next time around, otherwise we might end up with no labels.
                        // Null nodes do not have a label, so inducing a type change through
                        // Null does not result in spurious labels.
                        properties_[nodes_[pool_index_]].object_type =
                            MapObject.ObjectType.Null;
                        nodes_[pool_index_].NodeUpdate();
                    }
                    properties_[nodes_[pool_index_++]] = node_properties;
                }
            }
コード例 #3
0
        void AddMenus(NodeSource source)
        {
            source.GetNodeType <FolderNodeType>().States[0].AddMenuDefinitions(removeFolder);

            source.GetNodeType <TagNode>().State("missing_reference").AddMenuDefinitions(copyFromGameArchive, remove);
            source.GetNodeType <TagNode>().State("valid_reference").AddMenuDefinitions(remove, edit, previewTag);
            source.GetNodeType <TagNode>().State("unreferenced").AddMenuDefinitions(include);

            source.GetNodeType <ObjectTag>().State("missing_reference").AddMenuDefinitions(copyFromGameArchive, remove);
            source.GetNodeType <ObjectTag>().State("valid_reference").AddDefaultMenuDefinition(previewTag);
            source.GetNodeType <ObjectTag>().State("valid_reference").AddDefaultMenuDefinition(edit, remove);

            source.GetNodeType <ModelTag>().State("missing_reference").AddMenuDefinitions(copyFromGameArchive, remove);
            source.GetNodeType <ModelTag>().State("valid_reference").AddDefaultMenuDefinition(previewTag);
            source.GetNodeType <ModelTag>().State("valid_reference").AddDefaultMenuDefinition(edit, remove);

            source.GetNodeType <SbspTag>().State("missing_reference").AddMenuDefinitions(copyFromGameArchive, remove);
            source.GetNodeType <SbspTag>().State("valid_reference").AddDefaultMenuDefinition(previewTag);
            source.GetNodeType <SbspTag>().State("valid_reference").AddDefaultMenuDefinition(edit, remove);

            source.GetNodeType <ScenarioTag>().State("missing_reference").AddMenuDefinitions(copyFromGameArchive, remove);
            source.GetNodeType <ScenarioTag>().State("valid_reference").AddDefaultMenuDefinition(previewTag);
            source.GetNodeType <ScenarioTag>().State("valid_reference").AddDefaultMenuDefinition(edit, remove);

            source.GetNodeType <ProjectTemplateTagNodeType>().States[0].AddMenuDefinitions(revertEssentialTag, edit);
            source.GetNodeType <GlobalTemplateTagNodeType>().States[0].AddDefaultMenuDefinition(editGlobal, selectProjectTag);

            source.GetNodeType <RecycleBinRootNodeType>().State("recyclebin_not_empty").AddDefaultMenuDefinition(browseRecycleBin, emptyRecycleBin);

#if DEBUG
            source.AddGlobalMenuDefinition(debugInfo);
#endif
        }
コード例 #4
0
        /// <summary>
        /// Invokes the specified method.
        /// </summary>
        /// <remarks>
        /// Returning non-good results in the argumentErrors list indicates that the call was not processed.
        /// Other types of errors are reported by throwing an exception.
        /// </remarks>
        protected virtual void Call(
            OperationContext context,
            NodeSource target,
            Delegate methodToCall,
            IList <object> inputArguments,
            IList <ServiceResult> argumentErrors,
            IList <object> outputArguments)
        {
            // check for standard handler.
            GenericMethodHandler GenericHandlerToCall = methodToCall as GenericMethodHandler;

            if (GenericHandlerToCall != null)
            {
                GenericHandlerToCall(context, target, inputArguments, argumentErrors, outputArguments);
                return;
            }

            // check for simple handler.
            NoArgumentsMethodHandler SimpleHandlerToCall = methodToCall as NoArgumentsMethodHandler;

            if (SimpleHandlerToCall != null)
            {
                SimpleHandlerToCall(context, target);
                return;
            }

            // subclass may define different handlers.
            throw new ServiceResultException(StatusCodes.BadNotImplemented);
        }
コード例 #5
0
        private void AddTagViewExtractedMenus(NodeSource source)
        {
            source.GetNodeType <FileNodeType>().States[0].AddDefaultMenuDefinition(previewTag);
            source.GetNodeType <FileNodeType>().States[0].AddDefaultMenuDefinition(
                viewTag, addTagToProject, replaceTagInProject);

            source.GetNodeType <ObjectFileNodeType>().States[0].AddDefaultMenuDefinition(previewTag);
            source.GetNodeType <ObjectFileNodeType>().States[0].AddDefaultMenuDefinition(
                viewTag, addTagToProject, replaceTagInProject);

            source.GetNodeType <ModelFileNodeType>().States[0].AddDefaultMenuDefinition(previewTag);
            source.GetNodeType <ModelFileNodeType>().States[0].AddDefaultMenuDefinition(
                viewTag, addTagToProject, replaceTagInProject);

            source.GetNodeType <SbspFileNodeType>().States[0].AddDefaultMenuDefinition(viewTag);
            source.GetNodeType <SbspFileNodeType>().States[0].AddDefaultMenuDefinition(
                previewTag, addTagToProject, replaceTagInProject);

            source.GetNodeType <ScenarioFileNodeType>().States[0].AddDefaultMenuDefinition(previewTag);
            source.GetNodeType <ScenarioFileNodeType>().States[0].AddDefaultMenuDefinition(
                viewTag, addTagToProject, replaceTagInProject);

            source.GetNodeType <FolderNodeType>().States[0].AddMenuDefinitions(addFolderToProject);

            source.GetNodeType <AttachedScriptNodeType>().States[0].AddDefaultMenuDefinition(viewScript);

            AddDebugMenu(source);

            // TODO: Create remaining menu items.
            // Edit Tag for Project
            // Check &Dependencies
        }
コード例 #6
0
ファイル: ObjectSource.cs プロジェクト: fr830/OPCUA.NET
 /// <summary>
 /// Adds the source to the type table.
 /// </summary>
 public ObjectSource(
     IServerInternal server,
     NodeSource parent)
     :
     base(server, parent)
 {
 }
コード例 #7
0
ファイル: map_node_pool.cs プロジェクト: pleroy/Principia
 public Provenance(string vessel_guid,
                   NodeSource source,
                   MapObject.ObjectType type)
 {
     this.vessel_guid = vessel_guid;
     this.source      = source;
     this.type        = type;
 }
コード例 #8
0
ファイル: BaseEvent.cs プロジェクト: neobox3000/UA-.NET
 /// <summary cref="NodeSource.Clone(NodeSource)" />
 public override NodeSource Clone(NodeSource parent)
 {
     lock (DataLock)
     {
         GenericEvent clone = new GenericEvent(Server, parent);
         clone.Initialize(this);
         return(clone);
     }
 }
コード例 #9
0
 /// <summary cref="NodeSource.Clone(NodeSource)" />
 public override NodeSource Clone(NodeSource parent)
 {
     lock (DataLock)
     {
         ObjectTypeSource clone = new ObjectTypeSource(Server);
         clone.Initialize(this);
         return(clone);
     }
 }
コード例 #10
0
ファイル: ObjectSource.cs プロジェクト: fr830/OPCUA.NET
 /// <summary cref="NodeSource.Clone(NodeSource)" />
 public override NodeSource Clone(NodeSource parent)
 {
     lock (DataLock)
     {
         Folder clone = new Folder(Server, parent);
         clone.Initialize(this);
         return(clone);
     }
 }
コード例 #11
0
 /// <summary cref="NodeSource.Clone(NodeSource)" />
 public override NodeSource Clone(NodeSource parent)
 {
     lock (DataLock)
     {
         MethodSource clone = new MethodSource(Server, parent);
         clone.Initialize(this);
         return(clone);
     }
 }
 /// <summary cref="NodeSource.Clone(NodeSource)" />
 public override NodeSource Clone(NodeSource parent)
 {
     lock (DataLock)
     {
         VariableTypeSource <T> clone = new VariableTypeSource <T>(Server);
         clone.Initialize(this);
         return(clone);
     }
 }
コード例 #13
0
ファイル: ObjectSource.cs プロジェクト: fr830/OPCUA.NET
 /// <summary cref="NodeSource.Clone(NodeSource)" />
 public override NodeSource Clone(NodeSource parent)
 {
     lock (DataLock)
     {
         ObjectSource clone = this;
         clone.Initialize(this);
         return(clone);
     }
 }
コード例 #14
0
        private void AddObjectViewExtractedMenus(NodeSource source)
        {
            source.GetNodeType <HLTNodeType>().States[0].AddDefaultMenuDefinition(
                viewTag, previewTag, addTagToProject, replaceTagInProject);

            source.GetNodeType <TagNodeType>().States[0].AddDefaultMenuDefinition(
                viewTag, previewTag, addTagToProject, replaceTagInProject);

            AddDebugMenu(source);
        }
コード例 #15
0
        private void AddNode(LineFS lineFs, string ip, string port, string hostName, NodeSource nodeSource, NetworkMessageInfo source, string sourceType = null)
        {
            if (_file.Start > _file.End)
            {
                throw new DateTimeExt.InvalidDateRangeException();
            }

            var node = new Node
            {
                Ip          = ip,
                Port        = port,
                Host        = hostName,
                iLine       = lineFs.iLine,
                Source      = nodeSource,
                SourceStart = _file.Start,
                SourceEnd   = _file.End
            };
            // Check if the Node already exists
            var found =
                Network.Nodes.Any(
                    n => n.Ip == node.Ip && n.Host == node.Host);

            if (found)
            {
                return;
            }

            if (sourceType == null)
            {
                var results = NetworkMapService.GetNetworkMapFiles(lineFs.Text, source);

                switch (results.Count)
                {
                case 0:
                    node.SourceType = Keywords.NO_FILE;
                    break;

                case 1:
                    node.SourceType = results[0].File.SourceType;
                    break;

                default:
                    node.SourceType = "Multiple Files";
                    break;
                }
            }
            else
            {
                node.SourceType = sourceType;
            }

            // Here we would need to find the target file to determine Source Type
            Network.Nodes.Add(node);
        }
コード例 #16
0
        /// <summary cref="NodeSource.Initialize(NodeSource)" />
        public override void Initialize(NodeSource source)
        {
            lock (DataLock)
            {
                base.Initialize(source);

                ObjectTypeSource type = (ObjectTypeSource)source;

                m_isAbstract = type.m_isAbstract;
            }
        }
コード例 #17
0
ファイル: ObjectSource.cs プロジェクト: fr830/OPCUA.NET
        /// <summary cref="NodeSource.Initialize(NodeSource)" />
        public override void Initialize(NodeSource source)
        {
            lock (DataLock)
            {
                base.Initialize(source);

                ObjectSource instance = (ObjectSource)source;

                m_eventNotifier = instance.m_eventNotifier;
            }
        }
コード例 #18
0
        /// <summary>
        /// Handles the GetWheels test method.
        /// </summary>
        public Wheel[] OnGetWheels(OperationContext context, NodeSource target, Vehicle vehicle)
        {
            GenericEvent e = GenericEvent.Construct(Server, new NodeId(ObjectTypes.MaintenanceEventType, GetNamespaceIndex(Namespaces.Sample)));

            e.InitializeNewEvent();
            e.Message.Value = "Some unknown problem.";
            e.SetProperty(new QualifiedName(BrowseNames.MustCompleteByDate, GetNamespaceIndex(Namespaces.Sample)), new DateTime(1987, 2, 3));

            ReportEvent(e);

            return(vehicle.Wheels.ToArray());
        }
コード例 #19
0
        /// <summary cref="NodeSource.Initialize(NodeSource)" />
        public override void Initialize(NodeSource source)
        {
            lock (DataLock)
            {
                base.Initialize(source);

                MethodSource method = (MethodSource)source;

                m_arguments      = method.m_arguments;
                m_executable     = method.m_executable;
                m_userExecutable = method.m_userExecutable;
            }
        }
コード例 #20
0
ファイル: ObjectSource.cs プロジェクト: fr830/OPCUA.NET
        /// <summary>
        /// Creates a new instance of the node.
        /// </summary>
        public static ObjectSource Construct(
            IServerInternal server,
            NodeSource parent,
            NodeId referenceTypeId,
            NodeId nodeId,
            QualifiedName browseName,
            uint numericId)
        {
            ObjectSource instance = new ObjectSource(server, parent);

            instance.Initialize(referenceTypeId, nodeId, browseName, numericId, ObjectTypes.BaseObjectType);
            return(instance);
        }
コード例 #21
0
        /// <summary>
        /// Creates a new instance of the node.
        /// </summary>
        public static MethodSource Construct(
            IServerInternal server,
            NodeSource parent,
            NodeId referenceTypeId,
            NodeId nodeId,
            QualifiedName browseName,
            uint numericId)
        {
            MethodSource instance = new MethodSource(server, parent);

            instance.Initialize(referenceTypeId, nodeId, browseName, numericId, null);
            return(instance);
        }
        /// <summary cref="NodeSource.Initialize(NodeSource)" />
        public override void Initialize(NodeSource source)
        {
            lock (DataLock)
            {
                base.Initialize(source);

                VariableTypeSource <T> type = (VariableTypeSource <T>)source;

                m_value           = (T)Utils.Clone(type.m_value);
                m_datatype        = type.m_datatype;
                m_valueRank       = type.m_valueRank;
                m_arrayDimensions = (IList <uint>)Utils.Clone(type.m_arrayDimensions);
                m_isAbstract      = type.m_isAbstract;
            }
        }
コード例 #23
0
        /// <summary>
        /// Finds the parent that has the specified type.
        /// </summary>
        protected NodeSource FindContainer(Type containerType)
        {
            NodeSource parent = this.Parent;

            while (parent != null)
            {
                if (containerType.IsInstanceOfType(parent))
                {
                    return(parent);
                }

                parent = parent.Parent;
            }

            return(null);
        }
コード例 #24
0
        /// <summary>
        /// A delegate used to receive notifications when the method is called.
        /// </summary>
        private string OnCalibrateFlowTransmitter(
            OperationContext context,
            NodeSource target,
            double scanRate,
            double duration)
        {
            lock (DataLock)
            {
                AcmeFlowTransmitter flowTransmitter = target as AcmeFlowTransmitter;

                if (flowTransmitter != null)
                {
                    flowTransmitter.CalibrationParameters.Value = new double[] { scanRate, duration };
                }

                return(String.Format("Calibration completed at {0}", DateTime.UtcNow));
            }
        }
コード例 #25
0
        /// <summary>
        /// Associates an object id with a callback.
        /// </summary>
        public void SetCallback(NodeSource target, Delegate callback)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            lock (DataLock)
            {
                if (callback != null)
                {
                    m_callbacks[target.NodeId] = new CallbackParameters(target, callback);
                }
                else
                {
                    m_callbacks.Remove(target.NodeId);
                }
            }
        }
コード例 #26
0
        /// <summary>
        /// Calls the method with no arguments.
        /// </summary>
        public void Call(OperationContext context, NodeSource target)
        {
            List <object>        inputArguments  = new List <object>();
            List <ServiceResult> argumentErrors  = new List <ServiceResult>();
            List <object>        outputArguments = new List <object>();

            ServiceResult result = Call(
                context,
                NodeId,
                null,
                target.NodeId,
                inputArguments,
                argumentErrors,
                outputArguments);

            if (ServiceResult.IsBad(result))
            {
                throw new ServiceResultException(result);
            }
        }
コード例 #27
0
        /// <summary>
        /// Handles a call.
        /// </summary>
        protected override void Call(
            OperationContext context,
            NodeSource target,
            Delegate methodToCall,
            IList <object> inputArguments,
            IList <ServiceResult> argumentErrors,
            IList <object> outputArguments)
        {
            NodeId        parentId        = (NodeId)inputArguments[0];
            NodeId        referenceTypeId = (NodeId)inputArguments[1];
            QualifiedName browseName      = (QualifiedName)inputArguments[2];
            NodeId        nodeId          = null;

            MethodCallHandler handler = methodToCall as MethodCallHandler;

            if (handler != null)
            {
                handler(context, target, parentId, referenceTypeId, browseName, out nodeId);
                return;
            }

            base.Call(context, target, methodToCall, inputArguments, argumentErrors, outputArguments);
        }
コード例 #28
0
ファイル: map_node_pool.cs プロジェクト: Norgg/Principia
            public void RenderAndDeleteApsides(IntPtr apsis_iterator,
                                               CelestialBody celestial,
                                               MapObject.ObjectType type,
                                               NodeSource source)
            {
                for (; !apsis_iterator.IteratorAtEnd();
                     apsis_iterator.IteratorIncrement())
                {
                    Vector3d          apsis = (Vector3d)apsis_iterator.IteratorGetXYZ();
                    MapNodeProperties node_properties;
                    node_properties.object_type    = type;
                    node_properties.celestial      = celestial;
                    node_properties.world_position = apsis;
                    node_properties.source         = source;

                    if (pool_index_ == nodes_.Count)
                    {
                        UnityEngine.Debug.LogWarning("Adding node to pool");
                        AddMapNodeToPool();
                    }
                    properties_[nodes_[pool_index_++]] = node_properties;
                }
                Interface.IteratorDelete(ref apsis_iterator);
            }
コード例 #29
0
            public void RenderMarkers(DisposableIterator apsis_iterator,
                                      MapObject.ObjectType type,
                                      NodeSource source,
                                      ReferenceFrameSelector reference_frame)
            {
                MapObject associated_map_object;

                UnityEngine.Color colour;
                switch (type)
                {
                case MapObject.ObjectType.Apoapsis:
                case MapObject.ObjectType.Periapsis:
                    CelestialBody fixed_body = reference_frame.selected_celestial;
                    associated_map_object = fixed_body.MapObject;
                    colour = fixed_body.orbit == null
              ? XKCDColors.SunshineYellow
              : fixed_body.orbitDriver.Renderer.nodeColor;
                    break;

                case MapObject.ObjectType.ApproachIntersect:
                    associated_map_object = reference_frame.target_override.mapObject;
                    colour = XKCDColors.Chartreuse;
                    break;

                case MapObject.ObjectType.AscendingNode:
                case MapObject.ObjectType.DescendingNode:
                    if (!reference_frame.target_override &&
                        (reference_frame.frame_type ==
                         ReferenceFrameSelector.FrameType.BODY_CENTRED_NON_ROTATING ||
                         reference_frame.frame_type ==
                         ReferenceFrameSelector.FrameType.BODY_SURFACE))
                    {
                        // In one-body frames, the apsides are shown with the colour of the
                        // body.
                        // The nodes are with respect to the equator, rather than with respect
                        // to an orbit. We show the nodes in a different (but arbitrary)
                        // colour so that they can be distinguished easily.
                        associated_map_object = reference_frame.selected_celestial.MapObject;
                        colour = XKCDColors.Chartreuse;
                    }
                    else
                    {
                        // In two-body frames, if apsides are shown, they are shown with the
                        // colour of the secondary (or in XKCD chartreuse if the secondary is
                        // a vessel).
                        // The nodes are with respect to the orbit of the secondary around the
                        // primary. We show the nodes with the colour of the primary.
                        CelestialBody primary = reference_frame.target_override
              ? reference_frame.selected_celestial
              : reference_frame.selected_celestial.referenceBody;
                        associated_map_object = primary.MapObject;
                        colour = primary.orbit == null
              ? XKCDColors.SunshineYellow
              : primary.orbitDriver.Renderer.nodeColor;
                    }
                    break;

                default:
                    throw Log.Fatal($"Unexpected type {type}");
                }
                colour.a = 1;

                for (int i = 0; i < MaxRenderedNodes && !apsis_iterator.IteratorAtEnd();
                     ++i, apsis_iterator.IteratorIncrement())
                {
                    QP apsis = apsis_iterator.IteratorGetDiscreteTrajectoryQP();
                    MapNodeProperties node_properties = new MapNodeProperties {
                        visible               = true,
                        object_type           = type,
                        colour                = colour,
                        reference_frame       = reference_frame,
                        world_position        = (Vector3d)apsis.q,
                        velocity              = (Vector3d)apsis.p,
                        source                = source,
                        time                  = apsis_iterator.IteratorGetDiscreteTrajectoryTime(),
                        associated_map_object = associated_map_object,
                    };
                    if (type == MapObject.ObjectType.Periapsis &&
                        reference_frame.selected_celestial.GetAltitude(
                            node_properties.world_position) < 0)
                    {
                        node_properties.object_type = MapObject.ObjectType.PatchTransition;
                        node_properties.colour      = XKCDColors.Orange;
                    }

                    if (pool_index_ == nodes_.Count)
                    {
                        nodes_.Add(MakePoolNode());
                    }
                    else if (properties_[nodes_[pool_index_]].object_type !=
                             node_properties.object_type ||
                             properties_[nodes_[pool_index_]].colour !=
                             node_properties.colour)
                    {
                        // KSP attaches labels to its map nodes, but never detaches them.
                        // If the node changes type, we end up with an arbitrary combination of
                        // labels Ap, Pe, AN, DN.
                        // Similarly, if the node changes colour, the colour of the icon label
                        // is not updated to match the icon (making it unreadable in some
                        // cases).  Recreating the node entirely takes a long time
                        // (approximately 𝑁 * 70 μs, where 𝑁 is the total number of map nodes
                        // in existence), instead we manually get rid of the labels.
                        foreach (var component in
                                 nodes_[pool_index_].transform.GetComponentsInChildren <
                                     TMPro.TextMeshProUGUI>())
                        {
                            if (component.name == "iconLabel(Clone)")
                            {
                                UnityEngine.Object.Destroy(component.gameObject);
                            }
                        }
                        // Ensure that KSP thinks the type changed, and reattaches icon
                        // labels next time around, otherwise we might end up with no labels.
                        // Null nodes do not have a label, so inducing a type change through
                        // Null does not result in spurious labels.  Note that the type is
                        // updated only if the node is visible.
                        properties_[nodes_[pool_index_]].visible     = true;
                        properties_[nodes_[pool_index_]].object_type =
                            MapObject.ObjectType.Null;
                        nodes_[pool_index_].NodeUpdate();
                    }
                    properties_[nodes_[pool_index_++]] = node_properties;
                }
            }
コード例 #30
0
 /// <summary>
 /// Initializes the object with default values.
 /// </summary>
 public MethodSource(IServerInternal server, NodeSource parent) : base(server, parent)
 {
     m_arguments  = new MethodArguments();
     m_callbacks  = new Dictionary <NodeId, CallbackParameters>();
     m_executable = m_userExecutable = true;
 }