diff --git a/config/default.json b/config/default.json index e463012..c679a23 100644 --- a/config/default.json +++ b/config/default.json @@ -432,6 +432,7 @@ "scene": "DO NOT SWITCH SCENE", "duration": "5" }, + "endGame":true, "delay": "5" } } diff --git a/package-lock.json b/package-lock.json index 43eb363..27f4f17 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,6 +18,7 @@ "node-fetch": "^2.6.7", "obs-websocket-js": "^4.0.3", "socket.io": "^4.4.1", + "squirrel": "^1.0.0", "update-electron-app": "^2.0.1" }, "devDependencies": { @@ -3019,6 +3020,11 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -3448,6 +3454,19 @@ "node": ">= 0.10" } }, + "node_modules/pull-core": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pull-core/-/pull-core-1.1.0.tgz", + "integrity": "sha512-j9cx14l4m4czQ7B85suR3QtdlAZWhQVY+OjcBHnhSh3Yu3XWJF2D720Ur9na7CxIGr2cZa1D15rrrY6xqMAvcA==" + }, + "node_modules/pull-stream": { + "version": "2.28.4", + "resolved": "https://registry.npmjs.org/pull-stream/-/pull-stream-2.28.4.tgz", + "integrity": "sha512-+uTgIM11eTOctGHxiTgNC/50qyM6PXcf8OxG1gTQIimamqlnIIxR0LjDbLWbeU1jfzg3EArVxknUQWEs8dmArw==", + "dependencies": { + "pull-core": "~1.1.0" + } + }, "node_modules/pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -3533,6 +3552,17 @@ "rc": "cli.js" } }, + "node_modules/read": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", + "integrity": "sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ==", + "dependencies": { + "mute-stream": "~0.0.4" + }, + "engines": { + "node": ">=0.8" + } + }, "node_modules/read-all-stream": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/read-all-stream/-/read-all-stream-3.1.0.tgz", @@ -3902,6 +3932,17 @@ "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", "optional": true }, + "node_modules/squirrel": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/squirrel/-/squirrel-1.0.0.tgz", + "integrity": "sha512-R63f6agVQIhzl58Bk/ecjomYt15J+F5XnOho0QBK+tUzLpKEy7V+dsMINB4ZCkrzLqOgfvAi1axwKgpkrqRxOw==", + "dependencies": { + "debug": "*", + "pull-stream": "^2", + "read": "^1", + "underscore": "^1" + } + }, "node_modules/statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", @@ -4124,6 +4165,11 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, + "node_modules/underscore": { + "version": "1.13.6", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", + "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==" + }, "node_modules/universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -6674,6 +6720,11 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==" }, + "mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==" + }, "natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -6992,6 +7043,19 @@ "ipaddr.js": "1.9.1" } }, + "pull-core": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pull-core/-/pull-core-1.1.0.tgz", + "integrity": "sha512-j9cx14l4m4czQ7B85suR3QtdlAZWhQVY+OjcBHnhSh3Yu3XWJF2D720Ur9na7CxIGr2cZa1D15rrrY6xqMAvcA==" + }, + "pull-stream": { + "version": "2.28.4", + "resolved": "https://registry.npmjs.org/pull-stream/-/pull-stream-2.28.4.tgz", + "integrity": "sha512-+uTgIM11eTOctGHxiTgNC/50qyM6PXcf8OxG1gTQIimamqlnIIxR0LjDbLWbeU1jfzg3EArVxknUQWEs8dmArw==", + "requires": { + "pull-core": "~1.1.0" + } + }, "pump": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.0.tgz", @@ -7045,6 +7109,14 @@ "strip-json-comments": "~2.0.1" } }, + "read": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/read/-/read-1.0.7.tgz", + "integrity": "sha512-rSOKNYUmaxy0om1BNjMN4ezNT6VKK+2xF4GBhc81mkH7L60i6dp8qPYrkndNLT3QPphoII3maL9PVC9XmhHwVQ==", + "requires": { + "mute-stream": "~0.0.4" + } + }, "read-all-stream": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/read-all-stream/-/read-all-stream-3.1.0.tgz", @@ -7321,6 +7393,17 @@ "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", "optional": true }, + "squirrel": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/squirrel/-/squirrel-1.0.0.tgz", + "integrity": "sha512-R63f6agVQIhzl58Bk/ecjomYt15J+F5XnOho0QBK+tUzLpKEy7V+dsMINB4ZCkrzLqOgfvAi1axwKgpkrqRxOw==", + "requires": { + "debug": "*", + "pull-stream": "^2", + "read": "^1", + "underscore": "^1" + } + }, "statuses": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz", @@ -7491,6 +7574,11 @@ "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=" }, + "underscore": { + "version": "1.13.6", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.13.6.tgz", + "integrity": "sha512-+A5Sja4HP1M08MaXya7p5LvjuM7K6q/2EaC0+iovj/wOcMsTzMvDFbasi/oSapiwOlt252IqsKqPjCl7huKS0A==" + }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", diff --git a/package.json b/package.json index 081e960..a589cea 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "east", - "version": "0.0.3", + "version": "0.0.4", "description": "Echo Arena Streaming Tool", "main": "main.js", "scripts": { @@ -23,6 +23,7 @@ "node-fetch": "^2.6.7", "obs-websocket-js": "^4.0.3", "socket.io": "^4.4.1", + "squirrel": "^1.0.0", "update-electron-app": "^2.0.1" }, "devDependencies": { diff --git a/public/roundBoard/index.html b/public/roundBoard/index.html new file mode 100644 index 0000000..816ea9c --- /dev/null +++ b/public/roundBoard/index.html @@ -0,0 +1,26 @@ + + + betweenRound + + + + + + + +
+
SCORES
+
+ + + +
+
+ + + +
+
BEST OF 3
+
+ + \ No newline at end of file diff --git a/public/scoreBoard/index.html b/public/scoreBoard/index.html new file mode 100644 index 0000000..4a80e32 --- /dev/null +++ b/public/scoreBoard/index.html @@ -0,0 +1,57 @@ + + + betweenRound + + + + + + + +
+
+ +
+
+
+
+ +
+ PTS + ASS + SAV + STN + POS + ATT +
+
+
+ +
+
+
+ +
+
+
+
+ PTS + ASS + SAV + STN + POS + ATT +
+ +
+
+
+
+ +
+
+ +
+
+ + \ No newline at end of file diff --git a/src/EventHandler.js b/src/EventHandler.js index 085bc86..5a50ea9 100644 --- a/src/EventHandler.js +++ b/src/EventHandler.js @@ -23,13 +23,17 @@ class EventHandler { clearTimeout(this.delay); clearTimeout(this.dur); this.delay = setTimeout(() => { - this.obsClient.send('SetCurrentScene', - { - "scene-name":this.config.end.ending.scene - }); - this.dur = setTimeout(() => { - this.obsClient.send('StopStreaming'); - }, this.config.end.ending.duration * 1000); + if(this.config.end.ending.scene !== "DO NOT SWITCH SCENE") { + this.obsClient.send('SetCurrentScene', + { + "scene-name":this.config.end.ending.scene + }); + } + if(this.config.end.endGame) { + this.dur = setTimeout(() => { + this.obsClient.send('StopStreaming'); + }, this.config.end.ending.duration * 1000); + } }, this.config.end.delay * 1000); } diff --git a/src/echo-arena-events/ScoreBoard.js b/src/echo-arena-events/ScoreBoard.js index e2b0f98..a41c838 100644 --- a/src/echo-arena-events/ScoreBoard.js +++ b/src/echo-arena-events/ScoreBoard.js @@ -32,7 +32,7 @@ class ScoreBoard { this.blue = gameData.blueTeam.playerStats; this.orange = gameData.orangeTeam.playerStats; - + console.log(this.blue); const send = (orange, blue) => { if(this.lastHalf === null || Math.floor(((Math.abs(this.lastHalf - Date.now())) / 1000) / 60) >= 1) { eventEmitter.send('local.halfTimeStats', { diff --git a/src/echo-arena-events/ScoreChanged.js b/src/echo-arena-events/ScoreChanged.js index 29b9021..d6e5822 100644 --- a/src/echo-arena-events/ScoreChanged.js +++ b/src/echo-arena-events/ScoreChanged.js @@ -12,7 +12,7 @@ class ScoreChanged { this.orangePoints = gameData.orangeTeam.points; return; } - if (this.orangePoints != gameData.orangeTeam.points || this.bluePoints != gameData.blueTeam.points) { + if ((this.orangePoints != gameData.orangeTeam.points || this.bluePoints != gameData.blueTeam.points)) { this.bluePoints = gameData.blueTeam.points; this.orangePoints = gameData.orangeTeam.points; let team; @@ -44,13 +44,17 @@ class ScoreChanged { blue: this.bluePoints, orange: this.orangePoints }; - eventEmitter.send('game.scoreChanged', { - blue: this.bluePoints, - orange: this.orangePoints, - data:this.data, - name:this.name, - clip:false - }); + //fix 0-0 bug + if(gameData.orangeTeam.points != 0 && gameData.blueTeam.points != 0) { + eventEmitter.send('game.scoreChanged', { + blue: this.bluePoints, + orange: this.orangePoints, + data:this.data, + name:this.name, + clip:false + }); + } + } } } diff --git a/src/gameData.js b/src/gameData.js index be13c30..b8ff965 100644 --- a/src/gameData.js +++ b/src/gameData.js @@ -1,3 +1,4 @@ +/* eslint-disable camelcase */ class GameData { constructor(json, vrmlInfo, customData, pingTracking = false) { this.vrmlInfo = vrmlInfo; @@ -38,13 +39,13 @@ class GameData { this.discPosition = [json.disc.position[0], json.disc.position[2]]; this.lastscore = json.last_score; - this.pointAmount = this.lastscore.pointAmount; - this.personScored = this.lastscore.personScored; - this.assistScored = this.lastscore.assistScored; + this.point_amount = this.lastscore.point_amount; + this.person_scored = this.lastscore.person_scored; + this.assist_scored = this.lastscore.assist_scored; this.team = this.lastscore.team; - this.distanceThrown = this.lastscore.distanceThrown; + this.distance_thrown = this.lastscore.distance_thrown; this.round = json.blue_round_score + json.orange_round_score + 1; this.totalRound = json.total_round_count; @@ -54,7 +55,9 @@ class GameData { if(this.blueTeam.blueTeamPlayers.length !== 0 && this.blueTeam.blueTeamPlayers !== undefined) { for (let player of this.blueTeam.blueTeamPlayers) { - player.stats.possessionTime = Math.round(player.stats.possessionTime); + + // eslint-disable-next-line camelcase + player.stats.possession_time = Math.round(player.stats.possession_time); this.blueTeam.playerStats.push({ name:player.name, stats:player.stats, @@ -77,7 +80,9 @@ class GameData { if(this.orangeTeam.orangeTeamPlayers !== 0 && this.orangeTeam.orangeTeamPlayers !== undefined) { for (let player of this.orangeTeam.orangeTeamPlayers) { - player.stats.possessionTime = Math.round(player.stats.possessionTime); + + // eslint-disable-next-line camelcase + player.stats.possession_time = Math.round(player.stats.possession_time); this.orangeTeam.playerStats.push({ name:player.name, stats:player.stats, diff --git a/ui/index.html b/ui/index.html index 55bf8da..6d6b5ac 100644 --- a/ui/index.html +++ b/ui/index.html @@ -223,6 +223,7 @@

Mixed Mode

diff --git a/ui/preload.js b/ui/preload.js index 32e5dd8..16accc0 100644 --- a/ui/preload.js +++ b/ui/preload.js @@ -21,6 +21,7 @@ const initAutoStream = (document) => { const between = document.getElementById('between-scene[0]'); const clips = document.getElementById('clips'); const buffer = document.getElementById('buffer'); + const endGame = document.getElementById('button-end-game'); data.events.map((eventName) => { const opt = document.createElement('option'); @@ -52,6 +53,7 @@ const initAutoStream = (document) => { scene:end.value, duration:delay.value }, + endGame:endGame.checked, delay: durEnd.value, }); }; @@ -107,6 +109,7 @@ const initAutoStream = (document) => { event.addEventListener('change', (event) => { switchEvent(event.target.value); }); + endGame.addEventListener('change', sendEnd); between.addEventListener('change',sendStart); state.addEventListener('change', sendEvent); dur.oninput = () => {sendEvent();}; @@ -535,6 +538,7 @@ const initVrmlMatchMode = (document) => { const delay = document.getElementById('end-duration[0]'); const durEnd = document.getElementById('delay-after-end-game'); const between = document.getElementById('between-scene[0]'); + const endGame = document.getElementById('button-end-game'); sceneSelects && [...sceneSelects].forEach((sceneSelect) => { const noSwitch = document.createElement('option'); @@ -563,6 +567,7 @@ const initVrmlMatchMode = (document) => { events = data.game.events; between.value = data.start.between; BetweenRoundDur.value = data.start.dur; + endGame.checked = data.end.endGame; }); ipcRenderer.send("log", 'OBS Scenes loaded'); });