mirror of
https://github.com/seriocomedy/ShiftOS-C-.git
synced 2025-01-22 17:22:14 +00:00
More matchmaking fixes
This commit is contained in:
parent
a14470ce12
commit
902b89212c
2 changed files with 30 additions and 13 deletions
|
@ -395,7 +395,9 @@ private void btnjoinlobby_Click(object sender, EventArgs e)
|
|||
t.Tick += (o, a) =>
|
||||
{
|
||||
SetupSidePane(Online.Hacking.Matchmaker.Players[sindex]);
|
||||
if(sindex < Online.Hacking.Matchmaker.Players.Count - 1)
|
||||
if (Matchmaker.Players.Count > 1)
|
||||
{
|
||||
if (sindex < Online.Hacking.Matchmaker.Players.Count - 1)
|
||||
{
|
||||
sindex = 0;
|
||||
}
|
||||
|
@ -403,6 +405,7 @@ private void btnjoinlobby_Click(object sender, EventArgs e)
|
|||
{
|
||||
sindex += 1;
|
||||
}
|
||||
}
|
||||
};
|
||||
t.Start();
|
||||
}
|
||||
|
|
|
@ -65,9 +65,11 @@ public static void Matchmake(ServerInfo si)
|
|||
}
|
||||
};
|
||||
Package_Grabber.SendMessage(si.IPAddress, "get_matchmaking");
|
||||
int index = 0;
|
||||
MakerTimer.Tick += (o, e) =>
|
||||
{
|
||||
int index = rnd.Next(0, Players.Count - 1);
|
||||
try
|
||||
{
|
||||
if (Players[index] != API.CurrentSave.MyOnlineNetwork && Players[index].Name != null)
|
||||
{
|
||||
SelectedNetwork = Players[index];
|
||||
|
@ -76,7 +78,18 @@ public static void Matchmake(ServerInfo si)
|
|||
SelectedNetworkTransmitter = new NetTransmitter(si, SelectedNetwork);
|
||||
Package_Grabber.SendMessage(SelectedServer.IPAddress, $"leave_lobby", API.CurrentSave.MyOnlineNetwork);
|
||||
}
|
||||
else
|
||||
{
|
||||
index += 1;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
invoke(() => { API.CreateInfoboxSession("Cannot make a match.", "Network Browser had trouble making a match with another network. Error: " + ex.Message, infobox.InfoboxMode.Info); });
|
||||
}
|
||||
};
|
||||
MakerTimer.Interval = 50;
|
||||
MakerTimer.Start();
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,6 +199,7 @@ public NetTransmitter(ServerInfo si, Network enemy)
|
|||
EnemyIdent = enemy.Name + ";" + enemy.Description;
|
||||
serverInfo = si;
|
||||
var h = new HackUI(this, Matchmaker.SelectedNetworkListener);
|
||||
h.Show();
|
||||
//HackUI will handle everything else to do with our network.
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue