Created
April 8, 2017 05:50
-
-
Save RameshRavone/7a789f39631b33b2ee6144cddc36dab2 to your computer and use it in GitHub Desktop.
Godot firebase storage
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/Upload").connect("button_down", self, "upload"); | |
| get_node("Buttons/Download").connect("button_down", self, "download"); | |
| pass | |
| func upload(): | |
| #firebase.upload("user://file", "userData"); | |
| firebase.upload("images/file.png", "images"); # uploades sdcard0/images/file.png => firebase - root/images | |
| pass | |
| func download(): | |
| firebase.download("images/file.png", "images"); | |
| pass | |
| func _recive_message(from, key, data): | |
| if from == "FireBase": | |
| print("Key: ", key, " Data: ", data); | |
| pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment