Skip videos
This commit is contained in:
@@ -382,6 +382,9 @@ func unpause_game():
|
||||
escoria.main.current_scene.show()
|
||||
|
||||
func pause_game():
|
||||
if get_video_player().is_playing():
|
||||
get_video_player().skip()
|
||||
return
|
||||
if not get_node(pause_menu).visible:
|
||||
get_node(main_menu).reset()
|
||||
get_node(pause_menu).reset()
|
||||
|
||||
@@ -10,3 +10,18 @@ func play(video_file: String):
|
||||
func _on_VideoPlayer_finished():
|
||||
self.visible = false
|
||||
emit_signal("finished")
|
||||
|
||||
|
||||
func skip():
|
||||
$VideoPlayer.stop()
|
||||
self.visible = false
|
||||
emit_signal("finished")
|
||||
|
||||
func get_player():
|
||||
return $VideoPlayer
|
||||
|
||||
func is_playing() -> bool:
|
||||
var play = $VideoPlayer.is_playing()
|
||||
return play
|
||||
func _on_Skip_pressed():
|
||||
skip()
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
[gd_scene load_steps=3 format=2]
|
||||
[gd_scene load_steps=5 format=2]
|
||||
|
||||
[ext_resource path="res://gymkhana/addons/escoria-ui-return-monkey-island/video_player/video_player.gd" type="Script" id=1]
|
||||
|
||||
[sub_resource type="VideoStreamTheora" id=1]
|
||||
|
||||
[sub_resource type="InputEventAction" id=2]
|
||||
action = "ui_cancel"
|
||||
|
||||
[sub_resource type="ShortCut" id=3]
|
||||
shortcut = SubResource( 2 )
|
||||
|
||||
[node name="video_player" type="Control"]
|
||||
margin_right = 1285.0
|
||||
margin_bottom = 753.0
|
||||
@@ -20,4 +26,14 @@ margin_bottom = 747.0
|
||||
stream = SubResource( 1 )
|
||||
expand = false
|
||||
|
||||
[node name="Skip" type="Button" parent="."]
|
||||
margin_left = 598.0
|
||||
margin_top = 662.0
|
||||
margin_right = 685.0
|
||||
margin_bottom = 694.0
|
||||
shortcut = SubResource( 3 )
|
||||
text = "Saltar video"
|
||||
flat = true
|
||||
|
||||
[connection signal="finished" from="VideoPlayer" to="." method="_on_VideoPlayer_finished"]
|
||||
[connection signal="pressed" from="Skip" to="." method="_on_Skip_pressed"]
|
||||
|
||||
Reference in New Issue
Block a user