:astonished: this is suitable, thank you very much!
Posts made by colyseus_
RE: Authorization in all rooms
posted in Questions & Help •
Authorization in all rooms
posted in Questions & Help •
I created an auth room where I load the player data from the database
async onAuth(options) {
//FIXME check fb auth key
const data = await gameDao.fetchPlayer(options.uid);
if (data.rows.length > 0) {
return data.rows[0];
}
return false;
}
onJoin(client, options, auth) {
var player = new Player(client.id, auth.name);
client.player = player;
}
how to check in another room player data?
// Code from play room
async onAuth(options) {
// this need check player data
return false;
}
for example, that players can not enter the location for high levels or the availability of game modes for premium players
colyseus.js and Cocos Creator
posted in Questions & Help •
how use colyseus.js in Cocos Creator ?
var Colyseus = require("colyseus");
cc.Class({
extends: cc.Component,
// use this for initialization
onLoad: function () {
var client = new Colyseus.Client('ws://localhost:2657');
}
});
Colyseus == undefined