forked from godot-extended-libraries/godot-next
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed to extend Reference and added a Node wrapper. Also validate f…
…unction calls before calling.
- Loading branch information
Showing
2 changed files
with
45 additions
and
4 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,33 @@ | ||
# MessageDispatcherWrapper | ||
# author: MunWolf (Rikhardur Bjarni Einarsson) | ||
# license: MIT | ||
# copyright: Copyright (c) 2019 Rikhardur Bjarni Einarsson | ||
# brief_description: A wrapper for MessageDispatcher that is extendable on a Node, | ||
# people can also use this as a template to implement it on | ||
# their own if they want to extend something else. | ||
|
||
extends Node | ||
|
||
class_name MessageDispatcherWrapper | ||
|
||
##### PROPERTIES ##### | ||
|
||
var _message_dispatcher = MessageDispatcher.new() | ||
|
||
##### PUBLIC METHODS ##### | ||
|
||
# See same function on MessageDispatcher | ||
func connect_message(message_type: String, obj: Object, function: String) -> void: | ||
_message_dispatcher.connect_message(message_type, obj, function) | ||
|
||
# See same function on MessageDispatcher | ||
func disconnect_message(message_type: String, obj: Object, function: String) -> void: | ||
_message_dispatcher.disconnect_message(message_type, obj, function) | ||
|
||
# See same function on MessageDispatcher | ||
func disconnect_all_message() -> void: | ||
_message_dispatcher.disconnect_all_message() | ||
|
||
# See same function on MessageDispatcher | ||
func emit_message(message_type: String, message_data: Dictionary) -> bool: | ||
return _message_dispatcher.emit_message(message_type, message_data) |
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