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

Resolve some problems in the control guide #554

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions src/client/java/minicraft/screen/TutorialDisplayHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static void loadTutorialElement(String criterionName, JSONObject json) {
private static ControlGuide currentGuide = null;

static {
controlGuides.add(new ControlGuide(120, "move-up|move-down|move-left|move-right",
controlGuides.add(new ControlGuide(300, "move-up|move-down|move-left|move-right",
() -> Localization.getLocalized("minicraft.control_guide.move",
String.format("%s|%s|%s|%s", Game.input.getMapping("move-up"),
Game.input.getMapping("move-left"), Game.input.getMapping("move-down"),
Expand Down Expand Up @@ -90,16 +90,11 @@ private ControlGuide(int duration, String key, Supplier<String> display) {
}

private void tick() {
if (this.key.contains("|")) {
InputHandler.Key key = new InputHandler.Key();
for (String keyposs: this.key.split("\\|")) {
InputHandler.Key aKey = Game.input.getKey(keyposs);
key.down = key.down || aKey.down;
key.clicked = key.clicked || aKey.clicked;
if (key.contains("|")) {
for (String k : key.split("\\|")) {
if (Game.input.inputDown(k)) interactedDuration++;
}

if (key.down) interactedDuration++;
} else if (Game.input.getKey(key).down)
} else if (Game.input.inputDown(key))
interactedDuration++;
}
}
Expand Down Expand Up @@ -188,7 +183,8 @@ public static void tick(InputHandler input) {
return;
}

currentGuide.tick();
if (Game.getDisplay() == null)
currentGuide.tick();
}

if (currentOngoingElement != null) {
Expand Down