mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Merge 401a078950
into 2d45fa8cd1
This commit is contained in:
commit
6bd3165e14
@ -154,6 +154,8 @@ export class HUDInteractiveTutorial extends BaseHUDPart {
|
|||||||
initialize() {
|
initialize() {
|
||||||
this.domAttach = new DynamicDomAttach(this.root, this.element, { trackHover: true });
|
this.domAttach = new DynamicDomAttach(this.root, this.element, { trackHover: true });
|
||||||
this.currentHintId = new TrackedState(this.onHintChanged, this);
|
this.currentHintId = new TrackedState(this.onHintChanged, this);
|
||||||
|
this.lastLevelHinted = this.root.hubGoals.level;
|
||||||
|
this.lastHintShown = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
onHintChanged(hintId) {
|
onHintChanged(hintId) {
|
||||||
@ -172,18 +174,22 @@ export class HUDInteractiveTutorial extends BaseHUDPart {
|
|||||||
update() {
|
update() {
|
||||||
// Compute current hint
|
// Compute current hint
|
||||||
const thisLevelHints = tutorialsByLevel[this.root.hubGoals.level - 1];
|
const thisLevelHints = tutorialsByLevel[this.root.hubGoals.level - 1];
|
||||||
|
if (this.root.hubGoals.level != this.lastLevelHinted) this.lastHintShown = 0;
|
||||||
let targetHintId = null;
|
let targetHintId = null;
|
||||||
|
|
||||||
if (thisLevelHints) {
|
if (thisLevelHints) {
|
||||||
for (let i = 0; i < thisLevelHints.length; ++i) {
|
for (let i = this.lastHintShown; i < thisLevelHints.length; ++i) {
|
||||||
const hint = thisLevelHints[i];
|
const hint = thisLevelHints[i];
|
||||||
if (hint.condition(this.root)) {
|
if (hint.condition(this.root)) {
|
||||||
targetHintId = hint.id;
|
targetHintId = hint.id;
|
||||||
|
this.lastHintShown = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (targetHintId === null) this.lastHintShown = thisLevelHints.length;
|
||||||
|
|
||||||
this.currentHintId.set(targetHintId);
|
this.currentHintId.set(targetHintId);
|
||||||
this.domAttach.update(!!targetHintId);
|
this.domAttach.update(!!targetHintId);
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ export class HUDTutorialVideoOffer extends BaseHUDPart {
|
|||||||
this.root.hud.signals.unlockNotificationFinished.add(() => {
|
this.root.hud.signals.unlockNotificationFinished.add(() => {
|
||||||
const level = this.root.hubGoals.level;
|
const level = this.root.hubGoals.level;
|
||||||
const tutorialVideoLink = THIRDPARTY_URLS.levelTutorialVideos[level];
|
const tutorialVideoLink = THIRDPARTY_URLS.levelTutorialVideos[level];
|
||||||
if (tutorialVideoLink) {
|
if (tutorialVideoLink && this.root.app.settings.getAllSettings().offerHints) {
|
||||||
const isForeign = this.root.app.settings.getLanguage() !== "en";
|
const isForeign = this.root.app.settings.getLanguage() !== "en";
|
||||||
const dialogData = isForeign
|
const dialogData = isForeign
|
||||||
? T.dialogs.tutorialVideoAvailableForeignLanguage
|
? T.dialogs.tutorialVideoAvailableForeignLanguage
|
||||||
|
Loading…
Reference in New Issue
Block a user