Esempio n. 1
0
    private void DrawBindings()
    {
        foreach (var variable in this.model)
        {
            EditorGUILayout.BeginHorizontal();
            {
                EditorGUILayout.BeginVertical();
                EditorGUILayout.BeginHorizontal();
                {
                    variable.randomize = EditorGUILayout.Toggle(variable.randomize);

                    if (GUILayout.Button("Randomize"))
                    {
                        this.InvokeEvent(this.OnEditBinding, variable);
                    }

                    if (GUILayout.Button("Clear"))
                    {
                        this.InvokeEvent(this.OnRemoveBinding, variable);
                    }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();

                var view = VariableBindingViewFactory.CreateFromVariable(variable);
                EditorGUILayout.BeginVertical();
                {
                    view.Draw();
                }
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.EndHorizontal();
        }
    }
    public void Draw()
    {
        EditorGUILayout.BeginVertical();
        EditorGUILayout.LabelField("Gameobject (Module):\t" + this.variable.target);
        EditorGUILayout.EndVertical();

        EditorGUILayout.BeginVertical();
        EditorGUILayout.LabelField("Field:\t\t\t" + this.variable.name);
        EditorGUILayout.EndVertical();

        EditorGUILayout.Separator();

        EditorGUILayout.LabelField("Alias/Value:");
        ++EditorGUI.indentLevel;
        var view = VariableBindingViewFactory.CreateFromVariable(this.variable);

        view.Draw();
        --EditorGUI.indentLevel;

        EditorGUILayout.Separator();

        var randView = new VariableRandomizationView(this.randomization, this.variable.randomize);

        randView.OnActivationToggled += this.OnActivationToggled;
        randView.Draw();
    }