Commit cb3a6ded authored by Lihinikaduwa D.N.R.  's avatar Lihinikaduwa D.N.R.

Merge branch 'master' of http://gitlab.sliit.lk/21_22-j-38/21_22j-38 into it18257632

parents a8337d89 4f05db76
{
"name": "firstapp",
"version": "0.0.1",
"lockfileVersion": 2,
"lockfileVersion": 1,
"requires": true,
"packages": {
"": {
......@@ -22513,14 +22513,6 @@
"resolved": "https://registry.npmjs.org/strict-uri-encode/-/strict-uri-encode-2.0.0.tgz",
"integrity": "sha1-ucczDHBChi9rFC3CdLvMWGbONUY="
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
},
"string-hash-64": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/string-hash-64/-/string-hash-64-1.0.3.tgz",
......@@ -22600,6 +22592,14 @@
"define-properties": "^1.1.3"
}
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"requires": {
"safe-buffer": "~5.1.0"
}
},
"strip-ansi": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz",
......
import React, { useEffect, useState } from 'react';
import { View, StyleSheet, ScrollView } from 'react-native';
import { Table, TableWrapper, Row, Rows, Col } from 'react-native-table-component';
import AsyncStorage from '@react-native-async-storage/async-storage';
import client from '../screen/client/Client';
const userId = 1;
// const [tableContent, setTableContent] = useState();
const CONTENT = {
tableHead: ['Date', 'Time', 'Name', 'Result'],
tableData: [],
};
const CONTENT2 = {
tableHead: ['Date', 'Time', 'Name', 'Result'],
tableData: [
['1 jan 2022', '2s', 'Red', 'Good'],
['2 jan 2022', '2s', 'Green', 'Good'],
['3 jan 2022', '2s', 'Black', 'Good'],
['4 jan 2022', '2s', 'White', 'Good'],
['5 jan 2022', '2s', 'Blue', 'Good'],
['6 jan 2022', '2s', 'Yellow', 'Good'],
export default function App() {
],
};
const [tableData, setTableData] = useState({
tableHead: ['Date', 'Time', 'Name', 'Result'],
data: [],
});
export default function App() {
useEffect(() => {
getResult(userId);
}, []);
function getResult(userId) {
async function getResult(userId) {
client.get('getColorActivitiesResult/'+userId, {
await client.get('getColorActivitiesResult/' + userId, {
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
},
}).then((response) => {
CONTENT.tableData = response.data.data
console.log(CONTENT.tableData);
console.log(CONTENT2.tableData);
// CONTENT.tableData = response.data.data
setTableData({
tableHead: ['Date', 'Time', 'Name', 'Result'],
data: response.data.data,
});
// console.log(CONTENT.tableData);
// userId = 5
// console.log(CONTENT2.tableData);
}).catch(err => {
console.log(err);
});
}
useEffect(() => {
getResult(userId);
}, []);
return (
<ScrollView>
<View style={styles.container}>
<Table borderStyle={{ borderWidth: 3, borderColor: '#fff' }}>
<Table borderStyle={{ borderWidth: 5, borderColor: '#fff' }}>
<Row
data={CONTENT.tableHead}
data={tableData.tableHead}
flexArr={[1, 1, 1, 1]}
style={styles.head}
textStyle={styles.text}
/>
<TableWrapper style={styles.wrapper}>
<Rows
data={CONTENT2.tableData}
data={tableData.data}
flexArr={[1, 1, 1, 1]}
style={styles.row}
textStyle={styles.text}
......
......@@ -15,7 +15,7 @@ const styles = StyleSheet.create({
width: '100%',
height: 90,
paddingTop: 36,
backgroundColor: Colors.primary,
backgroundColor: '#5fcf93',
justifyContent: 'center',
alignItems: 'center'
},
......
import React from 'react'
import {StyleSheet, View, Text, TouchableOpacity} from 'react-native'
import Colors from '../../constants/Colors'
const MainButton = (props) => {
return(
<TouchableOpacity onPress={props.onPress}>
<View style={{...styles.button, ...props.styles}}>
<Text style={styles.buttonText}>{props.children}</Text>
</View>
</TouchableOpacity>
);
};
const styles = StyleSheet.create({
button: {
backgroundColor: Colors.primary,
paddingVertical: 30,
paddingHorizontal: 30,
borderRadius: 25,
marginBottom: 20
},
buttonText: {
color: 'white',
fontSize: 30,
fontWeight: 'bold',
textAlign: 'center'
}
});
export default MainButton;
\ No newline at end of file
export default {
elementry: 7,
elementry: 5,
medium: 5,
advance: 2
advance: 3
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ import Home from '../screen/Home';
import Start from '../screen/Start';
import Register from '../screen/auth/Register';
import Login from '../screen/auth/Login';
import Splash from '../screen/splash/Splash';
import Splash from '../screen/splash/splash';
import Color from '../screen/Color';
import Blue from '../screen/activity/Blue';
import Blue2 from '../screen/activity/Blue2';
......@@ -210,7 +210,7 @@ const AppRouter = () => {
options={{
title: 'Memory Games',
headerTintColor: 'white',
headerStyle: {backgroundColor: Colors.primary},
headerStyle: {backgroundColor: '#5fcf93'}
}}
/>
<Stack.Screen
......@@ -220,7 +220,7 @@ const AppRouter = () => {
headerShown: true,
title: 'Game Start',
headerTintColor: 'white',
headerStyle: {backgroundColor: Colors.primary},
headerStyle: {backgroundColor: '#5fcf93'},
}}
/>
<Stack.Screen
......@@ -290,7 +290,7 @@ const AppRouter = () => {
headerShown: true,
title: 'Game Over',
headerTintColor: 'white',
headerStyle: {backgroundColor: Colors.primary},
headerStyle: {backgroundColor: '#5fcf93'},
}}
/>
<Stack.Screen
......@@ -300,8 +300,8 @@ const AppRouter = () => {
headerShown: true,
title: 'Results',
headerTintColor: 'white',
headerStyle: {backgroundColor: Colors.primary},
}}
headerStyle: {backgroundColor: '#5fcf93'},
}}
/>
<Stack.Screen
name="GameLevel"
......@@ -310,8 +310,8 @@ const AppRouter = () => {
headerShown: true,
title: 'Levels',
headerTintColor: 'white',
headerStyle: {backgroundColor: Colors.primary},
}}
headerStyle: {backgroundColor: '#5fcf93'},
}}
/>
<Stack.Screen
name="MediumLevelStart"
......@@ -320,8 +320,8 @@ const AppRouter = () => {
headerShown: true,
title: 'Medium Level',
headerTintColor: 'white',
headerStyle: {backgroundColor: Colors.primary},
}}
headerStyle: {backgroundColor: '#5fcf93'},
}}
/>
<Stack.Screen
name="AdvanceLevelStart"
......@@ -330,8 +330,8 @@ const AppRouter = () => {
headerShown: true,
title: 'Advance Level',
headerTintColor: 'white',
headerStyle: {backgroundColor: Colors.primary},
}}
headerStyle: {backgroundColor: '#5fcf93'},
}}
/>
<Stack.Screen
options={{headerShown: false}}
......
......@@ -244,7 +244,7 @@ export default function Red({ navigation }) {
const startRecording = async () => {
// setModalVisible(true);
setModalVisible(true);
try {
await Voice.start('en-US');
......
import { Center, Column, Row } from 'native-base';
import React from 'react';
import {Text, View, StyleSheet, Button} from 'react-native';
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';
const GameLevel = ({navigation}) => {
const [modalVisible, setModalVisible] = useState(false);
const [mediumModalVisible, setMediumModalVisible] = useState(false);
return (
<View style={styles.screen} >
<View style={styles.levelWrapper}>
<View style={styles.levelContainer}>
<Button style={styles.btn} title='Elementry' onPress={()=>{navigation.navigate('StartGameScreen')}} />
<Button style={styles.btn} title='Medium' onPress={()=>{navigation.navigate('MediumLevelStart')}} />
<Button style={styles.btn} title='Advance' onPress={()=>{navigation.navigate('AdvanceLevelStart')}} />
</View>
<ScrollView>
<Modal
animationType="slide"
transparent={true}
visible={modalVisible}
onRequestClose={() => {
Alert.alert("Modal has been closed.");
setModalVisible(!modalVisible);
}}
>
<View style={styles.centeredView}>
<View style={styles.modalView}>
<Text style={styles.modalText}>Select matching images, 5 seconds will be given for each!</Text>
<Text style={styles.modalTextBold}>Are you ready?</Text>
<View style={{ flexDirection: 'row' }} >
<Pressable
style={[styles.button, styles.buttonClose]}
onPress={() => {setModalVisible(!modalVisible); navigation.navigate('GameScreenOne'); }}
>
<Text style={styles.textStyle}>Yes</Text>
</Pressable>
<Pressable
style={[styles.button, styles.buttonClose]}
onPress={() => {setModalVisible(!modalVisible)}}
>
<Text style={styles.textStyle}>No</Text>
</Pressable>
</View>
</View>
</View>
</Modal>
<Modal
animationType="slide"
transparent={true}
visible={mediumModalVisible}
onRequestClose={() => {
Alert.alert("Modal has been closed.");
setModalVisible(!mediumModalVisible);
}}
>
<View style={styles.centeredView}>
<View style={styles.modalView}>
<Text style={styles.modalText}>Select matching images, 5 seconds will be given for each!</Text>
<Text style={styles.modalTextBold}>Are you ready?</Text>
<View style={{ flexDirection: 'row' }} >
<Pressable
style={[styles.button, styles.buttonClose]}
onPress={() => {setModalVisible(!mediumModalVisible); navigation.navigate('MediumGameScreenOne'); }}
>
<Text style={styles.textStyle}>Yes</Text>
</Pressable>
<Pressable
style={[styles.button, styles.buttonClose]}
onPress={() => {setMediumModalVisible(!mediumModalVisible)}}
>
<Text style={styles.textStyle}>No</Text>
</Pressable>
</View>
</View>
</View>
</Modal>
<View style={{ marginBottom: 20 }}>
<View style={styles.gameItemRow}>
<ImageBackground source={{ uri: 'https://cdn.pixabay.com/photo/2014/09/21/21/31/flowers-455591_960_720.jpg' }}
style={styles.image}>
{/* <Text style={styles.title}>Play Memo</Text> */}
<View style={styles.titleContainer}>
<Text style={styles.title} numberOfLines={1}>Play Memo</Text>
</View>
</ImageBackground>
</View>
</View>
<View style={styles.screen} >
<MainButton styles={styles.elementryBtn} onPress={() => setModalVisible(true)}>
Elementry
</MainButton>
<MainButton styles={styles.mediumBtn} onPress={()=>{setMediumModalVisible(true)}}>
{/* navigation.navigate('MediumLevelStart') */}
Medium
</MainButton>
<MainButton styles={styles.advanceBtn} onPress={()=>{navigation.navigate('AdvanceLevelStart')}}>
Advance
</MainButton>
</View>
</ScrollView>
// <View style={styles.screen} >
// <View style={styles.levelWrapper}>
// <View style={styles.levelContainer}>
// <Button style={styles.btn} title='Elementry' onPress={()=>{navigation.navigate('StartGameScreen')}} />
// <Button style={styles.btn} title='Medium' onPress={()=>{navigation.navigate('MediumLevelStart')}} />
// <Button style={styles.btn} title='Advance' onPress={()=>{navigation.navigate('AdvanceLevelStart')}} />
// </View>
// </View>
// </View>
);
}
......@@ -34,10 +123,91 @@ const styles = StyleSheet.create({
justifyContent: 'center',
alignItems: 'center'
},
btn: {
maxWidth: '100%',
height: 30
}
elementryBtn: {
backgroundColor: '#6dce99'
},
mediumBtn: {
backgroundColor: '#4285F4'
},
advanceBtn: {
backgroundColor: '#DB4437'
},
image: {
height: 250,
width: '100%',
},
title: {
color: 'white',
fontWeight: 'bold',
fontSize: 30,
textAlign: 'center',
},
titleContainer: {
position: 'absolute',
padding: 20,
backgroundColor: 'rgba(0,0,0,0.5)',
bottom: 0,
width: '100%'
},
bgImage: {
height: '100%',
width: '100%',
justifyContent: 'flex-end'
},
gameItemRow: {
flexDirection: 'row',
},
centeredView: {
flex: 1,
justifyContent: "center",
alignItems: "center",
marginTop: 22
},
modalView: {
margin: 20,
backgroundColor: "white",
borderRadius: 20,
padding: 35,
alignItems: "center",
shadowColor: "#000",
shadowOffset: {
width: 0,
height: 2
},
shadowOpacity: 0.25,
shadowRadius: 4,
elevation: 5
},
button: {
borderRadius: 20,
padding: 10,
elevation: 2,
marginHorizontal: 10
},
buttonOpen: {
backgroundColor: "#F194FF",
},
buttonClose: {
backgroundColor: "#2196F3",
},
textStyle: {
color: "white",
fontWeight: "bold",
textAlign: "center",
fontSize: 20
},
modalText: {
marginBottom: 15,
textAlign: "center",
fontSize: 20
},
modalTextBold: {
marginBottom: 15,
textAlign: "center",
fontSize: 20,
fontWeight: 'bold'
}
});
export default GameLevel;
......
......@@ -61,11 +61,11 @@ const GameOverScreen = ({navigation}) => {
}
if(data>=3.0){
disorderLevel = 'High'
disorderLevel = 'High';
}else if (data>=1.5) {
disorderLevel = 'Medium'
disorderLevel = 'Medium';
} else {
disorderLevel = 'low'
disorderLevel = 'low';
}
const insertData = () => {
......@@ -89,8 +89,11 @@ const GameOverScreen = ({navigation}) => {
if(!loading){
insertData();
resultText=(
// <Text style={styles.resultText}>
// <Text>Child's disorder level is </Text> <Text style={styles.highlight}>{disorderLevel}</Text>
// </Text>
<Text style={styles.resultText}>
<Text>Child's disorder level is </Text> <Text style={styles.highlight}>{disorderLevel}</Text>
{disorderLevel == 'High' ? `Hmm...It looks like you have to keep remember more...` : disorderLevel == 'Medium' ? `Hey...nicely played! Good!` : 'Wow! You are Excellent!'}
</Text>
);
}
......@@ -101,16 +104,23 @@ const GameOverScreen = ({navigation}) => {
<View style={styles.imageContainer}>
<Image
fadeDuration={1000}
source={require('../../memory/images/assets/success.png')}
source={require('../../memory/images/assets/navo2.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 style={styles.buttonContainer}>
<View style={styles.button}>
<Button color={'#4285F4'} title='Play Again' onPress={()=>{navigation.navigate('GameList'); setIsLoading(false); dispatch(memoryActions.clearData());}}/>
</View>
<View style={styles.button}>
<Button color={'#DB4437'} title='Finish' onPress={()=>{sendData()}}/>
</View>
</View>
</View>
);
}
......@@ -125,10 +135,10 @@ const styles = StyleSheet.create({
imageContainer: {
width: '80%',
height: 300,
borderColor: 'black',
borderWidth: 2,
// borderColor: 'black',
// borderWidth: 2,
borderRadius: 200,
overflow: 'hidden',
// overflow: 'hidden',
marginVertical: 30
},
image : {
......@@ -150,8 +160,19 @@ const styles = StyleSheet.create({
},
resultText: {
textAlign: 'center',
fontSize: 18
}
fontSize: 22,
fontWeight: 'bold'
},
buttonContainer: {
flexDirection: 'row',
width: 300,
maxWidth: '80%',
justifyContent: 'space-between',
marginTop: 20
},
button: {
width: '40%'
},
});
export default GameOverScreen;
\ No newline at end of file
import React from 'react';
import {Text, View, StyleSheet, Button} from 'react-native';
import {Text, View, StyleSheet, Button, Image, ImageBackground} from 'react-native';
const StartGameScreen = ({navigation}) => {
return(
<View style={styles.screen}>
<Text>Start Game Screen</Text>
<Button title='Start' onPress={()=>{navigation.navigate("GameScreenOne")}}/>
{/* <ImageBackground source={require('../../memory/images/assets/gameback.png')} resizeMode="cover" style={styles.imageback}> */}
<View style={styles.imageContainer}>
<Text style={{ fontSize: 20, fontWeight: 'bold' }}>Select matching images</Text>
<Image
fadeDuration={1000}
source={require('../../memory/images/assets/navo1.png')}
style={styles.image}
/>
</View>
<Button title='Start' onPress={()=>{navigation.navigate("GameScreenOne")}}/>
{/* </ImageBackground> */}
</View>
);
}
......@@ -15,7 +24,28 @@ const styles = StyleSheet.create({
flex: 1,
justifyContent: 'center',
alignItems: 'center'
}
},
imageContainer: {
alignItems: 'center',
width: '80%',
height: 300,
// borderColor: 'black',
// borderWidth: 2,
borderRadius: 200,
// overflow: 'hidden',
marginVertical: 30
},
image : {
width: '100%',
height: '100%'
},
// imageback: {
// flex: 1,
// justifyContent: 'center',
// width: '100%',
// height: '100%',
// padding: 20
// }
});
export default StartGameScreen;
\ No newline at end of file
......@@ -27,7 +27,7 @@ const GameScreenFive = ({navigation}) => {
timeLabels={{s: 'Seconds'}}
style={styles.counter}
/>
<Text style={styles.imageText}>Fish - මාළුවා</Text>
<Text style={styles.imageText}>Fish</Text>
</View>
);
}
......
......@@ -4,12 +4,6 @@ import CountDown from 'react-native-countdown-component';
import Countdown from '../../../constants/Countdown';
const GameScreenFour = ({navigation}) => {
useEffect(()=>{
setTimeout( () => {
navigation.navigate('GameScreenFourAll');
}, 5000 );
});
return(
<View style={styles.sreen}>
......@@ -20,7 +14,7 @@ const GameScreenFour = ({navigation}) => {
style={styles.image}
/>
</View>
<Text style={styles.imageText}>Car - කාරය</Text>
<Text style={styles.imageText}>Car</Text>
<CountDown
size={40}
until={Countdown.elementry}
......
......@@ -29,7 +29,7 @@ const GameScreenOne = ({navigation}) => {
style={styles.image}
/>
</View>
<Text style={styles.imageText}>Pencil - පැන්සල</Text>
<Text style={styles.imageText}>Pencil</Text>
<CountDown
size={40}
until={Countdown.elementry}
......
......@@ -14,7 +14,7 @@ const GameScreenSix = ({navigation}) => {
style={styles.image}
/>
</View>
<Text style={styles.imageText}>Pencil - පැන්සල</Text>
<Text style={styles.imageText}>Pencil</Text>
<CountDown
size={40}
until={Countdown.elementry}
......
......@@ -14,7 +14,7 @@ const GameScreenThree = ({navigation}) => {
style={styles.image}
/>
</View>
<Text style={styles.imageText}>Flower - මල</Text>
<Text style={styles.imageText}>Flower</Text>
<CountDown
size={40}
until={Countdown.elementry}
......
......@@ -14,7 +14,7 @@ const GameScreenTwo = ({navigation}) => {
style={styles.image}
/>
</View>
<Text style={styles.imageText}>Ball - බෝලය</Text>
<Text style={styles.imageText}>Ball</Text>
<CountDown
size={40}
until={Countdown.elementry}
......
......@@ -14,6 +14,7 @@ const MediumGameScreenFive = ({navigation}) => {
style={styles.image}
/>
</View>
<Text style={styles.imageText}>Shadow of Horse</Text>
<CountDown
size={40}
until={Countdown.medium}
......
......@@ -14,7 +14,7 @@ const MediumGameScreenFour = ({navigation}) => {
style={styles.image}
/>
</View>
<Text style={styles.imageText}>Car - කාරය</Text>
<Text style={styles.imageText}>A boy with a balloon</Text>
<CountDown
size={40}
until={Countdown.medium}
......
......@@ -29,7 +29,7 @@ const MediumGameScreenOne = ({navigation}) => {
style={styles.image}
/>
</View>
<Text style={styles.imageText}>Pencil - පැන්සල</Text>
<Text style={styles.imageText}>Birds</Text>
<CountDown
size={40}
until={Countdown.medium}
......
......@@ -14,7 +14,7 @@ const MediumGameScreenSix = ({navigation}) => {
style={styles.image}
/>
</View>
<Text style={styles.imageText}>Pencil - පැන්සල</Text>
<Text style={styles.imageText}>Arrow</Text>
<CountDown
size={40}
until={Countdown.medium}
......
......@@ -14,7 +14,7 @@ const MediumGameScreenThree = ({navigation}) => {
style={styles.image}
/>
</View>
<Text style={styles.imageText}>Flower - මල</Text>
<Text style={styles.imageText}>Circle and Rectangle</Text>
<CountDown
size={40}
until={Countdown.medium}
......
......@@ -14,7 +14,7 @@ const MediumGameScreenTwo = ({navigation}) => {
style={styles.image}
/>
</View>
<Text style={styles.imageText}>Ball - බෝලය</Text>
<Text style={styles.imageText}>Boy with a bicycle</Text>
<CountDown
size={40}
until={Countdown.medium}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment