From 1a2dc20435b2f317d20054d8673e819ebc395c3f Mon Sep 17 00:00:00 2001 From: Miguel Angel Astor Romero Date: Wed, 31 Oct 2018 06:04:33 -0400 Subject: [PATCH] Changed some site UI stuff. --- docs/js/eth.js | 3 ++- docs/js/game.js | 2 +- src/js/eth.js | 3 ++- src/js/game.js | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/docs/js/eth.js b/docs/js/eth.js index edc443e..d2f72e3 100644 --- a/docs/js/eth.js +++ b/docs/js/eth.js @@ -10,6 +10,7 @@ function canIPlayTheGame() { if (result.logs[0].args.player === myAccount) { $('#can_play').text(myAccount + ' can play the game!'); getTimesPlayed(); + loadBalance(); playTheGame(); } else { alert("Whoops! An error ocurred.\nThanks for your money, though :P"); @@ -26,7 +27,6 @@ function loadBalance() { myWeb3.eth.getBalance(account, function(err, balance) { if (err === null) { $('#balance').text(myWeb3.fromWei(balance, "ether") + " ETH"); - $('#can_play').text(myAccount + " can't play the game... so sad!"); } }); } @@ -65,6 +65,7 @@ function initWeb3() { // update UI loadBalance(); getTimesPlayed(); + $('#can_play').text(myAccount + " can't play the game... so sad!"); // Register call and listen for events. ethCallback = canIPlayTheGame; diff --git a/docs/js/game.js b/docs/js/game.js index 781b70a..0fcc8ae 100644 --- a/docs/js/game.js +++ b/docs/js/game.js @@ -40,7 +40,7 @@ function randSig() { function startGame() { if (ethCallback !== null) { - canIPlayTheGame() + ethCallback(); } else { alert("Can't play the game\nWeb3 not initialized."); } diff --git a/src/js/eth.js b/src/js/eth.js index edc443e..d2f72e3 100644 --- a/src/js/eth.js +++ b/src/js/eth.js @@ -10,6 +10,7 @@ function canIPlayTheGame() { if (result.logs[0].args.player === myAccount) { $('#can_play').text(myAccount + ' can play the game!'); getTimesPlayed(); + loadBalance(); playTheGame(); } else { alert("Whoops! An error ocurred.\nThanks for your money, though :P"); @@ -26,7 +27,6 @@ function loadBalance() { myWeb3.eth.getBalance(account, function(err, balance) { if (err === null) { $('#balance').text(myWeb3.fromWei(balance, "ether") + " ETH"); - $('#can_play').text(myAccount + " can't play the game... so sad!"); } }); } @@ -65,6 +65,7 @@ function initWeb3() { // update UI loadBalance(); getTimesPlayed(); + $('#can_play').text(myAccount + " can't play the game... so sad!"); // Register call and listen for events. ethCallback = canIPlayTheGame; diff --git a/src/js/game.js b/src/js/game.js index 781b70a..0fcc8ae 100644 --- a/src/js/game.js +++ b/src/js/game.js @@ -40,7 +40,7 @@ function randSig() { function startGame() { if (ethCallback !== null) { - canIPlayTheGame() + ethCallback(); } else { alert("Can't play the game\nWeb3 not initialized."); }