Example #1
0
        public void RemoveNodeDelegate(INodeDelegate nodeDelegate)
        {
            bool successful = this._nodeDelegates.Remove(nodeDelegate);

            if (!successful)
            {
                Debug.LogError("Node - RemoveNodeDelegate called with node delegate not found!");
            }
        }
        private void AddNodeDelegateToNode(object tupleAsObject)
        {
            Tuple <Node, Type> data = tupleAsObject as Tuple <Node, Type>;
            Node node = data.Item1;
            Type type = data.Item2;

            INodeDelegate nodeDelegate = Activator.CreateInstance(type) as INodeDelegate;

            if (nodeDelegate == null)
            {
                Debug.LogError("AddNodeDelegateToNode - Failed to cast created type as INodeDelgate!");
                return;
            }

            node.AddNodeDelegate(nodeDelegate);
            this.SetTargetDirty();
        }
Example #3
0
        // PRAGMA MARK - ISerializationCallbackReceiver Implementation
        public void OnAfterDeserialize()
        {
            if (this._nodeDelegates == null)
            {
                this._nodeDelegates = new List <INodeDelegate>();
            }
            else
            {
                this._nodeDelegates.Clear();
            }

            foreach (string serializedNodeDelegate in this._serializedNodeDelegates)
            {
                INodeDelegate nodeDelegate = JsonSerialization.DeserializeGeneric <INodeDelegate>(serializedNodeDelegate);
                if (nodeDelegate != null)
                {
                    this._nodeDelegates.Add(nodeDelegate);
                }
            }
        }
Example #4
0
 public void AddNodeDelegate(INodeDelegate nodeDelegate)
 {
     this._nodeDelegates.Add(nodeDelegate);
 }