Basic game template addon
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
@tool
|
||||
extends Label
|
||||
## Displays the value of `application/config/name`, set in project settings.
|
||||
|
||||
const NO_NAME_STRING : String = "Title"
|
||||
|
||||
## If true, update the title when ready.
|
||||
@export var auto_update : bool = true
|
||||
|
||||
func update_name_label():
|
||||
var config_name : String = ProjectSettings.get_setting("application/config/name", NO_NAME_STRING)
|
||||
if config_name.is_empty():
|
||||
config_name = NO_NAME_STRING
|
||||
text = config_name
|
||||
|
||||
func _ready():
|
||||
if auto_update:
|
||||
update_name_label()
|
||||
@@ -0,0 +1 @@
|
||||
uid://bkwlopi4qn32o
|
||||
@@ -0,0 +1,17 @@
|
||||
@tool
|
||||
extends Label
|
||||
## Displays the value of `application/config/version`, set in project settings.
|
||||
|
||||
const NO_VERSION_STRING : String = "0.0.0"
|
||||
|
||||
## Prefixes the value of `application/config/version` when displaying to the user.
|
||||
@export var version_prefix : String = "v"
|
||||
|
||||
func update_version_label() -> void:
|
||||
var config_version : String = ProjectSettings.get_setting("application/config/version", NO_VERSION_STRING)
|
||||
if config_version.is_empty():
|
||||
config_version = NO_VERSION_STRING
|
||||
text = version_prefix + config_version
|
||||
|
||||
func _ready() -> void:
|
||||
update_version_label()
|
||||
@@ -0,0 +1 @@
|
||||
uid://dmkubt2nsnsbn
|
||||
@@ -0,0 +1,10 @@
|
||||
extends RichTextLabel
|
||||
## If true, disable opening links. For platforms that don't permit linking to other domains.
|
||||
@export var disable_opening_links: bool = false
|
||||
|
||||
func _on_meta_clicked(meta: String) -> void:
|
||||
if meta.begins_with("https://") and not disable_opening_links:
|
||||
var _err = OS.shell_open(meta)
|
||||
|
||||
func _ready() -> void:
|
||||
meta_clicked.connect(_on_meta_clicked)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cc2wtqasev7le
|
||||
@@ -0,0 +1,28 @@
|
||||
@tool
|
||||
extends Label
|
||||
## Displays the value of `version` from the config file of the specified plugin.
|
||||
|
||||
const NO_VERSION_STRING : String = "0.0.0"
|
||||
|
||||
@export var plugin_directory : String
|
||||
@export var version_prefix : String = "v"
|
||||
|
||||
func _get_plugin_version() -> String:
|
||||
if not plugin_directory.is_empty():
|
||||
for enabled_plugin in ProjectSettings.get_setting("editor_plugins/enabled"):
|
||||
if enabled_plugin.contains(plugin_directory):
|
||||
var config := ConfigFile.new()
|
||||
var error = config.load(enabled_plugin)
|
||||
if error != OK:
|
||||
break
|
||||
return config.get_value("plugin", "version", NO_VERSION_STRING)
|
||||
return ""
|
||||
|
||||
func update_version_label() -> void:
|
||||
var plugin_version = _get_plugin_version()
|
||||
if plugin_version.is_empty():
|
||||
plugin_version = NO_VERSION_STRING
|
||||
text = version_prefix + plugin_version
|
||||
|
||||
func _ready() -> void:
|
||||
update_version_label()
|
||||
@@ -0,0 +1 @@
|
||||
uid://kgp5jnrxxhdy
|
||||
Reference in New Issue
Block a user