config-importer.tscn 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. [gd_scene load_steps=2 format=3 uid="uid://c7m7hu5uvgbit"]
  2. [sub_resource type="GDScript" id="GDScript_d7xax"]
  3. script/source = "@tool
  4. extends Control
  5. var path: String
  6. var _config_path: String
  7. var _config := ConfigFile.new()
  8. const _config_section := 'CONFIG'
  9. func _enter_tree() -> void:
  10. _config_path = path.path_join('config-importer.ini')
  11. _config.load(_config_path)
  12. $config_path.text = _config.get_value(_config_section, 'config_path', '')
  13. func _exit_tree() -> void:
  14. _config_save()
  15. func _config_save() -> void:
  16. _config.set_value(_config_section, 'config_path', $config_path.text)
  17. _config.save(_config_path)
  18. func _on_import_perform_button_down():
  19. print(_config_path)
  20. "
  21. [node name="配置" type="VBoxContainer"]
  22. anchors_preset = 15
  23. anchor_right = 1.0
  24. anchor_bottom = 1.0
  25. grow_horizontal = 2
  26. grow_vertical = 2
  27. script = SubResource("GDScript_d7xax")
  28. [node name="config_path" type="LineEdit" parent="."]
  29. layout_mode = 2
  30. placeholder_text = "配置路径"
  31. [node name="import_perform" type="Button" parent="."]
  32. layout_mode = 2
  33. text = "读取表格生成配置"
  34. [connection signal="button_down" from="import_perform" to="." method="_on_import_perform_button_down"]