-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add programmer callbacks to FmodEvent
- Loading branch information
Showing
18 changed files
with
248 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class_name ChooseLanguageButton extends OptionButton | ||
|
||
|
||
@export var root_node: Node | ||
var current_bank_loader: FmodBankLoader = null | ||
|
||
func _enter_tree(): | ||
connect("item_selected", _on_item_selected) | ||
|
||
func _on_item_selected(index: int): | ||
if index == -1: | ||
return | ||
if (current_bank_loader != null): | ||
root_node.remove_child(current_bank_loader) | ||
var bank_path := "res://assets/Banks/Dialogue_%s.bank" % get_item_text(index) | ||
current_bank_loader = FmodBankLoader.new() | ||
current_bank_loader.bank_paths = [bank_path] | ||
root_node.add_child(current_bank_loader) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
extends Button | ||
|
||
|
||
@export var welcome_option_button: ChooseLanguageButton | ||
|
||
func _enter_tree(): | ||
connect("pressed", _on_pressed) | ||
|
||
func _on_pressed(): | ||
if welcome_option_button.current_bank_loader == null: | ||
return | ||
var event_emitter = FmodEventEmitter2D.new() | ||
event_emitter.event_guid = "{9aa2ecc5-ea4b-4ebe-85c3-054b11b21dcd}" | ||
event_emitter.autoplay = true | ||
event_emitter.set_programmer_callback("welcome") | ||
welcome_option_button.current_bank_loader.add_child(event_emitter) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
class_name WelcomeOptionButton extends OptionButton | ||
|
||
|
||
var current_index := -1 | ||
|
||
func _enter_tree(): | ||
connect("item_selected", _on_item_selected) | ||
|
||
func _on_item_selected(index: int): | ||
if index == -1: | ||
return | ||
if (current_index != -1): | ||
FmodServer.unload_bank("res://assets/Banks/%s" % ("Dialogue_%s.bank" % get_item_text(current_index))) | ||
current_index = index | ||
var bank_path := "res://assets/Banks/Dialogue_%s.bank" % get_item_text(index) | ||
# warning-ignore:return_value_discarded | ||
FmodServer.load_bank(bank_path, FmodServer.FMOD_STUDIO_LOAD_BANK_NORMAL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
extends Button | ||
|
||
|
||
@export var welcome_option_button_path: NodePath | ||
var welcome_option_button: WelcomeOptionButton | ||
|
||
func _enter_tree(): | ||
connect("pressed", _on_pressed) | ||
|
||
func _ready(): | ||
welcome_option_button = get_node(welcome_option_button_path) | ||
|
||
func _on_pressed(): | ||
if welcome_option_button.current_index == -1: | ||
return | ||
var event_instance = FmodServer.create_event_instance("event:/Character/Dialogue") | ||
event_instance.set_programmer_callback("welcome") | ||
event_instance.start() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.