Files
IntoHole/playtest/showcase/scripts/showcase.gd
T
Yanchen 39ff1fd7b4 feat: 建立关卡工坊并整理项目目录
- 加入 Godot 基础试玩、画风展示和通孔验证场景
- 支持自由放球、多层叠放、墙壁、锥口球洞及固定 +5 m/s 定向加速方块
- 保存 Blender 源资产、模型导出、资源制作脚本和关卡编辑存档逻辑
- 按七类目录归档工程,集中 zsh 启动入口并补充 AGENTS.md 文件索引
- 同步设计规则、依赖锁定、验证报告和目录迁移记录

验证:目录迁移后的资源导入与四个场景加载通过;本次提交前检查暂存内容,未重复运行整套物理测试。
2026-11-16 11:12:21 +08:00

59 lines
2.1 KiB
GDScript

extends "res://designer/scripts/studio.gd"
var speed_slider: HSlider
var speed_label: Label
var reset_button: Button
func setup_environment() -> void:
super.setup_environment()
camera.h_offset=0
func setup_ui() -> void:
var layer:=CanvasLayer.new();add_child(layer)
var panel:=PanelContainer.new();layer.add_child(panel)
panel.set_anchors_and_offsets_preset(Control.PRESET_CENTER_BOTTOM)
panel.offset_left=-340;panel.offset_right=340
panel.offset_top=-96;panel.offset_bottom=-24
panel.add_theme_stylebox_override("panel",style(PAPER))
var controls:=row(panel)
controls.add_theme_constant_override("separation",16)
run_button=button("启动",toggle_run,true);run_button.custom_minimum_size.x=100
controls.add_child(run_button)
reset_button=button("重置",reset_simulation);reset_button.custom_minimum_size.x=100
controls.add_child(reset_button)
var speed_control:=VBoxContainer.new();speed_control.size_flags_horizontal=Control.SIZE_EXPAND_FILL
controls.add_child(speed_control)
speed_label=label("初速度 0.0 m/s",15);speed_control.add_child(speed_label)
speed_slider=HSlider.new();speed_slider.min_value=0;speed_slider.max_value=5
speed_slider.step=.1;speed_slider.value=0;speed_slider.custom_minimum_size=Vector2(360,24)
speed_slider.value_changed.connect(func(value):speed_label.text="初速度 %.1f m/s" % value)
speed_control.add_child(speed_slider)
func rebuild() -> void:
super.rebuild()
for child in world.get_children():
if child is Label3D:child.hide()
func reset_simulation() -> void:
super.reset_simulation()
for tag in tags:tag.hide()
func initial_velocity(index: int) -> Vector3:
var spec: Dictionary=spawn_specs[index]
var direction: Vector3=lib.vector(spec.launchDirection)
return direction.normalized()*speed_slider.value
func toggle_run() -> void:
if started:return
super.toggle_run()
func refresh_ui() -> void:
if run_button==null:return
run_button.disabled=started
speed_slider.editable=not started
func initialize_level() -> void:
apply_data(JSON.parse_string(FileAccess.get_file_as_string("res://playtest/showcase/data/showcase.json")))
status="准备好,让两颗铁球一起出发。"
refresh_ui()