Compare commits
No commits in common. "0e741a02e20c7b90426f74abe845280b912cc291" and "a3ce3a76c391fe4669e211b034c80e3ddddcc6c3" have entirely different histories.
0e741a02e2
...
a3ce3a76c3
3 changed files with 14 additions and 19 deletions
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 1.7 KiB |
|
|
@ -98,9 +98,6 @@ function MainStackComponent(props: {
|
||||||
MainStack,
|
MainStack,
|
||||||
GameStartScreen,
|
GameStartScreen,
|
||||||
i18n.t('screens.game.title'),
|
i18n.t('screens.game.title'),
|
||||||
true,
|
|
||||||
null,
|
|
||||||
'transparent',
|
|
||||||
)}
|
)}
|
||||||
<MainStack.Screen
|
<MainStack.Screen
|
||||||
name="game-main"
|
name="game-main"
|
||||||
|
|
|
||||||
|
|
@ -384,24 +384,22 @@ class GameStartScreen extends React.Component<PropsType> {
|
||||||
recoverGameScore() {
|
recoverGameScore() {
|
||||||
const {route} = this.props;
|
const {route} = this.props;
|
||||||
this.gameStats = route.params;
|
this.gameStats = route.params;
|
||||||
if (this.gameStats.score != null) {
|
this.isHighScore =
|
||||||
this.isHighScore =
|
this.scores.length === 0 || this.gameStats.score > this.scores[0];
|
||||||
this.scores.length === 0 || this.gameStats.score > this.scores[0];
|
for (let i = 0; i < 3; i += 1) {
|
||||||
for (let i = 0; i < 3; i += 1) {
|
if (this.scores.length > i && this.gameStats.score > this.scores[i]) {
|
||||||
if (this.scores.length > i && this.gameStats.score > this.scores[i]) {
|
this.scores.splice(i, 0, this.gameStats.score);
|
||||||
this.scores.splice(i, 0, this.gameStats.score);
|
break;
|
||||||
break;
|
} else if (this.scores.length <= i) {
|
||||||
} else if (this.scores.length <= i) {
|
this.scores.push(this.gameStats.score);
|
||||||
this.scores.push(this.gameStats.score);
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (this.scores.length > 3) this.scores.splice(3, 1);
|
|
||||||
AsyncStorageManager.set(
|
|
||||||
AsyncStorageManager.PREFERENCES.gameScores.key,
|
|
||||||
this.scores,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
if (this.scores.length > 3) this.scores.splice(3, 1);
|
||||||
|
AsyncStorageManager.set(
|
||||||
|
AsyncStorageManager.PREFERENCES.gameScores.key,
|
||||||
|
this.scores,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): React.Node {
|
render(): React.Node {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue