fix bug with redundant play/pause events, fix spec, tweak current moderator css

This commit is contained in:
AlecM33
2023-04-08 16:01:39 -04:00
parent f1a5df94e2
commit bef8cd8d59
6 changed files with 25 additions and 22 deletions

View File

@@ -188,7 +188,8 @@ export class InProgress {
toast('You have been killed!', 'warning', true, true, 'medium'); toast('You have been killed!', 'warning', true, true, 'medium');
} else { } else {
toast(killedPlayer.name + ' was killed!', 'warning', true, true, 'medium'); toast(killedPlayer.name + ' was killed!', 'warning', true, true, 'medium');
if (killedPlayer.userType === globals.USER_TYPES.MODERATOR) { if (killedPlayer.userType === globals.USER_TYPES.MODERATOR
&& this.stateBucket.currentGameState.client.userType !== globals.USER_TYPES.TEMPORARY_MODERATOR) {
SharedStateUtil.displayCurrentModerator(killedPlayer); SharedStateUtil.displayCurrentModerator(killedPlayer);
} }
} }

View File

@@ -21,8 +21,8 @@
border-radius: 5px; border-radius: 5px;
color: #d7d7d7; color: #d7d7d7;
background-color: #16141e; background-color: #16141e;
width: fit-content; padding: 0 10px;
padding: 0 20px; width: 90%;
margin-bottom: 0.5em; margin-bottom: 0.5em;
} }
@@ -74,7 +74,7 @@
flex-wrap: wrap; flex-wrap: wrap;
display: flex; display: flex;
width: 100%; width: 100%;
margin: 1em auto 140px auto; margin: 0 auto 140px auto;
} }
#game-state-container h2 { #game-state-container h2 {

View File

@@ -9,7 +9,7 @@
"build:dev": "webpack --watch --config client/webpack/webpack-dev.config.js --mode=development", "build:dev": "webpack --watch --config client/webpack/webpack-dev.config.js --mode=development",
"start:dev": "NODE_ENV=development && webpack --config client/webpack/webpack-dev.config.js --mode=development && nodemon index.js", "start:dev": "NODE_ENV=development && webpack --config client/webpack/webpack-dev.config.js --mode=development && nodemon index.js",
"start:dev:no-hot-reload": "NODE_ENV=development && webpack --config client/webpack/webpack-dev.config.js --mode=development && node index.js", "start:dev:no-hot-reload": "NODE_ENV=development && webpack --config client/webpack/webpack-dev.config.js --mode=development && node index.js",
"start:dev:windows": "SET NODE_ENV=development && webpack --config client/webpack/webpack-dev.config.js --mode=development && nodemon index.js", "start:dev:windows": "SET NODE_ENV=development && webpack --config client/webpack/webpack-dev.config.js --mode=development && nodemon index.js -- loglevel=debug",
"start:dev:windows:no-hot-reload:debug": "SET NODE_ENV=development && webpack --config client/webpack/webpack-dev.config.js --mode=development && node --inspect index.js", "start:dev:windows:no-hot-reload:debug": "SET NODE_ENV=development && webpack --config client/webpack/webpack-dev.config.js --mode=development && node --inspect index.js",
"start:dev:windows:no-hot-reload": "SET NODE_ENV=development && webpack --config client/webpack/webpack-dev.config.js --mode=development && node index.js", "start:dev:windows:no-hot-reload": "SET NODE_ENV=development && webpack --config client/webpack/webpack-dev.config.js --mode=development && node index.js",
"start": "NODE_ENV=production node index.js -- loglevel=debug", "start": "NODE_ENV=production node index.js -- loglevel=debug",

View File

@@ -66,13 +66,15 @@ class ServerTimer {
} }
stopTimer () { stopTimer () {
this.logger.debug('STOPPING TIMER');
if (this.ticking) { if (this.ticking) {
this.logger.debug('STOPPING TIMER');
clearTimeout(this.ticking); clearTimeout(this.ticking);
this.ticking = null;
} }
} }
resumeTimer () { resumeTimer () {
if (!this.ticking) {
this.logger.debug('RESUMING TIMER FOR ' + this.currentTimeInMillis + 'ms'); this.logger.debug('RESUMING TIMER FOR ' + this.currentTimeInMillis + 'ms');
this.start = Date.now(); this.start = Date.now();
this.totalTime = this.currentTimeInMillis; this.totalTime = this.currentTimeInMillis;
@@ -87,6 +89,7 @@ class ServerTimer {
return this.timesUpPromise; return this.timesUpPromise;
} }
}
} }
function convertFromMinutesToMilliseconds (minutes) { function convertFromMinutesToMilliseconds (minutes) {

View File

@@ -59,7 +59,7 @@ class EventManager {
try { try {
messageComponents = message.split(';', 3); messageComponents = message.split(';', 3);
if (messageComponents[messageComponents.length - 1] === this.instanceId) { if (messageComponents[messageComponents.length - 1] === this.instanceId) {
this.logger.trace('Disregarding self-authored message'); this.logger.debug('Disregarding self-authored message');
return; return;
} }
args = JSON.parse( args = JSON.parse(

View File

@@ -21,12 +21,11 @@ describe('ServerTimer', () => {
serverTimer = new ServerTimer(1, 0, 10, logger); serverTimer = new ServerTimer(1, 0, 10, logger);
spyOn(global, 'clearTimeout'); spyOn(global, 'clearTimeout');
serverTimer.runTimer(false).then(() => { serverTimer.runTimer(false).then(() => {
fail(); serverTimer.stopTimer();
expect(clearTimeout).toHaveBeenCalledWith(serverTimer.ticking);
}).catch((e) => { }).catch((e) => {
fail(e); fail(e);
}); });
serverTimer.stopTimer();
expect(clearTimeout).toHaveBeenCalledWith(serverTimer.ticking);
}); });
it('should stop and resume the timer', async () => { it('should stop and resume the timer', async () => {