chatchat/src/index.ts

51 lines
1.2 KiB
TypeScript
Raw Normal View History

2020-12-27 18:28:06 +00:00
import "core-js/stable";
import "whatwg-fetch";
2020-10-01 00:44:52 +00:00
import * as FontFaceObserver from 'fontfaceobserver';
2020-09-30 19:38:09 +00:00
import * as PIXI from 'pixi.js';
2020-10-01 00:44:52 +00:00
import './assets/css/chatchat.css';
2020-09-30 19:38:09 +00:00
2020-12-27 18:28:06 +00:00
import * as PlayerIO from "./PlayerIOClient";
2020-09-30 19:38:09 +00:00
(async function() {
2020-10-01 00:44:52 +00:00
let app = new PIXI.Application({width: 640, height: 600});
document.body.appendChild(app.view);
let font = new FontFaceObserver("Unscii");
await font.load();
let chatStyle = new PIXI.TextStyle({
fontFamily: "Unscii",
fontSize: 32,
fill: "white",
});
let message = new PIXI.Text("Hello, world! β", chatStyle);
message.position.set(32, 128);
app.stage.addChild(message);
2020-12-27 18:28:06 +00:00
const cli = await PlayerIO.authenticate(
2020-09-30 19:38:09 +00:00
"kittygame-48om7qu7teeazkf9gana",
"public",
2020-12-27 18:28:06 +00:00
{ userId: "aly" },
2020-09-30 19:38:09 +00:00
[]
);
console.log(cli);
const multiplayer = cli.multiplayer;
console.log(multiplayer);
2020-12-27 18:28:06 +00:00
const rooms = await multiplayer.listRooms(
2020-09-30 19:38:09 +00:00
"KittyRpg2",
{},
50,
0
)
console.log(rooms);
2020-10-01 00:44:52 +00:00
2020-12-27 18:28:06 +00:00
let messageN = new PIXI.Text("Hello, world! μ : (A ⊗ A) ⇝ A", chatStyle);
2020-10-01 00:44:52 +00:00
messageN.position.set(32, 32);
app.stage.addChild(messageN);
2020-09-30 19:38:09 +00:00
})();