def _on_max_public_party_size_minus_press(self) -> None: val = _ba.get_public_party_max_size() val -= 1 if val < 1: val = 1 _ba.set_public_party_max_size(val) ba.textwidget(edit=self._host_max_party_size_value, text=str(val))
def _build_host_tab(self, region_width: float, region_height: float) -> None: c_width = region_width c_height = region_height - 20 v = c_height - 35 v -= 25 is_public_enabled = _ba.get_public_party_enabled() v -= 30 party_name_text = ba.Lstr( resource='gatherWindow.partyNameText', fallback_resource='editGameListWindow.nameText') ba.textwidget(parent=self._container, size=(0, 0), h_align='right', v_align='center', maxwidth=200, scale=0.8, color=ba.app.ui.infotextcolor, position=(210, v - 9), text=party_name_text) self._host_name_text = ba.textwidget(parent=self._container, editable=True, size=(535, 40), position=(230, v - 30), text=ba.app.config.get( 'Public Party Name', ''), maxwidth=494, shadow=0.3, flatness=1.0, description=party_name_text, autoselect=True, v_align='center', corner_scale=1.0) v -= 60 ba.textwidget(parent=self._container, size=(0, 0), h_align='right', v_align='center', maxwidth=200, scale=0.8, color=ba.app.ui.infotextcolor, position=(210, v - 9), text=ba.Lstr(resource='maxPartySizeText', fallback_resource='maxConnectionsText')) self._host_max_party_size_value = ba.textwidget( parent=self._container, size=(0, 0), h_align='center', v_align='center', scale=1.2, color=(1, 1, 1), position=(240, v - 9), text=str(_ba.get_public_party_max_size())) btn1 = self._host_max_party_size_minus_button = (ba.buttonwidget( parent=self._container, size=(40, 40), on_activate_call=ba.WeakCall( self._on_max_public_party_size_minus_press), position=(280, v - 26), label='-', autoselect=True)) btn2 = self._host_max_party_size_plus_button = (ba.buttonwidget( parent=self._container, size=(40, 40), on_activate_call=ba.WeakCall( self._on_max_public_party_size_plus_press), position=(350, v - 26), label='+', autoselect=True)) v -= 50 v -= 70 if is_public_enabled: label = ba.Lstr( resource='gatherWindow.makePartyPrivateText', fallback_resource='gatherWindow.stopAdvertisingText') else: label = ba.Lstr( resource='gatherWindow.makePartyPublicText', fallback_resource='gatherWindow.startAdvertisingText') self._host_toggle_button = ba.buttonwidget( parent=self._container, label=label, size=(400, 80), on_activate_call=self._on_stop_advertising_press if is_public_enabled else self._on_start_advertizing_press, position=(c_width * 0.5 - 200, v), autoselect=True, up_widget=btn2) ba.widget(edit=self._host_name_text, down_widget=btn2) ba.widget(edit=btn2, up_widget=self._host_name_text) ba.widget(edit=btn1, up_widget=self._host_name_text) ba.widget(edit=self._join_text, down_widget=self._host_name_text) v -= 10 self._host_status_text = ba.textwidget( parent=self._container, text=ba.Lstr(resource='gatherWindow.' 'partyStatusNotPublicText'), size=(0, 0), scale=0.7, flatness=1.0, shadow=0.0, h_align='center', v_align='top', maxwidth=c_width, color=(0.6, 0.6, 0.6), position=(c_width * 0.5, v)) v -= 90 ba.textwidget( parent=self._container, text=ba.Lstr(resource='gatherWindow.dedicatedServerInfoText'), size=(0, 0), scale=0.7, flatness=1.0, shadow=0.0, h_align='center', v_align='center', maxwidth=c_width * 0.9, color=ba.app.ui.infotextcolor, position=(c_width * 0.5, v)) # If public sharing is already on, # launch a status-check immediately. if _ba.get_public_party_enabled(): self._do_status_check()
def _on_max_public_party_size_minus_press(self) -> None: val = max(1, _ba.get_public_party_max_size() - 1) _ba.set_public_party_max_size(val) ba.textwidget(edit=self._host_max_party_size_value, text=str(val))