Skip to content

Commit

Permalink
Merge pull request #299 from TruncateGame/feat/rule-events
Browse files Browse the repository at this point in the history
Rule events + return of the tutorial menu
  • Loading branch information
bglw authored Feb 16, 2025
2 parents 55dd1c9 + 52d46dc commit d5c82a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
6 changes: 6 additions & 0 deletions truncate_client/src/regions/rules.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,8 @@ impl RulesState {
.centered_button(theme.button_emphasis, theme.text, &self.map_texture, ui)
.clicked()
{
self.event_dispatcher
.event(format!("tutorial_core_rules_go_puzzle"));
action = Some(RuleCardAction::DailyPuzzle);
}
ui.add_space(text_padding * 2.0);
Expand All @@ -407,6 +409,8 @@ impl RulesState {
.centered_button(theme.water.lighten(), theme.text, &self.map_texture, ui)
.clicked()
{
self.event_dispatcher
.event(format!("tutorial_core_rules_go_tutorial"));
action = Some(RuleCardAction::Tutorial);
}

Expand All @@ -415,6 +419,8 @@ impl RulesState {
.centered_button(theme.water.lighten(), theme.text, &self.map_texture, ui)
.clicked()
{
self.event_dispatcher
.event(format!("tutorial_core_rules_go_menu"));
back_to_menu();
}
ui.add_space(text_padding);
Expand Down
18 changes: 7 additions & 11 deletions web_client/src/_includes/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -560,27 +560,23 @@ <h2>Many thanks to the word data sources:</h2>
});

if (has_played_tut) {
this.button("Learn To Play", () => {
localStorage.setItem("tutorial_played", "true");
truncate_runner.join_game('RULE_CARD');
this.button("Tutorials", () => {
this.learnStage();
});
// Uncomment if adding back a second tutorial
// this.button("Tutorials", () => {
// this.learnStage();
// });
}
}

learnStage() {
this.reset();

this.button("Learn To Play", () => {
this.button("Quick Start", () => {
localStorage.setItem("tutorial_played", "true");
truncate_runner.join_game('TUTORIAL_RULES');
truncate_runner.join_game('RULE_CARD');
});

this.button("Example Game", () => {
truncate_runner.join_game('TUTORIAL_EXAMPLE');
this.button("Interactive Tutorial", () => {
localStorage.setItem("tutorial_played", "true");
truncate_runner.join_game('TUTORIAL_RULES');
});

this.backButton();
Expand Down

0 comments on commit d5c82a9

Please sign in to comment.