示例#1
0
        void IGraphFactory.CreateOrUpdateNode(CdmNode nodeNew, Vector3 location)
        {
            CdmNodeBtc nodeNewBtc = nodeNew as CdmNodeBtc;

            // Do we exist already?
            GameObject nodeExistingGo;

            if (_graphIndex.TryGetValue(nodeNewBtc.NodeId, out nodeExistingGo))
            {
                UpdateExistingNodeGoData(nodeExistingGo, nodeNewBtc);

                Msg.Log("GraphFactory.CreateOrUpdateNode: Node refreshed: " + nodeExistingGo.gameObject.name + " at " + nodeExistingGo.gameObject.transform.position);

                return;
            }

            GameObject nodeCreated = null;
            Vector3    createPos   = GetRandomPosNear(location);

            //Msg.LogWarning("created near:" + location);

            nodeCreated = InstantiateNode(createPos, nodeNewBtc.NodeType);

            if (nodeCreated != null)
            {
                GraphNodePhysics nodeNode = nodeCreated.GetComponent <GraphNodePhysics>();
                nodeNode.name = nodeNewBtc.NodeId;
                nodeNode.Text = name;

                UpdateExistingNodeGoData(nodeCreated, nodeNewBtc);

                Msg.Log("GraphFactory.CreateOrUpdateNode: Node created: " + nodeCreated.gameObject.name + " at " + nodeCreated.gameObject.transform.position);
                _graphIndex.Add(nodeNewBtc.NodeId, nodeCreated);
            }
            else
            {
                Msg.LogWarning("GraphFactory.CreateOrUpdateNode: Something went wrong, no node created.");
                return;
            }
        }
示例#2
0
 void IGraphFactory.CreateOrUpdateNode(CdmNode nodeNew, Vector3 location)
 {
     // nodeNew contains all the interesting data about a node (an address or a transaction)
     Debug.Log("Node received: " + nodeNew.NodeType + " " + nodeNew.NodeId + " to be created near: " + location);
 }