def _email(self) -> None: import urllib.parse # If somehow we got signed out. if _ba.get_account_state() != 'signed_in': ba.screenmessage(ba.Lstr(resource='notSignedInText'), color=(1, 0, 0)) ba.playsound(ba.getsound('error')) return ba.set_analytics_screen('Email Friend Code') subject = (ba.Lstr(resource='gatherWindow.friendHasSentPromoCodeText'). evaluate().replace( '${NAME}', _ba.get_account_name()).replace( '${APP_NAME}', ba.Lstr(resource='titleText').evaluate()).replace( '${COUNT}', str(self._data['tickets']))) body = (ba.Lstr(resource='gatherWindow.youHaveBeenSentAPromoCodeText'). evaluate().replace('${APP_NAME}', ba.Lstr(resource='titleText').evaluate()) + '\n\n' + str(self._data['code']) + '\n\n') body += ( (ba.Lstr(resource='gatherWindow.friendPromoCodeRedeemShortText'). evaluate().replace('${COUNT}', str(self._data['tickets']))) + '\n\n' + ba.Lstr(resource='gatherWindow.friendPromoCodeInstructionsText'). evaluate().replace('${APP_NAME}', ba.Lstr(resource='titleText').evaluate()) + '\n' + ba.Lstr(resource='gatherWindow.friendPromoCodeExpireText'). evaluate().replace('${EXPIRE_HOURS}', str( self._data['expireHours'])) + '\n' + ba.Lstr(resource='enjoyText').evaluate()) ba.open_url('mailto:?subject=' + urllib.parse.quote(subject) + '&body=' + urllib.parse.quote(body))
def do_rating() -> None: if platform == 'android': if subplatform == 'google': url = 'market://details?id=net.froemling.ballisticacore' else: url = 'market://details?id=net.froemling.ballisticacorecb' else: url = 'macappstore://itunes.apple.com/app/id416482767?ls=1&mt=12' ba.open_url(url) ba.containerwidget(edit=dlg, transition='out_left')
def _on_cheating_press(self) -> None: from urllib import parse _ba.add_transaction({ 'type': 'REPORT_ACCOUNT', 'reason': 'cheating', 'account': self._account_id }) body = ba.Lstr(resource='reportPlayerExplanationText').evaluate() ba.open_url('mailto:[email protected]' f'?subject={_ba.appnameupper()} Player Report: ' + self._account_id + '&body=' + parse.quote(body)) self.close()
def do_rating() -> None: import _ba if platform == 'android': appname = _ba.appname() if subplatform == 'google': url = f'market://details?id=net.froemling.{appname}' else: url = 'market://details?id=net.froemling.{appname}cb' else: url = 'macappstore://itunes.apple.com/app/id416482767?ls=1&mt=12' ba.open_url(url) ba.containerwidget(edit=dlg, transition='out_left')
def _on_more_press(self) -> None: our_login_id = _ba.get_public_login_id() # our_login_id = _bs.get_account_misc_read_val_2( # 'resolvedAccountID', None) if not self._can_do_more_button or our_login_id is None: ba.playsound(ba.getsound('error')) ba.screenmessage(ba.Lstr(resource='unavailableText'), color=(1, 0, 0)) return if self._season is None: season_str = '' else: season_str = ( '&season=' + ('all_time' if self._season == 'a' else self._season)) if self._league_url_arg != '': league_str = '&league=' + self._league_url_arg else: league_str = '' ba.open_url(_ba.get_master_server_address() + '/highscores?list=powerRankings&v=2' + league_str + season_str + '&player=' + our_login_id)
def _on_more_press(self) -> None: ba.open_url(_ba.get_master_server_address() + '/highscores?profile=' + self._account_id)
def __init__(self, origin_widget: ba.Widget): from ba.internal import is_browser_likely_available logincode = '1412345' address = ( f'{_ba.get_master_server_address(version=2)}?login={logincode}') self._width = 600 self._height = 500 uiscale = ba.app.ui.uiscale super().__init__(root_widget=ba.containerwidget( size=(self._width, self._height), transition='in_scale', scale_origin_stack_offset=origin_widget.get_screen_space_center(), scale=(1.25 if uiscale is ba.UIScale.SMALL else 1.0 if uiscale is ba.UIScale.MEDIUM else 0.85))) ba.textwidget( parent=self._root_widget, position=(self._width * 0.5, self._height - 85), size=(0, 0), text=ba.Lstr( resource='accountSettingsWindow.v2LinkInstructionsText'), color=ba.app.ui.title_color, maxwidth=self._width * 0.9, h_align='center', v_align='center') button_width = 450 if is_browser_likely_available(): ba.buttonwidget(parent=self._root_widget, position=((self._width * 0.5 - button_width * 0.5), self._height - 175), autoselect=True, size=(button_width, 60), label=ba.Lstr(value=address), color=(0.55, 0.5, 0.6), textcolor=(0.75, 0.7, 0.8), on_activate_call=lambda: ba.open_url(address)) qroffs = 0.0 else: ba.textwidget(parent=self._root_widget, position=(self._width * 0.5, self._height - 135), size=(0, 0), text=ba.Lstr(value=address), flatness=1.0, maxwidth=self._width, scale=0.75, h_align='center', v_align='center') qroffs = 20.0 self._cancel_button = ba.buttonwidget( parent=self._root_widget, position=(30, self._height - 55), size=(130, 50), scale=0.8, label=ba.Lstr(resource='cancelText'), # color=(0.6, 0.5, 0.6), on_activate_call=self._done, autoselect=True, textcolor=(0.75, 0.7, 0.8), # icon=ba.gettexture('crossOut'), # iconscale=1.2 ) ba.containerwidget(edit=self._root_widget, cancel_button=self._cancel_button) qr_size = 270 ba.imagewidget(parent=self._root_widget, position=(self._width * 0.5 - qr_size * 0.5, self._height * 0.34 + qroffs - qr_size * 0.5), size=(qr_size, qr_size), texture=_ba.get_qrcode_texture(address))