Intial commit
This commit is contained in:
33
client/Scripts/Systems/GameGui.gd
Normal file
33
client/Scripts/Systems/GameGui.gd
Normal file
@ -0,0 +1,33 @@
|
||||
extends CanvasLayer
|
||||
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
func set_dialog(message, speaker=""):
|
||||
$Dialog.show()
|
||||
$Dialog/Textbox/Speaker.text = speaker
|
||||
$Dialog/Textbox/Body.text = message
|
||||
|
||||
func finish_dialog():
|
||||
$Dialog.hide()
|
||||
|
||||
func clear_choices():
|
||||
$Dialog/Choices.hide()
|
||||
for i in range($Dialog/Choices.get_child_count()):
|
||||
$Dialog/Choices.get_child(i).queue_free()
|
||||
|
||||
func add_choice(speaker : Node, choice_id : int, choice_text : String):
|
||||
var button = Button.new()
|
||||
button.text = choice_text
|
||||
button.connect("button_down", speaker, "_on_choice", [choice_id])
|
||||
$Dialog/Choices.add_child(button)
|
||||
|
||||
func show_choices():
|
||||
$Dialog/Choices.show()
|
31
client/Scripts/Systems/TitleButtons.gd
Normal file
31
client/Scripts/Systems/TitleButtons.gd
Normal file
@ -0,0 +1,31 @@
|
||||
extends Node
|
||||
|
||||
var audio_player : AudioStreamPlayer
|
||||
var audio_clip = preload("res://Assets/Sfx/button_press.wav")
|
||||
|
||||
|
||||
func _ready():
|
||||
audio_player = AudioStreamPlayer.new()
|
||||
add_child(audio_player)
|
||||
audio_player.stream = audio_clip
|
||||
|
||||
$StartButton.connect("button_down", self, "_on_button_press", ["start"])
|
||||
$QuitButton.connect("button_down", self, "_on_button_press", ["quit"])
|
||||
$CreditsButton.connect("button_down", self, "_on_button_press", ["credits"])
|
||||
$OptionsButton.connect("button_down", self, "_on_button_press", ["options"])
|
||||
$BugButton.connect("button_down", self, "_on_button_press", ["bug"])
|
||||
|
||||
|
||||
func _on_button_press(button):
|
||||
audio_player.play()
|
||||
match(button):
|
||||
"start":
|
||||
get_tree().change_scene("res://Scenes/Intro.scn")
|
||||
"quit":
|
||||
get_tree().quit(0)
|
||||
"credits":
|
||||
get_parent().get_parent().get_node("CreditsDialog").popup_centered()
|
||||
"options":
|
||||
get_parent().get_parent().get_node("OptionsDialog").popup_centered()
|
||||
"bug":
|
||||
OS.shell_open("https://github.com/josephbmanley")
|
Reference in New Issue
Block a user