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

Allow TextBoxComponent to skip #3488

Closed
1 task done
livtanong opened this issue Feb 12, 2025 · 4 comments · Fixed by #3490
Closed
1 task done

Allow TextBoxComponent to skip #3488

livtanong opened this issue Feb 12, 2025 · 4 comments · Fixed by #3490
Assignees

Comments

@livtanong
Copy link
Contributor

Problem to solve

It is a fairly common feature for a game to "type out" dialogue within a TextBoxComponent (as the behavior would be if timePerChar > 0, but also allow the user to skip that type-out effect, and display the dialogue in its entirety (as the behavior would be if timePerChar == 0).

Proposal

One way to implement this would be to add a setter for boxConfig (currently it does not have one) such that it can be replaced with a new boxConfig wherein boxConfig.timePerChar = 0.

If there are reservations for adding that setter, a method void skip() that does this internally would also work.

More information

No response

Other

  • Are you interested in working on a PR for this?
@spydon
Copy link
Member

spydon commented Feb 12, 2025

Sounds like a good idea, I'll assign you to the issue since you've marked that you're interested in working on it. :)

@livtanong
Copy link
Contributor Author

Hello @spydon I may need a bit of help. The functionality is basically done, but...
I'm trying to follow the guidelines here, specifically melos run test.
https://github.com/flame-engine/flame/blob/main/CONTRIBUTING.md#requirements

And the tests fail. A large number of the error messages follow this form:

ERROR: ERROR: ERROR: package:trex_game has uses-material-design: true set but the primary pubspec contains uses-material-design: false. If the application needs material icons, then uses-material-design must be set to true.

Resulting in:

melos run test
└> melos run test:select --no-select
└> FAILED
ScriptException: The script test failed to execute.

These are not related to my changes. Indeed, even when I run melos run test on the current main branch, the result is similar. I am unsure how to proceed.

@spydon
Copy link
Member

spydon commented Feb 12, 2025

That is not related to your changes, it is due to the pre-release version of Melos that we're using.
You can just push up the PR and the tests should run properly in the pipeline. :)

@spydon
Copy link
Member

spydon commented Feb 12, 2025

If you use the pre-release version of Melos I think you should be able to get it to run locally too:

dart pub global activate melos 7.0.0-dev.7

spydon added a commit that referenced this issue Feb 13, 2025
…ce method to skip per-char buildup (#3490)

This PR addresses the concerns in
#3488
For convenience, here is the relevant text.

> It is a fairly common feature for a game to "type out" dialogue within
a TextBoxComponent (as the behavior would be if timePerChar > 0, but
also allow the user to skip that type-out effect, and display the
dialogue in its entirety (as the behavior would be if timePerChar == 0).

This PR implements a setter for TextBoxComponent.boxConfig, allowing for
the TextBoxConfig to be changed after TextBoxComponent is instantiated.
The `_boxConfig` has been made non-final to allow this field to be
modifiable.

Additionally, a `skip` method is implemented which more explicitly
provides the intended skipping behavior.

---------

Co-authored-by: Lukas Klingsbo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants