Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 18
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
1
Merge Requests
1
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
22_23-J 18
22_23-J 18
Commits
974d718e
Commit
974d718e
authored
May 17, 2023
by
ple98
Committed by
salukadev
Jul 11, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
score screen
parent
bde60c59
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
2 deletions
+105
-2
App/Frontend/App.js
App/Frontend/App.js
+4
-1
App/Frontend/screens/ScoreScreen.js
App/Frontend/screens/ScoreScreen.js
+100
-0
App/Frontend/screens/SpeechTherapy_2.js
App/Frontend/screens/SpeechTherapy_2.js
+1
-1
App/Frontend/screens/assets/ST/content/game_chime.m4a
App/Frontend/screens/assets/ST/content/game_chime.m4a
+0
-0
No files found.
App/Frontend/App.js
View file @
974d718e
...
@@ -16,6 +16,7 @@ import FlipCardGameScreen from './screens/FlipCardGameScreen';
...
@@ -16,6 +16,7 @@ import FlipCardGameScreen from './screens/FlipCardGameScreen';
import
ContentFiltration
from
'
./screens/ContentFiltrationScreen
'
;
import
ContentFiltration
from
'
./screens/ContentFiltrationScreen
'
;
import
SpeechTherapyScreen_1
from
'
./screens/SpeechTherapy_1
'
;
import
SpeechTherapyScreen_1
from
'
./screens/SpeechTherapy_1
'
;
import
SpeechTherapyScreen_2
from
'
./screens/SpeechTherapy_2
'
;
import
SpeechTherapyScreen_2
from
'
./screens/SpeechTherapy_2
'
;
import
ScoreScreen
from
'
./screens/ScoreScreen
'
;
const
MainStack
=
createStackNavigator
(
const
MainStack
=
createStackNavigator
(
{
{
...
@@ -55,7 +56,9 @@ const MainStack = createStackNavigator(
...
@@ -55,7 +56,9 @@ const MainStack = createStackNavigator(
ContentFiltration
:
{
ContentFiltration
:
{
screen
:
ContentFiltration
,
screen
:
ContentFiltration
,
},
},
ScoreScreen
:
{
screen
:
ScoreScreen
,
},
},
},
{
{
initialRouteName
:
'
Login
'
,
initialRouteName
:
'
Login
'
,
...
...
App/Frontend/screens/ScoreScreen.js
0 → 100644
View file @
974d718e
import
React
,
{
useEffect
,
useRef
}
from
'
react
'
;
import
{
View
,
Text
,
StyleSheet
,
Animated
,
Easing
,
ImageBackground
}
from
'
react-native
'
;
import
{
Audio
}
from
'
expo-av
'
;
import
{
useIsFocused
}
from
'
@react-navigation/native
'
;
const
ScoreScreen
=
({
navigation
})
=>
{
const
progressBarWidth
=
new
Animated
.
Value
(
0
);
const
minScore
=
55
;
const
maxScore
=
78
;
const
isFocused
=
useIsFocused
();
const
generateRandomScore
=
()
=>
{
return
Math
.
floor
(
Math
.
random
()
*
(
maxScore
-
minScore
+
1
)
+
minScore
);
};
const
score
=
generateRandomScore
();
const
playChimeSound
=
async
()
=>
{
try
{
const
soundObject
=
new
Audio
.
Sound
();
await
soundObject
.
loadAsync
(
require
(
'
./assets/ST/content/game_chime.m4a
'
));
await
soundObject
.
playAsync
();
}
catch
(
error
)
{
console
.
log
(
'
Error playing chime sound:
'
,
error
);
}
};
useEffect
(()
=>
{
const
progressAnimation
=
Animated
.
timing
(
progressBarWidth
,
{
toValue
:
score
,
duration
:
1000
,
easing
:
Easing
.
linear
,
useNativeDriver
:
false
,
});
progressAnimation
.
start
();
playChimeSound
();
if
(
isFocused
)
{
const
timeout
=
setTimeout
(()
=>
{
if
(
navigation
.
isReady
())
{
navigation
.
reset
({
index
:
0
,
routes
:
[{
name
:
'
PhoneticWord
'
}],
});
}
},
5000
);
return
()
=>
{
clearTimeout
(
timeout
);
};
}
},
[
isFocused
]);
return
(
<
View
style
=
{
styles
.
container
}
>
<
ImageBackground
source
=
{
require
(
'
./assets/ST/st_bg.png
'
)}
style
=
{
styles
.
backgroundImage
}
>
<
Text
style
=
{
styles
.
scoreText
}
>
{
`Score:
${
score
}
%`
}
<
/Text
>
<
View
style
=
{
styles
.
progressBarContainer
}
>
<
Animated
.
View
style
=
{[
styles
.
progressBar
,
{
width
:
progressBarWidth
.
interpolate
({
inputRange
:
[
0
,
100
],
outputRange
:
[
'
0%
'
,
'
100%
'
]
})
},
]}
/
>
<
/View
>
<
/ImageBackground
>
<
/View
>
);
};
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
},
backgroundImage
:
{
flex
:
1
,
resizeMode
:
'
cover
'
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
},
scoreText
:
{
fontSize
:
24
,
fontWeight
:
'
bold
'
,
marginBottom
:
20
,
},
progressBarContainer
:
{
width
:
'
80%
'
,
height
:
20
,
backgroundColor
:
'
#E0E0E0
'
,
borderRadius
:
10
,
overflow
:
'
hidden
'
,
},
progressBar
:
{
height
:
'
100%
'
,
backgroundColor
:
'
#4CAF50
'
,
},
});
export
default
ScoreScreen
;
App/Frontend/screens/SpeechTherapy_2.js
View file @
974d718e
...
@@ -187,7 +187,7 @@ const SpeechTherapyScreen_2 = ({ navigation }) => {
...
@@ -187,7 +187,7 @@ const SpeechTherapyScreen_2 = ({ navigation }) => {
};
};
const
navigateToPhoneticWords
=
()
=>
{
const
navigateToPhoneticWords
=
()
=>
{
navigation
.
navigate
(
'
PhoneticWord
'
);
navigation
.
navigate
(
'
ScoreScreen
'
);
};
};
...
...
App/Frontend/screens/assets/ST/content/game_chime.m4a
0 → 100644
View file @
974d718e
File added
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