protected void OnGUI() { using (new GUILayout.HorizontalScope(GUI.skin.box, GUILayout.ExpandWidth(true))) { if (guiComponents != null) { using (GUIScope.ChangeCheck) { idComponent = GUILayout.SelectionGrid(idComponent, guiComponents, 1, GUILayout.Width(200)); if (GUI.changed) { xpcfComponent = xpcfComponents[idComponent]; /* * foreach (var uuid in xpcfComponent.getInterfaces()) * { * Debug.Log(xpcfComponent.getDescription(uuid)); * //var metadata = xpcfManager.findInterfaceMetadata(uuid); * //Debug.Log(metadata.name()); * //Debug.Log(metadata.description()); * } */ /* * xpcfInterfaces = xpcfComponent.getInterfaces().ToArray(); * guiInterfaces = xpcfInterfaces * .Select(xpcfComponent.getDescription) * .Select(s => new GUIContent("", s)) * .ToArray(); */ xpcfConfigurable = xpcfComponent.implements(configurableUUID) ? xpcfComponent.BindTo <IConfigurable>() : null; } } } /* * if (guiInterfaces != null) * { * using (GUITools.ChangeCheckScope) * { * idInterface = GUILayout.SelectionGrid(idInterface, guiInterfaces, 1); * if (GUI.changed) * { * var uuid = xpcfInterfaces[idInterface]; * * //var xpcfInstance = xpcfComponent.bindTo(""); * guiInterfaces = xpcfComponent.getInterfaces() * .Select(xpcfComponent.getDescription) * .Select(s => new GUIContent("", s)) * .ToArray(); * } * } * } */ if (xpcfConfigurable == null) { GUILayout.Label("This component is not IConfigurable"); } else { using (new GUILayout.VerticalScope(GUI.skin.box)) { foreach (var p in xpcfConfigurable.getProperties()) { var access = p.getAccessSpecifier(); var type = p.getType(); object value = access.CanRead() ? p.Get() : type.Default(); using (new GUILayout.HorizontalScope()) { GUILayout.Label(p.getName(), GUILayout.Width(200)); using (GUIScope.ChangeCheck) { value = type.OnGUI(value); if (access.CanWrite() && GUI.changed) { p.Set(value); } } } } } } } }