long overdue update but i'm not sure it works at all lol
This commit is contained in:
parent
e6ab1fb39a
commit
ae1da3a3d6
7 changed files with 51 additions and 27 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://ciorv2qbkgxpl" path="res://01 - Menus/01 - Main Menu/main_menu.gd" id="1_6vrvy"]
|
[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")
|
script = ExtResource("1_6vrvy")
|
||||||
|
|
||||||
[node name="ui_main_menu" type="ColorRect" parent="."]
|
[node name="ui_main_menu" type="ColorRect" parent="."]
|
||||||
|
|
@ -27,6 +27,7 @@ text = "Exit"
|
||||||
|
|
||||||
[node name="campaign_manager" type="Button" parent="."]
|
[node name="campaign_manager" type="Button" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
visible = false
|
||||||
offset_left = 88.0
|
offset_left = 88.0
|
||||||
offset_top = 1176.0
|
offset_top = 1176.0
|
||||||
offset_right = 408.0
|
offset_right = 408.0
|
||||||
|
|
|
||||||
|
|
@ -9,23 +9,10 @@ var items = []
|
||||||
|
|
||||||
var module_scene
|
var module_scene
|
||||||
|
|
||||||
# Called when the node enters the scene tree for the first time.
|
|
||||||
func _enter_tree() -> void:
|
func _enter_tree() -> void:
|
||||||
config.load("res://02 - Configurations/" + category + ".ini")
|
config.load("res://02 - Configurations/" + category + ".ini")
|
||||||
%scroll.size = $".".size
|
|
||||||
create_book()
|
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():
|
func create_book():
|
||||||
var conf_modules = ConfigFile.new()
|
var conf_modules = ConfigFile.new()
|
||||||
conf_modules.load("res://02 - Configurations/campaign/modules.ini")
|
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 = load("res://01 - Menus/04 - Modules/module.tscn").instantiate()
|
||||||
module_scene.size.x = %container.size.x
|
module_scene.size.x = %container.size.x
|
||||||
%container.add_child(module_scene)
|
%container.add_child(module_scene)
|
||||||
module_scene.set_stat_text(i)
|
module_scene.text = i
|
||||||
module_scene.custom_minimum_size = Vector2(256,64)
|
module_scene.custom_minimum_size = Vector2(256,64)
|
||||||
var module = conf_modules.get_value(category,i,"").split(":",true)
|
var module = conf_modules.get_value(category,i,"").split(":",true)
|
||||||
create_module(module,i)
|
create_module(module,i)
|
||||||
|
|
@ -50,15 +37,18 @@ func create_module(module,i):
|
||||||
fixed_array.fill(0)
|
fixed_array.fill(0)
|
||||||
var value = config.get_value(item,i,fixed_array)
|
var value = config.get_value(item,i,fixed_array)
|
||||||
for j in value:
|
for j in value:
|
||||||
module_scene.set_value(LineEdit,j)
|
module_scene.module_type = LineEdit
|
||||||
|
module_scene.value = j
|
||||||
|
module_scene.init()
|
||||||
"list":
|
"list":
|
||||||
match module[2]:
|
match module[2]:
|
||||||
"rec":
|
"rec":
|
||||||
pass
|
pass
|
||||||
"multi":
|
"multi":
|
||||||
for j in config.get_value(item,i,[]):
|
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()
|
var conf_category = ConfigFile.new()
|
||||||
conf_category.load("res://02 - Configurations/" + i + ".ini")
|
conf_category.load("res://02 - Configurations/" + i + ".ini")
|
||||||
var add_stat = OptionButton.new()
|
var add_stat = OptionButton.new()
|
||||||
|
|
@ -87,7 +77,7 @@ func create_module(module,i):
|
||||||
stat.wrap_mode = 1
|
stat.wrap_mode = 1
|
||||||
stat.clip_contents = false
|
stat.clip_contents = false
|
||||||
stat.text = config.get_value(item,i,"")
|
stat.text = config.get_value(item,i,"")
|
||||||
set_items()
|
module_scene.init()
|
||||||
|
|
||||||
#func rec(i,conf,k):
|
#func rec(i,conf,k):
|
||||||
#var conff = "res://02 - Configurations/" + conf + ".ini"
|
#var conff = "res://02 - Configurations/" + conf + ".ini"
|
||||||
|
|
@ -128,3 +118,7 @@ func create_module(module,i):
|
||||||
|
|
||||||
func _on_close_button_up() -> void:
|
func _on_close_button_up() -> void:
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
||||||
|
func redraw():
|
||||||
|
for i in %container.get_children():
|
||||||
|
i.resize()
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,9 @@ unique_name_in_owner = true
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_right = 448.0
|
offset_right = 448.0
|
||||||
offset_bottom = 256.0
|
offset_bottom = 256.0
|
||||||
|
follow_focus = true
|
||||||
|
draw_focus_border = true
|
||||||
|
vertical_scroll_mode = 2
|
||||||
|
|
||||||
[node name="container" type="VBoxContainer" parent="scroll"]
|
[node name="container" type="VBoxContainer" parent="scroll"]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,29 @@
|
||||||
extends Control
|
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
|
%stat.text = text
|
||||||
|
|
||||||
func set_value(module_type,value):
|
func set_value():
|
||||||
var module = module_type.new()
|
var module = module_type.new()
|
||||||
module.text = str(value)
|
module.text = str(value)
|
||||||
%value.add_child(module)
|
%value.add_child(module)
|
||||||
|
|
|
||||||
|
|
@ -10,13 +10,12 @@ anchor_bottom = 1.0
|
||||||
grow_horizontal = 2
|
grow_horizontal = 2
|
||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
size_flags_vertical = 3
|
|
||||||
script = ExtResource("1_rxp26")
|
script = ExtResource("1_rxp26")
|
||||||
|
|
||||||
[node name="vbox" type="VBoxContainer" parent="."]
|
[node name="vbox" type="VBoxContainer" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
layout_mode = 0
|
layout_mode = 0
|
||||||
offset_right = 760.0
|
offset_right = 56.0
|
||||||
offset_bottom = 51.0
|
offset_bottom = 51.0
|
||||||
|
|
||||||
[node name="stat" type="Label" parent="vbox"]
|
[node name="stat" type="Label" parent="vbox"]
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,10 @@ func _enter_tree() -> void:
|
||||||
pixel_x = get_viewport_rect().size[0] / ui_scale
|
pixel_x = get_viewport_rect().size[0] / ui_scale
|
||||||
pixel_y = get_viewport_rect().size[1] / ui_scale
|
pixel_y = get_viewport_rect().size[1] / ui_scale
|
||||||
module_fit_window()
|
module_fit_window()
|
||||||
#call_deferred("module_fit_window")
|
|
||||||
set_bar_items()
|
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:
|
func _process(_delta: float) -> void:
|
||||||
if pixel_x != get_viewport_rect().size[0] or pixel_y != get_viewport_rect().size[1]:
|
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]:
|
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).size = %ui_background.size - Vector2(64,64)
|
||||||
module.get_child(0).position = %ui_background.position + Vector2(32,32)
|
module.get_child(0).position = %ui_background.position + Vector2(32,32)
|
||||||
|
for i in [%size_right,%size_left,%size_bottom]:
|
||||||
|
i.visible = true
|
||||||
else:
|
else:
|
||||||
position = Vector2(0,0)
|
%window.position = Vector2(0,0)
|
||||||
%ui_background.size = get_viewport_rect().size
|
%ui_background.size = get_viewport_rect().size / ui_scale
|
||||||
module.get_child(0).size = %ui_background.size - Vector2(64,64)
|
module.get_child(0).size = %ui_background.size - Vector2(64,64)
|
||||||
module.get_child(0).position = Vector2(32,96)
|
module.get_child(0).position = Vector2(32,96)
|
||||||
%ui_bar.size.x = %ui_background.size.x
|
%ui_bar.size.x = %ui_background.size.x
|
||||||
|
|
@ -61,8 +65,8 @@ func module_fit_window():
|
||||||
%minimize.position.x = %close.position.x - 92
|
%minimize.position.x = %close.position.x - 92
|
||||||
for i in [%size_right,%size_left,%size_bottom]:
|
for i in [%size_right,%size_left,%size_bottom]:
|
||||||
i.visible = false
|
i.visible = false
|
||||||
module.set_items()
|
|
||||||
move_child(module,1)
|
move_child(module,1)
|
||||||
|
module.redraw()
|
||||||
|
|
||||||
func _on_ui_bar_gui_input(ev: InputEvent) -> void:
|
func _on_ui_bar_gui_input(ev: InputEvent) -> void:
|
||||||
if ev is InputEventMouseButton:
|
if ev is InputEventMouseButton:
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,10 @@ window/size/borderless=true
|
||||||
window/subwindows/embed_subwindows=false
|
window/subwindows/embed_subwindows=false
|
||||||
window/handheld/orientation=1
|
window/handheld/orientation=1
|
||||||
|
|
||||||
|
[global_group]
|
||||||
|
|
||||||
|
main_menu="scene to attach to if independent of parent"
|
||||||
|
|
||||||
[gui]
|
[gui]
|
||||||
|
|
||||||
theme/custom="uid://lf2ixoythamg"
|
theme/custom="uid://lf2ixoythamg"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue