Skip to content
This repository was archived by the owner on Feb 22, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 10 additions & 25 deletions addons/playerloop/Playerloop/playerloop.gd
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,29 @@ class_name PlayerloopSDK
extends Node

const ENVIRONMENT_VARIABLES : String = "playerloop/config"

#var report : PlayerloopReport
var request : PlayerloopRequest

var debug: bool = false

var config : Dictionary = {
"playerloopSecret": ""
}
var config : Dictionary = { "playerloopSecret": ""}

func _ready() -> void:
load_config()
load_nodes()

# Load all config settings from ProjectSettings
func load_config() -> void:
if config.playerloopSecret != "":
pass
else:
printerr("Add your secret in the res://addons/Playerloop/playerloop.gd file, line 13")
load_nodes()
return
# else:
# var env = ConfigFile.new()
# var err = env.load("res://addons/playerloop/.env")
# if err == OK:
# for key in config.keys():
# var value : String = env.get_value(ENVIRONMENT_VARIABLES, key, "")
# if value == "":
# printerr("%s has not a valid value." % key)
# else:
# config[key] = value
# else:
# printerr("Unable to read .env file at path 'res://.env'")

printerr("Add your secret in the res://addons/Playerloop/playerloop.gd file, line 13")

func load_nodes() -> void:
request = PlayerloopRequest.new()
request._secret = config["playerloopSecret"]
add_child(request)

func config(secret:String):
config["playerloopSecret"] = secret
load_nodes()

func open_privacy_policy():
OS.shell_open("https://playerloop.io/privacy-policy")
OS.shell_open("https://playerloop.io/privacy-policy")

2 changes: 1 addition & 1 deletion addons/playerloop/plugin.gd
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
tool
extends EditorPlugin

var interface = preload("res://addons/playerloop/SettingInterface.tscn").instance()

func _enter_tree():
add_autoload_singleton("Playerloop", "res://addons/playerloop/Playerloop/playerloop.gd")


func _exit_tree():
remove_autoload_singleton("Playerloop")