Esempio n. 1
0
        protected void drawStatemap()
        {
            System.Object value;

            foreach (StatemapField field in graph.statemapDefinition.definitions)
            {
                if (!field.editable)
                {
                    EditorPropertyHelper.readonlyField(field.name, NAME_WIDTH);
                    continue;
                }

                value = EditorPropertyHelper.propertyField(field.name, NAME_WIDTH, field.type, field.value, statemapInspectorWidth - NAME_WIDTH - 10f);

                if (!System.Object.Equals(value, field.value))
                {
                    field.set(field.type, value);
                    EditorUtility.SetDirty(graph);
                }
            }
        }
Esempio n. 2
0
        protected void drawFields(MoronIONode node, Rect nodeRect)
        {
            System.Object value, original;
            Rect          current, label;
            float         labelWidth;

            current = new Rect(nodeRect.x, nodeRect.y + 20, nodeRect.width, 20);
            label   = current;

            GUI.color           = NODE_BACKGROUND_COLOR;
            GUI.contentColor    = NODE_BACKGROUND_COLOR;
            GUI.backgroundColor = NODE_BACKGROUND_COLOR;

            // manual
            foreach (FieldInfo field in node.getFieldsWithAttribute <MoronManualWriteAttribute>())
            {
                label.y     = current.y;
                label.width = GUI.skin.label.CalcSize(new GUIContent(field.Name)).x;

                labelWidth    = label.width + 5;
                current.x     = nodeRect.x + labelWidth;
                current.width = nodeRect.width - labelWidth - 2;

                original = node.getManualJoist(field.Name);
                value    = EditorPropertyHelper.propertyField(current, label, field.Name, field.FieldType, original);
                node.setManualJoist(field.Name, value);

                if (value != original)
                {
                    EditorUtility.SetDirty(graph);
                }

                current.y += 20;
            }

            drawJoistList <MoronStateReadAttribute>(node, nodeRect, ref current, ref label, node.getReadJoist, node.setReadJoist, "    Reads:");
            drawJoistList <MoronStateWriteAttribute>(node, nodeRect, ref current, ref label, node.getWriteJoist, node.setWriteJoist, "    Writes:");
        }