Last active
April 8, 2017 05:33
-
-
Save RameshRavone/21c70cacb87e286215a99ba9615c0bf8 to your computer and use it in GitHub Desktop.
godot firebase google auth.
This file contains hidden or 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
| extends Node | |
| var firebase = null; | |
| var sqlbridge = null; | |
| func _ready(): | |
| if OS.get_name() == "Android": | |
| firebase = Globals.get_singleton("FireBase"); | |
| sqlbridge = Globals.get_singleton("SQLBridge"); | |
| firebase.initWithFile("res://godot-firebase-config.json", get_instance_ID()); | |
| get_node("Buttons/gConnect").connect("button_down", self, "login"); | |
| get_node("Buttons/gDisConnect").connect("button_down", self, "logout"); | |
| pass | |
| func login(): | |
| if (!firebase.is_google_connected()): | |
| firebase.google_sign_in(); | |
| pass | |
| func logout(): | |
| if (firebase.is_google_connected()): | |
| firebase.google_sign_out(); | |
| pass | |
| func _recive_message(from, key, data): | |
| if from == "FireBase": | |
| print("Key: ", key, " Data: ", data); | |
| if key == "GoogleLogin" && data == "true": Print("Google Signed in"); | |
| if key == "GoogleLogin" && data == "false": Print("Google Signed out"); | |
| pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment