|
@@ -67,6 +67,10 @@ class GameMainScreen extends React.Component<Props, State> {
|
67
|
67
|
this.startGame();
|
68
|
68
|
}
|
69
|
69
|
|
|
70
|
+ componentWillUnmount() {
|
|
71
|
+ this.logic.stopGame();
|
|
72
|
+ }
|
|
73
|
+
|
70
|
74
|
getRightButton = () => {
|
71
|
75
|
return <MaterialHeaderButtons>
|
72
|
76
|
<Item title="pause" iconName="pause" onPress={this.togglePause}/>
|
|
@@ -168,32 +172,6 @@ class GameMainScreen extends React.Component<Props, State> {
|
168
|
172
|
});
|
169
|
173
|
}
|
170
|
174
|
|
171
|
|
- showGameOverConfirm() {
|
172
|
|
- let message = i18n.t("screens.game.gameOver.score") + this.state.gameScore + '\n';
|
173
|
|
- message += i18n.t("screens.game.gameOver.level") + this.state.gameLevel + '\n';
|
174
|
|
- message += i18n.t("screens.game.gameOver.time") + this.getFormattedTime(this.state.gameTime) + '\n';
|
175
|
|
- const onDismiss = () => {
|
176
|
|
- this.onDialogDismiss();
|
177
|
|
- this.startGame();
|
178
|
|
- };
|
179
|
|
- this.setState({
|
180
|
|
- dialogVisible: true,
|
181
|
|
- dialogTitle: i18n.t("screens.game.gameOver.text"),
|
182
|
|
- dialogMessage: message,
|
183
|
|
- dialogButtons: [
|
184
|
|
- {
|
185
|
|
- title: i18n.t("screens.game.gameOver.exit"),
|
186
|
|
- onPress: () => this.props.navigation.goBack()
|
187
|
|
- },
|
188
|
|
- {
|
189
|
|
- title: i18n.t("screens.game.resume"),
|
190
|
|
- onPress: onDismiss
|
191
|
|
- }
|
192
|
|
- ],
|
193
|
|
- onDialogDismiss: onDismiss,
|
194
|
|
- });
|
195
|
|
- }
|
196
|
|
-
|
197
|
175
|
startGame = () => {
|
198
|
176
|
this.logic.startGame(this.onTick, this.onClock, this.onGameEnd);
|
199
|
177
|
this.setState({
|