delete compiled js
This commit is contained in:
parent
113c6d105a
commit
a4a968c408
1 changed files with 0 additions and 59 deletions
|
@ -1,59 +0,0 @@
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
||||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
||||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
||||||
});
|
|
||||||
};
|
|
||||||
import { Game } from "./net/game.js";
|
|
||||||
import { InitialState, onLogic } from "./logic/logic.js";
|
|
||||||
import { startGraphicsUpdater } from "./renderer.js";
|
|
||||||
import { GameKeyMap, Key } from "./types.js";
|
|
||||||
const join = document.getElementById("join");
|
|
||||||
const lobby = document.getElementById("lobby");
|
|
||||||
lobby.style.display = "none";
|
|
||||||
join.onsubmit = function (event) {
|
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
|
||||||
event.preventDefault();
|
|
||||||
const room_code = document.getElementById("room_code").value;
|
|
||||||
const player_name = document.getElementById("player_name").value;
|
|
||||||
if (room_code == '') {
|
|
||||||
alert('Please enter a room code');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (player_name == '') {
|
|
||||||
alert('Please enter a player name');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
join.style.display = "none";
|
|
||||||
startGame(room_code, player_name);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
const updateGraphics = startGraphicsUpdater();
|
|
||||||
const onLoad = (startData) => {
|
|
||||||
if (startData.data.started) {
|
|
||||||
alert('Room has already started');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
let players = Object.values(startData.data.players).filter(p => { return p !== null && p.name !== undefined; });
|
|
||||||
if (players.length >= 4) {
|
|
||||||
alert('Room is full');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
lobby.style.display = "";
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
const onFrame = (data, frame) => {
|
|
||||||
updateGraphics(data ? data.data : InitialState, frame);
|
|
||||||
};
|
|
||||||
const startGame = (code, name) => {
|
|
||||||
const game = new Game(3000);
|
|
||||||
game.start(code, GameKeyMap, onLoad, onFrame, onLogic, {
|
|
||||||
start: false,
|
|
||||||
key: Key.NOTHING,
|
|
||||||
name
|
|
||||||
});
|
|
||||||
};
|
|
||||||
//# sourceMappingURL=main.js.map
|
|
Loading…
Reference in a new issue