Merge branch 'luke' of bitbucket.org:LuckyLaszlo/ft_transcendence into cherif_back_and_game
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
import * as enumeration from './shared_js/enums';
|
||||
import * as pong from "./client/pong"
|
||||
import * as pongSpectator from "./client/pongSpectator" // TODO init spectator
|
||||
import { matchEnded, matchAbort } from "./client/ws";
|
||||
|
||||
//user's stuff
|
||||
let user;
|
||||
@@ -102,7 +103,8 @@
|
||||
if (invitation.token)
|
||||
{
|
||||
options.playerOneUsername = invitation.playerOneUsername;
|
||||
options.playerTwoUsername = user.username;
|
||||
options.playerTwoUsername = invitation.playerTwoUsername;
|
||||
options.isSomeoneIsInvited = true;
|
||||
pong.init(options, gameAreaId, invitation.token);
|
||||
showWaitPage = false
|
||||
hiddenGame = false;
|
||||
@@ -148,7 +150,7 @@
|
||||
console.log(error)
|
||||
|
||||
})
|
||||
showInvitation()
|
||||
showInvitation() // maybe useless
|
||||
initGameForPrivateParty(invitation)
|
||||
}
|
||||
</script>
|
||||
@@ -268,6 +270,9 @@
|
||||
#game_page {
|
||||
margin: 0;
|
||||
background-color: #222425;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
#canvas_container {
|
||||
margin-top: 20px;
|
||||
|
||||
@@ -53,6 +53,13 @@ export function init(options: InitOptions, gameAreaId: string, token: string)
|
||||
export function destroy()
|
||||
{
|
||||
// TODO
|
||||
if (pong)
|
||||
{
|
||||
clearInterval(pong.handleInputInterval);
|
||||
clearInterval(pong.gameLoopInterval);
|
||||
clearInterval(pong.drawLoopInterval);
|
||||
initPong(null);
|
||||
}
|
||||
}
|
||||
|
||||
function start()
|
||||
|
||||
@@ -11,6 +11,7 @@ import { sleep } from "./utils.js";
|
||||
import { Vector, VectorInteger } from "../shared_js/class/Vector.js";
|
||||
|
||||
export let matchEnded = false;
|
||||
export let matchAbort = false;
|
||||
|
||||
class ClientInfo {
|
||||
id = "";
|
||||
@@ -87,6 +88,7 @@ function preMatchListener(this: WebSocket, event: MessageEvent)
|
||||
startFunction();
|
||||
break;
|
||||
case en.EventTypes.matchAbort:
|
||||
matchAbort = true;
|
||||
socket.removeEventListener("message", preMatchListener);
|
||||
msg.matchAbort();
|
||||
break;
|
||||
|
||||
@@ -71,6 +71,13 @@ export class EventMatchEnd extends ServerEvent {
|
||||
}
|
||||
}
|
||||
|
||||
export class EventMatchAbort extends ServerEvent {
|
||||
|
||||
constructor() {
|
||||
super(en.EventTypes.matchAbort);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* From Client */
|
||||
export class ClientEvent {
|
||||
|
||||
Reference in New Issue
Block a user