Spectating, fire, damaged limb sprites, water detector, engineer jumpsuit, new signal comp sprites, resharper cleanup (god knows what else, commit more often)
This commit is contained in:
@@ -32,7 +32,7 @@ namespace Barotrauma
|
||||
|
||||
Hull cargoRoom = Hull.FindHull(wp.Position);
|
||||
|
||||
if (wp == null)
|
||||
if (cargoRoom == null)
|
||||
{
|
||||
DebugConsole.ThrowError("A waypoint marked as Cargo must be placed inside a room!");
|
||||
return;
|
||||
@@ -44,7 +44,7 @@ namespace Barotrauma
|
||||
Rand.Range(cargoRoom.Rect.X + 20, cargoRoom.Rect.Right - 20),
|
||||
Rand.Range(cargoRoom.Rect.Y - cargoRoom.Rect.Height + 20.0f, cargoRoom.Rect.Y));
|
||||
|
||||
new Item(prefab as ItemPrefab, wp.Position);
|
||||
new Item(prefab as ItemPrefab, position);
|
||||
}
|
||||
|
||||
purchasedItems.Clear();
|
||||
|
||||
@@ -20,6 +20,10 @@ namespace Barotrauma
|
||||
private GUIFrame guiFrame;
|
||||
private GUIListBox listBox;
|
||||
|
||||
private bool crewFrameOpen;
|
||||
private GUIButton crewButton;
|
||||
protected GUIFrame crewFrame;
|
||||
|
||||
|
||||
public int Money
|
||||
{
|
||||
@@ -34,10 +38,13 @@ namespace Barotrauma
|
||||
|
||||
guiFrame = new GUIFrame(new Rectangle(0, 50, 150, 450), Color.Transparent);
|
||||
|
||||
listBox = new GUIListBox(new Rectangle(0, 0, 150, 0), Color.Transparent, null, guiFrame);
|
||||
listBox = new GUIListBox(new Rectangle(0, 30, 150, 0), Color.Transparent, null, guiFrame);
|
||||
listBox.ScrollBarEnabled = false;
|
||||
listBox.OnSelected = SelectCharacter;
|
||||
|
||||
crewButton = new GUIButton(new Rectangle(0, 00, 100, 20), "Crew", GUI.Style, guiFrame);
|
||||
crewButton.OnClicked = ToggleCrewFrame;
|
||||
|
||||
money = 10000;
|
||||
}
|
||||
|
||||
@@ -100,6 +107,8 @@ namespace Barotrauma
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
guiFrame.Update(deltaTime);
|
||||
|
||||
if (crewFrameOpen) crewFrame.Update(deltaTime);
|
||||
}
|
||||
|
||||
public void KillCharacter(Character killedCharacter)
|
||||
@@ -113,6 +122,71 @@ namespace Barotrauma
|
||||
//}
|
||||
}
|
||||
|
||||
|
||||
public void CreateCrewFrame(List<Character> crew)
|
||||
{
|
||||
int width = 600, height = 400;
|
||||
|
||||
crewFrame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style);
|
||||
crewFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||
|
||||
GUIListBox crewList = new GUIListBox(new Rectangle(0, 0, 280, 300), Color.White * 0.7f, GUI.Style, crewFrame);
|
||||
crewList.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||
crewList.OnSelected = SelectCrewCharacter;
|
||||
|
||||
foreach (Character character in crew)
|
||||
{
|
||||
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, null, crewList);
|
||||
frame.UserData = character;
|
||||
frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||
frame.Color = (GameMain.NetworkMember != null && GameMain.NetworkMember.Character == character) ? Color.Gold * 0.2f : Color.Transparent;
|
||||
frame.HoverColor = Color.LightGray * 0.5f;
|
||||
frame.SelectedColor = Color.Gold * 0.5f;
|
||||
|
||||
GUITextBlock textBlock = new GUITextBlock(
|
||||
new Rectangle(40, 0, 0, 25),
|
||||
character.Info.Name + " (" + character.Info.Job.Name + ")",
|
||||
Color.Transparent, Color.White,
|
||||
Alignment.Left, Alignment.Left,
|
||||
null, frame);
|
||||
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
|
||||
|
||||
new GUIImage(new Rectangle(-10, 0, 0, 0), character.AnimController.Limbs[0].sprite, Alignment.Left, frame);
|
||||
}
|
||||
|
||||
var closeButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Close", Alignment.BottomCenter, GUI.Style, crewFrame);
|
||||
closeButton.OnClicked = ToggleCrewFrame;
|
||||
}
|
||||
|
||||
protected virtual bool SelectCrewCharacter(GUIComponent component, object obj)
|
||||
{
|
||||
Character character = obj as Character;
|
||||
if (character == null) return false;
|
||||
|
||||
GUIComponent existingFrame = crewFrame.FindChild("selectedcharacter");
|
||||
if (existingFrame != null) crewFrame.RemoveChild(existingFrame);
|
||||
|
||||
var previewPlayer = new GUIFrame(
|
||||
new Rectangle(0, 0, 230, 300),
|
||||
new Color(0.0f, 0.0f, 0.0f, 0.8f), Alignment.TopRight, GUI.Style, crewFrame);
|
||||
previewPlayer.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||
previewPlayer.UserData = "selectedcharacter";
|
||||
|
||||
character.Info.CreateInfoFrame(previewPlayer);
|
||||
|
||||
if (GameMain.NetworkMember != null) GameMain.NetworkMember.SelectCrewCharacter(component, obj);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool ToggleCrewFrame(GUIButton button, object obj)
|
||||
{
|
||||
if (crewFrame == null) CreateCrewFrame(characters);
|
||||
|
||||
crewFrameOpen = !crewFrameOpen;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void StartShift()
|
||||
{
|
||||
listBox.ClearChildren();
|
||||
@@ -161,6 +235,8 @@ namespace Barotrauma
|
||||
public void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
guiFrame.Draw(spriteBatch);
|
||||
|
||||
if (crewFrameOpen) crewFrame.Draw(spriteBatch);
|
||||
}
|
||||
|
||||
public void Save(XElement parentElement)
|
||||
|
||||
@@ -47,6 +47,11 @@ namespace Barotrauma
|
||||
get { return endMessage; }
|
||||
}
|
||||
|
||||
public GameModePreset Preset
|
||||
{
|
||||
get { return preset; }
|
||||
}
|
||||
|
||||
public GameMode(GameModePreset preset)
|
||||
{
|
||||
this.preset = preset;
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Barotrauma
|
||||
{
|
||||
//private const int StartCharacterAmount = 3;
|
||||
|
||||
public readonly CrewManager CrewManager;
|
||||
//public readonly CrewManager CrewManager;
|
||||
//public readonly HireManager hireManager;
|
||||
|
||||
private GUIButton endShiftButton;
|
||||
@@ -36,14 +36,18 @@ namespace Barotrauma
|
||||
|
||||
public int Money
|
||||
{
|
||||
get { return CrewManager.Money; }
|
||||
set { CrewManager.Money = value; }
|
||||
get { return GameMain.GameSession.CrewManager.Money; }
|
||||
set { GameMain.GameSession.CrewManager.Money = value; }
|
||||
}
|
||||
|
||||
private CrewManager CrewManager
|
||||
{
|
||||
get { return GameMain.GameSession.CrewManager; }
|
||||
}
|
||||
|
||||
public SinglePlayerMode(GameModePreset preset)
|
||||
: base(preset)
|
||||
{
|
||||
CrewManager = new CrewManager();
|
||||
|
||||
CargoManager = new CargoManager();
|
||||
|
||||
@@ -86,7 +90,7 @@ namespace Barotrauma
|
||||
{
|
||||
if (subElement.Name.ToString().ToLower() != "crew") continue;
|
||||
|
||||
CrewManager = new CrewManager(subElement);
|
||||
GameMain.GameSession.CrewManager = new CrewManager(subElement);
|
||||
}
|
||||
|
||||
savedOnStart = true;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Barotrauma
|
||||
|
||||
GameMain.GameSession.StartShift("tuto");
|
||||
|
||||
GameMain.GameSession.taskManager.Tasks.Clear();
|
||||
GameMain.GameSession.TaskManager.Tasks.Clear();
|
||||
|
||||
GameMain.GameScreen.Select();
|
||||
}
|
||||
@@ -255,7 +255,6 @@ namespace Barotrauma
|
||||
infoBox = CreateInfoFrame("You can see the equipped wire at the middle of the connection panel. Drag it to the power connector.");
|
||||
|
||||
var steeringConnection = steering.Item.Connections.Find(c => c.Name.Contains("power"));
|
||||
var junctionConnection = junctionBox.Item.Connections.Find(c => c.Name.Contains("power"));
|
||||
|
||||
while (steeringConnection.Wires.FirstOrDefault(w => w != null) == null)
|
||||
{
|
||||
|
||||
@@ -12,23 +12,17 @@ namespace Barotrauma
|
||||
{
|
||||
class GameSession
|
||||
{
|
||||
public readonly TaskManager taskManager;
|
||||
|
||||
|
||||
//protected DateTime startTime;
|
||||
//protected DateTime endTime;
|
||||
|
||||
public readonly GameMode gameMode;
|
||||
public readonly TaskManager TaskManager;
|
||||
|
||||
public readonly GameMode gameMode;
|
||||
|
||||
private GUIFrame guiRoot;
|
||||
|
||||
//private GUIListBox chatBox;
|
||||
//private GUITextBox textBox;
|
||||
|
||||
|
||||
private string saveFile;
|
||||
|
||||
private Submarine submarine;
|
||||
|
||||
public CrewManager CrewManager;
|
||||
|
||||
public Quest Quest
|
||||
{
|
||||
@@ -65,28 +59,29 @@ namespace Barotrauma
|
||||
get { return saveFile; }
|
||||
}
|
||||
|
||||
public GameSession(Submarine submarine, string saveFile, GameModePreset gameModePreset)
|
||||
:this(submarine, saveFile, gameModePreset.Instantiate())
|
||||
public GameSession(Submarine submarine, string saveFile, GameModePreset gameModePreset = null)
|
||||
{
|
||||
GameMain.GameSession = this;
|
||||
|
||||
}
|
||||
CrewManager = new CrewManager();
|
||||
|
||||
public GameSession(Submarine selectedSub, string saveFile, GameMode gameMode = null)
|
||||
{
|
||||
taskManager = new TaskManager(this);
|
||||
TaskManager = new TaskManager(this);
|
||||
|
||||
this.saveFile = saveFile;
|
||||
|
||||
guiRoot = new GUIFrame(new Rectangle(0,0,GameMain.GraphicsWidth,GameMain.GraphicsWidth), Color.Transparent);
|
||||
|
||||
this.gameMode = gameMode;
|
||||
this.submarine = selectedSub;
|
||||
|
||||
if (gameModePreset!=null) this.gameMode = gameModePreset.Instantiate();
|
||||
this.submarine = submarine;
|
||||
}
|
||||
|
||||
|
||||
public GameSession(Submarine selectedSub, string saveFile, string filePath)
|
||||
: this(selectedSub, saveFile)
|
||||
{
|
||||
GameMain.GameSession = this;
|
||||
|
||||
CrewManager = new CrewManager();
|
||||
|
||||
XDocument doc = ToolBox.TryLoadXml(filePath);
|
||||
if (doc == null) return;
|
||||
|
||||
@@ -131,7 +126,7 @@ namespace Barotrauma
|
||||
|
||||
if (gameMode!=null) gameMode.Start();
|
||||
|
||||
taskManager.StartShift(level);
|
||||
TaskManager.StartShift(level);
|
||||
}
|
||||
|
||||
public void EndShift(string endMessage)
|
||||
@@ -149,7 +144,7 @@ namespace Barotrauma
|
||||
GameMain.LobbyScreen.Select();
|
||||
}
|
||||
|
||||
taskManager.EndShift();
|
||||
TaskManager.EndShift();
|
||||
//gameMode.End();
|
||||
|
||||
//return true;
|
||||
@@ -158,9 +153,7 @@ namespace Barotrauma
|
||||
|
||||
public void KillCharacter(Character character)
|
||||
{
|
||||
SinglePlayerMode singlePlayerMode = gameMode as SinglePlayerMode;
|
||||
if (singlePlayerMode == null) return;
|
||||
singlePlayerMode.CrewManager.KillCharacter(character);
|
||||
CrewManager.KillCharacter(character);
|
||||
}
|
||||
|
||||
public bool LoadPrevious(GUIButton button, object obj)
|
||||
@@ -174,7 +167,7 @@ namespace Barotrauma
|
||||
|
||||
public void Update(float deltaTime)
|
||||
{
|
||||
taskManager.Update(deltaTime);
|
||||
TaskManager.Update(deltaTime);
|
||||
|
||||
guiRoot.Update(deltaTime);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user