bauiv1lib.helpui

Provides help related ui.

  1# Released under the MIT License. See LICENSE for details.
  2#
  3"""Provides help related ui."""
  4
  5from __future__ import annotations
  6
  7import bauiv1 as bui
  8
  9
 10class HelpWindow(bui.Window):
 11    """A window providing help on how to play."""
 12
 13    def __init__(
 14        self, main_menu: bool = False, origin_widget: bui.Widget | None = None
 15    ):
 16        # pylint: disable=too-many-statements
 17        # pylint: disable=too-many-locals
 18
 19        bui.set_analytics_screen('Help Window')
 20
 21        # If they provided an origin-widget, scale up from that.
 22        scale_origin: tuple[float, float] | None
 23        if origin_widget is not None:
 24            self._transition_out = 'out_scale'
 25            scale_origin = origin_widget.get_screen_space_center()
 26            transition = 'in_scale'
 27        else:
 28            self._transition_out = 'out_right'
 29            scale_origin = None
 30            transition = 'in_right'
 31
 32        self._r = 'helpWindow'
 33
 34        getres = bui.app.lang.get_resource
 35
 36        self._main_menu = main_menu
 37        assert bui.app.classic is not None
 38        uiscale = bui.app.ui_v1.uiscale
 39        width = 950 if uiscale is bui.UIScale.SMALL else 750
 40        x_offs = 100 if uiscale is bui.UIScale.SMALL else 0
 41        height = (
 42            460
 43            if uiscale is bui.UIScale.SMALL
 44            else 530
 45            if uiscale is bui.UIScale.MEDIUM
 46            else 600
 47        )
 48
 49        super().__init__(
 50            root_widget=bui.containerwidget(
 51                size=(width, height),
 52                transition=transition,
 53                toolbar_visibility='menu_minimal',
 54                scale_origin_stack_offset=scale_origin,
 55                scale=(
 56                    1.77
 57                    if uiscale is bui.UIScale.SMALL
 58                    else 1.25
 59                    if uiscale is bui.UIScale.MEDIUM
 60                    else 1.0
 61                ),
 62                stack_offset=(0, -30)
 63                if uiscale is bui.UIScale.SMALL
 64                else (0, 15)
 65                if uiscale is bui.UIScale.MEDIUM
 66                else (0, 0),
 67            )
 68        )
 69
 70        bui.textwidget(
 71            parent=self._root_widget,
 72            position=(0, height - (50 if uiscale is bui.UIScale.SMALL else 45)),
 73            size=(width, 25),
 74            text=bui.Lstr(
 75                resource=self._r + '.titleText',
 76                subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
 77            ),
 78            color=bui.app.ui_v1.title_color,
 79            h_align='center',
 80            v_align='top',
 81        )
 82
 83        self._scrollwidget = bui.scrollwidget(
 84            parent=self._root_widget,
 85            position=(44 + x_offs, 55 if uiscale is bui.UIScale.SMALL else 55),
 86            simple_culling_v=100.0,
 87            size=(
 88                width - (88 + 2 * x_offs),
 89                height - 120 + (5 if uiscale is bui.UIScale.SMALL else 0),
 90            ),
 91            capture_arrows=True,
 92        )
 93
 94        if bui.app.ui_v1.use_toolbars:
 95            bui.widget(
 96                edit=self._scrollwidget,
 97                right_widget=bui.get_special_widget('party_button'),
 98            )
 99        bui.containerwidget(
100            edit=self._root_widget, selected_child=self._scrollwidget
101        )
102
103        # ugly: create this last so it gets first dibs at touch events (since
104        # we have it close to the scroll widget)
105        if uiscale is bui.UIScale.SMALL and bui.app.ui_v1.use_toolbars:
106            bui.containerwidget(
107                edit=self._root_widget, on_cancel_call=self._close
108            )
109            bui.widget(
110                edit=self._scrollwidget,
111                left_widget=bui.get_special_widget('back_button'),
112            )
113        else:
114            btn = bui.buttonwidget(
115                parent=self._root_widget,
116                position=(
117                    x_offs + (40 + 0 if uiscale is bui.UIScale.SMALL else 70),
118                    height - (59 if uiscale is bui.UIScale.SMALL else 50),
119                ),
120                size=(140, 60),
121                scale=0.7 if uiscale is bui.UIScale.SMALL else 0.8,
122                label=bui.Lstr(resource='backText')
123                if self._main_menu
124                else 'Close',
125                button_type='back' if self._main_menu else None,
126                extra_touch_border_scale=2.0,
127                autoselect=True,
128                on_activate_call=self._close,
129            )
130            bui.containerwidget(edit=self._root_widget, cancel_button=btn)
131
132            if self._main_menu:
133                bui.buttonwidget(
134                    edit=btn,
135                    button_type='backSmall',
136                    size=(60, 55),
137                    label=bui.charstr(bui.SpecialChar.BACK),
138                )
139
140        self._sub_width = 660
141        self._sub_height = (
142            1590
143            + bui.app.lang.get_resource(self._r + '.someDaysExtraSpace')
144            + bui.app.lang.get_resource(
145                self._r + '.orPunchingSomethingExtraSpace'
146            )
147        )
148
149        self._subcontainer = bui.containerwidget(
150            parent=self._scrollwidget,
151            size=(self._sub_width, self._sub_height),
152            background=False,
153            claims_left_right=False,
154            claims_tab=False,
155        )
156
157        spacing = 1.0
158        h = self._sub_width * 0.5
159        v = self._sub_height - 55
160        logo_tex = bui.gettexture('logo')
161        icon_buffer = 1.1
162        header = (0.7, 1.0, 0.7, 1.0)
163        header2 = (0.8, 0.8, 1.0, 1.0)
164        paragraph = (0.8, 0.8, 1.0, 1.0)
165
166        txt = bui.Lstr(
167            resource=self._r + '.welcomeText',
168            subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
169        ).evaluate()
170        txt_scale = 1.4
171        txt_maxwidth = 480
172        bui.textwidget(
173            parent=self._subcontainer,
174            position=(h, v),
175            size=(0, 0),
176            scale=txt_scale,
177            flatness=0.5,
178            res_scale=1.5,
179            text=txt,
180            h_align='center',
181            color=header,
182            v_align='center',
183            maxwidth=txt_maxwidth,
184        )
185        txt_width = min(
186            txt_maxwidth,
187            bui.get_string_width(txt, suppress_warning=True) * txt_scale,
188        )
189
190        icon_size = 70
191        hval2 = h - (txt_width * 0.5 + icon_size * 0.5 * icon_buffer)
192        bui.imagewidget(
193            parent=self._subcontainer,
194            size=(icon_size, icon_size),
195            position=(hval2 - 0.5 * icon_size, v - 0.45 * icon_size),
196            texture=logo_tex,
197        )
198
199        app = bui.app
200        assert app.classic is not None
201
202        v -= spacing * 50.0
203        txt = bui.Lstr(resource=self._r + '.someDaysText').evaluate()
204        bui.textwidget(
205            parent=self._subcontainer,
206            position=(h, v),
207            size=(0, 0),
208            scale=1.2,
209            maxwidth=self._sub_width * 0.9,
210            text=txt,
211            h_align='center',
212            color=paragraph,
213            v_align='center',
214            flatness=1.0,
215        )
216        v -= spacing * 25.0 + getres(self._r + '.someDaysExtraSpace')
217        txt_scale = 0.66
218        txt = bui.Lstr(resource=self._r + '.orPunchingSomethingText').evaluate()
219        bui.textwidget(
220            parent=self._subcontainer,
221            position=(h, v),
222            size=(0, 0),
223            scale=txt_scale,
224            maxwidth=self._sub_width * 0.9,
225            text=txt,
226            h_align='center',
227            color=paragraph,
228            v_align='center',
229            flatness=1.0,
230        )
231        v -= spacing * 27.0 + getres(self._r + '.orPunchingSomethingExtraSpace')
232        txt_scale = 1.0
233        txt = bui.Lstr(
234            resource=self._r + '.canHelpText',
235            subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
236        ).evaluate()
237        bui.textwidget(
238            parent=self._subcontainer,
239            position=(h, v),
240            size=(0, 0),
241            scale=txt_scale,
242            flatness=1.0,
243            text=txt,
244            h_align='center',
245            color=paragraph,
246            v_align='center',
247        )
248
249        v -= spacing * 70.0
250        txt_scale = 1.0
251        txt = bui.Lstr(resource=self._r + '.toGetTheMostText').evaluate()
252        bui.textwidget(
253            parent=self._subcontainer,
254            position=(h, v),
255            size=(0, 0),
256            scale=txt_scale,
257            maxwidth=self._sub_width * 0.9,
258            text=txt,
259            h_align='center',
260            color=header,
261            v_align='center',
262            flatness=1.0,
263        )
264
265        v -= spacing * 40.0
266        txt_scale = 0.74
267        txt = bui.Lstr(resource=self._r + '.friendsText').evaluate()
268        hval2 = h - 220
269        bui.textwidget(
270            parent=self._subcontainer,
271            position=(hval2, v),
272            size=(0, 0),
273            scale=txt_scale,
274            maxwidth=100,
275            text=txt,
276            h_align='right',
277            color=header,
278            v_align='center',
279            flatness=1.0,
280        )
281
282        txt = bui.Lstr(
283            resource=self._r + '.friendsGoodText',
284            subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
285        ).evaluate()
286        txt_scale = 0.7
287        bui.textwidget(
288            parent=self._subcontainer,
289            position=(hval2 + 10, v + 8),
290            size=(0, 0),
291            scale=txt_scale,
292            maxwidth=500,
293            text=txt,
294            h_align='left',
295            color=paragraph,
296            flatness=1.0,
297        )
298
299        app = bui.app
300
301        v -= spacing * 45.0
302        txt = (
303            bui.Lstr(resource=self._r + '.devicesText').evaluate()
304            if app.env.vr
305            else bui.Lstr(resource=self._r + '.controllersText').evaluate()
306        )
307        txt_scale = 0.74
308        hval2 = h - 220
309        bui.textwidget(
310            parent=self._subcontainer,
311            position=(hval2, v),
312            size=(0, 0),
313            scale=txt_scale,
314            maxwidth=100,
315            text=txt,
316            h_align='right',
317            v_align='center',
318            color=header,
319            flatness=1.0,
320        )
321
322        txt_scale = 0.7
323        if not app.env.vr:
324            infotxt = '.controllersInfoText'
325            txt = bui.Lstr(
326                resource=self._r + infotxt,
327                fallback_resource=self._r + '.controllersInfoText',
328                subs=[
329                    ('${APP_NAME}', bui.Lstr(resource='titleText')),
330                    ('${REMOTE_APP_NAME}', bui.get_remote_app_name()),
331                ],
332            ).evaluate()
333        else:
334            txt = bui.Lstr(
335                resource=self._r + '.devicesInfoText',
336                subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
337            ).evaluate()
338
339        bui.textwidget(
340            parent=self._subcontainer,
341            position=(hval2 + 10, v + 8),
342            size=(0, 0),
343            scale=txt_scale,
344            maxwidth=500,
345            max_height=105,
346            text=txt,
347            h_align='left',
348            color=paragraph,
349            flatness=1.0,
350        )
351
352        v -= spacing * 150.0
353
354        txt = bui.Lstr(resource=self._r + '.controlsText').evaluate()
355        txt_scale = 1.4
356        txt_maxwidth = 480
357        bui.textwidget(
358            parent=self._subcontainer,
359            position=(h, v),
360            size=(0, 0),
361            scale=txt_scale,
362            flatness=0.5,
363            text=txt,
364            h_align='center',
365            color=header,
366            v_align='center',
367            res_scale=1.5,
368            maxwidth=txt_maxwidth,
369        )
370        txt_width = min(
371            txt_maxwidth,
372            bui.get_string_width(txt, suppress_warning=True) * txt_scale,
373        )
374        icon_size = 70
375
376        hval2 = h - (txt_width * 0.5 + icon_size * 0.5 * icon_buffer)
377        bui.imagewidget(
378            parent=self._subcontainer,
379            size=(icon_size, icon_size),
380            position=(hval2 - 0.5 * icon_size, v - 0.45 * icon_size),
381            texture=logo_tex,
382        )
383
384        v -= spacing * 45.0
385
386        txt_scale = 0.7
387        txt = bui.Lstr(
388            resource=self._r + '.controlsSubtitleText',
389            subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
390        ).evaluate()
391        bui.textwidget(
392            parent=self._subcontainer,
393            position=(h, v),
394            size=(0, 0),
395            scale=txt_scale,
396            maxwidth=self._sub_width * 0.9,
397            flatness=1.0,
398            text=txt,
399            h_align='center',
400            color=paragraph,
401            v_align='center',
402        )
403        v -= spacing * 160.0
404
405        sep = 70
406        icon_size = 100
407        # icon_size_2 = 30
408        hval2 = h - sep
409        vval2 = v
410        bui.imagewidget(
411            parent=self._subcontainer,
412            size=(icon_size, icon_size),
413            position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size),
414            texture=bui.gettexture('buttonPunch'),
415            color=(1, 0.7, 0.3),
416        )
417
418        txt_scale = getres(self._r + '.punchInfoTextScale')
419        txt = bui.Lstr(resource=self._r + '.punchInfoText').evaluate()
420        bui.textwidget(
421            parent=self._subcontainer,
422            position=(h - sep - 185 + 70, v + 120),
423            size=(0, 0),
424            scale=txt_scale,
425            flatness=1.0,
426            text=txt,
427            h_align='center',
428            color=(1, 0.7, 0.3, 1.0),
429            v_align='top',
430        )
431
432        hval2 = h + sep
433        vval2 = v
434        bui.imagewidget(
435            parent=self._subcontainer,
436            size=(icon_size, icon_size),
437            position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size),
438            texture=bui.gettexture('buttonBomb'),
439            color=(1, 0.3, 0.3),
440        )
441
442        txt = bui.Lstr(resource=self._r + '.bombInfoText').evaluate()
443        txt_scale = getres(self._r + '.bombInfoTextScale')
444        bui.textwidget(
445            parent=self._subcontainer,
446            position=(h + sep + 50 + 60, v - 35),
447            size=(0, 0),
448            scale=txt_scale,
449            flatness=1.0,
450            maxwidth=270,
451            text=txt,
452            h_align='center',
453            color=(1, 0.3, 0.3, 1.0),
454            v_align='top',
455        )
456
457        hval2 = h
458        vval2 = v + sep
459        bui.imagewidget(
460            parent=self._subcontainer,
461            size=(icon_size, icon_size),
462            position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size),
463            texture=bui.gettexture('buttonPickUp'),
464            color=(0.5, 0.5, 1),
465        )
466
467        txtl = bui.Lstr(resource=self._r + '.pickUpInfoText')
468        txt_scale = getres(self._r + '.pickUpInfoTextScale')
469        bui.textwidget(
470            parent=self._subcontainer,
471            position=(h + 60 + 120, v + sep + 50),
472            size=(0, 0),
473            scale=txt_scale,
474            flatness=1.0,
475            text=txtl,
476            h_align='center',
477            color=(0.5, 0.5, 1, 1.0),
478            v_align='top',
479        )
480
481        hval2 = h
482        vval2 = v - sep
483        bui.imagewidget(
484            parent=self._subcontainer,
485            size=(icon_size, icon_size),
486            position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size),
487            texture=bui.gettexture('buttonJump'),
488            color=(0.4, 1, 0.4),
489        )
490
491        txt = bui.Lstr(resource=self._r + '.jumpInfoText').evaluate()
492        txt_scale = getres(self._r + '.jumpInfoTextScale')
493        bui.textwidget(
494            parent=self._subcontainer,
495            position=(h - 250 + 75, v - sep - 15 + 30),
496            size=(0, 0),
497            scale=txt_scale,
498            flatness=1.0,
499            text=txt,
500            h_align='center',
501            color=(0.4, 1, 0.4, 1.0),
502            v_align='top',
503        )
504
505        txt = bui.Lstr(resource=self._r + '.runInfoText').evaluate()
506        txt_scale = getres(self._r + '.runInfoTextScale')
507        bui.textwidget(
508            parent=self._subcontainer,
509            position=(h, v - sep - 100),
510            size=(0, 0),
511            scale=txt_scale,
512            maxwidth=self._sub_width * 0.93,
513            flatness=1.0,
514            text=txt,
515            h_align='center',
516            color=(0.7, 0.7, 1.0, 1.0),
517            v_align='center',
518        )
519
520        v -= spacing * 280.0
521
522        txt = bui.Lstr(resource=self._r + '.powerupsText').evaluate()
523        txt_scale = 1.4
524        txt_maxwidth = 480
525        bui.textwidget(
526            parent=self._subcontainer,
527            position=(h, v),
528            size=(0, 0),
529            scale=txt_scale,
530            flatness=0.5,
531            text=txt,
532            h_align='center',
533            color=header,
534            v_align='center',
535            maxwidth=txt_maxwidth,
536        )
537        txt_width = min(
538            txt_maxwidth,
539            bui.get_string_width(txt, suppress_warning=True) * txt_scale,
540        )
541        icon_size = 70
542        hval2 = h - (txt_width * 0.5 + icon_size * 0.5 * icon_buffer)
543        bui.imagewidget(
544            parent=self._subcontainer,
545            size=(icon_size, icon_size),
546            position=(hval2 - 0.5 * icon_size, v - 0.45 * icon_size),
547            texture=logo_tex,
548        )
549
550        v -= spacing * 50.0
551        txt_scale = getres(self._r + '.powerupsSubtitleTextScale')
552        txt = bui.Lstr(resource=self._r + '.powerupsSubtitleText').evaluate()
553        bui.textwidget(
554            parent=self._subcontainer,
555            position=(h, v),
556            size=(0, 0),
557            scale=txt_scale,
558            maxwidth=self._sub_width * 0.9,
559            text=txt,
560            h_align='center',
561            color=paragraph,
562            v_align='center',
563            flatness=1.0,
564        )
565
566        v -= spacing * 1.0
567
568        mm1 = -270
569        mm2 = -215
570        mm3 = 0
571        icon_size = 50
572        shadow_size = 80
573        shadow_offs_x = 3
574        shadow_offs_y = -4
575        t_big = 1.1
576        t_small = 0.65
577
578        shadow_tex = bui.gettexture('shadowSharp')
579
580        for tex in [
581            'powerupPunch',
582            'powerupShield',
583            'powerupBomb',
584            'powerupHealth',
585            'powerupIceBombs',
586            'powerupImpactBombs',
587            'powerupStickyBombs',
588            'powerupLandMines',
589            'powerupCurse',
590        ]:
591            name = bui.Lstr(resource=self._r + '.' + tex + 'NameText')
592            desc = bui.Lstr(resource=self._r + '.' + tex + 'DescriptionText')
593
594            v -= spacing * 60.0
595
596            bui.imagewidget(
597                parent=self._subcontainer,
598                size=(shadow_size, shadow_size),
599                position=(
600                    h + mm1 + shadow_offs_x - 0.5 * shadow_size,
601                    v + shadow_offs_y - 0.5 * shadow_size,
602                ),
603                texture=shadow_tex,
604                color=(0, 0, 0),
605                opacity=0.5,
606            )
607            bui.imagewidget(
608                parent=self._subcontainer,
609                size=(icon_size, icon_size),
610                position=(h + mm1 - 0.5 * icon_size, v - 0.5 * icon_size),
611                texture=bui.gettexture(tex),
612            )
613
614            txt_scale = t_big
615            txtl = name
616            bui.textwidget(
617                parent=self._subcontainer,
618                position=(h + mm2, v + 3),
619                size=(0, 0),
620                scale=txt_scale,
621                maxwidth=200,
622                flatness=1.0,
623                text=txtl,
624                h_align='left',
625                color=header2,
626                v_align='center',
627            )
628            txt_scale = t_small
629            txtl = desc
630            bui.textwidget(
631                parent=self._subcontainer,
632                position=(h + mm3, v),
633                size=(0, 0),
634                scale=txt_scale,
635                maxwidth=300,
636                flatness=1.0,
637                text=txtl,
638                h_align='left',
639                color=paragraph,
640                v_align='center',
641                res_scale=0.5,
642            )
643
644    def _close(self) -> None:
645        # pylint: disable=cyclic-import
646        from bauiv1lib.mainmenu import MainMenuWindow
647
648        bui.containerwidget(
649            edit=self._root_widget, transition=self._transition_out
650        )
651        if self._main_menu:
652            assert bui.app.classic is not None
653            bui.app.ui_v1.set_main_menu_window(
654                MainMenuWindow(transition='in_left').get_root_widget()
655            )
class HelpWindow(bauiv1._uitypes.Window):
 11class HelpWindow(bui.Window):
 12    """A window providing help on how to play."""
 13
 14    def __init__(
 15        self, main_menu: bool = False, origin_widget: bui.Widget | None = None
 16    ):
 17        # pylint: disable=too-many-statements
 18        # pylint: disable=too-many-locals
 19
 20        bui.set_analytics_screen('Help Window')
 21
 22        # If they provided an origin-widget, scale up from that.
 23        scale_origin: tuple[float, float] | None
 24        if origin_widget is not None:
 25            self._transition_out = 'out_scale'
 26            scale_origin = origin_widget.get_screen_space_center()
 27            transition = 'in_scale'
 28        else:
 29            self._transition_out = 'out_right'
 30            scale_origin = None
 31            transition = 'in_right'
 32
 33        self._r = 'helpWindow'
 34
 35        getres = bui.app.lang.get_resource
 36
 37        self._main_menu = main_menu
 38        assert bui.app.classic is not None
 39        uiscale = bui.app.ui_v1.uiscale
 40        width = 950 if uiscale is bui.UIScale.SMALL else 750
 41        x_offs = 100 if uiscale is bui.UIScale.SMALL else 0
 42        height = (
 43            460
 44            if uiscale is bui.UIScale.SMALL
 45            else 530
 46            if uiscale is bui.UIScale.MEDIUM
 47            else 600
 48        )
 49
 50        super().__init__(
 51            root_widget=bui.containerwidget(
 52                size=(width, height),
 53                transition=transition,
 54                toolbar_visibility='menu_minimal',
 55                scale_origin_stack_offset=scale_origin,
 56                scale=(
 57                    1.77
 58                    if uiscale is bui.UIScale.SMALL
 59                    else 1.25
 60                    if uiscale is bui.UIScale.MEDIUM
 61                    else 1.0
 62                ),
 63                stack_offset=(0, -30)
 64                if uiscale is bui.UIScale.SMALL
 65                else (0, 15)
 66                if uiscale is bui.UIScale.MEDIUM
 67                else (0, 0),
 68            )
 69        )
 70
 71        bui.textwidget(
 72            parent=self._root_widget,
 73            position=(0, height - (50 if uiscale is bui.UIScale.SMALL else 45)),
 74            size=(width, 25),
 75            text=bui.Lstr(
 76                resource=self._r + '.titleText',
 77                subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
 78            ),
 79            color=bui.app.ui_v1.title_color,
 80            h_align='center',
 81            v_align='top',
 82        )
 83
 84        self._scrollwidget = bui.scrollwidget(
 85            parent=self._root_widget,
 86            position=(44 + x_offs, 55 if uiscale is bui.UIScale.SMALL else 55),
 87            simple_culling_v=100.0,
 88            size=(
 89                width - (88 + 2 * x_offs),
 90                height - 120 + (5 if uiscale is bui.UIScale.SMALL else 0),
 91            ),
 92            capture_arrows=True,
 93        )
 94
 95        if bui.app.ui_v1.use_toolbars:
 96            bui.widget(
 97                edit=self._scrollwidget,
 98                right_widget=bui.get_special_widget('party_button'),
 99            )
100        bui.containerwidget(
101            edit=self._root_widget, selected_child=self._scrollwidget
102        )
103
104        # ugly: create this last so it gets first dibs at touch events (since
105        # we have it close to the scroll widget)
106        if uiscale is bui.UIScale.SMALL and bui.app.ui_v1.use_toolbars:
107            bui.containerwidget(
108                edit=self._root_widget, on_cancel_call=self._close
109            )
110            bui.widget(
111                edit=self._scrollwidget,
112                left_widget=bui.get_special_widget('back_button'),
113            )
114        else:
115            btn = bui.buttonwidget(
116                parent=self._root_widget,
117                position=(
118                    x_offs + (40 + 0 if uiscale is bui.UIScale.SMALL else 70),
119                    height - (59 if uiscale is bui.UIScale.SMALL else 50),
120                ),
121                size=(140, 60),
122                scale=0.7 if uiscale is bui.UIScale.SMALL else 0.8,
123                label=bui.Lstr(resource='backText')
124                if self._main_menu
125                else 'Close',
126                button_type='back' if self._main_menu else None,
127                extra_touch_border_scale=2.0,
128                autoselect=True,
129                on_activate_call=self._close,
130            )
131            bui.containerwidget(edit=self._root_widget, cancel_button=btn)
132
133            if self._main_menu:
134                bui.buttonwidget(
135                    edit=btn,
136                    button_type='backSmall',
137                    size=(60, 55),
138                    label=bui.charstr(bui.SpecialChar.BACK),
139                )
140
141        self._sub_width = 660
142        self._sub_height = (
143            1590
144            + bui.app.lang.get_resource(self._r + '.someDaysExtraSpace')
145            + bui.app.lang.get_resource(
146                self._r + '.orPunchingSomethingExtraSpace'
147            )
148        )
149
150        self._subcontainer = bui.containerwidget(
151            parent=self._scrollwidget,
152            size=(self._sub_width, self._sub_height),
153            background=False,
154            claims_left_right=False,
155            claims_tab=False,
156        )
157
158        spacing = 1.0
159        h = self._sub_width * 0.5
160        v = self._sub_height - 55
161        logo_tex = bui.gettexture('logo')
162        icon_buffer = 1.1
163        header = (0.7, 1.0, 0.7, 1.0)
164        header2 = (0.8, 0.8, 1.0, 1.0)
165        paragraph = (0.8, 0.8, 1.0, 1.0)
166
167        txt = bui.Lstr(
168            resource=self._r + '.welcomeText',
169            subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
170        ).evaluate()
171        txt_scale = 1.4
172        txt_maxwidth = 480
173        bui.textwidget(
174            parent=self._subcontainer,
175            position=(h, v),
176            size=(0, 0),
177            scale=txt_scale,
178            flatness=0.5,
179            res_scale=1.5,
180            text=txt,
181            h_align='center',
182            color=header,
183            v_align='center',
184            maxwidth=txt_maxwidth,
185        )
186        txt_width = min(
187            txt_maxwidth,
188            bui.get_string_width(txt, suppress_warning=True) * txt_scale,
189        )
190
191        icon_size = 70
192        hval2 = h - (txt_width * 0.5 + icon_size * 0.5 * icon_buffer)
193        bui.imagewidget(
194            parent=self._subcontainer,
195            size=(icon_size, icon_size),
196            position=(hval2 - 0.5 * icon_size, v - 0.45 * icon_size),
197            texture=logo_tex,
198        )
199
200        app = bui.app
201        assert app.classic is not None
202
203        v -= spacing * 50.0
204        txt = bui.Lstr(resource=self._r + '.someDaysText').evaluate()
205        bui.textwidget(
206            parent=self._subcontainer,
207            position=(h, v),
208            size=(0, 0),
209            scale=1.2,
210            maxwidth=self._sub_width * 0.9,
211            text=txt,
212            h_align='center',
213            color=paragraph,
214            v_align='center',
215            flatness=1.0,
216        )
217        v -= spacing * 25.0 + getres(self._r + '.someDaysExtraSpace')
218        txt_scale = 0.66
219        txt = bui.Lstr(resource=self._r + '.orPunchingSomethingText').evaluate()
220        bui.textwidget(
221            parent=self._subcontainer,
222            position=(h, v),
223            size=(0, 0),
224            scale=txt_scale,
225            maxwidth=self._sub_width * 0.9,
226            text=txt,
227            h_align='center',
228            color=paragraph,
229            v_align='center',
230            flatness=1.0,
231        )
232        v -= spacing * 27.0 + getres(self._r + '.orPunchingSomethingExtraSpace')
233        txt_scale = 1.0
234        txt = bui.Lstr(
235            resource=self._r + '.canHelpText',
236            subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
237        ).evaluate()
238        bui.textwidget(
239            parent=self._subcontainer,
240            position=(h, v),
241            size=(0, 0),
242            scale=txt_scale,
243            flatness=1.0,
244            text=txt,
245            h_align='center',
246            color=paragraph,
247            v_align='center',
248        )
249
250        v -= spacing * 70.0
251        txt_scale = 1.0
252        txt = bui.Lstr(resource=self._r + '.toGetTheMostText').evaluate()
253        bui.textwidget(
254            parent=self._subcontainer,
255            position=(h, v),
256            size=(0, 0),
257            scale=txt_scale,
258            maxwidth=self._sub_width * 0.9,
259            text=txt,
260            h_align='center',
261            color=header,
262            v_align='center',
263            flatness=1.0,
264        )
265
266        v -= spacing * 40.0
267        txt_scale = 0.74
268        txt = bui.Lstr(resource=self._r + '.friendsText').evaluate()
269        hval2 = h - 220
270        bui.textwidget(
271            parent=self._subcontainer,
272            position=(hval2, v),
273            size=(0, 0),
274            scale=txt_scale,
275            maxwidth=100,
276            text=txt,
277            h_align='right',
278            color=header,
279            v_align='center',
280            flatness=1.0,
281        )
282
283        txt = bui.Lstr(
284            resource=self._r + '.friendsGoodText',
285            subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
286        ).evaluate()
287        txt_scale = 0.7
288        bui.textwidget(
289            parent=self._subcontainer,
290            position=(hval2 + 10, v + 8),
291            size=(0, 0),
292            scale=txt_scale,
293            maxwidth=500,
294            text=txt,
295            h_align='left',
296            color=paragraph,
297            flatness=1.0,
298        )
299
300        app = bui.app
301
302        v -= spacing * 45.0
303        txt = (
304            bui.Lstr(resource=self._r + '.devicesText').evaluate()
305            if app.env.vr
306            else bui.Lstr(resource=self._r + '.controllersText').evaluate()
307        )
308        txt_scale = 0.74
309        hval2 = h - 220
310        bui.textwidget(
311            parent=self._subcontainer,
312            position=(hval2, v),
313            size=(0, 0),
314            scale=txt_scale,
315            maxwidth=100,
316            text=txt,
317            h_align='right',
318            v_align='center',
319            color=header,
320            flatness=1.0,
321        )
322
323        txt_scale = 0.7
324        if not app.env.vr:
325            infotxt = '.controllersInfoText'
326            txt = bui.Lstr(
327                resource=self._r + infotxt,
328                fallback_resource=self._r + '.controllersInfoText',
329                subs=[
330                    ('${APP_NAME}', bui.Lstr(resource='titleText')),
331                    ('${REMOTE_APP_NAME}', bui.get_remote_app_name()),
332                ],
333            ).evaluate()
334        else:
335            txt = bui.Lstr(
336                resource=self._r + '.devicesInfoText',
337                subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
338            ).evaluate()
339
340        bui.textwidget(
341            parent=self._subcontainer,
342            position=(hval2 + 10, v + 8),
343            size=(0, 0),
344            scale=txt_scale,
345            maxwidth=500,
346            max_height=105,
347            text=txt,
348            h_align='left',
349            color=paragraph,
350            flatness=1.0,
351        )
352
353        v -= spacing * 150.0
354
355        txt = bui.Lstr(resource=self._r + '.controlsText').evaluate()
356        txt_scale = 1.4
357        txt_maxwidth = 480
358        bui.textwidget(
359            parent=self._subcontainer,
360            position=(h, v),
361            size=(0, 0),
362            scale=txt_scale,
363            flatness=0.5,
364            text=txt,
365            h_align='center',
366            color=header,
367            v_align='center',
368            res_scale=1.5,
369            maxwidth=txt_maxwidth,
370        )
371        txt_width = min(
372            txt_maxwidth,
373            bui.get_string_width(txt, suppress_warning=True) * txt_scale,
374        )
375        icon_size = 70
376
377        hval2 = h - (txt_width * 0.5 + icon_size * 0.5 * icon_buffer)
378        bui.imagewidget(
379            parent=self._subcontainer,
380            size=(icon_size, icon_size),
381            position=(hval2 - 0.5 * icon_size, v - 0.45 * icon_size),
382            texture=logo_tex,
383        )
384
385        v -= spacing * 45.0
386
387        txt_scale = 0.7
388        txt = bui.Lstr(
389            resource=self._r + '.controlsSubtitleText',
390            subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
391        ).evaluate()
392        bui.textwidget(
393            parent=self._subcontainer,
394            position=(h, v),
395            size=(0, 0),
396            scale=txt_scale,
397            maxwidth=self._sub_width * 0.9,
398            flatness=1.0,
399            text=txt,
400            h_align='center',
401            color=paragraph,
402            v_align='center',
403        )
404        v -= spacing * 160.0
405
406        sep = 70
407        icon_size = 100
408        # icon_size_2 = 30
409        hval2 = h - sep
410        vval2 = v
411        bui.imagewidget(
412            parent=self._subcontainer,
413            size=(icon_size, icon_size),
414            position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size),
415            texture=bui.gettexture('buttonPunch'),
416            color=(1, 0.7, 0.3),
417        )
418
419        txt_scale = getres(self._r + '.punchInfoTextScale')
420        txt = bui.Lstr(resource=self._r + '.punchInfoText').evaluate()
421        bui.textwidget(
422            parent=self._subcontainer,
423            position=(h - sep - 185 + 70, v + 120),
424            size=(0, 0),
425            scale=txt_scale,
426            flatness=1.0,
427            text=txt,
428            h_align='center',
429            color=(1, 0.7, 0.3, 1.0),
430            v_align='top',
431        )
432
433        hval2 = h + sep
434        vval2 = v
435        bui.imagewidget(
436            parent=self._subcontainer,
437            size=(icon_size, icon_size),
438            position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size),
439            texture=bui.gettexture('buttonBomb'),
440            color=(1, 0.3, 0.3),
441        )
442
443        txt = bui.Lstr(resource=self._r + '.bombInfoText').evaluate()
444        txt_scale = getres(self._r + '.bombInfoTextScale')
445        bui.textwidget(
446            parent=self._subcontainer,
447            position=(h + sep + 50 + 60, v - 35),
448            size=(0, 0),
449            scale=txt_scale,
450            flatness=1.0,
451            maxwidth=270,
452            text=txt,
453            h_align='center',
454            color=(1, 0.3, 0.3, 1.0),
455            v_align='top',
456        )
457
458        hval2 = h
459        vval2 = v + sep
460        bui.imagewidget(
461            parent=self._subcontainer,
462            size=(icon_size, icon_size),
463            position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size),
464            texture=bui.gettexture('buttonPickUp'),
465            color=(0.5, 0.5, 1),
466        )
467
468        txtl = bui.Lstr(resource=self._r + '.pickUpInfoText')
469        txt_scale = getres(self._r + '.pickUpInfoTextScale')
470        bui.textwidget(
471            parent=self._subcontainer,
472            position=(h + 60 + 120, v + sep + 50),
473            size=(0, 0),
474            scale=txt_scale,
475            flatness=1.0,
476            text=txtl,
477            h_align='center',
478            color=(0.5, 0.5, 1, 1.0),
479            v_align='top',
480        )
481
482        hval2 = h
483        vval2 = v - sep
484        bui.imagewidget(
485            parent=self._subcontainer,
486            size=(icon_size, icon_size),
487            position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size),
488            texture=bui.gettexture('buttonJump'),
489            color=(0.4, 1, 0.4),
490        )
491
492        txt = bui.Lstr(resource=self._r + '.jumpInfoText').evaluate()
493        txt_scale = getres(self._r + '.jumpInfoTextScale')
494        bui.textwidget(
495            parent=self._subcontainer,
496            position=(h - 250 + 75, v - sep - 15 + 30),
497            size=(0, 0),
498            scale=txt_scale,
499            flatness=1.0,
500            text=txt,
501            h_align='center',
502            color=(0.4, 1, 0.4, 1.0),
503            v_align='top',
504        )
505
506        txt = bui.Lstr(resource=self._r + '.runInfoText').evaluate()
507        txt_scale = getres(self._r + '.runInfoTextScale')
508        bui.textwidget(
509            parent=self._subcontainer,
510            position=(h, v - sep - 100),
511            size=(0, 0),
512            scale=txt_scale,
513            maxwidth=self._sub_width * 0.93,
514            flatness=1.0,
515            text=txt,
516            h_align='center',
517            color=(0.7, 0.7, 1.0, 1.0),
518            v_align='center',
519        )
520
521        v -= spacing * 280.0
522
523        txt = bui.Lstr(resource=self._r + '.powerupsText').evaluate()
524        txt_scale = 1.4
525        txt_maxwidth = 480
526        bui.textwidget(
527            parent=self._subcontainer,
528            position=(h, v),
529            size=(0, 0),
530            scale=txt_scale,
531            flatness=0.5,
532            text=txt,
533            h_align='center',
534            color=header,
535            v_align='center',
536            maxwidth=txt_maxwidth,
537        )
538        txt_width = min(
539            txt_maxwidth,
540            bui.get_string_width(txt, suppress_warning=True) * txt_scale,
541        )
542        icon_size = 70
543        hval2 = h - (txt_width * 0.5 + icon_size * 0.5 * icon_buffer)
544        bui.imagewidget(
545            parent=self._subcontainer,
546            size=(icon_size, icon_size),
547            position=(hval2 - 0.5 * icon_size, v - 0.45 * icon_size),
548            texture=logo_tex,
549        )
550
551        v -= spacing * 50.0
552        txt_scale = getres(self._r + '.powerupsSubtitleTextScale')
553        txt = bui.Lstr(resource=self._r + '.powerupsSubtitleText').evaluate()
554        bui.textwidget(
555            parent=self._subcontainer,
556            position=(h, v),
557            size=(0, 0),
558            scale=txt_scale,
559            maxwidth=self._sub_width * 0.9,
560            text=txt,
561            h_align='center',
562            color=paragraph,
563            v_align='center',
564            flatness=1.0,
565        )
566
567        v -= spacing * 1.0
568
569        mm1 = -270
570        mm2 = -215
571        mm3 = 0
572        icon_size = 50
573        shadow_size = 80
574        shadow_offs_x = 3
575        shadow_offs_y = -4
576        t_big = 1.1
577        t_small = 0.65
578
579        shadow_tex = bui.gettexture('shadowSharp')
580
581        for tex in [
582            'powerupPunch',
583            'powerupShield',
584            'powerupBomb',
585            'powerupHealth',
586            'powerupIceBombs',
587            'powerupImpactBombs',
588            'powerupStickyBombs',
589            'powerupLandMines',
590            'powerupCurse',
591        ]:
592            name = bui.Lstr(resource=self._r + '.' + tex + 'NameText')
593            desc = bui.Lstr(resource=self._r + '.' + tex + 'DescriptionText')
594
595            v -= spacing * 60.0
596
597            bui.imagewidget(
598                parent=self._subcontainer,
599                size=(shadow_size, shadow_size),
600                position=(
601                    h + mm1 + shadow_offs_x - 0.5 * shadow_size,
602                    v + shadow_offs_y - 0.5 * shadow_size,
603                ),
604                texture=shadow_tex,
605                color=(0, 0, 0),
606                opacity=0.5,
607            )
608            bui.imagewidget(
609                parent=self._subcontainer,
610                size=(icon_size, icon_size),
611                position=(h + mm1 - 0.5 * icon_size, v - 0.5 * icon_size),
612                texture=bui.gettexture(tex),
613            )
614
615            txt_scale = t_big
616            txtl = name
617            bui.textwidget(
618                parent=self._subcontainer,
619                position=(h + mm2, v + 3),
620                size=(0, 0),
621                scale=txt_scale,
622                maxwidth=200,
623                flatness=1.0,
624                text=txtl,
625                h_align='left',
626                color=header2,
627                v_align='center',
628            )
629            txt_scale = t_small
630            txtl = desc
631            bui.textwidget(
632                parent=self._subcontainer,
633                position=(h + mm3, v),
634                size=(0, 0),
635                scale=txt_scale,
636                maxwidth=300,
637                flatness=1.0,
638                text=txtl,
639                h_align='left',
640                color=paragraph,
641                v_align='center',
642                res_scale=0.5,
643            )
644
645    def _close(self) -> None:
646        # pylint: disable=cyclic-import
647        from bauiv1lib.mainmenu import MainMenuWindow
648
649        bui.containerwidget(
650            edit=self._root_widget, transition=self._transition_out
651        )
652        if self._main_menu:
653            assert bui.app.classic is not None
654            bui.app.ui_v1.set_main_menu_window(
655                MainMenuWindow(transition='in_left').get_root_widget()
656            )

A window providing help on how to play.

HelpWindow(main_menu: bool = False, origin_widget: _bauiv1.Widget | None = None)
 14    def __init__(
 15        self, main_menu: bool = False, origin_widget: bui.Widget | None = None
 16    ):
 17        # pylint: disable=too-many-statements
 18        # pylint: disable=too-many-locals
 19
 20        bui.set_analytics_screen('Help Window')
 21
 22        # If they provided an origin-widget, scale up from that.
 23        scale_origin: tuple[float, float] | None
 24        if origin_widget is not None:
 25            self._transition_out = 'out_scale'
 26            scale_origin = origin_widget.get_screen_space_center()
 27            transition = 'in_scale'
 28        else:
 29            self._transition_out = 'out_right'
 30            scale_origin = None
 31            transition = 'in_right'
 32
 33        self._r = 'helpWindow'
 34
 35        getres = bui.app.lang.get_resource
 36
 37        self._main_menu = main_menu
 38        assert bui.app.classic is not None
 39        uiscale = bui.app.ui_v1.uiscale
 40        width = 950 if uiscale is bui.UIScale.SMALL else 750
 41        x_offs = 100 if uiscale is bui.UIScale.SMALL else 0
 42        height = (
 43            460
 44            if uiscale is bui.UIScale.SMALL
 45            else 530
 46            if uiscale is bui.UIScale.MEDIUM
 47            else 600
 48        )
 49
 50        super().__init__(
 51            root_widget=bui.containerwidget(
 52                size=(width, height),
 53                transition=transition,
 54                toolbar_visibility='menu_minimal',
 55                scale_origin_stack_offset=scale_origin,
 56                scale=(
 57                    1.77
 58                    if uiscale is bui.UIScale.SMALL
 59                    else 1.25
 60                    if uiscale is bui.UIScale.MEDIUM
 61                    else 1.0
 62                ),
 63                stack_offset=(0, -30)
 64                if uiscale is bui.UIScale.SMALL
 65                else (0, 15)
 66                if uiscale is bui.UIScale.MEDIUM
 67                else (0, 0),
 68            )
 69        )
 70
 71        bui.textwidget(
 72            parent=self._root_widget,
 73            position=(0, height - (50 if uiscale is bui.UIScale.SMALL else 45)),
 74            size=(width, 25),
 75            text=bui.Lstr(
 76                resource=self._r + '.titleText',
 77                subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
 78            ),
 79            color=bui.app.ui_v1.title_color,
 80            h_align='center',
 81            v_align='top',
 82        )
 83
 84        self._scrollwidget = bui.scrollwidget(
 85            parent=self._root_widget,
 86            position=(44 + x_offs, 55 if uiscale is bui.UIScale.SMALL else 55),
 87            simple_culling_v=100.0,
 88            size=(
 89                width - (88 + 2 * x_offs),
 90                height - 120 + (5 if uiscale is bui.UIScale.SMALL else 0),
 91            ),
 92            capture_arrows=True,
 93        )
 94
 95        if bui.app.ui_v1.use_toolbars:
 96            bui.widget(
 97                edit=self._scrollwidget,
 98                right_widget=bui.get_special_widget('party_button'),
 99            )
100        bui.containerwidget(
101            edit=self._root_widget, selected_child=self._scrollwidget
102        )
103
104        # ugly: create this last so it gets first dibs at touch events (since
105        # we have it close to the scroll widget)
106        if uiscale is bui.UIScale.SMALL and bui.app.ui_v1.use_toolbars:
107            bui.containerwidget(
108                edit=self._root_widget, on_cancel_call=self._close
109            )
110            bui.widget(
111                edit=self._scrollwidget,
112                left_widget=bui.get_special_widget('back_button'),
113            )
114        else:
115            btn = bui.buttonwidget(
116                parent=self._root_widget,
117                position=(
118                    x_offs + (40 + 0 if uiscale is bui.UIScale.SMALL else 70),
119                    height - (59 if uiscale is bui.UIScale.SMALL else 50),
120                ),
121                size=(140, 60),
122                scale=0.7 if uiscale is bui.UIScale.SMALL else 0.8,
123                label=bui.Lstr(resource='backText')
124                if self._main_menu
125                else 'Close',
126                button_type='back' if self._main_menu else None,
127                extra_touch_border_scale=2.0,
128                autoselect=True,
129                on_activate_call=self._close,
130            )
131            bui.containerwidget(edit=self._root_widget, cancel_button=btn)
132
133            if self._main_menu:
134                bui.buttonwidget(
135                    edit=btn,
136                    button_type='backSmall',
137                    size=(60, 55),
138                    label=bui.charstr(bui.SpecialChar.BACK),
139                )
140
141        self._sub_width = 660
142        self._sub_height = (
143            1590
144            + bui.app.lang.get_resource(self._r + '.someDaysExtraSpace')
145            + bui.app.lang.get_resource(
146                self._r + '.orPunchingSomethingExtraSpace'
147            )
148        )
149
150        self._subcontainer = bui.containerwidget(
151            parent=self._scrollwidget,
152            size=(self._sub_width, self._sub_height),
153            background=False,
154            claims_left_right=False,
155            claims_tab=False,
156        )
157
158        spacing = 1.0
159        h = self._sub_width * 0.5
160        v = self._sub_height - 55
161        logo_tex = bui.gettexture('logo')
162        icon_buffer = 1.1
163        header = (0.7, 1.0, 0.7, 1.0)
164        header2 = (0.8, 0.8, 1.0, 1.0)
165        paragraph = (0.8, 0.8, 1.0, 1.0)
166
167        txt = bui.Lstr(
168            resource=self._r + '.welcomeText',
169            subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
170        ).evaluate()
171        txt_scale = 1.4
172        txt_maxwidth = 480
173        bui.textwidget(
174            parent=self._subcontainer,
175            position=(h, v),
176            size=(0, 0),
177            scale=txt_scale,
178            flatness=0.5,
179            res_scale=1.5,
180            text=txt,
181            h_align='center',
182            color=header,
183            v_align='center',
184            maxwidth=txt_maxwidth,
185        )
186        txt_width = min(
187            txt_maxwidth,
188            bui.get_string_width(txt, suppress_warning=True) * txt_scale,
189        )
190
191        icon_size = 70
192        hval2 = h - (txt_width * 0.5 + icon_size * 0.5 * icon_buffer)
193        bui.imagewidget(
194            parent=self._subcontainer,
195            size=(icon_size, icon_size),
196            position=(hval2 - 0.5 * icon_size, v - 0.45 * icon_size),
197            texture=logo_tex,
198        )
199
200        app = bui.app
201        assert app.classic is not None
202
203        v -= spacing * 50.0
204        txt = bui.Lstr(resource=self._r + '.someDaysText').evaluate()
205        bui.textwidget(
206            parent=self._subcontainer,
207            position=(h, v),
208            size=(0, 0),
209            scale=1.2,
210            maxwidth=self._sub_width * 0.9,
211            text=txt,
212            h_align='center',
213            color=paragraph,
214            v_align='center',
215            flatness=1.0,
216        )
217        v -= spacing * 25.0 + getres(self._r + '.someDaysExtraSpace')
218        txt_scale = 0.66
219        txt = bui.Lstr(resource=self._r + '.orPunchingSomethingText').evaluate()
220        bui.textwidget(
221            parent=self._subcontainer,
222            position=(h, v),
223            size=(0, 0),
224            scale=txt_scale,
225            maxwidth=self._sub_width * 0.9,
226            text=txt,
227            h_align='center',
228            color=paragraph,
229            v_align='center',
230            flatness=1.0,
231        )
232        v -= spacing * 27.0 + getres(self._r + '.orPunchingSomethingExtraSpace')
233        txt_scale = 1.0
234        txt = bui.Lstr(
235            resource=self._r + '.canHelpText',
236            subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
237        ).evaluate()
238        bui.textwidget(
239            parent=self._subcontainer,
240            position=(h, v),
241            size=(0, 0),
242            scale=txt_scale,
243            flatness=1.0,
244            text=txt,
245            h_align='center',
246            color=paragraph,
247            v_align='center',
248        )
249
250        v -= spacing * 70.0
251        txt_scale = 1.0
252        txt = bui.Lstr(resource=self._r + '.toGetTheMostText').evaluate()
253        bui.textwidget(
254            parent=self._subcontainer,
255            position=(h, v),
256            size=(0, 0),
257            scale=txt_scale,
258            maxwidth=self._sub_width * 0.9,
259            text=txt,
260            h_align='center',
261            color=header,
262            v_align='center',
263            flatness=1.0,
264        )
265
266        v -= spacing * 40.0
267        txt_scale = 0.74
268        txt = bui.Lstr(resource=self._r + '.friendsText').evaluate()
269        hval2 = h - 220
270        bui.textwidget(
271            parent=self._subcontainer,
272            position=(hval2, v),
273            size=(0, 0),
274            scale=txt_scale,
275            maxwidth=100,
276            text=txt,
277            h_align='right',
278            color=header,
279            v_align='center',
280            flatness=1.0,
281        )
282
283        txt = bui.Lstr(
284            resource=self._r + '.friendsGoodText',
285            subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
286        ).evaluate()
287        txt_scale = 0.7
288        bui.textwidget(
289            parent=self._subcontainer,
290            position=(hval2 + 10, v + 8),
291            size=(0, 0),
292            scale=txt_scale,
293            maxwidth=500,
294            text=txt,
295            h_align='left',
296            color=paragraph,
297            flatness=1.0,
298        )
299
300        app = bui.app
301
302        v -= spacing * 45.0
303        txt = (
304            bui.Lstr(resource=self._r + '.devicesText').evaluate()
305            if app.env.vr
306            else bui.Lstr(resource=self._r + '.controllersText').evaluate()
307        )
308        txt_scale = 0.74
309        hval2 = h - 220
310        bui.textwidget(
311            parent=self._subcontainer,
312            position=(hval2, v),
313            size=(0, 0),
314            scale=txt_scale,
315            maxwidth=100,
316            text=txt,
317            h_align='right',
318            v_align='center',
319            color=header,
320            flatness=1.0,
321        )
322
323        txt_scale = 0.7
324        if not app.env.vr:
325            infotxt = '.controllersInfoText'
326            txt = bui.Lstr(
327                resource=self._r + infotxt,
328                fallback_resource=self._r + '.controllersInfoText',
329                subs=[
330                    ('${APP_NAME}', bui.Lstr(resource='titleText')),
331                    ('${REMOTE_APP_NAME}', bui.get_remote_app_name()),
332                ],
333            ).evaluate()
334        else:
335            txt = bui.Lstr(
336                resource=self._r + '.devicesInfoText',
337                subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
338            ).evaluate()
339
340        bui.textwidget(
341            parent=self._subcontainer,
342            position=(hval2 + 10, v + 8),
343            size=(0, 0),
344            scale=txt_scale,
345            maxwidth=500,
346            max_height=105,
347            text=txt,
348            h_align='left',
349            color=paragraph,
350            flatness=1.0,
351        )
352
353        v -= spacing * 150.0
354
355        txt = bui.Lstr(resource=self._r + '.controlsText').evaluate()
356        txt_scale = 1.4
357        txt_maxwidth = 480
358        bui.textwidget(
359            parent=self._subcontainer,
360            position=(h, v),
361            size=(0, 0),
362            scale=txt_scale,
363            flatness=0.5,
364            text=txt,
365            h_align='center',
366            color=header,
367            v_align='center',
368            res_scale=1.5,
369            maxwidth=txt_maxwidth,
370        )
371        txt_width = min(
372            txt_maxwidth,
373            bui.get_string_width(txt, suppress_warning=True) * txt_scale,
374        )
375        icon_size = 70
376
377        hval2 = h - (txt_width * 0.5 + icon_size * 0.5 * icon_buffer)
378        bui.imagewidget(
379            parent=self._subcontainer,
380            size=(icon_size, icon_size),
381            position=(hval2 - 0.5 * icon_size, v - 0.45 * icon_size),
382            texture=logo_tex,
383        )
384
385        v -= spacing * 45.0
386
387        txt_scale = 0.7
388        txt = bui.Lstr(
389            resource=self._r + '.controlsSubtitleText',
390            subs=[('${APP_NAME}', bui.Lstr(resource='titleText'))],
391        ).evaluate()
392        bui.textwidget(
393            parent=self._subcontainer,
394            position=(h, v),
395            size=(0, 0),
396            scale=txt_scale,
397            maxwidth=self._sub_width * 0.9,
398            flatness=1.0,
399            text=txt,
400            h_align='center',
401            color=paragraph,
402            v_align='center',
403        )
404        v -= spacing * 160.0
405
406        sep = 70
407        icon_size = 100
408        # icon_size_2 = 30
409        hval2 = h - sep
410        vval2 = v
411        bui.imagewidget(
412            parent=self._subcontainer,
413            size=(icon_size, icon_size),
414            position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size),
415            texture=bui.gettexture('buttonPunch'),
416            color=(1, 0.7, 0.3),
417        )
418
419        txt_scale = getres(self._r + '.punchInfoTextScale')
420        txt = bui.Lstr(resource=self._r + '.punchInfoText').evaluate()
421        bui.textwidget(
422            parent=self._subcontainer,
423            position=(h - sep - 185 + 70, v + 120),
424            size=(0, 0),
425            scale=txt_scale,
426            flatness=1.0,
427            text=txt,
428            h_align='center',
429            color=(1, 0.7, 0.3, 1.0),
430            v_align='top',
431        )
432
433        hval2 = h + sep
434        vval2 = v
435        bui.imagewidget(
436            parent=self._subcontainer,
437            size=(icon_size, icon_size),
438            position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size),
439            texture=bui.gettexture('buttonBomb'),
440            color=(1, 0.3, 0.3),
441        )
442
443        txt = bui.Lstr(resource=self._r + '.bombInfoText').evaluate()
444        txt_scale = getres(self._r + '.bombInfoTextScale')
445        bui.textwidget(
446            parent=self._subcontainer,
447            position=(h + sep + 50 + 60, v - 35),
448            size=(0, 0),
449            scale=txt_scale,
450            flatness=1.0,
451            maxwidth=270,
452            text=txt,
453            h_align='center',
454            color=(1, 0.3, 0.3, 1.0),
455            v_align='top',
456        )
457
458        hval2 = h
459        vval2 = v + sep
460        bui.imagewidget(
461            parent=self._subcontainer,
462            size=(icon_size, icon_size),
463            position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size),
464            texture=bui.gettexture('buttonPickUp'),
465            color=(0.5, 0.5, 1),
466        )
467
468        txtl = bui.Lstr(resource=self._r + '.pickUpInfoText')
469        txt_scale = getres(self._r + '.pickUpInfoTextScale')
470        bui.textwidget(
471            parent=self._subcontainer,
472            position=(h + 60 + 120, v + sep + 50),
473            size=(0, 0),
474            scale=txt_scale,
475            flatness=1.0,
476            text=txtl,
477            h_align='center',
478            color=(0.5, 0.5, 1, 1.0),
479            v_align='top',
480        )
481
482        hval2 = h
483        vval2 = v - sep
484        bui.imagewidget(
485            parent=self._subcontainer,
486            size=(icon_size, icon_size),
487            position=(hval2 - 0.5 * icon_size, vval2 - 0.5 * icon_size),
488            texture=bui.gettexture('buttonJump'),
489            color=(0.4, 1, 0.4),
490        )
491
492        txt = bui.Lstr(resource=self._r + '.jumpInfoText').evaluate()
493        txt_scale = getres(self._r + '.jumpInfoTextScale')
494        bui.textwidget(
495            parent=self._subcontainer,
496            position=(h - 250 + 75, v - sep - 15 + 30),
497            size=(0, 0),
498            scale=txt_scale,
499            flatness=1.0,
500            text=txt,
501            h_align='center',
502            color=(0.4, 1, 0.4, 1.0),
503            v_align='top',
504        )
505
506        txt = bui.Lstr(resource=self._r + '.runInfoText').evaluate()
507        txt_scale = getres(self._r + '.runInfoTextScale')
508        bui.textwidget(
509            parent=self._subcontainer,
510            position=(h, v - sep - 100),
511            size=(0, 0),
512            scale=txt_scale,
513            maxwidth=self._sub_width * 0.93,
514            flatness=1.0,
515            text=txt,
516            h_align='center',
517            color=(0.7, 0.7, 1.0, 1.0),
518            v_align='center',
519        )
520
521        v -= spacing * 280.0
522
523        txt = bui.Lstr(resource=self._r + '.powerupsText').evaluate()
524        txt_scale = 1.4
525        txt_maxwidth = 480
526        bui.textwidget(
527            parent=self._subcontainer,
528            position=(h, v),
529            size=(0, 0),
530            scale=txt_scale,
531            flatness=0.5,
532            text=txt,
533            h_align='center',
534            color=header,
535            v_align='center',
536            maxwidth=txt_maxwidth,
537        )
538        txt_width = min(
539            txt_maxwidth,
540            bui.get_string_width(txt, suppress_warning=True) * txt_scale,
541        )
542        icon_size = 70
543        hval2 = h - (txt_width * 0.5 + icon_size * 0.5 * icon_buffer)
544        bui.imagewidget(
545            parent=self._subcontainer,
546            size=(icon_size, icon_size),
547            position=(hval2 - 0.5 * icon_size, v - 0.45 * icon_size),
548            texture=logo_tex,
549        )
550
551        v -= spacing * 50.0
552        txt_scale = getres(self._r + '.powerupsSubtitleTextScale')
553        txt = bui.Lstr(resource=self._r + '.powerupsSubtitleText').evaluate()
554        bui.textwidget(
555            parent=self._subcontainer,
556            position=(h, v),
557            size=(0, 0),
558            scale=txt_scale,
559            maxwidth=self._sub_width * 0.9,
560            text=txt,
561            h_align='center',
562            color=paragraph,
563            v_align='center',
564            flatness=1.0,
565        )
566
567        v -= spacing * 1.0
568
569        mm1 = -270
570        mm2 = -215
571        mm3 = 0
572        icon_size = 50
573        shadow_size = 80
574        shadow_offs_x = 3
575        shadow_offs_y = -4
576        t_big = 1.1
577        t_small = 0.65
578
579        shadow_tex = bui.gettexture('shadowSharp')
580
581        for tex in [
582            'powerupPunch',
583            'powerupShield',
584            'powerupBomb',
585            'powerupHealth',
586            'powerupIceBombs',
587            'powerupImpactBombs',
588            'powerupStickyBombs',
589            'powerupLandMines',
590            'powerupCurse',
591        ]:
592            name = bui.Lstr(resource=self._r + '.' + tex + 'NameText')
593            desc = bui.Lstr(resource=self._r + '.' + tex + 'DescriptionText')
594
595            v -= spacing * 60.0
596
597            bui.imagewidget(
598                parent=self._subcontainer,
599                size=(shadow_size, shadow_size),
600                position=(
601                    h + mm1 + shadow_offs_x - 0.5 * shadow_size,
602                    v + shadow_offs_y - 0.5 * shadow_size,
603                ),
604                texture=shadow_tex,
605                color=(0, 0, 0),
606                opacity=0.5,
607            )
608            bui.imagewidget(
609                parent=self._subcontainer,
610                size=(icon_size, icon_size),
611                position=(h + mm1 - 0.5 * icon_size, v - 0.5 * icon_size),
612                texture=bui.gettexture(tex),
613            )
614
615            txt_scale = t_big
616            txtl = name
617            bui.textwidget(
618                parent=self._subcontainer,
619                position=(h + mm2, v + 3),
620                size=(0, 0),
621                scale=txt_scale,
622                maxwidth=200,
623                flatness=1.0,
624                text=txtl,
625                h_align='left',
626                color=header2,
627                v_align='center',
628            )
629            txt_scale = t_small
630            txtl = desc
631            bui.textwidget(
632                parent=self._subcontainer,
633                position=(h + mm3, v),
634                size=(0, 0),
635                scale=txt_scale,
636                maxwidth=300,
637                flatness=1.0,
638                text=txtl,
639                h_align='left',
640                color=paragraph,
641                v_align='center',
642                res_scale=0.5,
643            )
Inherited Members
bauiv1._uitypes.Window
get_root_widget