private void ShowValue(float value)
        {
            var intValue = RadialMenuUtility.RadialPercentage(value, out var cValue);

            _progress.Progress        = value;
            _text.text                = intValue + "%";
            _point.transform.rotation = Quaternion.Euler(0, 0, cValue * 360f);
        }
        public override void OnClickEnd()
        {
            switch (Type)
            {
            case ControlType.Button:
                if (_menu.PressingButton == this)
                {
                    _menu.PressingButton = null;
                }
                else
                {
                    return;
                }
                SetValue(0);
                break;

            case ControlType.Toggle:
                if (RadialMenuUtility.Is(GetValue(), ActiveValue))
                {
                    SetValue(0);
                }
                else
                {
                    SetControlValue();
                }
                break;

            case ControlType.SubMenu:
                if (!_subMenu)
                {
                    break;
                }
                SetControlValue();
                _menu.OpenMenu(_subMenu, _parameter, ActiveValue);
                break;

            case ControlType.TwoAxisPuppet:
                _menu.OpenPuppet(new TwoAxisPuppet(this));
                break;

            case ControlType.FourAxisPuppet:
                _menu.OpenPuppet(new FourAxisPuppet(this));
                break;

            case ControlType.RadialPuppet:
                _menu.OpenPuppet(new RadialPuppet(this));
                break;

            default: throw new ArgumentOutOfRangeException();
            }
        }
 private bool Is(float value) => RadialMenuUtility.Is(Get(), value);
Beispiel #4
0
 internal RadialMenuDynamic(string name, Texture2D icon, ControlType type, float activeValue) : base(name, icon, RadialMenuUtility.GetSubIcon(type))
 {
     Type         = type;
     ActiveValue  = activeValue;
     _dynamicType = GetDynamicType();
     _instance    = _dynamicType != DynamicType.None;
 }