|
@ -11,6 +11,7 @@ import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons'; |
|
|
import Icons from '../themes/Icons'; |
|
|
import Icons from '../themes/Icons'; |
|
|
import Colors from "../themes/Colors"; |
|
|
import Colors from "../themes/Colors"; |
|
|
import Metrics from "../themes/Metrics"; |
|
|
import Metrics from "../themes/Metrics"; |
|
|
|
|
|
import { addFinished } from "../redux/actions/UserActions"; |
|
|
|
|
|
|
|
|
function AdditionGame(props){ |
|
|
function AdditionGame(props){ |
|
|
|
|
|
|
|
@ -77,8 +78,14 @@ function AdditionGame(props){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function selectAnswer(answer){ |
|
|
function selectAnswer(answer){ |
|
|
//fix
|
|
|
let currentChallenge = addChallenge[challengeState.current]; |
|
|
if (true) { |
|
|
let outcome = ( |
|
|
|
|
|
answer === ( |
|
|
|
|
|
currentChallenge.left + currentChallenge.right |
|
|
|
|
|
) |
|
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
if (outcome) { |
|
|
answers.current = answers.current + 1; |
|
|
answers.current = answers.current + 1; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -101,13 +108,13 @@ function AdditionGame(props){ |
|
|
setHeaderColor(styles.darkGreen); |
|
|
setHeaderColor(styles.darkGreen); |
|
|
setHeaderText(finalTime + ' s'); |
|
|
setHeaderText(finalTime + ' s'); |
|
|
setTimerState(4); |
|
|
setTimerState(4); |
|
|
// dispatch(squareFinished(answers.current, finalTime));
|
|
|
dispatch(addFinished(answers.current, finalTime)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function generateLine(left, right, pairIndex) { |
|
|
function generateLine(left, right, pairIndex) { |
|
|
return ( |
|
|
return ( |
|
|
<Fade key={pairIndex} faded={challengeState.current !== pairIndex} duration={250}> |
|
|
<Fade key={pairIndex} faded={challengeState.current !== pairIndex} duration={250}> |
|
|
<View style={[styles.buttonMargin]}> |
|
|
<View style={[styles.buttonMargin, styles.addQuestionHeight]}> |
|
|
<Text style={[styles.headerTitleFont, styles.darkText, styles.centeredText]}> |
|
|
<Text style={[styles.headerTitleFont, styles.darkText, styles.centeredText]}> |
|
|
{left + ' + ' + right + ' = '} |
|
|
{left + ' + ' + right + ' = '} |
|
|
</Text> |
|
|
</Text> |
|
@ -134,9 +141,10 @@ function AdditionGame(props){ |
|
|
origin={scrollOrigin} |
|
|
origin={scrollOrigin} |
|
|
destination={scrollDestination.current} |
|
|
destination={scrollDestination.current} |
|
|
duration={250} |
|
|
duration={250} |
|
|
|
|
|
style={{overflow: 'hidden'}} |
|
|
> |
|
|
> |
|
|
<View style={[styles.gameView]} /> |
|
|
|
|
|
{squareMemo} |
|
|
{squareMemo} |
|
|
|
|
|
<Fade faded={challengeState.current < 20} duration={250}> |
|
|
<View style={[styles.gameView, styles.flexRow, styles.spaceEvenly, styles.centeredItems]}> |
|
|
<View style={[styles.gameView, styles.flexRow, styles.spaceEvenly, styles.centeredItems]}> |
|
|
<MaterialIcon |
|
|
<MaterialIcon |
|
|
name={Icons.squareIcons.check} |
|
|
name={Icons.squareIcons.check} |
|
@ -147,6 +155,7 @@ function AdditionGame(props){ |
|
|
Finish |
|
|
Finish |
|
|
</Text> |
|
|
</Text> |
|
|
</View> |
|
|
</View> |
|
|
|
|
|
</Fade> |
|
|
</Autoscroll> |
|
|
</Autoscroll> |
|
|
</View> |
|
|
</View> |
|
|
<View style={[styles.timerView, styles.dark, styles.centeredJustify]}> |
|
|
<View style={[styles.timerView, styles.dark, styles.centeredJustify]}> |
|
|