New login process + a little bit of cleanup
No reliability required :) Will get to the client soon
This commit is contained in:
@@ -28,6 +28,8 @@ namespace Barotrauma.Networking
|
||||
private NetServer server;
|
||||
private NetPeerConfiguration config;
|
||||
|
||||
private int MaxPlayers;
|
||||
|
||||
private DateTime sparseUpdateTimer;
|
||||
private DateTime refreshMasterTimer;
|
||||
|
||||
@@ -80,6 +82,7 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
|
||||
config.MaximumConnections = maxPlayers;
|
||||
MaxPlayers = maxPlayers;
|
||||
|
||||
config.DisableMessageType(NetIncomingMessageType.DebugMessage |
|
||||
NetIncomingMessageType.WarningMessage | NetIncomingMessageType.Receipt |
|
||||
@@ -444,47 +447,57 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
|
||||
sparseUpdateTimer = DateTime.Now + sparseUpdateInterval;
|
||||
}
|
||||
|
||||
public bool StartGameClicked(GUIButton button, object obj)
|
||||
}
|
||||
|
||||
private byte GetNewClientID()
|
||||
{
|
||||
Submarine selectedSub = null;
|
||||
Submarine selectedShuttle = GameMain.NetLobbyScreen.SelectedShuttle;
|
||||
|
||||
if (Voting.AllowSubVoting)
|
||||
{
|
||||
selectedSub = Voting.HighestVoted<Submarine>(VoteType.Sub, connectedClients);
|
||||
if (selectedSub == null) selectedSub = GameMain.NetLobbyScreen.SelectedSub;
|
||||
byte userID = 1;
|
||||
while (connectedClients.Any(c => c.ID == userID))
|
||||
{
|
||||
userID++;
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedSub = GameMain.NetLobbyScreen.SelectedSub;
|
||||
}
|
||||
|
||||
if (selectedSub == null)
|
||||
{
|
||||
GameMain.NetLobbyScreen.SubList.Flash();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (selectedShuttle == null)
|
||||
{
|
||||
GameMain.NetLobbyScreen.ShuttleList.Flash();
|
||||
return false;
|
||||
}
|
||||
|
||||
GameModePreset selectedMode = Voting.HighestVoted<GameModePreset>(VoteType.Mode, connectedClients);
|
||||
if (selectedMode == null) selectedMode = GameMain.NetLobbyScreen.SelectedMode;
|
||||
|
||||
if (selectedMode == null)
|
||||
{
|
||||
GameMain.NetLobbyScreen.ModeList.Flash();
|
||||
return false;
|
||||
}
|
||||
|
||||
//CoroutineManager.StartCoroutine(WaitForPlayersReady(selectedSub, selectedShuttle, selectedMode), "WaitForPlayersReady");
|
||||
|
||||
return true;
|
||||
return userID;
|
||||
}
|
||||
|
||||
public bool StartGameClicked(GUIButton button, object obj)
|
||||
{
|
||||
Submarine selectedSub = null;
|
||||
Submarine selectedShuttle = GameMain.NetLobbyScreen.SelectedShuttle;
|
||||
|
||||
if (Voting.AllowSubVoting)
|
||||
{
|
||||
selectedSub = Voting.HighestVoted<Submarine>(VoteType.Sub, connectedClients);
|
||||
if (selectedSub == null) selectedSub = GameMain.NetLobbyScreen.SelectedSub;
|
||||
}
|
||||
else
|
||||
{
|
||||
selectedSub = GameMain.NetLobbyScreen.SelectedSub;
|
||||
}
|
||||
|
||||
if (selectedSub == null)
|
||||
{
|
||||
GameMain.NetLobbyScreen.SubList.Flash();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (selectedShuttle == null)
|
||||
{
|
||||
GameMain.NetLobbyScreen.ShuttleList.Flash();
|
||||
return false;
|
||||
}
|
||||
|
||||
GameModePreset selectedMode = Voting.HighestVoted<GameModePreset>(VoteType.Mode, connectedClients);
|
||||
if (selectedMode == null) selectedMode = GameMain.NetLobbyScreen.SelectedMode;
|
||||
|
||||
if (selectedMode == null)
|
||||
{
|
||||
GameMain.NetLobbyScreen.ModeList.Flash();
|
||||
return false;
|
||||
}
|
||||
|
||||
//CoroutineManager.StartCoroutine(WaitForPlayersReady(selectedSub, selectedShuttle, selectedMode), "WaitForPlayersReady");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void EndGame()
|
||||
@@ -528,29 +541,29 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
CoroutineManager.StartCoroutine(EndCinematic());
|
||||
}
|
||||
|
||||
public IEnumerable<object> EndCinematic()
|
||||
{
|
||||
float endPreviewLength = 10.0f;
|
||||
|
||||
var cinematic = new TransitionCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, endPreviewLength);
|
||||
|
||||
float secondsLeft = endPreviewLength;
|
||||
|
||||
do
|
||||
{
|
||||
secondsLeft -= CoroutineManager.UnscaledDeltaTime;
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
} while (secondsLeft > 0.0f);
|
||||
|
||||
Submarine.Unload();
|
||||
|
||||
GameMain.NetLobbyScreen.Select();
|
||||
|
||||
yield return CoroutineStatus.Success;
|
||||
CoroutineManager.StartCoroutine(EndCinematic());
|
||||
}
|
||||
|
||||
public IEnumerable<object> EndCinematic()
|
||||
{
|
||||
float endPreviewLength = 10.0f;
|
||||
|
||||
var cinematic = new TransitionCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, endPreviewLength);
|
||||
|
||||
float secondsLeft = endPreviewLength;
|
||||
|
||||
do
|
||||
{
|
||||
secondsLeft -= CoroutineManager.UnscaledDeltaTime;
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
} while (secondsLeft > 0.0f);
|
||||
|
||||
Submarine.Unload();
|
||||
|
||||
GameMain.NetLobbyScreen.Select();
|
||||
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
private void UpdateCrewFrame()
|
||||
|
||||
Reference in New Issue
Block a user