From 44e179fdf6d12c06d0fdd0d3ef001029fcdd0742 Mon Sep 17 00:00:00 2001 From: Vishal Date: Wed, 11 Dec 2024 13:31:17 +0530 Subject: [PATCH 1/4] A Small but Fun Change --- src/assets/ba_data/python/bauiv1lib/help.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/assets/ba_data/python/bauiv1lib/help.py b/src/assets/ba_data/python/bauiv1lib/help.py index d0652d59c..613515db7 100644 --- a/src/assets/ba_data/python/bauiv1lib/help.py +++ b/src/assets/ba_data/python/bauiv1lib/help.py @@ -393,12 +393,14 @@ def __init__( # icon_size_2 = 30 hval2 = h - sep vval2 = v - bui.imagewidget( + bui.buttonwidget( parent=self._subcontainer, + label='', size=(icon_size, icon_size), position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size), texture=bui.gettexture('buttonPunch'), color=(1, 0.7, 0.3), + selectable=False, ) txt_scale = getres(f'{self._r}.punchInfoTextScale') @@ -417,12 +419,14 @@ def __init__( hval2 = h + sep vval2 = v - bui.imagewidget( + bui.buttonwidget( parent=self._subcontainer, + label='', size=(icon_size, icon_size), position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size), texture=bui.gettexture('buttonBomb'), color=(1, 0.3, 0.3), + selectable=False, ) txt = bui.Lstr(resource=f'{self._r}.bombInfoText').evaluate() @@ -442,12 +446,14 @@ def __init__( hval2 = h vval2 = v + sep - bui.imagewidget( + bui.buttonwidget( parent=self._subcontainer, + label='', size=(icon_size, icon_size), position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size), texture=bui.gettexture('buttonPickUp'), color=(0.5, 0.5, 1), + selectable=False, ) txtl = bui.Lstr(resource=f'{self._r}.pickUpInfoText') @@ -466,12 +472,14 @@ def __init__( hval2 = h vval2 = v - sep - bui.imagewidget( + bui.buttonwidget( parent=self._subcontainer, + label='', size=(icon_size, icon_size), position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size), texture=bui.gettexture('buttonJump'), color=(0.4, 1, 0.4), + selectable=False, ) txt = bui.Lstr(resource=f'{self._r}.jumpInfoText').evaluate() From 0e96a25d816ef20acff5d1b2043bdb4684aba3da Mon Sep 17 00:00:00 2001 From: Vishal Date: Wed, 15 Jan 2025 15:38:59 +0530 Subject: [PATCH 2/4] A little more interesting sounds --- src/assets/ba_data/python/bauiv1lib/help.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/assets/ba_data/python/bauiv1lib/help.py b/src/assets/ba_data/python/bauiv1lib/help.py index 613515db7..88a0830e6 100644 --- a/src/assets/ba_data/python/bauiv1lib/help.py +++ b/src/assets/ba_data/python/bauiv1lib/help.py @@ -401,6 +401,8 @@ def __init__( texture=bui.gettexture('buttonPunch'), color=(1, 0.7, 0.3), selectable=False, + enable_sound=False, + on_activate_call=bui.getsound('spazAttack01').play, ) txt_scale = getres(f'{self._r}.punchInfoTextScale') @@ -427,6 +429,8 @@ def __init__( texture=bui.gettexture('buttonBomb'), color=(1, 0.3, 0.3), selectable=False, + enable_sound=False, + on_activate_call=bui.getsound('explosion01').play, ) txt = bui.Lstr(resource=f'{self._r}.bombInfoText').evaluate() @@ -454,6 +458,8 @@ def __init__( texture=bui.gettexture('buttonPickUp'), color=(0.5, 0.5, 1), selectable=False, + enable_sound=False, + on_activate_call=bui.getsound('spazPickup01').play, ) txtl = bui.Lstr(resource=f'{self._r}.pickUpInfoText') @@ -480,6 +486,8 @@ def __init__( texture=bui.gettexture('buttonJump'), color=(0.4, 1, 0.4), selectable=False, + enable_sound=False, + on_activate_call=bui.getsound('spazJump01').play, ) txt = bui.Lstr(resource=f'{self._r}.jumpInfoText').evaluate() From 8119aa12037bbd715c594a3558ad8ba864ffb552 Mon Sep 17 00:00:00 2001 From: Vishal Date: Wed, 15 Jan 2025 21:33:23 +0530 Subject: [PATCH 3/4] Little fixing up for different sounds --- src/assets/ba_data/python/bauiv1lib/help.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/assets/ba_data/python/bauiv1lib/help.py b/src/assets/ba_data/python/bauiv1lib/help.py index 88a0830e6..fb0790743 100644 --- a/src/assets/ba_data/python/bauiv1lib/help.py +++ b/src/assets/ba_data/python/bauiv1lib/help.py @@ -8,6 +8,8 @@ import bauiv1 as bui +import random + class HelpWindow(bui.MainWindow): """A window providing help on how to play.""" @@ -402,7 +404,7 @@ def __init__( color=(1, 0.7, 0.3), selectable=False, enable_sound=False, - on_activate_call=bui.getsound('spazAttack01').play, + on_activate_call=bui.WeakCall(self._play_sound, 'spazAttack0', 4), ) txt_scale = getres(f'{self._r}.punchInfoTextScale') @@ -430,7 +432,7 @@ def __init__( color=(1, 0.3, 0.3), selectable=False, enable_sound=False, - on_activate_call=bui.getsound('explosion01').play, + on_activate_call=bui.WeakCall(self._play_sound, 'explosion0', 5), ) txt = bui.Lstr(resource=f'{self._r}.bombInfoText').evaluate() @@ -459,7 +461,7 @@ def __init__( color=(0.5, 0.5, 1), selectable=False, enable_sound=False, - on_activate_call=bui.getsound('spazPickup01').play, + on_activate_call=bui.WeakCall(self._play_sound, 'spazPickup0', 1), ) txtl = bui.Lstr(resource=f'{self._r}.pickUpInfoText') @@ -487,7 +489,7 @@ def __init__( color=(0.4, 1, 0.4), selectable=False, enable_sound=False, - on_activate_call=bui.getsound('spazJump01').play, + on_activate_call=bui.WeakCall(self._play_sound, 'spazJump0', 4), ) txt = bui.Lstr(resource=f'{self._r}.jumpInfoText').evaluate() @@ -643,6 +645,9 @@ def __init__( res_scale=0.5, ) + def _play_sound(self, text: str, num: int): + bui.getsound(text + str(random.randint(1, num))).play() + @override def get_main_window_state(self) -> bui.MainWindowState: # Support recreating our window for back/refresh purposes. From acd84b4b3da6cf9d68b6fe97fceb0f20e7d5ed54 Mon Sep 17 00:00:00 2001 From: Vishal Date: Wed, 15 Jan 2025 21:39:35 +0530 Subject: [PATCH 4/4] CI Fix --- src/assets/ba_data/python/bauiv1lib/help.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/assets/ba_data/python/bauiv1lib/help.py b/src/assets/ba_data/python/bauiv1lib/help.py index fb0790743..bdef94792 100644 --- a/src/assets/ba_data/python/bauiv1lib/help.py +++ b/src/assets/ba_data/python/bauiv1lib/help.py @@ -6,10 +6,10 @@ from typing import override -import bauiv1 as bui - import random +import bauiv1 as bui + class HelpWindow(bui.MainWindow): """A window providing help on how to play.""" @@ -645,7 +645,7 @@ def __init__( res_scale=0.5, ) - def _play_sound(self, text: str, num: int): + def _play_sound(self, text: str, num: int) -> None: bui.getsound(text + str(random.randint(1, num))).play() @override