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
71a14976
Commit
71a14976
authored
May 03, 2022
by
Neranga K.T.
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'it18256888' into 'master'
It18256888 See merge request
!190
parents
26dbdad4
d1ee0c97
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
15 deletions
+54
-15
frontend/src/component/memory/MainButton.js
frontend/src/component/memory/MainButton.js
+1
-1
frontend/src/screen/memory/GameLevel.js
frontend/src/screen/memory/GameLevel.js
+22
-6
frontend/src/screen/memory/GameOverScreen.js
frontend/src/screen/memory/GameOverScreen.js
+3
-2
frontend/src/screen/memory/elementry/GameScreenOne.js
frontend/src/screen/memory/elementry/GameScreenOne.js
+4
-4
frontend/src/store/actions/memory.js
frontend/src/store/actions/memory.js
+5
-0
frontend/src/store/reducers/memory.js
frontend/src/store/reducers/memory.js
+19
-2
No files found.
frontend/src/component/memory/MainButton.js
View file @
71a14976
...
...
@@ -4,7 +4,7 @@ import Colors from '../../constants/Colors'
const
MainButton
=
(
props
)
=>
{
return
(
<
TouchableOpacity
onPress
=
{
props
.
onPress
}
>
<
TouchableOpacity
disabled
=
{
props
.
disabled
}
onPress
=
{
props
.
onPress
}
>
<
View
style
=
{{...
styles
.
button
,
...
props
.
styles
}}
>
<
Text
style
=
{
styles
.
buttonText
}
>
{
props
.
children
}
<
/Text
>
<
/View
>
...
...
frontend/src/screen/memory/GameLevel.js
View file @
71a14976
...
...
@@ -2,10 +2,26 @@ import { Center, Column, Row } from 'native-base';
import
React
,
{
useState
}
from
'
react
'
;
import
{
Text
,
View
,
StyleSheet
,
Button
,
ScrollView
,
Image
,
ImageBackground
,
TouchableOpacity
,
Modal
,
Alert
,
Pressable
}
from
'
react-native
'
;
import
MainButton
from
'
../../component/memory/MainButton
'
;
import
{
useDispatch
,
useSelector
}
from
'
react-redux
'
;
import
{
Icon
}
from
'
react-native-elements
'
;
const
GameLevel
=
({
navigation
})
=>
{
const
[
modalVisible
,
setModalVisible
]
=
useState
(
false
);
const
[
mediumModalVisible
,
setMediumModalVisible
]
=
useState
(
false
);
const
status
=
useSelector
(
state
=>
state
.
memory
.
is_passed
.
status
);
const
level
=
useSelector
(
state
=>
state
.
memory
.
is_passed
.
level
);
console
.
log
(
status
);
console
.
log
(
level
);
React
.
useEffect
(()
=>
{
const
unsubscribe
=
navigation
.
addListener
(
'
focus
'
,
()
=>
{
});
return
unsubscribe
;
},
[
navigation
]);
return
(
<
ScrollView
>
<
Modal
...
...
@@ -81,15 +97,15 @@ const GameLevel = ({navigation}) => {
<
/View
>
<
/View
>
<
View
style
=
{
styles
.
screen
}
>
<
MainButton
styles
=
{
styles
.
elementryBtn
}
onPress
=
{()
=>
setModalVisible
(
true
)}
>
Elementry
<
MainButton
disabled
=
{
false
}
styles
=
{
styles
.
elementryBtn
}
onPress
=
{()
=>
setModalVisible
(
true
)}
>
<
Icon
name
=
"
unlock-alt
"
type
=
"
font-awesome
"
size
=
{
36
}
color
=
"
white
"
/>
Elementry
<
/MainButton
>
<
MainButton
styles
=
{
styles
.
mediumBtn
}
onPress
=
{()
=>
{
setMediumModalVisible
(
true
)}}
>
<
MainButton
disabled
=
{
!
status
?
true
:
false
}
styles
=
{
styles
.
mediumBtn
}
onPress
=
{()
=>
{
setMediumModalVisible
(
true
)}}
>
{
/* navigation.navigate('MediumLevelStart') */
}
Medium
<
Icon
name
=
{
status
?
'
unlock-alt
'
:
'
lock
'
}
type
=
"
font-awesome
"
size
=
{
36
}
color
=
"
white
"
/>
Medium
<
/MainButton
>
<
MainButton
styles
=
{
styles
.
advanceBtn
}
onPress
=
{()
=>
{
navigation
.
navigate
(
'
AdvanceLevelStart
'
)}}
>
Advance
<
MainButton
disabled
=
{
true
}
styles
=
{
styles
.
advanceBtn
}
onPress
=
{()
=>
{
navigation
.
navigate
(
'
AdvanceLevelStart
'
)}}
>
<
Icon
name
=
"
lock
"
type
=
"
font-awesome
"
size
=
{
36
}
color
=
"
white
"
/>
Advance
<
/MainButton
>
<
/View
>
<
/ScrollView
>
...
...
frontend/src/screen/memory/GameOverScreen.js
View file @
71a14976
...
...
@@ -60,9 +60,9 @@ const GameOverScreen = ({navigation}) => {
.
catch
(
err
=>
console
.
log
(
err
));
}
if
(
data
>=
3.0
){
if
(
data
>=
2.9
){
disorderLevel
=
'
High
'
;
}
else
if
(
data
>=
1.
5
)
{
}
else
if
(
data
>=
1.
99
)
{
disorderLevel
=
'
Medium
'
;
}
else
{
disorderLevel
=
'
low
'
;
...
...
@@ -88,6 +88,7 @@ const GameOverScreen = ({navigation}) => {
if
(
!
loading
){
insertData
();
dispatch
(
memoryActions
.
levelPassed
({
level
:
disorderLevel
,
status
:
true
}));
resultText
=
(
// <Text style={styles.resultText}>
// <Text>Child's disorder level is </Text> <Text style={styles.highlight}>{disorderLevel}</Text>
...
...
frontend/src/screen/memory/elementry/GameScreenOne.js
View file @
71a14976
...
...
@@ -9,10 +9,10 @@ import Countdown from '../../../constants/Countdown';
const
GameScreenOne
=
({
navigation
})
=>
{
//
useEffect(()=>{
//
const backHandler = BackHandler.addEventListener('hardwareBackPress', () => true)
//
return () => backHandler.remove()
//
},[]);
useEffect
(()
=>
{
const
backHandler
=
BackHandler
.
addEventListener
(
'
hardwareBackPress
'
,
()
=>
true
)
return
()
=>
backHandler
.
remove
()
},[]);
const
dispatch
=
useDispatch
();
...
...
frontend/src/store/actions/memory.js
View file @
71a14976
...
...
@@ -2,6 +2,7 @@ export const SET_ANSWERS = 'SET_ANSWERS';
export
const
SET_TIME
=
'
SET_TIME
'
;
export
const
CLEAR_DATA
=
'
CLEAR_DATA
'
;
export
const
SET_GAME_LEVEL
=
'
SET_GAME_LEVEL
'
;
export
const
PASS
=
'
PASS
'
;
export
const
setGameLevel
=
(
level
)
=>
{
return
{
type
:
SET_GAME_LEVEL
,
level
:
level
}
...
...
@@ -17,4 +18,8 @@ export const setTime = (time) => {
export
const
clearData
=
()
=>
{
return
{
type
:
CLEAR_DATA
}
}
export
const
levelPassed
=
(
status
)
=>
{
return
{
type
:
PASS
,
status
:
status
}
}
\ No newline at end of file
frontend/src/store/reducers/memory.js
View file @
71a14976
import
{
CLEAR_DATA
,
SET_ANSWERS
,
SET_GAME_LEVEL
,
SET_TIME
}
from
"
../actions/memory
"
;
import
{
CLEAR_DATA
,
SET_ANSWERS
,
SET_GAME_LEVEL
,
SET_TIME
,
PASS
}
from
"
../actions/memory
"
;
const
initialState
=
{
gameLevel
:
null
,
memoryData
:
{},
screenTime
:
{}
screenTime
:
{},
is_passed
:
{
level
:
null
,
status
:
false
}
}
const
memoryReducer
=
(
state
=
initialState
,
action
)
=>
{
...
...
@@ -44,6 +48,19 @@ const memoryReducer = (state=initialState, action) => {
gameLevel
:
null
}
case
PASS
:
const
levelPassed
=
action
.
level
;
const
PassedStatus
=
action
.
status
;
return
{
...
state
,
is_passed
:
{
level
:
levelPassed
,
status
:
PassedStatus
}
}
default
:
return
state
}
...
...
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