Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hold-to-quit button for gameplay/replays #2430

Merged
merged 35 commits into from
May 22, 2018

Conversation

UselessToucan
Copy link
Contributor

@UselessToucan UselessToucan commented Apr 20, 2018

@peppy
Copy link
Sponsor Member

peppy commented Apr 20, 2018

We really need something like this for play modes too. @arflyte anything in mind?

@arflyte
Copy link

arflyte commented Apr 20, 2018

An "exit" button for play mode and replay?

@peppy
Copy link
Sponsor Member

peppy commented Apr 20, 2018

Some mechanism to exit gameplay, for touch users for instance.

@arflyte
Copy link

arflyte commented Apr 20, 2018

Haven't worked on touch interface elements yet. Use this for now, will revisit the buttons again later.

spectator-screen

To quit, player have to hold the button for 1s. "Hold to Quit" fades away after 5s. It's either "Quit" or "Resign", depends on the mode.

On hold, the action icon becomes bigger, "Hold to Quit" is visible again, and progress ring appears.

ee3397bea7

@peppy
Copy link
Sponsor Member

peppy commented Apr 20, 2018

Note that this should be displayed in both play and replay, but probably doesn't need to completely fade during replay.

During play it should fade out until the cursor is hovering it and then appear again.

@peppy peppy added this to the Candidate Issues milestone Apr 20, 2018
@UselessToucan
Copy link
Contributor Author

UselessToucan commented Apr 21, 2018

Looks ok to me
https://www.youtube.com/watch?v=lg4_EXMZiSs

However I don't know what to do with this new HoldToQuit UI element during actual gameplay.

  1. As osu! standard player I just don't need this thing on the screen during gameplay.
  2. During gameplay Exit call causes player to pause(pause != quit). https://www.youtube.com/watch?v=RiqKzdcun48

@peppy
Copy link
Sponsor Member

peppy commented Apr 21, 2018

Where's the test case?

@UselessToucan
Copy link
Contributor Author

Not written yet. :(

@peppy
Copy link
Sponsor Member

peppy commented Apr 21, 2018

How did you even make this component without a test case? Please read the wiki regarding how to develop for this project before going any further.

@peppy
Copy link
Sponsor Member

peppy commented Apr 21, 2018

This whole thing can be done using transforms and without a clock or whatever.

onMouseDown
{
    ring.FillTo(1, duration).OnComplete(_ =>
    {
        // exit
    });
}

onMouseUp
{
    ring.FillTo(0, duration/4); // interrupts the other transform and causes the exit to never occur.
}

@peppy
Copy link
Sponsor Member

peppy commented Apr 28, 2018

Did you see my comment above? It would clean up the implementation considerably.

Copy link
Contributor

@smoogipoo smoogipoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs some work on the design, but let's go with these reviews for now.

@@ -216,6 +216,8 @@ private void load(AudioManager audio, APIAccess api, OsuConfigManager config)
}
};

hudOverlay.HoldToQuit.Button.ExitAction = Exit;

This comment was marked as off-topic.

{
Anchor = Anchor.BottomRight,
Origin = Anchor.BottomRight,
Margin = new MarginPadding { Bottom = Progress.Size.Y * 1.25f, Right = 5 }

This comment was marked as off-topic.


namespace osu.Game.Screens.Play.HUD
{
public class HoldToQuit : FillFlowContainer

This comment was marked as off-topic.

AutoSizeAxes = Axes.Both;
}

public class HoldToQuitButton : CircularContainer

This comment was marked as off-topic.

@@ -205,6 +207,13 @@ protected virtual ScoreCounter CreateScoreCounter() => new ScoreCounter(6)
RelativeSizeAxes = Axes.X,
};

protected virtual HoldToQuit CreateHoldToQuit() => new HoldToQuit

This comment was marked as off-topic.

Copy link
Contributor

@smoogipoo smoogipoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as commented

@peppy peppy changed the title Add 'End replay' button Add hold-to-quit button for gameplay/replays May 21, 2018
@peppy
Copy link
Sponsor Member

peppy commented May 21, 2018

@UselessToucan highly recommend you check my code changes for this. look how elegant the shared logic is now

hudOverlay = new HUDOverlay(scoreProcessor, RulesetContainer, working, offsetClock, adjustableClock)
{
Clock = Clock, // hud overlay doesn't want to use the audio clock directly
ProcessCustomClock = false,
Anchor = Anchor.Centre,
Origin = Anchor.Centre
},
RulesetContainer.Cursor?.CreateProxy() ?? new Container(),

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

{
base.Update();

float adjust = Vector2.Distance(GetContainingInputManager().CurrentState.Mouse.NativeState.Position, button.ScreenSpaceDrawQuad.Centre) / 200;

This comment was marked as off-topic.

This comment was marked as off-topic.

{
base.Confirm();

// temporarily unbind as to not look weird during flash animation.

This comment was marked as off-topic.

This comment was marked as off-topic.


// temporarily unbind as to not look weird during flash animation.
Progress.UnbindAll();
pendingAnimation = true;

This comment was marked as off-topic.

This comment was marked as off-topic.

Progress.UnbindAll();
pendingAnimation = true;

innerCircle.ScaleTo(0, 100)

This comment was marked as off-topic.

This comment was marked as off-topic.


innerCircle.ScaleTo(0, 100)
.Then().FadeOut().ScaleTo(1).FadeIn(500)
.OnComplete(a => circularProgress.FadeOut(100).OnComplete(_ =>

This comment was marked as off-topic.

This comment was marked as off-topic.

base.Confirm();

// temporarily unbind as to not look weird during flash animation.
Progress.UnbindAll();

This comment was marked as off-topic.


bool stayVisible = text.Alpha > 0 || button.Progress.Value > 0 || IsHovered;

Alpha = stayVisible ? 1 : Interpolation.ValueAt(elapsed, Alpha, MathHelper.Clamp(1 - adjust, 0.04f, 1), 0, 200, Easing.OutQuint);

This comment was marked as off-topic.

This comment was marked as off-topic.


namespace osu.Game.Graphics.Containers
{
public abstract class HoldToCofirmContainer : Container

This comment was marked as off-topic.

@peppy
Copy link
Sponsor Member

peppy commented May 22, 2018

All fixed 👍

Copy link
Contributor

@smoogipoo smoogipoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@smoogipoo smoogipoo merged commit c0802b5 into ppy:master May 22, 2018
@UselessToucan UselessToucan deleted the exit_replay_button branch May 25, 2018 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants