示例#1
0
        public override void Construct()
        {
            Name = "Pass Thru Node";

            m_inlet  = MakeLet <Inlet>("Inlet");
            m_outlet = MakeLet <Outlet>("Outlet", 25);

            Size = new Vector2(Size.x, 80);
        }
示例#2
0
        public override void Construct()
        {
            Name = "DelayNode";

            m_inlet  = MakeLet <Inlet>("Inlet");
            m_outlet = MakeLet <Outlet>("Outlet", 25);

            Size = new Vector2(125, Size.y);
        }
        public override void Construct()
        {
            Name = "ConditionalNode";

            m_inlet  = MakeLet <Inlet>("Inlet");
            m_outlet = MakeLet <Outlet>("Outlet", 25);

            Size = new Vector2(125, 125);
        }
示例#4
0
        public override void Construct()
        {
            Name = "GateNode";

            m_inlet1 = MakeLet <Inlet>("Inlet 1");
            m_inlet2 = MakeLet <Inlet>("Inlet 2", 25);
            m_outlet = MakeLet <Outlet>("Outlet", 50);

            Size = new Vector2(Size.x, 125);
        }
示例#5
0
        public override void Construct()
        {
            Name   = "PersuadeBaseNode";
            Size   = new Vector2(200, 200);
            inlet  = MakeLet <Inlet>("Input");
            outlet = MakeLet <Outlet>("Output");

            feedbackOutlet      = MakeLet <Outlet>("正向反馈", 20);
            feedbackOutlet.type = 1;
        }
示例#6
0
        public override void Construct()
        {
            Name = "TextNode";

            inlet  = MakeLet <Inlet>("Trigger");
            setter = MakeLet <Inlet>("Set", 25);
            outlet = MakeLet <Outlet>("Output", 50);

            Size = new Vector2(200, 125);
        }
示例#7
0
        public override void Construct()
        {
            Name = "NumberNode";

            m_trigger = MakeLet <Inlet>("Trigger");
            m_setter  = MakeLet <Inlet>("Set", 25);
            m_outlet  = MakeLet <Outlet>("Outlet", 50);

            Size = new Vector2(Size.x, 125);
        }
示例#8
0
        public override void Construct()
        {
            Name = "RandomIntNode";

            inlet = MakeLet <Inlet>();

            outlet         = MakeLet <Outlet>();
            outlet.yOffset = 25;

            Size = new Vector2(125, 100);
        }
示例#9
0
        void BreakConnectionMenu(Inlet inlet, Outlet outlet)
        {
            GenericMenu genericMenu = new GenericMenu();

            genericMenu.AddItem(new GUIContent("Break Connection"), false, () =>
            {
                inlet.RemoveLet(outlet);
                outlet.RemoveLet(inlet);
            });

            genericMenu.ShowAsContext();
        }
示例#10
0
        public void Draw()
        {
            if (!Visible)
            {
                return;
            }

            m_rect = GUI.Window(Id, m_rect, WindowCallback, gameObject.name);

            Vector2 newPos = new Vector2(m_rect.x, m_rect.y);

            if (newPos != Position)
            {
                for (int i = 0; i < m_lets.Count; i++)
                {
                    switch (m_lets[i].Type)
                    {
                    case LetTypes.INLET:
                        Inlet inlet = m_lets[i] as Inlet;
                        for (int j = 0; j < inlet.Connections.Count; j++)
                        {
                            inlet.Connections[j].Outlet.MakeConnections();
                        }
                        break;

                    case LetTypes.OUTLET:
                        Outlet outlet = m_lets[i] as Outlet;
                        outlet.MakeConnections();
                        break;
                    }
                }
            }

            Position = newPos;
            m_size   = new Vector2(m_rect.width, m_rect.height);

            // Draw Let(s)
            for (int i = 0; i < m_lets.Count; i++)
            {
                m_lets[i].DrawLet(m_rect);
            }

            // draw close box
            if (ShowCloseButton)
            {
                GUI.Box(m_closeBoxPos, "X");
            }
        }
        public override void Construct()
        {
            m_lets.Clear();
            Name = "CustomNodeExample2";
            Size = new Vector2(180, 150);

            // create 3 inlets
            int yOffset = 25;

            for (int i = 0; i < 3; i++)
            {
                Inlet inlet = gameObject.AddComponent <Inlet>();
                inlet.Construct(this);

                inlet.yOffset = yOffset * i;
                inlet.Name    = "Inlet " + i.ToString();

                m_lets.Add(inlet);

                // add listener to inlet 1
                if (i == 0)
                {
                    inlet1 = inlet;
                }
            }

            // Create 2 outlets
            for (int i = 0; i < 2; i++)
            {
                Outlet outlet = gameObject.AddComponent <Outlet>();
                outlet.Construct(this);

                outlet.yOffset = yOffset * (i + 3);
                outlet.Name    = "Outlet " + i.ToString();

                m_lets.Add(outlet);

                if (i == 0)
                {
                    outlet1 = outlet;
                }
                if (i == 1)
                {
                    outlet2 = outlet;
                }
            }
        }
示例#12
0
        public Connection(Inlet inlet, Outlet outlet, List <Vector2> points)
        {
            Outlet = outlet;
            Inlet  = inlet;

            // TODO : make this better
            // remove last point if to close to connecting inlet
            if (points.Count > 0)
            {
                if (Vector2.Distance(inlet.Position.center, points[points.Count - 1]) < 5)
                {
                    points.RemoveAt(points.Count - 1);
                }
            }

            points.Reverse();
            Points = points.ToArray();
        }
示例#13
0
        public override void WindowCallback(int id)
        {
            GUI.BeginGroup(new Rect(5, y, 100, 50));

            int newNum = EditorGUILayout.IntField(Outlets, GUILayout.MaxWidth(80));

            newNum = Mathf.Clamp(newNum, 1, 100);
            if (newNum < Outlets)
            {
                int remove = Outlets - newNum;

                for (int i = 0; i < remove; i++)
                {
                    Let letToRemove = m_outlets[m_outlets.Count - 1];
                    DestroyLet(letToRemove);
                    m_outlets.Remove((Outlet)letToRemove);
                    y -= 25;
                }

                Size = new Vector2(Size.x, 55 + y);

                Outlets = newNum;
            }
            else if (newNum > Outlets)
            {
                int add = newNum - Outlets;

                for (int i = 0; i < add; i++)
                {
                    Outlet outlet = MakeLet <Outlet>("Outlet " + m_outlets.Count.ToString(), y);
                    m_outlets.Add(outlet);

                    y += 25;
                }

                Size = new Vector2(Size.x, 55 + y);

                Outlets = newNum;
            }

            GUI.EndGroup();

            base.WindowCallback(id);
        }