Пример #1
0
        public void CursorOnVariableLabel(SetBlockUI setBlock, ActiveLabel sender)
        {
            switch (_setLabelSteps)
            {
            case SetLabelSteps.SetTarget:
            {
                _setLabelTarget       = sender;
                _isSetedLabelVariable = true;
                _setVariableBlock     = setBlock;
                _activeLabelType      = ActiveLabelType.Variable;

                _setLabelSteps = SetLabelSteps.SetValue;
                _contextMenu.ClearContextMenu();
                SetVariableMenuItems();
                _contextMenu.gameObject.SetActive(true);
            }
            break;
            }
        }
Пример #2
0
        public void CursorOnContextMenuItem(MenuButton sender)
        {
            switch (_setLabelSteps)
            {
            case SetLabelSteps.ChoiceLabelType:
            {
                _activeLabelType = _labelTypeMenuButtons[sender];
                _setLabelSteps   = SetLabelSteps.SetValue;

                _contextMenu.ClearContextMenu();
                if (_activeLabelType == ActiveLabelType.Variable)
                {
                    SetLabelVariableMenuItems();
                }
                else if (_activeLabelType == ActiveLabelType.Expression)
                {
                    if (_setLabelTarget.ValueType == ValueType.Bool)
                    {
                        _setLabelTarget.Value = new LogicExpression();
                    }
                    else
                    {
                        _setLabelTarget.Value = new Expression();
                    }

                    if (_setLabelTarget.Value.Parent == null)
                    {
                        _setLabelValueUi.Value = _setLabelTarget.Value;
                    }
                    _setLabelValueUi.RebuildAnValue();

                    _contextMenu.gameObject.SetActive(false);
                    _setLabelSteps = SetLabelSteps.SetTarget;
                }
                else if (_activeLabelType == ActiveLabelType.Constant)
                {
                    _mainController.SetValueFromDialog(_setLabelValueUi, _setLabelTarget.Value);

                    _contextMenu.gameObject.SetActive(false);
                    _setLabelSteps = SetLabelSteps.SetTarget;
                }
                else if (_activeLabelType == ActiveLabelType.Operation)
                {
                    if (_setLabelTarget.LabelType == ActiveLabelType.Condition)
                    {
                        SetRelationMenuItems();
                    }
                    else
                    {
                        if (_setLabelTarget.ValueType == ValueType.Bool)
                        {
                            SetLogicOperationMenuItems();
                        }
                        else
                        {
                            SetNumberOperationMenuItems();
                        }
                    }

                    _setLabelSteps = SetLabelSteps.SetValue;
                }
                else if (_activeLabelType == ActiveLabelType.Condition)
                {
                    _setLabelTarget.Value = new Condition();

                    if (_setLabelTarget.Value.Parent == null)
                    {
                        _setLabelValueUi.Value = _setLabelTarget.Value;
                    }
                    _setLabelValueUi.RebuildAnValue();

                    _contextMenu.gameObject.SetActive(false);
                    _setLabelSteps = SetLabelSteps.SetTarget;
                }
            }
            break;

            case SetLabelSteps.SetValue:
            {
                if (_activeLabelType == ActiveLabelType.Operation)
                {
                    if (_setLabelTarget.LabelType == ActiveLabelType.Condition)
                    {
                        Condition condition = _setLabelTarget.Value as Condition;
                        condition.Relation = _relationMenuButtons[sender];
                    }
                    else
                    {
                        if (_setLabelTarget.ValueType == ValueType.Bool)
                        {
                            LogicExpression logicExpression = _setLabelTarget.Value as LogicExpression;
                            logicExpression.Operation = _logicOperationMenuButtons[sender];
                        }
                        else
                        {
                            Expression numberExpression = _setLabelTarget.Value as Expression;
                            numberExpression.Operation = _numberOperationMenuButtons[sender];
                        }
                    }

                    _setLabelValueUi.RebuildAnValue();
                }
                else if (_activeLabelType == ActiveLabelType.Variable)
                {
                    if (_isSetedLabelVariable)
                    {
                        _setLabelTarget.Value = _labelVariableMenuButtons[sender];
                        _setVariableBlock.SetBlock.Variable = _labelVariableMenuButtons[sender];

                        _setVariableBlock.RefreshParameter();
                    }
                    else
                    {
                        _setLabelTarget.Value = _labelVariableMenuButtons[sender];

                        if (_setLabelTarget.Value.Parent == null)
                        {
                            _setLabelValueUi.Value = _setLabelTarget.Value;
                        }
                        _setLabelValueUi.RebuildAnValue();
                    }
                }

                _contextMenu.gameObject.SetActive(false);
                _setLabelSteps = SetLabelSteps.SetTarget;
            }
            break;
            }
        }