x12 windowing system
This commit is contained in:
parent
e16b468e23
commit
e6ab1fb39a
60 changed files with 701 additions and 877 deletions
|
|
@ -1,74 +0,0 @@
|
|||
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()
|
||||
|
|
@ -1 +0,0 @@
|
|||
uid://d1ixiojxt27x7
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://cl4squ3cegosj"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d1ixiojxt27x7" path="res://01 - Menus/03 - Sheets/item.gd" id="1_sscaq"]
|
||||
|
||||
[node name="item" type="Node2D"]
|
||||
script = ExtResource("1_sscaq")
|
||||
|
||||
[node name="tabs" type="ColorRect" parent="."]
|
||||
offset_top = -256.0
|
||||
offset_right = 384.0
|
||||
offset_bottom = 1184.0
|
||||
color = Color(0.047058824, 0.07058824, 0.09803922, 1)
|
||||
|
||||
[node name="scroll" type="ScrollContainer" parent="."]
|
||||
clip_contents = false
|
||||
offset_left = 64.0
|
||||
offset_top = 64.0
|
||||
offset_right = 320.0
|
||||
offset_bottom = 960.0
|
||||
|
||||
[node name="container" type="VBoxContainer" parent="scroll"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
130
01 - Menus/03 - Sheets/sheet.gd
Normal file
130
01 - Menus/03 - Sheets/sheet.gd
Normal file
|
|
@ -0,0 +1,130 @@
|
|||
extends Control
|
||||
|
||||
var config = ConfigFile.new()
|
||||
var category = ""
|
||||
var item = ""
|
||||
var stats = []
|
||||
|
||||
var items = []
|
||||
|
||||
var module_scene
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _enter_tree() -> void:
|
||||
config.load("res://02 - Configurations/" + category + ".ini")
|
||||
%scroll.size = $".".size
|
||||
create_book()
|
||||
|
||||
func set_items():
|
||||
for i in %container.get_children():
|
||||
match i.tooltip_text:
|
||||
"Text:long":
|
||||
i.get_child(1).custom_minimum_size = Vector2(%scroll.size.x - 400,192)
|
||||
"Array:int":
|
||||
var count = i.get_child(1).get_child_count()
|
||||
for j in count:
|
||||
i.get_child(1).get_child(j).custom_minimum_size.x = (%scroll.size.x - 96) / count
|
||||
|
||||
|
||||
func create_book():
|
||||
var conf_modules = ConfigFile.new()
|
||||
conf_modules.load("res://02 - Configurations/campaign/modules.ini")
|
||||
stats = conf_modules.get_section_keys(category)
|
||||
print(str(stats))
|
||||
for i in stats:
|
||||
module_scene = load("res://01 - Menus/04 - Modules/module.tscn").instantiate()
|
||||
module_scene.size.x = %container.size.x
|
||||
%container.add_child(module_scene)
|
||||
module_scene.set_stat_text(i)
|
||||
module_scene.custom_minimum_size = Vector2(256,64)
|
||||
var module = conf_modules.get_value(category,i,"").split(":",true)
|
||||
create_module(module,i)
|
||||
|
||||
func create_module(module,i):
|
||||
match module[0]:
|
||||
"Array":
|
||||
match module[1]:
|
||||
"int":
|
||||
var fixed_array = [0]
|
||||
fixed_array.resize(int(module[2]))
|
||||
fixed_array.fill(0)
|
||||
var value = config.get_value(item,i,fixed_array)
|
||||
for j in value:
|
||||
module_scene.set_value(LineEdit,j)
|
||||
"list":
|
||||
match module[2]:
|
||||
"rec":
|
||||
pass
|
||||
"multi":
|
||||
for j in config.get_value(item,i,[]):
|
||||
module_scene.set_value(LineEdit,j)
|
||||
|
||||
var conf_category = ConfigFile.new()
|
||||
conf_category.load("res://02 - Configurations/" + i + ".ini")
|
||||
var add_stat = OptionButton.new()
|
||||
add_stat.add_separator("Add " + i)
|
||||
add_stat.set_item_disabled(0,true)
|
||||
for j in conf_category.get_sections():
|
||||
if not config.get_value(item,i,[]).has(j):
|
||||
add_stat.add_item(j)
|
||||
add_stat.select(0)
|
||||
"single":
|
||||
var conf_category = ConfigFile.new()
|
||||
conf_category.load("res://02 - Configurations/" + i + ".ini")
|
||||
var add_stat = OptionButton.new()
|
||||
add_stat.add_separator("Select " + i)
|
||||
add_stat.set_item_disabled(0,true)
|
||||
for j in conf_category.get_sections():
|
||||
add_stat.add_item(j)
|
||||
add_stat.select(1 + conf_category.get_sections().find(config.get_value(item,i,[""])[0]))
|
||||
"Text":
|
||||
match module[1]:
|
||||
"short":
|
||||
var stat = LineEdit.new()
|
||||
stat.text = str(config.get_value(item,i,""))
|
||||
"long":
|
||||
var stat = TextEdit.new()
|
||||
stat.wrap_mode = 1
|
||||
stat.clip_contents = false
|
||||
stat.text = config.get_value(item,i,"")
|
||||
set_items()
|
||||
|
||||
#func rec(i,conf,k):
|
||||
#var conff = "res://02 - Configurations/" + conf + ".ini"
|
||||
#config = ConfigFile.new()
|
||||
#config.load(conff)
|
||||
#print("modules_list:rec:1 conff = " + conff)
|
||||
#print("modules_list:rec:2 sections = " + str(config.get_section_keys(k)))
|
||||
#print("modules_list:rec:3 k = " + str(k))
|
||||
#print("modules_list:rec:4 i = " + str(i))
|
||||
#if config.get_section_keys(k).has(i):
|
||||
#var m = config.get_value(k,i)
|
||||
#print("modules_list:rec:5 " + (k) + " has " + str(m) + " as " + str(i))
|
||||
#if module == i:
|
||||
#print("modules_list:rec:6 " + str(items))
|
||||
#for b in config.get_value(k,i,[]):
|
||||
#print("modules_list:rec:10 " + str(b) + str(items))
|
||||
#if not items.has(b) and b != "":
|
||||
#items = items + [b]
|
||||
#print("modules_list:rec:11 adding " + b + " to list")
|
||||
#if item_filter == "":
|
||||
#%list.add_item(str(b))
|
||||
#%list.set_item_tooltip(%list.item_count - 1, k)
|
||||
#if conf != category:
|
||||
#%list.set_item_custom_bg_color(%list.item_count - 1,"black")
|
||||
#elif item_filter.to_lower() in b.to_lower():
|
||||
#%list.add_item(str(b))
|
||||
#else:
|
||||
#%list.item_count = %list.item_count -1
|
||||
#print("modules_list:rec:12 " + i + " " + str(category))
|
||||
#if i != category:
|
||||
#print("modules_list:rec:7 " + str(rec_helper.slice(rec_helper.find(i),-1)))
|
||||
#print("modules_list:rec:8 " + str(m))
|
||||
#for o in rec_helper.slice(rec_helper.find(i),rec_helper.size()):
|
||||
#print(str(o))
|
||||
#for j in m:
|
||||
#print("modules_list:rec:9 rec " + o + " - " + i + " - " + j)
|
||||
#rec(o,i,j)
|
||||
|
||||
func _on_close_button_up() -> void:
|
||||
queue_free()
|
||||
1
01 - Menus/03 - Sheets/sheet.gd.uid
Normal file
1
01 - Menus/03 - Sheets/sheet.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://bmphhxrifc4gc
|
||||
39
01 - Menus/03 - Sheets/sheet.tscn
Normal file
39
01 - Menus/03 - Sheets/sheet.tscn
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
[gd_scene load_steps=2 format=3 uid="uid://4q13obqp8uh8"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://bmphhxrifc4gc" path="res://01 - Menus/03 - Sheets/sheet.gd" id="1_v0a3n"]
|
||||
|
||||
[node name="sheet" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
offset_bottom = 8.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_v0a3n")
|
||||
|
||||
[node name="scroll" type="ScrollContainer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 0
|
||||
offset_right = 448.0
|
||||
offset_bottom = 256.0
|
||||
|
||||
[node name="container" type="VBoxContainer" parent="scroll"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[node name="close" type="Button" parent="."]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 56.0
|
||||
offset_top = 360.0
|
||||
offset_right = 164.0
|
||||
offset_bottom = 402.0
|
||||
text = "Close"
|
||||
|
||||
[connection signal="button_up" from="close" to="." method="_on_close_button_up"]
|
||||
Loading…
Add table
Add a link
Reference in a new issue