Exemple #1
0
        private void UpdateExistingNodeGoData(GameObject nodeExistingGo, CdmNodeBtc nodeNewBtc)
        {
            GraphNodeBrain gnb = nodeExistingGo.GetComponent <GraphNodeBrain>();

            if (gnb != null)
            {
                gnb.CdmNodeBtc  = nodeNewBtc;
                gnb.NodeType    = nodeNewBtc.NodeType;
                gnb.ValueMBtc   = nodeNewBtc.FinalBalance;
                gnb.TotalEdges  = nodeNewBtc.NodeEdgeCountTotal;
                gnb.Id          = nodeNewBtc.NodeId;
                gnb.TxDate      = nodeNewBtc.CreateDate;
                gnb.BlockHeight = nodeNewBtc.BlockHeight;
                gnb.RelayedBy   = nodeNewBtc.RelayedBy;

                // Special case for first ever created node
                if (!GlobalData.Instance.FirstNodeCreatedYet)
                {
                    GlobalData.Instance.FirstNodeCreatedYet = true;
                    gnb.SetFirstEverCreated();
                }

                // Update UI text els with the new GraphNodeBrain values
                gnb.RefreshUI();
            }
        }
Exemple #2
0
        private void DoSprout()
        {
            if (_nodeFolder == null)
            {
                return;
            }

            bool didSproutHappen = false;

            foreach (Transform child in _nodeFolder.transform)
            {
                // might be a node, might be an edge
                GraphNodeBrain gnb = child.GetComponent <GraphNodeBrain>();
                if (gnb != null)
                {
                    if (gnb.IsSproutable(AutoSproutDepth, EnoughEdges))
                    {
                        // trigger a tap/click on the node
                        gnb.OnGazeTrigger();
                        didSproutHappen = true;
                        break;
                    }
                }
            }

            if (!didSproutHappen)
            {
                // We are done, can switch off sprouting
                Msg.Log("GraphFactorySprout is switching itself off, there are no sproutable nodes left.");
                IsAutoGrowActive = false;
            }
        }
Exemple #3
0
        private static void UpdateLinkCountersOnSourceAndTarget(GameObject source, GameObject target)
        {
            // update link counters on source and target
            GraphNodeBrain gnbSource = source.GetComponent <GraphNodeBrain>();
            GraphNodeBrain gnbTarget = target.GetComponent <GraphNodeBrain>();

            if (gnbSource != null)
            {
                gnbSource.CurrentLinksIncrement();
            }
            if (gnbTarget != null)
            {
                gnbTarget.CurrentLinksIncrement();
            }
        }