diff --git a/client/img/icone.icns b/client/img/icone.icns new file mode 100644 index 0000000..589c0f5 Binary files /dev/null and b/client/img/icone.icns differ diff --git a/client/js/client.js b/client/js/client.js index 87f7c9e..2b70ce1 100644 --- a/client/js/client.js +++ b/client/js/client.js @@ -65,7 +65,7 @@ function displayTurn(turn){ case 2: displayHumanTurnDiv.classList.add('hidden'); displayIaTurnDiv.classList.remove('hidden'); - break; + break; default: displayHumanTurnDiv.classList.add('hidden'); displayIaTurnDiv.classList.add('hidden'); @@ -74,7 +74,7 @@ function displayTurn(turn){ } function hideGameOver(){ - var gameOverDiv = document.getElementById('gameover'); + const gameOverDiv = document.getElementById('gameover'); gameOverDiv.classList.add('hidden'); } @@ -116,11 +116,11 @@ ipcRenderer.on('humanMoved', (event, data) => { ipcRenderer.on('iaMoved', (event, data) => { console.log('Event : iaMoved'); updateGrid(data.board); + humanCanPlay = true; + displayTurn(1); if (data.gameOver !== 0){ displayGameOver(data.gameOver); } - humanCanPlay = true; - displayTurn(1); }); newGame(); diff --git a/main.js b/main.js index d11edad..421e00b 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,6 @@ const {dialog, BrowserWindow, app, ipcMain, Tray} = require('electron') const Puissance4 = require('./puissance4'); -const minMaxWorker = require('child_process').fork('./minmax'); +const minMaxWorker = require('child_process').fork(`${__dirname}/minmax`); let browserWindow, tray, game; @@ -11,17 +11,17 @@ const createBrowserWindow = () => { } const createTray = () => { - tray = new Tray('client/img/red.png'); + tray = new Tray(`${__dirname}/client/img/red.png`); tray.setToolTip('A vous de jouer.'); } const updateTray = (event) => { let image, tooltip; if (event === 'humanMoved') { - image = 'client/img/yellow.png' + image = `${__dirname}/client/img/yellow.png` tooltip = 'A Electron de jouer'; } else { - image = 'client/img/red.png' + image = `${__dirname}/client/img/red.png` tooltip = 'A vous de jouer'; } tray.setImage(image); diff --git a/package.json b/package.json index b8304de..ea218e2 100644 --- a/package.json +++ b/package.json @@ -16,8 +16,10 @@ }, "build": { "appId": "com.electron.puissance4", + "productName": "Puissance 4", "mac": { - "category": "public.app-category.games" + "category": "public.app-category.games", + "icon": "client/img/icone.icns" } } }