Skip to content

Commit

Permalink
Merge pull request #58 from NotBlue-Dev/develop
Browse files Browse the repository at this point in the history
fix+individual+checkEnd
  • Loading branch information
NotBlue-Dev authored Oct 25, 2022
2 parents e3e3987 + 551cfa2 commit 011ee0d
Show file tree
Hide file tree
Showing 11 changed files with 219 additions and 24 deletions.
1 change: 1 addition & 0 deletions config/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,7 @@
"scene": "DO NOT SWITCH SCENE",
"duration": "5"
},
"endGame":true,
"delay": "5"
}
}
Expand Down
88 changes: 88 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "east",
"version": "0.0.3",
"version": "0.0.4",
"description": "Echo Arena Streaming Tool",
"main": "main.js",
"scripts": {
Expand All @@ -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": {
Expand Down
26 changes: 26 additions & 0 deletions public/roundBoard/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<html>
<head>
<title>betweenRound</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script src="https://cdn.socket.io/4.4.1/socket.io.js"></script>
<script src="/betweenRound/renderer.js"></script>
<link rel="stylesheet" href="/betweenRound/style.css">
<link rel="stylesheet" href="/style.css">
</head>
<body>
<div class="scores">
<div class="sc"><a>SCORES</a></div>
<div class="top">
<div id="R1B" class="RoundB"><a id="R1B_SCORE">R1</a></div>
<div id="R2B" class="RoundB"><a id="R2B_SCORE">R2</a></div>
<div id="R3B" class="RoundB"><a id="R3B_SCORE">R3</a></div>
</div>
<div class="bottom">
<div id="R1O" class="RoundO "><a id="R1O_SCORE">R1</a></div>
<div id="R2O" class="RoundO "><a id="R2O_SCORE">R2</a></div>
<div id="R3O" class="RoundO"><a id="R3O_SCORE">R3</a></div>
</div>
<div class="sc"><a>BEST OF 3</a></div>
</div>
</body>
</html>
57 changes: 57 additions & 0 deletions public/scoreBoard/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<html>
<head>
<title>betweenRound</title>
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<script src="https://cdn.socket.io/4.4.1/socket.io.js"></script>
<script src="/betweenRound/renderer.js"></script>
<link rel="stylesheet" href="/betweenRound/style.css">
<link rel="stylesheet" href="/style.css">
</head>
<body>
<div class="cont">
<div class="orange">
<img id="LogoA" class="LogoO hide">
<div class="stats">
<div class="title">
<div class="contain">
<div class="teamO">
<a id="nameA"></a>
</div>
<a>PTS</a>
<a>ASS</a>
<a>SAV</a>
<a>STN</a>
<a>POS</a>
<a>ATT</a>
</div>
</div>
<div id="playersOrange">

</div>
</div>
</div>

<div class="blue">
<div class="stats">
<div class="title">
<div class="contain b">
<a>PTS</a>
<a>ASS</a>
<a>SAV</a>
<a>STN</a>
<a>POS</a>
<a>ATT</a>
<div class="teamB">
<a id="nameB"></a>
</div>
</div>
</div>
<div id="playersBlue">

</div>
</div>
<img id="LogoB" class="LogoB hide">
</div>
</div>
</body>
</html>
18 changes: 11 additions & 7 deletions src/EventHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
2 changes: 1 addition & 1 deletion src/echo-arena-events/ScoreBoard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', {
Expand Down
20 changes: 12 additions & 8 deletions src/echo-arena-events/ScoreChanged.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
});
}

}
}
}
Expand Down
17 changes: 11 additions & 6 deletions src/gameData.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable camelcase */
class GameData {
constructor(json, vrmlInfo, customData, pingTracking = false) {
this.vrmlInfo = vrmlInfo;
Expand Down Expand Up @@ -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;

Expand All @@ -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,
Expand All @@ -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,
Expand Down
Loading

0 comments on commit 011ee0d

Please sign in to comment.