private void ApplyComponentSelector(ModuleWalkCallback visitor, XmlNode node, UIComponent component) { var name = XmlUtil.GetStringAttribute(node, "name"); bool regex = XmlUtil.TryGetBoolAttribute(node, "name_regex"); bool recursive = XmlUtil.TryGetBoolAttribute(node, "recursive"); bool optional = XmlUtil.TryGetBoolAttribute(node, "optional"); var childComponents = Util.FindComponentsInChildren(node, component, name, regex, recursive, optional); var hash = XmlUtil.TryGetStringAttribute(node, "hash", null); foreach (var childComponent in childComponents) { if (hash != null) { var componentHash = HashUtil.HashToString( HashUtil.HashRect(new Rect(childComponent.relativePosition.x, childComponent.relativePosition.y, childComponent.size.x, childComponent.size.y))); if (Regex.IsMatch(componentHash, hash)) { WalkModuleInternalRecursive(visitor, node, childComponent); break; } continue; } WalkModuleInternalRecursive(visitor, node, childComponent); } }
void DoInfoWindow(int i) { GUILayout.Label(String.Format("name: {0}", hoveredComponent.name)); GUILayout.Label(String.Format("type: {0}", hoveredComponent.GetType().Name)); if (hoveredComponent.parent != null) { GUILayout.Label(String.Format("parent: {0}", hoveredComponent.parent.name)); } GUILayout.Label(String.Format("anchor: {0}", hoveredComponent.anchor)); GUILayout.Label(String.Format("size: {0}", hoveredComponent.size)); GUILayout.Label(String.Format("relativePosition: {0}", hoveredComponent.relativePosition)); var hash = HashUtil.HashRect(new Rect(hoveredComponent.relativePosition.x, hoveredComponent.relativePosition.y, hoveredComponent.size.x, hoveredComponent.size.y)); GUILayout.Label(String.Format("hash: {0}", HashUtil.HashToString(hash))); }