chvin / react-tetris Goto Github PK
View Code? Open in Web Editor NEWUse React, Redux, Immutable to code Tetris. 🎮
Home Page: https://chvin.github.io/react-tetris/?lan=en
Use React, Redux, Immutable to code Tetris. 🎮
Home Page: https://chvin.github.io/react-tetris/?lan=en
我只是想说,这个项目是伟大的。 请原谅翻译。
That's a wonderful project, what's the license? I'd like to port it to React Native if I could to follow your design
您好,我们想把您的这个俄罗斯方块引入到我们APP内,该怎样联系到您呢?已给您发过邮件了
我注意到没有这个项目没有开源协议,就想问一下.感觉蛮好玩的,想拿来搭建到自己的网站下
执行完npm install之后接着执行npm start会报错,输出如下:
-> % npm start
> [email protected] start /Users/zentorwie/Codes/Frontend/react-tetris
> webpack-dev-server --progress
70% 1/1 build modules http://0.0.0.0:8080/
webpack result is served from /
content is served from ./server
32% 3/8 build modulesThe react/require-extension rule is deprecated. Please use the import/extensions rule from eslint-plugin-import instead.
Hash: 98044a932f7444f61380
Version: webpack 1.14.0
Time: 3764ms
Asset Size Chunks Chunk Names
app.js 669 kB 0 [emitted] main
music.mp3 54.4 kB [emitted]
loader.css 1.5 kB [emitted]
chunk {0} app.js (main) 226 kB [rendered]
[0] multi main 52 bytes {0} [built] [1 error]
[1] (webpack)-dev-server/client?http://0.0.0.0:8080 3.97 kB {0} [built]
[2] ./~/url/url.js 23.3 kB {0} [built]
[3] ./~/url/~/punycode/punycode.js 14.6 kB {0} [built]
[4] (webpack)/buildin/module.js 251 bytes {0} [built]
[5] ./~/url/util.js 314 bytes {0} [built]
[6] ./~/querystring/index.js 127 bytes {0} [built]
[7] ./~/querystring/decode.js 2.4 kB {0} [built]
[8] ./~/querystring/encode.js 2.09 kB {0} [built]
[9] ./~/strip-ansi/index.js 161 bytes {0} [built]
[10] ./~/ansi-regex/index.js 135 bytes {0} [built]
[11] (webpack)-dev-server/client/socket.js 856 bytes {0} [built]
[12] ./~/sockjs-client/lib/entry.js 244 bytes {0} [built]
[13] ./~/sockjs-client/lib/transport-list.js 613 bytes {0} [built]
[14] ./~/sockjs-client/lib/transport/websocket.js 2.71 kB {0} [built]
[15] ./~/node-libs-browser/~/process/browser.js 5.3 kB {0} [built]
[16] ./~/sockjs-client/lib/utils/event.js 2 kB {0} [built]
[17] ./~/sockjs-client/lib/utils/random.js 746 bytes {0} [built]
[18] ./~/sockjs-client/lib/utils/browser-crypto.js 438 bytes {0} [built]
[19] ./~/sockjs-client/lib/utils/url.js 975 bytes {0} [built]
[20] ./~/url-parse/index.js 9.92 kB {0} [built]
[21] ./~/requires-port/index.js 753 bytes {0} [built]
[22] ./~/url-parse/lolcation.js 1.58 kB {0} [built]
[23] ./~/querystringify/index.js 1.3 kB {0} [built]
[24] ./~/debug/src/browser.js 4.68 kB {0} [built]
[25] ./~/debug/src/debug.js 4.31 kB {0} [built]
[26] ./~/ms/index.js 2.72 kB {0} [built]
[27] ./~/inherits/inherits_browser.js 672 bytes {0} [built]
[28] ./~/sockjs-client/lib/event/emitter.js 1.27 kB {0} [built]
[29] ./~/sockjs-client/lib/event/eventtarget.js 1.85 kB {0} [built]
[30] ./~/sockjs-client/lib/transport/browser/websocket.js 172 bytes {0} [built]
[31] ./~/sockjs-client/lib/transport/xhr-streaming.js 1.25 kB {0} [built]
[32] ./~/sockjs-client/lib/transport/lib/ajax-based.js 1.31 kB {0} [built]
[33] ./~/sockjs-client/lib/transport/lib/sender-receiver.js 1.15 kB {0} [built]
[34] ./~/sockjs-client/lib/transport/lib/buffered-sender.js 2.3 kB {0} [built]
[35] ./~/sockjs-client/lib/transport/lib/polling.js 1.32 kB {0} [built]
[36] ./~/sockjs-client/lib/transport/receiver/xhr.js 1.58 kB {0} [built]
[37] ./~/sockjs-client/lib/transport/sender/xhr-cors.js 343 bytes {0} [built]
[38] ./~/sockjs-client/lib/transport/browser/abstract-xhr.js 4.8 kB {0} [built]
[39] ./~/sockjs-client/lib/transport/sender/xhr-local.js 352 bytes {0} [built]
[40] ./~/sockjs-client/lib/utils/browser.js 560 bytes {0} [built]
[41] ./~/sockjs-client/lib/transport/xdr-streaming.js 984 bytes {0} [built]
[42] ./~/sockjs-client/lib/transport/sender/xdr.js 2.46 kB {0} [built]
[43] ./~/sockjs-client/lib/transport/eventsource.js 766 bytes {0} [built]
[44] ./~/sockjs-client/lib/transport/receiver/eventsource.js 1.58 kB {0} [built]
[45] ./~/sockjs-client/lib/transport/browser/eventsource.js 37 bytes {0} [built]
[46] ./~/sockjs-client/lib/transport/lib/iframe-wrap.js 981 bytes {0} [built]
[47] ./~/sockjs-client/lib/transport/iframe.js 3.83 kB {0} [built]
[48] ./~/json3/lib/json3.js 43.3 kB {0} [built]
[49] (webpack)/buildin/amd-options.js 43 bytes {0} [built]
[50] ./~/sockjs-client/lib/version.js 26 bytes {0} [built]
[51] ./~/sockjs-client/lib/utils/iframe.js 5.06 kB {0} [built]
[52] ./~/sockjs-client/lib/utils/object.js 532 bytes {0} [built]
[53] ./~/sockjs-client/lib/transport/htmlfile.js 710 bytes {0} [built]
[54] ./~/sockjs-client/lib/transport/receiver/htmlfile.js 2.2 kB {0} [built]
[55] ./~/sockjs-client/lib/transport/xhr-polling.js 894 bytes {0} [built]
[56] ./~/sockjs-client/lib/transport/xdr-polling.js 712 bytes {0} [built]
[57] ./~/sockjs-client/lib/transport/jsonp-polling.js 1.02 kB {0} [built]
[58] ./~/sockjs-client/lib/transport/receiver/jsonp.js 5.57 kB {0} [built]
[59] ./~/sockjs-client/lib/transport/sender/jsonp.js 2.46 kB {0} [built]
[60] ./~/sockjs-client/lib/main.js 11.9 kB {0} [built]
[61] ./~/sockjs-client/lib/shims.js 18.2 kB {0} [built]
[62] ./~/sockjs-client/lib/utils/escape.js 2.31 kB {0} [built]
[63] ./~/sockjs-client/lib/utils/transport.js 1.35 kB {0} [built]
[64] ./~/sockjs-client/lib/utils/log.js 450 bytes {0} [built]
[65] ./~/sockjs-client/lib/event/event.js 477 bytes {0} [built]
[66] ./~/sockjs-client/lib/location.js 177 bytes {0} [built]
[67] ./~/sockjs-client/lib/event/close.js 295 bytes {0} [built]
[68] ./~/sockjs-client/lib/event/trans-message.js 292 bytes {0} [built]
[69] ./~/sockjs-client/lib/info-receiver.js 2.22 kB {0} [built]
[70] ./~/sockjs-client/lib/transport/sender/xhr-fake.js 456 bytes {0} [built]
[71] ./~/sockjs-client/lib/info-iframe.js 1.52 kB {0} [built]
[72] ./~/sockjs-client/lib/info-iframe-receiver.js 791 bytes {0} [built]
[73] ./~/sockjs-client/lib/info-ajax.js 1.03 kB {0} [built]
[74] ./~/sockjs-client/lib/iframe-bootstrap.js 2.9 kB {0} [built]
[75] ./~/sockjs-client/lib/facade.js 723 bytes {0} [built]
[76] (webpack)/hot/dev-server.js 1.85 kB {0} [built]
[77] (webpack)/hot/log-apply-result.js 813 bytes {0} [built]
ERROR in ./src/index.js
Module build failed: ReferenceError: [BABEL] /Users/zentorwie/Codes/Frontend/react-tetris/src/index.js: Unknown option: /Users/zentorwie/Codes/Frontend/react-tetris/node_modules/react/react.js.Children. Check out http://babeljs.io/docs/usage/options/ for more information about options.
A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:
Invalid:
`{ presets: [{option: value}] }`
Valid:
`{ presets: [['presetName', {option: value}]] }`
For more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options. (While processing preset: "/Users/zentorwie/Codes/Frontend/react-tetris/node_modules/react/react.js")
at Logger.error (/Users/zentorwie/Codes/Frontend/react-tetris/node_modules/babel-core/lib/transformation/file/logger.js:41:11)
at OptionManager.mergeOptions (/Users/zentorwie/Codes/Frontend/react-tetris/node_modules/babel-core/lib/transformation/file/options/option-manager.js:221:20)
at /Users/zentorwie/Codes/Frontend/react-tetris/node_modules/babel-core/lib/transformation/file/options/option-manager.js:260:14
at /Users/zentorwie/Codes/Frontend/react-tetris/node_modules/babel-core/lib/transformation/file/options/option-manager.js:329:22
at Array.map (native)
at OptionManager.resolvePresets (/Users/zentorwie/Codes/Frontend/react-tetris/node_modules/babel-core/lib/transformation/file/options/option-manager.js:270:20)
at OptionManager.mergePresets (/Users/zentorwie/Codes/Frontend/react-tetris/node_modules/babel-core/lib/transformation/file/options/option-manager.js:259:10)
at OptionManager.mergeOptions (/Users/zentorwie/Codes/Frontend/react-tetris/node_modules/babel-core/lib/transformation/file/options/option-manager.js:244:14)
at OptionManager.init (/Users/zentorwie/Codes/Frontend/react-tetris/node_modules/babel-core/lib/transformation/file/options/option-manager.js:374:12)
at File.initOptions (/Users/zentorwie/Codes/Frontend/react-tetris/node_modules/babel-core/lib/transformation/file/index.js:216:65)
at new File (/Users/zentorwie/Codes/Frontend/react-tetris/node_modules/babel-core/lib/transformation/file/index.js:139:24)
at Pipeline.transform (/Users/zentorwie/Codes/Frontend/react-tetris/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at transpile (/Users/zentorwie/Codes/Frontend/react-tetris/node_modules/babel-loader/lib/index.js:38:20)
at Object.module.exports (/Users/zentorwie/Codes/Frontend/react-tetris/node_modules/babel-loader/lib/index.js:133:12)
@ multi main
webpack: bundle is now VALID.
环境信息:
OS: OS X 10.11
npm version的输出:
{ 'react-tetris': '1.0.0',
npm: '3.10.9',
ares: '1.10.1-DEV',
http_parser: '2.7.0',
icu: '57.1',
modules: '48',
node: '6.9.2',
openssl: '1.0.2j',
uv: '1.9.1',
v8: '5.1.281.88',
zlib: '1.2.8' }
This is a great project!
作者你好,您这个项目太完美了,我想上架到AppStore可以吗?
我有苹果的开发者账号,想写一个简单的App,在App内用浏览器加载 https://chvin.github.io/react-tetris
这个页面。
Hello Chvin,
We added GamePad control for this wonderful Tetris game, maybe it isn't good enough but it works well in my Chrome browser:)
Only changed this file: src/control/index.js
https://github.com/chvin/react-tetris/commit/1e31eed7aaa19446f9f5ebd60cd42640d1bb7c8f
我添加了手柄功能来方便大家用手柄玩这个完美的游戏,在我的Chrome 浏览器上运行效果还不错。
可能需要调整按键的顺序来适配不同的手柄,我们自己是用Joyscube测试,它能够自己调整按键顺序,所以不存在这个问题!
The idea is simple. building a component on the right side where users can change the color of the handheld.
我把源码下载到了本地运行docs文件夹下的index.html,额没有声音!
这个画面好有童年的味道哦,简单的快乐...
我在npm run build时遇到错误
> [email protected] build
> rm -rf ./docs/* && webpack --config ./webpack.production.config.js --progress && ls ./docs
10% 0/1 build modulesThe react/require-extension rule is deprecated. Please use the import/extensions rule from eslint-plugin-import instead.
70% 1/1 build modules(node:40496) Warning: Accessing non-existent property 'cat' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:40496) Warning: Accessing non-existent property 'cd' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'chmod' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'cp' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'dirs' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'pushd' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'popd' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'echo' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'tempdir' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'pwd' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'exec' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'ls' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'find' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'grep' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'head' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'ln' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'mkdir' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'rm' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'mv' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'sed' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'set' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'sort' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'tail' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'test' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'to' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'toEnd' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'touch' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'uniq' of module exports inside circular dependency
(node:40496) Warning: Accessing non-existent property 'which' of module exports inside circular dependency
Hash: 297bc94e95c5cbfaebeb
Version: webpack 1.15.0
Time: 8636ms
Asset Size Chunks Chunk Names
app-1.0.1.js 1.15 MB 0 [emitted] main
css-1.0.1.css 7.11 kB 0 [emitted] main
app-1.0.1.js.map 1.36 MB 0 [emitted] main
css-1.0.1.css.map 90 bytes 0 [emitted] main
music.mp3 54.4 kB [emitted]
loader.css 1.5 kB [emitted]
index.html 991 bytes [emitted]
+ 310 hidden modules
ERROR in app-1.0.1.js from UglifyJs
SyntaxError: Unexpected token name «i», expected punc «;» [./~/qrcode/lib/core/qrcode.js:51,0]
Child html-webpack-plugin for "index.html":
+ 3 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
app-1.0.1.js css-1.0.1.css.map music.mp3
app-1.0.1.js.map index.html
css-1.0.1.css loader.css
getianyoudeMacBook-Pro:react-tetris-master ge$
Tetris is a copyrighted name. The company owning it defend it very aggressively. You are probably only days away from a "cease and desist" from their legal department.
shouldcomponentupdate用的太多也不是太好,现在无状态组件可以使用PureComponent
创建。
参考http://jamesknelson.com/should-i-use-shouldcomponentupdate/
iOS12下,Safari里,快速点击某个按钮(比如连按两下“向左”按钮),会触发页面缩放操作。
Under iOS12, using Safari, when click same button rapidly (e.g. Press "Move Left" button twice quickly), will trigger the zoom operation of the browser.
I tried to use it as you can go from my web to yours. But it seems to not load all fies please help!
在微信的浏览器里打开是有些bug的
Hi,
we are receiving this error when we lose Tetris. can anybody suggest solution???
We are receiving tons of this error when we lost game.
index.js:6542 Uncaught TypeError: Cannot set property '4' of undefined
at pieceSetter (index.js:6542)
at Object.getGameBoard (index.js:6964)
at gameBoard (index.js:7240)
at Object.Gameboard._this._onChange (index.js:7291)
at emitNone (index.js:4735)
at Object.emit (index.js:4829)
at Object.emitChange (index.js:5143)
at Object. (index.js:7010)
at emitNone (index.js:4735)
at Object.emit (index.js:4829)
at Object.emitChange (index.js:5143)
at Object.setPiece (index.js:6580)
at _lockInPiece (index.js:6824)
at _moveDown (index.js:6794)
at Object.tick (index.js:6876)
at index.js:6975
简单的使用tarui init初始化配置,能编译,游戏也能运行,就是没了右上角的分数级别层数的统计。
请问有什么方便的打包可执行文件的方案吗?
Hello Chvin,
I can see that the repository doesn't contain any license file.
READMEs also doesn't mention any licenses.
Could this be fixed, so everyone can clearly see how this repo may be used, please?
Kind regards
Can I use your game on a website with ads? Not sure I understand the licence.
rt
js function 传递引用跟节约内存没有必然联系
等待界面那个小恐龙也太可爱了吧
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.