GodotComponentTest/ui/WorldGeneratorUI.gd

27 lines
732 B
GDScript
Raw Permalink Normal View History

2023-12-14 17:27:07 +01:00
extends CenterContainer
2023-12-14 17:27:07 +01:00
onready var SeedLineEdit: LineEdit
onready var ChunkSizeSpinBox: SpinBox
#onready var GameScene: PackedScene = preload ("res://scenes/Game.tscn")
func _ready():
2023-12-14 17:27:07 +01:00
SeedLineEdit = find_node("SeedLineEdit")
assert(SeedLineEdit)
2023-12-14 17:27:07 +01:00
ChunkSizeSpinBox = find_node("ChunkSizeSpinBox")
assert(ChunkSizeSpinBox)
func _on_RefreshSeedButton_pressed():
var rng = RandomNumberGenerator.new()
rng.seed = Time.get_ticks_msec()
SeedLineEdit.text = str(rng.randi())
2023-12-14 17:27:07 +01:00
func _on_GenerateButton_pressed():
# var game_scene_instance = GameScene.instance()
2023-12-14 17:27:07 +01:00
self.visible = false
# get_tree().get_root().add_child(game_scene_instance)
# game_scene_instance.StartNewGame(int(SeedLineEdit.text), int(ChunkSizeSpinBox.value))