Version: 0.0.4
Scrolling implemented in view and creator, so you can add infinite variables to the content.
This commit is contained in:
parent
21bcce37fa
commit
5e4f79ee19
5 changed files with 48 additions and 15 deletions
|
@ -20,4 +20,20 @@ offset_bottom = 435.0
|
|||
scale = Vector2(2, 2)
|
||||
text = "Send"
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 13
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -400.0
|
||||
offset_right = 104.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[connection signal="pressed" from="button" to="." method="_on_button_pressed"]
|
||||
|
|
|
@ -42,7 +42,7 @@ offset_top = 432.0
|
|||
offset_right = 592.0
|
||||
offset_bottom = 455.0
|
||||
scale = Vector2(3, 3)
|
||||
text = "Version: 0.0.3"
|
||||
text = "Version: 0.0.4"
|
||||
|
||||
[connection signal="pressed" from="Button" to="." method="_on_button_pressed"]
|
||||
[connection signal="pressed" from="Button2" to="." method="_on_button_2_pressed"]
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
[ext_resource type="Script" path="res://scripts/getStats.gd" id="1_dcehj"]
|
||||
|
||||
[node name="characterVsiewer" type="Control"]
|
||||
[node name="characterViewer" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
|
@ -12,7 +12,7 @@ grow_vertical = 2
|
|||
script = ExtResource("1_dcehj")
|
||||
|
||||
[node name="button" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
layout_mode = 2
|
||||
offset_left = 512.0
|
||||
offset_top = 400.0
|
||||
offset_right = 638.0
|
||||
|
@ -20,4 +20,20 @@ offset_bottom = 435.0
|
|||
scale = Vector2(2, 2)
|
||||
text = "Get"
|
||||
|
||||
[node name="ScrollContainer" type="ScrollContainer" parent="."]
|
||||
layout_mode = 1
|
||||
anchors_preset = 13
|
||||
anchor_left = 0.5
|
||||
anchor_right = 0.5
|
||||
anchor_bottom = 1.0
|
||||
offset_left = -400.0
|
||||
offset_right = 104.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="VBoxContainer" type="VBoxContainer" parent="ScrollContainer"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
|
||||
[connection signal="pressed" from="button" to="." method="_on_button_pressed"]
|
||||
|
|
|
@ -23,16 +23,17 @@ func _ready():
|
|||
if loadJSON("res://content/stats.json"):
|
||||
for i in range(int(data.get("amount"))):
|
||||
var fieldInstance = field.instantiate()
|
||||
add_child(fieldInstance)
|
||||
get_child(i+1).position = Vector2(16,(16+i*88))
|
||||
get_child(i+1).placeholder_text = data.get(str(i))
|
||||
$"ScrollContainer/VBoxContainer".add_child(fieldInstance)
|
||||
$"ScrollContainer/VBoxContainer".get_child(i).position = Vector2(16,(16+i*88))
|
||||
$"ScrollContainer/VBoxContainer".get_child(i).placeholder_text = data.get(str(i))
|
||||
$"ScrollContainer/VBoxContainer".get_child(i).custom_minimum_size.y = 40
|
||||
|
||||
func saveJSON(savePath):
|
||||
var saveData = {}
|
||||
|
||||
for i in range(int(data.get("amount"))):
|
||||
if i > 0:
|
||||
saveData[data.get(str(i))] = get_child(i+1).text
|
||||
saveData[data.get(str(i))] = $"ScrollContainer/VBoxContainer".get_child(i).text
|
||||
|
||||
var jsonString = JSON.stringify(saveData)
|
||||
|
||||
|
@ -45,7 +46,7 @@ func saveJSON(savePath):
|
|||
fileAccess.close()
|
||||
|
||||
func _on_button_pressed():
|
||||
var savePath = str("user://player_data"+get_child(1).text+".json")
|
||||
var savePath = str("user://player_data"+$"ScrollContainer/VBoxContainer".get_child(0).text+".json")
|
||||
saveJSON(savePath)
|
||||
|
||||
func _process(delta):
|
||||
|
|
|
@ -24,20 +24,20 @@ func _ready():
|
|||
if loadJSON("res://content/stats.json"):
|
||||
for i in range(int(data.get("amount"))):
|
||||
var fieldInstance = field.instantiate()
|
||||
add_child(fieldInstance)
|
||||
get_child(i+1).position = Vector2(16,(16+i*88))
|
||||
get_child(i+1).placeholder_text = data.get(str(i))
|
||||
$"ScrollContainer/VBoxContainer".add_child(fieldInstance)
|
||||
$"ScrollContainer/VBoxContainer".get_child(i).placeholder_text = data.get(str(i))
|
||||
$"ScrollContainer/VBoxContainer".get_child(i).custom_minimum_size.y = 40
|
||||
if i > 0:
|
||||
get_child(i+1).editable = false
|
||||
$"ScrollContainer/VBoxContainer".get_child(i).editable = false
|
||||
amount = data.get("amount")
|
||||
|
||||
func _on_button_pressed():
|
||||
var savePath = str("user://player_data"+get_child(1).text+".json")
|
||||
var savePath = str("user://player_data"+$"ScrollContainer/VBoxContainer".get_child(0).text+".json")
|
||||
if loadJSON(savePath):
|
||||
for i in range(int(amount)-1):
|
||||
get_child(i+2).text = data.get(str(get_child(i+2).placeholder_text))
|
||||
$"ScrollContainer/VBoxContainer".get_child(i+1).text = data.get(str($"ScrollContainer/VBoxContainer".get_child(i+1).placeholder_text))
|
||||
|
||||
func _process(delta):
|
||||
func _process(_delta):
|
||||
if Input.is_action_pressed("escape"):
|
||||
get_tree().change_scene_to_file("res://scenes/menu/main.tscn")
|
||||
|
||||
|
|
Loading…
Reference in a new issue