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