浏览代码

:tada: Allow selection of starting slide from editor

In order to start from the middle of the presentation.
DricomDragon 2 年之前
父节点
当前提交
b72cf60814
共有 2 个文件被更改,包括 9 次插入1 次删除
  1. 8 1
      godot/projector/show/Show.gd
  2. 1 0
      godot/run/root.tscn

+ 8 - 1
godot/projector/show/Show.gd

@@ -5,8 +5,11 @@ extends Node2D
 
 signal new_focus(pos: Vector2, scale: float)
 
-var current_id := -1
+const VOID_SLIDE_ID := -1
 
+@export var start_slide := 0
+
+var current_id := VOID_SLIDE_ID
 var current_slide: Slide
 
 @onready var slides: Array = get_children()
@@ -16,6 +19,7 @@ func _ready():
 	_enforce_children()
 	next_slide()
 
+
 func next_slide():
 	_disconnect_current_slide()
 	current_id = _next_id()
@@ -45,6 +49,9 @@ func _enforce_children() -> void:
 
 
 func _next_id() -> int:
+	if current_id == VOID_SLIDE_ID:
+		return start_slide
+
 	var next_id: int = current_id + 1
 
 	if next_id >= slides.size():

+ 1 - 0
godot/run/root.tscn

@@ -49,6 +49,7 @@ position = Vector2(-291, -187)
 zoom = Vector2(0.1, 0.1)
 
 [node name="Show" parent="Board" instance=ExtResource("2_cih7e")]
+start_slide = 34
 
 [node name="World" parent="Board/Show" instance=ExtResource("3_s3lgd")]
 scale = Vector2(10, 10)