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

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