-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 90a290c
Showing
16 changed files
with
6,493 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Debug", | ||
"type": "pwa-node", | ||
"request": "launch", | ||
"args": ["src/index.js"], | ||
"cwd": "${workspaceRoot}", | ||
"internalConsoleOptions": "openOnSessionStart", | ||
"resolveSourceMapLocations": [ | ||
"${workspaceFolder}/**", | ||
"!**/node_modules/**" | ||
], | ||
"skipFiles": ["<node_internals>/**", "node_modules/**"] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Welcome to Colyseus! | ||
|
||
This project has been created using [⚔️ `create-colyseus-app`](https://github.com/colyseus/create-colyseus-app/) - an npm init template for kick starting a Colyseus project in TypeScript. | ||
|
||
[Documentation](http://docs.colyseus.io/) | ||
|
||
## :crossed_swords: Usage | ||
|
||
``` | ||
npm start | ||
``` | ||
|
||
## Structure | ||
|
||
- `index.js`: main entry point, register an empty room handler and attach [`@colyseus/monitor`](https://github.com/colyseus/colyseus-monitor) | ||
- `src/rooms/MyRoom.js`: an empty room handler for you to implement your logic | ||
- `src/rooms/schema/MyRoomState.js`: an empty schema used on your room's state. | ||
- `loadtest/example.js`: scriptable client for the loadtest tool (see `npm run loadtest`) | ||
- `package.json`: | ||
- `scripts`: | ||
- `npm start`: runs `node index.js` | ||
- `npm test`: runs mocha test suite | ||
- `npm run loadtest`: runs the [`@colyseus/loadtest`](https://github.com/colyseus/colyseus-loadtest/) tool for testing the connection, using the `loadtest/example.js` script. | ||
- `tsconfig.json`: TypeScript configuration file | ||
|
||
|
||
## License | ||
|
||
MIT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
NODE_ENV=production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<link rel="stylesheet" href="./public/css/style.css"> | ||
<title>Roomy Tic-tac-toe</title> | ||
</head> | ||
<body> | ||
Tic-tac-toe | ||
<script src="https://unpkg.com/colyseus.js@^0.14.0/dist/colyseus.js"></script> | ||
<script src="./public/js/script.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
*{ | ||
background-color: wheat; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
var client = new Colyseus.Client('ws://localhost:2567'); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
NODE_ENV=development | ||
SOMETHING=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
export function requestJoinOptions (i) { | ||
return { requestNumber: i }; | ||
} | ||
|
||
export function onJoin () { | ||
console.log(this.sessionId, "joined."); | ||
|
||
this.onMessage("*", (type, message) => { | ||
console.log(this.sessionId, "received:", type, message); | ||
}); | ||
} | ||
|
||
export function onLeave () { | ||
console.log(this.sessionId, "left."); | ||
} | ||
|
||
export function onError (err) { | ||
console.log(this.sessionId, "!! ERROR !!", err.message); | ||
} | ||
|
||
export function onStateChange (state) { | ||
console.log(this.sessionId, "new state:", state); | ||
} |
Oops, something went wrong.