GodotComponentTest/ui/WorldGeneratorUI.gd

27 lines
732 B
GDScript

extends CenterContainer
onready var SeedLineEdit: LineEdit
onready var ChunkSizeSpinBox: SpinBox
#onready var GameScene: PackedScene = preload ("res://scenes/Game.tscn")
func _ready():
SeedLineEdit = find_node("SeedLineEdit")
assert(SeedLineEdit)
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())
func _on_GenerateButton_pressed():
# var game_scene_instance = GameScene.instance()
self.visible = false
# get_tree().get_root().add_child(game_scene_instance)
# game_scene_instance.StartNewGame(int(SeedLineEdit.text), int(ChunkSizeSpinBox.value))