public void AddOnBlock(AlgorithmBlockUI sender) { switch (_addBlockStep) { case AddBlockSteps.SetTarget: { _addTarget = sender; _isAddBlock = true; _contextMenu.ClearContextMenu(); if (_addTarget.BlockData.Type == BlockType.If || _addTarget.BlockData.Type == BlockType.While) { SetAddInsertTypeMenuItems(); _contextMenu.gameObject.SetActive(true); _addBlockStep = AddBlockSteps.ChoiceInsertType; } else { _addInsertInside = false; SetAddTypeMenuItems(); _contextMenu.gameObject.SetActive(true); _addBlockStep = AddBlockSteps.ChoiceBlockType; } } break; } }
public void AddBlockOnContextMenuItem(MenuButton sender) { switch (_addBlockStep) { case AddBlockSteps.ChoiceInsertType: { if (!_addInsertTypeMenuButtons.ContainsKey(sender)) { return; } _addInsertInside = _addInsertTypeMenuButtons[sender]; _contextMenu.ClearContextMenu(); SetAddTypeMenuItems(); _addBlockStep = AddBlockSteps.ChoiceBlockType; } break; case AddBlockSteps.ChoiceBlockType: { if (!_addTypeMenuButtons.ContainsKey(sender)) { return; } _addType = _addTypeMenuButtons[sender]; _contextMenu.ClearContextMenu(); SetAddBlocksMenuItems(); _addBlockStep = AddBlockSteps.ChoiceBlock; } break; case AddBlockSteps.ChoiceBlock: { if (!_addBlockMenuButtons.ContainsKey(sender)) { return; } _contextMenu.gameObject.SetActive(false); _addBlockData = _addBlockMenuButtons[sender]; _treePanel.AddBlock(_addTarget, _addBlockData, _addInsertInside); _editPanel.CurrentTool = EditTools.Cursor; _addBlockStep = AddBlockSteps.SetBlockData; } break; } }
public void AddInit() { _addBlockStep = AddBlockSteps.SetTarget; _addVariableStep = AddVariableSteps.SetType; }