Added mascot dialog on game first start
This commit is contained in:
parent
3989652c29
commit
746303b35a
4 changed files with 47 additions and 1 deletions
|
@ -379,6 +379,11 @@
|
||||||
"level": "Level: ",
|
"level": "Level: ",
|
||||||
"time": "Time: ",
|
"time": "Time: ",
|
||||||
"exit": "leave Game"
|
"exit": "leave Game"
|
||||||
|
},
|
||||||
|
"mascotDialog": {
|
||||||
|
"title": "Play !",
|
||||||
|
"message": "Play.",
|
||||||
|
"button": "Yes !"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"debug": {
|
"debug": {
|
||||||
|
|
|
@ -378,6 +378,11 @@
|
||||||
"level": "Niveau: ",
|
"level": "Niveau: ",
|
||||||
"time": "Temps: ",
|
"time": "Temps: ",
|
||||||
"exit": "Quitter"
|
"exit": "Quitter"
|
||||||
|
},
|
||||||
|
"mascotDialog": {
|
||||||
|
"title": "Jeu !",
|
||||||
|
"message": "Jouer.",
|
||||||
|
"button": "Oui !"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"debug": {
|
"debug": {
|
||||||
|
|
|
@ -100,6 +100,11 @@ export default class AsyncStorageManager {
|
||||||
default: '1',
|
default: '1',
|
||||||
current: '',
|
current: '',
|
||||||
},
|
},
|
||||||
|
gameStartShowBanner: {
|
||||||
|
key: 'gameStartShowBanner',
|
||||||
|
default: '1',
|
||||||
|
current: '',
|
||||||
|
},
|
||||||
proxiwashWatchedMachines: {
|
proxiwashWatchedMachines: {
|
||||||
key: 'proxiwashWatchedMachines',
|
key: 'proxiwashWatchedMachines',
|
||||||
default: '[]',
|
default: '[]',
|
||||||
|
|
|
@ -5,6 +5,10 @@ import {StackNavigationProp} from "@react-navigation/stack";
|
||||||
import type {CustomTheme} from "../../../managers/ThemeManager";
|
import type {CustomTheme} from "../../../managers/ThemeManager";
|
||||||
import {Button, Headline, withTheme} from "react-native-paper";
|
import {Button, Headline, withTheme} from "react-native-paper";
|
||||||
import {View} from "react-native";
|
import {View} from "react-native";
|
||||||
|
import i18n from "i18n-js";
|
||||||
|
import {MASCOT_STYLE} from "../../../components/Mascot/Mascot";
|
||||||
|
import MascotPopup from "../../../components/Mascot/MascotPopup";
|
||||||
|
import AsyncStorageManager from "../../../managers/AsyncStorageManager";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
navigation: StackNavigationProp,
|
navigation: StackNavigationProp,
|
||||||
|
@ -12,11 +16,23 @@ type Props = {
|
||||||
}
|
}
|
||||||
|
|
||||||
type State = {
|
type State = {
|
||||||
|
mascotDialogVisible: boolean,
|
||||||
}
|
}
|
||||||
|
|
||||||
class GameStartScreen extends React.Component<Props, State> {
|
class GameStartScreen extends React.Component<Props, State> {
|
||||||
|
|
||||||
|
state = {
|
||||||
|
mascotDialogVisible: AsyncStorageManager.getInstance().preferences.gameStartShowBanner.current === "1",
|
||||||
|
}
|
||||||
|
|
||||||
|
hideMascotDialog = () => {
|
||||||
|
AsyncStorageManager.getInstance().savePref(
|
||||||
|
AsyncStorageManager.getInstance().preferences.gameStartShowBanner.key,
|
||||||
|
'0'
|
||||||
|
);
|
||||||
|
this.setState({mascotDialogVisible: false})
|
||||||
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1}}>
|
<View style={{flex: 1}}>
|
||||||
|
@ -27,6 +43,21 @@ class GameStartScreen extends React.Component<Props, State> {
|
||||||
>
|
>
|
||||||
PLAY
|
PLAY
|
||||||
</Button>
|
</Button>
|
||||||
|
<MascotPopup
|
||||||
|
visible={this.state.mascotDialogVisible}
|
||||||
|
title={i18n.t("screens.game.mascotDialog.title")}
|
||||||
|
message={i18n.t("screens.game.mascotDialog.message")}
|
||||||
|
icon={"gamepad-variant"}
|
||||||
|
buttons={{
|
||||||
|
action: null,
|
||||||
|
cancel: {
|
||||||
|
message: i18n.t("screens.game.mascotDialog.button"),
|
||||||
|
icon: "check",
|
||||||
|
onPress: this.hideMascotDialog,
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
emotion={MASCOT_STYLE.COOL}
|
||||||
|
/>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue