Beispiel #1
0
        private static void GenerateOptions()
        {
            //Get a list of all available projections
            Type[] types = typeof(Projection).Assembly.GetTypes();
            optionValues = (from Type type in types where (type.IsSubclassOf(typeof(Projection)) && !type.IsAbstract) select type).ToArray();

            //Get a list of titles for all available projections
            options = new string[optionValues.Length];
            for (int i = 0; i < optionValues.Length; i++)
            {
                Type type = optionValues[i];
                while (type != typeof(Projection))
                {
                    if (options[i] == null)
                    {
                        options[i] = LlockhamEditorUtility.AddSpacesToType(type.Name);
                    }
                    else
                    {
                        options[i] = LlockhamEditorUtility.AddSpacesToType(type.Name) + "/" + options[i];
                    }
                    type = type.BaseType;
                }
            }
        }
Beispiel #2
0
        private bool DrawProjection(Rect Rect, string Name, string Type)
        {
            //Draw Rect
            EditorGUI.DrawRect(Rect, LlockhamEditorUtility.ForegroundColor);

            //Draw Labels
            EditorGUI.LabelField(new Rect(Rect.x, Rect.y, Rect.width / 2, Rect.height), Name);
            EditorGUI.LabelField(new Rect(Rect.x + (Rect.width / 2), Rect.y, Rect.width / 2, Rect.height), LlockhamEditorUtility.AddSpacesToType(Type));

            if (Event.current.type == EventType.MouseDown && Event.current.button == 0 && Rect.Contains(Event.current.mousePosition))
            {
                Event.current.Use();
                return(true);
            }
            else
            {
                return(false);
            }
        }