From 04df7189a9182023b94cdba9ebc5404e16422d32 Mon Sep 17 00:00:00 2001 From: dean Date: Wed, 13 Jun 2018 09:34:52 -0400 Subject: [PATCH 1/4] Database settings. --- .gitignore | 3 +- config.js | 5 +++- database/humptydumpty_users.sql | 53 +++++++++++++++++++++++++++++++++ database/index.js | 29 +++++++++++++++--- 4 files changed, 84 insertions(+), 6 deletions(-) create mode 100644 database/humptydumpty_users.sql diff --git a/.gitignore b/.gitignore index 373c5df..286a985 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules package-lock.json -.DS_Store \ No newline at end of file +.DS_Store +config.js \ No newline at end of file diff --git a/config.js b/config.js index f53059c..bf4e734 100644 --- a/config.js +++ b/config.js @@ -1,3 +1,6 @@ module.exports = { - TOKEN: 'YOUR TOKEN HERE' + host: '143.95.72.156', + user: 'destroys_groots', + password: ']4*AB+Gg;_L;', + database: 'destroys_typingwars' }; \ No newline at end of file diff --git a/database/humptydumpty_users.sql b/database/humptydumpty_users.sql new file mode 100644 index 0000000..a4d10d8 --- /dev/null +++ b/database/humptydumpty_users.sql @@ -0,0 +1,53 @@ +-- MySQL dump 10.13 Distrib 5.7.17, for macos10.12 (x86_64) +-- +-- Host: ironman.crb3zmhwoovo.us-east-1.rds.amazonaws.com Database: humptydumpty +-- ------------------------------------------------------ +-- Server version 5.6.39-log + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; + +-- +-- Table structure for table `users` +-- + +DROP TABLE IF EXISTS `users`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `users` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(100) DEFAULT NULL, + `high_score` int(11) DEFAULT NULL, + `mode` varchar(10) DEFAULT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `users` +-- + +LOCK TABLES `users` WRITE; +/*!40000 ALTER TABLE `users` DISABLE KEYS */; +INSERT INTO `users` VALUES (1,'scott',48,NULL),(2,'koichi',70,NULL),(3,'lina',78,NULL),(4,'',196,NULL),(5,'test',23,NULL),(6,'Catherine',50,NULL),(7,'ALVIN',30,NULL),(8,'Yoosun',39,NULL),(9,'Karen',40,NULL),(10,'AJ',24,NULL),(11,'MeanDean',38,NULL),(12,'Dean',47,NULL),(13,'not koichi',48,NULL),(14,'ihciok',44,NULL),(15,'Isto',35,NULL),(16,'JOHN',72,NULL),(17,'koichi-mon',49,NULL),(18,'Rose',69,NULL),(19,'JosephPMartin',72,NULL),(20,'John2',58,NULL),(21,'John3',78,NULL),(22,'john-4',69,NULL),(23,'JOHN WHY',62,NULL),(24,'anotherJOHN',76,NULL),(25,'JOHN STOP IT',60,NULL),(26,'just-john',70,NULL),(27,'JUAN',61,NULL),(28,'NobodyCracksEggsLikeThatGif',45,NULL),(29,'john again',65,NULL),(30,'johnjohn',83,NULL),(31,'JUAN CYNN',61,NULL),(32,'only john',87,NULL),(33,'monstar',47,NULL),(34,'LKM',36,NULL),(35,'2chainz',40,NULL),(36,'nick',38,NULL),(37,'Phil',27,NULL),(38,'michael',19,NULL),(39,'Hany',50,NULL),(40,'katie2',79,NULL),(41,'katie',24,NULL),(42,'lina4',83,NULL),(43,'lina5',74,NULL),(44,'lina7',73,NULL),(45,'lina11',88,NULL),(46,'333',19,NULL),(47,'L1na4',89,NULL),(48,'L1na9',73,NULL),(49,'L1na11',83,NULL),(50,'L1na21',94,NULL),(51,'L1na99',96,NULL),(52,'L1na901',66,NULL),(53,'LINA 2000',84,NULL),(54,'lina unknown',85,NULL),(55,'lina unknoWnb',80,NULL),(56,'katei9',120,NULL),(57,'99',19,NULL),(58,'lina_despair',86,NULL),(59,'Peter',25,NULL),(60,'oooh its john',59,NULL),(61,'asdf',26,NULL),(62,'phil1',19,NULL),(63,'phil2',21,NULL),(64,'asdfds',19,NULL),(65,'sadf',19,NULL),(66,'asdfsadf',19,NULL),(67,'adsf',31,NULL),(68,'asdfa',19,NULL),(69,'asdfasd',19,NULL),(70,'phila',19,NULL),(71,'johna',20,NULL),(72,'philb',19,NULL),(73,'asdfasdf',19,NULL),(74,'John Doe',19,NULL),(75,'sad John',83,NULL),(76,'2chainz thug lyfe',130,NULL),(77,'guest',19,NULL),(78,'dan',20,NULL),(79,'jeff',20,NULL),(80,'chuck',19,NULL),(81,'asfasdf',19,NULL),(82,'sam',19,NULL),(83,'alex',20,NULL),(84,'someguy',26,NULL),(85,'Jason',22,NULL),(86,'SMACK',55,NULL),(87,'fdsa',41,NULL),(88,'faaa',42,NULL),(89,'fdsa',41,NULL),(90,'faaa',42,NULL),(91,'four',41,'easy'),(92,'one',43,'easy'),(93,'two',41,'easy'),(94,'three',41,'easy'),(95,'four',41,'easy'),(96,'player 1',19,NULL),(97,'player 2',19,NULL),(98,'P1',19,NULL),(99,'P2',19,NULL),(100,'one',41,'medium'),(101,'one',41,'hard'); +/*!40000 ALTER TABLE `users` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +-- Dump completed on 2018-06-13 8:38:11 diff --git a/database/index.js b/database/index.js index 53cc15a..711eb41 100644 --- a/database/index.js +++ b/database/index.js @@ -2,11 +2,32 @@ const mysql = require('mysql'); const fs = require('fs'); const path = require('path'); +const credentials = process.env.host; +if(credentials === undefined){ + credentials = require('./../config.js'); +} else { + credentials = { + host: process.env.host, + user: process.env.user, + password: process.env.password, + database: process.env.database + } +} + +// const connection = mysql.createConnection({ +// host: 'ironman.crb3zmhwoovo.us-east-1.rds.amazonaws.com', +// user: 'IronMan', +// password: 'IronMan-HR', +// database: 'humptydumpty', +// port: 3306, +// timeout: 6000, +// }); + const connection = mysql.createConnection({ - host: 'ironman.crb3zmhwoovo.us-east-1.rds.amazonaws.com', - user: 'IronMan', - password: 'IronMan-HR', - database: 'humptydumpty', + host: credentials.host, + user: credentials.user, + password: credentials.password, + database: credentials.database, port: 3306, timeout: 6000, }); From dbe212b7ca69db1a14a1192ecbb652cf002ca7c2 Mon Sep 17 00:00:00 2001 From: dean Date: Wed, 13 Jun 2018 09:37:23 -0400 Subject: [PATCH 2/4] Variable change. --- database/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/database/index.js b/database/index.js index 711eb41..1276b5d 100644 --- a/database/index.js +++ b/database/index.js @@ -2,7 +2,7 @@ const mysql = require('mysql'); const fs = require('fs'); const path = require('path'); -const credentials = process.env.host; +var credentials = process.env.host; if(credentials === undefined){ credentials = require('./../config.js'); } else { From ebfb2b66845c5097faad3b447faa71f10e654378 Mon Sep 17 00:00:00 2001 From: dean Date: Wed, 13 Jun 2018 09:57:53 -0400 Subject: [PATCH 3/4] Removed line for reset. --- client/dist/bundle.js | 2 +- client/src/components/Game.jsx | 1 + server/index.js | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/client/dist/bundle.js b/client/dist/bundle.js index b6a6b68..06644f6 100644 --- a/client/dist/bundle.js +++ b/client/dist/bundle.js @@ -106,7 +106,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("/* WEBPACK VAR INJECTION */(function(process) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _react = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _Brick = __webpack_require__(/*! ./Brick.jsx */ \"./client/src/components/Brick.jsx\");\n\nvar _Brick2 = _interopRequireDefault(_Brick);\n\nvar _axios = __webpack_require__(/*! axios */ \"./node_modules/axios/index.js\");\n\nvar _axios2 = _interopRequireDefault(_axios);\n\nvar _PowerBank = __webpack_require__(/*! ./PowerBank.jsx */ \"./client/src/components/PowerBank.jsx\");\n\nvar _PowerBank2 = _interopRequireDefault(_PowerBank);\n\nvar _constants = __webpack_require__(/*! constants */ \"./node_modules/constants-browserify/constants.json\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar io = __webpack_require__(/*! socket.io-client */ \"./node_modules/socket.io-client/lib/index.js\");\nvar socket = io();\n\nvar Game = function (_React$Component) {\n _inherits(Game, _React$Component);\n\n function Game(props) {\n _classCallCheck(this, Game);\n\n var _this = _possibleConstructorReturn(this, (Game.__proto__ || Object.getPrototypeOf(Game)).call(this, props));\n\n _this.state = {\n userInput: '',\n dictionary: {},\n words: [],\n theirWords: [],\n time: 0,\n timeInterval: 1000,\n round: 'all',\n instructions: [\"Humpty Dumpty sat on a wall,\", \"Humpty Dumpty had a great fall.\", \"All the king's horses and all the king's men\", \"Couldn't put Humpty together again.\", \"HURRY - KEEP TYPING TO PREVENT HIS DEMISE!\"],\n prompt: 'START GAME',\n opponentTime: 0,\n powerups: {},\n bankedPowers: []\n };\n\n _this.getReady = _this.getReady.bind(_this);\n _this.startGame = _this.startGame.bind(_this);\n _this.addWord = _this.addWord.bind(_this);\n _this.updateOpponentWordList = _this.updateOpponentWordList.bind(_this);\n _this.handleChange = _this.handleChange.bind(_this);\n _this.handleSubmit = _this.handleSubmit.bind(_this);\n _this.sendScore = _this.sendScore.bind(_this);\n _this.stopGame = _this.stopGame.bind(_this);\n\n _this.pauseGame = _this.pauseGame.bind(_this);\n _this.removeWords = _this.removeWords.bind(_this);\n _this.shuffleArray = _this.shuffleArray.bind(_this);\n _this.switchWords = _this.switchWords.bind(_this);\n\n _this.removeAllWords = _this.removeAllWords.bind(_this);\n _this.stopAll = _this.stopAll.bind(_this);\n _this.usePower = _this.usePower.bind(_this);\n _this.addPower = _this.addPower.bind(_this);\n var c = io.connect(process.env.PORT, { query: _this.state.time });\n console.log('c', c);\n\n socket.on('receive words from opponent', function (words) {\n _this.updateOpponentWordList(words);\n });\n socket.on('startGame', function () {\n _this.startGame();\n });\n socket.on('they lost', function (score) {\n // this is bad, eventually put a red x over their bricks or something\n _this.setState({\n opponentTime: score\n });\n document.getElementById('their-game').style.backgroundColor = \"red\";\n });\n return _this;\n }\n\n // get words from dictionary and join socket\n\n\n _createClass(Game, [{\n key: 'componentDidMount',\n value: function componentDidMount() {\n var _this2 = this;\n\n _axios2.default.get('/dictionary').then(function (results) {\n _this2.setState({\n dictionary: results.data\n });\n }).catch(function (err) {\n console.error(err);\n });\n socket.emit('entering room', {\n room: this.props.room,\n username: this.props.username\n });\n }\n\n // sends your words to opponent\n\n }, {\n key: 'componentDidUpdate',\n value: function componentDidUpdate(prevProps, prevState) {\n if (this.state.words.length !== prevState.words.length) {\n socket.emit('send words to opponent', {\n room: this.props.room,\n newWords: this.state.words\n });\n }\n }\n\n // leave socket\n\n }, {\n key: 'componentWillUnmount',\n value: function componentWillUnmount() {\n socket.emit('leaving room', {\n room: this.props.room,\n username: this.props.username\n });\n }\n\n // hides starter form and user input, waits for another player to start game\n\n }, {\n key: 'getReady',\n value: function getReady(e) {\n e.preventDefault();\n document.getElementById('starter-form').disabled = true;\n document.getElementById('user-input').disabled = true;\n this.setState({\n prompt: 'WAITING...'\n });\n socket.emit('ready', {\n room: this.props.room,\n username: this.props.username\n });\n }\n }, {\n key: 'startGame',\n value: function startGame() {\n var _this3 = this;\n\n document.getElementById('typing-input').disabled = false;\n document.getElementById('typing-input').focus();\n document.getElementById('overlay').style.display = \"none\";\n document.getElementById('their-game').style.backgroundColor = \"transparent\";\n document.getElementById('gudetama').style = {\n display: \"inline-block\",\n backgroundColor: \"none\"\n };\n document.getElementById('their-gudetama').style = {\n display: \"inline-block\",\n backgroundColor: \"none\"\n };\n\n // long function to define what happens at every interval\n var go = function go() {\n // creates a loop by calling itself:\n var step = setTimeout(function () {\n go();\n }, _this3.state.timeInterval);\n\n // adds a brick:\n _this3.addWord();\n\n // ends game or changes background color of gudetama based on length of \"words\" array\n // (as bricks build up, background turns a darker red to signify danger)\n if (_this3.state.words.length >= 20) {\n clearTimeout(step);\n //console.log('opponent time',this.state.time)\n socket.emit('i lost', {\n room: _this3.props.room,\n username: _this3.props.username,\n score: _this3.state.time\n });\n _this3.stopGame();\n } else if (_this3.state.words.length > 15) {\n document.getElementById('gudetama').style.backgroundColor = \"rgba(255, 0, 0, 1)\";\n } else if (_this3.state.words.length > 10) {\n document.getElementById('gudetama').style.backgroundColor = \"rgba(255, 0, 0, 0.5)\";\n }\n\n // updates the time and speeds up the game accordingly \n // (as timeInterval decreases, words appear at a faster rate)\n var newTime = _this3.state.time + 1;\n if (newTime > 20) {\n _this3.setState({\n time: newTime,\n timeInterval: 600\n //round: 'roundThree', // uncomment these to only serve short words at beginning, long words at end\n });\n } else if (newTime > 8) {\n _this3.setState({\n time: newTime,\n timeInterval: 800\n //round: 'roundTwo',\n });\n } else {\n _this3.setState({\n time: newTime\n //round: 'roundOne',\n });\n }\n };\n\n // blank slate, then start!\n this.setState({\n words: [],\n time: 0,\n timeInterval: 1000,\n userInput: ''\n }, function () {\n return go();\n });\n }\n\n // pulls random word from dictionary obj and adds it to words state\n\n }, {\n key: 'addWord',\n value: function addWord() {\n var availableWords = this.state.dictionary[this.state.round];\n var newWord = availableWords[Math.floor(Math.random() * availableWords.length)];\n this.addPower(newWord);\n this.setState({\n words: [].concat(_toConsumableArray(this.state.words), [newWord])\n });\n }\n\n // updates your view of opponent's words\n\n }, {\n key: 'updateOpponentWordList',\n value: function updateOpponentWordList(words) {\n this.setState({\n theirWords: words\n });\n }\n\n // updates userInput with what user is currently typing\n\n }, {\n key: 'handleChange',\n value: function handleChange(e) {\n this.setState({\n userInput: e.target.value\n });\n }\n\n // when the user hits \"enter\"\n\n }, {\n key: 'handleSubmit',\n value: function handleSubmit(e) {\n e.preventDefault();\n var submittedWord = this.state.userInput;\n var index = this.state.words.indexOf(submittedWord);\n var powerups;\n var deposit;\n // check if what they typed is in our \"words\" array\n // flash green for a correctly typed word and remove word from \"words\" array\n if (index !== -1) {\n\n document.getElementById('typing-input').style.backgroundColor = \"green\";\n var newWords = this.state.words.slice();\n newWords.splice(index, 1);\n playCorrect();\n\n if (this.state.powerups[submittedWord] != undefined) {\n powerups = Object.assign({}, this.state.powerups);\n deposit = powerups[submittedWord];\n delete powerups[submittedWord];\n\n if (this.state.bankedPowers.length != 0) {\n deposit = [].concat(_toConsumableArray(this.state.bankedPowers), [deposit]);\n } else {\n deposit = [deposit];\n }\n\n this.setState({\n words: newWords,\n bankedPowers: deposit,\n powerups: powerups\n });\n } else {\n this.setState({\n words: newWords\n });\n }\n } else {\n // else flash red for a mistyped word\n playWrong();\n document.getElementById('typing-input').style.backgroundColor = \"red\";\n }\n\n setTimeout(function () {\n document.getElementById('typing-input').style.backgroundColor = \"white\";\n }, 100);\n\n this.setState({\n userInput: ''\n });\n }\n\n // upon game over, sends username and score to database to be added/updated\n\n }, {\n key: 'sendScore',\n value: function sendScore(username, score) {\n _axios2.default.post('/wordgame', {\n \"username\": username,\n \"high_score\": score\n }).then(function (result) {\n console.log(result);\n }).catch(function (err) {\n console.error(err);\n });\n }\n }, {\n key: 'stopGame',\n value: function stopGame() {\n document.getElementById('typing-input').disabled = true;\n document.getElementById('overlay').style.display = \"block\";\n document.getElementById('gudetama').style.display = \"none\";\n document.getElementById('their-gudetama').style.display = \"none\";\n document.getElementById('starter-form').disabled = false;\n document.getElementById('user-input').disabled = false;\n\n // enables user to hit \"enter\" after 2 seconds to restart game\n setTimeout(function () {\n if (document.getElementById('overlay').display !== \"none\") {\n document.getElementById('user-input').focus();\n }\n }, 2000);\n\n this.sendScore(this.props.username, this.state.time);\n\n // audio effect\n playGameOver();\n\n this.setState({\n // maybe find a way to compare your score vs opponent's score and show YOU WIN/YOU LOSE\n instructions: ['GAME OVER', 'YOU SCORED: ' + this.state.time, 'YOUR OPPONENT SCORED: ' + this.state.opponentTime],\n prompt: 'REPLAY'\n });\n }\n\n //ADDED FOR POWERUPS\n\n }, {\n key: 'pauseGame',\n value: function pauseGame() {\n var _this4 = this;\n\n var previousInterval = this.state.timeInterval;\n setInterval(function () {\n _this4.setState({\n timeInterval: previousInterval\n });\n }, 5000);\n this.setState({\n timeInterval: 5000\n });\n }\n }, {\n key: 'shuffleArray',\n value: function shuffleArray(arr) {\n var current = arr.length;\n var temp;\n var rand;\n\n while (current !== 0) {\n rand = Math.floor(Math.random() * current);\n current--;\n temp = arr[current];\n arr[current] = arr[rand];\n arr[rand] = temp;\n }\n return arr;\n }\n }, {\n key: 'removeWords',\n value: function removeWords(num) {\n var removeWords = this.state.words.slice();\n var half = Math.floor(removeWords.length / 2);\n removeWords = this.shuffleArray(removeWords);\n removeWords = removeWords.slice(0, half);\n this.setState({\n words: removeWords\n });\n }\n }, {\n key: 'switchWords',\n value: function switchWords() {\n var list = this.state.words.slice();\n list.pop();\n list.push(\"aaa\");\n this.setState({\n words: list\n });\n }\n }, {\n key: 'removeAllWords',\n value: function removeAllWords(num) {\n this.setState({\n words: []\n });\n }\n }, {\n key: 'usePower',\n value: function usePower(e) {\n var temp;\n var banked;\n if (e.keyCode === 32) {\n temp = e.target.value;\n temp = temp.substring(0, temp.length - 1);\n\n if (this.state.bankedPowers[0] != undefined) {\n if (this.state.bankedPowers[0] === 'power0') {\n this.removeAllWords();\n } else if (this.state.bankedPowers[0] === 'power1') {\n this.pauseGame();\n } else if (this.state.bankedPowers[0] === 'power2') {\n this.removeWords();\n }\n banked = this.state.bankedPowers.slice();\n banked.shift();\n }\n this.setState({\n userInput: temp,\n bankedPowers: banked\n });\n }\n }\n }, {\n key: 'addPower',\n value: function addPower(word) {\n var chance = 4;\n var rand = Math.floor(Math.random() * chance) + 1;\n var current;\n if (rand === 1) {\n if (Object.keys(this.state.powerups).length === 0) {\n current = {};\n } else {\n current = this.state.powerups;\n }\n current[word] = \"power\" + Math.floor(Math.random() * 3);\n this.setState({\n powerups: current\n });\n }\n }\n }, {\n key: 'stopAll',\n value: function stopAll() {\n this.setState({\n timeInterval: 100000\n });\n }\n //END OF POWERUPS\n\n }, {\n key: 'render',\n value: function render() {\n var _this5 = this;\n\n return _react2.default.createElement(\n 'div',\n { className: 'game' },\n _react2.default.createElement(\n 'div',\n { id: 'overlay' },\n _react2.default.createElement(\n 'div',\n null,\n this.state.instructions.map(function (line, index) {\n // audio effect:\n playStart();\n return _react2.default.createElement(\n 'span',\n { key: index },\n line,\n _react2.default.createElement('br', null)\n );\n })\n ),\n _react2.default.createElement('div', { id: 'crackedegg' }),\n _react2.default.createElement(\n 'div',\n null,\n _react2.default.createElement(\n 'form',\n { id: 'starter-form', onSubmit: this.getReady, autoComplete: 'off' },\n _react2.default.createElement('input', { id: 'user-input', placeholder: 'Who are you?', value: this.props.username, onChange: this.props.handleUserNameChange, autoFocus: true })\n )\n ),\n _react2.default.createElement(\n 'div',\n { id: 'overlay-start', onClick: this.startGame, className: 'blinking' },\n this.state.prompt\n )\n ),\n _react2.default.createElement(\n 'div',\n { className: 'timer' },\n _react2.default.createElement(\n 'h1',\n null,\n this.state.time\n )\n ),\n _react2.default.createElement(\n 'div',\n { className: 'board' },\n _react2.default.createElement(\n 'div',\n { className: 'play' },\n this.state.words.map(function (word, index) {\n return _react2.default.createElement(_Brick2.default, { word: word, key: index, powerup: _this5.state.powerups[word] ? _this5.state.powerups[word] : \"\" });\n }),\n _react2.default.createElement('div', { id: 'gudetama' }),\n _react2.default.createElement(\n 'form',\n { onSubmit: this.handleSubmit, autoComplete: 'off' },\n _react2.default.createElement('input', { id: 'typing-input', type: 'text', value: this.state.userInput, onChange: this.handleChange, onKeyUp: this.usePower })\n )\n ),\n _react2.default.createElement(\n 'div',\n { id: 'power-bank' },\n _react2.default.createElement(\n 'h5',\n null,\n 'Powers:'\n ),\n this.state.bankedPowers.map(function (powerup, index) {\n return _react2.default.createElement(_PowerBank2.default, { key: index, powerup: powerup });\n }),\n _react2.default.createElement(\n 'div',\n { id: 'legend' },\n _react2.default.createElement(\n 'div',\n { className: 'power1' },\n 'Pause (5s)'\n ),\n _react2.default.createElement(\n 'div',\n { className: 'power2' },\n 'Remove 1/2'\n ),\n _react2.default.createElement(\n 'div',\n { className: 'power0' },\n 'Remove All'\n )\n )\n ),\n _react2.default.createElement(\n 'div',\n { className: 'play', id: 'their-game' },\n this.state.theirWords.map(function (word, index) {\n return _react2.default.createElement(_Brick2.default, { word: word, key: index });\n }),\n _react2.default.createElement('div', { id: 'their-gudetama' }),\n _react2.default.createElement(\n 'form',\n { autoComplete: 'off' },\n _react2.default.createElement('input', { value: 'OPPONENT' })\n )\n )\n )\n );\n }\n }]);\n\n return Game;\n}(_react2.default.Component);\n\nexports.default = Game;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/process/browser.js */ \"./node_modules/process/browser.js\")))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9jbGllbnQvc3JjL2NvbXBvbmVudHMvR2FtZS5qc3guanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vY2xpZW50L3NyYy9jb21wb25lbnRzL0dhbWUuanN4PzE2ZWIiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0JztcbmltcG9ydCBCcmljayBmcm9tICcuL0JyaWNrLmpzeCc7XG5pbXBvcnQgYXhpb3MgZnJvbSAnYXhpb3MnO1xuaW1wb3J0IFBvd2VyQmFuayB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0E7QUFDQTtBQUNBO0FBQUE7QUFBQTtBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFDQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQ0E7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUhBO0FBTEE7QUFjQTtBQUFBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQUE7QUFBQTtBQUNBO0FBREE7QUFMQTtBQTFCQTtBQXpCQTtBQStEQTs7OztBQTFjQTtBQUNBO0FBNGNBO0EiLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///./client/src/components/Game.jsx\n"); +eval("/* WEBPACK VAR INJECTION */(function(process) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _react = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _Brick = __webpack_require__(/*! ./Brick.jsx */ \"./client/src/components/Brick.jsx\");\n\nvar _Brick2 = _interopRequireDefault(_Brick);\n\nvar _axios = __webpack_require__(/*! axios */ \"./node_modules/axios/index.js\");\n\nvar _axios2 = _interopRequireDefault(_axios);\n\nvar _PowerBank = __webpack_require__(/*! ./PowerBank.jsx */ \"./client/src/components/PowerBank.jsx\");\n\nvar _PowerBank2 = _interopRequireDefault(_PowerBank);\n\nvar _constants = __webpack_require__(/*! constants */ \"./node_modules/constants-browserify/constants.json\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar io = __webpack_require__(/*! socket.io-client */ \"./node_modules/socket.io-client/lib/index.js\");\nvar socket = io();\n\nvar Game = function (_React$Component) {\n _inherits(Game, _React$Component);\n\n function Game(props) {\n _classCallCheck(this, Game);\n\n var _this = _possibleConstructorReturn(this, (Game.__proto__ || Object.getPrototypeOf(Game)).call(this, props));\n\n _this.state = {\n userInput: '',\n dictionary: {},\n words: [],\n theirWords: [],\n time: 0,\n timeInterval: 1000,\n round: 'all',\n instructions: [\"Humpty Dumpty sat on a wall,\", \"Humpty Dumpty had a great fall.\", \"All the king's horses and all the king's men\", \"Couldn't put Humpty together again.\", \"HURRY - KEEP TYPING TO PREVENT HIS DEMISE!\"],\n prompt: 'START GAME',\n opponentTime: 0,\n powerups: {},\n bankedPowers: []\n };\n\n _this.getReady = _this.getReady.bind(_this);\n _this.startGame = _this.startGame.bind(_this);\n _this.addWord = _this.addWord.bind(_this);\n _this.updateOpponentWordList = _this.updateOpponentWordList.bind(_this);\n _this.handleChange = _this.handleChange.bind(_this);\n _this.handleSubmit = _this.handleSubmit.bind(_this);\n _this.sendScore = _this.sendScore.bind(_this);\n _this.stopGame = _this.stopGame.bind(_this);\n\n _this.pauseGame = _this.pauseGame.bind(_this);\n _this.removeWords = _this.removeWords.bind(_this);\n _this.shuffleArray = _this.shuffleArray.bind(_this);\n _this.switchWords = _this.switchWords.bind(_this);\n\n _this.removeAllWords = _this.removeAllWords.bind(_this);\n _this.stopAll = _this.stopAll.bind(_this);\n _this.usePower = _this.usePower.bind(_this);\n _this.addPower = _this.addPower.bind(_this);\n var c = io.connect(process.env.PORT, { query: _this.state.time });\n console.log('c', c);\n\n socket.on('receive words from opponent', function (words) {\n _this.updateOpponentWordList(words);\n });\n socket.on('startGame', function () {\n _this.startGame();\n });\n socket.on('they lost', function (score) {\n // this is bad, eventually put a red x over their bricks or something\n _this.setState({\n opponentTime: score\n });\n document.getElementById('their-game').style.backgroundColor = \"red\";\n });\n return _this;\n }\n\n // get words from dictionary and join socket\n\n\n _createClass(Game, [{\n key: 'componentDidMount',\n value: function componentDidMount() {\n var _this2 = this;\n\n _axios2.default.get('/dictionary').then(function (results) {\n _this2.setState({\n dictionary: results.data\n });\n }).catch(function (err) {\n console.error(err);\n });\n socket.emit('entering room', {\n room: this.props.room,\n username: this.props.username\n });\n }\n\n // sends your words to opponent\n\n }, {\n key: 'componentDidUpdate',\n value: function componentDidUpdate(prevProps, prevState) {\n if (this.state.words.length !== prevState.words.length) {\n socket.emit('send words to opponent', {\n room: this.props.room,\n newWords: this.state.words\n });\n }\n }\n\n // leave socket\n\n }, {\n key: 'componentWillUnmount',\n value: function componentWillUnmount() {\n socket.emit('leaving room', {\n room: this.props.room,\n username: this.props.username\n });\n }\n\n // hides starter form and user input, waits for another player to start game\n\n }, {\n key: 'getReady',\n value: function getReady(e) {\n e.preventDefault();\n document.getElementById('starter-form').disabled = true;\n document.getElementById('user-input').disabled = true;\n this.setState({\n prompt: 'WAITING...'\n });\n socket.emit('ready', {\n room: this.props.room,\n username: this.props.username\n });\n }\n }, {\n key: 'startGame',\n value: function startGame() {\n var _this3 = this;\n\n document.getElementById('typing-input').disabled = false;\n document.getElementById('typing-input').focus();\n document.getElementById('overlay').style.display = \"none\";\n document.getElementById('their-game').style.backgroundColor = \"transparent\";\n document.getElementById('gudetama').style = {\n display: \"inline-block\",\n backgroundColor: \"none\"\n };\n document.getElementById('their-gudetama').style = {\n display: \"inline-block\",\n backgroundColor: \"none\"\n };\n\n // long function to define what happens at every interval\n var go = function go() {\n // creates a loop by calling itself:\n var step = setTimeout(function () {\n go();\n }, _this3.state.timeInterval);\n\n // adds a brick:\n _this3.addWord();\n\n // ends game or changes background color of gudetama based on length of \"words\" array\n // (as bricks build up, background turns a darker red to signify danger)\n if (_this3.state.words.length >= 20) {\n clearTimeout(step);\n //console.log('opponent time',this.state.time)\n console.log('REACT losing...');\n socket.emit('i lost', {\n room: _this3.props.room,\n username: _this3.props.username,\n score: _this3.state.time\n });\n _this3.stopGame();\n } else if (_this3.state.words.length > 15) {\n document.getElementById('gudetama').style.backgroundColor = \"rgba(255, 0, 0, 1)\";\n } else if (_this3.state.words.length > 10) {\n document.getElementById('gudetama').style.backgroundColor = \"rgba(255, 0, 0, 0.5)\";\n }\n\n // updates the time and speeds up the game accordingly \n // (as timeInterval decreases, words appear at a faster rate)\n var newTime = _this3.state.time + 1;\n if (newTime > 20) {\n _this3.setState({\n time: newTime,\n timeInterval: 600\n //round: 'roundThree', // uncomment these to only serve short words at beginning, long words at end\n });\n } else if (newTime > 8) {\n _this3.setState({\n time: newTime,\n timeInterval: 800\n //round: 'roundTwo',\n });\n } else {\n _this3.setState({\n time: newTime\n //round: 'roundOne',\n });\n }\n };\n\n // blank slate, then start!\n this.setState({\n words: [],\n time: 0,\n timeInterval: 1000,\n userInput: ''\n }, function () {\n return go();\n });\n }\n\n // pulls random word from dictionary obj and adds it to words state\n\n }, {\n key: 'addWord',\n value: function addWord() {\n var availableWords = this.state.dictionary[this.state.round];\n var newWord = availableWords[Math.floor(Math.random() * availableWords.length)];\n this.addPower(newWord);\n this.setState({\n words: [].concat(_toConsumableArray(this.state.words), [newWord])\n });\n }\n\n // updates your view of opponent's words\n\n }, {\n key: 'updateOpponentWordList',\n value: function updateOpponentWordList(words) {\n this.setState({\n theirWords: words\n });\n }\n\n // updates userInput with what user is currently typing\n\n }, {\n key: 'handleChange',\n value: function handleChange(e) {\n this.setState({\n userInput: e.target.value\n });\n }\n\n // when the user hits \"enter\"\n\n }, {\n key: 'handleSubmit',\n value: function handleSubmit(e) {\n e.preventDefault();\n var submittedWord = this.state.userInput;\n var index = this.state.words.indexOf(submittedWord);\n var powerups;\n var deposit;\n // check if what they typed is in our \"words\" array\n // flash green for a correctly typed word and remove word from \"words\" array\n if (index !== -1) {\n\n document.getElementById('typing-input').style.backgroundColor = \"green\";\n var newWords = this.state.words.slice();\n newWords.splice(index, 1);\n playCorrect();\n\n if (this.state.powerups[submittedWord] != undefined) {\n powerups = Object.assign({}, this.state.powerups);\n deposit = powerups[submittedWord];\n delete powerups[submittedWord];\n\n if (this.state.bankedPowers.length != 0) {\n deposit = [].concat(_toConsumableArray(this.state.bankedPowers), [deposit]);\n } else {\n deposit = [deposit];\n }\n\n this.setState({\n words: newWords,\n bankedPowers: deposit,\n powerups: powerups\n });\n } else {\n this.setState({\n words: newWords\n });\n }\n } else {\n // else flash red for a mistyped word\n playWrong();\n document.getElementById('typing-input').style.backgroundColor = \"red\";\n }\n\n setTimeout(function () {\n document.getElementById('typing-input').style.backgroundColor = \"white\";\n }, 100);\n\n this.setState({\n userInput: ''\n });\n }\n\n // upon game over, sends username and score to database to be added/updated\n\n }, {\n key: 'sendScore',\n value: function sendScore(username, score) {\n _axios2.default.post('/wordgame', {\n \"username\": username,\n \"high_score\": score\n }).then(function (result) {\n console.log(result);\n }).catch(function (err) {\n console.error(err);\n });\n }\n }, {\n key: 'stopGame',\n value: function stopGame() {\n document.getElementById('typing-input').disabled = true;\n document.getElementById('overlay').style.display = \"block\";\n document.getElementById('gudetama').style.display = \"none\";\n document.getElementById('their-gudetama').style.display = \"none\";\n document.getElementById('starter-form').disabled = false;\n document.getElementById('user-input').disabled = false;\n\n // enables user to hit \"enter\" after 2 seconds to restart game\n setTimeout(function () {\n if (document.getElementById('overlay').display !== \"none\") {\n document.getElementById('user-input').focus();\n }\n }, 2000);\n\n this.sendScore(this.props.username, this.state.time);\n\n // audio effect\n playGameOver();\n\n this.setState({\n // maybe find a way to compare your score vs opponent's score and show YOU WIN/YOU LOSE\n instructions: ['GAME OVER', 'YOU SCORED: ' + this.state.time, 'YOUR OPPONENT SCORED: ' + this.state.opponentTime],\n prompt: 'REPLAY'\n });\n }\n\n //ADDED FOR POWERUPS\n\n }, {\n key: 'pauseGame',\n value: function pauseGame() {\n var _this4 = this;\n\n var previousInterval = this.state.timeInterval;\n setInterval(function () {\n _this4.setState({\n timeInterval: previousInterval\n });\n }, 5000);\n this.setState({\n timeInterval: 5000\n });\n }\n }, {\n key: 'shuffleArray',\n value: function shuffleArray(arr) {\n var current = arr.length;\n var temp;\n var rand;\n\n while (current !== 0) {\n rand = Math.floor(Math.random() * current);\n current--;\n temp = arr[current];\n arr[current] = arr[rand];\n arr[rand] = temp;\n }\n return arr;\n }\n }, {\n key: 'removeWords',\n value: function removeWords(num) {\n var removeWords = this.state.words.slice();\n var half = Math.floor(removeWords.length / 2);\n removeWords = this.shuffleArray(removeWords);\n removeWords = removeWords.slice(0, half);\n this.setState({\n words: removeWords\n });\n }\n }, {\n key: 'switchWords',\n value: function switchWords() {\n var list = this.state.words.slice();\n list.pop();\n list.push(\"aaa\");\n this.setState({\n words: list\n });\n }\n }, {\n key: 'removeAllWords',\n value: function removeAllWords(num) {\n this.setState({\n words: []\n });\n }\n }, {\n key: 'usePower',\n value: function usePower(e) {\n var temp;\n var banked;\n if (e.keyCode === 32) {\n temp = e.target.value;\n temp = temp.substring(0, temp.length - 1);\n\n if (this.state.bankedPowers[0] != undefined) {\n if (this.state.bankedPowers[0] === 'power0') {\n this.removeAllWords();\n } else if (this.state.bankedPowers[0] === 'power1') {\n this.pauseGame();\n } else if (this.state.bankedPowers[0] === 'power2') {\n this.removeWords();\n }\n banked = this.state.bankedPowers.slice();\n banked.shift();\n }\n this.setState({\n userInput: temp,\n bankedPowers: banked\n });\n }\n }\n }, {\n key: 'addPower',\n value: function addPower(word) {\n var chance = 4;\n var rand = Math.floor(Math.random() * chance) + 1;\n var current;\n if (rand === 1) {\n if (Object.keys(this.state.powerups).length === 0) {\n current = {};\n } else {\n current = this.state.powerups;\n }\n current[word] = \"power\" + Math.floor(Math.random() * 3);\n this.setState({\n powerups: current\n });\n }\n }\n }, {\n key: 'stopAll',\n value: function stopAll() {\n this.setState({\n timeInterval: 100000\n });\n }\n //END OF POWERUPS\n\n }, {\n key: 'render',\n value: function render() {\n var _this5 = this;\n\n return _react2.default.createElement(\n 'div',\n { className: 'game' },\n _react2.default.createElement(\n 'div',\n { id: 'overlay' },\n _react2.default.createElement(\n 'div',\n null,\n this.state.instructions.map(function (line, index) {\n // audio effect:\n playStart();\n return _react2.default.createElement(\n 'span',\n { key: index },\n line,\n _react2.default.createElement('br', null)\n );\n })\n ),\n _react2.default.createElement('div', { id: 'crackedegg' }),\n _react2.default.createElement(\n 'div',\n null,\n _react2.default.createElement(\n 'form',\n { id: 'starter-form', onSubmit: this.getReady, autoComplete: 'off' },\n _react2.default.createElement('input', { id: 'user-input', placeholder: 'Who are you?', value: this.props.username, onChange: this.props.handleUserNameChange, autoFocus: true })\n )\n ),\n _react2.default.createElement(\n 'div',\n { id: 'overlay-start', onClick: this.startGame, className: 'blinking' },\n this.state.prompt\n )\n ),\n _react2.default.createElement(\n 'div',\n { className: 'timer' },\n _react2.default.createElement(\n 'h1',\n null,\n this.state.time\n )\n ),\n _react2.default.createElement(\n 'div',\n { className: 'board' },\n _react2.default.createElement(\n 'div',\n { className: 'play' },\n this.state.words.map(function (word, index) {\n return _react2.default.createElement(_Brick2.default, { word: word, key: index, powerup: _this5.state.powerups[word] ? _this5.state.powerups[word] : \"\" });\n }),\n _react2.default.createElement('div', { id: 'gudetama' }),\n _react2.default.createElement(\n 'form',\n { onSubmit: this.handleSubmit, autoComplete: 'off' },\n _react2.default.createElement('input', { id: 'typing-input', type: 'text', value: this.state.userInput, onChange: this.handleChange, onKeyUp: this.usePower })\n )\n ),\n _react2.default.createElement(\n 'div',\n { id: 'power-bank' },\n _react2.default.createElement(\n 'h5',\n null,\n 'Powers:'\n ),\n this.state.bankedPowers.map(function (powerup, index) {\n return _react2.default.createElement(_PowerBank2.default, { key: index, powerup: powerup });\n }),\n _react2.default.createElement(\n 'div',\n { id: 'legend' },\n _react2.default.createElement(\n 'div',\n { className: 'power1' },\n 'Pause (5s)'\n ),\n _react2.default.createElement(\n 'div',\n { className: 'power2' },\n 'Remove 1/2'\n ),\n _react2.default.createElement(\n 'div',\n { className: 'power0' },\n 'Remove All'\n )\n )\n ),\n _react2.default.createElement(\n 'div',\n { className: 'play', id: 'their-game' },\n this.state.theirWords.map(function (word, index) {\n return _react2.default.createElement(_Brick2.default, { word: word, key: index });\n }),\n _react2.default.createElement('div', { id: 'their-gudetama' }),\n _react2.default.createElement(\n 'form',\n { autoComplete: 'off' },\n _react2.default.createElement('input', { value: 'OPPONENT' })\n )\n )\n )\n );\n }\n }]);\n\n return Game;\n}(_react2.default.Component);\n\nexports.default = Game;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/process/browser.js */ \"./node_modules/process/browser.js\")))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9jbGllbnQvc3JjL2NvbXBvbmVudHMvR2FtZS5qc3guanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vY2xpZW50L3NyYy9jb21wb25lbnRzL0dhbWUuanN4PzE2ZWIiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0JztcbmltcG9ydCBCcmljayBmcm9tICcuL0JyaWNrLmpzeCc7XG5pbXBvcnQgYXhpb3MgZnJvbSAnYXhpb3MnO1xu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UE7QUFBQTtBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUFBO0FBQUE7QUFDQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBQ0E7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFIQTtBQUxBO0FBY0E7QUFBQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUFBO0FBQUE7QUFDQTtBQURBO0FBTEE7QUExQkE7QUF6QkE7QUErREE7Ozs7QUEzY0E7QUFDQTtBQTZjQTtBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./client/src/components/Game.jsx\n"); /***/ }), diff --git a/client/src/components/Game.jsx b/client/src/components/Game.jsx index c775887..458d979 100644 --- a/client/src/components/Game.jsx +++ b/client/src/components/Game.jsx @@ -138,6 +138,7 @@ class Game extends React.Component { if (this.state.words.length >= 20) { clearTimeout(step); //console.log('opponent time',this.state.time) + console.log('REACT losing...'); socket.emit('i lost', { room: this.props.room, username: this.props.username, diff --git a/server/index.js b/server/index.js index 58c403a..ebced0f 100644 --- a/server/index.js +++ b/server/index.js @@ -61,7 +61,9 @@ io.on('connection', (socket) => { }); socket.on('leaving room', (data) => { + console.log('leaving rooms...'); socket.leave(data.room); + console.log('leaving-rooms', rooms); rooms[data.room][data.username] = 0; if (getPlayerCount(data.room) === 0) { delete rooms[data.room]; @@ -81,8 +83,10 @@ io.on('connection', (socket) => { }); socket.on('i lost', (data) => { + console.log('losing...'); socket.broadcast.to(data.room).emit('they lost', data.score); - rooms[data.room][data.username] = 0; + console.log('rooms:', rooms); + //rooms[data.room][data.username] = 0; console.log('i lost, rooms is', rooms); }); From 799cc4d05255c3baf4e735dd20c33274a2228c65 Mon Sep 17 00:00:00 2001 From: dean Date: Wed, 13 Jun 2018 10:14:45 -0400 Subject: [PATCH 4/4] Updated powerup drop rate. --- client/dist/bundle.js | 2 +- client/src/components/Game.jsx | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/dist/bundle.js b/client/dist/bundle.js index 06644f6..e998d5d 100644 --- a/client/dist/bundle.js +++ b/client/dist/bundle.js @@ -106,7 +106,7 @@ eval("\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n /***/ (function(module, exports, __webpack_require__) { "use strict"; -eval("/* WEBPACK VAR INJECTION */(function(process) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _react = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _Brick = __webpack_require__(/*! ./Brick.jsx */ \"./client/src/components/Brick.jsx\");\n\nvar _Brick2 = _interopRequireDefault(_Brick);\n\nvar _axios = __webpack_require__(/*! axios */ \"./node_modules/axios/index.js\");\n\nvar _axios2 = _interopRequireDefault(_axios);\n\nvar _PowerBank = __webpack_require__(/*! ./PowerBank.jsx */ \"./client/src/components/PowerBank.jsx\");\n\nvar _PowerBank2 = _interopRequireDefault(_PowerBank);\n\nvar _constants = __webpack_require__(/*! constants */ \"./node_modules/constants-browserify/constants.json\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar io = __webpack_require__(/*! socket.io-client */ \"./node_modules/socket.io-client/lib/index.js\");\nvar socket = io();\n\nvar Game = function (_React$Component) {\n _inherits(Game, _React$Component);\n\n function Game(props) {\n _classCallCheck(this, Game);\n\n var _this = _possibleConstructorReturn(this, (Game.__proto__ || Object.getPrototypeOf(Game)).call(this, props));\n\n _this.state = {\n userInput: '',\n dictionary: {},\n words: [],\n theirWords: [],\n time: 0,\n timeInterval: 1000,\n round: 'all',\n instructions: [\"Humpty Dumpty sat on a wall,\", \"Humpty Dumpty had a great fall.\", \"All the king's horses and all the king's men\", \"Couldn't put Humpty together again.\", \"HURRY - KEEP TYPING TO PREVENT HIS DEMISE!\"],\n prompt: 'START GAME',\n opponentTime: 0,\n powerups: {},\n bankedPowers: []\n };\n\n _this.getReady = _this.getReady.bind(_this);\n _this.startGame = _this.startGame.bind(_this);\n _this.addWord = _this.addWord.bind(_this);\n _this.updateOpponentWordList = _this.updateOpponentWordList.bind(_this);\n _this.handleChange = _this.handleChange.bind(_this);\n _this.handleSubmit = _this.handleSubmit.bind(_this);\n _this.sendScore = _this.sendScore.bind(_this);\n _this.stopGame = _this.stopGame.bind(_this);\n\n _this.pauseGame = _this.pauseGame.bind(_this);\n _this.removeWords = _this.removeWords.bind(_this);\n _this.shuffleArray = _this.shuffleArray.bind(_this);\n _this.switchWords = _this.switchWords.bind(_this);\n\n _this.removeAllWords = _this.removeAllWords.bind(_this);\n _this.stopAll = _this.stopAll.bind(_this);\n _this.usePower = _this.usePower.bind(_this);\n _this.addPower = _this.addPower.bind(_this);\n var c = io.connect(process.env.PORT, { query: _this.state.time });\n console.log('c', c);\n\n socket.on('receive words from opponent', function (words) {\n _this.updateOpponentWordList(words);\n });\n socket.on('startGame', function () {\n _this.startGame();\n });\n socket.on('they lost', function (score) {\n // this is bad, eventually put a red x over their bricks or something\n _this.setState({\n opponentTime: score\n });\n document.getElementById('their-game').style.backgroundColor = \"red\";\n });\n return _this;\n }\n\n // get words from dictionary and join socket\n\n\n _createClass(Game, [{\n key: 'componentDidMount',\n value: function componentDidMount() {\n var _this2 = this;\n\n _axios2.default.get('/dictionary').then(function (results) {\n _this2.setState({\n dictionary: results.data\n });\n }).catch(function (err) {\n console.error(err);\n });\n socket.emit('entering room', {\n room: this.props.room,\n username: this.props.username\n });\n }\n\n // sends your words to opponent\n\n }, {\n key: 'componentDidUpdate',\n value: function componentDidUpdate(prevProps, prevState) {\n if (this.state.words.length !== prevState.words.length) {\n socket.emit('send words to opponent', {\n room: this.props.room,\n newWords: this.state.words\n });\n }\n }\n\n // leave socket\n\n }, {\n key: 'componentWillUnmount',\n value: function componentWillUnmount() {\n socket.emit('leaving room', {\n room: this.props.room,\n username: this.props.username\n });\n }\n\n // hides starter form and user input, waits for another player to start game\n\n }, {\n key: 'getReady',\n value: function getReady(e) {\n e.preventDefault();\n document.getElementById('starter-form').disabled = true;\n document.getElementById('user-input').disabled = true;\n this.setState({\n prompt: 'WAITING...'\n });\n socket.emit('ready', {\n room: this.props.room,\n username: this.props.username\n });\n }\n }, {\n key: 'startGame',\n value: function startGame() {\n var _this3 = this;\n\n document.getElementById('typing-input').disabled = false;\n document.getElementById('typing-input').focus();\n document.getElementById('overlay').style.display = \"none\";\n document.getElementById('their-game').style.backgroundColor = \"transparent\";\n document.getElementById('gudetama').style = {\n display: \"inline-block\",\n backgroundColor: \"none\"\n };\n document.getElementById('their-gudetama').style = {\n display: \"inline-block\",\n backgroundColor: \"none\"\n };\n\n // long function to define what happens at every interval\n var go = function go() {\n // creates a loop by calling itself:\n var step = setTimeout(function () {\n go();\n }, _this3.state.timeInterval);\n\n // adds a brick:\n _this3.addWord();\n\n // ends game or changes background color of gudetama based on length of \"words\" array\n // (as bricks build up, background turns a darker red to signify danger)\n if (_this3.state.words.length >= 20) {\n clearTimeout(step);\n //console.log('opponent time',this.state.time)\n console.log('REACT losing...');\n socket.emit('i lost', {\n room: _this3.props.room,\n username: _this3.props.username,\n score: _this3.state.time\n });\n _this3.stopGame();\n } else if (_this3.state.words.length > 15) {\n document.getElementById('gudetama').style.backgroundColor = \"rgba(255, 0, 0, 1)\";\n } else if (_this3.state.words.length > 10) {\n document.getElementById('gudetama').style.backgroundColor = \"rgba(255, 0, 0, 0.5)\";\n }\n\n // updates the time and speeds up the game accordingly \n // (as timeInterval decreases, words appear at a faster rate)\n var newTime = _this3.state.time + 1;\n if (newTime > 20) {\n _this3.setState({\n time: newTime,\n timeInterval: 600\n //round: 'roundThree', // uncomment these to only serve short words at beginning, long words at end\n });\n } else if (newTime > 8) {\n _this3.setState({\n time: newTime,\n timeInterval: 800\n //round: 'roundTwo',\n });\n } else {\n _this3.setState({\n time: newTime\n //round: 'roundOne',\n });\n }\n };\n\n // blank slate, then start!\n this.setState({\n words: [],\n time: 0,\n timeInterval: 1000,\n userInput: ''\n }, function () {\n return go();\n });\n }\n\n // pulls random word from dictionary obj and adds it to words state\n\n }, {\n key: 'addWord',\n value: function addWord() {\n var availableWords = this.state.dictionary[this.state.round];\n var newWord = availableWords[Math.floor(Math.random() * availableWords.length)];\n this.addPower(newWord);\n this.setState({\n words: [].concat(_toConsumableArray(this.state.words), [newWord])\n });\n }\n\n // updates your view of opponent's words\n\n }, {\n key: 'updateOpponentWordList',\n value: function updateOpponentWordList(words) {\n this.setState({\n theirWords: words\n });\n }\n\n // updates userInput with what user is currently typing\n\n }, {\n key: 'handleChange',\n value: function handleChange(e) {\n this.setState({\n userInput: e.target.value\n });\n }\n\n // when the user hits \"enter\"\n\n }, {\n key: 'handleSubmit',\n value: function handleSubmit(e) {\n e.preventDefault();\n var submittedWord = this.state.userInput;\n var index = this.state.words.indexOf(submittedWord);\n var powerups;\n var deposit;\n // check if what they typed is in our \"words\" array\n // flash green for a correctly typed word and remove word from \"words\" array\n if (index !== -1) {\n\n document.getElementById('typing-input').style.backgroundColor = \"green\";\n var newWords = this.state.words.slice();\n newWords.splice(index, 1);\n playCorrect();\n\n if (this.state.powerups[submittedWord] != undefined) {\n powerups = Object.assign({}, this.state.powerups);\n deposit = powerups[submittedWord];\n delete powerups[submittedWord];\n\n if (this.state.bankedPowers.length != 0) {\n deposit = [].concat(_toConsumableArray(this.state.bankedPowers), [deposit]);\n } else {\n deposit = [deposit];\n }\n\n this.setState({\n words: newWords,\n bankedPowers: deposit,\n powerups: powerups\n });\n } else {\n this.setState({\n words: newWords\n });\n }\n } else {\n // else flash red for a mistyped word\n playWrong();\n document.getElementById('typing-input').style.backgroundColor = \"red\";\n }\n\n setTimeout(function () {\n document.getElementById('typing-input').style.backgroundColor = \"white\";\n }, 100);\n\n this.setState({\n userInput: ''\n });\n }\n\n // upon game over, sends username and score to database to be added/updated\n\n }, {\n key: 'sendScore',\n value: function sendScore(username, score) {\n _axios2.default.post('/wordgame', {\n \"username\": username,\n \"high_score\": score\n }).then(function (result) {\n console.log(result);\n }).catch(function (err) {\n console.error(err);\n });\n }\n }, {\n key: 'stopGame',\n value: function stopGame() {\n document.getElementById('typing-input').disabled = true;\n document.getElementById('overlay').style.display = \"block\";\n document.getElementById('gudetama').style.display = \"none\";\n document.getElementById('their-gudetama').style.display = \"none\";\n document.getElementById('starter-form').disabled = false;\n document.getElementById('user-input').disabled = false;\n\n // enables user to hit \"enter\" after 2 seconds to restart game\n setTimeout(function () {\n if (document.getElementById('overlay').display !== \"none\") {\n document.getElementById('user-input').focus();\n }\n }, 2000);\n\n this.sendScore(this.props.username, this.state.time);\n\n // audio effect\n playGameOver();\n\n this.setState({\n // maybe find a way to compare your score vs opponent's score and show YOU WIN/YOU LOSE\n instructions: ['GAME OVER', 'YOU SCORED: ' + this.state.time, 'YOUR OPPONENT SCORED: ' + this.state.opponentTime],\n prompt: 'REPLAY'\n });\n }\n\n //ADDED FOR POWERUPS\n\n }, {\n key: 'pauseGame',\n value: function pauseGame() {\n var _this4 = this;\n\n var previousInterval = this.state.timeInterval;\n setInterval(function () {\n _this4.setState({\n timeInterval: previousInterval\n });\n }, 5000);\n this.setState({\n timeInterval: 5000\n });\n }\n }, {\n key: 'shuffleArray',\n value: function shuffleArray(arr) {\n var current = arr.length;\n var temp;\n var rand;\n\n while (current !== 0) {\n rand = Math.floor(Math.random() * current);\n current--;\n temp = arr[current];\n arr[current] = arr[rand];\n arr[rand] = temp;\n }\n return arr;\n }\n }, {\n key: 'removeWords',\n value: function removeWords(num) {\n var removeWords = this.state.words.slice();\n var half = Math.floor(removeWords.length / 2);\n removeWords = this.shuffleArray(removeWords);\n removeWords = removeWords.slice(0, half);\n this.setState({\n words: removeWords\n });\n }\n }, {\n key: 'switchWords',\n value: function switchWords() {\n var list = this.state.words.slice();\n list.pop();\n list.push(\"aaa\");\n this.setState({\n words: list\n });\n }\n }, {\n key: 'removeAllWords',\n value: function removeAllWords(num) {\n this.setState({\n words: []\n });\n }\n }, {\n key: 'usePower',\n value: function usePower(e) {\n var temp;\n var banked;\n if (e.keyCode === 32) {\n temp = e.target.value;\n temp = temp.substring(0, temp.length - 1);\n\n if (this.state.bankedPowers[0] != undefined) {\n if (this.state.bankedPowers[0] === 'power0') {\n this.removeAllWords();\n } else if (this.state.bankedPowers[0] === 'power1') {\n this.pauseGame();\n } else if (this.state.bankedPowers[0] === 'power2') {\n this.removeWords();\n }\n banked = this.state.bankedPowers.slice();\n banked.shift();\n }\n this.setState({\n userInput: temp,\n bankedPowers: banked\n });\n }\n }\n }, {\n key: 'addPower',\n value: function addPower(word) {\n var chance = 4;\n var rand = Math.floor(Math.random() * chance) + 1;\n var current;\n if (rand === 1) {\n if (Object.keys(this.state.powerups).length === 0) {\n current = {};\n } else {\n current = this.state.powerups;\n }\n current[word] = \"power\" + Math.floor(Math.random() * 3);\n this.setState({\n powerups: current\n });\n }\n }\n }, {\n key: 'stopAll',\n value: function stopAll() {\n this.setState({\n timeInterval: 100000\n });\n }\n //END OF POWERUPS\n\n }, {\n key: 'render',\n value: function render() {\n var _this5 = this;\n\n return _react2.default.createElement(\n 'div',\n { className: 'game' },\n _react2.default.createElement(\n 'div',\n { id: 'overlay' },\n _react2.default.createElement(\n 'div',\n null,\n this.state.instructions.map(function (line, index) {\n // audio effect:\n playStart();\n return _react2.default.createElement(\n 'span',\n { key: index },\n line,\n _react2.default.createElement('br', null)\n );\n })\n ),\n _react2.default.createElement('div', { id: 'crackedegg' }),\n _react2.default.createElement(\n 'div',\n null,\n _react2.default.createElement(\n 'form',\n { id: 'starter-form', onSubmit: this.getReady, autoComplete: 'off' },\n _react2.default.createElement('input', { id: 'user-input', placeholder: 'Who are you?', value: this.props.username, onChange: this.props.handleUserNameChange, autoFocus: true })\n )\n ),\n _react2.default.createElement(\n 'div',\n { id: 'overlay-start', onClick: this.startGame, className: 'blinking' },\n this.state.prompt\n )\n ),\n _react2.default.createElement(\n 'div',\n { className: 'timer' },\n _react2.default.createElement(\n 'h1',\n null,\n this.state.time\n )\n ),\n _react2.default.createElement(\n 'div',\n { className: 'board' },\n _react2.default.createElement(\n 'div',\n { className: 'play' },\n this.state.words.map(function (word, index) {\n return _react2.default.createElement(_Brick2.default, { word: word, key: index, powerup: _this5.state.powerups[word] ? _this5.state.powerups[word] : \"\" });\n }),\n _react2.default.createElement('div', { id: 'gudetama' }),\n _react2.default.createElement(\n 'form',\n { onSubmit: this.handleSubmit, autoComplete: 'off' },\n _react2.default.createElement('input', { id: 'typing-input', type: 'text', value: this.state.userInput, onChange: this.handleChange, onKeyUp: this.usePower })\n )\n ),\n _react2.default.createElement(\n 'div',\n { id: 'power-bank' },\n _react2.default.createElement(\n 'h5',\n null,\n 'Powers:'\n ),\n this.state.bankedPowers.map(function (powerup, index) {\n return _react2.default.createElement(_PowerBank2.default, { key: index, powerup: powerup });\n }),\n _react2.default.createElement(\n 'div',\n { id: 'legend' },\n _react2.default.createElement(\n 'div',\n { className: 'power1' },\n 'Pause (5s)'\n ),\n _react2.default.createElement(\n 'div',\n { className: 'power2' },\n 'Remove 1/2'\n ),\n _react2.default.createElement(\n 'div',\n { className: 'power0' },\n 'Remove All'\n )\n )\n ),\n _react2.default.createElement(\n 'div',\n { className: 'play', id: 'their-game' },\n this.state.theirWords.map(function (word, index) {\n return _react2.default.createElement(_Brick2.default, { word: word, key: index });\n }),\n _react2.default.createElement('div', { id: 'their-gudetama' }),\n _react2.default.createElement(\n 'form',\n { autoComplete: 'off' },\n _react2.default.createElement('input', { value: 'OPPONENT' })\n )\n )\n )\n );\n }\n }]);\n\n return Game;\n}(_react2.default.Component);\n\nexports.default = Game;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/process/browser.js */ \"./node_modules/process/browser.js\")))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9jbGllbnQvc3JjL2NvbXBvbmVudHMvR2FtZS5qc3guanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vY2xpZW50L3NyYy9jb21wb25lbnRzL0dhbWUuanN4PzE2ZWIiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0JztcbmltcG9ydCBCcmljayBmcm9tICcuL0JyaWNrLmpzeCc7XG5pbXBvcnQgYXhpb3MgZnJvbSAnYXhpb3MnO1xuaW1wb3J0IFBvd2VyQmFuayBmcm9tICcuL1Bvd2VyQmFuay5qc3gnO1xuXG5pbXBvcnQgeyBFRVhJU1QgfSBmcm9tICdjb25zdGFudHMnO1xuY29uc3QgaW8gPSByZXF1aXJlKCd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BQTtBQUFBO0FBQUE7QUFBQTtBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFIQTtBQUxBO0FBY0E7QUFBQTtBQUFBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUFBO0FBQUE7QUFDQTtBQURBO0FBTEE7QUExQkE7QUF6QkE7QUErREE7Ozs7QUEzY0E7QUFDQTtBQTZjQTtBIiwic291cmNlUm9vdCI6IiJ9\n//# sourceURL=webpack-internal:///./client/src/components/Game.jsx\n"); +eval("/* WEBPACK VAR INJECTION */(function(process) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _react = __webpack_require__(/*! react */ \"./node_modules/react/index.js\");\n\nvar _react2 = _interopRequireDefault(_react);\n\nvar _Brick = __webpack_require__(/*! ./Brick.jsx */ \"./client/src/components/Brick.jsx\");\n\nvar _Brick2 = _interopRequireDefault(_Brick);\n\nvar _axios = __webpack_require__(/*! axios */ \"./node_modules/axios/index.js\");\n\nvar _axios2 = _interopRequireDefault(_axios);\n\nvar _PowerBank = __webpack_require__(/*! ./PowerBank.jsx */ \"./client/src/components/PowerBank.jsx\");\n\nvar _PowerBank2 = _interopRequireDefault(_PowerBank);\n\nvar _constants = __webpack_require__(/*! constants */ \"./node_modules/constants-browserify/constants.json\");\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nfunction _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return call && (typeof call === \"object\" || typeof call === \"function\") ? call : self; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function, not \" + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }\n\nvar io = __webpack_require__(/*! socket.io-client */ \"./node_modules/socket.io-client/lib/index.js\");\nvar socket = io();\n\nvar Game = function (_React$Component) {\n _inherits(Game, _React$Component);\n\n function Game(props) {\n _classCallCheck(this, Game);\n\n var _this = _possibleConstructorReturn(this, (Game.__proto__ || Object.getPrototypeOf(Game)).call(this, props));\n\n _this.state = {\n userInput: '',\n dictionary: {},\n words: [],\n theirWords: [],\n time: 0,\n timeInterval: 1000,\n round: 'all',\n instructions: [\"Humpty Dumpty sat on a wall,\", \"Humpty Dumpty had a great fall.\", \"All the king's horses and all the king's men\", \"Couldn't put Humpty together again.\", \"HURRY - KEEP TYPING TO PREVENT HIS DEMISE!\"],\n prompt: 'START GAME',\n opponentTime: 0,\n powerups: {},\n bankedPowers: []\n };\n\n _this.getReady = _this.getReady.bind(_this);\n _this.startGame = _this.startGame.bind(_this);\n _this.addWord = _this.addWord.bind(_this);\n _this.updateOpponentWordList = _this.updateOpponentWordList.bind(_this);\n _this.handleChange = _this.handleChange.bind(_this);\n _this.handleSubmit = _this.handleSubmit.bind(_this);\n _this.sendScore = _this.sendScore.bind(_this);\n _this.stopGame = _this.stopGame.bind(_this);\n\n _this.pauseGame = _this.pauseGame.bind(_this);\n _this.removeWords = _this.removeWords.bind(_this);\n _this.shuffleArray = _this.shuffleArray.bind(_this);\n _this.switchWords = _this.switchWords.bind(_this);\n\n _this.removeAllWords = _this.removeAllWords.bind(_this);\n _this.stopAll = _this.stopAll.bind(_this);\n _this.usePower = _this.usePower.bind(_this);\n _this.addPower = _this.addPower.bind(_this);\n var c = io.connect(process.env.PORT, { query: _this.state.time });\n console.log('c', c);\n\n socket.on('receive words from opponent', function (words) {\n _this.updateOpponentWordList(words);\n });\n socket.on('startGame', function () {\n _this.startGame();\n });\n socket.on('they lost', function (score) {\n // this is bad, eventually put a red x over their bricks or something\n _this.setState({\n opponentTime: score\n });\n document.getElementById('their-game').style.backgroundColor = \"red\";\n });\n return _this;\n }\n\n // get words from dictionary and join socket\n\n\n _createClass(Game, [{\n key: 'componentDidMount',\n value: function componentDidMount() {\n var _this2 = this;\n\n _axios2.default.get('/dictionary').then(function (results) {\n _this2.setState({\n dictionary: results.data\n });\n }).catch(function (err) {\n console.error(err);\n });\n socket.emit('entering room', {\n room: this.props.room,\n username: this.props.username\n });\n }\n\n // sends your words to opponent\n\n }, {\n key: 'componentDidUpdate',\n value: function componentDidUpdate(prevProps, prevState) {\n if (this.state.words.length !== prevState.words.length) {\n socket.emit('send words to opponent', {\n room: this.props.room,\n newWords: this.state.words\n });\n }\n }\n\n // leave socket\n\n }, {\n key: 'componentWillUnmount',\n value: function componentWillUnmount() {\n socket.emit('leaving room', {\n room: this.props.room,\n username: this.props.username\n });\n }\n\n // hides starter form and user input, waits for another player to start game\n\n }, {\n key: 'getReady',\n value: function getReady(e) {\n e.preventDefault();\n document.getElementById('starter-form').disabled = true;\n document.getElementById('user-input').disabled = true;\n this.setState({\n prompt: 'WAITING...'\n });\n socket.emit('ready', {\n room: this.props.room,\n username: this.props.username\n });\n }\n }, {\n key: 'startGame',\n value: function startGame() {\n var _this3 = this;\n\n document.getElementById('typing-input').disabled = false;\n document.getElementById('typing-input').focus();\n document.getElementById('overlay').style.display = \"none\";\n document.getElementById('their-game').style.backgroundColor = \"transparent\";\n document.getElementById('gudetama').style = {\n display: \"inline-block\",\n backgroundColor: \"none\"\n };\n document.getElementById('their-gudetama').style = {\n display: \"inline-block\",\n backgroundColor: \"none\"\n };\n\n // long function to define what happens at every interval\n var go = function go() {\n // creates a loop by calling itself:\n var step = setTimeout(function () {\n go();\n }, _this3.state.timeInterval);\n\n // adds a brick:\n _this3.addWord();\n\n // ends game or changes background color of gudetama based on length of \"words\" array\n // (as bricks build up, background turns a darker red to signify danger)\n if (_this3.state.words.length >= 20) {\n clearTimeout(step);\n //console.log('opponent time',this.state.time)\n socket.emit('i lost', {\n room: _this3.props.room,\n username: _this3.props.username,\n score: _this3.state.time\n });\n _this3.stopGame();\n } else if (_this3.state.words.length > 15) {\n document.getElementById('gudetama').style.backgroundColor = \"rgba(255, 0, 0, 1)\";\n } else if (_this3.state.words.length > 10) {\n document.getElementById('gudetama').style.backgroundColor = \"rgba(255, 0, 0, 0.5)\";\n }\n\n // updates the time and speeds up the game accordingly \n // (as timeInterval decreases, words appear at a faster rate)\n var newTime = _this3.state.time + 1;\n if (newTime > 20) {\n _this3.setState({\n time: newTime,\n timeInterval: 600\n //round: 'roundThree', // uncomment these to only serve short words at beginning, long words at end\n });\n } else if (newTime > 8) {\n _this3.setState({\n time: newTime,\n timeInterval: 800\n //round: 'roundTwo',\n });\n } else {\n _this3.setState({\n time: newTime\n //round: 'roundOne',\n });\n }\n };\n\n // blank slate, then start!\n this.setState({\n words: [],\n time: 0,\n timeInterval: 1000,\n userInput: ''\n }, function () {\n return go();\n });\n }\n\n // pulls random word from dictionary obj and adds it to words state\n\n }, {\n key: 'addWord',\n value: function addWord() {\n var availableWords = this.state.dictionary[this.state.round];\n var newWord = availableWords[Math.floor(Math.random() * availableWords.length)];\n this.addPower(newWord);\n this.setState({\n words: [].concat(_toConsumableArray(this.state.words), [newWord])\n });\n }\n\n // updates your view of opponent's words\n\n }, {\n key: 'updateOpponentWordList',\n value: function updateOpponentWordList(words) {\n this.setState({\n theirWords: words\n });\n }\n\n // updates userInput with what user is currently typing\n\n }, {\n key: 'handleChange',\n value: function handleChange(e) {\n this.setState({\n userInput: e.target.value\n });\n }\n\n // when the user hits \"enter\"\n\n }, {\n key: 'handleSubmit',\n value: function handleSubmit(e) {\n e.preventDefault();\n var submittedWord = this.state.userInput;\n var index = this.state.words.indexOf(submittedWord);\n var powerups;\n var deposit;\n // check if what they typed is in our \"words\" array\n // flash green for a correctly typed word and remove word from \"words\" array\n if (index !== -1) {\n\n document.getElementById('typing-input').style.backgroundColor = \"green\";\n var newWords = this.state.words.slice();\n newWords.splice(index, 1);\n playCorrect();\n\n if (this.state.powerups[submittedWord] != undefined) {\n powerups = Object.assign({}, this.state.powerups);\n deposit = powerups[submittedWord];\n delete powerups[submittedWord];\n\n if (this.state.bankedPowers.length != 0) {\n deposit = [].concat(_toConsumableArray(this.state.bankedPowers), [deposit]);\n } else {\n deposit = [deposit];\n }\n\n this.setState({\n words: newWords,\n bankedPowers: deposit,\n powerups: powerups\n });\n } else {\n this.setState({\n words: newWords\n });\n }\n } else {\n // else flash red for a mistyped word\n playWrong();\n document.getElementById('typing-input').style.backgroundColor = \"red\";\n }\n\n setTimeout(function () {\n document.getElementById('typing-input').style.backgroundColor = \"white\";\n }, 100);\n\n this.setState({\n userInput: ''\n });\n }\n\n // upon game over, sends username and score to database to be added/updated\n\n }, {\n key: 'sendScore',\n value: function sendScore(username, score) {\n _axios2.default.post('/wordgame', {\n \"username\": username,\n \"high_score\": score\n }).then(function (result) {\n console.log(result);\n }).catch(function (err) {\n console.error(err);\n });\n }\n }, {\n key: 'stopGame',\n value: function stopGame() {\n document.getElementById('typing-input').disabled = true;\n document.getElementById('overlay').style.display = \"block\";\n document.getElementById('gudetama').style.display = \"none\";\n document.getElementById('their-gudetama').style.display = \"none\";\n document.getElementById('starter-form').disabled = false;\n document.getElementById('user-input').disabled = false;\n\n // enables user to hit \"enter\" after 2 seconds to restart game\n setTimeout(function () {\n if (document.getElementById('overlay').display !== \"none\") {\n document.getElementById('user-input').focus();\n }\n }, 2000);\n\n this.sendScore(this.props.username, this.state.time);\n\n // audio effect\n playGameOver();\n\n this.setState({\n // maybe find a way to compare your score vs opponent's score and show YOU WIN/YOU LOSE\n instructions: ['GAME OVER', 'YOU SCORED: ' + this.state.time, 'YOUR OPPONENT SCORED: ' + this.state.opponentTime],\n prompt: 'REPLAY'\n });\n }\n\n //ADDED FOR POWERUPS\n\n }, {\n key: 'pauseGame',\n value: function pauseGame() {\n var _this4 = this;\n\n var previousInterval = this.state.timeInterval;\n setInterval(function () {\n _this4.setState({\n timeInterval: previousInterval\n });\n }, 5000);\n this.setState({\n timeInterval: 5000\n });\n }\n }, {\n key: 'shuffleArray',\n value: function shuffleArray(arr) {\n var current = arr.length;\n var temp;\n var rand;\n\n while (current !== 0) {\n rand = Math.floor(Math.random() * current);\n current--;\n temp = arr[current];\n arr[current] = arr[rand];\n arr[rand] = temp;\n }\n return arr;\n }\n }, {\n key: 'removeWords',\n value: function removeWords(num) {\n var removeWords = this.state.words.slice();\n var half = Math.floor(removeWords.length / 2);\n removeWords = this.shuffleArray(removeWords);\n removeWords = removeWords.slice(0, half);\n this.setState({\n words: removeWords\n });\n }\n }, {\n key: 'switchWords',\n value: function switchWords() {\n var list = this.state.words.slice();\n list.pop();\n list.push(\"aaa\");\n this.setState({\n words: list\n });\n }\n }, {\n key: 'removeAllWords',\n value: function removeAllWords(num) {\n this.setState({\n words: []\n });\n }\n }, {\n key: 'usePower',\n value: function usePower(e) {\n var temp;\n var banked;\n if (e.keyCode === 32) {\n temp = e.target.value;\n temp = temp.substring(0, temp.length - 1);\n\n if (this.state.bankedPowers[0] != undefined) {\n if (this.state.bankedPowers[0] === 'power0') {\n this.removeAllWords();\n } else if (this.state.bankedPowers[0] === 'power1') {\n this.pauseGame();\n } else if (this.state.bankedPowers[0] === 'power2') {\n this.removeWords();\n }\n banked = this.state.bankedPowers.slice();\n banked.shift();\n }\n this.setState({\n userInput: temp,\n bankedPowers: banked\n });\n }\n }\n }, {\n key: 'addPower',\n value: function addPower(word) {\n var chance = 8; //1 in chance\n var rand = Math.floor(Math.random() * chance) + 1;\n var current;\n if (rand === 1) {\n if (Object.keys(this.state.powerups).length === 0) {\n current = {};\n } else {\n current = this.state.powerups;\n }\n\n current[word] = \"power\" + Math.floor(Math.random() * 3);\n this.setState({\n powerups: current\n });\n }\n }\n }, {\n key: 'stopAll',\n value: function stopAll() {\n this.setState({\n timeInterval: 100000\n });\n }\n //END OF POWERUPS\n\n }, {\n key: 'render',\n value: function render() {\n var _this5 = this;\n\n return _react2.default.createElement(\n 'div',\n { className: 'game' },\n _react2.default.createElement(\n 'div',\n { id: 'overlay' },\n _react2.default.createElement(\n 'div',\n null,\n this.state.instructions.map(function (line, index) {\n // audio effect:\n playStart();\n return _react2.default.createElement(\n 'span',\n { key: index },\n line,\n _react2.default.createElement('br', null)\n );\n })\n ),\n _react2.default.createElement('div', { id: 'crackedegg' }),\n _react2.default.createElement(\n 'div',\n null,\n _react2.default.createElement(\n 'form',\n { id: 'starter-form', onSubmit: this.getReady, autoComplete: 'off' },\n _react2.default.createElement('input', { id: 'user-input', placeholder: 'Who are you?', value: this.props.username, onChange: this.props.handleUserNameChange, autoFocus: true })\n )\n ),\n _react2.default.createElement(\n 'div',\n { id: 'overlay-start', onClick: this.startGame, className: 'blinking' },\n this.state.prompt\n )\n ),\n _react2.default.createElement(\n 'div',\n { className: 'timer' },\n _react2.default.createElement(\n 'h1',\n null,\n this.state.time\n )\n ),\n _react2.default.createElement(\n 'div',\n { className: 'board' },\n _react2.default.createElement(\n 'div',\n { className: 'play' },\n this.state.words.map(function (word, index) {\n return _react2.default.createElement(_Brick2.default, { word: word, key: index, powerup: _this5.state.powerups[word] ? _this5.state.powerups[word] : \"\" });\n }),\n _react2.default.createElement('div', { id: 'gudetama' }),\n _react2.default.createElement(\n 'form',\n { onSubmit: this.handleSubmit, autoComplete: 'off' },\n _react2.default.createElement('input', { id: 'typing-input', type: 'text', value: this.state.userInput, onChange: this.handleChange, onKeyUp: this.usePower })\n )\n ),\n _react2.default.createElement(\n 'div',\n { id: 'power-bank' },\n _react2.default.createElement(\n 'h5',\n null,\n 'Powers:'\n ),\n this.state.bankedPowers.map(function (powerup, index) {\n return _react2.default.createElement(_PowerBank2.default, { key: index, powerup: powerup });\n }),\n _react2.default.createElement(\n 'div',\n { id: 'legend' },\n _react2.default.createElement(\n 'div',\n { className: 'power1' },\n 'Pause (5s)'\n ),\n _react2.default.createElement(\n 'div',\n { className: 'power2' },\n 'Remove 1/2'\n ),\n _react2.default.createElement(\n 'div',\n { className: 'power0' },\n 'Remove All'\n )\n )\n ),\n _react2.default.createElement(\n 'div',\n { className: 'play', id: 'their-game' },\n this.state.theirWords.map(function (word, index) {\n return _react2.default.createElement(_Brick2.default, { word: word, key: index });\n }),\n _react2.default.createElement('div', { id: 'their-gudetama' }),\n _react2.default.createElement(\n 'form',\n { autoComplete: 'off' },\n _react2.default.createElement('input', { value: 'OPPONENT' })\n )\n )\n )\n );\n }\n }]);\n\n return Game;\n}(_react2.default.Component);\n\nexports.default = Game;\n/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../node_modules/process/browser.js */ \"./node_modules/process/browser.js\")))//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9jbGllbnQvc3JjL2NvbXBvbmVudHMvR2FtZS5qc3guanMiLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vY2xpZW50L3NyYy9jb21wb25lbnRzL0dhbWUuanN4PzE2ZWIiXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IFJlYWN0IGZyb20gJ3JlYWN0JztcbmltcG9ydCBCcmljayBmcm9tICcuL0JyaWNrLmpzeCc7XG5pbXBvcnQgYXhpb3MgZnJvbSAnYXhpb3MnO1xuaW1wb3J0IFBvd2VyQmFuayBmcm9tICcuL1Bvd2VyQmFuay5qc3gnO1xuXG5pbXBvcnQgeyBFRVhJU1Qgf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TtBQUNBO0FBQ0E7QUFBQTtBQUFBO0FBQ0E7QUFBQTtBQUFBO0FBQUE7QUFBQTtBQUNBO0FBQUE7QUFBQTtBQUFBO0FBQUE7QUFDQTtBQUFBO0FBQUE7QUFBQTtBQUFBO0FBSEE7QUFMQTtBQWNBO0FBQUE7QUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFBQTtBQUFBO0FBQ0E7QUFEQTtBQUxBO0FBMUJBO0FBekJBO0FBK0RBOzs7O0FBM2NBO0FBQ0E7QUE2Y0E7QSIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///./client/src/components/Game.jsx\n"); /***/ }), diff --git a/client/src/components/Game.jsx b/client/src/components/Game.jsx index 458d979..d114392 100644 --- a/client/src/components/Game.jsx +++ b/client/src/components/Game.jsx @@ -138,7 +138,6 @@ class Game extends React.Component { if (this.state.words.length >= 20) { clearTimeout(step); //console.log('opponent time',this.state.time) - console.log('REACT losing...'); socket.emit('i lost', { room: this.props.room, username: this.props.username, @@ -378,7 +377,7 @@ class Game extends React.Component { } addPower(word){ - var chance = 4; + var chance = 8; //1 in chance var rand = Math.floor(Math.random() * chance) + 1; var current; if(rand === 1){ @@ -387,6 +386,7 @@ class Game extends React.Component { } else { current = this.state.powerups; } + current[word] = "power" + Math.floor(Math.random() * 3); this.setState({ powerups: current @@ -422,7 +422,7 @@ class Game extends React.Component {

{this.state.time}

- {/* + {/*

GOD MODE

*/}