Traitor probability selection instead of separate traitor mode, stopping water ambience on round end, lobby sync after client has verified connection, WIP shiftsummary in multiplayer, "cleanbuild" command in debugconsole
This commit is contained in:
@@ -187,7 +187,7 @@ namespace Barotrauma
|
|||||||
new GUIImage(new Rectangle(-5, -5, 0, 0), character.AnimController.Limbs[0].sprite, Alignment.Left, characterButton);
|
new GUIImage(new Rectangle(-5, -5, 0, 0), character.AnimController.Limbs[0].sprite, Alignment.Left, characterButton);
|
||||||
|
|
||||||
var humanAi = character.AIController as HumanAIController;
|
var humanAi = character.AIController as HumanAIController;
|
||||||
if (humanAi.CurrentOrder != null)
|
if (humanAi != null && humanAi.CurrentOrder != null)
|
||||||
{
|
{
|
||||||
CreateCharacterOrderFrame(characterButton, humanAi.CurrentOrder, humanAi.CurrentOrderOption);
|
CreateCharacterOrderFrame(characterButton, humanAi.CurrentOrder, humanAi.CurrentOrderOption);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1161,6 +1161,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
GameMain.NetworkMember.AddChatMessage(chatMessage, ChatMessageType.Dead);
|
GameMain.NetworkMember.AddChatMessage(chatMessage, ChatMessageType.Dead);
|
||||||
GameMain.LightManager.LosEnabled = false;
|
GameMain.LightManager.LosEnabled = false;
|
||||||
|
controlled = null;
|
||||||
|
|
||||||
new NetworkEvent(NetworkEventType.KillCharacter, ID, true, causeOfDeath);
|
new NetworkEvent(NetworkEventType.KillCharacter, ID, true, causeOfDeath);
|
||||||
}
|
}
|
||||||
@@ -1169,7 +1170,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
new NetworkEvent(NetworkEventType.KillCharacter, ID, true, causeOfDeath);
|
new NetworkEvent(NetworkEventType.KillCharacter, ID, true, causeOfDeath);
|
||||||
}
|
}
|
||||||
//otherwise don't kill the Character unless received a message about the Character dying
|
//don't kill the Character unless received a message about the Character dying
|
||||||
else if (!isNetworkMessage)
|
else if (!isNetworkMessage)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -423,6 +423,30 @@ namespace Barotrauma
|
|||||||
|
|
||||||
GameMain.Server.ShowNetStats = !GameMain.Server.ShowNetStats;
|
GameMain.Server.ShowNetStats = !GameMain.Server.ShowNetStats;
|
||||||
break;
|
break;
|
||||||
|
case "cleanbuild":
|
||||||
|
GameMain.Config.MusicVolume = 0.5f;
|
||||||
|
GameMain.Config.SoundVolume = 0.5f;
|
||||||
|
GameMain.Config.Save("config.xml");
|
||||||
|
DebugConsole.NewMessage("Set music and sound volume to 0.5", Color.Green);
|
||||||
|
|
||||||
|
var saveFiles = System.IO.Directory.GetFiles(SaveUtil.SaveFolder);
|
||||||
|
|
||||||
|
foreach (string saveFile in saveFiles)
|
||||||
|
{
|
||||||
|
System.IO.File.Delete(saveFile);
|
||||||
|
DebugConsole.NewMessage("Deleted "+saveFile, Color.Green);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (System.IO.File.Exists("filelist.xml"))
|
||||||
|
{
|
||||||
|
System.IO.File.Delete("filelist.xml");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!System.IO.File.Exists("Content/Map/TutorialSub.sub"))
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("TutorialSub.sub not found!");
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
NewMessage("Command not found", Color.Red);
|
NewMessage("Command not found", Color.Red);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -86,7 +86,11 @@ namespace Barotrauma
|
|||||||
characterInfos.Add(character.Info);
|
characterInfos.Add(character.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
commander.UpdateCharacters();
|
if (character is AICharacter)
|
||||||
|
{
|
||||||
|
commander.UpdateCharacters();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
character.Info.CreateCharacterFrame(listBox, character.Info.Name.Replace(' ', '\n'), character);
|
character.Info.CreateCharacterFrame(listBox, character.Info.Name.Replace(' ', '\n'), character);
|
||||||
|
|
||||||
@@ -128,9 +132,10 @@ namespace Barotrauma
|
|||||||
GUIComponent characterBlock = listBox.GetChild(killedCharacter) as GUIComponent;
|
GUIComponent characterBlock = listBox.GetChild(killedCharacter) as GUIComponent;
|
||||||
if (characterBlock != null) characterBlock.Color = Color.DarkRed * 0.5f;
|
if (characterBlock != null) characterBlock.Color = Color.DarkRed * 0.5f;
|
||||||
|
|
||||||
|
if (killedCharacter is AICharacter)
|
||||||
commander.UpdateCharacters();
|
{
|
||||||
|
commander.UpdateCharacters();
|
||||||
|
}
|
||||||
//if (characters.Find(c => !c.IsDead)==null)
|
//if (characters.Find(c => !c.IsDead)==null)
|
||||||
//{
|
//{
|
||||||
// Game1.GameSession.EndShift(null, null);
|
// Game1.GameSession.EndShift(null, null);
|
||||||
|
|||||||
@@ -43,10 +43,10 @@ namespace Barotrauma
|
|||||||
var mode = new GameModePreset("SandBox", typeof(GameMode), false);
|
var mode = new GameModePreset("SandBox", typeof(GameMode), false);
|
||||||
mode.Description = "A game mode with no specific objectives.";
|
mode.Description = "A game mode with no specific objectives.";
|
||||||
|
|
||||||
mode = new GameModePreset("Traitor", typeof(TraitorMode), false);
|
//mode = new GameModePreset("Traitor", typeof(TraitorMode), false);
|
||||||
mode.Description = "One of the players is selected as a traitor and given a secret objective. "
|
//mode.Description = "One of the players is selected as a traitor and given a secret objective. "
|
||||||
+ "The rest of the crew will win if they reach the end of the level or kill the traitor "
|
// + "The rest of the crew will win if they reach the end of the level or kill the traitor "
|
||||||
+ "before the objective is completed.";
|
// + "before the objective is completed.";
|
||||||
|
|
||||||
mode = new GameModePreset("Mission", typeof(MissionMode), false);
|
mode = new GameModePreset("Mission", typeof(MissionMode), false);
|
||||||
mode.Description = "The crew must work together to complete a specific task, such as retrieving "
|
mode.Description = "The crew must work together to complete a specific task, such as retrieving "
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public readonly CargoManager CargoManager;
|
public readonly CargoManager CargoManager;
|
||||||
|
|
||||||
private ShiftSummary shiftSummary;
|
|
||||||
|
|
||||||
public Map Map;
|
public Map Map;
|
||||||
|
|
||||||
private bool crewDead;
|
private bool crewDead;
|
||||||
@@ -119,8 +117,6 @@ namespace Barotrauma
|
|||||||
isRunning = true;
|
isRunning = true;
|
||||||
|
|
||||||
CrewManager.StartShift();
|
CrewManager.StartShift();
|
||||||
|
|
||||||
shiftSummary = new ShiftSummary(GameMain.GameSession);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryHireCharacter(HireManager hireManager, CharacterInfo characterInfo)
|
public bool TryHireCharacter(HireManager hireManager, CharacterInfo characterInfo)
|
||||||
@@ -195,11 +191,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//if (endMessage != "" || this.endMessage == null) this.endMessage = endMessage;
|
//if (endMessage != "" || this.endMessage == null) this.endMessage = endMessage;
|
||||||
|
|
||||||
GUIFrame summaryFrame = shiftSummary.CreateSummaryFrame();
|
|
||||||
GUIMessageBox.MessageBoxes.Enqueue(summaryFrame);
|
|
||||||
var okButton = new GUIButton(new Rectangle(0,0,100,30), "Ok", Alignment.BottomRight, GUI.Style, summaryFrame.children[0]);
|
|
||||||
okButton.OnClicked = (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Dequeue(); return true; };
|
|
||||||
|
|
||||||
bool success = CrewManager.characters.Any(c => !c.IsDead);
|
bool success = CrewManager.characters.Any(c => !c.IsDead);
|
||||||
|
|
||||||
if (success)
|
if (success)
|
||||||
|
|||||||
@@ -4,84 +4,66 @@ using Barotrauma.Networking;
|
|||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
class TraitorMode : GameMode
|
class TraitorManager
|
||||||
{
|
{
|
||||||
private Character traitorCharacter, targetCharacter;
|
private Character traitorCharacter, targetCharacter;
|
||||||
|
|
||||||
public TraitorMode(GameModePreset preset)
|
public TraitorManager(GameServer server)
|
||||||
: base(preset)
|
|
||||||
{
|
{
|
||||||
|
server.NewTraitor(out traitorCharacter, out targetCharacter);
|
||||||
|
}
|
||||||
|
|
||||||
|
public string GetEndMessage()
|
||||||
|
{
|
||||||
|
if (GameMain.Server == null || traitorCharacter == null || targetCharacter == null) return "";
|
||||||
|
|
||||||
|
if (targetCharacter == null || targetCharacter.IsDead)
|
||||||
|
{
|
||||||
|
string endMessage = traitorCharacter.Name + " was a traitor! ";
|
||||||
|
endMessage += (traitorCharacter.Info.Gender == Gender.Male) ? "His" : "Her";
|
||||||
|
endMessage += " task was to assassinate " + targetCharacter.Name + ". The task was successful.";
|
||||||
|
//End(endMessage);
|
||||||
|
}
|
||||||
|
else if (traitorCharacter == null || traitorCharacter.IsDead)
|
||||||
|
{
|
||||||
|
string endMessage = traitorCharacter.Name + " was a traitor! ";
|
||||||
|
endMessage += (traitorCharacter.Info.Gender == Gender.Male) ? "His" : "Her";
|
||||||
|
endMessage += " task was to assassinate " + targetCharacter.Name + ", but ";
|
||||||
|
endMessage += (traitorCharacter.Info.Gender == Gender.Male) ? "he" : "she";
|
||||||
|
endMessage += " got " + ((traitorCharacter.Info.Gender == Gender.Male) ? "himself" : "herself");
|
||||||
|
endMessage += " killed before completing it.";
|
||||||
|
|
||||||
|
return endMessage;
|
||||||
|
}
|
||||||
|
else if (Submarine.Loaded.AtEndPosition)
|
||||||
|
{
|
||||||
|
string endMessage = traitorCharacter.Name + " was a traitor! ";
|
||||||
|
endMessage += (traitorCharacter.Info.Gender == Gender.Male) ? "His" : "Her";
|
||||||
|
endMessage += " task was to assassinate " + targetCharacter.Name + ". ";
|
||||||
|
endMessage += "The task was unsuccessful - the has submarine reached its destination.";
|
||||||
|
|
||||||
|
return endMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Start()
|
//public void CharacterLeft(Character character)
|
||||||
{
|
//{
|
||||||
base.Start();
|
// if (character != traitorCharacter && character != targetCharacter) return;
|
||||||
|
|
||||||
traitorCharacter = null;
|
// if (character == traitorCharacter)
|
||||||
targetCharacter = null;
|
// {
|
||||||
}
|
// string endMessage = "The traitor has disconnected from the server.";
|
||||||
|
// End(endMessage);
|
||||||
public override void Update(float deltaTime)
|
// }
|
||||||
{
|
// else if (character == targetCharacter)
|
||||||
if (GameMain.Server == null) return;
|
// {
|
||||||
|
// string endMessage = "The traitor's target has disconnected from the server.";
|
||||||
base.Update(deltaTime);
|
// End(endMessage);
|
||||||
|
// }
|
||||||
if (!isRunning) return;
|
//}
|
||||||
|
|
||||||
|
|
||||||
if (traitorCharacter == null || targetCharacter == null)
|
|
||||||
{
|
|
||||||
GameMain.Server.NewTraitor(out traitorCharacter, out targetCharacter);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (targetCharacter == null || targetCharacter.IsDead)
|
|
||||||
{
|
|
||||||
string endMessage = traitorCharacter.Name + " was a traitor! ";
|
|
||||||
endMessage += (traitorCharacter.Info.Gender == Gender.Male) ? "His" : "Her";
|
|
||||||
endMessage += " task was to assassinate " + targetCharacter.Name + ". The task was successful.";
|
|
||||||
End(endMessage);
|
|
||||||
}
|
|
||||||
else if (traitorCharacter == null || traitorCharacter.IsDead)
|
|
||||||
{
|
|
||||||
string endMessage = traitorCharacter.Name + " was a traitor! ";
|
|
||||||
endMessage += (traitorCharacter.Info.Gender == Gender.Male) ? "His" : "Her";
|
|
||||||
endMessage += " task was to assassinate " + targetCharacter.Name + ", but ";
|
|
||||||
endMessage += (traitorCharacter.Info.Gender == Gender.Male) ? "he" : "she";
|
|
||||||
endMessage += " got " + ((traitorCharacter.Info.Gender == Gender.Male) ? "himself" : "herself");
|
|
||||||
endMessage += " killed before completing it.";
|
|
||||||
End(endMessage);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else if (Submarine.Loaded.AtEndPosition)
|
|
||||||
{
|
|
||||||
string endMessage = traitorCharacter.Name + " was a traitor! ";
|
|
||||||
endMessage += (traitorCharacter.Info.Gender == Gender.Male) ? "His" : "Her";
|
|
||||||
endMessage += " task was to assassinate " + targetCharacter.Name + ". ";
|
|
||||||
endMessage += "The task was unsuccessful - the has submarine reached its destination.";
|
|
||||||
End(endMessage);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CharacterLeft(Character character)
|
|
||||||
{
|
|
||||||
if (character != traitorCharacter && character != targetCharacter) return;
|
|
||||||
|
|
||||||
if (character == traitorCharacter)
|
|
||||||
{
|
|
||||||
string endMessage = "The traitor has disconnected from the server.";
|
|
||||||
End(endMessage);
|
|
||||||
}
|
|
||||||
else if (character == targetCharacter)
|
|
||||||
{
|
|
||||||
string endMessage = "The traitor's target has disconnected from the server.";
|
|
||||||
End(endMessage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public CrewManager CrewManager;
|
public CrewManager CrewManager;
|
||||||
|
|
||||||
|
private ShiftSummary shiftSummary;
|
||||||
|
|
||||||
public Mission Mission
|
public Mission Mission
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@@ -54,6 +56,11 @@ namespace Barotrauma
|
|||||||
get { return saveFile; }
|
get { return saveFile; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ShiftSummary ShiftSummary
|
||||||
|
{
|
||||||
|
get { return shiftSummary; }
|
||||||
|
}
|
||||||
|
|
||||||
public GameSession(Submarine submarine, string saveFile, GameModePreset gameModePreset = null)
|
public GameSession(Submarine submarine, string saveFile, GameModePreset gameModePreset = null)
|
||||||
{
|
{
|
||||||
GameMain.GameSession = this;
|
GameMain.GameSession = this;
|
||||||
@@ -119,6 +126,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (Mission!=null) Mission.Start(Level.Loaded);
|
if (Mission!=null) Mission.Start(Level.Loaded);
|
||||||
|
|
||||||
|
shiftSummary = new ShiftSummary(this);
|
||||||
|
|
||||||
if (gameMode!=null) gameMode.Start();
|
if (gameMode!=null) gameMode.Start();
|
||||||
|
|
||||||
TaskManager.StartShift(level);
|
TaskManager.StartShift(level);
|
||||||
@@ -139,6 +148,12 @@ namespace Barotrauma
|
|||||||
GameMain.LobbyScreen.Select();
|
GameMain.LobbyScreen.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GUIFrame summaryFrame = shiftSummary.CreateSummaryFrame(endMessage);
|
||||||
|
GUIMessageBox.MessageBoxes.Enqueue(summaryFrame);
|
||||||
|
var okButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Ok", Alignment.BottomRight, GUI.Style, summaryFrame.children[0]);
|
||||||
|
okButton.OnClicked = (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Dequeue(); return true; };
|
||||||
|
|
||||||
|
|
||||||
TaskManager.EndShift();
|
TaskManager.EndShift();
|
||||||
//gameMode.End();
|
//gameMode.End();
|
||||||
|
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
this.gameSession = gameSession;
|
this.gameSession = gameSession;
|
||||||
|
|
||||||
startLocation = gameSession.Map.CurrentLocation;
|
startLocation = gameSession.Map==null ? null : gameSession.Map.CurrentLocation;
|
||||||
endLocation = gameSession.Map.SelectedLocation;
|
endLocation = gameSession.Map==null ? null : gameSession.Map.SelectedLocation;
|
||||||
|
|
||||||
casualties = new List<Casualty>();
|
casualties = new List<Casualty>();
|
||||||
|
|
||||||
@@ -48,7 +48,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
selectedMission = gameSession.Mission;
|
selectedMission = gameSession.Mission;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -57,24 +56,36 @@ namespace Barotrauma
|
|||||||
casualties.Add(new Casualty(character.Info, causeOfDeath, ""));
|
casualties.Add(new Casualty(character.Info, causeOfDeath, ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIFrame CreateSummaryFrame()
|
public GUIFrame CreateSummaryFrame(string endMessage)
|
||||||
{
|
{
|
||||||
|
bool singleplayer = GameMain.NetworkMember == null;
|
||||||
|
|
||||||
bool gameOver = !gameSession.CrewManager.characters.Any(c => !c.IsDead);
|
bool gameOver = !gameSession.CrewManager.characters.Any(c => !c.IsDead);
|
||||||
bool progress = Submarine.Loaded.AtEndPosition;
|
bool progress = Submarine.Loaded.AtEndPosition;
|
||||||
|
|
||||||
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.8f);
|
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.8f);
|
||||||
|
|
||||||
|
|
||||||
int width = 760, height = 400;
|
int width = 760, height = 400;
|
||||||
GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, width, height), null, Alignment.Center, GUI.Style, frame);
|
GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, width, height), null, Alignment.Center, GUI.Style, frame);
|
||||||
|
|
||||||
|
|
||||||
int y = 0;
|
int y = 0;
|
||||||
string summaryText = InfoTextManager.GetInfoText(gameOver ? "gameover" :
|
|
||||||
(progress ? "progress" : "return"));
|
|
||||||
|
|
||||||
var infoText = new GUITextBlock(new Rectangle(0, y, 0, 50), summaryText, GUI.Style, innerFrame, true);
|
if (singleplayer)
|
||||||
y += infoText.Rect.Height;
|
{
|
||||||
|
string summaryText = InfoTextManager.GetInfoText(gameOver ? "gameover" :
|
||||||
|
(progress ? "progress" : "return"));
|
||||||
|
|
||||||
|
var infoText = new GUITextBlock(new Rectangle(0, y, 0, 50), summaryText, GUI.Style, innerFrame, true);
|
||||||
|
y += infoText.Rect.Height;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!string.IsNullOrWhiteSpace(endMessage))
|
||||||
|
{
|
||||||
|
var endText = new GUITextBlock(new Rectangle(0, y, 0, 30), endMessage, GUI.Style, innerFrame, true);
|
||||||
|
|
||||||
|
y += 30 + endText.Text.Split('\n').Length * 20;
|
||||||
|
}
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, y, 0, 20), "Crew status:", GUI.Style, innerFrame, GUI.LargeFont);
|
new GUITextBlock(new Rectangle(0, y, 0, 20), "Crew status:", GUI.Style, innerFrame, GUI.LargeFont);
|
||||||
y += 30;
|
y += 30;
|
||||||
@@ -87,9 +98,12 @@ namespace Barotrauma
|
|||||||
var characterFrame = new GUIFrame(new Rectangle(x, y, 170, 70), character.IsDead ? Color.DarkRed * 0.7f : Color.Transparent, GUI.Style, listBox);
|
var characterFrame = new GUIFrame(new Rectangle(x, y, 170, 70), character.IsDead ? Color.DarkRed * 0.7f : Color.Transparent, GUI.Style, listBox);
|
||||||
characterFrame.OutlineColor = Color.Transparent;
|
characterFrame.OutlineColor = Color.Transparent;
|
||||||
characterFrame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
characterFrame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||||
|
characterFrame.CanBeFocused = false;
|
||||||
|
|
||||||
character.Info.CreateCharacterFrame(characterFrame,
|
character.Info.CreateCharacterFrame(characterFrame,
|
||||||
character.Info.Job != null ? (character.Info.Name + '\n' + "(" + character.Info.Job.Name + ")") : character.Info.Name, null);
|
character.Info.Job != null ? (character.Info.Name + '\n' + "(" + character.Info.Job.Name + ")") : character.Info.Name, null);
|
||||||
|
|
||||||
|
|
||||||
string statusText;
|
string statusText;
|
||||||
Color statusColor;
|
Color statusColor;
|
||||||
|
|
||||||
@@ -103,7 +117,7 @@ namespace Barotrauma
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
statusText = (character.Health / character.MaxHealth > 0.8f) ? "OK" : "Injured";
|
statusText = (character.Health / character.MaxHealth > 0.8f) ? "OK" : "Injured";
|
||||||
statusColor = Color.DarkGreen;
|
statusColor = (character.Health / character.MaxHealth > 0.8f) ? Color.DarkGreen : Color.DarkOrange;
|
||||||
}
|
}
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), statusText,
|
new GUITextBlock(new Rectangle(0, 0, 0, 20), statusText,
|
||||||
@@ -122,10 +136,12 @@ namespace Barotrauma
|
|||||||
new GUITextBlock(new Rectangle(0, y, 0, 30),
|
new GUITextBlock(new Rectangle(0, y, 0, 30),
|
||||||
(GameMain.GameSession.Mission.Completed) ? GameMain.GameSession.Mission.SuccessMessage : GameMain.GameSession.Mission.FailureMessage,
|
(GameMain.GameSession.Mission.Completed) ? GameMain.GameSession.Mission.SuccessMessage : GameMain.GameSession.Mission.FailureMessage,
|
||||||
GUI.Style, innerFrame);
|
GUI.Style, innerFrame);
|
||||||
|
y += 40;
|
||||||
|
|
||||||
if (GameMain.GameSession.Mission.Completed)
|
if (GameMain.GameSession.Mission.Completed && singleplayer)
|
||||||
{
|
{
|
||||||
new GUITextBlock(new Rectangle(0, y + 40, 0, 30), "Reward: " + GameMain.GameSession.Mission.Reward, GUI.Style, innerFrame);
|
new GUITextBlock(new Rectangle(0, y, 0, 30), "Reward: " + GameMain.GameSession.Mission.Reward, GUI.Style, innerFrame);
|
||||||
|
y += 30;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
if (expression == value) return;
|
if (expression == value) return;
|
||||||
expression = value;
|
expression = value;
|
||||||
|
previousReceivedSignal = "";
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -55,12 +56,13 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(expression) || regex==null) return;
|
if (string.IsNullOrWhiteSpace(expression) || regex==null) return;
|
||||||
|
|
||||||
if (receivedSignal!=previousReceivedSignal)
|
if (receivedSignal != previousReceivedSignal)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Match match = regex.Match(receivedSignal);
|
Match match = regex.Match(receivedSignal);
|
||||||
previousResult = match.Success;
|
previousResult = match.Success;
|
||||||
|
previousReceivedSignal = receivedSignal;
|
||||||
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
|||||||
@@ -243,6 +243,10 @@ namespace Barotrauma.Networking
|
|||||||
GameMain.NetLobbyScreen.AddPlayer(name);
|
GameMain.NetLobbyScreen.AddPlayer(name);
|
||||||
|
|
||||||
CanStart = true;
|
CanStart = true;
|
||||||
|
|
||||||
|
NetOutgoingMessage lobbyUpdateRequest = client.CreateMessage();
|
||||||
|
lobbyUpdateRequest.Write((byte)PacketTypes.RequestNetLobbyUpdate);
|
||||||
|
client.SendMessage(lobbyUpdateRequest, NetDeliveryMethod.ReliableUnordered);
|
||||||
}
|
}
|
||||||
else if (packetType == (byte)PacketTypes.KickedOut)
|
else if (packetType == (byte)PacketTypes.KickedOut)
|
||||||
{
|
{
|
||||||
@@ -588,15 +592,18 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
public IEnumerable<object> EndGame(string endMessage)
|
public IEnumerable<object> EndGame(string endMessage)
|
||||||
{
|
{
|
||||||
var messageBox = new GUIMessageBox("The round has ended", endMessage, 400, 300);
|
GameMain.GameSession.gameMode.End(endMessage);
|
||||||
|
|
||||||
|
|
||||||
|
//var messageBox = new GUIMessageBox("The round has ended", endMessage, 400, 300);
|
||||||
|
|
||||||
if (!gameStarted) yield return CoroutineStatus.Success;
|
if (!gameStarted) yield return CoroutineStatus.Success;
|
||||||
gameStarted = false;
|
gameStarted = false;
|
||||||
|
|
||||||
Character.Controlled = null;
|
Character.Controlled = null;
|
||||||
|
GameMain.GameScreen.Cam.TargetPos = Vector2.Zero;
|
||||||
GameMain.LightManager.LosEnabled = false;
|
GameMain.LightManager.LosEnabled = false;
|
||||||
|
|
||||||
|
|
||||||
float endPreviewLength = 10.0f;
|
float endPreviewLength = 10.0f;
|
||||||
|
|
||||||
var cinematic = new TransitionCinematic(Submarine.Loaded, GameMain.GameScreen.Cam, endPreviewLength);
|
var cinematic = new TransitionCinematic(Submarine.Loaded, GameMain.GameScreen.Cam, endPreviewLength);
|
||||||
@@ -615,7 +622,7 @@ namespace Barotrauma.Networking
|
|||||||
//GameMain.GameScreen.Cam.TargetPos = Submarine.Loaded.Position + offset * 0.8f;
|
//GameMain.GameScreen.Cam.TargetPos = Submarine.Loaded.Position + offset * 0.8f;
|
||||||
//Game1.GameScreen.Cam.MoveCamera((float)deltaTime);
|
//Game1.GameScreen.Cam.MoveCamera((float)deltaTime);
|
||||||
|
|
||||||
messageBox.Text = endMessage + "\nReturning to lobby in " + (int)secondsLeft + " s";
|
//messageBox.Text = endMessage + "\nReturning to lobby in " + (int)secondsLeft + " s";
|
||||||
|
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
} while (secondsLeft > 0.0f);
|
} while (secondsLeft > 0.0f);
|
||||||
@@ -641,13 +648,13 @@ namespace Barotrauma.Networking
|
|||||||
// yield return CoroutineStatus.Running;
|
// yield return CoroutineStatus.Running;
|
||||||
//} while (secondsLeft > 0.0f);
|
//} while (secondsLeft > 0.0f);
|
||||||
|
|
||||||
messageBox.Close(null,null);
|
//messageBox.Close(null,null);
|
||||||
|
|
||||||
Submarine.Unload();
|
Submarine.Unload();
|
||||||
|
|
||||||
GameMain.NetLobbyScreen.Select();
|
GameMain.NetLobbyScreen.Select();
|
||||||
|
|
||||||
if (GameMain.GameSession!=null) GameMain.GameSession.EndShift("");
|
//if (GameMain.GameSession!=null) GameMain.GameSession.EndShift("");
|
||||||
|
|
||||||
myCharacter = null;
|
myCharacter = null;
|
||||||
foreach (Client c in otherClients)
|
foreach (Client c in otherClients)
|
||||||
@@ -776,6 +783,9 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
|
|
||||||
Character character = Character.Create(ch, position, !isMyCharacter, false);
|
Character character = Character.Create(ch, position, !isMyCharacter, false);
|
||||||
|
GameMain.GameSession.CrewManager.characters.Add(character);
|
||||||
|
character.OnDeath = GameMain.GameSession.ShiftSummary.AddCasualty;
|
||||||
|
|
||||||
|
|
||||||
character.ID = ID;
|
character.ID = ID;
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,8 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
private bool masterServerResponded;
|
private bool masterServerResponded;
|
||||||
|
|
||||||
|
public TraitorManager TraitorManager;
|
||||||
|
|
||||||
public GameServer(string name, int port, bool isPublic = false, string password = "", bool attemptUPnP = false, int maxPlayers = 10)
|
public GameServer(string name, int port, bool isPublic = false, string password = "", bool attemptUPnP = false, int maxPlayers = 10)
|
||||||
{
|
{
|
||||||
var endRoundButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170, 20, 150, 25), "End round", Alignment.TopLeft, GUI.Style, inGameHUD);
|
var endRoundButton = new GUIButton(new Rectangle(GameMain.GraphicsWidth - 170, 20, 150, 25), "End round", Alignment.TopLeft, GUI.Style, inGameHUD);
|
||||||
@@ -401,8 +403,6 @@ namespace Barotrauma.Networking
|
|||||||
SendMessage(outmsg, NetDeliveryMethod.ReliableUnordered, inc.SenderConnection);
|
SendMessage(outmsg, NetDeliveryMethod.ReliableUnordered, inc.SenderConnection);
|
||||||
|
|
||||||
AddChatMessage(sender.name + " has joined the server", ChatMessageType.Server);
|
AddChatMessage(sender.name + " has joined the server", ChatMessageType.Server);
|
||||||
|
|
||||||
UpdateNetLobby(null, null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (inc.SenderConnection.Status == NetConnectionStatus.Disconnected)
|
else if (inc.SenderConnection.Status == NetConnectionStatus.Disconnected)
|
||||||
@@ -470,6 +470,9 @@ namespace Barotrauma.Networking
|
|||||||
case (byte)PacketTypes.Vote:
|
case (byte)PacketTypes.Vote:
|
||||||
Voting.RegisterVote(inc, ConnectedClients);
|
Voting.RegisterVote(inc, ConnectedClients);
|
||||||
break;
|
break;
|
||||||
|
case (byte)PacketTypes.RequestNetLobbyUpdate:
|
||||||
|
UpdateNetLobby(null, null);
|
||||||
|
break;
|
||||||
case (byte)PacketTypes.SpectateRequest:
|
case (byte)PacketTypes.SpectateRequest:
|
||||||
if (gameStarted && allowSpectating)
|
if (gameStarted && allowSpectating)
|
||||||
{
|
{
|
||||||
@@ -772,6 +775,9 @@ namespace Barotrauma.Networking
|
|||||||
ConnectedClients[i].Character = Character.Create(
|
ConnectedClients[i].Character = Character.Create(
|
||||||
ConnectedClients[i].characterInfo, assignedWayPoints[i].WorldPosition, true, false);
|
ConnectedClients[i].characterInfo, assignedWayPoints[i].WorldPosition, true, false);
|
||||||
ConnectedClients[i].Character.GiveJobItems(assignedWayPoints[i]);
|
ConnectedClients[i].Character.GiveJobItems(assignedWayPoints[i]);
|
||||||
|
|
||||||
|
GameMain.GameSession.CrewManager.characters.Add(ConnectedClients[i].Character);
|
||||||
|
ConnectedClients[i].Character.OnDeath = GameMain.GameSession.ShiftSummary.AddCasualty;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (characterInfo != null)
|
if (characterInfo != null)
|
||||||
@@ -780,6 +786,9 @@ namespace Barotrauma.Networking
|
|||||||
Character.Controlled = myCharacter;
|
Character.Controlled = myCharacter;
|
||||||
|
|
||||||
myCharacter.GiveJobItems(assignedWayPoints[assignedWayPoints.Length - 1]);
|
myCharacter.GiveJobItems(assignedWayPoints[assignedWayPoints.Length - 1]);
|
||||||
|
|
||||||
|
GameMain.GameSession.CrewManager.characters.Add(myCharacter);
|
||||||
|
myCharacter.OnDeath = GameMain.GameSession.ShiftSummary.AddCasualty;
|
||||||
}
|
}
|
||||||
|
|
||||||
var startMessage = CreateStartMessage(roundStartSeed, Submarine.Loaded, GameMain.GameSession.gameMode.Preset);
|
var startMessage = CreateStartMessage(roundStartSeed, Submarine.Loaded, GameMain.GameSession.gameMode.Preset);
|
||||||
@@ -790,6 +799,11 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
UpdateCrewFrame();
|
UpdateCrewFrame();
|
||||||
|
|
||||||
|
if (TraitorsEnabled == YesNoMaybe.Yes || (TraitorsEnabled == YesNoMaybe.Maybe && Rand.Range(0.0f, 1.0f)<0.5f))
|
||||||
|
{
|
||||||
|
TraitorManager = new TraitorManager(this);
|
||||||
|
}
|
||||||
|
|
||||||
//give some time for the clients to load the map
|
//give some time for the clients to load the map
|
||||||
yield return new WaitForSeconds(2.0f);
|
yield return new WaitForSeconds(2.0f);
|
||||||
|
|
||||||
@@ -838,7 +852,14 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
private bool EndButtonHit(GUIButton button, object obj)
|
private bool EndButtonHit(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
GameMain.GameSession.gameMode.End("Server admin has ended the round");
|
string endMessage = "The round has ended." + '\n';
|
||||||
|
|
||||||
|
if (TraitorManager!=null)
|
||||||
|
{
|
||||||
|
endMessage += TraitorManager.GetEndMessage();
|
||||||
|
}
|
||||||
|
|
||||||
|
GameMain.GameSession.gameMode.End(endMessage);
|
||||||
|
|
||||||
if (autoRestart) AutoRestartTimer = 20.0f;
|
if (autoRestart) AutoRestartTimer = 20.0f;
|
||||||
|
|
||||||
@@ -847,7 +868,7 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
public IEnumerable<object> EndGame(string endMessage)
|
public IEnumerable<object> EndGame(string endMessage)
|
||||||
{
|
{
|
||||||
var messageBox = new GUIMessageBox("The round has ended", endMessage, 400, 300);
|
//var messageBox = new GUIMessageBox("The round has ended", endMessage, 400, 300);
|
||||||
|
|
||||||
Character.Controlled = null;
|
Character.Controlled = null;
|
||||||
myCharacter = null;
|
myCharacter = null;
|
||||||
@@ -893,14 +914,14 @@ namespace Barotrauma.Networking
|
|||||||
//GameMain.GameScreen.Cam.TargetPos = Submarine.Loaded.Position + offset * 0.8f;
|
//GameMain.GameScreen.Cam.TargetPos = Submarine.Loaded.Position + offset * 0.8f;
|
||||||
//Game1.GameScreen.Cam.MoveCamera((float)deltaTime);
|
//Game1.GameScreen.Cam.MoveCamera((float)deltaTime);
|
||||||
|
|
||||||
messageBox.Text = endMessage + "\nReturning to lobby in " + (int)secondsLeft + " s";
|
//messageBox.Text = endMessage + "\nReturning to lobby in " + (int)secondsLeft + " s";
|
||||||
|
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
} while (secondsLeft > 0.0f);
|
} while (secondsLeft > 0.0f);
|
||||||
|
|
||||||
Submarine.Unload();
|
Submarine.Unload();
|
||||||
|
|
||||||
messageBox.Close(null, null);
|
//messageBox.Close(null, null);
|
||||||
|
|
||||||
GameMain.NetLobbyScreen.Select();
|
GameMain.NetLobbyScreen.Select();
|
||||||
|
|
||||||
@@ -922,11 +943,11 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
if (GameMain.GameSession!=null && GameMain.GameSession.gameMode!=null)
|
if (GameMain.GameSession!=null && GameMain.GameSession.gameMode!=null)
|
||||||
{
|
{
|
||||||
TraitorMode traitorMode = GameMain.GameSession.gameMode as TraitorMode;
|
//TraitorMode traitorMode = GameMain.GameSession.gameMode as TraitorMode;
|
||||||
if (traitorMode!=null)
|
//if (traitorMode!=null)
|
||||||
{
|
//{
|
||||||
traitorMode.CharacterLeft(client.Character);
|
// traitorMode.CharacterLeft(client.Character);
|
||||||
}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
client.Character.ClearInputs();
|
client.Character.ClearInputs();
|
||||||
|
|||||||
@@ -6,11 +6,16 @@ using System.Text;
|
|||||||
|
|
||||||
namespace Barotrauma.Networking
|
namespace Barotrauma.Networking
|
||||||
{
|
{
|
||||||
enum SelectionMode
|
enum SelectionMode : int
|
||||||
{
|
{
|
||||||
Manual = 0, Random = 1, Vote = 2
|
Manual = 0, Random = 1, Vote = 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enum YesNoMaybe : int
|
||||||
|
{
|
||||||
|
No = 0, Maybe = 1, Yes = 2
|
||||||
|
}
|
||||||
|
|
||||||
partial class GameServer : NetworkMember
|
partial class GameServer : NetworkMember
|
||||||
{
|
{
|
||||||
public bool ShowNetStats;
|
public bool ShowNetStats;
|
||||||
@@ -47,6 +52,12 @@ namespace Barotrauma.Networking
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public YesNoMaybe TraitorsEnabled
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
set;
|
||||||
|
}
|
||||||
|
|
||||||
public SelectionMode SubSelectionMode
|
public SelectionMode SubSelectionMode
|
||||||
{
|
{
|
||||||
get { return subSelectionMode; }
|
get { return subSelectionMode; }
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
PlayerJoined, PlayerLeft, KickedOut,
|
PlayerJoined, PlayerLeft, KickedOut,
|
||||||
|
|
||||||
|
RequestNetLobbyUpdate,
|
||||||
|
|
||||||
StartGame, EndGame,
|
StartGame, EndGame,
|
||||||
|
|
||||||
CharacterInfo,
|
CharacterInfo,
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private GUIListBox subList, modeList, chatBox;
|
private GUIListBox subList, modeList, chatBox;
|
||||||
|
|
||||||
|
private GUIButton[] traitorProbabilityButtons;
|
||||||
|
private GUITextBlock traitorProbabilityText;
|
||||||
|
|
||||||
private GUIListBox jobList;
|
private GUIListBox jobList;
|
||||||
|
|
||||||
private GUITextBox textBox, seedBox;
|
private GUITextBox textBox, seedBox;
|
||||||
@@ -31,8 +34,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private GUITickBox autoRestartBox;
|
private GUITickBox autoRestartBox;
|
||||||
|
|
||||||
private float camAngle;
|
|
||||||
|
|
||||||
public bool IsServer;
|
public bool IsServer;
|
||||||
public string ServerName, ServerMessage;
|
public string ServerName, ServerMessage;
|
||||||
|
|
||||||
@@ -260,6 +261,21 @@ namespace Barotrauma
|
|||||||
var restartText = new GUITextBlock(new Rectangle(columnX, 210, 20, 20), "", GUI.Style, infoFrame);
|
var restartText = new GUITextBlock(new Rectangle(columnX, 210, 20, 20), "", GUI.Style, infoFrame);
|
||||||
restartText.TextGetter = AutoRestartText;
|
restartText.TextGetter = AutoRestartText;
|
||||||
|
|
||||||
|
//traitor probability ------------------------------------------------------------------
|
||||||
|
|
||||||
|
var traitorText = new GUITextBlock(new Rectangle(columnX, 230, 20, 20), "Traitors:", GUI.Style, infoFrame);
|
||||||
|
|
||||||
|
traitorProbabilityButtons = new GUIButton[2];
|
||||||
|
|
||||||
|
traitorProbabilityButtons[0] = new GUIButton(new Rectangle(columnX, 260, 20, 20), "<", GUI.Style, infoFrame);
|
||||||
|
traitorProbabilityButtons[0].UserData = -1;
|
||||||
|
|
||||||
|
traitorProbabilityText = new GUITextBlock(new Rectangle(columnX+20, 260, 150, 20), "No", null,null, Alignment.TopCenter, GUI.Style, infoFrame);
|
||||||
|
|
||||||
|
traitorProbabilityButtons[1] = new GUIButton(new Rectangle(columnX + 150, 260, 20, 20), ">", GUI.Style, infoFrame);
|
||||||
|
traitorProbabilityButtons[1].UserData = 1;
|
||||||
|
|
||||||
|
|
||||||
//server info ------------------------------------------------------------------
|
//server info ------------------------------------------------------------------
|
||||||
|
|
||||||
var serverName = new GUITextBox(new Rectangle(0, 0, 200, 20), null, null, Alignment.TopLeft, Alignment.TopLeft, GUI.Style, infoFrame);
|
var serverName = new GUITextBox(new Rectangle(0, 0, 200, 20), null, null, Alignment.TopLeft, Alignment.TopLeft, GUI.Style, infoFrame);
|
||||||
@@ -296,6 +312,10 @@ namespace Barotrauma
|
|||||||
seedBox.Enabled = GameMain.Server != null;
|
seedBox.Enabled = GameMain.Server != null;
|
||||||
serverMessage.Enabled = GameMain.Server != null;
|
serverMessage.Enabled = GameMain.Server != null;
|
||||||
autoRestartBox.Enabled = GameMain.Server != null;
|
autoRestartBox.Enabled = GameMain.Server != null;
|
||||||
|
|
||||||
|
traitorProbabilityButtons[0].Enabled = GameMain.Server != null;
|
||||||
|
traitorProbabilityButtons[1].Enabled = GameMain.Server != null;
|
||||||
|
|
||||||
ServerName = (GameMain.Server==null) ? "Server" : GameMain.Server.Name;
|
ServerName = (GameMain.Server==null) ? "Server" : GameMain.Server.Name;
|
||||||
|
|
||||||
infoFrame.RemoveChild(infoFrame.children.Find(c => c.UserData as string == "startButton"));
|
infoFrame.RemoveChild(infoFrame.children.Find(c => c.UserData as string == "startButton"));
|
||||||
@@ -307,9 +327,12 @@ namespace Barotrauma
|
|||||||
if (IsServer && GameMain.Server != null)
|
if (IsServer && GameMain.Server != null)
|
||||||
{
|
{
|
||||||
modeList.OnSelected = VotableClicked;
|
modeList.OnSelected = VotableClicked;
|
||||||
modeList.OnSelected += SelectMode;
|
modeList.OnSelected = SelectMode;
|
||||||
subList.OnSelected = VotableClicked;
|
subList.OnSelected = VotableClicked;
|
||||||
subList.OnSelected += SelectMap;
|
subList.OnSelected = SelectMap;
|
||||||
|
|
||||||
|
traitorProbabilityButtons[0].OnClicked = ToggleTraitorsEnabled;
|
||||||
|
traitorProbabilityButtons[1].OnClicked = ToggleTraitorsEnabled;
|
||||||
|
|
||||||
GUIButton startButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Start", Alignment.BottomRight, GUI.Style, infoFrame);
|
GUIButton startButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Start", Alignment.BottomRight, GUI.Style, infoFrame);
|
||||||
startButton.OnClicked = GameMain.Server.StartGameClicked;
|
startButton.OnClicked = GameMain.Server.StartGameClicked;
|
||||||
@@ -461,6 +484,29 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool ToggleTraitorsEnabled(GUIButton button, object userData)
|
||||||
|
{
|
||||||
|
if (GameMain.Server == null) return false;
|
||||||
|
|
||||||
|
int dir = (int)userData;
|
||||||
|
|
||||||
|
int index = (int)GameMain.Server.TraitorsEnabled + dir;
|
||||||
|
if (index < 0) index = 2;
|
||||||
|
if (index > 2) index = 0;
|
||||||
|
|
||||||
|
SetTraitorsEnabled((YesNoMaybe)index);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetTraitorsEnabled(YesNoMaybe enabled)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (GameMain.Server != null) GameMain.Server.TraitorsEnabled = enabled;
|
||||||
|
(traitorProbabilityText as GUITextBlock).Text = enabled.ToString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private bool SelectMap(GUIComponent component, object obj)
|
private bool SelectMap(GUIComponent component, object obj)
|
||||||
{
|
{
|
||||||
if (GameMain.Server != null) GameMain.Server.UpdateNetLobby(obj);
|
if (GameMain.Server != null) GameMain.Server.UpdateNetLobby(obj);
|
||||||
@@ -884,6 +930,8 @@ namespace Barotrauma
|
|||||||
msg.Write(ServerName);
|
msg.Write(ServerName);
|
||||||
msg.Write(ServerMessage);
|
msg.Write(ServerMessage);
|
||||||
|
|
||||||
|
msg.WriteRangedInteger(0, 2, (int)GameMain.Server.TraitorsEnabled);
|
||||||
|
|
||||||
//msg.Write(AllowSubVoting);
|
//msg.Write(AllowSubVoting);
|
||||||
//msg.Write(AllowModeVoting);
|
//msg.Write(AllowModeVoting);
|
||||||
|
|
||||||
@@ -914,6 +962,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
float restartTimer = 0.0f;
|
float restartTimer = 0.0f;
|
||||||
|
|
||||||
|
YesNoMaybe traitorsEnabled;
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
mapName = msg.ReadString();
|
mapName = msg.ReadString();
|
||||||
@@ -922,6 +972,8 @@ namespace Barotrauma
|
|||||||
ServerName = msg.ReadString();
|
ServerName = msg.ReadString();
|
||||||
ServerMessage = msg.ReadString();
|
ServerMessage = msg.ReadString();
|
||||||
|
|
||||||
|
traitorsEnabled = (YesNoMaybe)msg.ReadRangedInteger(0, 2);
|
||||||
|
|
||||||
//AllowSubVoting = msg.ReadBoolean();
|
//AllowSubVoting = msg.ReadBoolean();
|
||||||
//AllowModeVoting = msg.ReadBoolean();
|
//AllowModeVoting = msg.ReadBoolean();
|
||||||
|
|
||||||
@@ -952,6 +1004,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (!GameMain.NetworkMember.Voting.AllowModeVoting) modeList.Select(modeIndex, true);
|
if (!GameMain.NetworkMember.Voting.AllowModeVoting) modeList.Select(modeIndex, true);
|
||||||
|
|
||||||
|
SetTraitorsEnabled(traitorsEnabled);
|
||||||
|
|
||||||
autoRestartBox.Selected = autoRestart;
|
autoRestartBox.Selected = autoRestart;
|
||||||
autoRestartTimer = restartTimer;
|
autoRestartTimer = restartTimer;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework;
|
||||||
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -19,6 +20,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (selected != null && selected!=this) selected.Deselect();
|
if (selected != null && selected!=this) selected.Deselect();
|
||||||
selected = this;
|
selected = this;
|
||||||
|
|
||||||
|
GUI.ScreenOverlayColor = Color.Transparent;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Update(double deltaTime)
|
public virtual void Update(double deltaTime)
|
||||||
|
|||||||
@@ -173,17 +173,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (Submarine.Loaded==null)
|
if (Submarine.Loaded==null)
|
||||||
{
|
{
|
||||||
|
for (int i = 0; i < waterAmbienceIndexes.Length; i++)
|
||||||
|
|
||||||
if (waterAmbienceIndexes[0] > 0)
|
|
||||||
{
|
{
|
||||||
SoundManager.Stop(waterAmbienceIndexes[0]);
|
if (waterAmbienceIndexes[i] <= 0) continue;
|
||||||
SoundManager.Stop(waterAmbienceIndexes[1]);
|
|
||||||
|
|
||||||
waterAmbienceIndexes[0] = 0;
|
SoundManager.Stop(waterAmbienceIndexes[i]);
|
||||||
waterAmbienceIndexes[1] = 0;
|
waterAmbienceIndexes[i] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
public class SaveUtil
|
public class SaveUtil
|
||||||
{
|
{
|
||||||
private static string SaveFolder = "Data"+Path.DirectorySeparatorChar+"Saves";
|
public static string SaveFolder = "Data"+Path.DirectorySeparatorChar+"Saves";
|
||||||
|
|
||||||
public delegate void ProgressDelegate(string sMessage);
|
public delegate void ProgressDelegate(string sMessage);
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user