コード例 #1
0
ファイル: MenuScreenView.cs プロジェクト: jaydn/Quaver
        /// <summary>
        ///     Creates tool buttons to the bottom right of the screen.
        /// </summary>
        private void CreateToolButtons()
        {
            const int targetY       = -5;
            const int animationTime = 1100;

            PowerButton = new ToolButton(FontAwesome.Get(FontAwesomeIcon.fa_power_button_off), (o, e) => DialogManager.Show(new QuitDialog()))
            {
                Alignment = Alignment.BotRight,
            };

            PowerButton.Y = PowerButton.Height;

            // Add Animation to move it up.
            PowerButton.Animations.Add(new Animation(AnimationProperty.Y, Easing.OutQuint,
                                                     PowerButton.Y, targetY, animationTime));

            MiddleContainer.AddContainedDrawable(PowerButton);

            // Create settings button
            SettingsButton = new ToolButton(FontAwesome.Get(FontAwesomeIcon.fa_settings), (o, e) => DialogManager.Show(new SettingsDialog()))
            {
                Parent     = MiddleContainer,
                Alignment  = Alignment.BotRight,
                Y          = PowerButton.Y,
                X          = PowerButton.X - PowerButton.Width - 5,
                Animations =
                {
                    new Animation(AnimationProperty.Y, Easing.OutQuint, PowerButton.Y, targetY, animationTime)
                }
            };

            MiddleContainer.AddContainedDrawable(SettingsButton);
        }
コード例 #2
0
        /// <summary>
        ///     Creates tool buttons to the bottom right of the screen.
        /// </summary>
        private void CreateToolButtons()
        {
            const int targetY       = -5;
            const int animationTime = 1100;

            PowerButton = new ToolButton(FontAwesome.Get(FontAwesomeIcon.fa_power_button_off), (o, e) =>
            {
                DialogManager.Show(new ConfirmCancelDialog("Are you sure you want to exit Quaver?", (sender, args) =>
                {
                    var game = GameBase.Game as QuaverGame;
                    game?.Exit();
                }));
            })
            {
                Alignment = Alignment.BotRight,
            };

            PowerButton.Y = PowerButton.Height;

            // Add Animation to move it up.
            PowerButton.Animations.Add(new Animation(AnimationProperty.Y, Easing.OutQuint,
                                                     PowerButton.Y, targetY, animationTime));

            MiddleContainer.AddContainedDrawable(PowerButton);

            // Create settings button
            SettingsButton = new ToolButton(FontAwesome.Get(FontAwesomeIcon.fa_settings), (o, e) => DialogManager.Show(new SettingsDialog()))
            {
                Parent     = MiddleContainer,
                Alignment  = Alignment.BotRight,
                Y          = PowerButton.Y,
                X          = PowerButton.X - PowerButton.Width - 5,
                Animations =
                {
                    new Animation(AnimationProperty.Y, Easing.OutQuint, PowerButton.Y, targetY, animationTime)
                }
            };

            MiddleContainer.AddContainedDrawable(SettingsButton);
        }