mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-03-23 02:35:49 +08:00
Merge pull request #123 from Benefit-Zebra/master
BombSquad Exclusive Emojis
This commit is contained in:
commit
90651d00d8
@ -12,6 +12,8 @@
|
|||||||
- Default widget 'show_buffer' is now 20 instead of 0 (causes scrolling to stay slightly ahead of widget selection). This can be overridden with the ba.widget() call if anything breaks.
|
- Default widget 'show_buffer' is now 20 instead of 0 (causes scrolling to stay slightly ahead of widget selection). This can be overridden with the ba.widget() call if anything breaks.
|
||||||
- Relocated ba.app.uiscale to ba.app.ui.uiscale
|
- Relocated ba.app.uiscale to ba.app.ui.uiscale
|
||||||
- Top level settings window now properly saves/restores its state again.
|
- Top level settings window now properly saves/restores its state again.
|
||||||
|
- 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)
|
### 1.5.22 (20139)
|
||||||
- Button and key names now display correctly again on Android (and are cleaned up on other platforms too).
|
- Button and key names now display correctly again on Android (and are cleaned up on other platforms too).
|
||||||
|
|||||||
@ -26,6 +26,8 @@ from typing import TYPE_CHECKING, cast
|
|||||||
|
|
||||||
import _ba
|
import _ba
|
||||||
import ba
|
import ba
|
||||||
|
from ba import charstr
|
||||||
|
from ba import SpecialChar as SpCh
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import List, Tuple, Optional
|
from typing import List, Tuple, Optional
|
||||||
@ -86,9 +88,12 @@ class OnScreenKeyboardWindow(ba.Window):
|
|||||||
always_show_carat=True)
|
always_show_carat=True)
|
||||||
|
|
||||||
self._shift_button = None
|
self._shift_button = None
|
||||||
|
self._double_press_shift = False
|
||||||
self._num_mode_button = None
|
self._num_mode_button = None
|
||||||
|
self._emoji_button = None
|
||||||
self._char_keys: List[ba.Widget] = []
|
self._char_keys: List[ba.Widget] = []
|
||||||
self._mode = 'normal'
|
self._mode = 'normal'
|
||||||
|
self._last_mode = 'normal'
|
||||||
|
|
||||||
v = self._height - 180
|
v = self._height - 180
|
||||||
key_width = 46
|
key_width = 46
|
||||||
@ -125,7 +130,7 @@ class OnScreenKeyboardWindow(ba.Window):
|
|||||||
autoselect=True,
|
autoselect=True,
|
||||||
textcolor=key_textcolor,
|
textcolor=key_textcolor,
|
||||||
color=key_color_dark,
|
color=key_color_dark,
|
||||||
label=ba.charstr(ba.SpecialChar.SHIFT),
|
label=charstr(SpCh.SHIFT),
|
||||||
enable_sound=False,
|
enable_sound=False,
|
||||||
extra_touch_border_scale=0.3,
|
extra_touch_border_scale=0.3,
|
||||||
button_type='square',
|
button_type='square',
|
||||||
@ -157,7 +162,7 @@ class OnScreenKeyboardWindow(ba.Window):
|
|||||||
repeat=True,
|
repeat=True,
|
||||||
textcolor=key_textcolor,
|
textcolor=key_textcolor,
|
||||||
color=key_color_dark,
|
color=key_color_dark,
|
||||||
label=ba.charstr(ba.SpecialChar.DELETE),
|
label=charstr(SpCh.DELETE),
|
||||||
button_type='square',
|
button_type='square',
|
||||||
on_activate_call=self._del)
|
on_activate_call=self._del)
|
||||||
v -= (key_height + 9)
|
v -= (key_height + 9)
|
||||||
@ -176,6 +181,19 @@ class OnScreenKeyboardWindow(ba.Window):
|
|||||||
color=key_color_dark,
|
color=key_color_dark,
|
||||||
label='',
|
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=charstr(SpCh.LOGO_FLAT),
|
||||||
|
extra_touch_border_scale=0.3,
|
||||||
|
button_type='square',
|
||||||
|
)
|
||||||
btn1 = self._num_mode_button
|
btn1 = self._num_mode_button
|
||||||
btn2 = ba.buttonwidget(parent=self._root_widget,
|
btn2 = ba.buttonwidget(parent=self._root_widget,
|
||||||
position=(210, v - 12),
|
position=(210, v - 12),
|
||||||
@ -188,10 +206,12 @@ class OnScreenKeyboardWindow(ba.Window):
|
|||||||
label=ba.Lstr(resource='spaceKeyText'),
|
label=ba.Lstr(resource='spaceKeyText'),
|
||||||
on_activate_call=ba.Call(
|
on_activate_call=ba.Call(
|
||||||
self._type_char, ' '))
|
self._type_char, ' '))
|
||||||
ba.widget(edit=btn1, right_widget=btn2)
|
btn3 = self._emoji_button
|
||||||
|
ba.widget(edit=btn1, right_widget=btn2, left_widget=btn3)
|
||||||
ba.widget(edit=btn2,
|
ba.widget(edit=btn2,
|
||||||
left_widget=btn1,
|
left_widget=btn1,
|
||||||
right_widget=self._done_button)
|
right_widget=self._done_button)
|
||||||
|
ba.widget(edit=btn3, left_widget=btn1)
|
||||||
ba.widget(edit=self._done_button, left_widget=btn2)
|
ba.widget(edit=self._done_button, left_widget=btn2)
|
||||||
|
|
||||||
ba.containerwidget(edit=self._root_widget,
|
ba.containerwidget(edit=self._root_widget,
|
||||||
@ -212,11 +232,15 @@ class OnScreenKeyboardWindow(ba.Window):
|
|||||||
ba.buttonwidget(edit=self._shift_button,
|
ba.buttonwidget(edit=self._shift_button,
|
||||||
color=self._key_color_lit
|
color=self._key_color_lit
|
||||||
if self._mode == 'caps' else self._key_color_dark,
|
if self._mode == 'caps' else self._key_color_dark,
|
||||||
label=ba.charstr(ba.SpecialChar.SHIFT),
|
label=charstr(SpCh.SHIFT),
|
||||||
on_activate_call=self._shift)
|
on_activate_call=self._shift)
|
||||||
ba.buttonwidget(edit=self._num_mode_button,
|
ba.buttonwidget(edit=self._num_mode_button,
|
||||||
label='123#&*',
|
label='123#&*',
|
||||||
on_activate_call=self._num_mode)
|
on_activate_call=self._num_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 == 'num':
|
elif self._mode == 'num':
|
||||||
chars = [
|
chars = [
|
||||||
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '/',
|
'1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '/',
|
||||||
@ -230,6 +254,76 @@ class OnScreenKeyboardWindow(ba.Window):
|
|||||||
ba.buttonwidget(edit=self._num_mode_button,
|
ba.buttonwidget(edit=self._num_mode_button,
|
||||||
label='abc',
|
label='abc',
|
||||||
on_activate_call=self._abc_mode)
|
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 = [
|
||||||
|
'😔',
|
||||||
|
'😥',
|
||||||
|
'😭',
|
||||||
|
'😖',
|
||||||
|
'😓',
|
||||||
|
'😉',
|
||||||
|
'😴',
|
||||||
|
'😷',
|
||||||
|
'👋',
|
||||||
|
'💯',
|
||||||
|
'🙏',
|
||||||
|
'💪',
|
||||||
|
'👀',
|
||||||
|
'💬',
|
||||||
|
'💀',
|
||||||
|
'☠',
|
||||||
|
'💩',
|
||||||
|
'👻',
|
||||||
|
'👽',
|
||||||
|
'👾',
|
||||||
|
'❤',
|
||||||
|
'💛',
|
||||||
|
'💚',
|
||||||
|
'💙',
|
||||||
|
'💜',
|
||||||
|
'💔']
|
||||||
|
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):
|
for i, btn in enumerate(self._char_keys):
|
||||||
assert chars is not None
|
assert chars is not None
|
||||||
@ -251,12 +345,33 @@ class OnScreenKeyboardWindow(ba.Window):
|
|||||||
self._mode = 'num'
|
self._mode = 'num'
|
||||||
self._refresh()
|
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' 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:
|
def _shift(self) -> None:
|
||||||
ba.playsound(self._click_sound)
|
ba.playsound(self._click_sound)
|
||||||
if self._mode == 'normal':
|
if self._mode == 'normal':
|
||||||
self._mode = 'caps'
|
self._mode = 'caps'
|
||||||
|
self._double_press_shift = False
|
||||||
elif self._mode == 'caps':
|
elif self._mode == 'caps':
|
||||||
self._mode = 'normal'
|
if not self._double_press_shift:
|
||||||
|
self._double_press_shift = True
|
||||||
|
else:
|
||||||
|
self._mode = 'normal'
|
||||||
self._refresh()
|
self._refresh()
|
||||||
|
|
||||||
def _del(self) -> None:
|
def _del(self) -> None:
|
||||||
@ -273,8 +388,9 @@ class OnScreenKeyboardWindow(ba.Window):
|
|||||||
txt = cast(str, ba.textwidget(query=self._text_field))
|
txt = cast(str, ba.textwidget(query=self._text_field))
|
||||||
txt += char
|
txt += char
|
||||||
ba.textwidget(edit=self._text_field, text=txt)
|
ba.textwidget(edit=self._text_field, text=txt)
|
||||||
# if we were caps, go back
|
# if we were caps,
|
||||||
if self._mode == 'caps':
|
# go back only if not Shift is pressed twice
|
||||||
|
if self._mode == 'caps' and not self._double_press_shift:
|
||||||
self._mode = 'normal'
|
self._mode = 'normal'
|
||||||
self._refresh()
|
self._refresh()
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user