autoupdater fixes, cursor fix, consistent directory separators + use of Path.Combine(), wire bugfixes, more loading screens
This commit is contained in:
@@ -319,47 +319,7 @@ namespace Subsurface.Networking
|
||||
case (byte)PacketTypes.StartGame:
|
||||
if (gameStarted) continue;
|
||||
|
||||
if (this.Character != null) Character.Remove();
|
||||
|
||||
int seed = inc.ReadInt32();
|
||||
|
||||
|
||||
string levelSeed = inc.ReadString();
|
||||
|
||||
string mapName = inc.ReadString();
|
||||
string mapHash = inc.ReadString();
|
||||
|
||||
GameMain.NetLobbyScreen.TrySelectMap(mapName, mapHash);
|
||||
|
||||
double durationMinutes = inc.ReadDouble();
|
||||
|
||||
TimeSpan duration = new TimeSpan(0,(int)durationMinutes,0);
|
||||
Rand.SetSyncedSeed(seed);
|
||||
//int gameModeIndex = inc.ReadInt32();
|
||||
GameMain.GameSession = new GameSession(Submarine.Loaded, "", GameMain.NetLobbyScreen.SelectedMode);
|
||||
GameMain.GameSession.StartShift(duration, levelSeed);
|
||||
|
||||
//myCharacter = ReadCharacterData(inc);
|
||||
//Character.Controlled = myCharacter;
|
||||
|
||||
List<Character> crew = new List<Character>();
|
||||
|
||||
int count = inc.ReadInt32();
|
||||
for (int n = 0; n < count; n++)
|
||||
{
|
||||
int id = inc.ReadInt32();
|
||||
Character newCharacter = ReadCharacterData(inc, id == myID);
|
||||
|
||||
crew.Add(newCharacter);
|
||||
}
|
||||
|
||||
gameStarted = true;
|
||||
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
AddChatMessage("Press TAB to chat", ChatMessageType.Server);
|
||||
|
||||
CreateCrewFrame(crew);
|
||||
GameMain.ShowLoading(StartGame(inc));
|
||||
|
||||
break;
|
||||
case (byte)PacketTypes.EndGame:
|
||||
@@ -416,6 +376,63 @@ namespace Subsurface.Networking
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerable<object> StartGame(NetIncomingMessage inc)
|
||||
{
|
||||
|
||||
if (this.Character != null) Character.Remove();
|
||||
|
||||
int seed = inc.ReadInt32();
|
||||
|
||||
string levelSeed = inc.ReadString();
|
||||
|
||||
string mapName = inc.ReadString();
|
||||
string mapHash = inc.ReadString();
|
||||
|
||||
GameMain.NetLobbyScreen.TrySelectMap(mapName, mapHash);
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
double durationMinutes = inc.ReadDouble();
|
||||
|
||||
TimeSpan duration = new TimeSpan(0, (int)durationMinutes, 0);
|
||||
Rand.SetSyncedSeed(seed);
|
||||
//int gameModeIndex = inc.ReadInt32();
|
||||
GameMain.GameSession = new GameSession(Submarine.Loaded, "", GameMain.NetLobbyScreen.SelectedMode);
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
GameMain.GameSession.StartShift(duration, levelSeed);
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
//myCharacter = ReadCharacterData(inc);
|
||||
//Character.Controlled = myCharacter;
|
||||
|
||||
List<Character> crew = new List<Character>();
|
||||
|
||||
int count = inc.ReadInt32();
|
||||
for (int n = 0; n < count; n++)
|
||||
{
|
||||
int id = inc.ReadInt32();
|
||||
Character newCharacter = ReadCharacterData(inc, id == myID);
|
||||
|
||||
crew.Add(newCharacter);
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
}
|
||||
|
||||
gameStarted = true;
|
||||
|
||||
GameMain.GameScreen.Select();
|
||||
|
||||
AddChatMessage("Press TAB to chat", ChatMessageType.Server);
|
||||
|
||||
CreateCrewFrame(crew);
|
||||
|
||||
yield return CoroutineStatus.Success;
|
||||
}
|
||||
|
||||
|
||||
public IEnumerable<object> EndGame(string endMessage)
|
||||
{
|
||||
gameStarted = false;
|
||||
|
||||
@@ -578,25 +578,33 @@ namespace Subsurface.Networking
|
||||
}
|
||||
|
||||
|
||||
public bool StartGame(GUIButton button, object obj)
|
||||
public bool StartGameClicked(GUIButton button, object obj)
|
||||
{
|
||||
Submarine selectedMap = GameMain.NetLobbyScreen.SelectedMap as Submarine;
|
||||
Submarine selectedSub = GameMain.NetLobbyScreen.SelectedMap as Submarine;
|
||||
|
||||
if (selectedMap == null)
|
||||
if (selectedSub == null)
|
||||
{
|
||||
GameMain.NetLobbyScreen.SubList.Flash();
|
||||
return false;
|
||||
}
|
||||
|
||||
AssignJobs();
|
||||
|
||||
|
||||
GameMain.ShowLoading(StartGame(selectedSub));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private IEnumerable<object> StartGame(Submarine selectedSub)
|
||||
{
|
||||
AssignJobs();
|
||||
|
||||
//selectedMap.Load();
|
||||
|
||||
int seed = DateTime.Now.Millisecond;
|
||||
Rand.SetSyncedSeed(seed);
|
||||
GameMain.GameSession = new GameSession(selectedMap, "", GameMain.NetLobbyScreen.SelectedMode);
|
||||
GameMain.GameSession = new GameSession(selectedSub, "", GameMain.NetLobbyScreen.SelectedMode);
|
||||
GameMain.GameSession.StartShift(GameMain.NetLobbyScreen.GameDuration, GameMain.NetLobbyScreen.LevelSeed);
|
||||
//EventManager.SelectEvent(Game1.netLobbyScreen.SelectedEvent);
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
List<CharacterInfo> characterInfos = new List<CharacterInfo>();
|
||||
|
||||
@@ -622,7 +630,7 @@ namespace Subsurface.Networking
|
||||
List<Character> crew = new List<Character>();
|
||||
WayPoint[] assignedWayPoints = WayPoint.SelectCrewSpawnPoints(characterInfos);
|
||||
|
||||
for (int i = 0; i < connectedClients.Count; i++ )
|
||||
for (int i = 0; i < connectedClients.Count; i++)
|
||||
{
|
||||
connectedClients[i].character = new Character(
|
||||
connectedClients[i].characterInfo, assignedWayPoints[i], true);
|
||||
@@ -633,14 +641,16 @@ namespace Subsurface.Networking
|
||||
|
||||
if (characterInfo != null)
|
||||
{
|
||||
myCharacter = new Character(characterInfo, assignedWayPoints[assignedWayPoints.Length-1]);
|
||||
myCharacter = new Character(characterInfo, assignedWayPoints[assignedWayPoints.Length - 1]);
|
||||
Character.Controlled = myCharacter;
|
||||
|
||||
myCharacter.GiveJobItems(assignedWayPoints[assignedWayPoints.Length - 1]);
|
||||
|
||||
crew.Add(myCharacter);
|
||||
}
|
||||
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
NetOutgoingMessage msg = server.CreateMessage();
|
||||
msg.Write((byte)PacketTypes.StartGame);
|
||||
|
||||
@@ -650,10 +660,10 @@ namespace Subsurface.Networking
|
||||
|
||||
msg.Write(GameMain.NetLobbyScreen.SelectedMap.Name);
|
||||
msg.Write(GameMain.NetLobbyScreen.SelectedMap.MD5Hash.Hash);
|
||||
|
||||
|
||||
msg.Write(GameMain.NetLobbyScreen.GameDuration.TotalMinutes);
|
||||
|
||||
msg.Write((myCharacter == null) ? connectedClients.Count : connectedClients.Count+1);
|
||||
msg.Write((myCharacter == null) ? connectedClients.Count : connectedClients.Count + 1);
|
||||
foreach (Client client in connectedClients)
|
||||
{
|
||||
msg.Write(client.ID);
|
||||
@@ -666,7 +676,9 @@ namespace Subsurface.Networking
|
||||
WriteCharacterData(msg, myCharacter.Info.Name, Character.Controlled);
|
||||
}
|
||||
|
||||
SendMessage(msg, NetDeliveryMethod.ReliableUnordered, null);
|
||||
SendMessage(msg, NetDeliveryMethod.ReliableUnordered, null);
|
||||
|
||||
yield return CoroutineStatus.Running;
|
||||
|
||||
gameStarted = true;
|
||||
|
||||
@@ -676,7 +688,8 @@ namespace Subsurface.Networking
|
||||
|
||||
CreateCrewFrame(crew);
|
||||
|
||||
return true;
|
||||
yield return CoroutineStatus.Success;
|
||||
|
||||
}
|
||||
|
||||
private bool EndButtonHit(GUIButton button, object obj)
|
||||
|
||||
Reference in New Issue
Block a user