Exemplo n.º 1
0
        protected override void InitFieldStyle()
        {
            base.InitFieldStyle();
            var background = VisualEditorGUIStyle.GetTexture(BuiltInColors.GetDark(_node.Type), new Color(0, 0, 0, 0), true, true, true, true);

            fieldStyle.normal.background  = background.Texture;
            fieldStyle.active.background  = background.Texture;
            fieldStyle.focused.background = background.Texture;
            fieldStyle.hover.background   = background.Texture;
        }
Exemplo n.º 2
0
        protected virtual void InitSelectionStyle()
        {
            var background = VisualEditorGUIStyle.GetTexture(new Color(0.85f, 0.51f, 0.00f, 1.00f), new Color(0.85f, 0.51f, 0.00f, 0.00f), false, false, false, false);

            selectionStyle = new GUIStyle(GUI.skin.box);
            selectionStyle.normal.background = background.Texture;
            selectionStyle.fontStyle         = FontStyle.Bold;
            selectionStyle.alignment         = TextAnchor.MiddleCenter;
            selectionStyle.normal.textColor  = Color.white;
            selectionStyle.border            = background.BorderOffset;
        }
Exemplo n.º 3
0
        protected override void InitGUIStyles()
        {
            buttonStyle          = new GUIStyle(GUI.skin.button);
            buttonStyle.fontSize = 9;
            buttonStyle.margin   = new RectOffset(0, 0, 0, 0);
            buttonStyle.padding  = new RectOffset(0, 0, 0, 0);

            foreach (var t in _availableTypes)
            {
                var color = BuiltInColors.Get(t);
                var tex   = VisualEditorGUIStyle.GetTexture(color, color, true, true, true, true);

                GUIStyle s = new GUIStyle(GUI.skin.box);
                s.normal.background = tex.Texture;
                s.border            = tex.BorderOffset;
                styles.Add(t, s);
            }
            base.InitGUIStyles();
        }
Exemplo n.º 4
0
        protected virtual void InitFieldStyle()
        {
            var textColor = Color.white;
            var bg        = VisualEditorGUIStyle.GetTexture(BuiltInColors.Default, new Color(0, 0, 0, 0), true, true, true, true);

            fieldStyle           = new GUIStyle(GUI.skin.textField);
            fieldStyle.fontStyle = FontStyle.Bold;
            fieldStyle.alignment = TextAnchor.MiddleCenter;
            fieldStyle.border    = bg.BorderOffset;
            fieldStyle.padding   = new RectOffset(0, 0, 0, 0);
            fieldStyle.margin    = new RectOffset(0, 0, 0, 0);

            fieldStyle.normal.textColor   = textColor;
            fieldStyle.normal.background  = bg.Texture;
            fieldStyle.active.textColor   = textColor;
            fieldStyle.active.background  = bg.Texture;
            fieldStyle.focused.textColor  = textColor;
            fieldStyle.focused.background = bg.Texture;
            fieldStyle.hover.textColor    = textColor;
            fieldStyle.hover.background   = bg.Texture;
        }
Exemplo n.º 5
0
        protected override void onGUI()
        {
            if (!_initialized)
            {
                Init();
                return;
            }

            var bg = VisualEditorGUIStyle.ColorBox(new Color(0.64f, 0.64f, 0.64f));

            GUI.Box(new Rect(0, -5, position.width, 10), "", bg);

            Rect toolbarRect = new Rect(0, 0, position.width, 15);
            Rect sideRect    = new Rect(0, 15, 225, this.position.height - 15);

            Workspace = new Rect(230, 15, this.position.width - 215, this.position.height - 30);


            GUI.Label(toolbarRect, "", (GUIStyle)"Toolbar");
            _zoomArea.Draw(Workspace);

            if (!_enabled || _loadedGraph == null)
            {
                EditorGUI.HelpBox(new Rect(Workspace.x + Workspace.width / 2 - 100, Workspace.y + Workspace.height / 2 - 25, 200, 50),
                                  "No graph is loaded. Please double click on a graph to load", MessageType.Info);
                return;
            }

            // TOOLBAR
            toolbarRect.width = sideRect.width;
            _tabIndex         = GUI.Toolbar(toolbarRect, _tabIndex, new string[] { "Variables", "Bookmarks" }, (GUIStyle)"toolbarbutton");

            // TITLE
            Rect titleRect     = new Rect(Workspace.x + 10, Workspace.y + 10, 200, 40);
            var  titleBg       = VisualEditorGUIStyle.ColorBox(new Color(0f, 0f, 0f, .3f));
            var  titleStyle    = RunemarkGUI.Styles.Paragraph(16, TextAnchor.MiddleLeft, FontStyle.Bold, new Color(1, 1, 1, 0.5f));
            var  subTitleStyle = RunemarkGUI.Styles.Paragraph(12, TextAnchor.MiddleCenter, FontStyle.Normal, new Color(1, 1, 1, 0.5f));

            GUI.Box(titleRect, "", titleBg);
            titleRect.x += 10;
            GUI.Label(titleRect, ((Node)_loadedGraph).name, titleStyle);

            Rect zoomRect = new Rect(Workspace.x + Workspace.width - 120, Workspace.y + Workspace.height - 40, 100, 30);

            GUI.Box(zoomRect, "", titleBg);
            GUI.Label(zoomRect, "Zoom: " + _zoomArea.ZoomStep, subTitleStyle);

            if (_marqueSelectionActive)
            {
                EditorGUI.DrawRect(_marqueSelection, new Color(1, 1, 1, .2f));
            }


            // SIDE BAR
            switch (_tabIndex)
            {
            case 0: _localVariables.Draw(sideRect); break;

            case 1: _bookmarks.Draw(sideRect); break;
            }

            updateControl();
        }