Lobbyscreen store fixes, sub name textbox & save button in sub editor, transitioncinematic on crew death, saving reactor state, radar marker position fix, minimap fix, button sounds, artifact positioning fix, better LegUp prevention method, some music clips when round ends

This commit is contained in:
Regalis
2016-01-03 01:13:32 +02:00
parent 8717a2259f
commit cb1513f5e6
32 changed files with 277 additions and 160 deletions

View File

@@ -1066,18 +1066,30 @@
<None Include="Content\Sounds\Music\Enter the Maze.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Music\Road to Hell.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Music\Static Motion.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Music\Tenebrous Brothers Carnival - Prelude.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Music\The Descent.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\Music\Unseen Horrors.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\stepMetal.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\UI\beep-shinymetal.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\UI\tap-zipper.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Sounds\UI\UImsg.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -37,6 +37,10 @@
<music file="Content/Sounds/Music/Simplex.ogg" type="default"/>
<music file="Content/Sounds/Music/Tenebrous Brothers Carnival - Prelude.ogg" type="default"/>
<music file="Content/Sounds/Music/The Descent.ogg" type="endshift"/>
<music file="Content/Sounds/Music/Road to Hell.ogg" type="crewdead"/>
<music file="Content/Sounds/Music/Enter the Maze.ogg" type="repair" priorityrange="30,60"/>
<music file="Content/Sounds/Music/Static Motion.ogg" type="repair" priorityrange="50,80"/>
<music file="Content/Sounds/Music/Unseen Horrors.ogg" type="monster" priorityrange="40,100"/>

View File

@@ -76,7 +76,7 @@ namespace Barotrauma
private Vector2 GetStandPosition()
{
Vector2 standPos = leak.Position;
var hull = leak.linkedTo[0];
var hull = leak.FlowTargetHull;
if (hull == null) return standPos;

View File

@@ -243,45 +243,33 @@ namespace Barotrauma
movement = MathUtils.SmoothStep(movement, TargetMovement, movementLerp);
movement.Y = 0.0f;
bool legsUp = false;
for (int i = 0; i < 2; i++)
{
Limb leg = GetLimb((i == 0) ? LimbType.LeftLeg : LimbType.RightLeg);// : leftLeg;
Limb leg = GetLimb((i == 0) ? LimbType.LeftThigh : LimbType.RightThigh);// : leftLeg;
float shortestAngle = leg.Rotation - torso.Rotation;
if (Math.Abs(shortestAngle)<2.4f) continue;
if (Math.Abs(shortestAngle) < 2.5f) continue;
leg.body.ApplyTorque(-shortestAngle*10.0f);
if (Math.Abs(shortestAngle) > 5.0f)
{
TargetDir = TargetDir == Direction.Right ? Direction.Left : Direction.Right;
}
else
{
leg = GetLimb((i == 0) ? LimbType.LeftThigh : LimbType.RightThigh);
leg.body.ApplyTorque(-shortestAngle * 5.0f);
// float torsoRot = MathHelper.WrapAngle(torso.Rotation);
// torsoRot = MathHelper.ToDegrees(torsoRot);
leg.body.ApplyTorque(shortestAngle * 10.0f);
//float torque = Math.Sign(torso.SimPosition.X - leg.SimPosition.X) * leg.Mass * 10.0f;
//leg.body.ApplyTorque(torque);
//leg.body.ApplyTorque(torque);
// if (Math.Sign(Dir)==Math.Sign(torsoRot))
// {
//leg.body.ApplyTorque(-leg.Mass * 100.0f);
// }
// else
// {
// leg.body.ApplyTorque(leg.Mass * 100.0f);
// }
//legsUp = true;
leg = GetLimb((i == 0) ? LimbType.LeftLeg : LimbType.RightLeg);
leg.body.ApplyTorque(-shortestAngle * 10.0f);
}
}
if (legsUp || LowestLimb == null) return;
if (LowestLimb == null) return;
if (!onGround || (LowestLimb.SimPosition.Y - floorY > 0.5f && stairs == null)) return;
getUpSpeed = getUpSpeed * Math.Max(head.SimPosition.Y - colliderPos.Y, 0.1f);
getUpSpeed = getUpSpeed * Math.Max(head.SimPosition.Y - colliderPos.Y, 0.5f);
if (stairs != null)
{

View File

@@ -590,7 +590,6 @@ namespace Barotrauma
{
DebugConsole.ThrowError("Failed to update ragdoll limb collisioncategories", e);
}
}
}

View File

@@ -412,6 +412,7 @@ namespace Barotrauma
if (Info.PickedItemIDs[i] == 0) continue;
Item item = FindEntityByID(Info.PickedItemIDs[i]) as Item;
System.Diagnostics.Debug.Assert(item != null);
if (item == null) continue;
item.Pick(this, true, true, true);
@@ -1100,49 +1101,44 @@ namespace Barotrauma
Kill(CauseOfDeath.Pressure, isNetworkMessage);
}
private IEnumerable<object> DeathAnim(Camera cam)
{
if (controlled != this) yield return CoroutineStatus.Success;
//private IEnumerable<object> DeathAnim(Camera cam)
//{
// if (controlled != this) yield return CoroutineStatus.Success;
Character.controlled = null;
// Character.controlled = null;
float dimDuration = 8.0f;
float timer = 0.0f;
// float dimDuration = 8.0f;
// float timer = 0.0f;
Color prevAmbientLight = GameMain.LightManager.AmbientLight;
Color darkLight = new Color(0.2f, 0.2f, 0.2f, 1.0f);
// Color prevAmbientLight = GameMain.LightManager.AmbientLight;
// Color darkLight = new Color(0.2f, 0.2f, 0.2f, 1.0f);
while (timer < dimDuration)
{
timer += CoroutineManager.DeltaTime;
// while (timer < dimDuration && Character.controlled == null)
// {
// timer += CoroutineManager.DeltaTime;
if (cam != null) cam.OffsetAmount = 0.0f;
// if (cam != null) cam.OffsetAmount = 0.0f;
cam.TargetPos = WorldPosition;
// cam.TargetPos = WorldPosition;
GameMain.LightManager.AmbientLight = Color.Lerp(prevAmbientLight, darkLight, timer / dimDuration);
// GameMain.LightManager.AmbientLight = Color.Lerp(prevAmbientLight, darkLight, timer / dimDuration);
yield return CoroutineStatus.Running;
}
// yield return CoroutineStatus.Running;
// }
// float lerpLightBack = 0.0f;
// while (lerpLightBack < 1.0f)
// {
// lerpLightBack = Math.Min(lerpLightBack + CoroutineManager.DeltaTime*5.0f, 1.0f);
while (controlled == this)
{
yield return CoroutineStatus.Running;
}
// GameMain.LightManager.AmbientLight = Color.Lerp(darkLight, prevAmbientLight, lerpLightBack);
// yield return CoroutineStatus.Running;
// }
float lerpLightBack = 0.0f;
while (lerpLightBack < 1.0f)
{
lerpLightBack = Math.Min(lerpLightBack + 0.05f, 1.0f);
// cam.TargetPos = Vector2.Zero;
GameMain.LightManager.AmbientLight = Color.Lerp(darkLight, prevAmbientLight, lerpLightBack);
yield return CoroutineStatus.Running;
}
cam.TargetPos = Vector2.Zero;
yield return CoroutineStatus.Success;
}
// yield return CoroutineStatus.Success;
//}
public void Kill(CauseOfDeath causeOfDeath, bool isNetworkMessage = false)
{
@@ -1175,7 +1171,7 @@ namespace Barotrauma
if (OnDeath != null) OnDeath(this, causeOfDeath);
CoroutineManager.StartCoroutine(DeathAnim(GameMain.GameScreen.Cam));
//CoroutineManager.StartCoroutine(DeathAnim(GameMain.GameScreen.Cam));
health = 0.0f;

View File

@@ -47,8 +47,8 @@ namespace Barotrauma
Vector2 tryPos = level.PositionsOfInterest[Rand.Int(level.PositionsOfInterest.Count, false)];
if (Submarine.PickBody(
tryPos,
tryPos - Vector2.UnitY*level.Size.Y,
ConvertUnits.ToSimUnits(tryPos),
ConvertUnits.ToSimUnits(tryPos - Vector2.UnitY*level.Size.Y),
null, Physics.CollisionLevel) != null)
{
position = tryPos;

View File

@@ -16,8 +16,15 @@ namespace Barotrauma
BottomRight = (Bottom | Right), BottomLeft = (Bottom | Left), BottomCenter = (CenterX | Bottom)
}
public enum GUISoundType
{
Message = 0,
Click = 1
}
public class GUI
{
public static GUIStyle Style;
private static Texture2D t;
@@ -57,7 +64,8 @@ namespace Barotrauma
if (loadSounds)
{
sounds = new Sound[2];
sounds[0] = Sound.Load("Content/Sounds/UI/UImsg.ogg", false);
sounds[(int)GUISoundType.Message] = Sound.Load("Content/Sounds/UI/UImsg.ogg", false);
sounds[(int)GUISoundType.Click] = Sound.Load("Content/Sounds/UI/beep-shinymetal.ogg", false);
}
// create 1x1 texture for line drawing
@@ -391,12 +399,12 @@ namespace Barotrauma
currPos.Y += messages.Count * 30;
messages.Add(new GUIMessage(message, color, currPos, lifeTime));
if (playSound) PlayMessageSound();
if (playSound) PlayUISound(GUISoundType.Message);
}
public static void PlayMessageSound()
public static void PlayUISound(GUISoundType soundType)
{
sounds[0].Play();
sounds[(int)soundType].Play();
}
private static void DrawMessages(SpriteBatch spriteBatch, float deltaTime)

View File

@@ -161,6 +161,8 @@ namespace Barotrauma
}
else if (PlayerInput.LeftButtonClicked())
{
GUI.PlayUISound(GUISoundType.Click);
if (OnClicked != null)
{
if (OnClicked(this, UserData) && CanBeSelected) state = ComponentState.Selected;

View File

@@ -208,10 +208,10 @@ namespace Barotrauma
flashTimer = FlashDuration;
flashColor = (color == null) ? Color.Red * 0.8f : (Color)color;
foreach (GUIComponent child in children)
{
child.Flash();
}
//foreach (GUIComponent child in children)
//{
// child.Flash();
//}
}
public virtual void Draw(SpriteBatch spriteBatch)
@@ -315,6 +315,7 @@ namespace Barotrauma
for (int i = 0; i < children.Count; i++)
{
if (!children[i].Visible) continue;
children[i].Update(deltaTime);
}
}

View File

@@ -43,12 +43,12 @@ namespace Barotrauma
{
get { return selected; }
}
public object SelectedData
{
get
get
{
return (Selected == null) ? null : Selected.UserData;
return (Selected == null) ? null : Selected.UserData;
}
}
@@ -87,18 +87,18 @@ namespace Barotrauma
public bool ScrollBarEnabled
{
get { return scrollBarEnabled; }
set
{
set
{
if (value)
{
if (!scrollBarEnabled && scrollBarHidden) ShowScrollBar();
if (!scrollBarEnabled && scrollBarHidden) ShowScrollBar();
}
else
{
if (scrollBarEnabled && !scrollBarHidden) HideScrollBar();
if (scrollBarEnabled && !scrollBarHidden) HideScrollBar();
}
scrollBarEnabled = value;
scrollBarEnabled = value;
}
}
@@ -114,7 +114,7 @@ namespace Barotrauma
public GUIListBox(Rectangle rect, Color? color, GUIStyle style = null, GUIComponent parent = null)
: this(rect, color, (Alignment.Left | Alignment.Top), style, parent)
{
{
}
public GUIListBox(Rectangle rect, Color? color, Alignment alignment, GUIStyle style = null, GUIComponent parent = null, bool isHorizontal = false)
@@ -125,7 +125,7 @@ namespace Barotrauma
selected = new List<GUIComponent>();
if (color!=null) this.color = (Color)color;
if (color != null) this.color = (Color)color;
if (parent != null)
parent.AddChild(this);
@@ -135,7 +135,7 @@ namespace Barotrauma
if (isHorizontal)
{
scrollBar = new GUIScrollBar(
new Rectangle(this.rect.X, this.rect.Bottom-20, this.rect.Width, 20), color, 1.0f, GUI.Style);
new Rectangle(this.rect.X, this.rect.Bottom - 20, this.rect.Width, 20), color, 1.0f, GUI.Style);
}
else
{
@@ -160,37 +160,39 @@ namespace Barotrauma
public void Select(object selection)
{
for (int i = 0; i < children.Count; i++ )
for (int i = 0; i < children.Count; i++)
{
if (children[i].UserData != selection) continue;
Select(i);
if (OnSelected != null) OnSelected(Selected, Selected.UserData);
//if (OnSelected != null) OnSelected(Selected, Selected.UserData);
if (!SelectMultiple) return;
}
}
public override void Update(float deltaTime)
{
if (!Visible) return;
base.Update(deltaTime);
scrollBar.Update(deltaTime);
if ((MouseOn==this || MouseOn==scrollBar || IsParentOf(MouseOn) )&& PlayerInput.ScrollWheelSpeed!=0)
if ((MouseOn == this || MouseOn == scrollBar || IsParentOf(MouseOn)) && PlayerInput.ScrollWheelSpeed != 0)
{
scrollBar.BarScroll -= (PlayerInput.ScrollWheelSpeed/500.0f) * BarSize;
scrollBar.BarScroll -= (PlayerInput.ScrollWheelSpeed / 500.0f) * BarSize;
}
}
public void Select(int childIndex)
{
//children[0] is the GUIFrame, ignore it
//childIndex += 1;
if (childIndex >= children.Count || childIndex < 0) return;
if (childIndex >= children.Count || childIndex<0) return;
bool wasSelected = true;
if (OnSelected != null) wasSelected = OnSelected(children[childIndex], children[childIndex].UserData);
if (!wasSelected) return;
if (SelectMultiple)
{
@@ -209,8 +211,6 @@ namespace Barotrauma
selected.Add(children[childIndex]);
}
if (OnSelected != null) OnSelected(Selected, Selected.UserData);
}
public void Deselect()
@@ -228,8 +228,8 @@ namespace Barotrauma
totalSize += spacing;
}
scrollBar.BarSize = scrollBar.IsHorizontal ?
Math.Min((float)rect.Width / (float)totalSize, 1.0f) :
scrollBar.BarSize = scrollBar.IsHorizontal ?
Math.Min((float)rect.Width / (float)totalSize, 1.0f) :
Math.Min((float)rect.Height / (float)totalSize, 1.0f);
if (scrollBar.BarSize < 1.0f && scrollBarHidden) ShowScrollBar();
@@ -250,7 +250,7 @@ namespace Barotrauma
//{
// scrollBar.BarScroll = 1.0f;
//}
}
public override void ClearChildren()
@@ -265,14 +265,14 @@ namespace Barotrauma
if (selected.Contains(child)) selected.Remove(child);
UpdateScrollBarSize();
UpdateScrollBarSize();
}
private void ShowScrollBar()
{
if (scrollBarHidden) Rect = new Rectangle(rect.X, rect.Y, rect.Width - scrollBar.Rect.Width, rect.Height);
scrollBarHidden = false;
}
private void HideScrollBar()
@@ -280,7 +280,7 @@ namespace Barotrauma
if (!scrollBarHidden) Rect = new Rectangle(rect.X, rect.Y, rect.Width + scrollBar.Rect.Width, rect.Height);
scrollBarHidden = true;
}
public override void Draw(SpriteBatch spriteBatch)
{
if (!Visible) return;
@@ -305,7 +305,7 @@ namespace Barotrauma
}
}
for (int i = 0; i < children.Count; i++ )
for (int i = 0; i < children.Count; i++)
{
GUIComponent child = children[i];
if (child == frame) continue;
@@ -320,6 +320,7 @@ namespace Barotrauma
y += child.Rect.Height + spacing;
}
child.Visible = false;
if (child.Rect.Y + child.Rect.Height < rect.Y) continue;
if (child.Rect.Y + child.Rect.Height > rect.Y + rect.Height) break;
@@ -330,7 +331,9 @@ namespace Barotrauma
continue;
}
if (enabled && child.CanBeFocused &&
child.Visible = true;
if (enabled && child.CanBeFocused &&
(MouseOn == this || (MouseOn != null && this.IsParentOf(MouseOn))) && child.Rect.Contains(PlayerInput.MousePosition))
{
child.State = ComponentState.Hover;
@@ -346,7 +349,7 @@ namespace Barotrauma
}
}
else if(selected.Contains(child))
else if (selected.Contains(child))
{
child.State = ComponentState.Selected;

View File

@@ -116,6 +116,8 @@ namespace Barotrauma
endTimer = 5.0f;
isRunning = true;
CrewManager.StartShift();
shiftSummary = new ShiftSummary(GameMain.GameSession);
@@ -141,7 +143,7 @@ namespace Barotrauma
public override void Draw(SpriteBatch spriteBatch)
{
base.Draw(spriteBatch);
if (!isRunning) return;
CrewManager.Draw(spriteBatch);
@@ -166,6 +168,8 @@ namespace Barotrauma
public override void Update(float deltaTime)
{
if (!isRunning) return;
base.Update(deltaTime);
CrewManager.Update(deltaTime);
@@ -174,16 +178,13 @@ namespace Barotrauma
if (!crewDead)
{
if (CrewManager.characters.Find(c => !c.IsDead) == null)
{
crewDead = true;
}
if (!CrewManager.characters.Any(c => !c.IsDead)) crewDead = true;
}
else
{
endTimer -= deltaTime;
if (endTimer <= 0.0f) End("");
if (endTimer <= 0.0f) EndShift(null, null);
}
}
@@ -192,8 +193,6 @@ namespace Barotrauma
isRunning = false;
GameMain.GameSession.EndShift("");
//if (endMessage != "" || this.endMessage == null) this.endMessage = endMessage;
GUIFrame summaryFrame = shiftSummary.CreateSummaryFrame();
@@ -211,8 +210,6 @@ namespace Barotrauma
}
SaveUtil.SaveGame(GameMain.GameSession.SaveFile);
}
else
{
@@ -223,6 +220,8 @@ namespace Barotrauma
msgBox.Buttons[1].OnClicked += msgBox.Close;
}
GameMain.GameSession.EndShift("");
CrewManager.EndShift();
for (int i = Character.CharacterList.Count - 1; i >= 0; i--)
{
@@ -234,8 +233,12 @@ namespace Barotrauma
private bool EndShift(GUIButton button, object obj)
{
isRunning = false;
var cinematic = new TransitionCinematic(Submarine.Loaded, GameMain.GameScreen.Cam);
SoundPlayer.OverrideMusicType = CrewManager.characters.Any(c => !c.IsDead) ? "endshift" : "crewdead";
CoroutineManager.StartCoroutine(EndCinematic(cinematic));
return true;
@@ -250,6 +253,10 @@ namespace Barotrauma
End("");
yield return new WaitForSeconds(18.0f);
SoundPlayer.OverrideMusicType = null;
yield return CoroutineStatus.Success;
}

View File

@@ -73,7 +73,12 @@ namespace Barotrauma.Tutorials
public virtual void Update(float deltaTime)
{
if (Character.Controlled != null && Character.Controlled.IsDead)
if (Character.Controlled==null)
{
CoroutineManager.StopCoroutine("TutorialMode.UpdateState");
infoBox = null;
}
else if (Character.Controlled.IsDead)
{
Character.Controlled = null;
@@ -147,7 +152,7 @@ namespace Barotrauma.Tutorials
}
GUI.PlayMessageSound();
GUI.PlayUISound(GUISoundType.Message);
return infoBlock;
}

View File

@@ -86,20 +86,23 @@ namespace Barotrauma
character.Info.Job!=null ? (character.Info.Name + '\n'+"("+character.Info.Job.Name+")") : character.Info.Name, null);
string statusText;
Color statusColor;
var casualty = casualties.Find(c => c.character == character.Info);
if (casualty != null)
{
statusText = InfoTextManager.GetInfoText("CauseOfDeath." + casualty.causeOfDeath.ToString());
statusColor = Color.DarkRed;
}
else
{
statusText = (character.Health / character.MaxHealth > 0.8f) ? "OK" : "Injured";
statusColor = Color.DarkGreen;
}
new GUITextBlock(new Rectangle(0,0,0,20), statusText,
GUI.Style, Alignment.BottomLeft, Alignment.TopCenter, characterFrame, true, GUI.SmallFont).Color = Color.Black*0.7f;
GUI.Style, Alignment.BottomLeft, Alignment.TopCenter, characterFrame, true, GUI.SmallFont).Color = statusColor*0.7f;
x += characterFrame.Rect.Width + 10;

View File

@@ -56,7 +56,12 @@ namespace Barotrauma
private set
{
unsavedSettings = value;
if (applyButton != null) applyButton.Selected = unsavedSettings;
if (applyButton != null)
{
//applyButton.Selected = unsavedSettings;
applyButton.Enabled = unsavedSettings;
applyButton.Text = unsavedSettings ? "Apply*" : "Apply";
}
}
}
@@ -424,7 +429,9 @@ namespace Barotrauma
private bool ApplyClicked(GUIButton button, object userData)
{
Save("config.xml");
settingsFrame.Flash(Color.Green);
if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
{
new GUIMessageBox("Restart required", "You need to restart the game for the resolution changes to take effect.");

View File

@@ -52,8 +52,8 @@ namespace Barotrauma.Items.Components
foreach (Hull hull in Hull.hullList)
{
Rectangle hullRect = new Rectangle(
miniMap.X + (int)((hull.Rect.X - Submarine.Borders.X) * size),
miniMap.Y - (int)((hull.Rect.Y - Submarine.Borders.Y) * size),
miniMap.X + (int)((hull.Rect.X - Submarine.HiddenSubPosition.X - Submarine.Borders.X) * size),
miniMap.Y - (int)((hull.Rect.Y - Submarine.HiddenSubPosition.Y - Submarine.Borders.Y) * size),
(int)(hull.Rect.Width * size),
(int)(hull.Rect.Height * size));

View File

@@ -230,11 +230,11 @@ namespace Barotrauma.Items.Components
DrawMarker(spriteBatch,
(GameMain.GameSession.Map == null) ? "Start" : GameMain.GameSession.Map.CurrentLocation.Name,
(Level.Loaded.StartPosition), displayScale, center, (rect.Width * 0.55f));
(Level.Loaded.StartPosition - (Submarine.Loaded.Position + Submarine.HiddenSubPosition)), displayScale, center, (rect.Width * 0.55f));
DrawMarker(spriteBatch,
(GameMain.GameSession.Map == null) ? "End" : GameMain.GameSession.Map.SelectedLocation.Name,
(Level.Loaded.EndPosition), displayScale, center, (rect.Width * 0.55f));
(Level.Loaded.EndPosition - (Submarine.Loaded.Position+Submarine.HiddenSubPosition)), displayScale, center, (rect.Width * 0.55f));
if (GameMain.GameSession.Mission != null)
{
@@ -244,7 +244,7 @@ namespace Barotrauma.Items.Components
{
DrawMarker(spriteBatch,
mission.RadarLabel,
mission.RadarPosition, displayScale, center, (rect.Width * 0.55f));
mission.RadarPosition - (Submarine.Loaded.Position + Submarine.HiddenSubPosition), displayScale, center, (rect.Width * 0.55f));
}
}

View File

@@ -80,6 +80,7 @@ namespace Barotrauma.Items.Components
}
}
[HasDefaultValue(0.0f, true)]
public float FissionRate
{
get { return fissionRate; }
@@ -89,7 +90,8 @@ namespace Barotrauma.Items.Components
fissionRate = MathHelper.Clamp(value, 0.0f, 100.0f);
}
}
[HasDefaultValue(0.0f, true)]
public float CoolingRate
{
get { return coolingRate; }
@@ -100,6 +102,7 @@ namespace Barotrauma.Items.Components
}
}
[HasDefaultValue(0.0f, true)]
public float Temperature
{
get { return temperature; }
@@ -115,6 +118,7 @@ namespace Barotrauma.Items.Components
return (temperature > 0.0f);
}
[HasDefaultValue(false, true)]
public bool AutoTemp
{
get { return autoTemp; }
@@ -125,6 +129,7 @@ namespace Barotrauma.Items.Components
public float AvailableFuel { get; set; }
[HasDefaultValue(500.0f, true)]
public float ShutDownTemp
{
get { return shutDownTemp; }

View File

@@ -203,7 +203,7 @@ namespace Barotrauma
FireProof = ToolBox.GetAttributeBool(element, "fireproof", false);
MapEntityCategory category;
Enum.TryParse(ToolBox.GetAttributeString(element, "category", "Item"), out category);
Enum.TryParse(ToolBox.GetAttributeString(element, "category", "Misc"), out category);
Category = category;
string spriteColorStr = ToolBox.GetAttributeString(element, "spritecolor", "1.0,1.0,1.0,1.0");

View File

@@ -9,7 +9,7 @@ namespace Barotrauma
{
enum MapEntityCategory
{
Structure, Machine, Item, Electrical, Equipment, Material
Structure, Machine, Equipment, Electrical, Material, Misc
}
class MapEntityPrefab

View File

@@ -55,6 +55,7 @@ namespace Barotrauma
public string Name
{
get { return name; }
set { name = value; }
}
public static Vector2 LastPickedPosition

View File

@@ -36,6 +36,7 @@ namespace Barotrauma
private IEnumerable<object> UpdateTransitionCinematic(Submarine sub, Camera cam, Vector2 targetPos)
{
Character.Controlled = null;
cam.TargetPos = Vector2.Zero;
GameMain.LightManager.LosEnabled = false;
Vector2 diff = targetPos - sub.Position;
@@ -50,15 +51,19 @@ namespace Barotrauma
while (timer < duration)
{
Vector2 cameraPos = sub.Position;
cameraPos.Y = ConvertUnits.ToDisplayUnits(Level.Loaded.ShaftBodies[0].Position.Y) - cam.WorldView.Height/2.0f;
cam.Zoom = Math.Max(0.2f, cam.Zoom - CoroutineManager.DeltaTime * 0.1f);
Vector2 cameraPos = sub.Position + Submarine.HiddenSubPosition;
cameraPos.Y = Math.Min(cameraPos.Y, ConvertUnits.ToDisplayUnits(Level.Loaded.ShaftBodies[0].Position.Y) - cam.WorldView.Height/2.0f);
GUI.ScreenOverlayColor = Color.Lerp(Color.TransparentBlack, Color.Black, timer/duration);
cam.Translate((cameraPos - cam.Position) * CoroutineManager.DeltaTime*10.0f);
cam.Zoom = Math.Max(0.2f, cam.Zoom - CoroutineManager.DeltaTime * 0.1f);
sub.ApplyForce((Vector2.Normalize(diff) * targetSpeed - sub.Velocity) * 500.0f);
if (diff != Vector2.Zero)
{
sub.ApplyForce((Vector2.Normalize(diff) * targetSpeed - sub.Velocity) * 500.0f);
}
timer += CoroutineManager.DeltaTime;

View File

@@ -195,7 +195,7 @@ namespace Barotrauma.Networking
if ((prevSize == 1.0f && chatBox.BarScroll == 0.0f) || (prevSize < 1.0f && chatBox.BarScroll == 1.0f)) chatBox.BarScroll = 1.0f;
GUI.PlayMessageSound();
GUI.PlayUISound(GUISoundType.Message);
}
public virtual void SendChatMessage(string message, ChatMessageType type = ChatMessageType.Server) { }

View File

@@ -14,6 +14,8 @@ namespace Barotrauma
private GUIComponent[] GUItabs;
private int selectedTab;
private GUITextBox nameBox;
//a Character used for picking up and manipulating items
private Character dummyCharacter;
@@ -58,13 +60,19 @@ namespace Barotrauma
//constructionList.OnSelected = MapEntityPrefab.SelectPrefab;
//constructionList.CheckSelected = MapEntityPrefab.GetSelected;
GUITextBlock nameBlock = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", GUI.Style, Alignment.TopLeft, Alignment.TopLeft, GUIpanel, true, GUI.LargeFont);
nameBlock.TextGetter = GetSubName;
GUITextBlock itemCount = new GUITextBlock(new Rectangle(0, 80, 0, 20), "", GUI.Style, GUIpanel);
new GUITextBlock(new Rectangle(0, 20, 0, 20), "Submarine:", GUI.Style, GUIpanel);
nameBox = new GUITextBox(new Rectangle(0, 40, 0, 20), GUI.Style, GUIpanel);
//nameBlock.TextGetter = GetSubName;
GUIButton button = new GUIButton(new Rectangle(0,70,0,20), "Save", GUI.Style, GUIpanel);
button.OnClicked = SaveSub;
GUITextBlock itemCount = new GUITextBlock(new Rectangle(0, 100, 0, 20), "", GUI.Style, GUIpanel);
itemCount.TextGetter = GetItemCount;
GUITextBlock structureCount = new GUITextBlock(new Rectangle(0, 100, 0, 20), "", GUI.Style, GUIpanel);
GUITextBlock structureCount = new GUITextBlock(new Rectangle(0, 120, 0, 20), "", GUI.Style, GUIpanel);
structureCount.TextGetter = GetStructureCount;
//GUITextBlock physicsBodyCount = new GUITextBlock(new Rectangle(0, 120, 0, 20), "", GUI.Style, GUIpanel);
@@ -79,7 +87,7 @@ namespace Barotrauma
GUItabs = new GUIComponent[Enum.GetValues(typeof(MapEntityCategory)).Length];
int width = 400, height = 400;
int y = 150;
int y = 160;
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
{
@@ -135,7 +143,7 @@ namespace Barotrauma
}
var button = new GUIButton(new Rectangle(0, y+50, 0, 20), "Character mode", Alignment.Left, GUI.Style, GUIpanel);
button = new GUIButton(new Rectangle(0, y+50, 0, 20), "Character mode", Alignment.Left, GUI.Style, GUIpanel);
button.ToolTip = "Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.";
button.OnClicked = ToggleCharacterMode;
@@ -165,7 +173,11 @@ namespace Barotrauma
GUIComponent.MouseOn = null;
characterMode = false;
if (Submarine.Loaded != null) cam.Position = Submarine.Loaded.Position + Submarine.HiddenSubPosition;
if (Submarine.Loaded != null)
{
cam.Position = Submarine.Loaded.Position + Submarine.HiddenSubPosition;
nameBox.Text = Submarine.Loaded.Name;
}
//CreateDummyCharacter();
}
@@ -194,6 +206,32 @@ namespace Barotrauma
GameMain.World.ProcessChanges();
}
private bool SaveSub(GUIButton button, object obj)
{
if (string.IsNullOrWhiteSpace(nameBox.Text))
{
nameBox.Flash();
return false;
}
if (nameBox.Text.Contains("../"))
{
DebugConsole.ThrowError("Illegal symbols in filename (../)");
nameBox.Flash();
return false;
}
if (Submarine.Loaded!=null)
{
Submarine.Loaded.Name = nameBox.Text;
}
Submarine.SaveCurrent(nameBox.Text + ".sub");
return false;
}
private bool SelectTab(GUIButton button, object obj)
{
selectedTab = (int)obj;

View File

@@ -140,6 +140,9 @@ namespace Barotrauma
buyButton = new GUIButton(new Rectangle(sellColumnWidth + 20, 0, 100, 25), "Buy", Alignment.Bottom, GUI.Style, bottomPanel[(int)PanelTab.Store]);
buyButton.OnClicked = BuyItems;
storeItemList = new GUIListBox(new Rectangle(0, 30, sellColumnWidth, 400), Color.White * 0.7f, Alignment.TopRight, GUI.Style, bottomPanel[(int)PanelTab.Store]);
storeItemList.OnSelected = SelectItem;
int x = selectedItemList.Rect.Width + 40;
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
{
@@ -149,14 +152,15 @@ namespace Barotrauma
var categoryButton = new GUIButton(new Rectangle(x, 0, 100, 20), category.ToString(), GUI.Style, bottomPanel[(int)PanelTab.Store]);
categoryButton.UserData = category;
categoryButton.OnClicked = SelectItemCategory;
if (category==MapEntityCategory.Equipment)
{
SelectItemCategory(categoryButton, category);
}
x += 110;
storeItemList = new GUIListBox(new Rectangle(0, 30, sellColumnWidth, 400), Color.White * 0.7f, Alignment.TopRight, GUI.Style, bottomPanel[(int)PanelTab.Store]);
storeItemList.OnSelected = SelectItem;
storeItemList.UserData = category;
}
SelectItemCategory(null, MapEntityCategory.Item);
}
@@ -184,6 +188,8 @@ namespace Barotrauma
{
topPanel.RemoveChild(topPanel.FindChild("locationtitle"));
topPanel.UserData = location;
var locationTitle = new GUITextBlock(new Rectangle(0, 0, 200, 25),
"Location: "+location.Name, Color.Transparent, Color.White, Alignment.TopLeft, GUI.Style, topPanel);
locationTitle.UserData = "locationtitle";
@@ -263,7 +269,7 @@ namespace Barotrauma
}
}
private void CreateItemFrame(MapEntityPrefab ep, GUIListBox listBox)
private void CreateItemFrame(MapEntityPrefab ep, GUIListBox listBox, int width)
{
Color color = ((listBox.CountChildren % 2) == 0) ? Color.Transparent : Color.White * 0.1f;
@@ -277,27 +283,28 @@ namespace Barotrauma
SpriteFont font = listBox.Rect.Width < 280 ? GUI.SmallFont : GUI.Font;
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(40, 0, 0, 25),
new Rectangle(50, 0, 0, 25),
ep.Name,
Color.Transparent, Color.White,
Alignment.Left, Alignment.Left,
Alignment.Left, Alignment.CenterX | Alignment.Left,
null, frame);
textBlock.Font = font;
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f);
textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
ep.Price.ToString(),
null, null,
Alignment.TopRight, GUI.Style, textBlock);
textBlock.Font = font;
if (ep.sprite != null)
{
GUIImage img = new GUIImage(new Rectangle(0, 0, 40, 40), ep.sprite, Alignment.Left, frame);
img.Color = ep.SpriteColor;
img.Scale = Math.Min(Math.Min(40.0f / img.SourceRect.Width, 40.0f / img.SourceRect.Height), 1.0f);
}
textBlock = new GUITextBlock(
new Rectangle(width - 80, 0, 80, 25),
ep.Price.ToString(),
null, null, Alignment.TopLeft,
Alignment.TopLeft, GUI.Style, frame);
textBlock.Font = font;
}
private bool SelectItem(GUIComponent component, object obj)
@@ -305,7 +312,7 @@ namespace Barotrauma
MapEntityPrefab prefab = obj as MapEntityPrefab;
if (prefab == null) return false;
CreateItemFrame(prefab, selectedItemList);
CreateItemFrame(prefab, selectedItemList, selectedItemList.Rect.Width);
buyButton.Enabled = CrewManager.Money >= selectedItemCost;
@@ -388,8 +395,8 @@ namespace Barotrauma
bottomPanel[selectedRightPanel].Rect.Width - 310,
bottomPanel[selectedRightPanel].Rect.Height - 40), mapZoom);
}
if (bottomPanel[(int)selectedRightPanel].UserData as Location != GameMain.GameSession.Map.CurrentLocation)
if (topPanel.UserData as Location != GameMain.GameSession.Map.CurrentLocation)
{
UpdateLocationTab(GameMain.GameSession.Map.CurrentLocation);
}
@@ -438,13 +445,25 @@ namespace Barotrauma
MapEntityCategory category = (MapEntityCategory)selection;
var items = MapEntityPrefab.list.FindAll(ep => ep.Price > 0.0f && ep.Category == category);
int width = storeItemList.Rect.Width;
foreach (MapEntityPrefab ep in items)
{
CreateItemFrame(ep, storeItemList);
CreateItemFrame(ep, storeItemList, width);
}
storeItemList.children.Sort((x, y) => (x.UserData as MapEntityPrefab).Name.CompareTo((y.UserData as MapEntityPrefab).Name));
foreach (GUIComponent child in button.Parent.children)
{
var otherButton = child as GUIButton;
if (child.UserData is MapEntityCategory && otherButton != button)
{
otherButton.Selected = false;
}
}
button.Selected = true;
return true;
}

View File

@@ -233,13 +233,15 @@ namespace Barotrauma
private bool ApplySettings(GUIButton button, object obj)
{
GameMain.Config.Save("config.xml");
selectedTab = (int)obj;
selectedTab = 0;
if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
{
new GUIMessageBox("Restart required", "You need to restart the game for the resolution changes to take effect.");
}
return true;
}

View File

@@ -55,7 +55,7 @@ namespace Barotrauma
public static float MusicVolume = 1.0f;
private const float MusicLerpSpeed = 0.01f;
private const float MusicLerpSpeed = 0.1f;
private static Sound[] waterAmbiences = new Sound[2];
private static int[] waterAmbienceIndexes = new int[2];
@@ -70,9 +70,17 @@ namespace Barotrauma
private static Sound startDrone;
public static bool Initialized;
public static string OverrideMusicType
{
get;
set;
}
public static IEnumerable<object> Init()
{
OverrideMusicType = null;
startDrone = Sound.Load("Content/Sounds/startDrone.ogg", false);
startDrone.Play();
@@ -226,9 +234,13 @@ namespace Barotrauma
}
}
}
List<BackgroundMusic> suitableMusic = null;
if (Submarine.Loaded!=null && Submarine.Loaded.Position.Y<SubmarineBody.DamageDepth+10000.0f)
if (OverrideMusicType != null)
{
suitableMusic = musicClips.Where(x => x != null && x.type == OverrideMusicType).ToList();
}
else if (Submarine.Loaded!=null && Submarine.Loaded.Position.Y<SubmarineBody.DamageDepth+10000.0f)
{
suitableMusic = musicClips.Where(x => x != null && x.type == "deep").ToList();
}

Binary file not shown.