Beispiel #1
0
        public void draw()
        {
            if (node != null)
            {
                switch (type)
                {
                case DSConnectionPointType.In:
                    rect.x = node.rect.x - rect.width + 1f;
                    rect.y = node.rect.y + node.rect.height / 2 - rect.height / 2;
                    break;

                case DSConnectionPointType.Out:
                    rect.x = node.rect.x + node.rect.width - 1f;
                    rect.y = node.rect.y + node.rect.height / 2 - rect.height / 2;
                    break;

                case DSConnectionPointType.TrueOut:
                    rect.x = node.rect.x + node.rect.width - 1f;
                    rect.y = node.rect.y + node.rect.height / 4 - rect.height / 2;
                    break;

                case DSConnectionPointType.FalseOut:
                    rect.x = node.rect.x + node.rect.width - 1f;
                    rect.y = node.rect.y + 3 * node.rect.height / 4 - rect.height / 2;
                    break;
                }
                if (GUI.Button(rect, letter, GUI.skin.box))
                {
                    switch (type)
                    {
                    case DSConnectionPointType.In:
                        ds.OnClickInPoint(this);
                        break;

                    case DSConnectionPointType.Out:
                    case DSConnectionPointType.TrueOut:
                    case DSConnectionPointType.FalseOut:
                        ds.OnClickOutPoint(this);
                        break;
                    }
                }
            }
            else
            {
                node = ds.nodes.Find(x => x.id == nodeID);
            }
        }
Beispiel #2
0
        public void load(string save)
        {
            string[] splited             = save.Split(DataSimulator.DS_SAVELOAD_SEPERATOR);
            DSConnectionPointType inType = (DSConnectionPointType)int.Parse(splited [0]);
            DSNode inNode = ds.nodes.Find(x => x.id == int.Parse(splited [1]));
            DSConnectionPointType outType = (DSConnectionPointType)int.Parse(splited [2]);
            DSNode outNode = ds.nodes.Find(x => x.id == int.Parse(splited [3]));

            switch (inType)
            {
            case DSConnectionPointType.In:
                inPoint = inNode.inPoint;
                break;

            default:
                break;
            }

            switch (outType)
            {
            case DSConnectionPointType.Out:
                outPoint = outNode.outPoint;
                break;

            case DSConnectionPointType.TrueOut:
                outPoint = ((DSSelectionNode)outNode).trueOutPoint;
                break;

            case DSConnectionPointType.FalseOut:
                outPoint = ((DSSelectionNode)outNode).falseOutPoint;
                break;

            default:
                break;
            }
        }