protected bool TryFindMatchingNode <T>(Attribute[] attribs, T interfaceRef, out InputNode node) { node = null; InputNode [] nodes = InputSystem.Instance.FindNodesMatchingCriteria(new Type[] { Utils.GetTypeFromRef(interfaceRef) }, attribs); if (nodes.Length > 0) { node = nodes[0]; return(true); } return(false); }
protected bool TryFindMatchingNode(Attribute[] attribs, Type[] interfaces, out InputNode node) { node = null; InputNode[] nodes = InputSystem.Instance.FindNodesMatchingCriteria(interfaces, attribs); if (nodes.Length > 0) { node = nodes[0]; return(true); } return(false); }
/// <summary> /// Checks if the provided node implements all interfaces from the provided list /// </summary> /// <param name="node">Node to check</param> /// <param name="interfaces">list of interfaces</param> /// <returns>true: if node implements all interfaces from the list; /// false: if node does not inplement all interfaces from the list</returns> //public static bool ImplementsInterfaces(InputNode node, string [] interfaces) //{ // return node.ImplementsInterfaces(interfaces); //} //public static bool IsMathingCriteria(InputNode node, string[] implementedInterfaces, Attribute[] attributes) //{ // return node.MatchesCriteria(implementedInterfaces, attributes); //} //public static string[] FindImplementedInterfaces(InputNode node, string[] interfaces) //{ // return node.FindImplementedInterfaces(interfaces); //} /// <summary> /// Gets array of input nodes that implement all specified interfaces /// </summary> /// <param name="interfaces">array of interfaces in string format</param> /// <returns>Array of interfaces implementing specified set of interfaces</returns> public InputNode[] GetInputNodes(string[] interfaces) { List <InputNode> result = new List <InputNode>(); for (int i = 0; i < m_Nodes.Count; ++i) { InputNode temp = m_Nodes[i]; if (temp.ImplementsInterfaces(interfaces)) { result.Add(temp); } } return(result.ToArray()); }
protected bool AddInputNode(InputNode node) { if (node.IsInUse) { throw new Exception("Node already in use"); } if (m_InputNodes.Contains(node)) { return(false); } else { node.OnEngaged(); m_InputNodes.Add(node); } return(true); }
public void RegisterNode(InputNode node) { m_Nodes.Add(node); node.OnRegister(); }