private void LabelClickHandler(ValueUI valueUi, ActiveLabel sender)
 {
     if (_editPanel.CurrentTool == EditTools.Cursor)
     {
         _cursorTool.CursorOnLabel(valueUi, sender);
     }
 }
Пример #2
0
        private ValueUI CreateValueUI(ValueType type)
        {
            ValueUI result = Instantiate(_resourceProvider.ValueUiPrefab, transform);

            result.Type = type;
            result.RebuildAnValue();
            _valueUis.Add(result);

            return(result);
        }
Пример #3
0
        public void CursorOnLabel(ValueUI valueUi, ActiveLabel sender)
        {
            switch (_setLabelSteps)
            {
            case SetLabelSteps.SetTarget:
            {
                _setLabelTarget       = sender;
                _isSetedLabelVariable = false;
                _setLabelValueUi      = valueUi;

                _setLabelSteps = SetLabelSteps.ChoiceLabelType;
                _contextMenu.ClearContextMenu();
                SetLabelTypeMenuItems();
                _contextMenu.gameObject.SetActive(true);
            }
            break;
            }
        }
        public void SetValueFromDialog(ValueUI valueUI, IValue value)
        {
            SetValueDialog setDialog = Instantiate(_resourceProvider.SetValueDialog, _dialogLayer);

            string inputValue = "0";

            bool    isNumber = true;
            INumber number   = value as INumber;

            if (number != null)
            {
                inputValue = number.Value.ToString();
            }

            IBoolean boolean = value as IBoolean;

            if (boolean != null)
            {
                inputValue = boolean.IsTrue ? "1" : "0";
                isNumber   = false;
            }

            setDialog.Init("Set Constant", inputValue);

            setDialog.OnOk.AddListener(
                (valueString) =>
            {
                if (isNumber)
                {
                    if (float.TryParse(valueString, out float floatValue))
                    {
                        FloatConstant constant = number as FloatConstant;

                        if (constant != null)
                        {
                            number.Value = floatValue;
                        }
                        else
                        {
                            constant       = new FloatConstant();
                            constant.Value = floatValue;
                            _cursorTool.SetLabelTarget.Value = constant;

                            if (_cursorTool.SetLabelTarget.Value.Parent == null)
                            {
                                _cursorTool.SetLabelValueUi.Value = _cursorTool.SetLabelTarget.Value;
                            }
                        }
                    }
                }
                else
                {
                    if (float.TryParse(valueString, out float floatValue))
                    {
                        BoolConstant constant = boolean as BoolConstant;

                        if (constant != null)
                        {
                            boolean.IsTrue = floatValue != 0;
                        }
                        else
                        {
                            constant        = new BoolConstant();
                            constant.IsTrue = floatValue != 0;
                            _cursorTool.SetLabelTarget.Value = constant;

                            if (_cursorTool.SetLabelTarget.Value.Parent == null)
                            {
                                _cursorTool.SetLabelValueUi.Value = _cursorTool.SetLabelTarget.Value;
                            }
                        }
                    }
                }

                valueUI.RebuildAnValue();
            });
        }
Пример #5
0
 private void LabelClickHandler(ValueUI valueUi, ActiveLabel label)
 {
     OnLabelClick?.Invoke(valueUi, label);
 }
Пример #6
0
        private void InitParameter(ParameterData parameter)
        {
            ValueUI valueUi = CreateValueUI(parameter.type);

            valueUi?.OnLabelClick.AddListener(LabelClickHandler);
        }