online multiplayer chess game (note server currently down)
Diffstat (limited to 'ui/chat/Chat.gd')
-rw-r--r--ui/chat/Chat.gd118
1 files changed, 90 insertions, 28 deletions
diff --git a/ui/chat/Chat.gd b/ui/chat/Chat.gd
index 9cb41d7..5cc2d97 100644
--- a/ui/chat/Chat.gd
+++ b/ui/chat/Chat.gd
@@ -22,28 +22,87 @@ var emoji_replace_regex := compile(":[^:]{1,30}:")
const piece_emoji_path = "res://assets/pieces/cburnett/"
const emoji_path = "res://assets/emojis/"
const emojis := {
- [":cold:"]: emoji_path + "cold.png",
- [":bigsmile:"]: emoji_path + "bigsmile.png",
- [":cry:", ":sad:"]: emoji_path + "cry.png",
- [":happy:"]: emoji_path + "happy.png",
- [":hmm:"]: emoji_path + "hmm.png",
- [":huh:"]: emoji_path + "huh.png",
- [":smile:"]: emoji_path + "smile.png",
- [":unhappy:"]: emoji_path + "unhappy.png",
- [":upsidedown_smile:"]: emoji_path + "upsidedown_smile.png",
- [":weary:"]: emoji_path + "weary.png",
- [":what:"]: emoji_path + "what.png",
- [":wink_tongue:"]: emoji_path + "wink_tongue.png",
- [":wink:"]: emoji_path + "wink.png",
- [":wow:"]: emoji_path + "wow.png",
- [":zany:"]: emoji_path + "zany.png",
- [":...:"]: emoji_path + "3dots.png",
- [":R:", ":rook:"]: piece_emoji_path + "wR.png",
- [":N:", ":knight:"]: piece_emoji_path + "wN.png",
- [":B:", ":bishop:"]: piece_emoji_path + "wB.png",
- [":Q:", ":queen:"]: piece_emoji_path + "wQ.png",
- [":K:", ":king:"]: piece_emoji_path + "wK.png",
- [":P:", ":pawn:"]: piece_emoji_path + "wP.png",
+ ":grinning:": "๐Ÿ˜€",
+ ":smiley:": "๐Ÿ˜ƒ",
+ ":smile:": "๐Ÿ˜„",
+ ":grin:": "๐Ÿ˜",
+ [":laughing:", ":satisfied:"]: "๐Ÿ˜†",
+ ":sweat_smile:": "๐Ÿ˜…",
+ ":joy:": "๐Ÿ˜‚",
+ ":rofl:": "๐Ÿคฃ",
+ ":blush:": "๐Ÿ˜Š",
+ ":innocent:": "๐Ÿ˜‡",
+ [":slight_smile:", ":slightly_smiling:"]: "๐Ÿ™‚",
+ [":upside_down:", ":upside_down:"]: "๐Ÿ™ƒ",
+ ":wink:": "๐Ÿ˜‰",
+ ":relieved:": "๐Ÿ˜Œ",
+ ":tear_smile:": "๐Ÿฅฒ",
+ ":heart_eyes:": "๐Ÿ˜",
+ ":hearty:": "๐Ÿฅฐ",
+ ":stuck_out_tongue_winking_eye:": "๐Ÿ˜œ",
+ ":yum:": "๐Ÿ˜‹",
+ ":stuck_out_tongue_closed_eyes:": "๐Ÿ˜",
+ ":stuck_out_tongue:": "๐Ÿ˜›",
+ ":raised_eyebrow:": "๐Ÿคจ",
+ ":sunglasses:": "๐Ÿ˜Ž",
+ ":nerd:": "๐Ÿค“",
+ ":star_struck:": "๐Ÿคฉ",
+ ":partying:": "๐Ÿฅณ",
+ ":smirk:": "๐Ÿ˜",
+ ":unamused:": "๐Ÿ˜’",
+ ":disappointed:": "๐Ÿ˜ž",
+ ":pensive:": "๐Ÿ˜”",
+ ":worried:": "๐Ÿ˜Ÿ",
+ ":confused:": "๐Ÿ˜•",
+ ":frown:": "๐Ÿ™",
+ ":persevere:": "๐Ÿ˜ฃ",
+ ":confounded:": "๐Ÿ˜–",
+ ":tired:": "๐Ÿ˜ซ",
+ ":weary:": "๐Ÿ˜ฉ",
+ ":cry:": "๐Ÿ˜ข",
+ ":sob:": "๐Ÿ˜ญ",
+ ":triumph:": "๐Ÿ˜ค",
+ ":angry:": "๐Ÿ˜ ",
+ ":rage:": "๐Ÿ˜ก",
+ ":no_mouth:": "๐Ÿ˜ถ",
+ ":sleeping:": "๐Ÿ˜ด",
+ ":cold:": "๐Ÿฅถ",
+ ":neutral:": "๐Ÿ˜",
+ ":expressionless:": "๐Ÿ˜‘",
+ ":hushed:": "๐Ÿ˜ฏ",
+ ":frowning:": "๐Ÿ˜ฆ",
+ ":anguished:": "๐Ÿ˜ง",
+ ":open_mouth:": "๐Ÿ˜ฎ",
+ ":astonished:": "๐Ÿ˜ฒ",
+ ":dizzy:": "๐Ÿ˜ต",
+ ":scream:": "๐Ÿ˜ฑ",
+ ":fearful:": "๐Ÿ˜จ",
+ ":cold_sweat:": "๐Ÿ˜ฐ",
+ ":disappointed_relieved:": "๐Ÿ˜ฅ",
+ ":sweat:": "๐Ÿ˜“",
+ ":sleepy:": "๐Ÿ˜ช",
+ ":devil:": "๐Ÿ˜ˆ",
+ ":face_with_rolling_eyes:": "๐Ÿ™„",
+ ":lying:": "๐Ÿคฅ",
+ ":grimacing:": "๐Ÿ˜ฌ",
+ ":zipped_mouth:": "๐Ÿค",
+ ":nauseated:": "๐Ÿคข",
+ ":sneezing:": "๐Ÿคง",
+ ":mask:": "๐Ÿ˜ท",
+ ":face_with_thermometer:": "๐Ÿค’",
+ ":face_with_head_bandage:": "๐Ÿค•",
+ ":smiley_cat:": "๐Ÿ˜บ",
+ ":smile_cat:": "๐Ÿ˜ธ",
+ ":joy_cat:": "๐Ÿ˜น",
+ ":heart_eyes_cat:": "๐Ÿ˜ป",
+ ":turtle:": "๐Ÿข",
+ ":cat:": "๐Ÿˆ",
+ ":smirk_cat:": "๐Ÿ˜ผ",
+ ":scream_cat:": "๐Ÿ™€",
+ ":cat_joy:": "๐Ÿ˜น",
+ ":cat_grin:": "๐Ÿ˜ธ",
+ ":crying_cat:": "๐Ÿ˜ฟ",
+ ":pouting_cat:": "๐Ÿ˜พ",
}
var expanded_emojis = {}
@@ -61,10 +120,13 @@ func _exit_tree():
Globals.chat = null
-func setup_triggers():
+func expand_emojis():
for trigger_list in emojis:
- for trigger in trigger_list:
- expanded_emojis[trigger] = emojis[trigger_list]
+ if typeof(trigger_list) == TYPE_ARRAY:
+ for trigger in trigger_list:
+ expanded_emojis[trigger] = emojis[trigger_list]
+ else:
+ expanded_emojis[trigger_list] = emojis[trigger_list]
func setup_text_input():
@@ -74,7 +136,7 @@ func setup_text_input():
kb.connect("closed", dsk_input, "set_text")
kb.text.emojibutton._setup(emojis)
dsk_input.textedit.connect("focus_entered", self, "open_kb")
- print("mobile keyboard setup")
+ Log.info("Mobile keyboard setup")
else:
kb.free()
dsk_input.show()
@@ -88,7 +150,7 @@ func open_kb():
func _ready():
- setup_triggers()
+ expand_emojis()
setup_text_input()
PacketHandler.connect("chat", self, "add_label_with")
server("Welcome!") # say hello
@@ -140,5 +202,5 @@ func emoji2bb(input: String) -> String:
for i in emoji_replace_regex.search_all(input):
var emoji = i.strings[0]
if emoji in expanded_emojis:
- input = input.replace(emoji, "[img=30]%s[/img]" % expanded_emojis[emoji])
+ input = input.replace(emoji, "%s" % expanded_emojis[emoji])
return input