lots of issusueesss, switchign compooters

This commit is contained in:
Ben Kyd
2021-05-09 22:52:37 +01:00
parent fbef3cf695
commit fa564614c2
6 changed files with 25 additions and 11 deletions

8
TODO
View File

@@ -39,13 +39,14 @@
✔ Game creation @done(21-04-26 17:38)
→ Multiplayer game logic
→ Process turns
Display turns on client
Display turns on client @done(21-05-09 22:45)
→ Server returns everything new to do with the game
✘ Singleplayer game logic - OUT OF SCOPE @cancelled(21-04-11 01:04)
✘ AI CPU player @cancelled(21-04-11 01:07)
☐ Client
Display multiplayer game info
Update dynamically
Display multiplayer game info @done(21-05-09 22:44)
Update dynamically @done(21-05-09 22:44)
☐ Code
→ Refactor to code portsoc eslint
@@ -53,6 +54,7 @@
→ WHY THE HELL ARE THEY CALLED USERS IN SOME PLACES AND PLAYERS IN OTHERS
☐ Bugfixes
→ If a user leaves their current game then makes a new one, it's corrupted
→ If a user disconnects during a game, the game is irrevokably corrupted

View File

@@ -88,7 +88,6 @@ function startMyTurn()
}
updateUsersUI(Users);
startMyTurnUI();
console.log('my turn', Users);
}
function startOthersTurn(useruid)
@@ -102,7 +101,6 @@ function startOthersTurn(useruid)
}
updateUsersUI(Users);
stopMyTurnUI();
console.log('not my turn', Users);
}
function playMyTurn(stagedpieces)
@@ -150,7 +148,8 @@ function skipMyTurn()
netSkipTurn();
}
function processOthersTurn()
function processTurn(turn)
{
removeStagedPieces();
renderBoardState(turn.boardtiles);
}

View File

@@ -247,7 +247,7 @@ function onGameBegin(socket, args)
function onStartTurn(socket, args)
{
console.log('my turn');
console.log('It\'s my turn!');
startMyTurn();
}
@@ -276,12 +276,12 @@ function onTurnError(socket, args)
function onturnProcessed(socket, args)
{
console.log('proc', args);
processTurn(args.outcome);
}
function onTurnStart(socket, args)
{
console.log('start', args);
console.log('Turn Starting!');
startOthersTurn(args.turninfo.turnplayer.uid);
}

View File

@@ -132,6 +132,12 @@ function renderBoardState(pieces)
setupPieces();
}
function removeStagedPieces()
{
for (const piece of document.querySelectorAll('.staged-piece'))
piece.remove();
}
// places for board coordinate (0-14)
function placePieceOnBoard(piece, x, y)
{

View File

@@ -97,6 +97,10 @@ function startMyTurnUI()
IPlayButton.forEach(e => {
e.disabled = false;
});
document.querySelectorAll('.unplayed-piece').forEach(e => {
if (e.classList.contains('played-piece'))
e.classList.remove('played-piece');
});
}
function stopMyTurnUI()
@@ -110,6 +114,10 @@ function stopMyTurnUI()
IPlayButton.forEach(e => {
e.disabled = true;
});
document.querySelectorAll('.unplayed-piece').forEach(e => {
if (!e.classList.contains('played-piece'))
e.classList.add('played-piece');
});
}
function onExchangeTiles()

View File

@@ -270,7 +270,6 @@ function PlayTurn(gameuid, playeruid, turn)
function SkipTurn(gameuid, playeruid)
{
console.log('skip');
gameNextTurn(gameuid);
}