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
a41e2df6
Commit
a41e2df6
authored
May 17, 2023
by
ple98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
score screen
parent
0391a513
Changes
4
Hide 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 @
a41e2df6
...
...
@@ -15,6 +15,7 @@ import PhoneticWordScreen from './screens/PhoneticWordsScreen';
import
FlipCardGameScreen
from
'
./screens/FlipCardGameScreen
'
;
import
SpeechTherapyScreen_1
from
'
./screens/SpeechTherapy_1
'
;
import
SpeechTherapyScreen_2
from
'
./screens/SpeechTherapy_2
'
;
import
ScoreScreen
from
'
./screens/ScoreScreen
'
;
const
MainStack
=
createStackNavigator
(
{
...
...
@@ -51,7 +52,9 @@ const MainStack = createStackNavigator(
FlipCardGame
:
{
screen
:
FlipCardGameScreen
,
},
ScoreScreen
:
{
screen
:
ScoreScreen
,
},
},
{
initialRouteName
:
'
Login
'
,
...
...
App/Frontend/screens/ScoreScreen.js
0 → 100644
View file @
a41e2df6
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 @
a41e2df6
...
...
@@ -187,7 +187,7 @@ const SpeechTherapyScreen_2 = ({ navigation }) => {
};
const
navigateToPhoneticWords
=
()
=>
{
navigation
.
navigate
(
'
PhoneticWord
'
);
navigation
.
navigate
(
'
ScoreScreen
'
);
};
...
...
App/Frontend/screens/assets/ST/content/game_chime.m4a
0 → 100644
View file @
a41e2df6
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