mirror of
https://github.com/thegatesbrowser/thegates.git
synced 2025-08-24 02:17:27 -04:00
add license, move folders
This commit is contained in:
parent
185cc74060
commit
271c4a46a1
132 changed files with 21 additions and 0 deletions
46
app/scripts/loading/config_base.gd
Normal file
46
app/scripts/loading/config_base.gd
Normal file
|
@ -0,0 +1,46 @@
|
|||
extends Node
|
||||
class_name ConfigBase
|
||||
|
||||
var config: ConfigFile
|
||||
var config_path: String
|
||||
|
||||
|
||||
func _init(path: String) -> void:
|
||||
config = ConfigFile.new()
|
||||
config.load(path)
|
||||
config_path = path
|
||||
|
||||
|
||||
func get_string(section: String, key: String) -> String:
|
||||
var value: String
|
||||
if config.has_section_key(section, key):
|
||||
value = config.get_value(section, key)
|
||||
# Debug.logr(key + "=" + value)
|
||||
else: Debug.logclr("don't have section " + section + ", key " + key, Color.YELLOW)
|
||||
return value
|
||||
|
||||
|
||||
func get_value(section: String, key: String):
|
||||
var value
|
||||
if config.has_section_key(section, key):
|
||||
value = config.get_value(section, key)
|
||||
# Debug.logr(key + "=" + str(value))
|
||||
else: Debug.logclr("don't have section " + section + ", key " + key, Color.YELLOW)
|
||||
return value
|
||||
|
||||
|
||||
func get_sections() -> PackedStringArray:
|
||||
return config.get_sections()
|
||||
|
||||
|
||||
func get_section_keys(section: String) -> PackedStringArray:
|
||||
var keys: PackedStringArray
|
||||
if config.has_section(section):
|
||||
keys = config.get_section_keys(section)
|
||||
# Debug.logr(keys)
|
||||
else: Debug.logclr("don't have section " + section, Color.YELLOW)
|
||||
return keys
|
||||
|
||||
|
||||
func set_value(section: String, key: String, value: Variant) -> void:
|
||||
config.set_value(section, key, value)
|
Loading…
Add table
Add a link
Reference in a new issue