From df048bdeecbeea6b0e8d58a89984f9f0acc3d2aa Mon Sep 17 00:00:00 2001 From: Benefit-Zebra <42458260+Benefit-Zebra@users.noreply.github.com> Date: Mon, 20 Jul 2020 18:47:21 +0530 Subject: [PATCH 1/4] BombSquad now has Exclusive Emojis --- .../python/bastd/ui/onscreenkeyboard.py | 74 ++++++++++++++++++- 1 file changed, 70 insertions(+), 4 deletions(-) diff --git a/assets/src/ba_data/python/bastd/ui/onscreenkeyboard.py b/assets/src/ba_data/python/bastd/ui/onscreenkeyboard.py index d32a9ae5..5494e2ec 100644 --- a/assets/src/ba_data/python/bastd/ui/onscreenkeyboard.py +++ b/assets/src/ba_data/python/bastd/ui/onscreenkeyboard.py @@ -86,9 +86,12 @@ class OnScreenKeyboardWindow(ba.Window): always_show_carat=True) self._shift_button = None + self._double_press_shift = False self._num_mode_button = None + self._emoji_button = None self._char_keys: List[ba.Widget] = [] self._mode = 'normal' + self._last_mode = 'normal' v = self._height - 180 key_width = 46 @@ -176,6 +179,19 @@ class OnScreenKeyboardWindow(ba.Window): color=key_color_dark, label='', ) + if self._emoji_button is None: + self._emoji_button = ba.buttonwidget( + parent=self._root_widget, + position=(56, v - 8), + size=(key_width, key_height + 5), + autoselect=True, + enable_sound=False, + textcolor=key_textcolor, + color=key_color_dark, + label=ba.charstr(ba.SpecialChar.LOGO_FLAT), + extra_touch_border_scale=0.3, + button_type='square', + ) btn1 = self._num_mode_button btn2 = ba.buttonwidget(parent=self._root_widget, position=(210, v - 12), @@ -188,10 +204,12 @@ class OnScreenKeyboardWindow(ba.Window): label=ba.Lstr(resource='spaceKeyText'), on_activate_call=ba.Call( self._type_char, ' ')) + btn3 = self._emoji_button ba.widget(edit=btn1, right_widget=btn2) ba.widget(edit=btn2, left_widget=btn1, right_widget=self._done_button) + ba.widget(edit=btn3, left_widget=btn1) ba.widget(edit=self._done_button, left_widget=btn2) ba.containerwidget(edit=self._root_widget, @@ -201,7 +219,7 @@ class OnScreenKeyboardWindow(ba.Window): def _refresh(self) -> None: chars: Optional[List[str]] = None - if self._mode in ['normal', 'caps']: + if self._mode in ['normal', 'caps', 'emoji']: chars = [ 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', @@ -217,6 +235,40 @@ class OnScreenKeyboardWindow(ba.Window): ba.buttonwidget(edit=self._num_mode_button, label='123#&*', on_activate_call=self._num_mode) + if self._mode == 'emoji': + chars = [ + ba.charstr( + ba.SpecialChar.LOGO_FLAT), ba.charstr( + ba.SpecialChar.UP_ARROW), ba.charstr( + ba.SpecialChar.DOWN_ARROW), ba.charstr( + ba.SpecialChar.LEFT_ARROW), ba.charstr( + ba.SpecialChar.RIGHT_ARROW), ba.charstr( + ba.SpecialChar.DELETE), ba.charstr( + ba.SpecialChar.BACK), ba.charstr( + ba.SpecialChar.TICKET), ba.charstr( + ba.SpecialChar.PARTY_ICON), ba.charstr( + ba.SpecialChar.LOCAL_ACCOUNT), ba.charstr( + ba.SpecialChar.FEDORA), ba.charstr( + ba.SpecialChar.HAL), ba.charstr( + ba.SpecialChar.CROWN), ba.charstr( + ba.SpecialChar.YIN_YANG), ba.charstr( + ba.SpecialChar.EYE_BALL), ba.charstr( + ba.SpecialChar.SKULL), ba.charstr( + ba.SpecialChar.HEART), ba.charstr( + ba.SpecialChar.DRAGON), ba.charstr( + ba.SpecialChar.HELMET), ba.charstr( + ba.SpecialChar.MUSHROOM), ba.charstr( + ba.SpecialChar.NINJA_STAR), ba.charstr( + ba.SpecialChar.VIKING_HELMET), ba.charstr( + ba.SpecialChar.MOON), ba.charstr( + ba.SpecialChar.SPIDER), ba.charstr( + ba.SpecialChar.FIREBALL), ba.charstr( + ba.SpecialChar.MIKIROG)] + ba.buttonwidget(edit=self._emoji_button, + color=self._key_color_lit + if self._mode == 'emoji' else self._key_color_dark, + label=ba.charstr(ba.SpecialChar.LOGO_FLAT), + on_activate_call=self._emoji_mode) elif self._mode == 'num': chars = [ '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '/', @@ -251,12 +303,25 @@ class OnScreenKeyboardWindow(ba.Window): self._mode = 'num' self._refresh() + def _emoji_mode(self) -> None: + ba.playsound(self._click_sound) + if self._mode in ['normal', 'caps', 'num']: + self._last_mode = self._mode + self._mode = 'emoji' + elif self._mode == 'emoji': + self._mode = self._last_mode + self._refresh() + def _shift(self) -> None: ba.playsound(self._click_sound) if self._mode == 'normal': self._mode = 'caps' + self._double_press_shift = False elif self._mode == 'caps': - self._mode = 'normal' + if not self._double_press_shift: + self._double_press_shift = True + else: + self._mode = 'normal' self._refresh() def _del(self) -> None: @@ -273,8 +338,9 @@ class OnScreenKeyboardWindow(ba.Window): txt = cast(str, ba.textwidget(query=self._text_field)) txt += char ba.textwidget(edit=self._text_field, text=txt) - # if we were caps, go back - if self._mode == 'caps': + # if we were caps, + # go back only if not Shift is pressed twice + if self._mode == 'caps' and self._double_press_shift != True: self._mode = 'normal' self._refresh() From 910243cefe67e3085feaa2a8441bc60ac9a348db Mon Sep 17 00:00:00 2001 From: Benefit-Zebra <42458260+Benefit-Zebra@users.noreply.github.com> Date: Mon, 20 Jul 2020 18:48:46 +0530 Subject: [PATCH 2/4] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8dc32dac..e134ce09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ - Fixed the shebang line in `bombsquad_server` file by using `-S` flag for `/usr/bin/env`. - Fixed a bug with hardware keyboards emitting extra characters in the in-game console (~ or F2) - Added support for 'plugin' mods and user controls to configure them in settings->advanced->plugins. +- BombSquad now has its own Exclusive Emojis in the Internal Game Keyboard. +- Added continuos CAPITAL letters typing feature in the Internal Game Keyboard. ### 1.5.22 (20139) - Button and key names now display correctly again on Android (and are cleaned up on other platforms too). From 919d8501cad5489c3cfe468bf3ee1dd9a90f0d83 Mon Sep 17 00:00:00 2001 From: Benefit-Zebra <42458260+Benefit-Zebra@users.noreply.github.com> Date: Tue, 21 Jul 2020 17:45:21 +0530 Subject: [PATCH 3/4] Added Classic Emojis --- .../python/bastd/ui/onscreenkeyboard.py | 106 +++++++++++------- 1 file changed, 67 insertions(+), 39 deletions(-) diff --git a/assets/src/ba_data/python/bastd/ui/onscreenkeyboard.py b/assets/src/ba_data/python/bastd/ui/onscreenkeyboard.py index 5494e2ec..9164c492 100644 --- a/assets/src/ba_data/python/bastd/ui/onscreenkeyboard.py +++ b/assets/src/ba_data/python/bastd/ui/onscreenkeyboard.py @@ -26,6 +26,8 @@ from typing import TYPE_CHECKING, cast import _ba import ba +from ba import charstr +from ba import SpecialChar as SpCh if TYPE_CHECKING: from typing import List, Tuple, Optional @@ -128,7 +130,7 @@ class OnScreenKeyboardWindow(ba.Window): autoselect=True, textcolor=key_textcolor, color=key_color_dark, - label=ba.charstr(ba.SpecialChar.SHIFT), + label=charstr(SpCh.SHIFT), enable_sound=False, extra_touch_border_scale=0.3, button_type='square', @@ -160,7 +162,7 @@ class OnScreenKeyboardWindow(ba.Window): repeat=True, textcolor=key_textcolor, color=key_color_dark, - label=ba.charstr(ba.SpecialChar.DELETE), + label=charstr(SpCh.DELETE), button_type='square', on_activate_call=self._del) v -= (key_height + 9) @@ -188,7 +190,7 @@ class OnScreenKeyboardWindow(ba.Window): enable_sound=False, textcolor=key_textcolor, color=key_color_dark, - label=ba.charstr(ba.SpecialChar.LOGO_FLAT), + label=charstr(SpCh.LOGO_FLAT), extra_touch_border_scale=0.3, button_type='square', ) @@ -205,7 +207,7 @@ class OnScreenKeyboardWindow(ba.Window): on_activate_call=ba.Call( self._type_char, ' ')) btn3 = self._emoji_button - ba.widget(edit=btn1, right_widget=btn2) + ba.widget(edit=btn1, right_widget=btn2, left_widget=btn3) ba.widget(edit=btn2, left_widget=btn1, right_widget=self._done_button) @@ -219,7 +221,7 @@ class OnScreenKeyboardWindow(ba.Window): def _refresh(self) -> None: chars: Optional[List[str]] = None - if self._mode in ['normal', 'caps', 'emoji']: + if self._mode in ['normal', 'caps']: chars = [ 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', @@ -230,44 +232,14 @@ class OnScreenKeyboardWindow(ba.Window): ba.buttonwidget(edit=self._shift_button, color=self._key_color_lit if self._mode == 'caps' else self._key_color_dark, - label=ba.charstr(ba.SpecialChar.SHIFT), + label=charstr(SpCh.SHIFT), on_activate_call=self._shift) ba.buttonwidget(edit=self._num_mode_button, label='123#&*', on_activate_call=self._num_mode) - if self._mode == 'emoji': - chars = [ - ba.charstr( - ba.SpecialChar.LOGO_FLAT), ba.charstr( - ba.SpecialChar.UP_ARROW), ba.charstr( - ba.SpecialChar.DOWN_ARROW), ba.charstr( - ba.SpecialChar.LEFT_ARROW), ba.charstr( - ba.SpecialChar.RIGHT_ARROW), ba.charstr( - ba.SpecialChar.DELETE), ba.charstr( - ba.SpecialChar.BACK), ba.charstr( - ba.SpecialChar.TICKET), ba.charstr( - ba.SpecialChar.PARTY_ICON), ba.charstr( - ba.SpecialChar.LOCAL_ACCOUNT), ba.charstr( - ba.SpecialChar.FEDORA), ba.charstr( - ba.SpecialChar.HAL), ba.charstr( - ba.SpecialChar.CROWN), ba.charstr( - ba.SpecialChar.YIN_YANG), ba.charstr( - ba.SpecialChar.EYE_BALL), ba.charstr( - ba.SpecialChar.SKULL), ba.charstr( - ba.SpecialChar.HEART), ba.charstr( - ba.SpecialChar.DRAGON), ba.charstr( - ba.SpecialChar.HELMET), ba.charstr( - ba.SpecialChar.MUSHROOM), ba.charstr( - ba.SpecialChar.NINJA_STAR), ba.charstr( - ba.SpecialChar.VIKING_HELMET), ba.charstr( - ba.SpecialChar.MOON), ba.charstr( - ba.SpecialChar.SPIDER), ba.charstr( - ba.SpecialChar.FIREBALL), ba.charstr( - ba.SpecialChar.MIKIROG)] ba.buttonwidget(edit=self._emoji_button, - color=self._key_color_lit - if self._mode == 'emoji' else self._key_color_dark, - label=ba.charstr(ba.SpecialChar.LOGO_FLAT), + color=self._key_color_dark, + label=charstr(SpCh.LOGO_FLAT), on_activate_call=self._emoji_mode) elif self._mode == 'num': chars = [ @@ -282,6 +254,54 @@ class OnScreenKeyboardWindow(ba.Window): ba.buttonwidget(edit=self._num_mode_button, label='abc', on_activate_call=self._abc_mode) + ba.buttonwidget(edit=self._emoji_button, + color=self._key_color_dark, + label=charstr(SpCh.LOGO_FLAT), + on_activate_call=self._emoji_mode) + + elif self._mode in ['emoji', 'emoji2']: + chars = [ + '🙂', '😄', '😆', '😅', '😂', '☺', '😀', '😉', '😇', '😍', '😘', '😎', + '😏', '😛', '😜', '😝', '😐', '😑', '😢', '😵', '😬', '😌', '😔', '😡', + '😴', '😷' + ] + if self._mode == 'emoji2': + chars = [ + charstr(SpCh.LOGO_FLAT), + charstr(SpCh.UP_ARROW), + charstr(SpCh.DOWN_ARROW), + charstr(SpCh.LEFT_ARROW), + charstr(SpCh.RIGHT_ARROW), + charstr(SpCh.DELETE), + charstr(SpCh.BACK), + charstr(SpCh.TICKET), + charstr(SpCh.PARTY_ICON), + charstr(SpCh.LOCAL_ACCOUNT), + charstr(SpCh.FEDORA), + charstr(SpCh.HAL), + charstr(SpCh.CROWN), + charstr(SpCh.YIN_YANG), + charstr(SpCh.EYE_BALL), + charstr(SpCh.SKULL), + charstr(SpCh.HEART), + charstr(SpCh.DRAGON), + charstr(SpCh.HELMET), + charstr(SpCh.MUSHROOM), + charstr(SpCh.NINJA_STAR), + charstr(SpCh.VIKING_HELMET), + charstr(SpCh.MOON), + charstr(SpCh.SPIDER), + charstr(SpCh.FIREBALL), + charstr(SpCh.MIKIROG)] + ba.buttonwidget(edit=self._shift_button, + color=self._key_color_lit + if self._mode == 'emoji2' else self._key_color_dark, + label=charstr(SpCh.SHIFT), + on_activate_call=self._emoji_mode_2) + ba.buttonwidget(edit=self._emoji_button, + color=self._key_color_lit, + label=charstr(SpCh.LOGO_FLAT), + on_activate_call=self._emoji_mode) for i, btn in enumerate(self._char_keys): assert chars is not None @@ -308,10 +328,18 @@ class OnScreenKeyboardWindow(ba.Window): if self._mode in ['normal', 'caps', 'num']: self._last_mode = self._mode self._mode = 'emoji' - elif self._mode == 'emoji': + elif self._mode == 'emoji' or self._mode == 'emoji2': self._mode = self._last_mode self._refresh() + def _emoji_mode_2(self) -> None: + ba.playsound(self._click_sound) + if self._mode == 'emoji': + self._mode = 'emoji2' + elif self._mode == 'emoji2': + self._mode = 'emoji' + self._refresh() + def _shift(self) -> None: ba.playsound(self._click_sound) if self._mode == 'normal': From ac174e45a5781cce2df3faa097a695ba7805903a Mon Sep 17 00:00:00 2001 From: Benefit-Zebra <42458260+Benefit-Zebra@users.noreply.github.com> Date: Wed, 22 Jul 2020 11:46:00 +0530 Subject: [PATCH 4/4] Added Standard Emojis --- .../python/bastd/ui/onscreenkeyboard.py | 84 ++++++++++++------- 1 file changed, 53 insertions(+), 31 deletions(-) diff --git a/assets/src/ba_data/python/bastd/ui/onscreenkeyboard.py b/assets/src/ba_data/python/bastd/ui/onscreenkeyboard.py index 7f60ff3f..a5d0fec1 100644 --- a/assets/src/ba_data/python/bastd/ui/onscreenkeyboard.py +++ b/assets/src/ba_data/python/bastd/ui/onscreenkeyboard.py @@ -261,38 +261,60 @@ class OnScreenKeyboardWindow(ba.Window): elif self._mode in ['emoji', 'emoji2']: chars = [ - '🙂', '😄', '😆', '😅', '😂', '☺', '😀', '😉', '😇', '😍', '😘', '😎', - '😏', '😛', '😜', '😝', '😐', '😑', '😢', '😵', '😬', '😌', '😔', '😡', - '😴', '😷' - ] + '💣', + '💥', + '🙂', + '😄', + '😆', + '😅', + '😂', + '☺', + '😀', + '😉', + '😇', + '😎', + '😰', + '😠', + '😈', + '😨', + '😛', + '😜', + '😝', + '😐', + '😑', + '😵', + '😬', + '😡', + '😌', + '😍'] if self._mode == 'emoji2': chars = [ - charstr(SpCh.LOGO_FLAT), - charstr(SpCh.UP_ARROW), - charstr(SpCh.DOWN_ARROW), - charstr(SpCh.LEFT_ARROW), - charstr(SpCh.RIGHT_ARROW), - charstr(SpCh.DELETE), - charstr(SpCh.BACK), - charstr(SpCh.TICKET), - charstr(SpCh.PARTY_ICON), - charstr(SpCh.LOCAL_ACCOUNT), - charstr(SpCh.FEDORA), - charstr(SpCh.HAL), - charstr(SpCh.CROWN), - charstr(SpCh.YIN_YANG), - charstr(SpCh.EYE_BALL), - charstr(SpCh.SKULL), - charstr(SpCh.HEART), - charstr(SpCh.DRAGON), - charstr(SpCh.HELMET), - charstr(SpCh.MUSHROOM), - charstr(SpCh.NINJA_STAR), - charstr(SpCh.VIKING_HELMET), - charstr(SpCh.MOON), - charstr(SpCh.SPIDER), - charstr(SpCh.FIREBALL), - charstr(SpCh.MIKIROG)] + '😔', + '😥', + '😭', + '😖', + '😓', + '😉', + '😴', + '😷', + '👋', + '💯', + '🙏', + '💪', + '👀', + '💬', + '💀', + '☠', + '💩', + '👻', + '👽', + '👾', + '❤', + '💛', + '💚', + '💙', + '💜', + '💔'] ba.buttonwidget(edit=self._shift_button, color=self._key_color_lit if self._mode == 'emoji2' else self._key_color_dark, @@ -368,7 +390,7 @@ class OnScreenKeyboardWindow(ba.Window): ba.textwidget(edit=self._text_field, text=txt) # if we were caps, # go back only if not Shift is pressed twice - if self._mode == 'caps' and self._double_press_shift != True: + if self._mode == 'caps' and not self._double_press_shift: self._mode = 'normal' self._refresh()