示例#1
0
        public CheckBox(string text, Vector2 position, CheckBoxType type, bool isChecked, CallMethodOnChange methodChecked = null, CallMethodOnChange methodUnchecked = null)
        {
            _isChecked = isChecked;
            if (text != null)
            {
                _boudary = new RectangleF(24, 24, position.X + 512, position.Y);
            }
            else
            {
                _boudary = new RectangleF(24, 24, position.X, position.Y);
            }

            _btn             = new Button(_boudary.Position, "", ChangeState, null, null, ButtonType.check);
            _methodChecked   = methodChecked;
            _methodUnchecked = methodUnchecked;
            _text            = text;
            _position        = position;
            _type            = type;

            switch (_type)
            {
            case CheckBoxType.visibility:
                _tex = Game1.Textures["CheckBoxVisibility"];
                break;

            case CheckBoxType.classic:
                _tex = Game1.Textures["CheckBoxClassic"];
                break;

            case CheckBoxType.sound:
                _tex = Game1.Textures["CheckBoxSound"];
                break;
            }
        }
示例#2
0
        public Radio(string text, Vector2 position, RadioType type, CallMethodOnChange methodChecked = null, CallMethodOnChange methodUnchecked = null, string name = null)
        {
            if (type == RadioType.classic)
            {
                if (text != null)
                {
                    _boudary = new RectangleF(24, 24, position.X + 512, position.Y);
                }
                else
                {
                    _boudary = new RectangleF(24, 24, position.X, position.Y);
                }
                _btn = new Button(_boudary.Position, "", ChangeState, null, null, ButtonType.check);
            }
            else if (type == RadioType.big)
            {
                _boudary = new RectangleF(128, 64, position.X, position.Y);
                _btn     = new Button(_boudary.Position, "", ChangeState, null, null, ButtonType.big);
            }

            _methodChecked   = methodChecked;
            _methodUnchecked = methodUnchecked;
            _text            = text;
            _position        = position;
            _type            = type;
            Name             = name;
        }