online multiplayer chess game (note server currently down)
Diffstat (limited to 'ui/chat/Chat.gd')
| -rw-r--r-- | ui/chat/Chat.gd | 118 |
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 |