From ae1da3a3d6b4ed06c1fcd32c9aca9f030edbd259 Mon Sep 17 00:00:00 2001 From: martyTF Date: Fri, 9 Jan 2026 20:48:30 +0100 Subject: [PATCH] long overdue update but i'm not sure it works at all lol --- 01 - Menus/01 - Main Menu/main_menu.tscn | 3 ++- 01 - Menus/03 - Sheets/sheet.gd | 30 ++++++++++-------------- 01 - Menus/03 - Sheets/sheet.tscn | 3 +++ 01 - Menus/04 - Modules/module.gd | 23 ++++++++++++++++-- 01 - Menus/04 - Modules/module.tscn | 3 +-- 01 - Menus/07 - Window/window.gd | 12 ++++++---- project.godot | 4 ++++ 7 files changed, 51 insertions(+), 27 deletions(-) diff --git a/01 - Menus/01 - Main Menu/main_menu.tscn b/01 - Menus/01 - Main Menu/main_menu.tscn index 34639c1..2be98b7 100644 --- a/01 - Menus/01 - Main Menu/main_menu.tscn +++ b/01 - Menus/01 - Main Menu/main_menu.tscn @@ -2,7 +2,7 @@ [ext_resource type="Script" uid="uid://ciorv2qbkgxpl" path="res://01 - Menus/01 - Main Menu/main_menu.gd" id="1_6vrvy"] -[node name="main_menu" type="Node2D"] +[node name="main_menu" type="Node2D" groups=["main_menu"]] script = ExtResource("1_6vrvy") [node name="ui_main_menu" type="ColorRect" parent="."] @@ -27,6 +27,7 @@ text = "Exit" [node name="campaign_manager" type="Button" parent="."] unique_name_in_owner = true +visible = false offset_left = 88.0 offset_top = 1176.0 offset_right = 408.0 diff --git a/01 - Menus/03 - Sheets/sheet.gd b/01 - Menus/03 - Sheets/sheet.gd index 3516165..41ce5a9 100644 --- a/01 - Menus/03 - Sheets/sheet.gd +++ b/01 - Menus/03 - Sheets/sheet.gd @@ -9,23 +9,10 @@ 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") @@ -35,7 +22,7 @@ func create_book(): 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.text = i module_scene.custom_minimum_size = Vector2(256,64) var module = conf_modules.get_value(category,i,"").split(":",true) create_module(module,i) @@ -50,15 +37,18 @@ func create_module(module,i): fixed_array.fill(0) var value = config.get_value(item,i,fixed_array) for j in value: - module_scene.set_value(LineEdit,j) + module_scene.module_type = LineEdit + module_scene.value = j + module_scene.init() "list": match module[2]: "rec": pass "multi": for j in config.get_value(item,i,[]): - module_scene.set_value(LineEdit,j) - + module_scene.module_type = LineEdit + module_scene.value = j + module_scene.init() var conf_category = ConfigFile.new() conf_category.load("res://02 - Configurations/" + i + ".ini") var add_stat = OptionButton.new() @@ -87,7 +77,7 @@ func create_module(module,i): stat.wrap_mode = 1 stat.clip_contents = false stat.text = config.get_value(item,i,"") - set_items() + module_scene.init() #func rec(i,conf,k): #var conff = "res://02 - Configurations/" + conf + ".ini" @@ -128,3 +118,7 @@ func create_module(module,i): func _on_close_button_up() -> void: queue_free() + +func redraw(): + for i in %container.get_children(): + i.resize() diff --git a/01 - Menus/03 - Sheets/sheet.tscn b/01 - Menus/03 - Sheets/sheet.tscn index 83c3fad..b948479 100644 --- a/01 - Menus/03 - Sheets/sheet.tscn +++ b/01 - Menus/03 - Sheets/sheet.tscn @@ -19,6 +19,9 @@ unique_name_in_owner = true layout_mode = 0 offset_right = 448.0 offset_bottom = 256.0 +follow_focus = true +draw_focus_border = true +vertical_scroll_mode = 2 [node name="container" type="VBoxContainer" parent="scroll"] unique_name_in_owner = true diff --git a/01 - Menus/04 - Modules/module.gd b/01 - Menus/04 - Modules/module.gd index 17811cd..d740eb9 100644 --- a/01 - Menus/04 - Modules/module.gd +++ b/01 - Menus/04 - Modules/module.gd @@ -1,10 +1,29 @@ extends Control +var text +var module_type = Button +var value = 0 -func set_stat_text(text): + +func init(): + set_stat_text() + set_value() + resize() + + +func resize(): + if %vbox.size.x != $".".size.x: + %vbox.size.x = $".".size.x + var sizey = 0 + for i in %vbox.get_children(): + sizey = sizey + i.size.y + #print(str(sizey)) + $".".custom_minimum_size.y = sizey + 16 + +func set_stat_text(): %stat.text = text -func set_value(module_type,value): +func set_value(): var module = module_type.new() module.text = str(value) %value.add_child(module) diff --git a/01 - Menus/04 - Modules/module.tscn b/01 - Menus/04 - Modules/module.tscn index b959f1c..a511f2f 100644 --- a/01 - Menus/04 - Modules/module.tscn +++ b/01 - Menus/04 - Modules/module.tscn @@ -10,13 +10,12 @@ anchor_bottom = 1.0 grow_horizontal = 2 grow_vertical = 2 size_flags_horizontal = 3 -size_flags_vertical = 3 script = ExtResource("1_rxp26") [node name="vbox" type="VBoxContainer" parent="."] unique_name_in_owner = true layout_mode = 0 -offset_right = 760.0 +offset_right = 56.0 offset_bottom = 51.0 [node name="stat" type="Label" parent="vbox"] diff --git a/01 - Menus/07 - Window/window.gd b/01 - Menus/07 - Window/window.gd index 8f755b3..ec72ae9 100644 --- a/01 - Menus/07 - Window/window.gd +++ b/01 - Menus/07 - Window/window.gd @@ -32,8 +32,10 @@ func _enter_tree() -> void: pixel_x = get_viewport_rect().size[0] / ui_scale pixel_y = get_viewport_rect().size[1] / ui_scale module_fit_window() - #call_deferred("module_fit_window") set_bar_items() + await get_tree().create_timer(0.0001).timeout + %size_right.position.x = %ui_bar.position.x + %ui_bar.size.x - 32 + module.redraw() func _process(_delta: float) -> void: if pixel_x != get_viewport_rect().size[0] or pixel_y != get_viewport_rect().size[1]: @@ -50,9 +52,11 @@ func module_fit_window(): if get_viewport_rect().size[0] > get_viewport_rect().size[1]: module.get_child(0).size = %ui_background.size - Vector2(64,64) module.get_child(0).position = %ui_background.position + Vector2(32,32) + for i in [%size_right,%size_left,%size_bottom]: + i.visible = true else: - position = Vector2(0,0) - %ui_background.size = get_viewport_rect().size + %window.position = Vector2(0,0) + %ui_background.size = get_viewport_rect().size / ui_scale module.get_child(0).size = %ui_background.size - Vector2(64,64) module.get_child(0).position = Vector2(32,96) %ui_bar.size.x = %ui_background.size.x @@ -61,8 +65,8 @@ func module_fit_window(): %minimize.position.x = %close.position.x - 92 for i in [%size_right,%size_left,%size_bottom]: i.visible = false - module.set_items() move_child(module,1) + module.redraw() func _on_ui_bar_gui_input(ev: InputEvent) -> void: if ev is InputEventMouseButton: diff --git a/project.godot b/project.godot index b13a0cc..5e0253d 100644 --- a/project.godot +++ b/project.godot @@ -21,6 +21,10 @@ window/size/borderless=true window/subwindows/embed_subwindows=false window/handheld/orientation=1 +[global_group] + +main_menu="scene to attach to if independent of parent" + [gui] theme/custom="uid://lf2ixoythamg"