added firebase and rudimentary leaderboard support

This commit is contained in:
derek
2025-04-09 11:19:02 -05:00
parent ce08df66e6
commit 25eb9e725a
121 changed files with 4987 additions and 4 deletions

View File

@@ -0,0 +1,36 @@
@tool
class_name FirebaseRemoteConfig
extends Node
const RemoteConfigFunctionId = "getRemoteConfig"
signal remote_config_received(config)
signal remote_config_error(error)
var _project_config = {}
var _headers : PackedStringArray = [
]
var _auth : Dictionary
func _set_config(config_json : Dictionary) -> void:
_project_config = config_json # This may get confusing, hoping the variable name makes it easier to understand
func _on_FirebaseAuth_login_succeeded(auth_result : Dictionary) -> void:
_auth = auth_result
func _on_FirebaseAuth_token_refresh_succeeded(auth_result : Dictionary) -> void:
_auth = auth_result
func _on_FirebaseAuth_logout() -> void:
_auth = {}
func get_remote_config() -> void:
var function_task = Firebase.Functions.execute("getRemoteConfig", HTTPClient.METHOD_GET, {}, {}) as FunctionTask
var result = await function_task.task_finished
Firebase._print("Config request result: " + str(result))
if result.has("error"):
remote_config_error.emit(result)
return
var config = RemoteConfig.new(result)
remote_config_received.emit(config)

View File

@@ -0,0 +1 @@
uid://xqngri5s6yc5

View File

@@ -0,0 +1,7 @@
[gd_scene load_steps=2 format=3 uid="uid://5xa6ulbllkjk"]
[ext_resource type="Script" path="res://addons/godot-firebase/remote_config/firebase_remote_config.gd" id="1_wx4ds"]
[node name="FirebaseRemoteConfig" type="HTTPRequest"]
use_threads = true
script = ExtResource("1_wx4ds")

View File

@@ -0,0 +1,14 @@
class_name RemoteConfig
extends RefCounted
var default_config = {}
func _init(values : Dictionary) -> void:
default_config = values
func get_value(key : String) -> Variant:
if default_config.has(key):
return default_config[key]
Firebase._printerr("Remote config does not contain key: " + key)
return null

View File

@@ -0,0 +1 @@
uid://bqimgkjkven2l