Bro
This commit is contained in:
7
TODO
7
TODO
@@ -15,11 +15,9 @@
|
||||
→ French (Alexendro)
|
||||
→ Czech (Mikdore)
|
||||
|
||||
|
||||
✔ Sort out how intents work in game transitioning @done(21-04-12 21:09)
|
||||
|
||||
☐ Lobbying logic
|
||||
✔ Create, join, delete and leave lobbies @done(21-04-12 20:51)
|
||||
✔ Sort out how intents work in game transitioning @done(21-04-12 21:09)
|
||||
→ Make lobbies publically discoverable on a list
|
||||
|
||||
☐ Dictionary
|
||||
@@ -38,3 +36,6 @@
|
||||
☐ Code
|
||||
→ Refactor to code portsoc eslint
|
||||
→ Refactor game client
|
||||
|
||||
☐ Bugfixes
|
||||
→ If a user disconnects during a game, the game is irrevokably corrupted
|
||||
|
||||
@@ -7,8 +7,7 @@ function computeTurn()
|
||||
}
|
||||
|
||||
|
||||
function initGame()
|
||||
function initGame(boardstate, players, tiles)
|
||||
{
|
||||
|
||||
}
|
||||
initGame();
|
||||
|
||||
@@ -23,7 +23,7 @@ function initMultiplayer()
|
||||
socket.on('identify-success', args => onIdentifySuccess(socket, args));
|
||||
socket.on('identify-error', args => onIdentifyError(socket, args));
|
||||
|
||||
socket.on('game-start', args => console.log(args));
|
||||
socket.on('game-begin', args => onGameBegin(socket, args));
|
||||
|
||||
}
|
||||
|
||||
@@ -101,6 +101,24 @@ function onDisconnect()
|
||||
|
||||
}
|
||||
|
||||
function onGameBegin(socket, args)
|
||||
{
|
||||
|
||||
if (!args)
|
||||
{
|
||||
ConnectionState.innerHTML = localeString('error-game-begin');
|
||||
return;
|
||||
}
|
||||
|
||||
if (!args.game.uid)
|
||||
{
|
||||
ConnectionState.innerHTML = localeString('error-game-begin');
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// is game singleplayer?
|
||||
|
||||
@@ -15,6 +15,7 @@ error-bad-intent:Client has no intent
|
||||
error-bold:ERROR
|
||||
error-cannot-join-lobby:Cannot join lobby
|
||||
error-creating-lobby:An error occurred while creating the lobby
|
||||
error-game-begin:There was an error starting the game
|
||||
error-illegal-intent:Illegal intent
|
||||
error-illegal-lobby:Illegal lobby
|
||||
error-illegal-user:Illegal user
|
||||
|
||||
@@ -14,6 +14,7 @@ error-bad-intent:Cliente no tiene intención
|
||||
error-bold:ERRO
|
||||
error-cannot-join-lobby:No se puede unir al lobby
|
||||
error-creating-lobby:Ocurrió un error al crear el lobby
|
||||
error-game-begin:
|
||||
error-illegal-intent:
|
||||
error-illegal-lobby:Lobby ilegal
|
||||
error-illegal-user:Usuario ilegal
|
||||
|
||||
@@ -64,6 +64,11 @@
|
||||
"es": "Ocurrió un error al crear el lobby",
|
||||
"pt": "Ocorreu um erro ao criar o lobby"
|
||||
},
|
||||
"error-game-begin": {
|
||||
"en": "There was an error starting the game",
|
||||
"es": "",
|
||||
"pt": ""
|
||||
},
|
||||
"error-illegal-intent": {
|
||||
"en": "Illegal intent",
|
||||
"es": "",
|
||||
|
||||
@@ -1,15 +1,3 @@
|
||||
43997
|
||||
, [CAT=punct1a]
|
||||
; [CAT=punct1b]
|
||||
: [CAT=punct1c]
|
||||
" [CAT=punct2d]
|
||||
( [CAT=punct2e]
|
||||
) [CAT=punct2f]
|
||||
! [CAT=punctg]
|
||||
? [CAT=puncth]
|
||||
. [CAT=puncti]
|
||||
... [CAT=punctj]
|
||||
à [$ao$CAT=cp,Prep=a,Art=o$G=f,N=s]
|
||||
abacateiro/p [CAT=nc,G=m,N=s]
|
||||
abacate/p [CAT=nc,G=m,N=s]
|
||||
abacaxi/p [CAT=nc,G=m,N=s]
|
||||
|
||||
@@ -14,6 +14,7 @@ error-bad-intent:Cliente não tem intenção
|
||||
error-bold:ERROR
|
||||
error-cannot-join-lobby:Não é possível entrar no lobby
|
||||
error-creating-lobby:Ocorreu um erro ao criar o lobby
|
||||
error-game-begin:
|
||||
error-illegal-intent:
|
||||
error-illegal-lobby:Lobby ilegal
|
||||
error-illegal-user:Usuário ilegal
|
||||
|
||||
@@ -70,12 +70,29 @@ function BeginGame(lobby)
|
||||
locale: gameowner.locale,
|
||||
players: players,
|
||||
turn: 0,
|
||||
tilebag: tilebag
|
||||
tilebag: tilebag,
|
||||
tileset: Dist.GetTileSet(gameowner.locale)
|
||||
};
|
||||
|
||||
return ActiveGames[lobby.uid];
|
||||
}
|
||||
|
||||
/*
|
||||
TURN OBJECT
|
||||
{
|
||||
|
||||
}
|
||||
NOTES
|
||||
- Turns are handled a little weird, client sends turn on turn end and
|
||||
this function validates it and changes the state of the game before
|
||||
returning an error or a validation object including the next players
|
||||
turn
|
||||
*/
|
||||
function PlayTurn(game, turn)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// returns tuple ([newtileset], [newusertiles])
|
||||
function ExchangeTiles(tileset, tilesToExchange)
|
||||
{
|
||||
@@ -90,5 +107,11 @@ function SelectTilesFromBag(tileset, num)
|
||||
|
||||
|
||||
module.exports = {
|
||||
// Game validation exports
|
||||
|
||||
// Get game exports
|
||||
|
||||
// Change game state exports
|
||||
BeginGame: BeginGame,
|
||||
PlayTurn: PlayTurn
|
||||
}
|
||||
|
||||
@@ -239,6 +239,15 @@ Distributions['cs'] = {
|
||||
]
|
||||
};
|
||||
|
||||
function GetDist(locale)
|
||||
{
|
||||
return Distributions[locale];
|
||||
}
|
||||
|
||||
function GetTileSet(locale)
|
||||
{
|
||||
return Distributions[locale].tileset;
|
||||
}
|
||||
|
||||
function GenerateStartStateDistribution(locale)
|
||||
{
|
||||
@@ -263,5 +272,7 @@ function GenerateStartStateDistribution(locale)
|
||||
module.exports = {
|
||||
Distributions: Distributions,
|
||||
|
||||
GetDist: GetDist,
|
||||
GetTileSet: GetTileSet,
|
||||
GenerateStartStateDistribution: GenerateStartStateDistribution
|
||||
};
|
||||
|
||||
@@ -69,6 +69,7 @@ async function Router(socket)
|
||||
// socket will emit game begin with play order and starting tiles
|
||||
// once all clients have connected with identify
|
||||
socket.on('lobby-game-begin', args => LobbyGameBegin(socket, args));
|
||||
socket.on('game-play-turn', args => GamePlayTurn(socket, args))
|
||||
|
||||
|
||||
socket.on('disconnect', args => HandleDisconnect(socket, ...args));
|
||||
@@ -128,6 +129,7 @@ function ClientIdentify(socket, args)
|
||||
// so make sure that they are joined into a lobby for
|
||||
// the networking
|
||||
socket.join(lobby.uid);
|
||||
console.log(io.sockets.adapter.rooms);
|
||||
|
||||
// If this user was the last player in the lobby to connect
|
||||
// start the game and tell every connected user
|
||||
@@ -340,6 +342,7 @@ function LobbyUserUnReady(socket, args)
|
||||
if (!Game.Lobbies.IsLobbyReady(lobby.uid)) LobbyUpdateCallback(user, lobby, 'game-unready');
|
||||
}
|
||||
|
||||
|
||||
function LobbyGameBegin(socket, args)
|
||||
{
|
||||
const user = Game.Registrar.GetUserbyConnection(socket.id);
|
||||
@@ -361,6 +364,11 @@ function LobbyGameBegin(socket, args)
|
||||
io.to(lobby.uid).emit('request-intent-change', { intent: 'GAMETRANSITION', lobby: lobby });
|
||||
}
|
||||
|
||||
function GamePlayTurn(socket, args)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
function HandleDisconnect(socket, args)
|
||||
{
|
||||
@@ -414,11 +422,8 @@ function EmitGameBegin(game)
|
||||
game: game
|
||||
});
|
||||
|
||||
console.log(game);
|
||||
|
||||
// for (const user of game.players)
|
||||
// {
|
||||
// const gameuser = game.players.filter(i => i.uid === user.uid)[0];
|
||||
|
||||
// }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user