public void SetVariableNameFromDialog(IVariable variable)
        {
            SetValueDialog setDialog = Instantiate(_resourceProvider.SetValueDialog, _dialogLayer);

            setDialog.Init("Variable Name:", "VariableName");

            setDialog.OnOk.AddListener(
                (valueString) =>
            {
                variable.Name = valueString;
                _variablesPanel.AddVariable(variable);
            });
        }
        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();
            });
        }