private static bool DrawBlock(OpenCog.BlockSet.BaseBlockSet.OCBlock block, bool selected) { UnityEngine.Rect rect = GUILayoutUtility.GetAspectRect(1f); if(selected) GUI.Box(rect, GUIContent.none); UnityEngine.Vector3 center = rect.center; rect.width -= 8; rect.height -= 8; rect.center = center; if(block != null) return block.DrawPreview(rect); return false; }
private static bool DrawItem(OpenCog.BlockSet.BaseBlockSet.OCBlock block, bool selected) { Rect position = GUILayoutUtility.GetRect(0, 40, GUILayout.ExpandWidth(true)); if(selected) GUI.Box(position, GUIContent.none); GUIStyle labelStyle = new GUIStyle(GUI.skin.label); labelStyle.alignment = TextAnchor.MiddleLeft; Rect texRect = new Rect(position.x+4, position.y+4, position.height-8, position.height-8); block.DrawPreview(texRect); Rect labelRect = position; labelRect.xMin = texRect.xMax+4; GUI.Label(labelRect, block.GetName(), labelStyle); return Event.current.type == EventType.MouseDown && Event.current.button == 0 && position.Contains(Event.current.mousePosition); }