Mod 0.5.1: F8 entfernt, automatisch neu verbinden; Releases ueber Gitea
Verbunden wird nur beim Start ueber die Lobby, bricht die Verbindung ab alle 10 s neu (nicht nach Ablehnung oder Konto-Problem). release.ps1 legt jetzt Gitea-Releases mit bso-release.json an. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+12
-9
@@ -10,7 +10,7 @@ using BSO.Net;
|
||||
namespace BSO
|
||||
{
|
||||
/// <summary>
|
||||
/// Verbindung zum BSO-Server (wie MSCO per IP): F8 verbindet/trennt, Server und Name stehen in BSO.json. Laeuft im
|
||||
/// Verbindung zum BSO-Server: automatisch beim Start ueber die Lobby (bricht sie ab, alle 10 s neu), Server und Name stehen in BSO.json. Laeuft im
|
||||
/// Hauptthread: Verbindungsaufbau wird nur abgefragt (nicht blockierend), empfangen wird ueber Connection.Poll().
|
||||
/// Schickt den eigenen Zustand 10x pro Sekunde, alle 2 s einen Ping.
|
||||
/// </summary>
|
||||
@@ -82,19 +82,20 @@ namespace BSO
|
||||
static Task connectTask;
|
||||
static Connection conn;
|
||||
static readonly Stopwatch connectClock = new(), sendClock = new(), pingClock = new();
|
||||
static bool autoConnectDone;
|
||||
static readonly Stopwatch retryClock = new();
|
||||
static bool autoConnectDone, rejected;
|
||||
const int RetryMs = 10000;
|
||||
|
||||
public static void Update()
|
||||
{
|
||||
if (!autoConnectDone && LocalPlayer.InScene)
|
||||
// Verbunden wird nur automatisch (Start ueber die Lobby im Launcher). Bricht die Verbindung ab, alle 10 s neu -
|
||||
// ausser der Server hat abgelehnt oder das Konto passt nicht (dann hilft nur neu SPIELEN im Launcher).
|
||||
if (Config.Current.AutoConnect && LocalPlayer.InScene && Status == NetStatus.Offline && !rejected
|
||||
&& (!autoConnectDone || retryClock.ElapsedMilliseconds >= RetryMs))
|
||||
{
|
||||
autoConnectDone = true;
|
||||
if (Config.Current.AutoConnect) Connect();
|
||||
}
|
||||
if (Input.Pressed(Input.F8))
|
||||
{
|
||||
if (Status == NetStatus.Offline) Connect();
|
||||
else Disconnect("Getrennt mit F8");
|
||||
retryClock.Restart();
|
||||
if (AccountProblem == null) Connect();
|
||||
}
|
||||
|
||||
if (Status == NetStatus.Connecting) PollConnect();
|
||||
@@ -234,6 +235,7 @@ namespace BSO
|
||||
break;
|
||||
|
||||
case MsgType.Reject:
|
||||
rejected = true; // kein automatisches Neu-Verbinden
|
||||
Disconnect("Abgelehnt: " + r.ReadString());
|
||||
break;
|
||||
|
||||
@@ -270,6 +272,7 @@ namespace BSO
|
||||
LastError = reason;
|
||||
Players.Clear();
|
||||
PingMs = -1;
|
||||
retryClock.Restart();
|
||||
Bootstrap.Log("Getrennt: " + reason);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user