Merge pull request #434 from misternebula/change-gamestate-event

This commit is contained in:
_nebula 2021-12-22 00:48:41 +00:00 committed by GitHub
commit bce5fd395a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 20 deletions

View File

@ -30,7 +30,7 @@ namespace QSB.ClientServerStateSync
public void ChangeClientState(ClientState newState)
{
if (QSBPlayerManager.LocalPlayer.State == newState)
if (PlayerTransformSync.LocalInstance == null || QSBPlayerManager.LocalPlayer.State == newState)
{
return;
}

View File

@ -87,22 +87,18 @@ namespace QSB.Menus
}
}
public void JoinGame(bool inEye, bool inSolarSystem)
public void JoinGame(bool inEye)
{
if (inEye)
{
LoadManager.LoadSceneAsync(OWScene.EyeOfTheUniverse, true, LoadManager.FadeType.ToBlack, 1f, false);
Locator.GetMenuInputModule().DisableInputs();
}
else if (inSolarSystem)
else
{
LoadManager.LoadSceneAsync(OWScene.SolarSystem, true, LoadManager.FadeType.ToBlack, 1f, false);
Locator.GetMenuInputModule().DisableInputs();
}
else
{
DebugLog.DebugWrite("tried to join game that wasnt in solar system or eye??");
}
}
private void OpenInfoPopup(string message, string buttonText)

View File

@ -21,8 +21,6 @@ namespace QSB.SaveSync.Events
{
AboutId = LocalPlayerId,
ForId = toId,
InSolarSystem = QSBSceneManager.CurrentScene == OWScene.SolarSystem,
InEye = QSBSceneManager.CurrentScene == OWScene.EyeOfTheUniverse,
WarpedToTheEye = gameSave.warpedToTheEye,
SecondsRemainingOnWarp = gameSave.secondsRemainingOnWarp,
LaunchCodesGiven = PlayerData.KnowsLaunchCodes(),
@ -53,11 +51,7 @@ namespace QSB.SaveSync.Events
PlayerData.SaveCurrentGame();
if (message.InEye != (QSBSceneManager.CurrentScene == OWScene.EyeOfTheUniverse)
|| message.InSolarSystem != (QSBSceneManager.CurrentScene == OWScene.SolarSystem))
{
MenuManager.Instance.JoinGame(message.InEye, message.InSolarSystem);
}
MenuManager.Instance.JoinGame(message.WarpedToTheEye);
}
}
}

View File

@ -7,8 +7,6 @@ namespace QSB.SaveSync.Events
{
internal class GameStateMessage : PlayerMessage
{
public bool InSolarSystem { get; set; }
public bool InEye { get; set; }
public bool WarpedToTheEye { get; set; }
public float SecondsRemainingOnWarp { get; set; }
public bool LaunchCodesGiven { get; set; }
@ -19,8 +17,6 @@ namespace QSB.SaveSync.Events
public override void Deserialize(QNetworkReader reader)
{
base.Deserialize(reader);
InSolarSystem = reader.ReadBoolean();
InEye = reader.ReadBoolean();
WarpedToTheEye = reader.ReadBoolean();
SecondsRemainingOnWarp = reader.ReadSingle();
LaunchCodesGiven = reader.ReadBoolean();
@ -48,8 +44,6 @@ namespace QSB.SaveSync.Events
public override void Serialize(QNetworkWriter writer)
{
base.Serialize(writer);
writer.Write(InSolarSystem);
writer.Write(InEye);
writer.Write(WarpedToTheEye);
writer.Write(SecondsRemainingOnWarp);
writer.Write(LaunchCodesGiven);