Beispiel #1
0
        protected internal virtual void DrawCotName()
        {
            if (Body.curGraph.curNodeState.GraphZoom < 0.9f)
            {
                return;
            }
            Vector2 offset   = Vector2.zero;
            var     gUIStyle = Body.NodeSkin.GetStyle("nodeKnobName");

            switch (side)
            {
            case Side.Left:
                offset   = new Vector2(15, 0);
                gUIStyle = Body.NodeSkin.GetStyle("nodeKnobNameL");
                break;

            case Side.Top:
                offset = new Vector2(0, -10);
                break;

            case Side.Right:
                offset   = new Vector2(-55, 0);
                gUIStyle = Body.NodeSkin.GetStyle("nodeKnobNameR");
                break;

            case Side.Bottom:
                offset = new Vector2(0, 5);
                break;
            }
            Rect drawRect = new Rect(rect.position + offset, new Vector2(50, 10));

            EffectUtility.FormatLabel(drawRect, CotName, gUIStyle);
        }
Beispiel #2
0
        static void DrawBindProxy(GameObject obj, GUISkin skin)
        {
#if UNITY_EDITOR
            EffectUtility.FormatLabel(obj.name, skin.GetStyle("HandleLabel1"));
            if (obj.GetComponent <EffectLProxy>() == null)
            {
                EffectUtility.FormatButton("bind", () => { BindProxy(obj); });
            }
#endif
        }
Beispiel #3
0
        static void DrawNodeHandle(Node node, GUISkin skin)
        {
#if UNITY_EDITOR
            if (node != target)
            {
                fields = NodeStack.NodeGetAsset(NodeStack.getDefaultNode(node.GetId));
                target = node;
                return;
            }
            EffectUtility.FormatLabel(node.Title, skin.GetStyle("HandleLabel1"));
            EffectUtility.FormatLabel("节点名:", skin.GetStyle("HandleLabel2"));
            EffectUtility.FormatTextfield(ref node.Title);
            foreach (FieldInfo field in fields)
            {
                var value = field.GetValue(node);
                EffectUtility.FormatLabel(field.Name, skin.GetStyle("HandleLabel2"));
                EffectUtility.FormatAssetField(ref value, field.FieldType);
                field.SetValue(node, value);
            }
#endif
        }
Beispiel #4
0
        static void DrawCubeHandle(Cube cube, GUISkin skin)
        {
#if UNITY_EDITOR
            if (cube != target)
            {
                fields = NodeStack.NodeGetAsset(NodeStack.getDefaultNode(cube.GetId));
                target = cube;
                return;
            }
            EffectUtility.FormatLabel(cube.Title, skin.GetStyle("HandleLabel1"));
            EffectUtility.FormatLabel("节点名:", skin.GetStyle("HandleLabel2"));
            EffectUtility.FormatTextfield(ref cube.Title);
            EffectUtility.FormatButton("添加组件", () =>
            {
                cube.Component.Add(0);
            });
            for (int i = 0; i < cube.Component.Count; i++)
            {
                GUILayout.BeginHorizontal();
                cube.Component[i] = EffectUtility.FormatPopup(cube.Component[i], 140f, NodeStack.MonoComponentsName.ToArray());
                int j = i;
                EffectUtility.FormatButton("除去", () =>
                {
                    cube.Component.RemoveAt(j);
                });
                GUILayout.EndHorizontal();
            }

            foreach (FieldInfo field in fields)
            {
                var value = field.GetValue(cube);
                EffectUtility.FormatLabel(field.Name, skin.GetStyle("HandleLabel2"));
                EffectUtility.FormatAssetField(ref value, field.FieldType);
                field.SetValue(cube, value);
            }
#endif
        }