Compare commits
No commits in common. "560c3367593d87b9459c3d5e35773b004a63d9d3" and "b2ff90855f4c974d66eaa2a830842e8a9e722514" have entirely different histories.
560c336759
...
b2ff90855f
9 changed files with 109 additions and 106 deletions
|
|
@ -95,7 +95,6 @@
|
|||
},
|
||||
"home": {
|
||||
"title": "Campus",
|
||||
"feedTitle": "Amicale's News",
|
||||
"feed": "Details",
|
||||
"dashboard": {
|
||||
"seeMore": "Click to see more",
|
||||
|
|
|
|||
|
|
@ -95,7 +95,6 @@
|
|||
},
|
||||
"home": {
|
||||
"title": "Campus",
|
||||
"feedTitle": "News de l'Amicale",
|
||||
"feed": "Détails",
|
||||
"dashboard": {
|
||||
"seeMore": "Clique pour plus d'infos",
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@ class SmallDashboardItem extends React.Component<Props> {
|
|||
onPress={this.props.onPress}
|
||||
borderless={true}
|
||||
style={{
|
||||
marginLeft: this.itemSize / 6,
|
||||
marginRight: this.itemSize / 6,
|
||||
marginLeft: this.itemSize / 4,
|
||||
marginRight: this.itemSize / 4,
|
||||
}}
|
||||
>
|
||||
<View style={{
|
||||
|
|
@ -50,12 +50,8 @@ class SmallDashboardItem extends React.Component<Props> {
|
|||
<Image
|
||||
source={{uri: props.image}}
|
||||
style={{
|
||||
width: "80%",
|
||||
height: "80%",
|
||||
marginLeft: "auto",
|
||||
marginRight: "auto",
|
||||
marginTop: "auto",
|
||||
marginBottom: "auto",
|
||||
width: "100%",
|
||||
height: "100%",
|
||||
}}
|
||||
/>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ class CellComponent extends React.PureComponent<Props> {
|
|||
borderWidth: 1,
|
||||
aspectRatio: 1,
|
||||
}}
|
||||
key={item.key}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ class GridComponent extends React.Component<Props> {
|
|||
}
|
||||
|
||||
getCellRender = (item: Cell) => {
|
||||
return <CellComponent cell={item} key={item.key}/>;
|
||||
return <CellComponent cell={item}/>;
|
||||
};
|
||||
|
||||
getGrid() {
|
||||
|
|
|
|||
|
|
@ -205,15 +205,11 @@ export default class GameLogic {
|
|||
}
|
||||
}
|
||||
|
||||
stopGame() {
|
||||
endGame(isRestart: boolean) {
|
||||
this.#gameRunning = false;
|
||||
this.#gamePaused = false;
|
||||
clearInterval(this.#gameTickInterval);
|
||||
clearInterval(this.#gameTimeInterval);
|
||||
}
|
||||
|
||||
endGame(isRestart: boolean) {
|
||||
this.stopGame();
|
||||
this.endCallback(this.#gameTime, this.#scoreManager.getScore(), isRestart);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -67,10 +67,6 @@ class GameMainScreen extends React.Component<Props, State> {
|
|||
this.startGame();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
this.logic.stopGame();
|
||||
}
|
||||
|
||||
getRightButton = () => {
|
||||
return <MaterialHeaderButtons>
|
||||
<Item title="pause" iconName="pause" onPress={this.togglePause}/>
|
||||
|
|
@ -172,6 +168,32 @@ class GameMainScreen extends React.Component<Props, State> {
|
|||
});
|
||||
}
|
||||
|
||||
showGameOverConfirm() {
|
||||
let message = i18n.t("screens.game.gameOver.score") + this.state.gameScore + '\n';
|
||||
message += i18n.t("screens.game.gameOver.level") + this.state.gameLevel + '\n';
|
||||
message += i18n.t("screens.game.gameOver.time") + this.getFormattedTime(this.state.gameTime) + '\n';
|
||||
const onDismiss = () => {
|
||||
this.onDialogDismiss();
|
||||
this.startGame();
|
||||
};
|
||||
this.setState({
|
||||
dialogVisible: true,
|
||||
dialogTitle: i18n.t("screens.game.gameOver.text"),
|
||||
dialogMessage: message,
|
||||
dialogButtons: [
|
||||
{
|
||||
title: i18n.t("screens.game.gameOver.exit"),
|
||||
onPress: () => this.props.navigation.goBack()
|
||||
},
|
||||
{
|
||||
title: i18n.t("screens.game.resume"),
|
||||
onPress: onDismiss
|
||||
}
|
||||
],
|
||||
onDialogDismiss: onDismiss,
|
||||
});
|
||||
}
|
||||
|
||||
startGame = () => {
|
||||
this.logic.startGame(this.onTick, this.onClock, this.onGameEnd);
|
||||
this.setState({
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ class GameStartScreen extends React.Component<Props, State> {
|
|||
animation={"fadeInDownBig"}
|
||||
delay={animDelay}
|
||||
duration={animDuration}
|
||||
key={"piece" + index.toString()}
|
||||
key={index.toString()}
|
||||
style={{
|
||||
width: size + "%",
|
||||
position: "absolute",
|
||||
|
|
@ -118,14 +118,21 @@ class GameStartScreen extends React.Component<Props, State> {
|
|||
left: left + "%",
|
||||
}}
|
||||
>
|
||||
<GridComponent
|
||||
width={4}
|
||||
height={4}
|
||||
grid={item}
|
||||
style={{
|
||||
transform: [{rotateZ: rot + "deg"}],
|
||||
}}
|
||||
/>
|
||||
<View style={{
|
||||
transform: [{rotateZ: rot + "deg"}],
|
||||
}}>
|
||||
<GridComponent
|
||||
width={4}
|
||||
height={4}
|
||||
grid={item}
|
||||
style={{
|
||||
marginRight: 5,
|
||||
marginLeft: 5,
|
||||
marginBottom: 5,
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
|
||||
</Animatable.View>
|
||||
);
|
||||
})}
|
||||
|
|
@ -372,33 +379,43 @@ class GameStartScreen extends React.Component<Props, State> {
|
|||
|
||||
getMainContent() {
|
||||
return (
|
||||
<View style={{flex: 1}}>
|
||||
{
|
||||
this.gameStats != null
|
||||
? this.getPostGameContent(this.gameStats)
|
||||
: this.getWelcomeText()
|
||||
}
|
||||
<Button
|
||||
icon={"play"}
|
||||
mode={"contained"}
|
||||
onPress={() => this.props.navigation.replace(
|
||||
"game-main",
|
||||
{
|
||||
highScore: this.scores.length > 0
|
||||
? this.scores[0]
|
||||
: null
|
||||
}
|
||||
)}
|
||||
style={{
|
||||
marginLeft: "auto",
|
||||
marginRight: "auto",
|
||||
marginTop: 10,
|
||||
}}
|
||||
>
|
||||
{i18n.t("screens.game.play")}
|
||||
</Button>
|
||||
{this.getTopScoresRender()}
|
||||
</View>
|
||||
<LinearGradient
|
||||
style={{flex: 1}}
|
||||
colors={[
|
||||
this.props.theme.colors.background + "00",
|
||||
this.props.theme.colors.background
|
||||
]}
|
||||
start={{x: 0, y: 0.1}}
|
||||
end={{x: 0.1, y: 1}}
|
||||
>
|
||||
<View style={{flex: 1}}>
|
||||
{
|
||||
this.gameStats != null
|
||||
? this.getPostGameContent(this.gameStats)
|
||||
: this.getWelcomeText()
|
||||
}
|
||||
<Button
|
||||
icon={"play"}
|
||||
mode={"contained"}
|
||||
onPress={() => this.props.navigation.replace(
|
||||
"game-main",
|
||||
{
|
||||
highScore: this.scores.length > 0
|
||||
? this.scores[0]
|
||||
: null
|
||||
}
|
||||
)}
|
||||
style={{
|
||||
marginLeft: "auto",
|
||||
marginRight: "auto",
|
||||
marginTop: 10,
|
||||
}}
|
||||
>
|
||||
{i18n.t("screens.game.play")}
|
||||
</Button>
|
||||
{this.getTopScoresRender()}
|
||||
</View>
|
||||
</LinearGradient>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
@ -408,34 +425,24 @@ class GameStartScreen extends React.Component<Props, State> {
|
|||
return (
|
||||
<View style={{flex: 1}}>
|
||||
{this.getPiecesBackground()}
|
||||
<LinearGradient
|
||||
style={{flex: 1}}
|
||||
colors={[
|
||||
this.props.theme.colors.background + "00",
|
||||
this.props.theme.colors.background
|
||||
]}
|
||||
start={{x: 0, y: 0}}
|
||||
end={{x: 0, y: 1}}
|
||||
>
|
||||
<ScrollView>
|
||||
{this.getMainContent()}
|
||||
<MascotPopup
|
||||
visible={this.state.mascotDialogVisible}
|
||||
title={i18n.t("screens.game.mascotDialog.title")}
|
||||
message={i18n.t("screens.game.mascotDialog.message")}
|
||||
icon={"gamepad-variant"}
|
||||
buttons={{
|
||||
action: null,
|
||||
cancel: {
|
||||
message: i18n.t("screens.game.mascotDialog.button"),
|
||||
icon: "check",
|
||||
onPress: this.hideMascotDialog,
|
||||
}
|
||||
}}
|
||||
emotion={MASCOT_STYLE.COOL}
|
||||
/>
|
||||
</ScrollView>
|
||||
</LinearGradient>
|
||||
<ScrollView>
|
||||
{this.getMainContent()}
|
||||
<MascotPopup
|
||||
visible={this.state.mascotDialogVisible}
|
||||
title={i18n.t("screens.game.mascotDialog.title")}
|
||||
message={i18n.t("screens.game.mascotDialog.message")}
|
||||
icon={"gamepad-variant"}
|
||||
buttons={{
|
||||
action: null,
|
||||
cancel: {
|
||||
message: i18n.t("screens.game.mascotDialog.button"),
|
||||
icon: "check",
|
||||
onPress: this.hideMascotDialog,
|
||||
}
|
||||
}}
|
||||
emotion={MASCOT_STYLE.COOL}
|
||||
/>
|
||||
</ScrollView>
|
||||
</View>
|
||||
|
||||
);
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@ import {FlatList} from 'react-native';
|
|||
import i18n from "i18n-js";
|
||||
import DashboardItem from "../../components/Home/EventDashboardItem";
|
||||
import WebSectionList from "../../components/Screens/WebSectionList";
|
||||
import {Headline, withTheme} from 'react-native-paper';
|
||||
import {withTheme} from 'react-native-paper';
|
||||
import FeedItem from "../../components/Home/FeedItem";
|
||||
import SmallDashboardItem from "../../components/Home/SmallDashboardItem";
|
||||
import SquareDashboardItem from "../../components/Home/SmallDashboardItem";
|
||||
import PreviewEventDashboardItem from "../../components/Home/PreviewEventDashboardItem";
|
||||
import {stringToDate} from "../../utils/Planning";
|
||||
import ActionsDashBoardItem from "../../components/Home/ActionsDashboardItem";
|
||||
|
|
@ -228,7 +228,7 @@ class HomeScreen extends React.Component<Props, State> {
|
|||
id: SECTIONS_ID[0]
|
||||
},
|
||||
{
|
||||
title: i18n.t("screens.home.feedTitle"),
|
||||
title: '',
|
||||
data: this.currentNewFeed,
|
||||
id: SECTIONS_ID[1]
|
||||
}
|
||||
|
|
@ -434,7 +434,7 @@ class HomeScreen extends React.Component<Props, State> {
|
|||
*/
|
||||
dashboardRowRenderItem = ({item}: { item: DashboardItem }) => {
|
||||
return (
|
||||
<SmallDashboardItem
|
||||
<SquareDashboardItem
|
||||
image={item.image}
|
||||
onPress={item.onPress}
|
||||
badgeCount={this.currentDashboard != null && item.badgeFunction != null
|
||||
|
|
@ -460,8 +460,7 @@ class HomeScreen extends React.Component<Props, State> {
|
|||
contentContainerStyle={{
|
||||
marginLeft: 'auto',
|
||||
marginRight: 'auto',
|
||||
marginTop: 10,
|
||||
marginBottom: 10,
|
||||
marginTop: 5,
|
||||
}}
|
||||
/>);
|
||||
}
|
||||
|
|
@ -511,21 +510,6 @@ class HomeScreen extends React.Component<Props, State> {
|
|||
this.fabRef.current.onScroll(event);
|
||||
};
|
||||
|
||||
renderSectionHeader = (data: { [key: string]: any }) => {
|
||||
if (data.section.title !== "")
|
||||
return (
|
||||
<Headline style={{
|
||||
textAlign: "center",
|
||||
marginTop: 50,
|
||||
marginBottom: 10,
|
||||
}}>
|
||||
{data.section.title}
|
||||
</Headline>
|
||||
)
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback when pressing the login button on the banner.
|
||||
* This hides the banner and takes the user to the login page.
|
||||
|
|
@ -555,7 +539,6 @@ class HomeScreen extends React.Component<Props, State> {
|
|||
itemHeight={FEED_ITEM_HEIGHT}
|
||||
onScroll={this.onScroll}
|
||||
showError={false}
|
||||
renderSectionHeader={this.renderSectionHeader}
|
||||
/>
|
||||
</View>
|
||||
<MascotPopup
|
||||
|
|
|
|||
Loading…
Reference in a new issue