public Hash(ChainNodeView nodeView, Dictionary <ChainNode, ChainNodeView> nodesToViews, int remainingDepth = RELATIVES_DEPTH, bool descendNodes = true) { LocalHash(nodeView); if (remainingDepth <= 0) { return; } if (descendNodes) { foreach ( var subState in (from s in nodeView.ChainNode.Router.SelectionStatesEnumerable select s)) { foreach (var childNode in subState) { if (!nodesToViews.ContainsKey(childNode)) { continue; } //Debug.LogError( "Node not found in node to nodeView correlative dictionary." ); RelativesHashes.Add( new StateHashPair(new Hash(nodesToViews[childNode], nodesToViews, remainingDepth - 1, descendNodes), subState.Name)); } } } else { if (StateRouter.NodeParents.ContainsKey(nodeView.ChainNode) && nodesToViews.ContainsKey(StateRouter.NodeParents[nodeView.ChainNode].Node)) { RelativesHashes.Add(new StateHashPair( new Hash( nodesToViews[StateRouter.NodeParents[nodeView.ChainNode].Node], nodesToViews, remainingDepth - 1, descendNodes), "parent")); } } }
public static void Enqueue(ChainNodeView cnv) { Instance.nodesToUpdate.Enqueue(cnv); }
//public Hash(ChainNodeView nodeView) //{ // LocalHash(nodeView); // //DescendentHash = HashingUtil.StringToMd5Hash( ) //} private void LocalHash(ChainNodeView nodeView) { TypeHash = HashingUtil.StringToMd5Hash(nodeView.ChainNode.GetType().ToString()); PositionHash = HashingUtil.StringToMd5Hash(nodeView.ViewModel.Position.ToString()); }