コード例 #1
0
    void DrawConditions()
    {
        if (templateParser_.conditions.Count == 0) {
            return;
        }

        conditionsFolded_.boolValue = Utils.Foldout("Conditions", conditionsFolded_.boolValue);
        if (!conditionsFolded_.boolValue) return;

        ++EditorGUI.indentLevel;

        foreach (var kv in templateParser_.conditions) {
            var prop = FindProperty(conditions_, kv.Key);
            var value = prop.FindPropertyRelative("value");
            var name = Utils.ToSpacedCamel(kv.Key);

            var isSelected = EditorGUILayout.Toggle(name, value.boolValue);
            if (value.boolValue != isSelected) {
                value.boolValue = isSelected;
            }
        }

        --EditorGUI.indentLevel;
    }