-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tutorial: Fix notification showing up when user logs in
- Loading branch information
1 parent
a391824
commit 4d8e947
Showing
3 changed files
with
19 additions
and
15 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 |
---|---|---|
|
@@ -7,10 +7,11 @@ onready var debug_panel := $CanvasLayer/DebugPanel | |
onready var chat_box := $CanvasLayer/ChatBox | ||
onready var notification_list := $CanvasLayer/NotificationList | ||
|
||
var email := "[email protected]" | ||
var password := "password" | ||
|
||
|
||
func _ready() -> void: | ||
var email := "[email protected]" | ||
var password := "password" | ||
|
||
var result: int = yield(request_authentication(email, password), "completed") | ||
if result != OK: | ||
|
@@ -65,13 +66,17 @@ func _on_ChatBox_text_sent(text) -> void: | |
yield(server_connection.send_text_async(text), "completed") | ||
|
||
|
||
func _on_ServerConnection_chat_message_received(sender_id, text) -> void: | ||
chat_box.add_reply(text, "User", user_color) | ||
func _on_ServerConnection_chat_message_received(username, text) -> void: | ||
chat_box.add_reply(text, username, user_color) | ||
|
||
|
||
func _on_ServerConnection_user_joined(user) -> void: | ||
notification_list.add_notification(user.username, Color.white, false) | ||
func _on_ServerConnection_user_joined(username) -> void: | ||
if email == username: | ||
return | ||
notification_list.add_notification(username, Color.white, false) | ||
|
||
|
||
func _on_ServerConnection_user_left(user) -> void: | ||
notification_list.add_notification(user.username, Color.white, true) | ||
func _on_ServerConnection_user_left(username) -> void: | ||
if email == username: | ||
return | ||
notification_list.add_notification(username, Color.white, true) |
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