Skip to content

Commit

Permalink
Resolve some problems in control guide
Browse files Browse the repository at this point in the history
  • Loading branch information
BenCheung0422 authored and Makkkkus committed Nov 6, 2023
1 parent f5d6a87 commit 2bc6fa8
Showing 1 changed file with 7 additions and 11 deletions.
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

0 comments on commit 2bc6fa8

Please sign in to comment.