37 lines
789 B
GDScript
37 lines
789 B
GDScript
@tool
|
|
extends ConfirmationDialog
|
|
class_name SceneIDRequestDialog
|
|
|
|
signal request_confirmed(prefix: int)
|
|
|
|
var _prefix_edit: SpinBox
|
|
|
|
func _ready() -> void:
|
|
title = "Request Scene ID"
|
|
ok_button_text = "Request"
|
|
cancel_button_text = "Cancel"
|
|
|
|
var v := VBoxContainer.new()
|
|
add_child(v)
|
|
|
|
# Prefix
|
|
var h := HBoxContainer.new()
|
|
v.add_child(h)
|
|
|
|
var l := Label.new()
|
|
l.text = "Prefix:"
|
|
h.add_child(l)
|
|
|
|
_prefix_edit = SpinBox.new()
|
|
_prefix_edit.min_value = 0
|
|
_prefix_edit.max_value = 99999999
|
|
_prefix_edit.step = 1
|
|
_prefix_edit.value = 10000 # 默认值,可改成自动推断
|
|
_prefix_edit.size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
|
h.add_child(_prefix_edit)
|
|
|
|
confirmed.connect(_on_confirmed)
|
|
|
|
func _on_confirmed() -> void:
|
|
request_confirmed.emit(int(_prefix_edit.value))
|