Beispiel #1
0
    private void DisplayPropertiesGUI()
    {
        Rect addProps   = o(inspectorRect, 10, 70, inspectorRect.width - 30, 20);
        Rect clearProps = yo(addProps, 0, 0, inspectorRect.width - 30, 20);

        if (GUI.Button(addProps, "Add Property"))
        {
            properties.Add(properties.keys.Count.ToString(), 0);
//			Debug.Log ("GETTING CLIKED?");
        }

        if (GUI.Button(clearProps, "Clear Property"))
        {
            properties.ClearValues();
        }

        Vector2 pos = yo(clearProps, 0, 20, 0, 0).position;

        //Draw properties
        for (int i = 0; i < properties.keys.Count; i++)
        {
            Rect myRect = r(pos.x, pos.y + (75 * i) + 5 * i, inspectorRect.width - 30, 75);
            GUI.Box(myRect, "");

            Rect propertyName = o(myRect, 5, 5, myRect.width - 10, 20);
            Rect floatValue   = yo(propertyName, 0, 5, myRect.width - 10, 20);
            Rect boolValue    = yo(floatValue, 0, 5, 20, 20);
            Rect destroy      = xo(boolValue, 30, 0, 100, 20);

            //string s = properties.keys[i];
            properties.locked = EditorGUI.Toggle(boolValue, properties.locked);
            if (properties.locked == false)
            {
                properties.keys [i] = GUI.TextField(propertyName, properties.keys [i]);
                //float v = properties.values[i];
                properties.values [i] = EditorGUI.FloatField(floatValue, properties.values [i]);

                if (GUI.Button(destroy, "Remove"))
                {
                    properties.RemoveValue(properties.keys [i]);
                }
            }
            else
            {
                GUI.Label(propertyName, "KEY : " + properties.keys [i]);
                GUI.Label(floatValue, "VAL : " + properties.values [i]);
            }

            //properties.SetValue (s, v);
        }


        finalScroll.height   = 130 + (75 * properties.keys.Count) + 5 * properties.keys.Count + 75;
        finalScroll.position = inspectorRect.position;
        GUI.EndScrollView();
    }