mirror of
https://github.com/bombsquad-community/plugin-manager.git
synced 2025-11-07 17:36:00 +00:00
[ci] auto-format
This commit is contained in:
parent
723579c969
commit
7337368ad7
2 changed files with 1313 additions and 1170 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -13,7 +13,7 @@ import threading
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from typing import Any, Optional, Dict, List, Tuple,Type
|
from typing import Any, Optional, Dict, List, Tuple, Type
|
||||||
import ba
|
import ba
|
||||||
from bastd.ui.gather import GatherWindow
|
from bastd.ui.gather import GatherWindow
|
||||||
|
|
||||||
|
|
@ -22,48 +22,54 @@ from bastd.ui.confirm import ConfirmWindow
|
||||||
|
|
||||||
import bastd.ui.mainmenu as bastd_ui_mainmenu
|
import bastd.ui.mainmenu as bastd_ui_mainmenu
|
||||||
|
|
||||||
connect=_ba.connect_to_party
|
connect = _ba.connect_to_party
|
||||||
disconnect=_ba.disconnect_from_host
|
disconnect = _ba.disconnect_from_host
|
||||||
|
|
||||||
server=[]
|
server = []
|
||||||
|
|
||||||
|
|
||||||
ip_add="private"
|
ip_add = "private"
|
||||||
p_port=44444
|
p_port = 44444
|
||||||
p_name="nothing here"
|
p_name = "nothing here"
|
||||||
def newconnect_to_party(address,port=43210,print_progress=False):
|
|
||||||
|
|
||||||
|
def newconnect_to_party(address, port=43210, print_progress=False):
|
||||||
global ip_add
|
global ip_add
|
||||||
global p_port
|
global p_port
|
||||||
dd=_ba.get_connection_to_host_info()
|
dd = _ba.get_connection_to_host_info()
|
||||||
if(dd!={} ):
|
if (dd != {}):
|
||||||
_ba.disconnect_from_host()
|
_ba.disconnect_from_host()
|
||||||
|
|
||||||
ip_add=address
|
ip_add = address
|
||||||
p_port=port
|
p_port = port
|
||||||
connect(address,port,print_progress)
|
connect(address, port, print_progress)
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
ip_add = address
|
||||||
ip_add=address
|
p_port = port
|
||||||
p_port=port
|
|
||||||
# print(ip_add,p_port)
|
# print(ip_add,p_port)
|
||||||
connect(ip_add,port,print_progress)
|
connect(ip_add, port, print_progress)
|
||||||
|
|
||||||
|
|
||||||
def newdisconnect_from_host():
|
def newdisconnect_from_host():
|
||||||
try:
|
try:
|
||||||
name=_ba.get_connection_to_host_info()['name']
|
name = _ba.get_connection_to_host_info()['name']
|
||||||
global server
|
global server
|
||||||
global ip_add
|
global ip_add
|
||||||
global p_port
|
global p_port
|
||||||
pojo = {"name":name,"ip":ip_add,"port":p_port}
|
pojo = {"name": name, "ip": ip_add, "port": p_port}
|
||||||
if pojo not in server:
|
if pojo not in server:
|
||||||
server.insert(0,pojo)
|
server.insert(0, pojo)
|
||||||
server = server[:3]
|
server = server[:3]
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
disconnect()
|
disconnect()
|
||||||
|
|
||||||
|
|
||||||
def printip():
|
def printip():
|
||||||
ba.screenmessage("ip address is"+ip_add)
|
ba.screenmessage("ip address is"+ip_add)
|
||||||
|
|
||||||
|
|
||||||
def new_refresh_in_game(
|
def new_refresh_in_game(
|
||||||
self, positions: List[Tuple[float, float,
|
self, positions: List[Tuple[float, float,
|
||||||
float]]) -> Tuple[float, float, float]:
|
float]]) -> Tuple[float, float, float]:
|
||||||
|
|
@ -118,28 +124,29 @@ def new_refresh_in_game(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
draw_controller=None,
|
draw_controller=None,
|
||||||
text="IP: "+ip_add+" PORT: "+str(p_port),
|
text="IP: "+ip_add+" PORT: "+str(p_port),
|
||||||
position=(h+self._button_width-80,v+60),
|
position=(h+self._button_width-80, 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)
|
||||||
v_h=v
|
v_h = v
|
||||||
|
|
||||||
global server
|
global server
|
||||||
def con(address,port):
|
|
||||||
|
def con(address, port):
|
||||||
global ip_add
|
global ip_add
|
||||||
global p_port
|
global p_port
|
||||||
if(address==ip_add and port==p_port):
|
if (address == ip_add and port == p_port):
|
||||||
self._resume()
|
self._resume()
|
||||||
else:
|
else:
|
||||||
_ba.disconnect_from_host()
|
_ba.disconnect_from_host()
|
||||||
_ba.connect_to_party(address,port)
|
_ba.connect_to_party(address, port)
|
||||||
if len(server) ==0:
|
if len(server) == 0:
|
||||||
ba.textwidget(
|
ba.textwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
draw_controller=None,
|
draw_controller=None,
|
||||||
text="Nothing in \n recents",
|
text="Nothing in \n recents",
|
||||||
position=(h +self._button_width *scale ,v-30),
|
position=(h + self._button_width * scale, v-30),
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
size=(20, 60),
|
size=(20, 60),
|
||||||
|
|
@ -148,14 +155,14 @@ def new_refresh_in_game(
|
||||||
self._server_button = ba.buttonwidget(
|
self._server_button = ba.buttonwidget(
|
||||||
color=(0.8, 0, 1),
|
color=(0.8, 0, 1),
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(h +self._button_width *scale - 80, v_h),
|
position=(h + self._button_width * scale - 80, v_h),
|
||||||
size=(self._button_width, self._button_height),
|
size=(self._button_width, self._button_height),
|
||||||
scale=scale,
|
scale=scale,
|
||||||
autoselect=self._use_autoselect,
|
autoselect=self._use_autoselect,
|
||||||
label=ser["name"][0:22],
|
label=ser["name"][0:22],
|
||||||
|
|
||||||
on_activate_call=ba.Call(con,ser["ip"],ser["port"]))
|
on_activate_call=ba.Call(con, ser["ip"], ser["port"]))
|
||||||
v_h=v_h-50
|
v_h = v_h-50
|
||||||
|
|
||||||
# Player name if applicable.
|
# Player name if applicable.
|
||||||
if self._input_player:
|
if self._input_player:
|
||||||
|
|
@ -245,6 +252,8 @@ def new_refresh_in_game(
|
||||||
scale=0.45,
|
scale=0.45,
|
||||||
maxwidth=self._button_width * 0.9)
|
maxwidth=self._button_width * 0.9)
|
||||||
return h, v, scale
|
return h, v, scale
|
||||||
|
|
||||||
|
|
||||||
def new_refresh(self) -> None:
|
def new_refresh(self) -> None:
|
||||||
# pylint: disable=too-many-branches
|
# pylint: disable=too-many-branches
|
||||||
# pylint: disable=too-many-locals
|
# pylint: disable=too-many-locals
|
||||||
|
|
@ -284,13 +293,12 @@ def new_refresh(self) -> None:
|
||||||
input_device.is_connected_to_remote_player()
|
input_device.is_connected_to_remote_player()
|
||||||
if input_device else False)
|
if input_device else False)
|
||||||
|
|
||||||
|
|
||||||
positions: List[Tuple[float, float, float]] = []
|
positions: List[Tuple[float, float, float]] = []
|
||||||
self._p_index = 0
|
self._p_index = 0
|
||||||
|
|
||||||
if self._in_game:
|
if self._in_game:
|
||||||
h, v, scale = self._refresh_in_game(positions)
|
h, v, scale = self._refresh_in_game(positions)
|
||||||
print("refreshing in GAME",ip_add)
|
print("refreshing in GAME", ip_add)
|
||||||
# btn = ba.buttonwidget(parent=self._root_widget,
|
# btn = ba.buttonwidget(parent=self._root_widget,
|
||||||
# position=(80,270),
|
# position=(80,270),
|
||||||
# size=(100, 90),
|
# size=(100, 90),
|
||||||
|
|
@ -302,14 +310,14 @@ def new_refresh(self) -> None:
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
draw_controller=None,
|
draw_controller=None,
|
||||||
text="IP: "+ip_add+" PORT: "+str(p_port),
|
text="IP: "+ip_add+" PORT: "+str(p_port),
|
||||||
position=(150,270),
|
position=(150, 270),
|
||||||
h_align='center',
|
h_align='center',
|
||||||
v_align='center',
|
v_align='center',
|
||||||
size=(20, 60),
|
size=(20, 60),
|
||||||
scale=1)
|
scale=1)
|
||||||
self._server_button = ba.buttonwidget(
|
self._server_button = ba.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(h * 3.2 +20 - self._button_width * scale, v),
|
position=(h * 3.2 + 20 - self._button_width * scale, v),
|
||||||
size=(self._button_width, self._button_height),
|
size=(self._button_width, self._button_height),
|
||||||
scale=scale,
|
scale=scale,
|
||||||
autoselect=self._use_autoselect,
|
autoselect=self._use_autoselect,
|
||||||
|
|
@ -318,7 +326,7 @@ def new_refresh(self) -> None:
|
||||||
on_activate_call=self._settings)
|
on_activate_call=self._settings)
|
||||||
self._server_button2 = ba.buttonwidget(
|
self._server_button2 = ba.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(h * 3.2 +20 - self._button_width * scale, v-50),
|
position=(h * 3.2 + 20 - self._button_width * scale, v-50),
|
||||||
size=(self._button_width, self._button_height),
|
size=(self._button_width, self._button_height),
|
||||||
scale=scale,
|
scale=scale,
|
||||||
autoselect=self._use_autoselect,
|
autoselect=self._use_autoselect,
|
||||||
|
|
@ -327,7 +335,7 @@ def new_refresh(self) -> None:
|
||||||
on_activate_call=self._settings)
|
on_activate_call=self._settings)
|
||||||
self._server_button3 = ba.buttonwidget(
|
self._server_button3 = ba.buttonwidget(
|
||||||
parent=self._root_widget,
|
parent=self._root_widget,
|
||||||
position=(h * 3.2 +20 - self._button_width * scale, v-100),
|
position=(h * 3.2 + 20 - self._button_width * scale, v-100),
|
||||||
size=(self._button_width, self._button_height),
|
size=(self._button_width, self._button_height),
|
||||||
scale=scale,
|
scale=scale,
|
||||||
autoselect=self._use_autoselect,
|
autoselect=self._use_autoselect,
|
||||||
|
|
@ -552,10 +560,13 @@ def new_refresh(self) -> None:
|
||||||
scale=3.0 * t_scale)
|
scale=3.0 * t_scale)
|
||||||
|
|
||||||
# ba_meta export plugin
|
# ba_meta export plugin
|
||||||
|
|
||||||
|
|
||||||
class bySmoothy(ba.Plugin):
|
class bySmoothy(ba.Plugin):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
if _ba.env().get("build_number",0) >= 20577:
|
if _ba.env().get("build_number", 0) >= 20577:
|
||||||
bastd_ui_mainmenu.MainMenuWindow._refresh_in_game= new_refresh_in_game
|
bastd_ui_mainmenu.MainMenuWindow._refresh_in_game = new_refresh_in_game
|
||||||
_ba.connect_to_party=newconnect_to_party
|
_ba.connect_to_party = newconnect_to_party
|
||||||
_ba.disconnect_from_host=newdisconnect_from_host
|
_ba.disconnect_from_host = newdisconnect_from_host
|
||||||
else:print("Server Switch only works on bs 1.7 and above")
|
else:
|
||||||
|
print("Server Switch only works on bs 1.7 and above")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue