Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
21_22-J 38
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
21_22-J 38
21_22-J 38
Commits
ae0499a7
Commit
ae0499a7
authored
Mar 31, 2022
by
Neranga K.T.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
src->screen->memory
parent
0b34943c
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
1220 additions
and
0 deletions
+1220
-0
frontend/src/screen/memory/GameList.js
frontend/src/screen/memory/GameList.js
+63
-0
frontend/src/screen/memory/GameOverScreen.js
frontend/src/screen/memory/GameOverScreen.js
+132
-0
frontend/src/screen/memory/StartGameScreen.js
frontend/src/screen/memory/StartGameScreen.js
+21
-0
frontend/src/screen/memory/elementry/GameScreenFive.js
frontend/src/screen/memory/elementry/GameScreenFive.js
+68
-0
frontend/src/screen/memory/elementry/GameScreenFiveAll.js
frontend/src/screen/memory/elementry/GameScreenFiveAll.js
+97
-0
frontend/src/screen/memory/elementry/GameScreenFour.js
frontend/src/screen/memory/elementry/GameScreenFour.js
+74
-0
frontend/src/screen/memory/elementry/GameScreenFourAll.js
frontend/src/screen/memory/elementry/GameScreenFourAll.js
+97
-0
frontend/src/screen/memory/elementry/GameScreenOne.js
frontend/src/screen/memory/elementry/GameScreenOne.js
+74
-0
frontend/src/screen/memory/elementry/GameScreenOneAll.js
frontend/src/screen/memory/elementry/GameScreenOneAll.js
+98
-0
frontend/src/screen/memory/elementry/GameScreenSix.js
frontend/src/screen/memory/elementry/GameScreenSix.js
+68
-0
frontend/src/screen/memory/elementry/GameScreenSixAll.js
frontend/src/screen/memory/elementry/GameScreenSixAll.js
+97
-0
frontend/src/screen/memory/elementry/GameScreenThree.js
frontend/src/screen/memory/elementry/GameScreenThree.js
+68
-0
frontend/src/screen/memory/elementry/GameScreenThreeAll.js
frontend/src/screen/memory/elementry/GameScreenThreeAll.js
+97
-0
frontend/src/screen/memory/elementry/GameScreenTwo.js
frontend/src/screen/memory/elementry/GameScreenTwo.js
+68
-0
frontend/src/screen/memory/elementry/GameScreenTwoAll.js
frontend/src/screen/memory/elementry/GameScreenTwoAll.js
+98
-0
No files found.
frontend/src/screen/memory/GameList.js
0 → 100644
View file @
ae0499a7
import
{
NavigationContainer
}
from
'
@react-navigation/native
'
;
import
{
Center
}
from
'
native-base
'
;
import
React
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
FlatList
,
TouchableOpacity
}
from
'
react-native
'
;
import
CategoryItem
from
'
../../component/memory/CategoryItem
'
;
import
{
CATEGORIES
}
from
'
../../memory/data/dummy-data
'
;
const
GameList
=
({
navigation
})
=>
{
const
renderItem
=
(
itemData
)
=>
{
return
(
<
CategoryItem
id
=
{
itemData
.
item
.
id
}
title
=
{
itemData
.
item
.
title
}
image
=
{
itemData
.
item
.
url
}
onSelectGame
=
{()
=>
{
navigation
.
navigate
(
"
StartGameScreen
"
)}}
/
>
);
}
return
(
<
View
style
=
{
styles
.
screen
}
>
<
FlatList
data
=
{
CATEGORIES
}
renderItem
=
{
renderItem
}
keyExtractor
=
{(
item
,
index
)
=>
item
.
id
}
style
=
{{
width
:
'
100%
'
}}
/
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
screen
:
{
flex
:
1
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
padding
:
20
,
backgroundColor
:
'
#faf1d0
'
},
gameItem
:
{
flex
:
1
,
margin
:
15
,
height
:
200
,
backgroundColor
:
'
tomato
'
,
borderRadius
:
10
,
shadowColor
:
'
black
'
,
shadowOpacity
:
0.26
,
shadowOffset
:
{
width
:
0
,
height
:
2
},
shadowRadius
:
10
,
elevation
:
8
},
gameTitle
:{
flex
:
1
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
fontSize
:
18
},
gameText
:{
fontSize
:
18
,
fontWeight
:
'
bold
'
}
});
export
default
GameList
;
\ No newline at end of file
frontend/src/screen/memory/GameOverScreen.js
0 → 100644
View file @
ae0499a7
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Button
,
Image
}
from
'
react-native
'
;
import
Colors
from
'
../../constants/Colors
'
;
import
{
useDispatch
,
useSelector
}
from
'
react-redux
'
;
import
*
as
memoryActions
from
'
../../store/actions/memory
'
;
const
GameOverScreen
=
({
navigation
})
=>
{
const
dispatch
=
useDispatch
();
const
passedData
=
useSelector
(
state
=>
state
.
memory
.
memoryData
);
const
passedTime
=
useSelector
(
state
=>
state
.
time
.
screenTime
);
console
.
log
(
passedData
);
console
.
log
(
passedTime
);
let
totalTime
=
0
;
for
(
const
key
in
passedTime
){
totalTime
+=
passedTime
[
key
];
}
const
avgTime
=
totalTime
/
Object
.
keys
(
passedTime
).
length
;
console
.
log
(
avgTime
);
const
seconds
=
((
avgTime
%
60000
)
/
1000
).
toFixed
(
1
);
console
.
log
(
seconds
);
const
[
data
,
setData
]
=
useState
([]);
const
[
loading
,
setIsLoading
]
=
useState
(
true
);
let
disorderLevel
;
let
resultText
;
const
gameData
=
{
q1
:
passedData
.
q1
,
q2
:
passedData
.
q2
,
q3
:
passedData
.
q3
,
q4
:
passedData
.
q4
,
q5
:
passedData
.
q5
,
q6
:
passedData
.
q6
,
time
:
seconds
}
const
sendData
=
()
=>
{
fetch
(
`http://192.168.8.170:5000/get_level?q1=
${
encodeURIComponent
(
gameData
.
q1
)}
&q2=
${
encodeURIComponent
(
gameData
.
q2
)}
&q3=
${
encodeURIComponent
(
gameData
.
q3
)}
&q4=
${
encodeURIComponent
(
gameData
.
q4
)}
&q5=
${
encodeURIComponent
(
gameData
.
q5
)}
&q6=
${
encodeURIComponent
(
gameData
.
q6
)}
&time=
${
encodeURIComponent
(
gameData
.
time
)}
`
,{
method
:
'
GET
'
})
.
then
(
resp
=>
resp
.
json
())
.
then
(
data
=>
{
setData
(
data
.
results
[
0
].
level
)
setIsLoading
(
false
)
})
.
catch
(
err
=>
console
.
log
(
err
));
}
if
(
data
>=
3.0
){
disorderLevel
=
'
High
'
}
else
if
(
data
>=
1.5
)
{
disorderLevel
=
'
Medium
'
}
else
{
disorderLevel
=
'
low
'
}
if
(
!
loading
){
resultText
=
(
<
Text
style
=
{
styles
.
resultText
}
>
<
Text
>
Child
'
s disorder level is </Text> <Text style={styles.highlight}>{disorderLevel}</Text>
</Text>
);
}
return(
<View style={styles.screen}>
<Text style={styles.titleText}>Successfully Completed!</Text>
<View style={styles.imageContainer}>
<Image
fadeDuration={1000}
source={require(
'
..
/
..
/
memory
/
images
/
assets
/
success
.
png
'
)}
style={styles.image}
/>
</View>
<Button title=
'
Play
Again
'
onPress={()=>{navigation.navigate(
'
GameList
'
); setIsLoading(false); dispatch(memoryActions.clearData());}}/>
<Button title=
'
Finish
'
onPress={()=>{sendData()}}/>
<View style={styles.resultContainer}>
{/* <Text style={styles.resultText}>{!loading ? `Child
'
s
disorder
level
is
$
{
disorderLevel
}
` : ''}</Text> */}
{resultText}
</View>
</View>
);
}
const styles = StyleSheet.create({
screen: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
padding: 10
},
imageContainer: {
width: '80%',
height: 300,
borderColor: 'black',
borderWidth: 2,
borderRadius: 200,
overflow: 'hidden',
marginVertical: 30
},
image : {
width: '100%',
height: '100%'
},
titleText:{
fontSize: 24,
fontWeight: 'bold'
},
highlight: {
color : Colors.primary,
fontWeight: 'bold'
},
resultContainer: {
width: '80%',
marginHorizontal: 20,
marginVertical: 40
},
resultText: {
textAlign: 'center',
fontSize: 18
}
});
export default GameOverScreen;
\ No newline at end of file
frontend/src/screen/memory/StartGameScreen.js
0 → 100644
View file @
ae0499a7
import
React
from
'
react
'
;
import
{
Text
,
View
,
StyleSheet
,
Button
}
from
'
react-native
'
;
const
StartGameScreen
=
({
navigation
})
=>
{
return
(
<
View
style
=
{
styles
.
screen
}
>
<
Text
>
Start
Game
Screen
<
/Text
>
<
Button
title
=
'
Start
'
onPress
=
{()
=>
{
navigation
.
navigate
(
"
GameScreenOne
"
)}}
/
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
screen
:
{
flex
:
1
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
}
});
export
default
StartGameScreen
;
\ No newline at end of file
frontend/src/screen/memory/elementry/GameScreenFive.js
0 → 100644
View file @
ae0499a7
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Image
}
from
'
react-native
'
;
import
CountDown
from
'
react-native-countdown-component
'
;
const
GameScreenFive
=
({
navigation
})
=>
{
return
(
<
View
style
=
{
styles
.
sreen
}
>
<
Text
><
/Text
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
Image
source
=
{
require
(
'
../../../memory/images/elementry/5/el-fish1-main.jpg
'
)}
style
=
{
styles
.
image
}
/
>
<
/View
>
<
CountDown
size
=
{
40
}
until
=
{
5
}
// onFinish={() => alert('Finished')}
onFinish
=
{()
=>
navigation
.
navigate
(
'
GameScreenFiveAll
'
)}
digitStyle
=
{{
backgroundColor
:
'
#FFF
'
,
borderWidth
:
2
,
borderColor
:
'
#1CC625
'
}}
digitTxtStyle
=
{{
color
:
'
#1CC625
'
}}
timeLabelStyle
=
{{
color
:
'
red
'
,
fontWeight
:
'
bold
'
}}
separatorStyle
=
{{
color
:
'
#1CC625
'
}}
timeToShow
=
{[
'
S
'
]}
timeLabels
=
{{
s
:
'
Seconds
'
}}
style
=
{
styles
.
counter
}
/
>
<
Text
style
=
{
styles
.
imageText
}
>
Fish
-
මාළුවා
<
/Text
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
sreen
:
{
flex
:
1
,
padding
:
10
,
alignItems
:
'
center
'
,
},
imageContainer
:
{
width
:
'
80%
'
,
height
:
300
,
borderColor
:
'
black
'
,
borderWidth
:
2
,
overflow
:
'
hidden
'
,
marginTop
:
30
,
borderRadius
:
10
,
shadowColor
:
'
black
'
,
shadowOpacity
:
0.26
,
shadowOffset
:
{
width
:
0
,
height
:
2
},
shadowRadius
:
10
,
elevation
:
8
},
image
:
{
width
:
'
100%
'
,
height
:
'
100%
'
},
imageText
:
{
fontSize
:
24
,
fontWeight
:
'
bold
'
,
marginTop
:
30
},
counter
:
{
marginTop
:
30
}
});
export
default
GameScreenFive
;
\ No newline at end of file
frontend/src/screen/memory/elementry/GameScreenFiveAll.js
0 → 100644
View file @
ae0499a7
import
React
,{
useState
,
useEffect
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Image
,
TouchableOpacity
}
from
'
react-native
'
;
import
{
useDispatch
}
from
'
react-redux
'
;
import
*
as
memoryActions
from
'
../../../store/actions/memory
'
const
GameScreenFiveAll
=
({
navigation
})
=>
{
const
dispatch
=
useDispatch
();
const
[
time
,
setTime
]
=
useState
(
0
);
const
[
timerOn
,
setTimeOn
]
=
useState
(
true
);
useEffect
(()
=>
{
let
interval
=
null
;
if
(
timerOn
){
interval
=
setInterval
(()
=>
{
setTime
(
prevTime
=>
prevTime
+
20
)
},
10
)
}
else
{
clearInterval
(
interval
);
}
return
()
=>
clearInterval
(
interval
);
},[
timerOn
]);
return
(
<
View
style
=
{
styles
.
screen
}
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q5
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q5
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenSix
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/5/el-fish8.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q5
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q5
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenSix
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/5/el-fish2.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q5
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q5
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenSix
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/5/el-fish3.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q5
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q5
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenSix
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/5/el-fish4.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q5
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q5
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenSix
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/5/el-fish5.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q5
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q5
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenSix
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/5/el-fish6.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q5
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q5
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenSix
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/5/el-fish7.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q5
'
,
answer
:
1
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q5
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenSix
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/5/el-fish1-main.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
screen
:
{
flex
:
1
,
padding
:
10
,
alignItems
:
'
center
'
,
},
imageItem
:
{
width
:
'
48%
'
,
height
:
165
,
margin
:
5
,
borderWidth
:
1
,
borderColor
:
'
black
'
,
borderRadius
:
10
,
shadowColor
:
'
black
'
,
shadowOpacity
:
0.26
,
shadowOffset
:
{
width
:
0
,
height
:
2
},
shadowRadius
:
10
,
elevation
:
8
,
overflow
:
'
hidden
'
},
imageContainer
:
{
flexDirection
:
'
row
'
,
width
:
'
100%
'
},
image
:
{
width
:
'
100%
'
,
height
:
'
100%
'
}
});
export
default
GameScreenFiveAll
;
\ No newline at end of file
frontend/src/screen/memory/elementry/GameScreenFour.js
0 → 100644
View file @
ae0499a7
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Image
}
from
'
react-native
'
;
import
CountDown
from
'
react-native-countdown-component
'
;
const
GameScreenFour
=
({
navigation
})
=>
{
useEffect
(()
=>
{
setTimeout
(
()
=>
{
navigation
.
navigate
(
'
GameScreenFourAll
'
);
},
5000
);
});
return
(
<
View
style
=
{
styles
.
sreen
}
>
<
Text
><
/Text
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
Image
source
=
{
require
(
'
../../../memory/images/elementry/4/el-car1-main.jpg
'
)}
style
=
{
styles
.
image
}
/
>
<
/View
>
<
Text
style
=
{
styles
.
imageText
}
>
Car
-
කාරය
<
/Text
>
<
CountDown
size
=
{
40
}
until
=
{
5
}
// onFinish={() => alert('Finished')}
onFinish
=
{()
=>
navigation
.
navigate
(
'
GameScreenFourAll
'
)}
digitStyle
=
{{
backgroundColor
:
'
#FFF
'
,
borderWidth
:
2
,
borderColor
:
'
#1CC625
'
}}
digitTxtStyle
=
{{
color
:
'
#1CC625
'
}}
timeLabelStyle
=
{{
color
:
'
red
'
,
fontWeight
:
'
bold
'
}}
separatorStyle
=
{{
color
:
'
#1CC625
'
}}
timeToShow
=
{[
'
S
'
]}
timeLabels
=
{{
s
:
'
Seconds
'
}}
style
=
{
styles
.
counter
}
/
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
sreen
:
{
flex
:
1
,
padding
:
10
,
alignItems
:
'
center
'
,
},
imageContainer
:
{
width
:
'
80%
'
,
height
:
300
,
borderColor
:
'
black
'
,
borderWidth
:
2
,
overflow
:
'
hidden
'
,
marginTop
:
30
,
borderRadius
:
10
,
shadowColor
:
'
black
'
,
shadowOpacity
:
0.26
,
shadowOffset
:
{
width
:
0
,
height
:
2
},
shadowRadius
:
10
,
elevation
:
8
},
image
:
{
width
:
'
100%
'
,
height
:
'
100%
'
},
imageText
:
{
fontSize
:
24
,
fontWeight
:
'
bold
'
,
marginTop
:
30
},
counter
:
{
marginTop
:
30
}
});
export
default
GameScreenFour
;
\ No newline at end of file
frontend/src/screen/memory/elementry/GameScreenFourAll.js
0 → 100644
View file @
ae0499a7
import
React
,{
useState
,
useEffect
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Image
,
TouchableOpacity
}
from
'
react-native
'
;
import
{
useDispatch
}
from
'
react-redux
'
;
import
*
as
memoryActions
from
'
../../../store/actions/memory
'
const
GameScreenFourAll
=
({
navigation
})
=>
{
const
dispatch
=
useDispatch
();
const
[
time
,
setTime
]
=
useState
(
0
);
const
[
timerOn
,
setTimeOn
]
=
useState
(
true
);
useEffect
(()
=>
{
let
interval
=
null
;
if
(
timerOn
){
interval
=
setInterval
(()
=>
{
setTime
(
prevTime
=>
prevTime
+
20
)
},
10
)
}
else
{
clearInterval
(
interval
);
}
return
()
=>
clearInterval
(
interval
);
},[
timerOn
]);
return
(
<
View
style
=
{
styles
.
screen
}
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q4
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q4
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFive
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/4/el-car8.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q4
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q4
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFive
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/4/el-car2.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q4
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q4
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFive
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/4/el-car3.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q4
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q4
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFive
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/4/el-car4.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q4
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q4
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFive
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/4/el-car5.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q4
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q4
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFive
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/4/el-car6.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q4
'
,
answer
:
1
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q4
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFive
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/4/el-car1-main.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q4
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q4
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFive
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/4/el-car7.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
screen
:
{
flex
:
1
,
padding
:
10
,
alignItems
:
'
center
'
},
imageItem
:
{
width
:
'
48%
'
,
height
:
165
,
margin
:
5
,
borderWidth
:
1
,
borderColor
:
'
black
'
,
borderRadius
:
10
,
shadowColor
:
'
black
'
,
shadowOpacity
:
0.26
,
shadowOffset
:
{
width
:
0
,
height
:
2
},
shadowRadius
:
10
,
elevation
:
8
,
overflow
:
'
hidden
'
},
imageContainer
:
{
flexDirection
:
'
row
'
,
width
:
'
100%
'
},
image
:
{
width
:
'
100%
'
,
height
:
'
100%
'
}
});
export
default
GameScreenFourAll
;
\ No newline at end of file
frontend/src/screen/memory/elementry/GameScreenOne.js
0 → 100644
View file @
ae0499a7
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Image
,
BackHandler
}
from
'
react-native
'
;
import
Header
from
'
../../../component/memory/Header
'
;
import
CountDown
from
'
react-native-countdown-component
'
;
const
GameScreenOne
=
({
navigation
})
=>
{
// useEffect(()=>{
// const backHandler = BackHandler.addEventListener('hardwareBackPress', () => true)
// return () => backHandler.remove()
// },[]);
return
(
<
View
style
=
{
styles
.
sreen
}
>
<
Text
><
/Text
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
Image
source
=
{
require
(
'
../../../memory/images/elementry/1/elmain.jpeg
'
)}
style
=
{
styles
.
image
}
/
>
<
/View
>
<
Text
style
=
{
styles
.
imageText
}
>
Pencil
-
පැන්සල
<
/Text
>
<
CountDown
size
=
{
40
}
until
=
{
5
}
// onFinish={() => alert('Finished')}
onFinish
=
{()
=>
navigation
.
navigate
(
'
GameScreenOneAll
'
)}
digitStyle
=
{{
backgroundColor
:
'
#FFF
'
,
borderWidth
:
2
,
borderColor
:
'
#1CC625
'
}}
digitTxtStyle
=
{{
color
:
'
#1CC625
'
}}
timeLabelStyle
=
{{
color
:
'
red
'
,
fontWeight
:
'
bold
'
}}
separatorStyle
=
{{
color
:
'
#1CC625
'
}}
timeToShow
=
{[
'
S
'
]}
timeLabels
=
{{
s
:
'
Seconds
'
}}
style
=
{
styles
.
counter
}
/
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
sreen
:
{
flex
:
1
,
padding
:
10
,
alignItems
:
'
center
'
,
},
imageContainer
:
{
width
:
'
80%
'
,
height
:
300
,
borderColor
:
'
black
'
,
borderWidth
:
2
,
overflow
:
'
hidden
'
,
marginTop
:
30
,
borderRadius
:
10
,
shadowColor
:
'
black
'
,
shadowOpacity
:
0.26
,
shadowOffset
:
{
width
:
0
,
height
:
2
},
shadowRadius
:
10
,
elevation
:
8
},
image
:
{
width
:
'
100%
'
,
height
:
'
100%
'
},
imageText
:
{
fontSize
:
24
,
fontWeight
:
'
bold
'
,
marginTop
:
30
},
counter
:
{
marginTop
:
30
}
});
export
default
GameScreenOne
;
\ No newline at end of file
frontend/src/screen/memory/elementry/GameScreenOneAll.js
0 → 100644
View file @
ae0499a7
import
React
,{
useEffect
,
useState
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Image
,
TouchableOpacity
}
from
'
react-native
'
;
import
{
useSelector
,
useDispatch
}
from
'
react-redux
'
;
import
*
as
memoryActions
from
'
../../../store/actions/memory
'
const
GameScreenOneAll
=
({
navigation
})
=>
{
const
dispatch
=
useDispatch
();
const
[
time
,
setTime
]
=
useState
(
0
);
const
[
timerOn
,
setTimeOn
]
=
useState
(
true
);
useEffect
(()
=>
{
let
interval
=
null
;
if
(
timerOn
){
interval
=
setInterval
(()
=>
{
setTime
(
prevTime
=>
prevTime
+
20
)
},
10
)
}
else
{
clearInterval
(
interval
);
}
return
()
=>
clearInterval
(
interval
);
},[
timerOn
]);
return
(
<
View
style
=
{
styles
.
screen
}
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q1
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q1
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenTwo
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/1/el1.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q1
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q1
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenTwo
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/1/el2.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q1
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q1
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenTwo
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/1/el4.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q1
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q1
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenTwo
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/1/el5.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q1
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q1
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenTwo
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/1/el6.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q1
'
,
answer
:
1
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q1
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenTwo
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/1/elmain.jpeg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q1
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q1
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenTwo
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/1/el7.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q1
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q1
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenTwo
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/1/el3.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
screen
:
{
flex
:
1
,
padding
:
10
,
alignItems
:
'
center
'
},
imageItem
:
{
width
:
'
48%
'
,
height
:
165
,
margin
:
5
,
borderWidth
:
1
,
borderColor
:
'
black
'
,
borderRadius
:
10
,
shadowColor
:
'
black
'
,
shadowOpacity
:
0.26
,
shadowOffset
:
{
width
:
0
,
height
:
2
},
shadowRadius
:
10
,
elevation
:
8
,
overflow
:
'
hidden
'
},
imageContainer
:
{
flexDirection
:
'
row
'
,
width
:
'
100%
'
},
image
:
{
width
:
'
100%
'
,
height
:
'
100%
'
}
});
export
default
GameScreenOneAll
;
\ No newline at end of file
frontend/src/screen/memory/elementry/GameScreenSix.js
0 → 100644
View file @
ae0499a7
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Image
}
from
'
react-native
'
;
import
CountDown
from
'
react-native-countdown-component
'
;
const
GameScreenSix
=
({
navigation
})
=>
{
return
(
<
View
style
=
{
styles
.
sreen
}
>
<
Text
><
/Text
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
Image
source
=
{
require
(
'
../../../memory/images/elementry/6/el-kite1-main.jpg
'
)}
style
=
{
styles
.
image
}
/
>
<
/View
>
<
Text
style
=
{
styles
.
imageText
}
>
Pencil
-
පැන්සල
<
/Text
>
<
CountDown
size
=
{
40
}
until
=
{
5
}
// onFinish={() => alert('Finished')}
onFinish
=
{()
=>
navigation
.
navigate
(
'
GameScreenSixAll
'
)}
digitStyle
=
{{
backgroundColor
:
'
#FFF
'
,
borderWidth
:
2
,
borderColor
:
'
#1CC625
'
}}
digitTxtStyle
=
{{
color
:
'
#1CC625
'
}}
timeLabelStyle
=
{{
color
:
'
red
'
,
fontWeight
:
'
bold
'
}}
separatorStyle
=
{{
color
:
'
#1CC625
'
}}
timeToShow
=
{[
'
S
'
]}
timeLabels
=
{{
s
:
'
Seconds
'
}}
style
=
{
styles
.
counter
}
/
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
sreen
:
{
flex
:
1
,
padding
:
10
,
alignItems
:
'
center
'
,
},
imageContainer
:
{
width
:
'
80%
'
,
height
:
300
,
borderColor
:
'
black
'
,
borderWidth
:
2
,
overflow
:
'
hidden
'
,
marginTop
:
30
,
borderRadius
:
10
,
shadowColor
:
'
black
'
,
shadowOpacity
:
0.26
,
shadowOffset
:
{
width
:
0
,
height
:
2
},
shadowRadius
:
10
,
elevation
:
8
},
image
:
{
width
:
'
100%
'
,
height
:
'
100%
'
},
imageText
:
{
fontSize
:
24
,
fontWeight
:
'
bold
'
,
marginTop
:
30
},
counter
:
{
marginTop
:
30
}
});
export
default
GameScreenSix
;
\ No newline at end of file
frontend/src/screen/memory/elementry/GameScreenSixAll.js
0 → 100644
View file @
ae0499a7
import
React
,{
useState
,
useEffect
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Image
,
TouchableOpacity
}
from
'
react-native
'
;
import
{
useDispatch
}
from
'
react-redux
'
;
import
*
as
memoryActions
from
'
../../../store/actions/memory
'
;
const
GameScreenSixAll
=
({
navigation
})
=>
{
const
dispatch
=
useDispatch
();
const
[
time
,
setTime
]
=
useState
(
0
);
const
[
timerOn
,
setTimeOn
]
=
useState
(
true
);
useEffect
(()
=>
{
let
interval
=
null
;
if
(
timerOn
){
interval
=
setInterval
(()
=>
{
setTime
(
prevTime
=>
prevTime
+
20
)
},
10
)
}
else
{
clearInterval
(
interval
);
}
return
()
=>
clearInterval
(
interval
);
},[
timerOn
]);
return
(
<
View
style
=
{
styles
.
screen
}
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q6
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q6
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameOverScreen
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/6/el-kite6.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q6
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q6
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameOverScreen
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/6/el-kite2.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q6
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q6
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameOverScreen
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/6/el-kite3.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q6
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q6
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameOverScreen
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/6/el-kite4.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q6
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q6
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameOverScreen
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/6/el-kite5.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q6
'
,
answer
:
1
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q6
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameOverScreen
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/6/el-kite1-main.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q6
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q6
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameOverScreen
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/6/el-kite7.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q6
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q6
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameOverScreen
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/6/el-kite8.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
screen
:
{
flex
:
1
,
padding
:
10
,
alignItems
:
'
center
'
},
imageItem
:
{
width
:
'
48%
'
,
height
:
165
,
margin
:
5
,
borderWidth
:
1
,
borderColor
:
'
black
'
,
borderRadius
:
10
,
shadowColor
:
'
black
'
,
shadowOpacity
:
0.26
,
shadowOffset
:
{
width
:
0
,
height
:
2
},
shadowRadius
:
10
,
elevation
:
8
,
overflow
:
'
hidden
'
},
imageContainer
:
{
flexDirection
:
'
row
'
,
width
:
'
100%
'
},
image
:
{
width
:
'
100%
'
,
height
:
'
100%
'
}
});
export
default
GameScreenSixAll
;
\ No newline at end of file
frontend/src/screen/memory/elementry/GameScreenThree.js
0 → 100644
View file @
ae0499a7
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Image
}
from
'
react-native
'
;
import
CountDown
from
'
react-native-countdown-component
'
;
const
GameScreenThree
=
({
navigation
})
=>
{
return
(
<
View
style
=
{
styles
.
sreen
}
>
<
Text
><
/Text
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
Image
source
=
{
require
(
'
../../../memory/images/elementry/3/el-flo1-main.jpg
'
)}
style
=
{
styles
.
image
}
/
>
<
/View
>
<
Text
style
=
{
styles
.
imageText
}
>
Flower
-
මල
<
/Text
>
<
CountDown
size
=
{
40
}
until
=
{
5
}
// onFinish={() => alert('Finished')}
onFinish
=
{()
=>
navigation
.
navigate
(
'
GameScreenThreeAll
'
)}
digitStyle
=
{{
backgroundColor
:
'
#FFF
'
,
borderWidth
:
2
,
borderColor
:
'
#1CC625
'
}}
digitTxtStyle
=
{{
color
:
'
#1CC625
'
}}
timeLabelStyle
=
{{
color
:
'
red
'
,
fontWeight
:
'
bold
'
}}
separatorStyle
=
{{
color
:
'
#1CC625
'
}}
timeToShow
=
{[
'
S
'
]}
timeLabels
=
{{
s
:
'
Seconds
'
}}
style
=
{
styles
.
counter
}
/
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
sreen
:
{
flex
:
1
,
padding
:
10
,
alignItems
:
'
center
'
,
},
imageContainer
:
{
width
:
'
80%
'
,
height
:
300
,
borderColor
:
'
black
'
,
borderWidth
:
2
,
overflow
:
'
hidden
'
,
marginTop
:
30
,
borderRadius
:
10
,
shadowColor
:
'
black
'
,
shadowOpacity
:
0.26
,
shadowOffset
:
{
width
:
0
,
height
:
2
},
shadowRadius
:
10
,
elevation
:
8
},
image
:
{
width
:
'
100%
'
,
height
:
'
100%
'
},
imageText
:
{
fontSize
:
24
,
fontWeight
:
'
bold
'
,
marginTop
:
30
},
counter
:
{
marginTop
:
30
}
});
export
default
GameScreenThree
;
\ No newline at end of file
frontend/src/screen/memory/elementry/GameScreenThreeAll.js
0 → 100644
View file @
ae0499a7
import
React
,{
useState
,
useEffect
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Image
,
TouchableOpacity
}
from
'
react-native
'
;
import
{
useDispatch
}
from
'
react-redux
'
;
import
*
as
memoryActions
from
'
../../../store/actions/memory
'
;
const
GameScreenThreeAll
=
({
navigation
})
=>
{
const
dispatch
=
useDispatch
();
const
[
time
,
setTime
]
=
useState
(
0
);
const
[
timerOn
,
setTimeOn
]
=
useState
(
true
);
useEffect
(()
=>
{
let
interval
=
null
;
if
(
timerOn
){
interval
=
setInterval
(()
=>
{
setTime
(
prevTime
=>
prevTime
+
20
)
},
10
)
}
else
{
clearInterval
(
interval
);
}
return
()
=>
clearInterval
(
interval
);
},[
timerOn
]);
return
(
<
View
style
=
{
styles
.
screen
}
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q3
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q3
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFour
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/3/el-flo8.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q3
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q3
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFour
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/3/el-flo2.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q3
'
,
answer
:
1
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q3
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFour
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/3/el-flo1-main.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q3
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q3
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFour
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/3/el-flo3.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q3
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q3
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFour
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/3/el-flo4.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q3
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q3
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFour
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/3/el-flo5.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q3
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q3
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFour
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/3/el-flo6.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q3
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q3
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenFour
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/3/el-flo7.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
screen
:
{
flex
:
1
,
padding
:
10
,
alignItems
:
'
center
'
},
imageItem
:
{
width
:
'
48%
'
,
height
:
165
,
margin
:
5
,
borderWidth
:
1
,
borderColor
:
'
black
'
,
borderRadius
:
10
,
shadowColor
:
'
black
'
,
shadowOpacity
:
0.26
,
shadowOffset
:
{
width
:
0
,
height
:
2
},
shadowRadius
:
10
,
elevation
:
8
,
overflow
:
'
hidden
'
},
imageContainer
:
{
flexDirection
:
'
row
'
,
width
:
'
100%
'
},
image
:
{
width
:
'
100%
'
,
height
:
'
100%
'
}
});
export
default
GameScreenThreeAll
;
\ No newline at end of file
frontend/src/screen/memory/elementry/GameScreenTwo.js
0 → 100644
View file @
ae0499a7
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Image
}
from
'
react-native
'
;
import
CountDown
from
'
react-native-countdown-component
'
;
const
GameScreenTwo
=
({
navigation
})
=>
{
return
(
<
View
style
=
{
styles
.
sreen
}
>
<
Text
><
/Text
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
Image
source
=
{
require
(
'
../../../memory/images/elementry/2/el-ball1-main.jpg
'
)}
style
=
{
styles
.
image
}
/
>
<
/View
>
<
Text
style
=
{
styles
.
imageText
}
>
Ball
-
බෝලය
<
/Text
>
<
CountDown
size
=
{
40
}
until
=
{
5
}
// onFinish={() => alert('Finished')}
onFinish
=
{()
=>
navigation
.
navigate
(
'
GameScreenTwoAll
'
)}
digitStyle
=
{{
backgroundColor
:
'
#FFF
'
,
borderWidth
:
2
,
borderColor
:
'
#1CC625
'
}}
digitTxtStyle
=
{{
color
:
'
#1CC625
'
}}
timeLabelStyle
=
{{
color
:
'
red
'
,
fontWeight
:
'
bold
'
}}
separatorStyle
=
{{
color
:
'
#1CC625
'
}}
timeToShow
=
{[
'
S
'
]}
timeLabels
=
{{
s
:
'
Seconds
'
}}
style
=
{
styles
.
counter
}
/
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
sreen
:
{
flex
:
1
,
padding
:
10
,
alignItems
:
'
center
'
,
},
imageContainer
:
{
width
:
'
80%
'
,
height
:
300
,
borderColor
:
'
black
'
,
borderWidth
:
2
,
overflow
:
'
hidden
'
,
marginTop
:
30
,
borderRadius
:
10
,
shadowColor
:
'
black
'
,
shadowOpacity
:
0.26
,
shadowOffset
:
{
width
:
0
,
height
:
2
},
shadowRadius
:
10
,
elevation
:
8
},
image
:
{
width
:
'
100%
'
,
height
:
'
100%
'
},
imageText
:
{
fontSize
:
24
,
fontWeight
:
'
bold
'
,
marginTop
:
30
},
counter
:
{
marginTop
:
30
}
});
export
default
GameScreenTwo
;
\ No newline at end of file
frontend/src/screen/memory/elementry/GameScreenTwoAll.js
0 → 100644
View file @
ae0499a7
import
{
NavigationContainer
}
from
'
@react-navigation/native
'
;
import
React
,
{
useState
,
useEffect
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Image
,
TouchableOpacity
}
from
'
react-native
'
;
import
{
useDispatch
}
from
'
react-redux
'
;
import
*
as
memoryActions
from
'
../../../store/actions/memory
'
const
GameScreenTwoAll
=
({
navigation
})
=>
{
const
dispatch
=
useDispatch
();
const
[
time
,
setTime
]
=
useState
(
0
);
const
[
timerOn
,
setTimeOn
]
=
useState
(
true
);
useEffect
(()
=>
{
let
interval
=
null
;
if
(
timerOn
){
interval
=
setInterval
(()
=>
{
setTime
(
prevTime
=>
prevTime
+
20
)
},
10
)
}
else
{
clearInterval
(
interval
);
}
return
()
=>
clearInterval
(
interval
);
},[
timerOn
]);
return
(
<
View
style
=
{
styles
.
screen
}
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q2
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q2
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenThree
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/2/el-ball8.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q2
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q2
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenThree
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/2/el-ball2.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q2
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q2
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenThree
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/2/el-ball3.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q2
'
,
answer
:
1
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q2
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenThree
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/2/el-ball1-main.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q2
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q2
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenThree
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/2/el-ball4.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q2
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q2
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenThree
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/2/el-ball5.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
View
style
=
{
styles
.
imageContainer
}
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q2
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q2
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenThree
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/2/el-ball6.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
activeOpacity
=
{
0.7
}
style
=
{
styles
.
imageItem
}
onPress
=
{()
=>
{
dispatch
(
memoryActions
.
setAnswers
({
question
:
'
q2
'
,
answer
:
0
}));
setTimeOn
(
false
);
dispatch
(
memoryActions
.
setTime
({
question
:
'
q2
'
,
time
:
time
}));
navigation
.
navigate
(
'
GameScreenThree
'
)}}
>
<
Image
style
=
{
styles
.
image
}
source
=
{
require
(
'
../../../memory/images/elementry/2/el-ball7.jpg
'
)}
/
>
<
/TouchableOpacity
>
<
/View
>
<
/View
>
);
}
const
styles
=
StyleSheet
.
create
({
screen
:
{
flex
:
1
,
padding
:
10
,
alignItems
:
'
center
'
,
},
imageItem
:
{
width
:
'
48%
'
,
height
:
165
,
margin
:
5
,
borderWidth
:
1
,
borderColor
:
'
black
'
,
borderRadius
:
10
,
shadowColor
:
'
black
'
,
shadowOpacity
:
0.26
,
shadowOffset
:
{
width
:
0
,
height
:
2
},
shadowRadius
:
10
,
elevation
:
8
,
overflow
:
'
hidden
'
},
imageContainer
:
{
flexDirection
:
'
row
'
,
width
:
'
100%
'
},
image
:
{
width
:
'
100%
'
,
height
:
'
100%
'
}
});
export
default
GameScreenTwoAll
;
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment