Beispiel #1
0
        /// <inheritdoc />
        /// <summary>
        /// </summary>
        /// <param name="dialog"></param>
        /// <param name="section"></param>
        /// <param name="icon"></param>
        /// <param name="name"></param>
        public SettingsSectionButton(SettingsDialog dialog, SettingsSection section, Texture2D icon, string name)
        {
            Dialog  = dialog;
            Section = section;
            Size    = new ScalableVector2(206, 35);
            Alpha   = 0.65f;

            Icon = new Sprite
            {
                Parent    = this,
                Image     = icon,
                Alignment = Alignment.MidCenter,
                Size      = new ScalableVector2(18, 18)
            };

            Text = new SpriteText(Fonts.Exo2SemiBold, name, 13)
            {
                Parent    = Icon,
                Alignment = Alignment.MidLeft,
                X         = Icon.Width + 4
            };

            Icon.X -= Icon.Width / 2f + Text.Width / 2f + 2;

            Flag = new Sprite
            {
                Parent = this,
                Size   = new ScalableVector2(4, Height),
                Tint   = Color.Yellow
            };

            Clicked += (o, e) =>
            {
                if (Dialog.SelectedSection == Section)
                {
                    return;
                }

                Dialog.SwitchSelected(Section);
            };
        }