24 lines
688 B
GDScript
24 lines
688 B
GDScript
@tool
|
|
extends TextureRect
|
|
|
|
@export var textures: Dictionary[String, Texture] = {}
|
|
|
|
func _get_configuration_warnings() -> PackedStringArray:
|
|
var warnings: PackedStringArray = []
|
|
for key in textures.keys():
|
|
if not TranslationServer.get_all_languages().has(key):
|
|
warnings.append("Locale not supported: %s" % key)
|
|
return warnings
|
|
|
|
func _ready() -> void:
|
|
State.settings_changed.connect(update_img)
|
|
update_img()
|
|
|
|
func update_img() -> void:
|
|
if textures.keys().has(TranslationServer.get_locale()):
|
|
texture = textures[TranslationServer.get_locale()]
|
|
|
|
func _validate_property(property: Dictionary) -> void:
|
|
if property.name == "texture":
|
|
property.usage |= PROPERTY_USAGE_READ_ONLY
|