(ec990ac7c) Save chatbox & crew menu toggle state between rounds
This commit is contained in:
@@ -33,7 +33,7 @@ namespace Barotrauma
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (_toggleOpen == value) { return; }
|
if (_toggleOpen == value) { return; }
|
||||||
_toggleOpen = value;
|
_toggleOpen = GameMain.Config.ChatOpen = value;
|
||||||
foreach (GUIComponent child in ToggleButton.Children)
|
foreach (GUIComponent child in ToggleButton.Children)
|
||||||
{
|
{
|
||||||
child.SpriteEffects = _toggleOpen == (HUDLayoutSettings.ChatBoxAlignment == Alignment.Right) ?
|
child.SpriteEffects = _toggleOpen == (HUDLayoutSettings.ChatBoxAlignment == Alignment.Right) ?
|
||||||
@@ -133,6 +133,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ToggleOpen = GameMain.Config.ChatOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TypingChatMessage(GUITextBox textBox, string text)
|
public bool TypingChatMessage(GUITextBox textBox, string text)
|
||||||
@@ -322,8 +324,6 @@ namespace Barotrauma
|
|||||||
prevUIScale = GUI.Scale;
|
prevUIScale = GUI.Scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (ToggleOpen || (inputBox != null && inputBox.Selected))
|
if (ToggleOpen || (inputBox != null && inputBox.Selected))
|
||||||
{
|
{
|
||||||
openState += deltaTime * 5.0f;
|
openState += deltaTime * 5.0f;
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace Barotrauma
|
|||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (toggleCrewAreaOpen == value) { return; }
|
if (toggleCrewAreaOpen == value) { return; }
|
||||||
toggleCrewAreaOpen = value;
|
toggleCrewAreaOpen = GameMain.Config.CrewMenuOpen = value;
|
||||||
foreach (GUIComponent child in toggleCrewButton.Children)
|
foreach (GUIComponent child in toggleCrewButton.Children)
|
||||||
{
|
{
|
||||||
child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||||
@@ -215,6 +215,8 @@ namespace Barotrauma
|
|||||||
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||||
|
|
||||||
prevUIScale = GUI.Scale;
|
prevUIScale = GUI.Scale;
|
||||||
|
|
||||||
|
ToggleCrewAreaOpen = GameMain.Config.CrewMenuOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1114,7 +1114,9 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
if (campaign == null)
|
if (campaign == null)
|
||||||
{
|
{
|
||||||
GameMain.GameSession = new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, missionIndex < 0 ? null : MissionPrefab.List[missionIndex]);
|
GameMain.GameSession = missionIndex < 0 ?
|
||||||
|
new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, MissionType.None) :
|
||||||
|
new GameSession(GameMain.NetLobbyScreen.SelectedSub, "", gameMode, MissionPrefab.List[missionIndex]);
|
||||||
GameMain.GameSession.StartRound(levelSeed, levelDifficulty, loadSecondSub);
|
GameMain.GameSession.StartRound(levelSeed, levelDifficulty, loadSecondSub);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -1756,9 +1756,8 @@ namespace Barotrauma.Networking
|
|||||||
Log("Level seed: " + GameMain.NetLobbyScreen.LevelSeed, ServerLog.MessageType.ServerMessage);
|
Log("Level seed: " + GameMain.NetLobbyScreen.LevelSeed, ServerLog.MessageType.ServerMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool missionAllowRespawn = campaign == null &&
|
MissionMode missionMode = GameMain.GameSession.GameMode as MissionMode;
|
||||||
(!(GameMain.GameSession.GameMode is MissionMode) ||
|
bool missionAllowRespawn = campaign == null && (missionMode?.Mission == null || missionMode.Mission.AllowRespawn);
|
||||||
((MissionMode)GameMain.GameSession.GameMode).Mission.AllowRespawn);
|
|
||||||
|
|
||||||
if (serverSettings.AllowRespawn && missionAllowRespawn) respawnManager = new RespawnManager(this, usingShuttle ? selectedShuttle : null);
|
if (serverSettings.AllowRespawn && missionAllowRespawn) respawnManager = new RespawnManager(this, usingShuttle ? selectedShuttle : null);
|
||||||
|
|
||||||
@@ -1941,10 +1940,8 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
MultiPlayerCampaign campaign = GameMain.GameSession?.GameMode as MultiPlayerCampaign;
|
MultiPlayerCampaign campaign = GameMain.GameSession?.GameMode as MultiPlayerCampaign;
|
||||||
|
|
||||||
bool missionAllowRespawn = campaign == null &&
|
MissionMode missionMode = GameMain.GameSession.GameMode as MissionMode;
|
||||||
(!(GameMain.GameSession.GameMode is MissionMode) ||
|
bool missionAllowRespawn = campaign == null && (missionMode?.Mission == null || missionMode.Mission.AllowRespawn);
|
||||||
((MissionMode)GameMain.GameSession.GameMode).Mission.AllowRespawn);
|
|
||||||
|
|
||||||
msg.Write(serverSettings.AllowRespawn && missionAllowRespawn);
|
msg.Write(serverSettings.AllowRespawn && missionAllowRespawn);
|
||||||
msg.Write(Submarine.MainSubs[1] != null); //loadSecondSub
|
msg.Write(Submarine.MainSubs[1] != null); //loadSecondSub
|
||||||
|
|
||||||
|
|||||||
@@ -207,10 +207,10 @@ namespace Barotrauma
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsAttached && attachTargetBody != null && deattachTimer < 0.0f)
|
if (attachTargetBody != null && deattachTimer < 0.0f)
|
||||||
{
|
{
|
||||||
Entity entity = attachTargetBody.UserData as Entity;
|
Entity entity = attachTargetBody.UserData as Entity;
|
||||||
Submarine attachedSub = entity is Submarine sub ? sub : entity?.Submarine;
|
Submarine attachedSub = entity is Submarine ? (Submarine)entity : entity?.Submarine;
|
||||||
if (attachedSub != null)
|
if (attachedSub != null)
|
||||||
{
|
{
|
||||||
float velocity = attachedSub.Velocity == Vector2.Zero ? 0.0f : attachedSub.Velocity.Length();
|
float velocity = attachedSub.Velocity == Vector2.Zero ? 0.0f : attachedSub.Velocity.Length();
|
||||||
|
|||||||
@@ -209,7 +209,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//isActive = false;
|
//isActive = false;
|
||||||
|
|
||||||
bool spawnReady = false;
|
|
||||||
if (spawnPending)
|
if (spawnPending)
|
||||||
{
|
{
|
||||||
//wait until there are no submarines at the spawnpos
|
//wait until there are no submarines at the spawnpos
|
||||||
@@ -220,30 +219,24 @@ namespace Barotrauma
|
|||||||
if (Vector2.DistanceSquared(submarine.WorldPosition, spawnPos) < minDist * minDist) return;
|
if (Vector2.DistanceSquared(submarine.WorldPosition, spawnPos) < minDist * minDist) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
spawnPending = false;
|
|
||||||
|
|
||||||
//+1 because Range returns an integer less than the max value
|
//+1 because Range returns an integer less than the max value
|
||||||
int amount = Rand.Range(minAmount, maxAmount + 1, Rand.RandSync.Server);
|
int amount = Rand.Range(minAmount, maxAmount + 1, Rand.RandSync.Server);
|
||||||
monsters = new List<Character>();
|
monsters = new Character[amount];
|
||||||
float offsetAmount = spawnPosType == Level.PositionType.MainPath ? 1000 : 100;
|
|
||||||
for (int i = 0; i < amount; i++)
|
for (int i = 0; i < amount; i++)
|
||||||
{
|
{
|
||||||
CoroutineManager.InvokeAfter(() =>
|
bool isClient = false;
|
||||||
{
|
|
||||||
bool isClient = false;
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
isClient = GameMain.Client != null;
|
isClient = GameMain.Client != null;
|
||||||
#endif
|
#endif
|
||||||
monsters.Add(Character.Create(characterFile, spawnPos + Rand.Vector(offsetAmount, Rand.RandSync.Server), i.ToString(), null, isClient, true, true));
|
|
||||||
if (monsters.Count == amount)
|
|
||||||
{
|
|
||||||
spawnReady = true;
|
|
||||||
}
|
|
||||||
}, Rand.Range(0f, amount / 2, Rand.RandSync.Server));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!spawnReady) { return; }
|
monsters[i] = Character.Create(
|
||||||
|
characterFile, spawnPos + Rand.Vector(100.0f, Rand.RandSync.Server),
|
||||||
|
i.ToString(), null, isClient, true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
spawnPending = false;
|
||||||
|
}
|
||||||
|
|
||||||
Entity targetEntity = Submarine.FindClosest(GameMain.GameScreen.Cam.WorldViewCenter);
|
Entity targetEntity = Submarine.FindClosest(GameMain.GameScreen.Cam.WorldViewCenter);
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
|
|||||||
@@ -150,6 +150,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public bool EnableMouseLook { get; set; } = true;
|
public bool EnableMouseLook { get; set; } = true;
|
||||||
|
|
||||||
|
public bool CrewMenuOpen { get; set; } = true;
|
||||||
|
public bool ChatOpen { get; set; } = true;
|
||||||
|
|
||||||
private bool unsavedSettings;
|
private bool unsavedSettings;
|
||||||
public bool UnsavedSettings
|
public bool UnsavedSettings
|
||||||
{
|
{
|
||||||
@@ -847,6 +850,9 @@ namespace Barotrauma
|
|||||||
AimAssistAmount = doc.Root.GetAttributeFloat("aimassistamount", AimAssistAmount);
|
AimAssistAmount = doc.Root.GetAttributeFloat("aimassistamount", AimAssistAmount);
|
||||||
EnableMouseLook = doc.Root.GetAttributeBool("enablemouselook", EnableMouseLook);
|
EnableMouseLook = doc.Root.GetAttributeBool("enablemouselook", EnableMouseLook);
|
||||||
|
|
||||||
|
CrewMenuOpen = doc.Root.GetAttributeBool("crewmenuopen", CrewMenuOpen);
|
||||||
|
ChatOpen = doc.Root.GetAttributeBool("chatopen", ChatOpen);
|
||||||
|
|
||||||
foreach (XElement subElement in doc.Root.Elements())
|
foreach (XElement subElement in doc.Root.Elements())
|
||||||
{
|
{
|
||||||
switch (subElement.Name.ToString().ToLowerInvariant())
|
switch (subElement.Name.ToString().ToLowerInvariant())
|
||||||
@@ -1022,7 +1028,9 @@ namespace Barotrauma
|
|||||||
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
|
new XAttribute("requiresteamauthentication", requireSteamAuthentication),
|
||||||
new XAttribute("autoupdateworkshopitems", AutoUpdateWorkshopItems),
|
new XAttribute("autoupdateworkshopitems", AutoUpdateWorkshopItems),
|
||||||
new XAttribute("aimassistamount", aimAssistAmount),
|
new XAttribute("aimassistamount", aimAssistAmount),
|
||||||
new XAttribute("enablemouselook", EnableMouseLook));
|
new XAttribute("enablemouselook", EnableMouseLook),
|
||||||
|
new XAttribute("chatopen", ChatOpen),
|
||||||
|
new XAttribute("crewmenuopen", CrewMenuOpen));
|
||||||
|
|
||||||
if (!ShowUserStatisticsPrompt)
|
if (!ShowUserStatisticsPrompt)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ namespace Barotrauma
|
|||||||
base.Deselect();
|
base.Deselect();
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
|
GameMain.Config.SaveNewPlayerConfig();
|
||||||
GameMain.SoundManager.SetCategoryMuffle("default", false);
|
GameMain.SoundManager.SetCategoryMuffle("default", false);
|
||||||
GUI.ClearMessages();
|
GUI.ClearMessages();
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user