first commit, long overdue
deez
This commit is contained in:
commit
54b9012a47
79 changed files with 2516 additions and 0 deletions
74
01 - Menus/03 - Sheets/item.gd
Normal file
74
01 - Menus/03 - Sheets/item.gd
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
extends Node2D
|
||||
|
||||
var item # e.g. grondir
|
||||
var category # e.g. character
|
||||
|
||||
var module
|
||||
var module_type
|
||||
var active_module
|
||||
|
||||
var module_self:String
|
||||
var modules_list:Array
|
||||
var modules_text:Array
|
||||
var modules_skill:Array
|
||||
|
||||
var config
|
||||
|
||||
func _enter_tree() -> void:
|
||||
print("item:_enter_tree:1 " + category)
|
||||
config = ConfigFile.new()
|
||||
config.load("res://02 - Configurations/campaign/categories.ini")
|
||||
module_self = config.get_value(category,"module","")
|
||||
var modules_all = [module_self]
|
||||
for i in config.get_section_keys(category):
|
||||
print("item:_enter_tree:2 " + i)
|
||||
if i.contains("modules_"):
|
||||
modules_all = modules_all + config.get_value(category,i,[])
|
||||
print("item:_enter_tree:3 " + str(modules_all))
|
||||
var j = 0
|
||||
for i in modules_all:
|
||||
var button = Button.new()
|
||||
button.tooltip_text = i
|
||||
if i == category:
|
||||
button.text = config.get_value(i,"name_self","")
|
||||
else:
|
||||
button.text = config.get_value(i,"name","")
|
||||
button.size.x = 192
|
||||
button.size.y = 64
|
||||
button.connect("button_up",spawn_module.bind(button.get_tooltip_text()))
|
||||
%container.add_child(button)
|
||||
j = j + 1
|
||||
spawn_module(category)
|
||||
|
||||
func spawn_module(text):
|
||||
print("item:spawn_module:1 " + text)
|
||||
remove_child(module)
|
||||
active_module = text
|
||||
config = ConfigFile.new()
|
||||
config.load("res://02 - Configurations/campaign/categories.ini")
|
||||
for i in config.get_section_keys(category):
|
||||
print("item:spawn_module:2 " + i)
|
||||
if i == "module" and category == text:
|
||||
print("item:spawn_module:3 " + text)
|
||||
module = load("res://01 - Menus/04 - Modules/modules_" + config.get_value(text,i,"") + ".tscn").instantiate()
|
||||
module.item = item
|
||||
module.category = category
|
||||
module.module = active_module
|
||||
module.position.x = 384
|
||||
add_child.call_deferred(module)
|
||||
elif i.contains("modules_"):
|
||||
print("item:spawn_module:4 is array" )
|
||||
if config.get_value(category,i,[]).has(text):
|
||||
print("item:spawn_module:5 " + i)
|
||||
module = load("res://01 - Menus/04 - Modules/" + i + ".tscn").instantiate()
|
||||
module.item = item
|
||||
module.category = category
|
||||
module.module = active_module
|
||||
module.position.x = 384
|
||||
add_child.call_deferred(module)
|
||||
|
||||
func show_save():
|
||||
pass
|
||||
|
||||
func save():
|
||||
module.save()
|
||||
Loading…
Add table
Add a link
Reference in a new issue