예제 #1
0
    void PopupInspector()
    {
        EditorGUILayout.Space();
        ArcadiaBehaviour ab = (ArcadiaBehaviour)target;

        rl.DoLayoutList();
        //	if (ab.serializedVar != null)
        //	{
        //		// var, show popup
        //		var loadedNamespaces = (ISeq)allLoadedUserNamespacesFn.invoke();
        //		if (loadedNamespaces.count() == 0)
        //			return;
        //		Namespace[] namespaces = (Namespace[])intoArrayFn.invoke(loadedNamespaces);
        //		var fullyQualifiedVars = namespaces.
        //		SelectMany(ns => ns.getMappings().
        //		  Select((IMapEntry me) => me.val()).
        //		  Where(v => v.GetType() == typeof(Var) &&
        //		   ((Var)v).Namespace == ns).
        //		  Select(v => v.ToString().Substring(2)));

        //		string[] blank = new string[] { "" };
        //		string[] popUpItems = blank.Concat(fullyQualifiedVars).ToArray();

        //		int selectedVar = Array.IndexOf(popUpItems, ab.serializedVar);
        //		if (selectedVar < 0) selectedVar = 0;
        //		selectedVar = EditorGUILayout.Popup("Function", selectedVar, popUpItems);

        //		ab.serializedVar = popUpItems[selectedVar];
        //		ab.OnAfterDeserialize();
        //	}
        //	else {
        //		EditorGUILayout.LabelField("Function", ab.fn == null ? "nil" : ab.fn.ToString());

        //	}
    }
예제 #2
0
 void OnEnable()
 {
     ArcadiaBehaviour ab = (ArcadiaBehaviour)target;
     //if (rl == null)
     //{
     //	rl = new ReorderableList(ab.fns, typeof(IFn), true, false, true, true);
     //	rl.headerHeight = 4;
     //	rl.onAddDropdownCallback = (buttonRect, list) =>
     //	{
     //		EditorGUI.Popup(buttonRect, 0, ((IList<object>)allUserFns.invoke()).Select(x => x.ToString().Substring(2)).ToArray());
     //	};
     //}
 }
예제 #3
0
    public override void OnInspectorGUI()
    {
        // var inspectorConfig = ClojureConfiguration.Get("editor", "hooks-inspector");

        // EditorGUILayout.LabelField("Disabled For Now, use the REPL");

        ArcadiaBehaviour ab = (ArcadiaBehaviour)target;
        //var fns = ab.fns;
        //var keys = ab.keys;
        var ifns = ab.ifnInfos;

        if (ifns.Length == 0)
        {
            EditorGUILayout.LabelField("No functions");
        }
        else
        {
            for (int i = 0; i < ifns.Length; i++)
            {
                var ifn = ifns[i];
                Var v   = ifn.fn as Var;
                if (v != null && v.isBound)
                {
                    EditorGUILayout.LabelField(ifn.key.ToString() + ": " + v.ToString());
                }
                else
                {
                    GUIStyle style = new GUIStyle(GUI.skin.label);
                    style.normal.textColor = Color.red;
                    EditorGUILayout.LabelField(ifn.key.ToString() + ": " + ifn.fn.ToString(), style);
                }
            }
        }

        // PopupInspector();

        /*
         * if(inspectorConfig == Keyword.intern(null, "popup")) {
         * PopupInspector();
         * } else if(inspectorConfig == Keyword.intern(null, "text")) {
         * TextInspector();
         * } else {
         * EditorGUILayout.HelpBox("Invalid value for :editor/hooks-inspector in configuration file." +
         *                                                "Expected :text or :drop-down, got " + inspectorConfig.ToString() +
         *                                                ". Showing text inspector.", MessageType.Warning);
         * TextInspector();
         * }
         */
    }
예제 #4
0
    public override void OnInspectorGUI()
    {
        ArcadiaBehaviour ab = (ArcadiaBehaviour)target;
        var ifns            = ab.ifnInfos;

        if (ifns.Length == 0)
        {
            EditorGUILayout.LabelField("No functions");
        }
        else
        {
            for (int i = 0; i < ifns.Length; i++)
            {
                var ifn       = ifns[i];
                Var v         = ifn.fn as Var;
                var boldStyle = new GUIStyle(EditorStyles.label);
                boldStyle.font = EditorStyles.boldFont;
                var redStyle = new GUIStyle(boldStyle);
                redStyle.normal.textColor = Color.red;
                if (v != null)
                {
                    if (v.isBound)
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.PrefixLabel(ifn.key.ToString(), EditorStyles.label, boldStyle);
                        EditorGUILayout.LabelField(v.ToString());
                        EditorGUILayout.EndHorizontal();
                    }
                    else
                    {
                        EditorGUILayout.BeginHorizontal();
                        EditorGUILayout.PrefixLabel(ifn.key.ToString(), EditorStyles.label, redStyle);
                        EditorGUILayout.LabelField(v.ToString());
                        EditorGUILayout.EndHorizontal();
                    }
                }
                else
                {
                    EditorGUILayout.BeginHorizontal();
                    EditorGUILayout.PrefixLabel(ifn.key.ToString(), EditorStyles.label, boldStyle);
                    EditorGUILayout.LabelField(ifn.fn.ToString());
                    EditorGUILayout.EndHorizontal();
                }
            }
        }

        EditorGUILayout.Space();
    }