Beispiel #1
0
	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);
	}