2 Star 1 Fork 0

yubo_725 / RNTetris

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
App.js 1.33 KB
一键复制 编辑 原始数据 按行查看 历史
yubo 提交于 2017-10-20 18:52 . first commit
import React, { Component } from 'react';
import { Dimensions, PixelRatio } from 'react-native';
import GameOverView from './src/view/GameOverView';
import GameNotStartView from './src/view/GameNotStartView';
import GamePauseView from './src/view/GamePauseView';
import GamePlayingView from './src/view/GamePlayingView';
import {GAME_STATE_NOT_START, GAME_STATE_PLAYING, GAME_STATE_PAUSE, GAME_STATE_OVER} from './src/utils/Constants';
if (!__DEV__) {
global.console = {
info: () => {},
log: () => {},
warn: () => {},
debug: () => {},
error: () => {},
};
}
export default class App extends Component<{}> {
constructor(props) {
super(props);
this.state = {
gameState: GAME_STATE_NOT_START
};
}
render() {
switch (this.state.gameState) {
case GAME_STATE_NOT_START:
return <GameNotStartView changeGameState={this.changeGameState} />;
break;
case GAME_STATE_PLAYING:
return <GamePlayingView changeGameState={this.changeGameState} />;
break;
case GAME_STATE_PAUSE:
return <GamePauseView changeGameState={this.changeGameState} />;
break;
case GAME_STATE_OVER:
return <GameOverView changeGameState={this.changeGameState} />;
break;
}
}
changeGameState = (state)=>{
this.setState({
gameState: state
});
}
}
JavaScript
1
https://gitee.com/yubo725/RNTetris.git
git@gitee.com:yubo725/RNTetris.git
yubo725
RNTetris
RNTetris
master

搜索帮助