Hello there
I don’t know why but the leaderboard plugin display an error :
the doc link is here :
https://rexrainbow.github.io/phaser3-rex-notes/docs/site/firebase-leaderboard/
dbRef = firebase.database().ref();
database = firebase.database();
var userList = this.plugins.get('rexfirebaseplugin').add.onlineUserList(firebaseConfig);//no error
var leaderBoard = this.plugins.get('rexfirebaseplugin').add.leaderBoard(firebaseConfig);//error
my firebase database works fine, but i don’t know why my plugin don’t see the connexion…
in the preload, i load the plugin like this :
this.load.plugin('rexfirebaseplugin', 'https://raw.githubusercontent.com/rexrainbow/phaser3-rex-notes/master/dist/rexfirebaseplugin.min.js', true);
any help please ?
thx
Live demo of firebase-leaderboard,
Client code of firebase does not include in plugin, you have to import them manually,
See Add Firebase SDKs section, and leaderboard uses firestore
1 Like
thx a lot, your link is very useful, i’ll try it and i’ll be back
thx you are really fast !!!
Moneo
ok i added the lines to the lib, but now, with this :
var firebaseConfig = {
apiKey: "AIzaSyCbHGEAhnqMtcJbpYU9jdjqc75bnGO23-Y",
authDomain: "wanted-314813.firebaseapp.com",
databaseURL: "https://wanted-314813-default-rtdb.europe-west1.firebasedatabase.app",
projectId: "wanted-314813",
storageBucket: "wanted-314813.appspot.com",
messagingSenderId: "348028017682",
appId: "1:348028017682:web:3d771c865cd77e62c00ccb"
};
// Initialize Firebase
if( firebaseApp == null )
firebaseApp = firebase.initializeApp(firebaseConfig);
dbRef = firebase.database().ref();
database = firebase.database();
var leaderBoard = this.plugins.get('rexfirebaseplugin').add.leaderBoard(firebaseConfig);
i have that :
i don’t understand why, my firebase works well, i do some update/insert of users and it’s works perfectly… any help again please ?
firebaseConfig
is used in firebase.initializeApp()
method, not for leaderBoard plugin, see that demo line 12-16
thx, i believe i don’t understand the plugin :
I thought it will help me to display the score of my users in the Realtime Database : but it use firestore database,
It’s hard to switch ? which is better ? realtime or firestore ? i save the user of my appli in the realtime Database, and i update the score of the users in the realtime… i shouldn’t ?
thx ! - sorry i’m a newby, i usually code with laravel or symfony and mysql ^^
Firebase has better response time. Firestore has better querying features.
I use Firestore in my leaderboard plugin because that it does not have to listen the score updating in real-time. Leaderboard sends a request then get result data back like normal database.
Real-time updating score board is not included in my current leaderboard plugin.
1 Like
nice thx rexrainbow, it’s clearer in my head now
i begin to understand ^^
++