disable tutorial via localstorage"

This commit is contained in:
ntr 2019-10-31 16:59:26 +11:00
parent 0ce19240f7
commit 38177f84e9

View File

@ -2,6 +2,7 @@ const preact = require('preact');
const actions = require('./actions');
function tutorialConstructDisplay(player, instance, tutorial, navInstance, i) {
if (localStorage.getItem('tutorial-complete')) return false;
if (instance.time_control === 'Practice' && instance.rounds.length === 1 && tutorial && tutorial < 6) {
if (tutorial <= 2 || (tutorial > 2 && i > 0)) {
const mobileVisible = navInstance === i + 1;
@ -13,12 +14,14 @@ function tutorialConstructDisplay(player, instance, tutorial, navInstance, i) {
}
function tutorialShouldDisableEquip(tutorial, iter, instance, construct) {
if (localStorage.getItem('tutorial-complete')) return false;
return tutorial && tutorial === 6 && iter === 0 && construct.skills.length !== 0
&& instance.time_control === 'Practice' && instance.rounds.length === 1;
}
function tutorialVbox(player, store, tutorial) {
if (localStorage.getItem('tutorial-complete')) return false;
let stage = tutorial;
const { vbox } = player;
if (stage === 1) {
@ -99,11 +102,15 @@ function tutorialVbox(player, store, tutorial) {
}
function tutorialStage(tutorial, ws, clearTutorial, instance) {
if (localStorage.getItem('tutorial-complete')) return false;
if (!(instance.time_control === 'Practice' && instance.rounds.length === 1)) return false;
const exit = () => {
clearTutorial();
localStorage.setItem('tutorial-complete', true);
ws.sendInstanceState(instance.id);
};
const tutorialText = () => {
if (tutorial === 1) {
return (