示例#1
0
        public override void ShowPopup(GraphItem targetItem = null)
        {
            base.ShowPopup(targetItem);

            // Init scroll position.
            content.localPosition = Vector2.zero;

            // Set event list.
            if (eventCategories == null || eventCategories.Length == 0)
            {
                ReadEventList();
                SetEventCategories();
            }

            // Set item selected status.
            if (targetItem != null && targetItem.GetItemData() != null)
            {
                for (int ix = 0; ix < eventListItems.Count; ++ix)
                {
                    if (Util.CompareTwoStrings(eventListItems[ix].GetEventName(), targetItem.GetItemData().ToString()))
                    {
                        eventListItems[ix].SetItemSelected(true);
                        break;
                    }
                }
            }
        }
示例#2
0
        public override void ShowPopup(GraphItem targetItem = null)
        {
            if (targetItem && targetItem.GetItemData() != null)
            {
                inputField.text = targetItem.GetItemData() as string;
            }

            base.ShowPopup(targetItem);
        }
示例#3
0
        public void ShowProperty(GraphItem node)
        {
            gameObject.SetActive(true);

            nodeTitleInput.text = node.GetBlockTitle;

            normalNode = node;
            nodeTitleInput.onValueChanged.AddListener(normalNode.SetBlockTitle);

            nodeTypeText.text = node.GetNodeType.ToString();
            nodeIDText.text   = node.BlockID.ToString();

            nodeValueInput.text = node.GetItemData() != null?node.GetItemData() as string : string.Empty;

            nodeValueInput.onValueChanged.AddListener(normalNode.SetItemData);

            nextIDText.text = node.GetNextBlockID.ToString();
        }
示例#4
0
        public void ShowProperty(GraphItem node)
        {
            gameObject.SetActive(true);

            variableNode        = node as VariableItem;
            nodeTitleInput.text = variableNode.GetBlockTitle;
            nodeNameInput.text  = variableNode.GetBlockName;

            nodeTitleInput.onValueChanged.AddListener(variableNode.SetBlockTitle);
            nodeNameInput.onValueChanged.AddListener(variableNode.SetBlockName);

            nodeOperatorDropdown.value = (int)variableNode.GetOperatorType;
            nodeOperatorDropdown.onValueChanged.AddListener(variableNode.SetOperatorType);

            nodeTypeText.text = node.GetNodeType.ToString();
            nodeIDText.text   = node.BlockID.ToString();

            nodeValueInput.text = node.GetItemData() != null?node.GetItemData().ToString() : "";

            nodeValueInput.onValueChanged.AddListener(variableNode.SetItemData);

            nextIDText.text = node.GetNextBlockID.ToString();
        }
示例#5
0
        public void AddNodeItem(GameObject itemPrefab, GraphItem node, Vector3 nodePos, int blockID)
        {
            // Create Block on to block pane.
            GameObject    newObj        = Instantiate(itemPrefab);
            RectTransform rectTransform = newObj.GetComponent <RectTransform>();

            rectTransform.SetParent(blockPane);
            rectTransform.position   = nodePos;
            rectTransform.localScale = Vector3.one;
            GraphItem graphItem = newObj.GetComponent <GraphItem>();

            graphItem.BlockID = blockID;
            graphItem.SetBlockTitle(node.GetBlockTitle);
            graphItem.SetItemData(node.GetItemData());

            if (node.GetNodeType == NodeType.SWITCH)
            {
                SwitchBranchItem switchNode      = graphItem as SwitchBranchItem;
                SwitchBranchItem givenSwitchNode = node as SwitchBranchItem;
                switchNode.SetBlockCount(givenSwitchNode.GetBlockCount);
                switchNode.SetSwitchType(givenSwitchNode.GetSwitchType);
                switchNode.SetSwitchName(givenSwitchNode.GetSwitchName);

                for (int ix = 1; ix < givenSwitchNode.GetBlockCount + 1; ++ix)
                {
                    if (switchNode.executePoints[ix] is ExecuteCasePoint)
                    {
                        ExecuteCasePoint casePoint = switchNode.executePoints[ix] as ExecuteCasePoint;
                        casePoint.CaseValue = (givenSwitchNode.executePoints[ix] as ExecuteCasePoint).CaseValue;
                    }
                }
            }

            else if (node.GetNodeType == NodeType.VARIABLE)
            {
                VariableItem variableNode      = graphItem as VariableItem;
                VariableItem givenVariableNode = node as VariableItem;
                variableNode.SetBlockName(givenVariableNode.GetBlockName);
                variableNode.SetOperatorType(givenVariableNode.GetOperatorType);
            }

            // Add Block Information to Block Diagram Manager.
            WorkspaceManager.Instance.AddBlock(graphItem);
        }