Beispiel #1
0
    private void DrawHeadingBar()
    {
        #region Draw Base Heading

        DrawRectBox(r(0, 0, width, 30), "", out heading);

        //Draw Options
        Rect filePath = o(heading, 5, 5, 100, 20);
        fileStringPath = GUI.TextField(filePath, fileStringPath);

        //Download / Upload
        Rect download = xo(filePath, 10, 0, 80, 20);
        Rect upload   = xo(download, 10, 0, 80, 20);

        if (GUI.Button(download, "Download"))
        {
            Download(fileStringPath);
        }

        if (GUI.Button(upload, "Upload"))
        {
            Upload(fileStringPath);
        }

        #endregion

        #region Draw Nodes

        //Draw Node Options
        Rect startNode  = xo(upload, 50, 0, 80, 20);
        Rect gateNode   = xo(startNode, 10, 0, 80, 20);
        Rect NPCNode    = xo(gateNode, 10, 0, 80, 20);
        Rect PlayerNode = xo(NPCNode, 10, 0, 80, 20);

        Rect ClearNodes = xo(PlayerNode, 30, 0, 80, 20);
        Rect refresh    = xo(ClearNodes, 30, 0, 80, 20);

        Rect _drawInspector = r(width - 120, 5, 100, 20);


        if (GUI.Button(startNode, "Start"))
        {
            connectionIDCount++;
            nodes.Add(new DNode("Start", new Vector2(width - 400, 70) - offset, connectionIDCount));
            connections.Add(connectionIDCount, nodes[nodes.Count - 1]);
        }

        if (GUI.Button(gateNode, "Gate"))
        {
            connectionIDCount++;
            nodes.Add(new DNode("Gate", new Vector2(width - 400, 70) - offset, connectionIDCount));
            connections.Add(connectionIDCount, nodes[nodes.Count - 1]);
        }

        if (GUI.Button(NPCNode, "NPC"))
        {
            connectionIDCount++;
            nodes.Add(new DNode("NPC", new Vector2(width - 400, 70) - offset, connectionIDCount));
            connections.Add(connectionIDCount, nodes[nodes.Count - 1]);
        }

        if (GUI.Button(PlayerNode, "Player"))
        {
            connectionIDCount++;
            nodes.Add(new DNode("Player", new Vector2(width - 400, 70) - offset, connectionIDCount));
            connections.Add(connectionIDCount, nodes[nodes.Count - 1]);
        }

        if (GUI.Button(ClearNodes, "Clear"))
        {
            connectionIDCount = 0;
            connections.ClearValues();
            properties.ClearValues();
            nodes.Clear();
        }

        if (GUI.Button(_drawInspector, "[]"))
        {
            drawInspector = !drawInspector;
        }

        if (GUI.Button(refresh, "REFRESH"))
        {
            for (int c = 0; c < nodes.Count; c++)
            {
                connections.SetValue(nodes[c].nodeID, nodes[c]);
            }

            for (int i = 0; i < nodes.Count; i++)
            {
                nodes [i].ConnectionOccurred(connections);
            }
            //ww22
            offset = Vector2.zero;
        }

        #endregion
    }