示例#1
0
        // Copy/Paste를 통해 라인 복제할 때 사용하는 메소드.
        public void DuplicateLines(List <GraphLine> lines)
        {
            for (int ix = 0; ix < lines.Count; ++ix)
            {
                int       leftID    = changedIDTable[lines[ix].GetLeftExecutePointInfo.blockID];
                int       rightID   = changedIDTable[lines[ix].GetRightExecutePointInfo.blockID];
                GraphItem leftItem  = GetGraphItem(leftID);
                GraphItem rightItem = GetGraphItem(rightID);

                ExecutePoint leftPoint  = null;
                ExecutePoint rightPoint = null;

                if (leftItem != null)
                {
                    leftPoint = leftItem.GetExecutePoint(ExecutePoint.PointPosition.ExecutePoint_Right, lines[ix].GetLeftExecutePointInfo.executePointID);
                }
                if (rightItem != null)
                {
                    rightPoint = rightItem.GetExecutePoint(ExecutePoint.PointPosition.ExecutePoint_Left);
                }

                if (leftItem != null && rightItem != null && leftPoint != null && rightPoint != null)
                {
                    GraphLine newLine = leftPoint.SetLineData(rightPoint);
                    if (newLine)
                    {
                        newLine.SetSelected();
                    }
                }
            }
        }
示例#2
0
        private void CreateLines(LineBlockArray lineData)
        {
            if (lineData.Length == -1)
            {
                return;
            }

            for (int ix = 0; ix < lineData.Length; ++ix)
            {
                GraphItem leftItem  = GetGraphItem(lineData[ix].left.blockID);
                GraphItem rightItem = GetGraphItem(lineData[ix].right.blockID);

                if (leftItem.GetNodeType == NodeType.SWITCH)
                {
                    if (switchCounts.Count == 0)
                    {
                        switchCounts.Add(new SwitchCount()
                        {
                            nodeID = leftItem.BlockID, count = 1
                        });
                    }

                    else if (switchCounts.Count == 1 && !switchCounts[0].nodeID.Equals(leftItem.BlockID))
                    {
                        switchCounts.Add(new SwitchCount()
                        {
                            nodeID = leftItem.BlockID, count = 1
                        });
                    }

                    else
                    {
                        bool isProcessed = false;
                        foreach (SwitchCount item in switchCounts)
                        {
                            if (item.nodeID.Equals(leftItem.BlockID))
                            {
                                item.count++;
                                isProcessed = true;
                                break;
                            }
                        }

                        if (!isProcessed)
                        {
                            switchCounts.Add(new SwitchCount()
                            {
                                nodeID = leftItem.BlockID, count = 1
                            });
                        }
                    }
                }

                ExecutePoint leftPoint  = null;
                ExecutePoint rightPoint = null;

                if (leftItem != null)
                {
                    leftPoint = leftItem.GetExecutePoint(ExecutePoint.PointPosition.ExecutePoint_Right, lineData[ix].left.executePointID);
                }
                if (rightItem != null)
                {
                    rightPoint = rightItem.GetExecutePoint(ExecutePoint.PointPosition.ExecutePoint_Left);
                }

                if (leftItem != null && rightItem != null && leftPoint != null && rightPoint != null)
                {
                    GraphLine newLine = leftPoint.SetLineData(rightPoint);
                }
            }

            //Debug.Log("switchCount: " + switchCounts.Count);

            foreach (SwitchCount item in switchCounts)
            {
                GraphItem        node       = GetGraphItem(item.nodeID);
                SwitchBranchItem switchNode = node as SwitchBranchItem;
                switchNode.SetBlockCount(item.count - 1);
            }
        }