mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-10-08 14:54:36 +00:00
[ci] auto-format
This commit is contained in:
parent
7666f31a63
commit
ed88413c43
1 changed files with 37 additions and 27 deletions
|
|
@ -18,13 +18,15 @@ import bascenev1 as bs
|
||||||
current_server_ip = "127.0.0.1"
|
current_server_ip = "127.0.0.1"
|
||||||
current_server_port = 43210
|
current_server_port = 43210
|
||||||
servers = []
|
servers = []
|
||||||
|
|
||||||
|
|
||||||
def _refresh_in_game(func):
|
def _refresh_in_game(func):
|
||||||
def wrapper(self, *args, **kwargs):
|
def wrapper(self, *args, **kwargs):
|
||||||
returnValue = func(self, *args, **kwargs)
|
returnValue = func(self, *args, **kwargs)
|
||||||
uiscale = bui.app.ui_v1.uiscale
|
uiscale = bui.app.ui_v1.uiscale
|
||||||
bui.containerwidget(
|
bui.containerwidget(
|
||||||
edit=self._root_widget,
|
edit=self._root_widget,
|
||||||
size=(self._width*2, self._height), # double the width
|
size=(self._width*2, self._height), # double the width
|
||||||
scale=(
|
scale=(
|
||||||
2.15
|
2.15
|
||||||
if uiscale is bui.UIScale.SMALL
|
if uiscale is bui.UIScale.SMALL
|
||||||
|
|
@ -36,28 +38,28 @@ def _refresh_in_game(func):
|
||||||
h = 125
|
h = 125
|
||||||
v = self._height - 60.0
|
v = self._height - 60.0
|
||||||
bui.textwidget(
|
bui.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
draw_controller=None,
|
draw_controller=None,
|
||||||
text="IP: "+current_server_ip+" PORT: "+str(current_server_port),
|
text="IP: "+current_server_ip+" PORT: "+str(current_server_port),
|
||||||
position=(h-self._button_width/2 + 130 , v+60),
|
position=(h-self._button_width/2 + 130, v+60),
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
size=(20, 60),
|
size=(20, 60),
|
||||||
scale=0.6)
|
scale=0.6)
|
||||||
self._public_servers = bui.buttonwidget(
|
self._public_servers = bui.buttonwidget(
|
||||||
color=(0.8, 0.45, 1),
|
color=(0.8, 0.45, 1),
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(h+self._button_width-10, v+60+20),
|
position=(h+self._button_width-10, v+60+20),
|
||||||
size=(self._button_width/4, self._button_height/2),
|
size=(self._button_width/4, self._button_height/2),
|
||||||
scale=1.0,
|
scale=1.0,
|
||||||
autoselect=self._use_autoselect,
|
autoselect=self._use_autoselect,
|
||||||
label="~~~",
|
label="~~~",
|
||||||
on_activate_call=bs.Call(public_servers))
|
on_activate_call=bs.Call(public_servers))
|
||||||
for server in servers:
|
for server in servers:
|
||||||
self._server_button = bui.buttonwidget(
|
self._server_button = bui.buttonwidget(
|
||||||
color=(0.8, 0, 1),
|
color=(0.8, 0, 1),
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=( (h- self._button_width / 2 ) + self._button_width + 20, v),
|
position=((h - self._button_width / 2) + self._button_width + 20, v),
|
||||||
size=(self._button_width, self._button_height),
|
size=(self._button_width, self._button_height),
|
||||||
scale=1.0,
|
scale=1.0,
|
||||||
autoselect=self._use_autoselect,
|
autoselect=self._use_autoselect,
|
||||||
|
|
@ -69,7 +71,10 @@ def _refresh_in_game(func):
|
||||||
return returnValue
|
return returnValue
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
connect = bs.connect_to_party
|
connect = bs.connect_to_party
|
||||||
|
|
||||||
|
|
||||||
def connect_to_party(address, port=43210, print_progress=False):
|
def connect_to_party(address, port=43210, print_progress=False):
|
||||||
global current_server_ip
|
global current_server_ip
|
||||||
global current_server_port
|
global current_server_port
|
||||||
|
|
@ -80,6 +85,7 @@ def connect_to_party(address, port=43210, print_progress=False):
|
||||||
connect(address, port, print_progress)
|
connect(address, port, print_progress)
|
||||||
babase.apptimer(1, check_connect_status)
|
babase.apptimer(1, check_connect_status)
|
||||||
|
|
||||||
|
|
||||||
def check_connect_status():
|
def check_connect_status():
|
||||||
global servers
|
global servers
|
||||||
global current_server_ip
|
global current_server_ip
|
||||||
|
|
@ -88,7 +94,8 @@ def check_connect_status():
|
||||||
if (not bs.get_connection_to_host_info()['name']):
|
if (not bs.get_connection_to_host_info()['name']):
|
||||||
babase.apptimer(1, check_connect_status)
|
babase.apptimer(1, check_connect_status)
|
||||||
return
|
return
|
||||||
new_server = {"name": bs.get_connection_to_host_info()['name'], "ip": current_server_ip, "port": current_server_port}
|
new_server = {"name": bs.get_connection_to_host_info(
|
||||||
|
)['name'], "ip": current_server_ip, "port": current_server_port}
|
||||||
if new_server not in servers:
|
if new_server not in servers:
|
||||||
servers.append(new_server)
|
servers.append(new_server)
|
||||||
servers = servers[-3:]
|
servers = servers[-3:]
|
||||||
|
|
@ -96,13 +103,16 @@ def check_connect_status():
|
||||||
print("connection failed falling back to gather window")
|
print("connection failed falling back to gather window")
|
||||||
public_servers()
|
public_servers()
|
||||||
|
|
||||||
def public_servers(origin = None):
|
|
||||||
|
def public_servers(origin=None):
|
||||||
from bauiv1lib.gather import GatherWindow
|
from bauiv1lib.gather import GatherWindow
|
||||||
bui.app.ui_v1.set_main_menu_window( GatherWindow(origin_widget=origin).get_root_widget())
|
bui.app.ui_v1.set_main_menu_window(GatherWindow(origin_widget=origin).get_root_widget())
|
||||||
|
|
||||||
# ba_meta export plugin
|
# ba_meta export plugin
|
||||||
|
|
||||||
|
|
||||||
class bySmoothy(babase.Plugin):
|
class bySmoothy(babase.Plugin):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
bastd_ui_mainmenu.MainMenuWindow._refresh_in_game = _refresh_in_game(bastd_ui_mainmenu.MainMenuWindow._refresh_in_game)
|
bastd_ui_mainmenu.MainMenuWindow._refresh_in_game = _refresh_in_game(
|
||||||
|
bastd_ui_mainmenu.MainMenuWindow._refresh_in_game)
|
||||||
bs.connect_to_party = connect_to_party
|
bs.connect_to_party = connect_to_party
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue