mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-05 23:13:46 +08:00
commit
eb9ce9fb3f
@ -35,3 +35,7 @@
|
|||||||
|
|
||||||
### Easy10781
|
### Easy10781
|
||||||
- Added feature
|
- Added feature
|
||||||
|
|
||||||
|
### Vishal332008
|
||||||
|
- Bug Fixer
|
||||||
|
- Modder
|
||||||
@ -36,9 +36,9 @@ class PopupText(ba.Actor):
|
|||||||
if len(color) == 3:
|
if len(color) == 3:
|
||||||
color = (color[0], color[1], color[2], 1.0)
|
color = (color[0], color[1], color[2], 1.0)
|
||||||
pos = (position[0] + offset[0] + random_offset *
|
pos = (position[0] + offset[0] + random_offset *
|
||||||
(0.5 - random.random()), position[1] + offset[0] +
|
(0.5 - random.random()), position[1] + offset[1] +
|
||||||
random_offset * (0.5 - random.random()), position[2] +
|
random_offset * (0.5 - random.random()), position[2] +
|
||||||
offset[0] + random_offset * (0.5 - random.random()))
|
offset[2] + random_offset * (0.5 - random.random()))
|
||||||
|
|
||||||
self.node = ba.newnode('text',
|
self.node = ba.newnode('text',
|
||||||
attrs={
|
attrs={
|
||||||
|
|||||||
@ -26,7 +26,7 @@ class ServerDialogWindow(ba.Window):
|
|||||||
txt_height = (_ba.get_string_height(txt, suppress_warning=True) *
|
txt_height = (_ba.get_string_height(txt, suppress_warning=True) *
|
||||||
txt_scale)
|
txt_scale)
|
||||||
self._width = 500
|
self._width = 500
|
||||||
self._height = 130 + min(200, txt_height)
|
self._height = 160 + min(200, txt_height)
|
||||||
uiscale = ba.app.ui.uiscale
|
uiscale = ba.app.ui.uiscale
|
||||||
super().__init__(root_widget=ba.containerwidget(
|
super().__init__(root_widget=ba.containerwidget(
|
||||||
size=(self._width, self._height),
|
size=(self._width, self._height),
|
||||||
@ -48,7 +48,9 @@ class ServerDialogWindow(ba.Window):
|
|||||||
maxwidth=self._width * 0.85,
|
maxwidth=self._width * 0.85,
|
||||||
max_height=(self._height - 110))
|
max_height=(self._height - 110))
|
||||||
show_cancel = data.get('showCancel', True)
|
show_cancel = data.get('showCancel', True)
|
||||||
|
self.copy_text = data.get('copyText', None)
|
||||||
self._cancel_button: ba.Widget | None
|
self._cancel_button: ba.Widget | None
|
||||||
|
self._copy_button: ba.Widget | None
|
||||||
if show_cancel:
|
if show_cancel:
|
||||||
self._cancel_button = ba.buttonwidget(
|
self._cancel_button = ba.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
@ -57,11 +59,22 @@ class ServerDialogWindow(ba.Window):
|
|||||||
autoselect=True,
|
autoselect=True,
|
||||||
label=ba.Lstr(resource='cancelText'),
|
label=ba.Lstr(resource='cancelText'),
|
||||||
on_activate_call=self._cancel_press)
|
on_activate_call=self._cancel_press)
|
||||||
|
elif self.copy_text is not None:
|
||||||
|
self._cancel_button = None
|
||||||
|
self._copy_button = ba.buttonwidget(
|
||||||
|
parent=self._root_widget,
|
||||||
|
position=(30, 30),
|
||||||
|
size=(160, 60),
|
||||||
|
autoselect=True,
|
||||||
|
label=ba.Lstr(resource='copyText'),
|
||||||
|
on_activate_call=self._copy_press)
|
||||||
else:
|
else:
|
||||||
self._cancel_button = None
|
self._cancel_button = None
|
||||||
|
self._copy_button = None
|
||||||
self._ok_button = ba.buttonwidget(
|
self._ok_button = ba.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=((self._width - 182) if show_cancel else
|
position=((self._width - 182) if show_cancel else
|
||||||
|
(self._width - 182) if self.copy_text is not None else
|
||||||
(self._width * 0.5 - 80), 30),
|
(self._width * 0.5 - 80), 30),
|
||||||
size=(160, 60),
|
size=(160, 60),
|
||||||
autoselect=True,
|
autoselect=True,
|
||||||
@ -72,6 +85,10 @@ class ServerDialogWindow(ba.Window):
|
|||||||
start_button=self._ok_button,
|
start_button=self._ok_button,
|
||||||
selected_child=self._ok_button)
|
selected_child=self._ok_button)
|
||||||
|
|
||||||
|
def _copy_press(self) -> None:
|
||||||
|
ba.clipboard_set_text(self.copy_text)
|
||||||
|
ba.screenmessage('Copied To Clipboard', color = (0, 1, 0))
|
||||||
|
|
||||||
def _ok_press(self) -> None:
|
def _ok_press(self) -> None:
|
||||||
if ba.time(ba.TimeType.REAL,
|
if ba.time(ba.TimeType.REAL,
|
||||||
ba.TimeFormat.MILLISECONDS) - self._starttime < 1000:
|
ba.TimeFormat.MILLISECONDS) - self._starttime < 1000:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user