Merge remote-tracking branch 'refs/remotes/barotrauma/master'

Conflicts:
	Subsurface/Properties/AssemblyInfo.cs
	Subsurface/Source/Characters/Character.cs
	Subsurface/Source/GUI/GUI.cs
	Subsurface/Source/GameMain.cs
	Subsurface/Source/GameSettings.cs
	Subsurface/Source/Items/CharacterInventory.cs
	Subsurface/Source/Items/Components/ItemComponent.cs
	Subsurface/Source/Items/Components/Machines/Pump.cs
	Subsurface/Source/Items/Components/Machines/Radar.cs
	Subsurface/Source/Items/Components/Machines/Steering.cs
	Subsurface/Source/Items/Components/Power/PowerContainer.cs
	Subsurface/Source/Items/Inventory.cs
	Subsurface/Source/Items/Item.cs
	Subsurface/Source/Items/ItemSpawner.cs
	Subsurface/Source/Map/Levels/WaterRenderer.cs
	Subsurface/Source/Map/LinkedSubmarine.cs
	Subsurface/Source/Map/Map/Map.cs
	Subsurface/Source/Map/Structure.cs
	Subsurface/Source/Map/Submarine.cs
	Subsurface/Source/Map/WayPoint.cs
	Subsurface/Source/Networking/GameClient.cs
	Subsurface/Source/Networking/GameServer.cs
	Subsurface/Source/Physics/PhysicsBody.cs
	Subsurface/Source/Screens/GameScreen.cs
This commit is contained in:
juanjp600
2016-10-11 20:19:25 -03:00
130 changed files with 4428 additions and 67178 deletions
-15
View File
@@ -1,15 +0,0 @@
#----------------------------- Global Properties ----------------------------#
/outputDir:bin/Windows
/intermediateDir:obj/Windows
/platform:Windows
/config:
/profile:Reach
/compress:False
#-------------------------------- References --------------------------------#
#---------------------------------- Content ---------------------------------#
-73
View File
@@ -1,73 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{6BE950CD-9A34-49C9-939A-786AC89C287E}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CrashReporter</RootNamespace>
<AssemblyName>CrashReporter</AssemblyName>
<FileAlignment>512</FileAlignment>
<MonoGamePlatform>Windows</MonoGamePlatform>
<MonoGameContentBuilderExe>
</MonoGameContentBuilderExe>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Windows\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Windows\Release\</OutputPath>
<DefineConstants>TRACE;WINDOWS</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Compile Include="ReporterMain.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="MonoGame.Framework">
<HintPath>$(MSBuildProgramFiles32)\MonoGame\v3.0\Assemblies\Windows\MonoGame.Framework.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Content Include="Icon.ico" />
</ItemGroup>
<ItemGroup>
<MonoGameContentReference Include="Content\Content.mgcb" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Subsurface\Barotrauma.csproj">
<Project>{008c0f83-e914-4966-9135-ea885059edd8}</Project>
<Name>Barotrauma</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 144 KiB

-26
View File
@@ -1,26 +0,0 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
#endregion
namespace CrashReporter
{
#if WINDOWS || LINUX
/// <summary>
/// The main class.
/// </summary>
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
using (var game = new ReporterMain())
game.Run();
}
}
#endif
}
-36
View File
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("CrashReporter")]
[assembly: AssemblyProduct("CrashReporter")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5087c690-b7c4-4087-979a-a064ada558b4")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.3.0.2069")]
[assembly: AssemblyFileVersion("3.3.0.2069")]
-147
View File
@@ -1,147 +0,0 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Barotrauma;
using System.IO;
namespace CrashReporter
{
/// <summary>
/// This is the main type for your game
/// </summary>
public class ReporterMain : Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
int graphicsWidth, graphicsHeight;
Texture2D backgroundTexture, titleTexture;
GUIFrame guiRoot;
string crashReport;
public ReporterMain()
: base()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
graphics = new GraphicsDeviceManager(this);
graphics.PreferredBackBufferWidth = 640;
graphics.PreferredBackBufferHeight = 360;
}
/// <summary>
/// Allows the game to perform any initialization it needs to before starting to run.
/// This is where it can query for any required services and load any non-graphic
/// related content. Calling base.Initialize will enumerate through any components
/// and initialize them as well.
/// </summary>
protected override void Initialize()
{
// TODO: Add your initialization logic here
base.Initialize();
}
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
graphicsWidth = GraphicsDevice.Viewport.Width;
graphicsHeight = GraphicsDevice.Viewport.Height;
TextureLoader.Init(GraphicsDevice);
GUI.Init(Content);
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
GUI.LoadContent(GraphicsDevice);
backgroundTexture = TextureLoader.FromFile("Content/UI/titleBackground.png");
titleTexture = TextureLoader.FromFile("Content/UI/titleText.png");
guiRoot = new GUIFrame(new Rectangle(0, 0, graphicsWidth, graphicsHeight), Color.Transparent);
guiRoot.Padding = new Vector4(40.0f, 40.0f, 40.0f, 40.0f);
GUIListBox infoBox = new GUIListBox(new Rectangle(0, 0, 330, 150), GUI.Style, guiRoot);
infoBox.Visible = false;
crashReport = System.IO.File.ReadAllText("CrashReport.txt");
string wrappedText = ToolBox.WrapText(crashReport, infoBox.Rect.Width, GUI.SmallFont);
int lineHeight = (int)GUI.SmallFont.MeasureString(" ").Y;
string[] lines = wrappedText.Split('\n');
foreach (string line in lines)
{
if (string.IsNullOrWhiteSpace(line)) continue;
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, lineHeight),
line, GUI.Style,
Alignment.TopLeft, Alignment.TopLeft,
infoBox, false, GUI.SmallFont);
textBlock.CanBeFocused = false;
}
GUIButton sendButton = new GUIButton(new Rectangle(0, 0, 100, 30), "SEND", Alignment.BottomRight, GUI.Style, guiRoot);
//se.OnClicked = LaunchClick;
}
/// <summary>
/// UnloadContent will be called once per game and is the place to unload
/// all content.
/// </summary>
protected override void UnloadContent()
{
// TODO: Unload any non ContentManager content here
}
/// <summary>
/// Allows the game to run logic such as updating the world,
/// checking for collisions, gathering input, and playing audio.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
Exit();
// TODO: Add your update logic here
base.Update(gameTime);
guiRoot.Update((float)gameTime.ElapsedGameTime.TotalMilliseconds);
}
/// <summary>
/// This is called when the game should draw itself.
/// </summary>
/// <param name="gameTime">Provides a snapshot of timing values.</param>
protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin();
guiRoot.Draw(spriteBatch);
spriteBatch.End();
}
private void SendReport()
{
}
}
}
-416
View File
@@ -1,416 +0,0 @@
<stylecopresultscache>
<version>12</version>
<project key="-635107402">
<configuration>DEBUG;TRACE;WINDOWS</configuration>
</project>
<sourcecode name="Game1.cs" parser="StyleCop.CSharp.CsParser">
<timestamps>
<styleCop>2014.04.01 10:18:24.000</styleCop>
<settingsFile>2012.09.27 21:03:32.000</settingsFile>
<sourceFile>2015.09.17 23:21:18.138</sourceFile>
<parser>2014.04.01 10:18:24.000</parser>
<StyleCop.CSharp.DocumentationRules>2014.04.01 10:18:24.000</StyleCop.CSharp.DocumentationRules>
<StyleCop.CSharp.DocumentationRules.FilesHashCode>-1945363787</StyleCop.CSharp.DocumentationRules.FilesHashCode>
<StyleCop.CSharp.LayoutRules>2014.04.01 10:18:24.000</StyleCop.CSharp.LayoutRules>
<StyleCop.CSharp.LayoutRules.FilesHashCode>0</StyleCop.CSharp.LayoutRules.FilesHashCode>
<StyleCop.CSharp.MaintainabilityRules>2014.04.01 10:18:24.000</StyleCop.CSharp.MaintainabilityRules>
<StyleCop.CSharp.MaintainabilityRules.FilesHashCode>0</StyleCop.CSharp.MaintainabilityRules.FilesHashCode>
<StyleCop.CSharp.NamingRules>2014.04.01 10:18:24.000</StyleCop.CSharp.NamingRules>
<StyleCop.CSharp.NamingRules.FilesHashCode>0</StyleCop.CSharp.NamingRules.FilesHashCode>
<StyleCop.CSharp.OrderingRules>2014.04.01 10:18:24.000</StyleCop.CSharp.OrderingRules>
<StyleCop.CSharp.OrderingRules.FilesHashCode>0</StyleCop.CSharp.OrderingRules.FilesHashCode>
<StyleCop.CSharp.ReadabilityRules>2014.04.01 10:18:24.000</StyleCop.CSharp.ReadabilityRules>
<StyleCop.CSharp.ReadabilityRules.FilesHashCode>0</StyleCop.CSharp.ReadabilityRules.FilesHashCode>
<StyleCop.CSharp.SpacingRules>2014.04.01 10:18:24.000</StyleCop.CSharp.SpacingRules>
<StyleCop.CSharp.SpacingRules.FilesHashCode>0</StyleCop.CSharp.SpacingRules.FilesHashCode>
</timestamps>
<violations>
<violation namespace="StyleCop.CSharp.DocumentationRules" rule="FileMustHaveHeader" ruleCheckId="SA1633">
<context>The file has no header, the header Xml is invalid, or the header is not located at the top of the file.</context>
<line>1</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.OrderingRules" rule="UsingDirectivesMustBePlacedWithinNamespace" ruleCheckId="SA1200">
<context>All using directives must be placed inside of the namespace.</context>
<line>1</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.OrderingRules" rule="UsingDirectivesMustBePlacedWithinNamespace" ruleCheckId="SA1200">
<context>All using directives must be placed inside of the namespace.</context>
<line>2</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.OrderingRules" rule="UsingDirectivesMustBePlacedWithinNamespace" ruleCheckId="SA1200">
<context>All using directives must be placed inside of the namespace.</context>
<line>3</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.OrderingRules" rule="UsingDirectivesMustBePlacedWithinNamespace" ruleCheckId="SA1200">
<context>All using directives must be placed inside of the namespace.</context>
<line>4</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.OrderingRules" rule="UsingDirectivesMustBePlacedWithinNamespace" ruleCheckId="SA1200">
<context>All using directives must be placed inside of the namespace.</context>
<line>5</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.OrderingRules" rule="SystemUsingDirectivesMustBePlacedBeforeOtherUsingDirectives" ruleCheckId="SA1208">
<context>System using directives must be placed before all other using directives.</context>
<line>5</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.LayoutRules" rule="CodeMustNotContainMultipleBlankLinesInARow" ruleCheckId="SA1507">
<context>The code must not contain multiple blank lines in a row.</context>
<line>23</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.LayoutRules" rule="CodeMustNotContainMultipleBlankLinesInARow" ruleCheckId="SA1507">
<context>The code must not contain multiple blank lines in a row.</context>
<line>24</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.DocumentationRules" rule="ElementsMustBeDocumented" ruleCheckId="SA1600">
<context>The field must have a documentation header.</context>
<line>14</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.MaintainabilityRules" rule="AccessModifierMustBeDeclared" ruleCheckId="SA1400">
<context>The field must have an access modifier.</context>
<line>14</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.DocumentationRules" rule="ElementsMustBeDocumented" ruleCheckId="SA1600">
<context>The field must have a documentation header.</context>
<line>15</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.MaintainabilityRules" rule="AccessModifierMustBeDeclared" ruleCheckId="SA1400">
<context>The field must have an access modifier.</context>
<line>15</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.DocumentationRules" rule="ElementsMustBeDocumented" ruleCheckId="SA1600">
<context>The field must have a documentation header.</context>
<line>17</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.MaintainabilityRules" rule="AccessModifierMustBeDeclared" ruleCheckId="SA1400">
<context>The field must have an access modifier.</context>
<line>17</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.DocumentationRules" rule="ElementsMustBeDocumented" ruleCheckId="SA1600">
<context>The field must have a documentation header.</context>
<line>19</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.MaintainabilityRules" rule="AccessModifierMustBeDeclared" ruleCheckId="SA1400">
<context>The field must have an access modifier.</context>
<line>19</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.DocumentationRules" rule="ElementsMustBeDocumented" ruleCheckId="SA1600">
<context>The field must have a documentation header.</context>
<line>21</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.MaintainabilityRules" rule="AccessModifierMustBeDeclared" ruleCheckId="SA1400">
<context>The field must have an access modifier.</context>
<line>21</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.DocumentationRules" rule="ElementsMustBeDocumented" ruleCheckId="SA1600">
<context>The constructor must have a documentation header.</context>
<line>25</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to graphics must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>28</line>
<index>601</index>
<endIndex>608</endIndex>
<startLine>28</startLine>
<startColumn>13</startColumn>
<endLine>28</endLine>
<endColumn>20</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to graphics must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>31</line>
<index>708</index>
<endIndex>715</endIndex>
<startLine>31</startLine>
<startColumn>13</startColumn>
<endLine>31</endLine>
<endColumn>20</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to graphics must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>32</line>
<index>765</index>
<endIndex>772</endIndex>
<startLine>32</startLine>
<startColumn>13</startColumn>
<endLine>32</endLine>
<endColumn>20</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to graphics must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>33</line>
<index>819</index>
<endIndex>826</endIndex>
<startLine>33</startLine>
<startColumn>13</startColumn>
<endLine>33</endLine>
<endColumn>20</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.LayoutRules" rule="SingleLineCommentsMustNotBeFollowedByBlankLine" ruleCheckId="SA1512">
<context>A single-line comment must not be followed by a blank line. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.</context>
<line>44</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.LayoutRules" rule="CurlyBracketsMustNotBeOmitted" ruleCheckId="SA1503">
<context>The body of the if statement must be wrapped in opening and closing curly brackets.</context>
<line>88</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.LayoutRules" rule="SingleLineCommentMustBePrecededByBlankLine" ruleCheckId="SA1515">
<context>A single-line comment must be preceded by a blank line or another single-line comment, or must be the first item in its scope. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.</context>
<line>99</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="ParametersMustBeOnSameLineOrSeparateLines" ruleCheckId="SA1117">
<context>All method parameters must be placed on the same line, or each parameter must be placed on a separate line.</context>
<line>90</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="ParameterMustFollowComma" ruleCheckId="SA1115">
<context>The parameter must begin on the line after the previous parameter.</context>
<line>92</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="ParameterMustFollowComma" ruleCheckId="SA1115">
<context>The parameter must begin on the line after the previous parameter.</context>
<line>93</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="ParameterMustFollowComma" ruleCheckId="SA1115">
<context>The parameter must begin on the line after the previous parameter.</context>
<line>94</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to spriteBatch must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>56</line>
<index>1712</index>
<endIndex>1722</endIndex>
<startLine>56</startLine>
<startColumn>13</startColumn>
<endLine>56</endLine>
<endColumn>23</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to graphicsWidth must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>58</line>
<index>1774</index>
<endIndex>1786</endIndex>
<startLine>58</startLine>
<startColumn>13</startColumn>
<endLine>58</endLine>
<endColumn>25</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to graphicsHeight must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>59</line>
<index>1834</index>
<endIndex>1847</endIndex>
<startLine>59</startLine>
<startColumn>13</startColumn>
<endLine>59</endLine>
<endColumn>26</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to GraphicsDevice must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>61</line>
<index>1917</index>
<endIndex>1930</endIndex>
<startLine>61</startLine>
<startColumn>32</startColumn>
<endLine>61</endLine>
<endColumn>45</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to Content must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>63</line>
<index>1958</index>
<endIndex>1964</endIndex>
<startLine>63</startLine>
<startColumn>22</startColumn>
<endLine>63</endLine>
<endColumn>28</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to spriteBatch must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>66</line>
<index>2061</index>
<endIndex>2071</endIndex>
<startLine>66</startLine>
<startColumn>13</startColumn>
<endLine>66</endLine>
<endColumn>23</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to GraphicsDevice must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>68</line>
<index>2139</index>
<endIndex>2152</endIndex>
<startLine>68</startLine>
<startColumn>29</startColumn>
<endLine>68</endLine>
<endColumn>42</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to backgroundTexture must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>70</line>
<index>2171</index>
<endIndex>2187</endIndex>
<startLine>70</startLine>
<startColumn>13</startColumn>
<endLine>70</endLine>
<endColumn>29</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to titleTexture must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>71</line>
<index>2262</index>
<endIndex>2273</endIndex>
<startLine>71</startLine>
<startColumn>13</startColumn>
<endLine>71</endLine>
<endColumn>24</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to guiRoot must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>73</line>
<index>2344</index>
<endIndex>2350</endIndex>
<startLine>73</startLine>
<startColumn>13</startColumn>
<endLine>73</endLine>
<endColumn>19</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to graphicsWidth must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>73</line>
<index>2387</index>
<endIndex>2399</endIndex>
<startLine>73</startLine>
<startColumn>56</startColumn>
<endLine>73</endLine>
<endColumn>68</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to graphicsHeight must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>73</line>
<index>2402</index>
<endIndex>2415</endIndex>
<startLine>73</startLine>
<startColumn>71</startColumn>
<endLine>73</endLine>
<endColumn>84</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to guiRoot must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>74</line>
<index>2452</index>
<endIndex>2458</endIndex>
<startLine>74</startLine>
<startColumn>13</startColumn>
<endLine>74</endLine>
<endColumn>19</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to guiRoot must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>76</line>
<index>2616</index>
<endIndex>2622</endIndex>
<startLine>76</startLine>
<startColumn>91</startColumn>
<endLine>76</endLine>
<endColumn>97</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to guiRoot must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>98</line>
<index>3542</index>
<endIndex>3548</endIndex>
<startLine>98</startLine>
<startColumn>122</startColumn>
<endLine>98</endLine>
<endColumn>128</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="UseStringEmptyForEmptyStrings" ruleCheckId="SA1122">
<context>Use string.Empty rather than "".</context>
<line>79</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.SpacingRules" rule="SingleLineCommentsMustBeginWithSingleSpace" ruleCheckId="SA1005">
<context>The comment must start with a single space. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.</context>
<line>99</line>
<index>3565</index>
<endIndex>3593</endIndex>
<startLine>99</startLine>
<startColumn>13</startColumn>
<endLine>99</endLine>
<endColumn>41</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.LayoutRules" rule="CurlyBracketsMustNotBeOmitted" ruleCheckId="SA1503">
<context>The body of the if statement must be wrapped in opening and closing curly brackets.</context>
<line>119</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.LayoutRules" rule="SingleLineCommentsMustNotBeFollowedByBlankLine" ruleCheckId="SA1512">
<context>A single-line comment must not be followed by a blank line. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.</context>
<line>121</line>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.ReadabilityRules" rule="PrefixCallsCorrectly" ruleCheckId="SA1126">
<context>The call to Exit must begin with the 'this.', 'base.', 'object.' or 'ReporterMain.' or 'Game.' prefix to indicate the intended method call. </context>
<line>119</line>
<index>4396</index>
<endIndex>4399</endIndex>
<startLine>119</startLine>
<startColumn>17</startColumn>
<endLine>119</endLine>
<endColumn>20</endColumn>
<warning>False</warning>
</violation>
<violation namespace="StyleCop.CSharp.LayoutRules" rule="SingleLineCommentsMustNotBeFollowedByBlankLine" ruleCheckId="SA1512">
<context>A single-line comment must not be followed by a blank line. To ignore this error when commenting out a line of code, begin the comment with '////' rather than '//'.</context>
<line>134</line>
<warning>False</warning>
</violation>
</violations>
</sourcecode>
</stylecopresultscache>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
</configuration>
-256
View File
@@ -1,256 +0,0 @@
namespace Launcher
{
partial class LauncherMain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LauncherMain));
this.launchButton = new System.Windows.Forms.Button();
this.resolutionBox = new System.Windows.Forms.ComboBox();
this.label1 = new System.Windows.Forms.Label();
this.fullscreenBox = new System.Windows.Forms.CheckBox();
this.contentPackageBox = new System.Windows.Forms.ComboBox();
this.label2 = new System.Windows.Forms.Label();
this.packageManagerButton = new System.Windows.Forms.Button();
this.installedVersionLabel = new System.Windows.Forms.Label();
this.autoUpdateCheckBox = new System.Windows.Forms.CheckBox();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.patchNoteBox = new System.Windows.Forms.TextBox();
this.updateLabel = new System.Windows.Forms.Label();
this.downloadButton = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// launchButton
//
this.launchButton.BackColor = System.Drawing.Color.OrangeRed;
this.launchButton.FlatAppearance.BorderColor = System.Drawing.Color.OrangeRed;
this.launchButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.launchButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.launchButton.ForeColor = System.Drawing.SystemColors.ControlText;
this.launchButton.Location = new System.Drawing.Point(455, 399);
this.launchButton.Name = "launchButton";
this.launchButton.Size = new System.Drawing.Size(161, 42);
this.launchButton.TabIndex = 1;
this.launchButton.Text = "LAUNCH";
this.launchButton.UseVisualStyleBackColor = false;
this.launchButton.Click += new System.EventHandler(this.launchButton_Click);
//
// resolutionBox
//
this.resolutionBox.AllowDrop = true;
this.resolutionBox.FormattingEnabled = true;
this.resolutionBox.Location = new System.Drawing.Point(369, 236);
this.resolutionBox.Name = "resolutionBox";
this.resolutionBox.Size = new System.Drawing.Size(212, 21);
this.resolutionBox.TabIndex = 2;
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.ForeColor = System.Drawing.SystemColors.Window;
this.label1.Location = new System.Drawing.Point(366, 220);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(60, 13);
this.label1.TabIndex = 3;
this.label1.Text = "Resolution:";
//
// fullscreenBox
//
this.fullscreenBox.AutoSize = true;
this.fullscreenBox.BackColor = System.Drawing.Color.Transparent;
this.fullscreenBox.ForeColor = System.Drawing.SystemColors.Window;
this.fullscreenBox.Location = new System.Drawing.Point(369, 281);
this.fullscreenBox.Name = "fullscreenBox";
this.fullscreenBox.Size = new System.Drawing.Size(74, 17);
this.fullscreenBox.TabIndex = 4;
this.fullscreenBox.Text = "Fullscreen";
this.fullscreenBox.UseVisualStyleBackColor = false;
//
// contentPackageBox
//
this.contentPackageBox.FormattingEnabled = true;
this.contentPackageBox.Location = new System.Drawing.Point(369, 138);
this.contentPackageBox.Name = "contentPackageBox";
this.contentPackageBox.Size = new System.Drawing.Size(212, 21);
this.contentPackageBox.TabIndex = 5;
this.contentPackageBox.SelectedIndexChanged += new System.EventHandler(this.contentPackageBox_SelectedIndexChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.ForeColor = System.Drawing.SystemColors.Window;
this.label2.Location = new System.Drawing.Point(366, 122);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(92, 13);
this.label2.TabIndex = 6;
this.label2.Text = "Content package:";
//
// packageManagerButton
//
this.packageManagerButton.BackColor = System.Drawing.Color.OrangeRed;
this.packageManagerButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.packageManagerButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.packageManagerButton.Location = new System.Drawing.Point(369, 165);
this.packageManagerButton.Name = "packageManagerButton";
this.packageManagerButton.Size = new System.Drawing.Size(120, 35);
this.packageManagerButton.TabIndex = 7;
this.packageManagerButton.Text = "Package manager";
this.packageManagerButton.UseVisualStyleBackColor = false;
this.packageManagerButton.Click += new System.EventHandler(this.packageManagerButton_Click);
//
// installedVersionLabel
//
this.installedVersionLabel.BackColor = System.Drawing.Color.Transparent;
this.installedVersionLabel.ForeColor = System.Drawing.SystemColors.ControlLightLight;
this.installedVersionLabel.Location = new System.Drawing.Point(-8, 78);
this.installedVersionLabel.Name = "installedVersionLabel";
this.installedVersionLabel.Size = new System.Drawing.Size(644, 23);
this.installedVersionLabel.TabIndex = 8;
this.installedVersionLabel.Text = "Installed version:";
this.installedVersionLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// autoUpdateCheckBox
//
this.autoUpdateCheckBox.AutoSize = true;
this.autoUpdateCheckBox.BackColor = System.Drawing.Color.Transparent;
this.autoUpdateCheckBox.ForeColor = System.Drawing.SystemColors.Window;
this.autoUpdateCheckBox.Location = new System.Drawing.Point(47, 122);
this.autoUpdateCheckBox.Name = "autoUpdateCheckBox";
this.autoUpdateCheckBox.Size = new System.Drawing.Size(177, 17);
this.autoUpdateCheckBox.TabIndex = 9;
this.autoUpdateCheckBox.Text = "Automatically check for updates";
this.autoUpdateCheckBox.UseVisualStyleBackColor = false;
//
// progressBar
//
this.progressBar.Location = new System.Drawing.Point(129, 407);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(207, 30);
this.progressBar.TabIndex = 10;
//
// patchNoteBox
//
this.patchNoteBox.AcceptsReturn = true;
this.patchNoteBox.Location = new System.Drawing.Point(47, 145);
this.patchNoteBox.Multiline = true;
this.patchNoteBox.Name = "patchNoteBox";
this.patchNoteBox.ReadOnly = true;
this.patchNoteBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.patchNoteBox.Size = new System.Drawing.Size(289, 226);
this.patchNoteBox.TabIndex = 11;
//
// updateLabel
//
this.updateLabel.AutoSize = true;
this.updateLabel.BackColor = System.Drawing.Color.Transparent;
this.updateLabel.ForeColor = System.Drawing.SystemColors.ButtonHighlight;
this.updateLabel.Location = new System.Drawing.Point(44, 383);
this.updateLabel.Name = "updateLabel";
this.updateLabel.Size = new System.Drawing.Size(98, 13);
this.updateLabel.TabIndex = 12;
this.updateLabel.Text = "New update found!";
//
// downloadButton
//
this.downloadButton.BackColor = System.Drawing.Color.OrangeRed;
this.downloadButton.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.downloadButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.downloadButton.Location = new System.Drawing.Point(47, 407);
this.downloadButton.Name = "downloadButton";
this.downloadButton.Size = new System.Drawing.Size(76, 30);
this.downloadButton.TabIndex = 13;
this.downloadButton.Text = "Download";
this.downloadButton.UseVisualStyleBackColor = false;
this.downloadButton.Click += new System.EventHandler(this.downloadButton_Click);
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
this.pictureBox1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(-8, 12);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(644, 63);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
//
// LauncherMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ClientSize = new System.Drawing.Size(628, 453);
this.Controls.Add(this.downloadButton);
this.Controls.Add(this.updateLabel);
this.Controls.Add(this.patchNoteBox);
this.Controls.Add(this.progressBar);
this.Controls.Add(this.autoUpdateCheckBox);
this.Controls.Add(this.installedVersionLabel);
this.Controls.Add(this.packageManagerButton);
this.Controls.Add(this.label2);
this.Controls.Add(this.contentPackageBox);
this.Controls.Add(this.fullscreenBox);
this.Controls.Add(this.label1);
this.Controls.Add(this.launchButton);
this.Controls.Add(this.resolutionBox);
this.Controls.Add(this.pictureBox1);
this.DoubleBuffered = true;
this.Name = "LauncherMain";
this.Text = "Launcher";
this.Load += new System.EventHandler(this.LauncherMain_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button launchButton;
private System.Windows.Forms.ComboBox resolutionBox;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.CheckBox fullscreenBox;
private System.Windows.Forms.ComboBox contentPackageBox;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button packageManagerButton;
private System.Windows.Forms.Label installedVersionLabel;
private System.Windows.Forms.CheckBox autoUpdateCheckBox;
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.TextBox patchNoteBox;
private System.Windows.Forms.Label updateLabel;
private System.Windows.Forms.Button downloadButton;
private System.Windows.Forms.PictureBox pictureBox1;
}
}
-410
View File
@@ -1,410 +0,0 @@
using RestSharp;
using Barotrauma;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Linq;
namespace Launcher
{
public partial class LauncherMain : Form
{
string version = AssemblyName.GetAssemblyName("Barotrauma.exe").Version.ToString();
private const string configPath = "config.xml";
private Barotrauma.GameSettings settings;
private string latestVersionFileList, latestVersionFolder;
[DllImport("user32.dll")]
public static extern bool EnumDisplaySettings(
string deviceName, int modeNum, ref DEVMODE devMode);
const int ENUM_CURRENT_SETTINGS = -1;
const int ENUM_REGISTRY_SETTINGS = -2;
private List<GraphicsMode> supportedModes;
public bool FullScreenEnabled
{
get { return settings.FullScreenEnabled; }
set { settings.FullScreenEnabled = value; }
}
public bool AutoCheckUpdates
{
get { return settings.AutoCheckUpdates; }
set { settings.AutoCheckUpdates = value; }
}
//private GraphicsMode selectedMode;
public LauncherMain()
{
InitializeComponent();
ContentPackage.LoadAll(ContentPackage.Folder);
contentPackageBox.DataSource = ContentPackage.list;
supportedModes = new List<GraphicsMode>();
DEVMODE vDevMode = new DEVMODE();
int i = 0;
while (EnumDisplaySettings(null, i, ref vDevMode))
{
if (vDevMode.dmBitsPerPel < 16 || supportedModes.FirstOrDefault(sm => sm.Width == vDevMode.dmPelsWidth && sm.Height == vDevMode.dmPelsHeight) != null)
{
i++;
continue;
}
supportedModes.Add(
new GraphicsMode(vDevMode.dmPelsWidth,
vDevMode.dmPelsHeight,
vDevMode.dmBitsPerPel, vDevMode.dmDisplayFrequency));
i++;
}
resolutionBox.DataSource = new BindingList<GraphicsMode>(supportedModes);
//resolutionBox.SelectedIndexChanged =
//LoadSettings(configPath);
settings = new GameSettings(configPath);
resolutionBox.SelectedItem = supportedModes.FirstOrDefault(sm => sm.Width == settings.GraphicsWidth && sm.Height == settings.GraphicsHeight);
if (resolutionBox.SelectedItem == null)
{
resolutionBox.SelectedItem = supportedModes.FirstOrDefault(sm =>
sm.Width == Screen.PrimaryScreen.Bounds.Width &&
sm.Height == Screen.PrimaryScreen.Bounds.Height);
if (resolutionBox.SelectedItem == null) resolutionBox.SelectedItem = supportedModes[0];
}
fullscreenBox.DataBindings.Add("Checked", this, "FullscreenEnabled");
autoUpdateCheckBox.DataBindings.Add("Checked", this, "AutoCheckUpdates");
if (settings.SelectedContentPackage == null)
{
if (contentPackageBox.Items.Count > 0) contentPackageBox.SelectedItem = contentPackageBox.Items[0];
}
else
{
contentPackageBox.SelectedItem = settings.SelectedContentPackage;
}
progressBar.Visible = false;
updateLabel.Visible = false;
downloadButton.Visible = false;
installedVersionLabel.Text = "Installed version: " + version;
if (settings.AutoCheckUpdates)
{
CheckForUpdates();
}
//resolutionBox.SelectedItem = selectedMode;
}
private void SaveSettings(string filePath)
{
GraphicsMode selectedMode = resolutionBox.SelectedItem as GraphicsMode;
settings.GraphicsWidth = selectedMode.Width;
settings.GraphicsHeight = selectedMode.Height;
settings.Save(configPath);
}
private void launchButton_Click(object sender, EventArgs e)
{
SaveSettings(configPath);
var executables = settings.SelectedContentPackage.GetFilesOfType(ContentType.Executable);
if (executables.Count == 0)
{
MessageBox.Show("Error", "The game executable isn't configured in the selected content package.");
return;
}
string exePath = Directory.GetCurrentDirectory() + "//" + executables[0];
if (!File.Exists(exePath))
{
MessageBox.Show("Error", "Couldn't find the executable ''" + exePath + "''!");
return;
}
try
{
Process.Start(new ProcessStartInfo(exePath));
}
catch (Exception exception)
{
MessageBox.Show("Error while opening executable ''" + exePath + "''", exception.Message);
return;
}
Application.Exit();
}
private void packageManagerButton_Click(object sender, EventArgs e)
{
var packageManager = new PackageManager(settings.SelectedContentPackage);
packageManager.Show();
}
private void contentPackageBox_SelectedIndexChanged(object sender, EventArgs e)
{
if (settings == null) return;
ComboBox comboBox = sender as ComboBox;
settings.SelectedContentPackage = comboBox.SelectedItem as ContentPackage;
}
private bool CheckForUpdates()
{
patchNoteBox.Text = "Checking for updates...";
XDocument doc = null;
try
{
doc = FetchXML("versioninfo.xml");
}
catch (Exception e)
{
patchNoteBox.Text = "Error while checking for updates: " + e.Message;
return false;
}
CheckUpdateXML(doc);
return true;
}
private XDocument FetchXML(string fileName)
{
var client = new RestClient(settings.MasterServerUrl);
var request = new RestRequest(fileName, Method.GET);
IRestResponse response = client.Execute(request);
if (response.ResponseStatus!= ResponseStatus.Completed) return null;
if (response.StatusCode != HttpStatusCode.OK) return null;
string xml = response.Content;
string _byteOrderMarkUtf8 = Encoding.UTF8.GetString(Encoding.UTF8.GetPreamble());
if (xml.StartsWith(_byteOrderMarkUtf8))
{
xml = xml.Remove(0, _byteOrderMarkUtf8.Length);
}
return XDocument.Parse(xml);
}
private bool CheckUpdateXML(XDocument doc)
{
if (doc.Root==null)
{
patchNoteBox.Text = "Error while checking for updates: could not parse update info";
return false;
}
progressBar.Visible = true;
downloadButton.Visible = true;
updateLabel.Visible = true;
string latestVersion = ToolBox.GetAttributeString(doc.Root, "latestversion", "");
latestVersionFolder = ToolBox.GetAttributeString(doc.Root, "latestversionfolder", "");
latestVersionFileList = ToolBox.GetAttributeString(doc.Root, "latestversionfilelist", "");
if (latestVersion == version)
{
patchNoteBox.Text = "Game is up to date!";
return false;
}
updateLabel.Text = "New update found! (" + latestVersion + ")";
XElement patchNotes = doc.Root.Element("patchnotes");
if (patchNotes!=null)
{
StringBuilder sb = new StringBuilder();
foreach (XElement patchNote in patchNotes.Elements())
{
string patchNumber = ToolBox.GetAttributeString(patchNote, "version", "");
//read the patch notes until we reach the user's version
if (patchNumber == version) break;
sb.AppendLine(ToolBox.ElementInnerText(patchNote));
sb.AppendLine("*************************************\n");
}
patchNoteBox.Text = sb.ToString();
}
return true;
}
private void downloadButton_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(latestVersionFolder)) return;
Button senderButton = sender as Button;
senderButton.Enabled = false;
XDocument doc = null;
try
{
doc = FetchXML("filelist.xml");
}
catch (Exception exception)
{
patchNoteBox.Text = "Error while checking for updates: " + exception.Message;
return;
}
filesToDownload = UpdaterUtil.GetRequiredFiles(doc);
string dir = Directory.GetCurrentDirectory();
filesToDownloadCount = filesToDownload.Count;
if (filesToDownloadCount>0)
{
WebClient webClient = new WebClient();
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
//webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
webClient.DownloadFileAsync(new Uri(latestVersionFolder + filesToDownload[0]), dir);
}
}
private List<string> filesToDownload;
private int filesDownloaded, filesToDownloadCount;
private void Completed(object sender, AsyncCompletedEventArgs e)
{
filesDownloaded++;
progressBar.Value = (int)(((float)filesDownloaded / (float)filesToDownloadCount) * 100.0f);//e.ProgressPercentage;
filesToDownload.RemoveAt(0);
if (filesToDownload.Count==0)
{
progressBar.Visible = false;
downloadButton.Visible = false;
updateLabel.Visible = false;
MessageBox.Show("Download completed!");
settings.WasGameUpdated = true;
return;
}
updateLabel.Text = "Downloading file "+ filesDownloaded + "/" + filesToDownloadCount + " ("+ filesToDownload[0] + ")";
WebClient webClient = new WebClient();
webClient.DownloadFileCompleted += new AsyncCompletedEventHandler(Completed);
//webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged);
string dir = Directory.GetCurrentDirectory();
string fileDir = Path.GetDirectoryName(filesToDownload[0]);
if (!string.IsNullOrWhiteSpace(fileDir) && !Directory.Exists(fileDir))
{
Directory.CreateDirectory(fileDir);
}
webClient.DownloadFileAsync(new Uri(latestVersionFolder + filesToDownload[0]), @dir + "\\" + filesToDownload[0]);
}
private void LauncherMain_Load(object sender, EventArgs e)
{
}
}
public class GraphicsMode
{
public readonly int Width, Height;
public readonly int Bits;
public readonly int Frequency;
public GraphicsMode(int width, int height, int bits, int freq)
{
Width = width;
Height = height;
Bits = bits;
Frequency = freq;
}
public override string ToString()
{
return Width + "x" + Height;// +", " + Bits + " bit, " + Frequency + " Hz";
}
}
[StructLayout(LayoutKind.Sequential)]
public struct DEVMODE
{
private const int CCHDEVICENAME = 0x20;
private const int CCHFORMNAME = 0x20;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)]
public string dmDeviceName;
public short dmSpecVersion;
public short dmDriverVersion;
public short dmSize;
public short dmDriverExtra;
public int dmFields;
public int dmPositionX;
public int dmPositionY;
public ScreenOrientation dmDisplayOrientation;
public int dmDisplayFixedOutput;
public short dmColor;
public short dmDuplex;
public short dmYResolution;
public short dmTTOption;
public short dmCollate;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 0x20)]
public string dmFormName;
public short dmLogPixels;
public int dmBitsPerPel;
public int dmPelsWidth;
public int dmPelsHeight;
public int dmDisplayFlags;
public int dmDisplayFrequency;
public int dmICMMethod;
public int dmICMIntent;
public int dmMediaType;
public int dmDitherType;
public int dmReserved1;
public int dmReserved2;
public int dmPanningWidth;
public int dmPanningHeight;
}
}
-28663
View File
File diff suppressed because it is too large Load Diff
BIN
View File
Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

-119
View File
@@ -1,119 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{24420B91-6CD9-4DE3-9ADD-2F2C7E1FB6BB}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Launcher</RootNamespace>
<AssemblyName>Launcher</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\Subsurface\bin\Windows\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<StartupObject>Launcher.Program</StartupObject>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\packages\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="PackageManager.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="PackageManager.Designer.cs">
<DependentUpon>PackageManager.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="PackageManager.resx">
<DependentUpon>PackageManager.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Subsurface\Barotrauma.csproj">
<Project>{008c0f83-e914-4966-9135-ea885059edd8}</Project>
<Name>Barotrauma</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Content Include="Icon.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
-6
View File
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ProjectFiles</ProjectView>
</PropertyGroup>
</Project>
-365
View File
@@ -1,365 +0,0 @@
namespace Launcher
{
partial class PackageManager
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PackageManager));
this.packageList = new System.Windows.Forms.ListBox();
this.newPackageName = new System.Windows.Forms.TextBox();
this.newPackage = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.itemList = new System.Windows.Forms.ListBox();
this.itemButton = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.characterList = new System.Windows.Forms.ListBox();
this.characterButton = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.structureList = new System.Windows.Forms.ListBox();
this.structureButton = new System.Windows.Forms.Button();
this.jobButton = new System.Windows.Forms.Button();
this.jobList = new System.Windows.Forms.ListBox();
this.label4 = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.characterFolder = new System.Windows.Forms.Button();
this.itemFolder = new System.Windows.Forms.Button();
this.structureFolder = new System.Windows.Forms.Button();
this.jobFolder = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label5 = new System.Windows.Forms.Label();
this.exeBox = new System.Windows.Forms.TextBox();
this.exeButton = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.SuspendLayout();
//
// packageList
//
this.packageList.FormattingEnabled = true;
this.packageList.Location = new System.Drawing.Point(12, 87);
this.packageList.Name = "packageList";
this.packageList.Size = new System.Drawing.Size(180, 381);
this.packageList.TabIndex = 3;
this.packageList.SelectedIndexChanged += new System.EventHandler(this.packageList_SelectedIndexChanged);
//
// newPackageName
//
this.newPackageName.Location = new System.Drawing.Point(12, 474);
this.newPackageName.Name = "newPackageName";
this.newPackageName.Size = new System.Drawing.Size(129, 20);
this.newPackageName.TabIndex = 4;
this.newPackageName.TextChanged += new System.EventHandler(this.newPackageName_TextChanged);
//
// newPackage
//
this.newPackage.Enabled = false;
this.newPackage.Location = new System.Drawing.Point(147, 474);
this.newPackage.Name = "newPackage";
this.newPackage.Size = new System.Drawing.Size(45, 20);
this.newPackage.TabIndex = 5;
this.newPackage.Text = "New";
this.newPackage.UseVisualStyleBackColor = true;
this.newPackage.Click += new System.EventHandler(this.newPackage_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.BackColor = System.Drawing.Color.Transparent;
this.label1.ForeColor = System.Drawing.SystemColors.Control;
this.label1.Location = new System.Drawing.Point(215, 338);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(51, 13);
this.label1.TabIndex = 7;
this.label1.Text = "Item files:";
//
// itemList
//
this.itemList.FormattingEnabled = true;
this.itemList.Location = new System.Drawing.Point(218, 360);
this.itemList.Name = "itemList";
this.itemList.Size = new System.Drawing.Size(255, 134);
this.itemList.TabIndex = 8;
this.itemList.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.fileList_KeyPress);
//
// itemButton
//
this.itemButton.Location = new System.Drawing.Point(317, 334);
this.itemButton.Name = "itemButton";
this.itemButton.Size = new System.Drawing.Size(75, 23);
this.itemButton.TabIndex = 9;
this.itemButton.Text = "Add file";
this.itemButton.UseVisualStyleBackColor = true;
this.itemButton.Click += new System.EventHandler(this.addFileButton_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.BackColor = System.Drawing.Color.Transparent;
this.label2.ForeColor = System.Drawing.SystemColors.Control;
this.label2.Location = new System.Drawing.Point(215, 173);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(77, 13);
this.label2.TabIndex = 7;
this.label2.Text = "Character files:";
//
// characterList
//
this.characterList.FormattingEnabled = true;
this.characterList.Location = new System.Drawing.Point(218, 198);
this.characterList.Name = "characterList";
this.characterList.Size = new System.Drawing.Size(255, 121);
this.characterList.TabIndex = 8;
this.characterList.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.fileList_KeyPress);
//
// characterButton
//
this.characterButton.Location = new System.Drawing.Point(317, 169);
this.characterButton.Name = "characterButton";
this.characterButton.Size = new System.Drawing.Size(75, 23);
this.characterButton.TabIndex = 9;
this.characterButton.Text = "Add file";
this.characterButton.UseVisualStyleBackColor = true;
this.characterButton.Click += new System.EventHandler(this.addFileButton_Click);
//
// label3
//
this.label3.AutoSize = true;
this.label3.BackColor = System.Drawing.Color.Transparent;
this.label3.ForeColor = System.Drawing.SystemColors.Control;
this.label3.Location = new System.Drawing.Point(489, 174);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(96, 13);
this.label3.TabIndex = 7;
this.label3.Text = "Map structure files:";
//
// structureList
//
this.structureList.FormattingEnabled = true;
this.structureList.Location = new System.Drawing.Point(492, 198);
this.structureList.Name = "structureList";
this.structureList.Size = new System.Drawing.Size(255, 121);
this.structureList.TabIndex = 8;
this.structureList.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.fileList_KeyPress);
//
// structureButton
//
this.structureButton.Location = new System.Drawing.Point(591, 169);
this.structureButton.Name = "structureButton";
this.structureButton.Size = new System.Drawing.Size(75, 23);
this.structureButton.TabIndex = 9;
this.structureButton.Text = "Add file";
this.structureButton.UseVisualStyleBackColor = true;
this.structureButton.Click += new System.EventHandler(this.addFileButton_Click);
//
// jobButton
//
this.jobButton.Location = new System.Drawing.Point(591, 334);
this.jobButton.Name = "jobButton";
this.jobButton.Size = new System.Drawing.Size(75, 23);
this.jobButton.TabIndex = 12;
this.jobButton.Text = "Add file";
this.jobButton.UseVisualStyleBackColor = true;
this.jobButton.Click += new System.EventHandler(this.addFileButton_Click);
//
// jobList
//
this.jobList.FormattingEnabled = true;
this.jobList.Location = new System.Drawing.Point(492, 360);
this.jobList.Name = "jobList";
this.jobList.Size = new System.Drawing.Size(255, 134);
this.jobList.TabIndex = 11;
this.jobList.PreviewKeyDown += new System.Windows.Forms.PreviewKeyDownEventHandler(this.fileList_KeyPress);
//
// label4
//
this.label4.AutoSize = true;
this.label4.BackColor = System.Drawing.Color.Transparent;
this.label4.ForeColor = System.Drawing.SystemColors.Control;
this.label4.Location = new System.Drawing.Point(489, 339);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(48, 13);
this.label4.TabIndex = 10;
this.label4.Text = "Job files:";
//
// okButton
//
this.okButton.Location = new System.Drawing.Point(623, 513);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(124, 37);
this.okButton.TabIndex = 13;
this.okButton.Text = "OK";
this.okButton.UseVisualStyleBackColor = true;
this.okButton.Click += new System.EventHandler(this.okButton_Click);
//
// characterFolder
//
this.characterFolder.Location = new System.Drawing.Point(398, 169);
this.characterFolder.Name = "characterFolder";
this.characterFolder.Size = new System.Drawing.Size(75, 23);
this.characterFolder.TabIndex = 9;
this.characterFolder.Text = "Add folder";
this.characterFolder.UseVisualStyleBackColor = true;
this.characterFolder.Click += new System.EventHandler(this.addFolderButton_Click);
//
// itemFolder
//
this.itemFolder.Location = new System.Drawing.Point(398, 333);
this.itemFolder.Name = "itemFolder";
this.itemFolder.Size = new System.Drawing.Size(75, 23);
this.itemFolder.TabIndex = 14;
this.itemFolder.Text = "Add folder";
this.itemFolder.UseVisualStyleBackColor = true;
this.itemFolder.Click += new System.EventHandler(this.addFolderButton_Click);
//
// structureFolder
//
this.structureFolder.Location = new System.Drawing.Point(672, 169);
this.structureFolder.Name = "structureFolder";
this.structureFolder.Size = new System.Drawing.Size(75, 23);
this.structureFolder.TabIndex = 15;
this.structureFolder.Text = "Add folder";
this.structureFolder.UseVisualStyleBackColor = true;
this.structureFolder.Click += new System.EventHandler(this.addFolderButton_Click);
//
// jobFolder
//
this.jobFolder.Location = new System.Drawing.Point(672, 334);
this.jobFolder.Name = "jobFolder";
this.jobFolder.Size = new System.Drawing.Size(75, 23);
this.jobFolder.TabIndex = 16;
this.jobFolder.Text = "Add folder";
this.jobFolder.UseVisualStyleBackColor = true;
this.jobFolder.Click += new System.EventHandler(this.addFolderButton_Click);
//
// pictureBox1
//
this.pictureBox1.BackColor = System.Drawing.Color.Transparent;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(-8, 12);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(802, 56);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 17;
this.pictureBox1.TabStop = false;
//
// label5
//
this.label5.AutoSize = true;
this.label5.BackColor = System.Drawing.Color.Transparent;
this.label5.ForeColor = System.Drawing.SystemColors.Control;
this.label5.Location = new System.Drawing.Point(215, 87);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(63, 13);
this.label5.TabIndex = 18;
this.label5.Text = "Executable:";
//
// exeBox
//
this.exeBox.Enabled = false;
this.exeBox.Location = new System.Drawing.Point(284, 84);
this.exeBox.Name = "exeBox";
this.exeBox.Size = new System.Drawing.Size(176, 20);
this.exeBox.TabIndex = 19;
//
// exeButton
//
this.exeButton.Location = new System.Drawing.Point(466, 84);
this.exeButton.Name = "exeButton";
this.exeButton.Size = new System.Drawing.Size(32, 20);
this.exeButton.TabIndex = 20;
this.exeButton.Text = "...";
this.exeButton.UseVisualStyleBackColor = true;
this.exeButton.Click += new System.EventHandler(this.button1_Click);
//
// PackageManager
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None;
this.ClientSize = new System.Drawing.Size(784, 562);
this.Controls.Add(this.exeButton);
this.Controls.Add(this.exeBox);
this.Controls.Add(this.label5);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.jobFolder);
this.Controls.Add(this.structureFolder);
this.Controls.Add(this.itemFolder);
this.Controls.Add(this.okButton);
this.Controls.Add(this.jobButton);
this.Controls.Add(this.jobList);
this.Controls.Add(this.label4);
this.Controls.Add(this.structureButton);
this.Controls.Add(this.characterFolder);
this.Controls.Add(this.characterButton);
this.Controls.Add(this.itemButton);
this.Controls.Add(this.structureList);
this.Controls.Add(this.label3);
this.Controls.Add(this.characterList);
this.Controls.Add(this.label2);
this.Controls.Add(this.itemList);
this.Controls.Add(this.label1);
this.Controls.Add(this.newPackage);
this.Controls.Add(this.newPackageName);
this.Controls.Add(this.packageList);
this.DoubleBuffered = true;
this.Name = "PackageManager";
this.Text = "PackageManager";
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.ListBox packageList;
private System.Windows.Forms.TextBox newPackageName;
private System.Windows.Forms.Button newPackage;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ListBox itemList;
private System.Windows.Forms.Button itemButton;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ListBox characterList;
private System.Windows.Forms.Button characterButton;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ListBox structureList;
private System.Windows.Forms.Button structureButton;
private System.Windows.Forms.Button jobButton;
private System.Windows.Forms.ListBox jobList;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button okButton;
private System.Windows.Forms.Button characterFolder;
private System.Windows.Forms.Button itemFolder;
private System.Windows.Forms.Button structureFolder;
private System.Windows.Forms.Button jobFolder;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox exeBox;
private System.Windows.Forms.Button exeButton;
}
}
-295
View File
@@ -1,295 +0,0 @@
using Barotrauma;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Launcher
{
public partial class PackageManager : Form
{
private ContentPackage selectedPackage;
private List<ListBox> fileBoxes;
private List<TextBox> singleFileBoxes;
private List<Button> fileButtons;
public PackageManager(ContentPackage _selectedPackage)
{
InitializeComponent();
packageList.DisplayMember = "Name";
packageList.ValueMember = "MD5hash";
foreach (ContentPackage package in ContentPackage.list)
{
packageList.Items.Add(package);
}
fileBoxes = new List<ListBox>();
fileButtons = new List<Button>();
singleFileBoxes = new List<TextBox>();
fileBoxes.Add(itemList);
itemList.Tag = ContentType.Item;
itemButton.Tag = ContentType.Item;
itemFolder.Tag = ContentType.Item;
fileButtons.Add(itemButton);
fileButtons.Add(itemFolder);
fileBoxes.Add(characterList);
characterList.Tag = ContentType.Character;
characterButton.Tag = ContentType.Character;
characterFolder.Tag = ContentType.Character;
fileButtons.Add(characterButton);
fileButtons.Add(characterFolder);
fileBoxes.Add(structureList);
structureList.Tag = ContentType.Structure;
structureButton.Tag = ContentType.Structure;
structureFolder.Tag = ContentType.Structure;
fileButtons.Add(structureButton);
fileButtons.Add(structureFolder);
fileBoxes.Add(jobList);
jobList.Tag = ContentType.Jobs;
jobButton.Tag = ContentType.Jobs;
jobFolder.Tag = ContentType.Jobs;
fileButtons.Add(jobButton);
fileButtons.Add(jobFolder);
singleFileBoxes.Add(exeBox);
exeBox.Tag = ContentType.Executable;
exeButton.Tag = ContentType.Executable;
foreach (Button fileButton in fileButtons)
{
fileButton.Enabled = false;
}
selectedPackage = _selectedPackage;
SelectPackage(selectedPackage);
}
private void packageList_SelectedIndexChanged(object sender, EventArgs e)
{
ListBox listBox = sender as ListBox;
SelectPackage(listBox.SelectedItem as ContentPackage);
}
private void SelectPackage(ContentPackage package)
{
selectedPackage = package;
foreach (Button fileButton in fileButtons)
{
fileButton.Enabled = (selectedPackage != null);
}
foreach (ListBox fileBox in fileBoxes)
{
fileBox.Items.Clear();
}
foreach (ListBox fileBox in fileBoxes)
{
ContentType type = (fileBox.Tag is ContentType) ? (ContentType)fileBox.Tag : ContentType.None;
foreach (ContentFile file in selectedPackage.files)
{
if (file.type != type) continue;
fileBox.Items.Add(file);
}
}
}
private void newPackage_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(newPackageName.Text)) return;
ContentPackage newPackage = ContentPackage.CreatePackage(newPackageName.Text);
packageList.Items.Add(newPackage);
packageList.SelectedItem = newPackage;
newPackageName.Text = "";
}
private void newPackageName_TextChanged(object sender, EventArgs e)
{
newPackage.Enabled = !string.IsNullOrEmpty(newPackageName.Text);
}
private void addFileButton_Click(object sender, EventArgs e)
{
Button button = sender as Button;
ContentType type = (button.Tag is ContentType) ? (ContentType)button.Tag : ContentType.None;
Debug.Assert(type != ContentType.None, "ContentType of a button tag was ContentType.None");
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = "XML files (*.xml)|*.xml;*.XML";
ofd.RestoreDirectory = true;
if (ofd.ShowDialog() == DialogResult.OK)
{
string[] fileNames = ofd.FileNames;
foreach (string file in fileNames)
{
AddFile(type, file);
}
}
}
private void fileList_KeyPress(object sender, PreviewKeyDownEventArgs e)
{
if (e.KeyCode != Keys.Delete) return;
ListBox listBox = sender as ListBox;
ContentType type = (listBox.Tag is ContentType) ? (ContentType)listBox.Tag : ContentType.None;
Debug.Assert(type != ContentType.None, "ContentType of a button tag was ContentType.None");
List<ContentFile> selectedFiles = new List<ContentFile>();
foreach (ContentFile item in listBox.SelectedItems)
{
selectedFiles.Add(item);
}
foreach (ContentFile file in selectedFiles)
{
RemoveFile(listBox, file);
}
}
private void AddFile(ContentType type, string path)
{
ListBox selectedBox = null;
foreach (ListBox fileBox in fileBoxes)
{
if (type != ((fileBox.Tag is ContentType) ? (ContentType)fileBox.Tag : ContentType.None)) continue;
selectedBox = fileBox;
break;
}
ContentFile newFile = selectedPackage.AddFile(GetRelativePath(path, Directory.GetCurrentDirectory()), type);
if (newFile!=null && selectedBox!=null) selectedBox.Items.Add(newFile);
}
private void RemoveFile(ListBox listBox, ContentFile file)
{
if (file == null) return;
if (listBox != null) listBox.Items.Remove(file);
selectedPackage.RemoveFile(file);
}
private void addFolderButton_Click(object sender, EventArgs e)
{
Button button = sender as Button;
ContentType type = (button.Tag is ContentType) ? (ContentType)button.Tag : ContentType.None;
Debug.Assert(type != ContentType.None, "ContentType of a button tag was ContentType.None");
FolderBrowserDialog fbd = new FolderBrowserDialog();
//OpenFileDialog ofd = new OpenFileDialog();
//ofd.Filter = "XML files (*.xml)|*.xml;*.XML";
//ofd.RestoreDirectory?
if (fbd.ShowDialog() == DialogResult.OK)
{
AddFilesInFolder(type, fbd.SelectedPath);
}
}
private void AddFilesInFolder(ContentType type, string folder, string searchPattern ="*xml")
{
if (!Directory.Exists(folder)) return;
string[] files = Directory.GetFiles(folder, "*.xml");
foreach (string filePath in files)
{
AddFile(type, filePath);
}
string[] subDirectories = Directory.GetDirectories(folder, "*");
foreach (string subDir in subDirectories)
{
AddFilesInFolder(type, subDir, searchPattern);
}
}
string GetRelativePath(string filespec, string folder)
{
Uri pathUri = new Uri(filespec);
// Folders must end in a slash
if (!folder.EndsWith(Path.DirectorySeparatorChar.ToString()))
{
folder += Path.DirectorySeparatorChar;
}
Uri folderUri = new Uri(folder);
return Uri.UnescapeDataString(folderUri.MakeRelativeUri(pathUri).ToString().Replace('/', Path.DirectorySeparatorChar));
}
private void okButton_Click(object sender, EventArgs e)
{
if (selectedPackage!=null) selectedPackage.Save(ContentPackage.Folder);
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
Button button = sender as Button;
ContentType type = (button.Tag is ContentType) ? (ContentType)button.Tag : ContentType.None;
Debug.Assert(type != ContentType.None, "ContentType of a button tag was ContentType.None");
TextBox selectedBox = null;
foreach (TextBox fileBox in singleFileBoxes)
{
if (type != ((fileBox.Tag is ContentType) ? (ContentType)fileBox.Tag : ContentType.None)) continue;
selectedBox = fileBox;
break;
}
OpenFileDialog ofd = new OpenFileDialog();
ofd.Filter = (type == ContentType.Executable) ? "Executable (*.exe)|*.exe" : "XML files (*.xml)|*.xml;*.XML";
ofd.Multiselect = false;
if (ofd.ShowDialog() == DialogResult.OK)
{
var existingFile = selectedPackage.files.Find(f => f.type == type);
if (existingFile!=null)
{
RemoveFile(null, existingFile);
}
AddFile(type, ofd.FileName);
selectedBox.Text = GetRelativePath(ofd.FileName, Directory.GetCurrentDirectory());
}
}
}
}
File diff suppressed because it is too large Load Diff
-22
View File
@@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Launcher
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new LauncherMain());
}
}
}
-36
View File
@@ -1,36 +0,0 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("OldLauncher")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Launcher")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("ef69d08c-36d1-4c9b-ac73-198db7d6e904")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
-71
View File
@@ -1,71 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Launcher.Properties
{
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Launcher.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}
-117
View File
@@ -1,117 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
-30
View File
@@ -1,30 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34209
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Launcher.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}
-7
View File
@@ -1,7 +0,0 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
-4
View File
@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="RestSharp" version="105.2.3" targetFramework="net45" />
</packages>
Binary file not shown.
+4
View File
@@ -104,6 +104,7 @@
<Compile Include="Source\ContentPackage.cs" /> <Compile Include="Source\ContentPackage.cs" />
<Compile Include="Source\CoroutineManager.cs" /> <Compile Include="Source\CoroutineManager.cs" />
<Compile Include="Source\Events\Missions\CargoMission.cs" /> <Compile Include="Source\Events\Missions\CargoMission.cs" />
<Compile Include="Source\Events\Missions\CombatMission.cs" />
<Compile Include="Source\Events\Missions\Mission.cs" /> <Compile Include="Source\Events\Missions\Mission.cs" />
<Compile Include="Source\Events\Missions\MonsterMission.cs" /> <Compile Include="Source\Events\Missions\MonsterMission.cs" />
<Compile Include="Source\Events\Missions\SalvageMission.cs" /> <Compile Include="Source\Events\Missions\SalvageMission.cs" />
@@ -807,6 +808,9 @@
<Content Include="Content\Map\ruins2.png"> <Content Include="Content\Map\ruins2.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\Map\ruins3.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\Map\shaft.png"> <Content Include="Content\Map\shaft.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@@ -30,7 +30,7 @@
<limb id = "3" width="13" height="45" mass = "6" ignorecollisions="true" flip="true" impacttolerance="50.0"> <limb id = "3" width="13" height="45" mass = "6" ignorecollisions="true" flip="true" impacttolerance="50.0">
<sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="65,131,36,50" depth="0.15" origin="0.4,0.5"/> <sprite texture="Content/Characters/Crawler/crawler.png" sourcerect="65,131,36,50" depth="0.15" origin="0.4,0.5"/>
<attack range="120" duration="0.5" damage="30" stun="0.1" bleedingdamage="3" structuredamage="50" damagetype="slash" torque="-20" targetforce="-30"/> <attack range="120" duration="0.5" damage="30" stun="0.1" bleedingdamage="3" structuredamage="50" damagetype="slash" force="20" torque="-20" targetforce="-30"/>
</limb> </limb>
<limb id = "4" width="11" height="34" mass = "4" type="RightLeg" flip="true"> <limb id = "4" width="11" height="34" mass = "4" type="RightLeg" flip="true">
@@ -11,7 +11,7 @@
<!-- head --> <!-- head -->
<limb id = "0" radius="230" height="500" type="Head" steerforce="1.0" flip="true" armorsector="0.0,180.0" armorvalue="100.0" impacttolerance="100"> <limb id = "0" radius="230" height="500" type="Head" steerforce="1.0" flip="true" armorsector="0.0,180.0" armorvalue="100.0" impacttolerance="100">
<sprite texture="Content/Characters/Moloch/moloch.png" sourcerect="0,0,628,1024" depth="0.02" origin ="0.4,0.5"/> <sprite texture="Content/Characters/Moloch/moloch.png" sourcerect="0,0,628,1024" depth="0.02" origin ="0.4,0.5"/>
<attack range="700" duration="0.2" damage="200" stun="5" force="25" damagetype="blunt" targetforce="100"/> <attack range="700" duration="0.2" damage="200" stun="5" force="20" damagetype="blunt" targetforce="100"/>
</limb> </limb>
<limb id = "1" width="50" height="440" flip="true"> <limb id = "1" width="50" height="440" flip="true">
@@ -16,7 +16,7 @@
linkable="true" linkable="true"
pickdistance ="150"> pickdistance ="150">
<Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,0,48,64"/> <Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,0,48,64" canflipx="false"/>
<ItemContainer capacity="20" canbeselected="true" hideitems="true"> <ItemContainer capacity="20" canbeselected="true" hideitems="true">
<Containable name="chem"/> <Containable name="chem"/>
@@ -29,7 +29,7 @@
linkable="true" linkable="true"
pickdistance ="150"> pickdistance ="150">
<Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,64,48,64"/> <Sprite texture ="cabinets.png" depth="0.84" sourcerect="0,64,48,64" canflipx="false"/>
<ItemContainer capacity="20" canbeselected="true" hideitems="true"> <ItemContainer capacity="20" canbeselected="true" hideitems="true">
<Containable name="chem"/> <Containable name="chem"/>
Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

After

Width:  |  Height:  |  Size: 3.7 KiB

@@ -10,8 +10,8 @@
<Sprite texture="lamp.png" sourcerect="0,0,16,32" depth="0.8"/> <Sprite texture="lamp.png" sourcerect="0,0,16,32" depth="0.8"/>
<LightComponent color="1.0,1.0,1.0,1.0" range ="800.0" powerconsumption="5"> <LightComponent lightcolor="1.0,1.0,1.0,1.0" range ="800.0" powerconsumption="5">
<sprite texture="Content/Items/Electricity/lamp.png" sourcerect="33,0,31,39"/> <sprite texture="Content/Items/Electricity/lamp.png" sourcerect="33,0,31,37"/>
</LightComponent> </LightComponent>
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]"> <ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
@@ -20,8 +20,25 @@
<input name="toggle"/> <input name="toggle"/>
<input name="set_state"/> <input name="set_state"/>
</ConnectionPanel> </ConnectionPanel>
</Item> </Item>
<Item
name="Emergency Light"
category="Electrical"
Tags="smallitem"
pickdistance="150">
<Sprite texture="lamp.png" sourcerect="0,48,48,16" depth="0.8"/>
<LightComponent lightcolor="1.0,0.0,0.0,0.2" range="500.0" IsOn="true">
<sprite texture="Content/Items/Electricity/lamp.png" sourcerect="0,48,48,16"/>
</LightComponent>
<ConnectionPanel selectkey="Action" canbeselected = "true" msg="Rewire [Screwdriver]">
<requireditem name="Screwdriver,Wire" type="Equipped"/>
<input name="toggle"/>
<input name="set_state"/>
</ConnectionPanel>
</Item>
</Items> </Items>
@@ -7,7 +7,7 @@
pickdistance="150" pickdistance="150"
description="Serves as a hub for power distribution and relaying signals between devices."> description="Serves as a hub for power distribution and relaying signals between devices.">
<Sprite texture ="junctionbox.png" depth="0.8"/> <Sprite texture="junctionbox.png" depth="0.8" canflipx="false"/>
<fixrequirement name="Electrical repairs"> <fixrequirement name="Electrical repairs">
<skill name="Electrical Engineering" level="40"/> <skill name="Electrical Engineering" level="40"/>
+2 -2
View File
@@ -8,7 +8,7 @@
pickthroughwalls="true" pickthroughwalls="true"
pickdistance="150"> pickdistance="150">
<Sprite texture ="engine.png" depth="0.8" sourcerect="0,0,373,113"/> <Sprite texture ="engine.png" depth="0.8" sourcerect="0,0,373,113" canflipx="true"/>
<fixrequirement name="Mechanical repairs"> <fixrequirement name="Mechanical repairs">
<skill name="Construction" level="40"/> <skill name="Construction" level="40"/>
@@ -36,7 +36,7 @@
pickthroughwalls="true" pickthroughwalls="true"
pickdistance="150"> pickdistance="150">
<Sprite texture ="engine.png" depth="0.8" sourcerect="0,115,224,73"/> <Sprite texture ="engine.png" depth="0.8" sourcerect="0,115,224,73" canflipx="true"/>
<fixrequirement name="Mechanical repairs"> <fixrequirement name="Mechanical repairs">
<skill name="Construction" level="30"/> <skill name="Construction" level="30"/>
+38 -19
View File
@@ -51,7 +51,8 @@
name="Iron Powder" name="Iron Powder"
category="Material" category="Material"
Tags="smallitem,chem" Tags="smallitem,chem"
pickdistance="150"> pickdistance="150"
price="5">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6" color="0.2,0.2,0.2,1.0"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6" color="0.2,0.2,0.2,1.0"/>
@@ -66,7 +67,8 @@
spritecolor="1.0,1.0,0.7,1.0" spritecolor="1.0,1.0,0.7,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150" pickdistance="150"
description="A mild stimulant which is used as an incredient in the manufacture of various medicines."> description="A mild stimulant which is used as an incredient in the manufacture of various medicines."
price="10">
<Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6" /> <Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6" />
@@ -91,7 +93,8 @@
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150" pickdistance="150"
canuseonself="true" canuseonself="true"
description="Most commonly used for treating oxygen deprivation."> description="Most commonly used for treating oxygen deprivation."
price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6" /> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6" />
@@ -111,7 +114,8 @@
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150" pickdistance="150"
canuseonself="true" canuseonself="true"
description="A hemostatic agent that slows down bleeding."> description="A hemostatic agent that slows down bleeding."
price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6" /> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6" />
@@ -136,7 +140,8 @@
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150" pickdistance="150"
canuseonself="true" canuseonself="true"
description="Highly effective at treating various types of physical trauma."> description="Highly effective at treating various types of physical trauma."
price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -160,7 +165,8 @@
spritecolor="1.0,1.0,0.0,1.0" spritecolor="1.0,1.0,0.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150" pickdistance="150"
description="A highly potent corrigodone-based stimulant."> description="A highly potent corrigodone-based stimulant."
price="150">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -178,7 +184,8 @@
category="Material" category="Material"
spritecolor="1.0,1.0,1.0,0.6" spritecolor="1.0,1.0,1.0,0.6"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"> pickdistance="150"
price="20">
<Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/> <Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/>
@@ -197,7 +204,8 @@
spritecolor="0.0,0.9,0.1,1.0" spritecolor="0.0,0.9,0.1,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
canuseonself="true" canuseonself="true"
pickdistance="150"> pickdistance="150"
price="20">
<ItemComponent> <ItemComponent>
<StatusEffect type="OnUse" target="This" Condition="-25.0" disabledeltatime="true"/> <StatusEffect type="OnUse" target="This" Condition="-25.0" disabledeltatime="true"/>
@@ -220,7 +228,8 @@
category="Material" category="Material"
spritecolor="0.7,0.7,0.7,1.0" spritecolor="0.7,0.7,0.7,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"> pickdistance="150"
price="20">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -238,7 +247,8 @@
category="Material" category="Material"
spritecolor="0.8,0.8,0.8,1.0" spritecolor="0.8,0.8,0.8,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"> pickdistance="150"
price="20">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -256,7 +266,8 @@
category="Material" category="Material"
spritecolor="0.1,0.1,0.1,1.0" spritecolor="0.1,0.1,0.1,1.0"
Tags="smallitem,chem,explosive" Tags="smallitem,chem,explosive"
pickdistance="150"> pickdistance="150"
price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -276,7 +287,8 @@
category="Material" category="Material"
spritecolor="1.0,1.0,1.0,0.8" spritecolor="1.0,1.0,1.0,0.8"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"> pickdistance="150"
price="20">
<Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/> <Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/>
@@ -294,7 +306,8 @@
category="Material" category="Material"
spritecolor="0.5,0.0,0.0,1.0" spritecolor="0.5,0.0,0.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"> pickdistance="150"
price="20">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -312,7 +325,8 @@
category="Material" category="Material"
spritecolor="0.5,0.0,0.0,1.0" spritecolor="0.5,0.0,0.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"> pickdistance="150"
price="50">
<Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/> <Sprite texture ="med.png" sourcerect="15,15,8,17" depth="0.6"/>
@@ -330,7 +344,8 @@
category="Material" category="Material"
spritecolor="0.2,0.35,0.06,1.0" spritecolor="0.2,0.35,0.06,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150"> pickdistance="150"
price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -349,7 +364,8 @@
spritecolor="0.8,0.3,0.8,1.0" spritecolor="0.8,0.3,0.8,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150" pickdistance="150"
description="A potent muscle stimulant."> description="A potent muscle stimulant."
price="50">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -368,7 +384,8 @@
spritecolor="0.0,0.0,0.0,1.0" spritecolor="0.0,0.0,0.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150" pickdistance="150"
description="A highly potent neurotoxin."> description="A highly potent neurotoxin."
price="200">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -387,7 +404,8 @@
spritecolor="0.0,0.0,0.0,1.0" spritecolor="0.0,0.0,0.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150" pickdistance="150"
description="Dormant eggs of the Europan lifeform colloquially referred to as 'husk parasite'."> description="Dormant eggs of the Europan lifeform colloquially referred to as 'husk parasite'."
price="200">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -406,7 +424,8 @@
spritecolor="0.0,0.0,0.0,1.0" spritecolor="0.0,0.0,0.0,1.0"
Tags="smallitem,chem,medical" Tags="smallitem,chem,medical"
pickdistance="150" pickdistance="150"
description="An antiparasitic drug used in the treatment of husk parasite infections."> description="An antiparasitic drug used in the treatment of husk parasite infections."
price="300">
<Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/> <Sprite texture ="med.png" sourcerect="24,16,8,16" depth="0.6"/>
@@ -38,7 +38,7 @@
name="Depth Charge Shell" name="Depth Charge Shell"
category="Misc" category="Misc"
pickdistance="150" pickdistance="150"
price="50"> price="200">
<Deconstruct time="10"> <Deconstruct time="10">
<Item name="Steel Bar"/> <Item name="Steel Bar"/>
@@ -66,7 +66,7 @@
name="Nuclear Depth Charge" name="Nuclear Depth Charge"
category="Misc" category="Misc"
pickdistance="150" pickdistance="150"
price="50"> price="500">
<Deconstruct time="20"> <Deconstruct time="20">
<Item name="Steel Bar"/> <Item name="Steel Bar"/>
+11 -2
View File
@@ -66,7 +66,7 @@
name="Railgun Shell" name="Railgun Shell"
category="Misc" category="Misc"
pickdistance="200" pickdistance="200"
price="100"> price="200">
<Deconstruct time="10"> <Deconstruct time="10">
<Item name="Steel Bar"/> <Item name="Steel Bar"/>
@@ -82,6 +82,10 @@
<Projectile launchimpulse="80.0"> <Projectile launchimpulse="80.0">
<Attack damage="100" bleedingdamage="10" structuredamage="200" damagetype="Blunt"/> <Attack damage="100" bleedingdamage="10" structuredamage="200" damagetype="Blunt"/>
<StatusEffect type="OnActive" target="This">
<ParticleEmitter particle="bubbles" anglemin="0" anglemax="360" particleamount="10" velocitymin="0" velocitymax="50" scalemin="2" scalemax="5"/>
</StatusEffect>
</Projectile> </Projectile>
<ItemContainer hideitems="true" capacity="1" canbeselected = "true"> <ItemContainer hideitems="true" capacity="1" canbeselected = "true">
@@ -93,7 +97,7 @@
name="Nuclear Shell" name="Nuclear Shell"
category="Misc" category="Misc"
pickdistance="200" pickdistance="200"
price="100"> price="500">
<Deconstruct time="10"> <Deconstruct time="10">
<Item name="Steel Bar"/> <Item name="Steel Bar"/>
@@ -110,9 +114,14 @@
<Projectile launchimpulse="80.0"> <Projectile launchimpulse="80.0">
<Attack damage="1000" bleedingdamage="10" structuredamage="200" damagetype="Blunt"/> <Attack damage="1000" bleedingdamage="10" structuredamage="200" damagetype="Blunt"/>
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Weapons/bigexplosion.ogg"> <StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true" sound="Content/Items/Weapons/bigexplosion.ogg">
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0"/> <Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0"/>
</StatusEffect> </StatusEffect>
<StatusEffect type="OnActive" target="This">
<ParticleEmitter particle="bubbles" anglemin="0" anglemax="360" particleamount="10" velocitymin="0" velocitymax="50" scalemin="2" scalemax="5"/>
</StatusEffect>
</Projectile> </Projectile>
<ItemContainer hideitems="true" capacity="1" canbeselected = "true"> <ItemContainer hideitems="true" capacity="1" canbeselected = "true">
+5 -1
View File
@@ -6,7 +6,12 @@
<structure prefab="RuinWallVertical" alignment="Left,Right" type="Wall"/> <structure prefab="RuinWallVertical" alignment="Left,Right" type="Wall"/>
<structure prefab="RuinWallVerticalSmall" alignment="Left,Right" type="CorridorWall"/> <structure prefab="RuinWallVerticalSmall" alignment="Left,Right" type="CorridorWall"/>
<structure prefab="RuinWallHeavyHorizontal" alignment="Top, Bottom" type="HeavyWall"/>
<structure prefab="RuinWallHeavyVertical" alignment="Left,Right" type="HeavyWall"/>
<structure prefab="RuinBack" alignment="Center" type="Back" commonness="3"/> <structure prefab="RuinBack" alignment="Center" type="Back" commonness="3"/>
<structure prefab="RuinBackFractal" alignment="Center" type="Back" commonness="2"/>
<structure prefab="RuinBackCarvings" alignment="Center" type="Back" commonness="1"/> <structure prefab="RuinBackCarvings" alignment="Center" type="Back" commonness="1"/>
<item prefab="RuinBlock" alignment="Right,Top,Bottom,Left" type="Prop" commonness="5"/> <item prefab="RuinBlock" alignment="Right,Top,Bottom,Left" type="Prop" commonness="5"/>
@@ -15,7 +20,6 @@
<item prefab="RuinClaw" alignment="Bottom" type="Prop" commonness="5"/> <item prefab="RuinClaw" alignment="Bottom" type="Prop" commonness="5"/>
<item prefab="Oxygenite Shard" alignment="Center,Right,Top,Bottom,Left" type="Prop" commonness="5"/> <item prefab="Oxygenite Shard" alignment="Center,Right,Top,Bottom,Left" type="Prop" commonness="5"/>
<item prefab="Sulphurite Shard" alignment="Center,Right,Top,Bottom,Left" type="Prop" commonness="5"/> <item prefab="Sulphurite Shard" alignment="Center,Right,Top,Bottom,Left" type="Prop" commonness="5"/>
+22 -5
View File
@@ -29,23 +29,23 @@
</smallverticalback2> </smallverticalback2>
<engineeringLabel width="153" height="16"> <engineeringLabel width="153" height="16">
<sprite texture="Content/Map/structures2.png" sourcerect="0,426,153,16" depth ="0.99"/> <sprite texture="Content/Map/structures2.png" sourcerect="0,426,153,16" depth="0.99" canflipx="false"/>
</engineeringLabel> </engineeringLabel>
<commandLabel width="128" height="16"> <commandLabel width="128" height="16">
<sprite texture="Content/Map/structures2.png" sourcerect="0,443,128,16" depth ="0.99"/> <sprite texture="Content/Map/structures2.png" sourcerect="0,443,128,16" depth="0.99" canflipx="false"/>
</commandLabel> </commandLabel>
<airlockLabel width = "99" height ="16"> <airlockLabel width = "99" height ="16">
<sprite texture="Content/Map/structures2.png" sourcerect="0,460,199,16" depth ="0.99"/> <sprite texture="Content/Map/structures2.png" sourcerect="0,460,199,16" depth="0.99" canflipx="false"/>
</airlockLabel> </airlockLabel>
<cabinsLabel width="83" height="16"> <cabinsLabel width="83" height="16">
<sprite texture="Content/Map/structures2.png" sourcerect="0,477,83,16" depth ="0.99"/> <sprite texture="Content/Map/structures2.png" sourcerect="0,477,83,16" depth="0.99" canflipx="false"/>
</cabinsLabel> </cabinsLabel>
<medicalLabel width="110" height="16"> <medicalLabel width="110" height="16">
<sprite texture="Content/Map/structures2.png" sourcerect="0,494,110,16" depth="0.99"/> <sprite texture="Content/Map/structures2.png" sourcerect="0,494,110,16" depth="0.99" canflipx="false"/>
</medicalLabel> </medicalLabel>
<arrowUp width="16" height="16"> <arrowUp width="16" height="16">
@@ -200,6 +200,18 @@
<sprite texture="Content/Map/ruins.png" sourcerect="896,192,128,832" depth ="0.061"/> <sprite texture="Content/Map/ruins.png" sourcerect="896,192,128,832" depth ="0.061"/>
</RuinWallVertical> </RuinWallVertical>
<RuinWallHeavyHorizontal category="Alien" castshadow="true"
width="128" height="128" resizehorizontal="true" body="true" health="100000">
<sprite texture="Content/Map/ruins3.png" sourcerect="352,896,672,128" depth ="0.06"/>
</RuinWallHeavyHorizontal>
<RuinWallHeavyVertical category="Alien" castshadow="true"
width="128" height="128" resizevertical="true" body="true" health="100000">
<sprite texture="Content/Map/ruins3.png" sourcerect="896,0,128,672" depth ="0.061"/>
</RuinWallHeavyVertical>
<RuinWallHorizontalSmall category="Alien" castshadow="true" <RuinWallHorizontalSmall category="Alien" castshadow="true"
width="128" height="54" resizehorizontal="true" body="true" health="500"> width="128" height="54" resizehorizontal="true" body="true" health="500">
<sprite texture="Content/Map/ruins.png" sourcerect="0,842,832,54" depth ="0.062"/> <sprite texture="Content/Map/ruins.png" sourcerect="0,842,832,54" depth ="0.062"/>
@@ -221,6 +233,11 @@
<sprite texture="Content/Map/ruins.png" sourcerect="512,0,233,512" depth ="0.981" /> <sprite texture="Content/Map/ruins.png" sourcerect="512,0,233,512" depth ="0.981" />
</RuinBackCarvings> </RuinBackCarvings>
<RuinBackFractal category="Alien"
width="64" height="64" resizehorizontal="true" resizevertical="true">
<sprite texture="Content/Map/ruins3.png" sourcerect="0,0,640,896" depth ="0.98"/>
</RuinBackFractal>
<RuinBlock category="Alien" <RuinBlock category="Alien"
width="514" height="296"> width="514" height="296">
<sprite texture="Content/Map/ruins.png" sourcerect="0,513,514,296" depth ="0.99" /> <sprite texture="Content/Map/ruins.png" sourcerect="0,513,514,296" depth ="0.99" />
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

+21
View File
@@ -174,4 +174,25 @@
</Item> </Item>
</Items> </Items>
</CargoMission> </CargoMission>
<CombatMission
name="Search and Destroy"
descriptionneutral="A Coalition vessel has been dispatched from [location1] to destroy a renegade vessel at the outskirts of [location2]."
description1="A renegade vessel has been detected at the outskirts of [location2]. Treason against the Europa Coalition is punishable by death - eliminate the renegades and return to [location1]!"
description2="You're a member of a renegade group opposing the Europa Coalition. According to your informants at [location1], a Coalition ship has just been dispatched on a mission to take down your vessel. Eliminate their crew and return to [location2]."
teamname1="Coalition"
teamname2="Renegade"
multiplayeronly="true"
commonness="20"
reward="2000"
successmessage="The [loser] vessel has been defeated by the [winner] crew!"
failuremessage="Both crews have perished.">
<message header="Crew eliminated" text="The renegade crew has been defeated! The Coalition vessel has to make its way back to [location1]."/>
<message header="Crew eliminated" text="The Coalition crew has been defeated! The renegade vessel has to make its way back to [location2]."/>
</CombatMission>
</Missions> </Missions>
Binary file not shown.
@@ -46,6 +46,7 @@
<BackgroundSpritePrefabs file="Content/BackgroundSprites/BackgroundSpritePrefabs.xml" /> <BackgroundSpritePrefabs file="Content/BackgroundSprites/BackgroundSpritePrefabs.xml" />
<RandomEvents file="Content/randomevents.xml" /> <RandomEvents file="Content/randomevents.xml" />
<LocationTypes file="Content/Map/locationTypes.xml" /> <LocationTypes file="Content/Map/locationTypes.xml" />
<LevelGenerationParameters file="Content/Map/LevelGenerationParameters.xml" />
<Missions file="Content/Missions.xml" /> <Missions file="Content/Missions.xml" />
<Jobs file="Content/Jobs.xml" /> <Jobs file="Content/Jobs.xml" />
<Executable file="Barotrauma.exe" /> <Executable file="Barotrauma.exe" />
-719
View File
@@ -1,719 +0,0 @@
<StyleCopSettings Version="105">
<Analyzers>
<Analyzer AnalyzerId="StyleCop.CSharp.DocumentationRules">
<Rules>
<Rule Name="ElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="EnumerationItemsMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationMustContainValidXml">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustHaveSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementDocumentationMustHaveSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustHaveSummaryText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PartialElementDocumentationMustHaveSummaryText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustNotHaveDefaultSummary">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustMatchElementParameters">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustDeclareParameterName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementParameterDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementReturnValueDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="VoidReturnValueMustNotBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParametersMustBeDocumented">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParametersMustBeDocumentedPartialClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustMatchTypeParameters">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustDeclareParameterName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="GenericTypeParameterDocumentationMustHaveText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertySummaryDocumentationMustMatchAccessors">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertySummaryDocumentationMustOmitSetAccessorWithRestrictedAccess">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustNotBeCopiedAndPasted">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustNotUseDocumentationStyleSlashes">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationTextMustNotBeEmpty">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationTextMustContainWhitespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationMustMeetCharacterPercentage">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DestructorSummaryDocumentationMustBeginWithStandardText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationHeadersMustNotContainBlankLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncludedDocumentationXPathDoesNotExist">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncludeNodeDoesNotContainValidFileAndPath">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="InheritDocMustBeUsedWithInheritingClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationMustBeSpelledCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMustHaveHeader">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustShowCopyright">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustHaveCopyrightText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustContainFileName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderFileNameDocumentationMustMatchFileName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderMustHaveValidCompanyText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileHeaderFileNameDocumentationMustMatchTypeName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.LayoutRules">
<Rules>
<Rule Name="CurlyBracketsForMultiLineStatementsMustNotShareLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StatementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementMustNotBeOnSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CurlyBracketsMustNotBeOmitted">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="AllAccessorsMustBeMultiLineOrSingleLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningCurlyBracketsMustNotBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationHeadersMustNotBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainMultipleBlankLinesInARow">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingCurlyBracketsMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningCurlyBracketsMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ChainedStatementBlocksMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="WhileDoFooterMustNotBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustNotBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingCurlyBracketMustBeFollowedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementDocumentationHeaderMustBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentMustBePrecededByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustBeSeparatedByBlankLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainBlankLinesAtStartOfFile">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainBlankLinesAtEndOfFile">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules">
<Rules>
<Rule Name="FileMayOnlyContainASingleClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="AccessModifierMustBeDeclared">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldsMustBePrivate">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeAnalysisSuppressionMustHaveJustification">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DebugAssertMustProvideMessageText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DebugFailMustProvideMessageText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMayOnlyContainASingleNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ArithmeticExpressionsMustDeclarePrecedence">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.OrderingRules">
<Rules>
<Rule Name="UsingDirectivesMustBePlacedWithinNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustAppearInTheCorrectOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ElementsMustBeOrderedByAccess">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ConstantsMustAppearBeforeFields">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticElementsMustAppearBeforeInstanceElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DeclarationKeywordsMustFollowOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ProtectedMustComeBeforeInternal">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PropertyAccessorsMustFollowOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="EventAccessorsMustFollowOrder">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="StaticReadonlyElementsMustAppearBeforeStaticNonReadonlyElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="InstanceReadonlyElementsMustAppearBeforeInstanceNonReadonlyElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SystemUsingDirectivesMustBePlacedBeforeOtherUsingDirectives">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UsingAliasDirectivesMustBePlacedAfterOtherUsingDirectives">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UsingDirectivesMustBeOrderedAlphabeticallyByNamespace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UsingAliasDirectivesMustBeOrderedAlphabeticallyByAliasName">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.ReadabilityRules">
<Rules>
<Rule Name="CommentsMustContainText">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DoNotPrefixCallsWithBaseUnlessLocalImplementationExists">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PrefixLocalCallsWithThis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PrefixCallsCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningParenthesisMustBeOnDeclarationLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingParenthesisMustBeOnLineOfLastParameter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingParenthesisMustBeOnLineOfOpeningParenthesis">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CommaMustBeOnSameLineAsPreviousParameter">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterListMustFollowDeclaration">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterMustFollowComma">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SplitParametersMustStartOnLineAfterDeclaration">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParametersMustBeOnSameLineOrSeparateLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ParameterMustNotSpanMultipleLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClauseMustFollowPreviousClause">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClausesMustBeOnSeparateLinesOrAllOnOneLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClauseMustBeginOnNewLineWhenPreviousClauseSpansMultipleLines">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="QueryClausesSpanningMultipleLinesMustBeginOnOwnLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DoNotPlaceRegionsWithinElements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainEmptyStatements">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainMultipleStatementsOnOneLine">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="BlockStatementsMustNotContainEmbeddedComments">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="BlockStatementsMustNotContainEmbeddedRegions">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UseStringEmptyForEmptyStrings">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UseBuiltInTypeAlias">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="UseShorthandForNullableTypes">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
<Analyzer AnalyzerId="StyleCop.CSharp.SpacingRules">
<Rules>
<Rule Name="KeywordsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CommasMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SemicolonsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DocumentationLinesMustBeginWithSingleSpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="SingleLineCommentsMustBeginWithSingleSpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PreprocessorKeywordsMustNotBePrecededBySpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OperatorKeywordMustBeFollowedBySpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningParenthesisMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingParenthesisMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningSquareBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingSquareBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningCurlyBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingCurlyBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningGenericBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingGenericBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="OpeningAttributeBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ClosingAttributeBracketsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="NullableTypeSymbolsMustNotBePrecededBySpace">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="MemberAccessSymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="IncrementDecrementSymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="NegativeSignsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="PositiveSignsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="DereferenceAndAccessOfSymbolsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ColonsMustBeSpacedCorrectly">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainMultipleWhitespaceInARow">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="CodeMustNotContainSpaceAfterNewKeywordInImplicitlyTypedArrayAllocation">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="TabsMustNotBeUsed">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
</Analyzers>
</StyleCopSettings>
+8 -2
View File
@@ -110,6 +110,8 @@ namespace Barotrauma
viewMatrix = viewMatrix =
Matrix.CreateTranslation(new Vector3(GameMain.GraphicsWidth / 2.0f, GameMain.GraphicsHeight / 2.0f, 0)); Matrix.CreateTranslation(new Vector3(GameMain.GraphicsWidth / 2.0f, GameMain.GraphicsHeight / 2.0f, 0));
UpdateTransform();
} }
public Vector2 TargetPos public Vector2 TargetPos
@@ -193,9 +195,13 @@ namespace Barotrauma
} }
} }
moveCam = moveCam * deltaTime * 60.0f; moveCam = moveCam * deltaTime * 60.0f;
Zoom = MathHelper.Clamp(zoom + (PlayerInput.ScrollWheelSpeed / 1000.0f) * zoom, GameMain.DebugDraw ? 0.01f : 0.1f, 2.0f); Vector2 mouseInWorld = ScreenToWorld(PlayerInput.MousePosition);
Vector2 diffViewCenter;
diffViewCenter = ((mouseInWorld - Position) * Zoom);
Zoom = MathHelper.Clamp(zoom + (PlayerInput.ScrollWheelSpeed / 1000.0f) * zoom, GameMain.DebugDraw ? 0.01f : 0.1f, 2.0f);
if (!PlayerInput.KeyDown(Keys.F)) Position = mouseInWorld - (diffViewCenter / Zoom);
} }
else else
{ {
@@ -341,7 +341,7 @@ namespace Barotrauma
{ {
wallAttackPos = Vector2.Zero; wallAttackPos = Vector2.Zero;
limb.AttackTimer = 0.0f; limb.AttackTimer = 0.0f;
if (Vector2.Distance(limb.SimPosition, attackPosition)<5.0) coolDownTimer = attackCoolDown; coolDownTimer = attackCoolDown;
} }
} }
@@ -180,8 +180,8 @@ namespace Barotrauma
{ {
if (selectedAiTarget != null) if (selectedAiTarget != null)
{ {
GUI.DrawLine(spriteBatch, GUI.DrawLine(spriteBatch,
new Vector2(Character.WorldPosition.X, -Character.WorldPosition.Y), new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y),
new Vector2(selectedAiTarget.WorldPosition.X, -selectedAiTarget.WorldPosition.Y), Color.Red); new Vector2(selectedAiTarget.WorldPosition.X, -selectedAiTarget.WorldPosition.Y), Color.Red);
} }
@@ -189,16 +189,16 @@ namespace Barotrauma
if (pathSteering == null || pathSteering.CurrentPath == null || pathSteering.CurrentPath.CurrentNode==null) return; if (pathSteering == null || pathSteering.CurrentPath == null || pathSteering.CurrentPath.CurrentNode==null) return;
GUI.DrawLine(spriteBatch, GUI.DrawLine(spriteBatch,
new Vector2(Character.WorldPosition.X, -Character.WorldPosition.Y), new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y),
new Vector2(pathSteering.CurrentPath.CurrentNode.WorldPosition.X, -pathSteering.CurrentPath.CurrentNode.WorldPosition.Y), new Vector2(pathSteering.CurrentPath.CurrentNode.DrawPosition.X, -pathSteering.CurrentPath.CurrentNode.DrawPosition.Y),
Color.LightGreen); Color.LightGreen);
for (int i = 1; i < pathSteering.CurrentPath.Nodes.Count; i++) for (int i = 1; i < pathSteering.CurrentPath.Nodes.Count; i++)
{ {
GUI.DrawLine(spriteBatch, GUI.DrawLine(spriteBatch,
new Vector2(pathSteering.CurrentPath.Nodes[i].WorldPosition.X, -pathSteering.CurrentPath.Nodes[i].WorldPosition.Y), new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y),
new Vector2(pathSteering.CurrentPath.Nodes[i - 1].WorldPosition.X, -pathSteering.CurrentPath.Nodes[i-1].WorldPosition.Y), new Vector2(pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.Y),
Color.LightGreen); Color.LightGreen);
} }
} }
+2 -2
View File
@@ -64,9 +64,9 @@ namespace Barotrauma
aiController.Update(deltaTime); aiController.Update(deltaTime);
} }
public override void DrawFront(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch) public override void DrawFront(Microsoft.Xna.Framework.Graphics.SpriteBatch spriteBatch,Camera cam)
{ {
base.DrawFront(spriteBatch); base.DrawFront(spriteBatch,cam);
if (GameMain.DebugDraw && !isDead) aiController.DebugDraw(spriteBatch); if (GameMain.DebugDraw && !isDead) aiController.DebugDraw(spriteBatch);
} }
@@ -426,7 +426,11 @@ namespace Barotrauma
float volume = stairs == null ? impact / 5.0f : impact; float volume = stairs == null ? impact / 5.0f : impact;
volume = Math.Min(impact, 1.0f); volume = Math.Min(impact, 1.0f);
if (impact > 0.8f && l.HitSound != null && l.soundTimer <= 0.0f) l.HitSound.Play(volume, impact * 100.0f, l.WorldPosition); if (impact > 0.5f && l.HitSound != null && l.soundTimer <= 0.0f)
{
l.soundTimer = Limb.SoundInterval;
l.HitSound.Play(volume, impact * 250.0f, l.WorldPosition);
}
if (impact > l.impactTolerance) if (impact > l.impactTolerance)
{ {
@@ -464,7 +468,7 @@ namespace Barotrauma
if (limb.pullJoint != null) if (limb.pullJoint != null)
{ {
Vector2 pos = ConvertUnits.ToDisplayUnits(limb.pullJoint.WorldAnchorA); Vector2 pos = ConvertUnits.ToDisplayUnits(limb.pullJoint.WorldAnchorA);
if (currentHull != null) pos += currentHull.Submarine.Position; if (currentHull != null) pos += currentHull.Submarine.DrawPosition;
pos.Y = -pos.Y; pos.Y = -pos.Y;
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), Color.Red, true, 0.01f); GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X, (int)pos.Y, 5, 5), Color.Red, true, 0.01f);
@@ -492,7 +496,7 @@ namespace Barotrauma
if (limb.body.TargetPosition != Vector2.Zero) if (limb.body.TargetPosition != Vector2.Zero)
{ {
Vector2 pos = ConvertUnits.ToDisplayUnits(limb.body.TargetPosition); Vector2 pos = ConvertUnits.ToDisplayUnits(limb.body.TargetPosition);
if (currentHull != null) pos += currentHull.Submarine.Position; if (currentHull != null) pos += currentHull.Submarine.DrawPosition;
pos.Y = -pos.Y; pos.Y = -pos.Y;
GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X - 10, (int)pos.Y - 10, 20, 20), Color.Cyan, false, 0.01f); GUI.DrawRectangle(spriteBatch, new Rectangle((int)pos.X - 10, (int)pos.Y - 10, 20, 20), Color.Cyan, false, 0.01f);
+49 -14
View File
@@ -72,6 +72,9 @@ namespace Barotrauma
} }
} }
public Hull PreviousHull = null;
public Hull CurrentHull = null;
public readonly bool IsNetworkPlayer; public readonly bool IsNetworkPlayer;
private bool networkUpdateSent; private bool networkUpdateSent;
@@ -92,7 +95,9 @@ namespace Barotrauma
private Item selectedConstruction; private Item selectedConstruction;
private Item[] selectedItems; private Item[] selectedItems;
public byte TeamID = 0;
public AnimController AnimController; public AnimController AnimController;
private Vector2 cursorPosition; private Vector2 cursorPosition;
@@ -833,19 +838,39 @@ namespace Barotrauma
attackPos, attackPos,
AnimController.Limbs.Select(l => l.body.FarseerBody).ToList(), AnimController.Limbs.Select(l => l.body.FarseerBody).ToList(),
Physics.CollisionCharacter | Physics.CollisionWall); Physics.CollisionCharacter | Physics.CollisionWall);
IDamageable attackTarget = null; IDamageable attackTarget = null;
if (body != null) if (body != null)
{ {
if (body.UserData is IDamageable)
{
attackTarget = (IDamageable)body.UserData;
}
else if (body.UserData is Limb)
{
attackTarget = ((Limb)body.UserData).character;
}
attackPos = Submarine.LastPickedPosition; attackPos = Submarine.LastPickedPosition;
if (body != null && body.UserData is Submarine)
{
var sub = ((Submarine)body.UserData);
body = Submarine.PickBody(
attackLimb.SimPosition - ((Submarine)body.UserData).SimPosition,
attackPos - ((Submarine)body.UserData).SimPosition,
AnimController.Limbs.Select(l => l.body.FarseerBody).ToList(),
Physics.CollisionWall);
if (body != null)
{
attackPos = Submarine.LastPickedPosition + sub.SimPosition;
attackTarget = body.UserData as IDamageable;
}
}
else
{
if (body.UserData is IDamageable)
{
attackTarget = (IDamageable)body.UserData;
}
else if (body.UserData is Limb)
{
attackTarget = ((Limb)body.UserData).character;
}
}
} }
attackLimb.UpdateAttack(deltaTime, attackPos, attackTarget); attackLimb.UpdateAttack(deltaTime, attackPos, attackTarget);
@@ -1195,6 +1220,10 @@ namespace Barotrauma
{ {
if (!Enabled) return; if (!Enabled) return;
PreviousHull = CurrentHull;
CurrentHull = Hull.FindHull(WorldPosition, CurrentHull, true);
//if (PreviousHull != CurrentHull && Character.Controlled == this) Hull.DetectItemVisibility(this); //WIP item culling
speechBubbleTimer = Math.Max(0.0f, speechBubbleTimer - deltaTime); speechBubbleTimer = Math.Max(0.0f, speechBubbleTimer - deltaTime);
obstructVisionAmount = Math.Max(obstructVisionAmount - deltaTime, 0.0f); obstructVisionAmount = Math.Max(obstructVisionAmount - deltaTime, 0.0f);
@@ -1406,7 +1435,7 @@ namespace Barotrauma
CharacterHUD.Draw(spriteBatch, this, cam); CharacterHUD.Draw(spriteBatch, this, cam);
} }
public virtual void DrawFront(SpriteBatch spriteBatch) public virtual void DrawFront(SpriteBatch spriteBatch, Camera cam)
{ {
if (!Enabled) return; if (!Enabled) return;
@@ -1424,9 +1453,15 @@ namespace Barotrauma
if (info != null) if (info != null)
{ {
Vector2 namePos = new Vector2(pos.X, pos.Y - 120.0f) - GUI.Font.MeasureString(Info.Name) * 0.5f; Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f/cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom;
spriteBatch.DrawString(GUI.Font, Info.Name, namePos - new Vector2(1.0f, 1.0f), Color.Black); Color nameColor = Color.White;
spriteBatch.DrawString(GUI.Font, Info.Name, namePos, Color.White);
if (Character.Controlled != null && TeamID!=Character.Controlled.TeamID)
{
nameColor = Color.Red;
}
spriteBatch.DrawString(GUI.Font, Info.Name, namePos + new Vector2(1.0f/cam.Zoom, 1.0f / cam.Zoom), Color.Black, 0.0f,Vector2.Zero, 1.0f / cam.Zoom,SpriteEffects.None,0.001f);
spriteBatch.DrawString(GUI.Font, Info.Name, namePos, nameColor, 0.0f, Vector2.Zero, 1.0f/cam.Zoom, SpriteEffects.None, 0.0f);
if (GameMain.DebugDraw) if (GameMain.DebugDraw)
{ {
+4 -3
View File
@@ -462,14 +462,14 @@ namespace Barotrauma
Vector2 normal = new Vector2(-line.Y, line.X); Vector2 normal = new Vector2(-line.Y, line.X);
normal = Vector2.Normalize(-normal); normal = Vector2.Normalize(-normal);
float dragDot = Vector2.Dot(normal, velDir); float dragDot = Math.Abs(Vector2.Dot(normal, velDir));
Vector2 dragForce = Vector2.Zero; Vector2 dragForce = Vector2.Zero;
if (dragDot > 0) if (dragDot > 0)
{ {
float vel = LinearVelocity.Length()*2.0f; float vel = LinearVelocity.Length()*2.0f;
float drag = dragDot * vel * vel float drag = dragDot * vel * vel
* ConvertUnits.ToSimUnits(sprite.size.Y); * ConvertUnits.ToSimUnits(sprite.size.Y);
dragForce = drag * -velDir; dragForce = Math.Min(drag, Mass*1000.0f) * -velDir;
//if (dragForce.Length() > 100.0f) { } //if (dragForce.Length() > 100.0f) { }
} }
@@ -499,7 +499,8 @@ namespace Barotrauma
float dist = ConvertUnits.ToDisplayUnits(Vector2.Distance(SimPosition, attackPosition)); float dist = ConvertUnits.ToDisplayUnits(Vector2.Distance(SimPosition, attackPosition));
AttackTimer += deltaTime; AttackTimer += deltaTime;
body.ApplyTorque(Mass * character.AnimController.Dir * attack.Torque);
body.ApplyTorque(Mass * character.AnimController.Dir * attack.Torque);
if (dist < attack.Range * 0.5f) if (dist < attack.Range * 0.5f)
{ {
+1 -1
View File
@@ -17,7 +17,7 @@ namespace Barotrauma
Structure, Structure,
Executable, Executable,
LocationTypes, LocationTypes,
LevelGenerationPresets, LevelGenerationParameters,
RandomEvents, RandomEvents,
Missions, Missions,
BackgroundCreaturePrefabs, BackgroundSpritePrefabs BackgroundCreaturePrefabs, BackgroundSpritePrefabs
+1 -1
View File
@@ -86,7 +86,7 @@ namespace Barotrauma
} }
catch (Exception e) catch (Exception e)
{ {
DebugConsole.ThrowError("Coroutine " + handle.Name + " threw an exception: " + e.Message); DebugConsole.ThrowError("Coroutine " + handle.Name + " threw an exception: " + e.Message + "\n" + e.StackTrace.ToString());
return true; return true;
} }
} }
+7 -5
View File
@@ -240,7 +240,7 @@ namespace Barotrauma
break; break;
case "near": case "near":
case "close": case "close":
float closestDist = 0.0f; float closestDist = -1.0f;
foreach (WayPoint wp in WayPoint.WayPointList) foreach (WayPoint wp in WayPoint.WayPointList)
{ {
if (wp.Submarine != null) continue; if (wp.Submarine != null) continue;
@@ -250,25 +250,27 @@ namespace Barotrauma
float dist = Vector2.Distance(wp.WorldPosition, GameMain.GameScreen.Cam.WorldViewCenter); float dist = Vector2.Distance(wp.WorldPosition, GameMain.GameScreen.Cam.WorldViewCenter);
if (spawnPoint == null || dist < closestDist) if (closestDist < 0.0f || dist < closestDist)
{ {
spawnPoint = wp; spawnPoint = wp;
closestDist = dist; closestDist = dist;
} }
} }
break; break;
case "cursor":
spawnPosition = GameMain.GameScreen.Cam.ScreenToWorld(PlayerInput.MousePosition);
break;
default: default:
spawnPoint = WayPoint.GetRandom(commands[1].ToLowerInvariant()=="human" ? SpawnType.Human : SpawnType.Enemy); spawnPoint = WayPoint.GetRandom(commands[1].ToLowerInvariant() == "human" ? SpawnType.Human : SpawnType.Enemy);
break; break;
} }
} }
else else
{ {
spawnPoint = WayPoint.GetRandom(commands[1].ToLowerInvariant() == "human" ? SpawnType.Human : SpawnType.Enemy); spawnPoint = WayPoint.GetRandom(commands[1].ToLowerInvariant() == "human" ? SpawnType.Human : SpawnType.Enemy);
} }
spawnPosition = spawnPoint == null ? Vector2.Zero : spawnPoint.WorldPosition; if (spawnPoint != null) spawnPosition = spawnPoint.WorldPosition;
if (commands[1].ToLowerInvariant()=="human") if (commands[1].ToLowerInvariant()=="human")
{ {
@@ -10,15 +10,14 @@ namespace Barotrauma
{ {
class CargoMission : Mission class CargoMission : Mission
{ {
private XElement itemConfig; private XElement itemConfig;
private List<Item> items; private List<Item> items;
private int requiredDeliveryAmount; private int requiredDeliveryAmount;
public CargoMission(XElement element) public CargoMission(XElement element, Location[] locations)
: base(element) : base(element, locations)
{ {
itemConfig = element.Element("Items"); itemConfig = element.Element("Items");
@@ -71,7 +70,7 @@ namespace Barotrauma
Vector2 position = new Vector2( Vector2 position = new Vector2(
cargoSpawnPos.Position.X + Rand.Range(-20.0f, 20.0f, false), cargoSpawnPos.Position.X + Rand.Range(-20.0f, 20.0f, false),
cargoRoom.Rect.Y - cargoRoom.Rect.Height); cargoRoom.Rect.Y - cargoRoom.Rect.Height + itemPrefab.Size.Y / 2);
var item = new Item(itemPrefab, position, cargoRoom.Submarine); var item = new Item(itemPrefab, position, cargoRoom.Submarine);
item.FindHull(); item.FindHull();
@@ -0,0 +1,231 @@
using Barotrauma.Networking;
using Microsoft.Xna.Framework;
using System;
using System.Linq;
using System.Collections.Generic;
using System.Xml.Linq;
namespace Barotrauma
{
class CombatMission : Mission
{
private Submarine[] subs;
private List<Character>[] crews;
private int state = 0;
private int winner = -1;
private string[] descriptions;
private static string[] teamNames;
public override string Description
{
get
{
if (GameMain.NetworkMember==null || GameMain.NetworkMember.Character==null)
{
//non-team-specific description
return descriptions[0];
}
//team specific
return descriptions[GameMain.NetworkMember.Character.TeamID];
}
}
public override string SuccessMessage
{
get
{
if (winner == -1) return "";
return successMessage
.Replace("[loser]", teamNames[1 - winner])
.Replace("[winner]", teamNames[winner]);
}
}
public CombatMission(XElement element, Location[] locations)
: base(element, locations)
{
descriptions = new string[]
{
ToolBox.GetAttributeString(element, "descriptionneutral", ""),
ToolBox.GetAttributeString(element, "description1", ""),
ToolBox.GetAttributeString(element, "description2", "")
};
for (int i = 0; i < descriptions.Length; i++ )
{
for (int n = 0; n < 2;n++ )
{
descriptions[i] = descriptions[i].Replace("[location" + (n + 1) + "]", Locations[n]);
}
}
teamNames = new string[]
{
ToolBox.GetAttributeString(element, "teamname1", "Team A"),
ToolBox.GetAttributeString(element, "teamname2", "Team B")
};
}
public static string GetTeamName(int teamID)
{
//team IDs start from 1, while teamName array starts from 0
teamID--;
if (teamID < 0 || teamID >= teamNames.Length)
{
return "Team " + teamID;
}
return teamNames[teamID];
}
public override bool AssignTeamIDs(List<Client> clients, out int hostTeam)
{
List<Client> randList = new List<Client>(clients);
for (int i = 0; i < randList.Count; i++)
{
Client a = randList[i];
int oi = Rand.Range(0, randList.Count - 1);
Client b = randList[oi];
randList[i] = b;
randList[oi] = a;
}
int halfPlayers = randList.Count / 2;
for (int i = 0; i < randList.Count; i++)
{
if (i < halfPlayers)
{
randList[i].TeamID = 1;
}
else
{
randList[i].TeamID = 2;
}
}
if (halfPlayers * 2 == randList.Count)
{
hostTeam = Rand.Range(1, 2);
}
else if (halfPlayers * 2 < randList.Count)
{
hostTeam = 1;
}
else
{
hostTeam = 2;
}
return true;
}
public override void Start(Level level)
{
if (GameMain.Server != null)
{
GameMain.Server.AllowRespawn = false;
}
if (GameMain.NetworkMember == null)
{
DebugConsole.ThrowError("Combat missions cannot be played in the single player mode.");
return;
}
Items.Components.Radar.StartMarker = Locations[0];
Items.Components.Radar.EndMarker = Locations[1];
subs = new Submarine[] { Submarine.MainSubs[0], Submarine.MainSubs[1] };
subs[1].SetPosition(Level.Loaded.EndPosition - new Vector2(0.0f, 2000.0f));
subs[1].FlipX();
crews = new List<Character>[] { new List<Character>(), new List<Character>() };
foreach (Submarine submarine in Submarine.Loaded)
{
//hide all subs from radar to make sneak attacks possible
submarine.OnRadar = false;
}
}
public override void Update(float deltaTime)
{
if (crews[0].Count == 0 && crews[1].Count == 0)
{
if (GameMain.Server != null)
{
GameMain.Server.AllowRespawn = false;
}
foreach (Character character in Character.CharacterList)
{
if (character.TeamID == 1)
{
crews[0].Add(character);
}
else if (character.TeamID == 2)
{
crews[1].Add(character);
}
}
}
bool[] teamDead =
{
crews[0].All(c => c.IsDead || c.IsUnconscious),
crews[1].All(c => c.IsDead || c.IsUnconscious)
};
if (state == 0)
{
for (int i = 0; i < teamDead.Length; i++)
{
if (!teamDead[i] && teamDead[1-i])
{
//make sure nobody in the other team can be revived because that would be pretty weird
crews[1-i].ForEach(c => { if (!c.IsDead) c.Kill(CauseOfDeath.Damage); });
winner = i;
ShowMessage(i);
state = 1;
break;
}
}
}
else
{
if (winner>=0 && subs[winner] != null &&
(winner == 0 && subs[winner].AtStartPosition) || (winner == 1 && subs[winner].AtEndPosition) &&
crews[winner].Any(c => !c.IsDead && c.Submarine == subs[winner]))
{
GameMain.GameSession.CrewManager.WinningTeam = winner+1;
if (GameMain.Server != null) GameMain.Server.EndGame();
}
}
if (teamDead[0] && teamDead[1])
{
GameMain.GameSession.CrewManager.WinningTeam = 0;
winner = -1;
if (GameMain.Server != null) GameMain.Server.EndGame();
}
}
public override void End()
{
if (GameMain.NetworkMember == null) return;
if (winner > -1)
{
GiveReward();
completed = true;
}
}
}
}
+37 -20
View File
@@ -27,12 +27,14 @@ namespace Barotrauma
private int reward; private int reward;
protected string[] Locations = new string[2];
public string Name public string Name
{ {
get { return name; } get { return name; }
} }
public string Description public virtual string Description
{ {
get { return description; } get { return description; }
} }
@@ -57,7 +59,7 @@ namespace Barotrauma
get { return Vector2.Zero; } get { return Vector2.Zero; }
} }
public string SuccessMessage virtual public string SuccessMessage
{ {
get { return successMessage; } get { return successMessage; }
} }
@@ -86,7 +88,7 @@ namespace Barotrauma
} }
} }
public Mission(XElement element) public Mission(XElement element, Location[] locations)
{ {
name = ToolBox.GetAttributeString(element, "name", ""); name = ToolBox.GetAttributeString(element, "name", "");
@@ -109,9 +111,24 @@ namespace Barotrauma
headers.Add(ToolBox.GetAttributeString(subElement, "header", "")); headers.Add(ToolBox.GetAttributeString(subElement, "header", ""));
messages.Add(ToolBox.GetAttributeString(subElement, "text", "")); messages.Add(ToolBox.GetAttributeString(subElement, "text", ""));
} }
for (int n = 0; n < 2; n++)
{
Locations[n] = locations[n].Name;
description = description.Replace("[location" + (n + 1) + "]", locations[n].Name);
successMessage = successMessage.Replace("[location" + (n + 1) + "]", locations[n].Name);
failureMessage = failureMessage.Replace("[location" + (n + 1) + "]", locations[n].Name);
for (int m = 0; m < messages.Count; m++)
{
messages[m] = messages[m].Replace("[location" + (n + 1) + "]", locations[n].Name);
}
}
} }
public static Mission LoadRandom(Location[] locations, MTRandom rand, string missionType = "") public static Mission LoadRandom(Location[] locations, MTRandom rand, string missionType = "", bool isSinglePlayer = false)
{ {
missionType = missionType.ToLowerInvariant(); missionType = missionType.ToLowerInvariant();
@@ -146,8 +163,15 @@ namespace Barotrauma
matchingElements = doc.Root.Elements().ToList().FindAll(m => m.Name.ToString().ToLowerInvariant().Replace("mission", "") == missionType); matchingElements = doc.Root.Elements().ToList().FindAll(m => m.Name.ToString().ToLowerInvariant().Replace("mission", "") == missionType);
} }
if (isSinglePlayer)
{
matchingElements.RemoveAll(m => ToolBox.GetAttributeBool(m, "multiplayeronly", false));
}
else
{
matchingElements.RemoveAll(m => ToolBox.GetAttributeBool(m, "singleplayeronly", false));
}
int i = 0; int i = 0;
foreach (XElement element in matchingElements) foreach (XElement element in matchingElements)
{ {
@@ -182,22 +206,13 @@ namespace Barotrauma
DebugConsole.ThrowError("Error in " + configFile + "! Could not find a mission class of the type \"" + type + "\"."); DebugConsole.ThrowError("Error in " + configFile + "! Could not find a mission class of the type \"" + type + "\".");
continue; continue;
} }
ConstructorInfo constructor = t.GetConstructor(new[] { typeof(XElement) }); ConstructorInfo constructor = t.GetConstructor(new[] { typeof(XElement), typeof(Location[]) });
object instance = constructor.Invoke(new object[] { element });
object instance = constructor.Invoke(new object[] { element, locations });
Mission mission = (Mission)instance; Mission mission = (Mission)instance;
for (int n = 0; n<2; n++)
{
mission.description = mission.description.Replace("[location"+(n+1)+"]", locations[n].Name);
mission.successMessage = mission.successMessage.Replace("[location" + (n + 1) + "]", locations[n].Name);
mission.failureMessage = mission.failureMessage.Replace("[location" + (n + 1) + "]", locations[n].Name);
}
return mission; return mission;
} }
@@ -212,6 +227,8 @@ namespace Barotrauma
public virtual void Update(float deltaTime) { } public virtual void Update(float deltaTime) { }
public virtual bool AssignTeamIDs(List<Networking.Client> clients,out int hostTeam) { clients.ForEach(client => { client.TeamID = 1; }); hostTeam = 1; return false; }
public void ShowMessage(int index) public void ShowMessage(int index)
{ {
if (index >= headers.Count && index >= messages.Count) return; if (index >= headers.Count && index >= messages.Count) return;
@@ -20,25 +20,15 @@ namespace Barotrauma
get { return monster != null && !monster.IsDead ? radarPosition : Vector2.Zero; } get { return monster != null && !monster.IsDead ? radarPosition : Vector2.Zero; }
} }
public MonsterMission(XElement element) public MonsterMission(XElement element, Location[] locations)
: base(element) : base(element, locations)
{ {
monsterFile = ToolBox.GetAttributeString(element, "monsterfile", ""); monsterFile = ToolBox.GetAttributeString(element, "monsterfile", "");
} }
public override void Start(Level level) public override void Start(Level level)
{ {
float minDist = Math.Max(Submarine.MainSub.Borders.Width, Submarine.MainSub.Borders.Height); Vector2 spawnPos = Level.Loaded.GetRandomInterestingPosition(true, Level.PositionType.MainPath, true);
//find a random spawnpos that isn't too close to the main sub
int tries = 0;
Vector2 spawnPos = Vector2.Zero;
do
{
spawnPos = Level.Loaded.GetRandomInterestingPosition(true, Level.PositionType.MainPath);
tries++;
} while (tries < 50 && Vector2.Distance(spawnPos, Submarine.MainSub.WorldPosition) < minDist);
monster = Character.Create(monsterFile, spawnPos, null, GameMain.Client != null); monster = Character.Create(monsterFile, spawnPos, null, GameMain.Client != null);
monster.Enabled = false; monster.Enabled = false;
@@ -26,8 +26,8 @@ namespace Barotrauma
} }
} }
public SalvageMission(XElement element) public SalvageMission(XElement element, Location[] locations)
: base(element) : base(element, locations)
{ {
string itemName = ToolBox.GetAttributeString(element, "itemname", ""); string itemName = ToolBox.GetAttributeString(element, "itemname", "");
+24 -16
View File
@@ -1,6 +1,8 @@
using System.Xml.Linq; using System.Xml.Linq;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using System; using System;
using System.Collections.Generic;
using System.Linq;
namespace Barotrauma namespace Barotrauma
{ {
@@ -14,6 +16,8 @@ namespace Barotrauma
private bool spawnDeep; private bool spawnDeep;
private bool disallowed;
private Level.PositionType spawnPosType; private Level.PositionType spawnPosType;
public override string ToString() public override string ToString()
@@ -38,6 +42,16 @@ namespace Barotrauma
} }
spawnDeep = ToolBox.GetAttributeBool(element, "spawndeep", false); spawnDeep = ToolBox.GetAttributeBool(element, "spawndeep", false);
if (GameMain.Server != null)
{
List<string> monsterNames = GameMain.Server.monsterEnabled.Keys.ToList();
string tryKey = monsterNames.Find(s => characterFile.ToLower().Contains(s.ToLower()));
if (!string.IsNullOrWhiteSpace(tryKey))
{
if (!GameMain.Server.monsterEnabled[tryKey]) disallowed = true; //spawn was disallowed by host
}
}
} }
protected override void Start() protected override void Start()
@@ -47,29 +61,18 @@ namespace Barotrauma
private void SpawnMonsters() private void SpawnMonsters()
{ {
float minDist = Math.Max(Submarine.MainSub.Borders.Width, Submarine.MainSub.Borders.Height); if (disallowed) return;
//find a random spawnpos that isn't too close to the main sub Vector2 spawnPos = Level.Loaded.GetRandomInterestingPosition(true, spawnPosType, true);
int tries = 0;
Vector2 spawnPos = Vector2.Zero;
do
{
spawnPos = Level.Loaded.GetRandomInterestingPosition(true, spawnPosType);
tries++;
} while (tries < 50 && Vector2.Distance(spawnPos, Submarine.MainSub.WorldPosition) < minDist);
int amount = Rand.Range(minAmount, maxAmount, false); int amount = Rand.Range(minAmount, maxAmount, false);
monsters = new Character[amount]; monsters = new Character[amount];
if (spawnDeep) spawnPos.Y -= Level.Loaded.Size.Y;
for (int i = 0; i < amount; i++) for (int i = 0; i < amount; i++)
{ {
if (spawnDeep)
{
spawnPos.Y -= Level.Loaded.Size.Y;
}
spawnPos.X += Rand.Range(-0.5f, 0.5f, false); spawnPos.X += Rand.Range(-0.5f, 0.5f, false);
spawnPos.Y += Rand.Range(-0.5f, 0.5f, false); spawnPos.Y += Rand.Range(-0.5f, 0.5f, false);
monsters[i] = Character.Create(characterFile, spawnPos, null, GameMain.Client != null); monsters[i] = Character.Create(characterFile, spawnPos, null, GameMain.Client != null);
@@ -78,6 +81,11 @@ namespace Barotrauma
public override void Update(float deltaTime) public override void Update(float deltaTime)
{ {
if (disallowed)
{
Finished();
return;
}
if (monsters == null) SpawnMonsters(); if (monsters == null) SpawnMonsters();
//base.Update(deltaTime); //base.Update(deltaTime);
+1 -1
View File
@@ -65,12 +65,12 @@ namespace Barotrauma
while (tries < 5) while (tries < 5)
{ {
ScriptedEvent scriptedEvent = ScriptedEvent.LoadRandom(rand); ScriptedEvent scriptedEvent = ScriptedEvent.LoadRandom(rand);
DebugConsole.Log("Created scripted event "+scriptedEvent.ToString());
if (scriptedEvent==null || scriptedEvent.Difficulty > totalDifficulty) if (scriptedEvent==null || scriptedEvent.Difficulty > totalDifficulty)
{ {
tries++; tries++;
continue; continue;
} }
DebugConsole.Log("Created scripted event " + scriptedEvent.ToString());
AddTask(new ScriptedTask(scriptedEvent)); AddTask(new ScriptedTask(scriptedEvent));
totalDifficulty -= scriptedEvent.Difficulty; totalDifficulty -= scriptedEvent.Difficulty;
+46 -9
View File
@@ -241,12 +241,22 @@ namespace Barotrauma
sb.DrawString(font, text, pos, color); sb.DrawString(font, text, pos, color);
} }
public static void DrawRectangle(SpriteBatch sb, Vector2 start, Vector2 size, Color clr, bool isFilled = false, float depth = 0.0f) public static void DrawRectangle(SpriteBatch sb, Vector2 start, Vector2 size, Color clr, bool isFilled = false, float depth = 0.0f, int thickness = 1)
{ {
DrawRectangle(sb, new Rectangle((int)start.X, (int)start.Y, (int)size.X, (int)size.Y), clr, isFilled, depth); if (size.X < 0)
{
start.X += size.X;
size.X = -size.X;
}
if (size.Y < 0)
{
start.Y += size.Y;
size.Y = -size.Y;
}
DrawRectangle(sb, new Rectangle((int)start.X, (int)start.Y, (int)size.X, (int)size.Y), clr, isFilled, depth, thickness);
} }
public static void DrawRectangle(SpriteBatch sb, Rectangle rect, Color clr, bool isFilled = false, float depth = 0.0f) public static void DrawRectangle(SpriteBatch sb, Rectangle rect, Color clr, bool isFilled = false, float depth = 0.0f, int thickness = 1)
{ {
if (isFilled) if (isFilled)
{ {
@@ -254,10 +264,10 @@ namespace Barotrauma
} }
else else
{ {
sb.Draw(t, new Rectangle(rect.X, rect.Y, rect.Width, 1), null, clr, 0.0f, Vector2.Zero, SpriteEffects.None, depth); sb.Draw(t, new Rectangle(rect.X, rect.Y, rect.Width, thickness), null, clr, 0.0f, Vector2.Zero, SpriteEffects.None, depth);
sb.Draw(t, new Rectangle(rect.X, rect.Y+rect.Height-1, rect.Width, 1), null, clr, 0.0f, Vector2.Zero, SpriteEffects.None, depth); sb.Draw(t, new Rectangle(rect.X, rect.Y+rect.Height- thickness, rect.Width, thickness), null, clr, 0.0f, Vector2.Zero, SpriteEffects.None, depth);
sb.Draw(t, new Rectangle(rect.X, rect.Y, 1, rect.Height), null, clr, 0.0f, Vector2.Zero, SpriteEffects.None, depth); sb.Draw(t, new Rectangle(rect.X, rect.Y, thickness, rect.Height), null, clr, 0.0f, Vector2.Zero, SpriteEffects.None, depth);
sb.Draw(t, new Rectangle(rect.X+rect.Width-1, rect.Y, 1, rect.Height), null, clr, 0.0f, Vector2.Zero, SpriteEffects.None, depth); sb.Draw(t, new Rectangle(rect.X+rect.Width- thickness, rect.Y, thickness, rect.Height), null, clr, 0.0f, Vector2.Zero, SpriteEffects.None, depth);
} }
} }
@@ -439,6 +449,33 @@ namespace Barotrauma
"Sub pos: " + Submarine.MainSub.Position.ToPoint(), "Sub pos: " + Submarine.MainSub.Position.ToPoint(),
new Vector2(10, 50), Color.White); new Vector2(10, 50), Color.White);
} }
for (int i = 1; i < Sounds.SoundManager.DefaultSourceCount; i++)
{
Color clr = Color.White;
string soundStr = i+": ";
var playingSound = Sounds.SoundManager.GetPlayingSound(i);
if (playingSound == null)
{
soundStr+= "none";
clr *= 0.5f;
}
else
{
soundStr += System.IO.Path.GetFileNameWithoutExtension(playingSound.FilePath);
if (Sounds.SoundManager.IsLooping(i))
{
soundStr += " (looping)";
clr = Color.Yellow;
}
}
GUI.DrawString(spriteBatch, new Vector2(200, i * 15), soundStr, clr, Color.Black * 0.5f, 0, GUI.SmallFont);
}
} }
if (GameMain.NetworkMember != null) GameMain.NetworkMember.Draw(spriteBatch); if (GameMain.NetworkMember != null) GameMain.NetworkMember.Draw(spriteBatch);
@@ -472,12 +509,12 @@ namespace Barotrauma
{ {
if (pauseMenuOpen) if (pauseMenuOpen)
{ {
pauseMenu.Update(0.016f); pauseMenu.Update(deltaTime);
} }
if (settingsMenuOpen) if (settingsMenuOpen)
{ {
GameMain.Config.SettingsFrame.Update(0.016f); GameMain.Config.SettingsFrame.Update(deltaTime);
} }
if (GUIMessageBox.MessageBoxes.Count > 0) if (GUIMessageBox.MessageBoxes.Count > 0)
+34 -2
View File
@@ -116,6 +116,21 @@ namespace Barotrauma
} }
} }
public override Rectangle Rect
{
get
{
return rect;
}
set
{
base.Rect = value;
frame.Rect = new Rectangle(value.X, value.Y, frame.Rect.Width, frame.Rect.Height);
textBlock.Rect = value;
}
}
public bool Selected { get; set; } public bool Selected { get; set; }
public GUIButton(Rectangle rect, string text, GUIStyle style, GUIComponent parent = null) public GUIButton(Rectangle rect, string text, GUIStyle style, GUIComponent parent = null)
@@ -183,6 +198,25 @@ namespace Barotrauma
base.Update(deltaTime); base.Update(deltaTime);
//Color currColor = color;
//if (state == ComponentState.Hover) currColor = hoverColor;
//if (state == ComponentState.Selected) currColor = selectedColor;
//GUI.DrawRectangle(spriteBatch, rect, currColor * alpha, true);
////spriteBatch.DrawString(HUD.font, text, new Vector2(rect.X+rect.Width/2, rect.Y+rect.Height/2), Color.Black, 0.0f, new Vector2(0.5f,0.5f), 1.0f, SpriteEffects.None, 0.0f);
//GUI.DrawRectangle(spriteBatch, rect, Color.Black * alpha, false);
DrawChildren(spriteBatch);
//if (!Enabled) GUI.DrawRectangle(spriteBatch, rect, Color.Gray*0.5f, true);
}
public override void Update(float deltaTime)
{
if (!Visible) return;
base.Update(deltaTime);
if (rect.Contains(PlayerInput.MousePosition) && CanBeSelected && Enabled && (MouseOn == null || MouseOn == this || IsParentOf(MouseOn))) if (rect.Contains(PlayerInput.MousePosition) && CanBeSelected && Enabled && (MouseOn == null || MouseOn == this || IsParentOf(MouseOn)))
{ {
state = ComponentState.Hover; state = ComponentState.Hover;
@@ -196,7 +230,6 @@ namespace Barotrauma
else if (PlayerInput.LeftButtonClicked()) else if (PlayerInput.LeftButtonClicked())
{ {
GUI.PlayUISound(GUISoundType.Click); GUI.PlayUISound(GUISoundType.Click);
if (OnClicked != null) if (OnClicked != null)
{ {
if (OnClicked(this, UserData) && CanBeSelected) state = ComponentState.Selected; if (OnClicked(this, UserData) && CanBeSelected) state = ComponentState.Selected;
@@ -212,7 +245,6 @@ namespace Barotrauma
{ {
state = Selected ? ComponentState.Selected : ComponentState.None; state = Selected ? ComponentState.Selected : ComponentState.None;
} }
frame.State = state; frame.State = state;
} }
} }
+6
View File
@@ -286,9 +286,15 @@ namespace Barotrauma
toolTipBlock.rect.Height = toolTipBlock.WrappedText.Split('\n').Length * 18; toolTipBlock.rect.Height = toolTipBlock.WrappedText.Split('\n').Length * 18;
toolTipBlock.Color = Color.Black * 0.7f; toolTipBlock.Color = Color.Black * 0.7f;
toolTipBlock.userData = ToolTip; toolTipBlock.userData = ToolTip;
} }
toolTipBlock.rect = new Rectangle(MouseOn.Rect.Center.X, MouseOn.rect.Bottom, toolTipBlock.rect.Width, toolTipBlock.rect.Height); toolTipBlock.rect = new Rectangle(MouseOn.Rect.Center.X, MouseOn.rect.Bottom, toolTipBlock.rect.Width, toolTipBlock.rect.Height);
if (toolTipBlock.rect.Right > GameMain.GraphicsWidth - 10)
{
toolTipBlock.rect.Location -= new Point(toolTipBlock.rect.Right - (GameMain.GraphicsWidth - 10), 0);
}
toolTipBlock.Draw(spriteBatch); toolTipBlock.Draw(spriteBatch);
} }
+107 -29
View File
@@ -103,15 +103,6 @@ namespace Barotrauma
get { return scrollBarEnabled; } get { return scrollBarEnabled; }
set set
{ {
if (value)
{
if (!scrollBarEnabled && scrollBarHidden) ShowScrollBar();
}
else
{
if (scrollBarEnabled && !scrollBarHidden) HideScrollBar();
}
scrollBarEnabled = value; scrollBarEnabled = value;
} }
} }
@@ -122,7 +113,7 @@ namespace Barotrauma
} }
public GUIListBox(Rectangle rect, GUIStyle style, Alignment alignment, GUIComponent parent = null) public GUIListBox(Rectangle rect, GUIStyle style, Alignment alignment, GUIComponent parent = null)
: this(rect, null, style, parent) : this(rect, null, alignment, style, parent, false)
{ {
} }
@@ -185,11 +176,101 @@ namespace Barotrauma
} }
} }
private void UpdateChildrenRect(float deltaTime)
{
int x = rect.X, y = rect.Y;
if (!scrollBarHidden)
{
if (scrollBar.IsHorizontal)
{
x -= (int)((totalSize - rect.Width) * scrollBar.BarScroll);
}
else
{
y -= (int)((totalSize - rect.Height) * scrollBar.BarScroll);
}
}
for (int i = 0; i < children.Count; i++)
{
GUIComponent child = children[i];
if (child == frame || !child.Visible) continue;
child.Rect = new Rectangle(x, y, child.Rect.Width, child.Rect.Height);
if (scrollBar.IsHorizontal)
{
x += child.Rect.Width + spacing;
}
else
{
y += child.Rect.Height + spacing;
}
if (scrollBar.IsHorizontal)
{
if (child.Rect.Right < rect.X) continue;
if (child.Rect.Right > rect.Right) break;
if (child.Rect.X < rect.X && child.Rect.Right >= rect.X)
{
x = rect.X;
continue;
}
}
else
{
if (child.Rect.Y + child.Rect.Height < rect.Y) continue;
if (child.Rect.Y + child.Rect.Height > rect.Y + rect.Height) break;
if (child.Rect.Y < rect.Y && child.Rect.Y + child.Rect.Height >= rect.Y)
{
y = rect.Y;
continue;
}
}
if (deltaTime>0.0f) child.Update(deltaTime);
if (enabled && child.CanBeFocused &&
(MouseOn == this || (MouseOn != null && this.IsParentOf(MouseOn))) && child.Rect.Contains(PlayerInput.MousePosition))
{
child.State = ComponentState.Hover;
if (PlayerInput.LeftButtonClicked())
{
Debug.WriteLine("clicked");
Select(i);
//selected = child;
//if (OnSelected != null)
//{
// if (!OnSelected(selected, child.UserData)) selected = null;
//}
}
}
else if (selected.Contains(child))
{
child.State = ComponentState.Selected;
if (CheckSelected != null)
{
if (CheckSelected() != child.UserData) selected.Remove(child);
}
}
else
{
child.State = ComponentState.None;
}
}
}
public override void Update(float deltaTime) public override void Update(float deltaTime)
{ {
if (!Visible) return; if (!Visible) return;
base.Update(deltaTime); UpdateChildrenRect(deltaTime);
//base.Update(deltaTime);
if (scrollBarEnabled && !scrollBarHidden) scrollBar.Update(deltaTime); if (scrollBarEnabled && !scrollBarHidden) scrollBar.Update(deltaTime);
@@ -277,17 +358,28 @@ namespace Barotrauma
Math.Max(Math.Min((float)rect.Width / (float)totalSize, 1.0f), 5.0f / rect.Width) : Math.Max(Math.Min((float)rect.Width / (float)totalSize, 1.0f), 5.0f / rect.Width) :
Math.Max(Math.Min((float)rect.Height / (float)totalSize, 1.0f), 5.0f / rect.Height); Math.Max(Math.Min((float)rect.Height / (float)totalSize, 1.0f), 5.0f / rect.Height);
if (scrollBar.BarSize < 1.0f && scrollBarHidden) ShowScrollBar(); scrollBarHidden = scrollBar.BarSize >= 1.0f;
if (scrollBar.BarSize >= 1.0f && !scrollBarHidden) HideScrollBar();
} }
public override void AddChild(GUIComponent child) public override void AddChild(GUIComponent child)
{ {
//temporarily reduce the size of the rect to prevent the child from expanding over the scrollbar
if (scrollBar.IsHorizontal)
rect.Height -= scrollBar.Rect.Height;
else
rect.Width -= scrollBar.Rect.Width;
base.AddChild(child); base.AddChild(child);
if (scrollBar.IsHorizontal)
rect.Height += scrollBar.Rect.Height;
else
rect.Width += scrollBar.Rect.Width;
//float oldScroll = scrollBar.BarScroll; //float oldScroll = scrollBar.BarScroll;
//float oldSize = scrollBar.BarSize; //float oldSize = scrollBar.BarSize;
UpdateScrollBarSize(); UpdateScrollBarSize();
UpdateChildrenRect(0.0f);
//if (oldSize == 1.0f && scrollBar.BarScroll == 0.0f) scrollBar.BarScroll = 1.0f; //if (oldSize == 1.0f && scrollBar.BarScroll == 0.0f) scrollBar.BarScroll = 1.0f;
@@ -312,25 +404,12 @@ namespace Barotrauma
UpdateScrollBarSize(); UpdateScrollBarSize();
} }
private void ShowScrollBar()
{
if (scrollBarHidden && !scrollBar.IsHorizontal) Rect = new Rectangle(rect.X, rect.Y, rect.Width - scrollBar.Rect.Width, rect.Height);
scrollBarHidden = false;
}
private void HideScrollBar()
{
if (!scrollBarHidden && !scrollBar.IsHorizontal) Rect = new Rectangle(rect.X, rect.Y, rect.Width + scrollBar.Rect.Width, rect.Height);
scrollBarHidden = true;
}
public override void Draw(SpriteBatch spriteBatch) public override void Draw(SpriteBatch spriteBatch)
{ {
if (!Visible) return; if (!Visible) return;
base.Draw(spriteBatch); //base.Draw(spriteBatch);
frame.Draw(spriteBatch); frame.Draw(spriteBatch);
//GUI.DrawRectangle(spriteBatch, rect, color*alpha, true); //GUI.DrawRectangle(spriteBatch, rect, color*alpha, true);
@@ -355,7 +434,6 @@ namespace Barotrauma
GUIComponent child = children[i]; GUIComponent child = children[i];
if (child == frame || !child.Visible) continue; if (child == frame || !child.Visible) continue;
child.Rect = new Rectangle(x, y, child.Rect.Width, child.Rect.Height);
if (scrollBar.IsHorizontal) if (scrollBar.IsHorizontal)
{ {
x += child.Rect.Width + spacing; x += child.Rect.Width + spacing;
+7 -2
View File
@@ -61,7 +61,12 @@ namespace Barotrauma
set set
{ {
if (base.Rect == value) return; if (base.Rect == value) return;
base.Rect = value; foreach (GUIComponent child in children)
{
child.Rect = new Rectangle(child.Rect.X + value.X - rect.X, child.Rect.Y + value.Y - rect.Y, child.Rect.Width, child.Rect.Height);
}
rect = value;
SetTextPos(); SetTextPos();
} }
} }
@@ -163,7 +168,7 @@ namespace Barotrauma
} }
} }
private void SetTextPos() public void SetTextPos()
{ {
if (text==null) return; if (text==null) return;
+15
View File
@@ -40,6 +40,21 @@ namespace Barotrauma
} }
} }
public override Rectangle Rect
{
get
{
return rect;
}
set
{
base.Rect = value;
box.Rect = new Rectangle(value.X,value.Y,box.Rect.Width,box.Rect.Height);
text.Rect = new Rectangle(box.Rect.Right + 10, box.Rect.Y + 2, 20, box.Rect.Height);
}
}
public GUITickBox(Rectangle rect, string label, Alignment alignment, GUIComponent parent) public GUITickBox(Rectangle rect, string label, Alignment alignment, GUIComponent parent)
: this(rect, label, alignment, GUI.Font, parent) : this(rect, label, alignment, GUI.Font, parent)
{ {
+12 -20
View File
@@ -78,7 +78,7 @@ namespace Barotrauma
//private Stopwatch renderTimer; //private Stopwatch renderTimer;
//public static int renderTimeElapsed; //public static int renderTimeElapsed;
public Camera Cam public Camera Cam
{ {
get { return GameScreen.Cam; } get { return GameScreen.Cam; }
@@ -295,21 +295,25 @@ namespace Barotrauma
Timing.Accumulator += gameTime.ElapsedGameTime.TotalSeconds; Timing.Accumulator += gameTime.ElapsedGameTime.TotalSeconds;
PlayerInput.UpdateVariable(); PlayerInput.UpdateVariable();
bool paused = true;
while (Timing.Accumulator >= Timing.Step) while (Timing.Accumulator >= Timing.Step)
{ {
fixedTime.IsRunningSlowly = gameTime.IsRunningSlowly; fixedTime.IsRunningSlowly = gameTime.IsRunningSlowly;
TimeSpan addTime = new TimeSpan(0,0,0,0,16); TimeSpan addTime = new TimeSpan(0, 0, 0, 0, 16);
fixedTime.ElapsedGameTime = addTime; fixedTime.ElapsedGameTime = addTime;
fixedTime.TotalGameTime.Add(addTime); fixedTime.TotalGameTime.Add(addTime);
base.Update(fixedTime); base.Update(fixedTime);
PlayerInput.Update(Timing.Step); PlayerInput.Update(Timing.Step);
bool paused = false;
if (titleScreenOpen) if (titleScreenOpen)
{ {
//TitleScreen.Update(); if (TitleScreen.LoadState >= 100.0f &&
(!waitForKeyHit || PlayerInput.GetKeyboardState.GetPressedKeys().Length>0 || PlayerInput.LeftButtonClicked()))
{
titleScreenOpen = false;
}
} }
else if (hasLoaded) else if (hasLoaded)
{ {
@@ -321,7 +325,7 @@ namespace Barotrauma
paused = (DebugConsole.IsOpen || GUI.PauseMenuOpen || GUI.SettingsMenuOpen) && paused = (DebugConsole.IsOpen || GUI.PauseMenuOpen || GUI.SettingsMenuOpen) &&
(NetworkMember == null || !NetworkMember.GameStarted); (NetworkMember == null || !NetworkMember.GameStarted);
if (!paused) if (!paused)
{ {
Screen.Selected.Update(Timing.Step); Screen.Selected.Update(Timing.Step);
@@ -334,13 +338,14 @@ namespace Barotrauma
GUI.Update((float)Timing.Step); GUI.Update((float)Timing.Step);
} }
CoroutineManager.Update((float)Timing.Step, paused ? 0.0f : (float)Timing.Step); CoroutineManager.Update((float)Timing.Step, paused ? 0.0f : (float)Timing.Step);
Timing.Accumulator -= Timing.Step; Timing.Accumulator -= Timing.Step;
} }
Timing.Alpha = Timing.Accumulator / Timing.Step; if (!paused) Timing.Alpha = Timing.Accumulator / Timing.Step;
} }
@@ -349,8 +354,6 @@ namespace Barotrauma
/// </summary> /// </summary>
protected override void Draw(GameTime gameTime) protected override void Draw(GameTime gameTime)
{ {
//renderTimer.Restart();
double deltaTime = gameTime.ElapsedGameTime.TotalSeconds; double deltaTime = gameTime.ElapsedGameTime.TotalSeconds;
FrameCounter.Update(deltaTime); FrameCounter.Update(deltaTime);
@@ -358,22 +361,11 @@ namespace Barotrauma
if (titleScreenOpen) if (titleScreenOpen)
{ {
TitleScreen.Draw(spriteBatch, GraphicsDevice, (float)deltaTime); TitleScreen.Draw(spriteBatch, GraphicsDevice, (float)deltaTime);
if (TitleScreen.LoadState>=100.0f &&
(!waitForKeyHit || PlayerInput.GetKeyboardState.GetPressedKeys().Length>0 || PlayerInput.LeftButtonClicked()))
{
titleScreenOpen = false;
}
} }
else if (hasLoaded) else if (hasLoaded)
{ {
Screen.Selected.Draw(deltaTime, GraphicsDevice, spriteBatch); Screen.Selected.Draw(deltaTime, GraphicsDevice, spriteBatch);
} }
//double elapsed = sw.Elapsed.TotalSeconds;
//if (elapsed < Physics.step)
//{
// System.Threading.Thread.Sleep((int)((Physics.step - elapsed) * 1000.0));
//}
} }
static bool waitForKeyHit = true; static bool waitForKeyHit = true;
@@ -5,14 +5,14 @@ namespace Barotrauma
{ {
class CargoManager class CargoManager
{ {
private List<MapEntityPrefab> purchasedItems; private List<ItemPrefab> purchasedItems;
public CargoManager() public CargoManager()
{ {
purchasedItems = new List<MapEntityPrefab>(); purchasedItems = new List<ItemPrefab>();
} }
public void AddItem(MapEntityPrefab item) public void AddItem(ItemPrefab item)
{ {
purchasedItems.Add(item); purchasedItems.Add(item);
} }
@@ -35,11 +35,11 @@ namespace Barotrauma
return; return;
} }
foreach (MapEntityPrefab prefab in purchasedItems) foreach (ItemPrefab prefab in purchasedItems)
{ {
Vector2 position = new Vector2( Vector2 position = new Vector2(
Rand.Range(cargoRoom.Rect.X + 20, cargoRoom.Rect.Right - 20), Rand.Range(cargoRoom.Rect.X + 20, cargoRoom.Rect.Right - 20),
Rand.Range(cargoRoom.Rect.Y - cargoRoom.Rect.Height, cargoRoom.Rect.Y)); cargoRoom.Rect.Y - cargoRoom.Rect.Height + prefab.Size.Y/2);
new Item(prefab as ItemPrefab, position, wp.Submarine); new Item(prefab as ItemPrefab, position, wp.Submarine);
} }
+37 -22
View File
@@ -12,6 +12,8 @@ namespace Barotrauma
{ {
public List<Character> characters; public List<Character> characters;
public List<CharacterInfo> characterInfos; public List<CharacterInfo> characterInfos;
public int WinningTeam = 1;
private int money; private int money;
@@ -206,35 +208,48 @@ namespace Barotrauma
public void CreateCrewFrame(List<Character> crew, GUIFrame crewFrame) public void CreateCrewFrame(List<Character> crew, GUIFrame crewFrame)
{ {
//crewFrame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), GUI.Style); List<byte> teamIDs = crew.Select(c => c.TeamID).Distinct().ToList();
//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); if (!teamIDs.Any()) teamIDs.Add(0);
crewList.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
crewList.OnSelected = SelectCrewCharacter;
foreach (Character character in crew) int listBoxHeight = 300 / teamIDs.Count;
int y = 20;
for (int i = 0; i < teamIDs.Count; i++)
{ {
GUIFrame frame = new GUIFrame(new Rectangle(0, 0, 0, 40), Color.Transparent, null, crewList); if (teamIDs.Count > 1)
frame.UserData = character; {
frame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f); new GUITextBlock(new Rectangle(0, y - 20, 100, 20), CombatMission.GetTeamName(teamIDs[i]), GUI.Style, crewFrame);
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( GUIListBox crewList = new GUIListBox(new Rectangle(0, y, 280, listBoxHeight), Color.White * 0.7f, GUI.Style, crewFrame);
new Rectangle(40, 0, 0, 25), crewList.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
character.Info.Name + " (" + character.Info.Job.Name + ")", crewList.OnSelected = SelectCrewCharacter;
Color.Transparent, Color.White,
Alignment.Left, Alignment.Left, foreach (Character character in crew.FindAll(c => c.TeamID == teamIDs[i]))
null, frame); {
textBlock.Padding = new Vector4(5.0f, 0.0f, 5.0f, 0.0f); 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;
new GUIImage(new Rectangle(-10, 0, 0, 0), character.AnimController.Limbs[0].sprite, Alignment.Left, frame); 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);
}
y += crewList.Rect.Height + 30;
} }
//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) protected virtual bool SelectCrewCharacter(GUIComponent component, object obj)
@@ -75,6 +75,8 @@ namespace Barotrauma
isRunning = true; isRunning = true;
} }
public virtual void MsgBox() { }
public virtual void Update(float deltaTime) public virtual void Update(float deltaTime)
{ {
//if (!isRunning) return; //if (!isRunning) return;
@@ -29,13 +29,12 @@ namespace Barotrauma
mission = Mission.LoadRandom(locations, rand, param as string); mission = Mission.LoadRandom(locations, rand, param as string);
} }
public override void Start() public override void MsgBox()
{ {
base.Start();
if (mission == null) return; if (mission == null) return;
new GUIMessageBox(mission.Name, mission.Description, 400, 400); var missionMsg = new GUIMessageBox(mission.Name, mission.Description, 400, 400);
missionMsg.UserData = "missionstartmessage";
Networking.GameServer.Log("Mission: " + mission.Name, Color.Cyan); Networking.GameServer.Log("Mission: " + mission.Name, Color.Cyan);
Networking.GameServer.Log(mission.Description, Color.Cyan); Networking.GameServer.Log(mission.Description, Color.Cyan);
@@ -26,6 +26,11 @@ namespace Barotrauma
private bool savedOnStart; private bool savedOnStart;
private List<Submarine> subsToLeaveBehind;
private Submarine leavingSub;
private bool atEndPosition;
public override Mission Mission public override Mission Mission
{ {
get get
@@ -80,18 +85,28 @@ namespace Barotrauma
public SinglePlayerMode(XElement element) public SinglePlayerMode(XElement element)
: this(GameModePreset.list.Find(gm => gm.Name == "Single Player"), null) : this(GameModePreset.list.Find(gm => gm.Name == "Single Player"), null)
{ {
string mapSeed = ToolBox.GetAttributeString(element, "mapseed", "a");
GenerateMap(mapSeed);
Map.SetLocation(ToolBox.GetAttributeInt(element, "currentlocation", 0));
foreach (XElement subElement in element.Elements()) foreach (XElement subElement in element.Elements())
{ {
if (subElement.Name.ToString().ToLowerInvariant() != "crew") continue; switch (subElement.Name.ToString().ToLowerInvariant())
{
GameMain.GameSession.CrewManager = new CrewManager(subElement); case "crew":
GameMain.GameSession.CrewManager = new CrewManager(subElement);
break;
case "map":
Map = Map.Load(subElement);
break;
}
}
//backwards compatibility with older save files
if (Map==null)
{
string mapSeed = ToolBox.GetAttributeString(element, "mapseed", "a");
GenerateMap(mapSeed);
Map.SetLocation(ToolBox.GetAttributeInt(element, "currentlocation", 0));
} }
savedOnStart = true; savedOnStart = true;
@@ -198,12 +213,6 @@ namespace Barotrauma
} }
endShiftButton.Draw(spriteBatch); endShiftButton.Draw(spriteBatch);
//chatBox.Draw(spriteBatch);
//textBox.Draw(spriteBatch);
//timerBar.Draw(spriteBatch);
//if (Game1.Client == null) endShiftButton.Draw(spriteBatch);
} }
public override void Update(float deltaTime) public override void Update(float deltaTime)
@@ -230,30 +239,33 @@ namespace Barotrauma
public override void End(string endMessage = "") public override void End(string endMessage = "")
{ {
isRunning = false; isRunning = false;
//if (endMessage != "" || this.endMessage == null) this.endMessage = endMessage;
bool success = CrewManager.characters.Any(c => !c.IsDead); bool success = CrewManager.characters.Any(c => !c.IsDead);
if (success)
{
if (subsToLeaveBehind == null || leavingSub == null)
{
DebugConsole.ThrowError("Leaving submarine not selected -> selecting the closest one");
leavingSub = GetLeavingSub();
subsToLeaveBehind = GetSubsToLeaveBehind(leavingSub);
}
}
GameMain.GameSession.EndShift(""); GameMain.GameSession.EndShift("");
if (success) if (success)
{ {
var leavingSub = GetLeavingSub(); if (leavingSub != Submarine.MainSub && !leavingSub.DockedTo.Contains(Submarine.MainSub))
if (!Submarine.MainSub.AtEndPosition && !Submarine.MainSub.AtStartPosition)
{ {
System.Diagnostics.Debug.Assert(leavingSub != Submarine.MainSub);
Submarine oldMainSub = Submarine.MainSub; Submarine oldMainSub = Submarine.MainSub;
Submarine.MainSub = leavingSub; Submarine.MainSub = leavingSub;
GameMain.GameSession.Submarine = leavingSub; GameMain.GameSession.Submarine = leavingSub;
List<Submarine> subsToLeaveBehind = GetSubsToLeaveBehind(leavingSub);
foreach (Submarine sub in subsToLeaveBehind) foreach (Submarine sub in subsToLeaveBehind)
{ {
MapEntity.mapEntityList.RemoveAll(e => e.Submarine == sub && e is LinkedSubmarine); MapEntity.mapEntityList.RemoveAll(e => e.Submarine == sub && e is LinkedSubmarine);
@@ -261,13 +273,11 @@ namespace Barotrauma
} }
} }
if (atEndPosition)
if (Submarine.MainSub.AtEndPosition)
{ {
Map.MoveToNextLocation(); Map.MoveToNextLocation();
} }
SaveUtil.SaveGame(GameMain.GameSession.SaveFile); SaveUtil.SaveGame(GameMain.GameSession.SaveFile);
} }
@@ -302,18 +312,18 @@ namespace Barotrauma
private bool TryEndShift(GUIButton button, object obj) private bool TryEndShift(GUIButton button, object obj)
{ {
List<Submarine> subsNotDocked = new List<Submarine>(); leavingSub = obj as Submarine;
var leavingSub = obj as Submarine;
if (leavingSub != null) if (leavingSub != null)
{ {
subsNotDocked = GetSubsToLeaveBehind(leavingSub); subsToLeaveBehind = GetSubsToLeaveBehind(leavingSub);
} }
if (subsNotDocked.Any()) atEndPosition = leavingSub.AtEndPosition;
if (subsToLeaveBehind.Any())
{ {
string msg = ""; string msg = "";
if (subsNotDocked.Count==1) if (subsToLeaveBehind.Count == 1)
{ {
msg = "One of your vessels isn't at the exit yet. Do you want to leave it behind?"; msg = "One of your vessels isn't at the exit yet. Do you want to leave it behind?";
} }
@@ -325,7 +335,7 @@ namespace Barotrauma
var msgBox = new GUIMessageBox("Warning", msg, new string[] {"Yes", "No"}); var msgBox = new GUIMessageBox("Warning", msg, new string[] {"Yes", "No"});
msgBox.Buttons[0].OnClicked += EndShift; msgBox.Buttons[0].OnClicked += EndShift;
msgBox.Buttons[0].OnClicked += msgBox.Close; msgBox.Buttons[0].OnClicked += msgBox.Close;
msgBox.Buttons[0].UserData = Submarine.Loaded.FindAll(s => !subsNotDocked.Contains(s)); msgBox.Buttons[0].UserData = Submarine.Loaded.FindAll(s => !subsToLeaveBehind.Contains(s));
msgBox.Buttons[1].OnClicked += msgBox.Close; msgBox.Buttons[1].OnClicked += msgBox.Close;
} }
@@ -343,7 +353,7 @@ namespace Barotrauma
List<Submarine> leavingSubs = obj as List<Submarine>; List<Submarine> leavingSubs = obj as List<Submarine>;
if (leavingSubs == null) leavingSubs = new List<Submarine>() { GetLeavingSub() }; if (leavingSubs == null) leavingSubs = new List<Submarine>() { GetLeavingSub() };
var cinematic = new TransitionCinematic(leavingSubs, GameMain.GameScreen.Cam, 5.0f); var cinematic = new TransitionCinematic(leavingSubs, GameMain.GameScreen.Cam, 5.0f);
SoundPlayer.OverrideMusicType = CrewManager.characters.Any(c => !c.IsDead) ? "endshift" : "crewdead"; SoundPlayer.OverrideMusicType = CrewManager.characters.Any(c => !c.IsDead) ? "endshift" : "crewdead";
@@ -378,13 +388,14 @@ namespace Barotrauma
//element.Add(new XAttribute("day", day)); //element.Add(new XAttribute("day", day));
XElement modeElement = new XElement("gamemode"); XElement modeElement = new XElement("gamemode");
modeElement.Add(new XAttribute("currentlocation", Map.CurrentLocationIndex)); //modeElement.Add(new XAttribute("currentlocation", Map.CurrentLocationIndex));
modeElement.Add(new XAttribute("mapseed", Map.Seed)); //modeElement.Add(new XAttribute("mapseed", Map.Seed));
CrewManager.Save(modeElement); CrewManager.Save(modeElement);
Map.Save(modeElement);
element.Add(modeElement); element.Add(modeElement);
} }
} }
} }
@@ -283,7 +283,7 @@ namespace Barotrauma.Tutorials
infoBox = CreateInfoFrame("Steer the submarine downwards, heading further into the cavern."); infoBox = CreateInfoFrame("Steer the submarine downwards, heading further into the cavern.");
while (Submarine.MainSub.WorldPosition.Y > 24600.0f) while (Submarine.MainSub.WorldPosition.Y > 31900.0f)
{ {
yield return CoroutineStatus.Running; yield return CoroutineStatus.Running;
} }
@@ -39,7 +39,7 @@ namespace Barotrauma.Tutorials
GameMain.GameSession = new GameSession(Submarine.MainSub, "", GameModePreset.list.Find(gm => gm.Name.ToLowerInvariant() == "tutorial")); GameMain.GameSession = new GameSession(Submarine.MainSub, "", GameModePreset.list.Find(gm => gm.Name.ToLowerInvariant() == "tutorial"));
(GameMain.GameSession.gameMode as TutorialMode).tutorialType = this; (GameMain.GameSession.gameMode as TutorialMode).tutorialType = this;
GameMain.GameSession.StartShift("tuto1"); GameMain.GameSession.StartShift("tuto2");
GameMain.GameSession.TaskManager.Tasks.Clear(); GameMain.GameSession.TaskManager.Tasks.Clear();
+25 -11
View File
@@ -107,14 +107,14 @@ namespace Barotrauma
} }
} }
public void StartShift(string levelSeed) public void StartShift(string levelSeed, bool loadSecondSub = true)
{ {
Level level = Level.CreateRandom(levelSeed); Level level = Level.CreateRandom(levelSeed);
StartShift(level); StartShift(level,true,loadSecondSub);
} }
public void StartShift(Level level, bool reloadSub = true) public void StartShift(Level level, bool reloadSub = true, bool loadSecondSub = false)
{ {
GameMain.LightManager.LosEnabled = (GameMain.Server==null || GameMain.Server.CharacterInfo!=null); GameMain.LightManager.LosEnabled = (GameMain.Server==null || GameMain.Server.CharacterInfo!=null);
@@ -128,6 +128,18 @@ namespace Barotrauma
if (reloadSub || Submarine.MainSub != submarine) submarine.Load(true); if (reloadSub || Submarine.MainSub != submarine) submarine.Load(true);
Submarine.MainSub = submarine; Submarine.MainSub = submarine;
if (loadSecondSub)
{
if (Submarine.MainSubs[1] == null)
{
Submarine.MainSubs[1] = new Submarine(Submarine.MainSub.FilePath,Submarine.MainSub.MD5Hash.Hash,true);
Submarine.MainSubs[1].Load(false);
}
else if (reloadSub)
{
Submarine.MainSubs[1].Load(false);
}
}
//var secondSub = new Submarine(submarine.FilePath, submarine.MD5Hash.Hash); //var secondSub = new Submarine(submarine.FilePath, submarine.MD5Hash.Hash);
//secondSub.Load(false); //secondSub.Load(false);
@@ -152,10 +164,14 @@ namespace Barotrauma
if (gameMode!=null) gameMode.Start(); if (gameMode!=null) gameMode.Start();
Items.Components.Radar.StartMarker = "Start";
Items.Components.Radar.EndMarker = "End";
if (gameMode.Mission != null) Mission.Start(Level.Loaded); if (gameMode.Mission != null) Mission.Start(Level.Loaded);
TaskManager.StartShift(level); TaskManager.StartShift(level);
if (gameMode != null) gameMode.MsgBox();
GameMain.GameScreen.ColorFade(Color.Black, Color.TransparentBlack, 5.0f); GameMain.GameScreen.ColorFade(Color.Black, Color.TransparentBlack, 5.0f);
SoundPlayer.SwitchMusic(); SoundPlayer.SwitchMusic();
} }
@@ -303,19 +319,15 @@ namespace Barotrauma
if (gameMode != null) gameMode.Update(deltaTime); if (gameMode != null) gameMode.Update(deltaTime);
if (Mission != null) Mission.Update(deltaTime); if (Mission != null) Mission.Update(deltaTime);
if (infoFrame != null) infoFrame.Update(deltaTime);
} }
public void Draw(SpriteBatch spriteBatch) public void Draw(SpriteBatch spriteBatch)
{ {
//guiRoot.Draw(spriteBatch);
infoButton.Draw(spriteBatch); infoButton.Draw(spriteBatch);
if (gameMode != null) gameMode.Draw(spriteBatch); if (gameMode != null) gameMode.Draw(spriteBatch);
if (infoFrame != null) if (infoFrame != null) infoFrame.Draw(spriteBatch);
{
infoFrame.Update(0.016f);
infoFrame.Draw(spriteBatch);
}
} }
public void Save(string filePath) public void Save(string filePath)
@@ -324,10 +336,12 @@ namespace Barotrauma
new XElement("Gamesession")); new XElement("Gamesession"));
var now = DateTime.Now; var now = DateTime.Now;
doc.Root.Add(new XAttribute("savetime", now.Hour + ":" + now.Minute + ", " + now.ToShortDateString())); doc.Root.Add(new XAttribute("savetime", now.ToShortTimeString() + ", " + now.ToShortDateString()));
doc.Root.Add(new XAttribute("submarine", submarine==null ? "" : submarine.Name)); doc.Root.Add(new XAttribute("submarine", submarine==null ? "" : submarine.Name));
doc.Root.Add(new XAttribute("mapseed", Map.Seed));
((SinglePlayerMode)gameMode).Save(doc.Root); ((SinglePlayerMode)gameMode).Save(doc.Root);
try try
+10 -5
View File
@@ -66,6 +66,12 @@ namespace Barotrauma
int x = 0; int x = 0;
foreach (Character character in gameSession.CrewManager.characters) foreach (Character character in gameSession.CrewManager.characters)
{ {
if (GameMain.GameSession.Mission is CombatMission &&
character.TeamID != GameMain.GameSession.CrewManager.WinningTeam)
{
continue;
}
var characterFrame = new GUIFrame(new Rectangle(x, y, 170, 70), Color.Transparent, GUI.Style, listBox); var characterFrame = new GUIFrame(new Rectangle(x, y, 170, 70), 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);
@@ -74,10 +80,9 @@ namespace Barotrauma
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 = "OK"; string statusText = "OK";
Color statusColor = Color.DarkGreen; Color statusColor = Color.DarkGreen;
if (character.IsDead) if (character.IsDead)
{ {
statusText = InfoTextManager.GetInfoText("CauseOfDeath." + character.CauseOfDeath.ToString()); statusText = InfoTextManager.GetInfoText("CauseOfDeath." + character.CauseOfDeath.ToString());
@@ -85,7 +90,7 @@ namespace Barotrauma
} }
else else
{ {
if (character.IsUnconscious) if (character.IsUnconscious)
{ {
statusText = "Unconscious"; statusText = "Unconscious";
@@ -96,13 +101,13 @@ namespace Barotrauma
statusText = "Injured"; statusText = "Injured";
statusColor = Color.DarkOrange; statusColor = Color.DarkOrange;
} }
} }
new GUITextBlock(new Rectangle(0, 0, 0, 20), statusText, new GUITextBlock(new Rectangle(0, 0, 0, 20), statusText,
GUI.Style, Alignment.BottomLeft, Alignment.TopCenter, characterFrame, true, GUI.SmallFont).Color = statusColor * 0.7f; GUI.Style, Alignment.BottomLeft, Alignment.TopCenter, characterFrame, true, GUI.SmallFont).Color = statusColor * 0.7f;
x += characterFrame.Rect.Width + 10; x += characterFrame.Rect.Width + 10;
} }
y += 120; y += 120;
+8 -19
View File
@@ -25,10 +25,8 @@ namespace Barotrauma
private KeyOrMouse[] keyMapping; private KeyOrMouse[] keyMapping;
private bool unsavedSettings; private bool unsavedSettings;
public GUIFrame SettingsFrame public GUIFrame SettingsFrame
{ {
get get
@@ -291,7 +289,7 @@ namespace Barotrauma
private bool ChangeSoundVolume(GUIScrollBar scrollBar, float barScroll) private bool ChangeSoundVolume(GUIScrollBar scrollBar, float barScroll)
{ {
UnsavedSettings = true; UnsavedSettings = true;
SoundVolume = MathHelper.Clamp(barScroll, 0.0f, 1.0f); SoundVolume = barScroll;
return true; return true;
} }
@@ -299,22 +297,11 @@ namespace Barotrauma
private bool ChangeMusicVolume(GUIScrollBar scrollBar, float barScroll) private bool ChangeMusicVolume(GUIScrollBar scrollBar, float barScroll)
{ {
UnsavedSettings = true; UnsavedSettings = true;
MusicVolume = MathHelper.Clamp(barScroll, 0.0f, 1.0f); MusicVolume = barScroll;
return true; return true;
} }
//private bool ToggleFullScreen(object userData)
//{
// UnsavedSettings = true;
// FullScreenEnabled = !FullScreenEnabled;
// GameMain.Graphics.IsFullScreen = FullScreenEnabled;
// GameMain.Graphics.ApplyChanges();
// return true;
//}
public void ResetSettingsFrame() public void ResetSettingsFrame()
{ {
settingsFrame = null; settingsFrame = null;
@@ -381,14 +368,16 @@ namespace Barotrauma
y += 70; y += 70;
new GUITextBlock(new Rectangle(0, y, 100, 20), "Sound volume:", GUI.Style, settingsFrame); new GUITextBlock(new Rectangle(0, y, 100, 20), "Sound volume:", GUI.Style, settingsFrame);
GUIScrollBar soundScrollBar = new GUIScrollBar(new Rectangle(0, y+20, 150, 20), GUI.Style,0.1f, settingsFrame); GUIScrollBar soundScrollBar = new GUIScrollBar(new Rectangle(0, y + 20, 150, 20), GUI.Style, 0.1f, settingsFrame);
soundScrollBar.BarScroll = SoundVolume; soundScrollBar.BarScroll = SoundVolume;
soundScrollBar.OnMoved = ChangeSoundVolume; soundScrollBar.OnMoved = ChangeSoundVolume;
soundScrollBar.Step = 0.05f;
new GUITextBlock(new Rectangle(0, y+40, 100, 20), "Music volume:", GUI.Style, settingsFrame); new GUITextBlock(new Rectangle(0, y + 40, 100, 20), "Music volume:", GUI.Style, settingsFrame);
GUIScrollBar musicScrollBar = new GUIScrollBar(new Rectangle(0, y+60, 150, 20), GUI.Style, 0.1f, settingsFrame); GUIScrollBar musicScrollBar = new GUIScrollBar(new Rectangle(0, y + 60, 150, 20), GUI.Style, 0.1f, settingsFrame);
musicScrollBar.BarScroll = MusicVolume; musicScrollBar.BarScroll = MusicVolume;
musicScrollBar.OnMoved = ChangeMusicVolume; musicScrollBar.OnMoved = ChangeMusicVolume;
musicScrollBar.Step = 0.05f;
x = 200; x = 200;
y = 10; y = 10;
@@ -310,7 +310,7 @@ namespace Barotrauma
MergeSlots(); MergeSlots();
} }
public override void Update(float deltaTime) public override void Update(float deltaTime, bool subInventory = false)
{ {
base.Update(deltaTime); base.Update(deltaTime);
@@ -339,7 +339,7 @@ namespace Barotrauma
//not equipped -> attempt to equip //not equipped -> attempt to equip
if (IsInLimbSlot(doubleClickedItem, InvSlotType.Any)) if (IsInLimbSlot(doubleClickedItem, InvSlotType.Any))
{ {
TryPutItem(doubleClickedItem, doubleClickedItem.AllowedSlots.FindAll(i => i != InvSlotType.Any)); TryPutItem(doubleClickedItem, doubleClickedItem.AllowedSlots.FindAll(i => i != InvSlotType.Any), true);
} }
//equipped -> attempt to unequip //equipped -> attempt to unequip
else if (doubleClickedItem.AllowedSlots.Contains(InvSlotType.Any)) else if (doubleClickedItem.AllowedSlots.Contains(InvSlotType.Any))
@@ -467,7 +467,7 @@ namespace Barotrauma
(draggingItem == null || draggingItem.Container != Items[selectedSlot])) (draggingItem == null || draggingItem.Container != Items[selectedSlot]))
{ {
selectedSlot = -1; selectedSlot = -1;
} }
} }
} }
+13 -2
View File
@@ -56,10 +56,15 @@ namespace Barotrauma.Items.Components
get get
{ {
if (linkedGap != null) return linkedGap; if (linkedGap != null) return linkedGap;
foreach (MapEntity e in item.linkedTo) foreach (MapEntity e in item.linkedTo)
{ {
linkedGap = e as Gap; linkedGap = e as Gap;
if (linkedGap != null) return linkedGap; if (linkedGap != null)
{
linkedGap.PassAmbientLight = window != Rectangle.Empty;
return linkedGap;
}
} }
Rectangle rect = item.Rect; Rectangle rect = item.Rect;
if (isHorizontal) if (isHorizontal)
@@ -75,6 +80,7 @@ namespace Barotrauma.Items.Components
linkedGap = new Gap(rect, Item.Submarine); linkedGap = new Gap(rect, Item.Submarine);
linkedGap.Submarine = item.Submarine; linkedGap.Submarine = item.Submarine;
linkedGap.PassAmbientLight = window != Rectangle.Empty;
linkedGap.Open = openState; linkedGap.Open = openState;
item.linkedTo.Add(linkedGap); item.linkedTo.Add(linkedGap);
return linkedGap; return linkedGap;
@@ -95,6 +101,11 @@ namespace Barotrauma.Items.Components
} }
} }
public Rectangle WindowRect
{
get { return window; }
}
[Editable, HasDefaultValue(false, true)] [Editable, HasDefaultValue(false, true)]
public bool IsOpen public bool IsOpen
{ {
@@ -585,6 +585,8 @@ namespace Barotrauma.Items.Components
return (average+100.0f)/2.0f; return (average+100.0f)/2.0f;
} }
public virtual void FlipX() { }
public bool HasRequiredContainedItems(bool addMessage) public bool HasRequiredContainedItems(bool addMessage)
{ {
List<RelatedItem> requiredContained = requiredItems.FindAll(ri=> ri.Type == RelatedItem.RelationType.Contained); List<RelatedItem> requiredContained = requiredItems.FindAll(ri=> ri.Type == RelatedItem.RelationType.Contained);
@@ -11,6 +11,12 @@ namespace Barotrauma.Items.Components
{ {
public LimbType limbType; public LimbType limbType;
public Vector2 position; public Vector2 position;
public LimbPos(LimbType limbType, Vector2 position)
{
this.limbType = limbType;
this.position = position;
}
} }
class Controller : ItemComponent class Controller : ItemComponent
@@ -243,5 +249,31 @@ namespace Barotrauma.Items.Components
return true; return true;
} }
public override void FlipX()
{
if (dir != Direction.None)
{
dir = dir == Direction.Left ? Direction.Right : Direction.Left;
}
if (userPos != 0.0f)
{
float diff = (item.Rect.X + UserPos) - item.Rect.Center.X;
userPos = item.Rect.Center.X - diff - item.Rect.X;
}
for (int i = 0; i < limbPositions.Count; i++)
{
float diff = (item.Rect.X + limbPositions[i].position.X) - item.Rect.Center.X;
Vector2 flippedPos =
new Vector2(
item.Rect.Center.X - diff - item.Rect.X,
limbPositions[i].position.Y);
limbPositions[i] = new LimbPos(limbPositions[i].limbType, flippedPos);
}
}
} }
} }
@@ -16,7 +16,7 @@ namespace Barotrauma.Items.Components
private float lastUpdate; private float lastUpdate;
private Hull hull1; public Hull hull1;
private GUITickBox isActiveTickBox; private GUITickBox isActiveTickBox;
@@ -21,6 +21,9 @@ namespace Barotrauma.Items.Components
private List<RadarBlip> radarBlips; private List<RadarBlip> radarBlips;
private float prevPingRadius; private float prevPingRadius;
public static string StartMarker = "Start";
public static string EndMarker = "End";
[HasDefaultValue(10000.0f, false)] [HasDefaultValue(10000.0f, false)]
public float Range public float Range
{ {
@@ -100,6 +103,11 @@ namespace Barotrauma.Items.Components
return pingState > 1.0f; return pingState > 1.0f;
} }
public override void UpdateHUD(Character character)
{
GuiFrame.Update((float)Timing.Step);
}
public override void DrawHUD(SpriteBatch spriteBatch, Character character) public override void DrawHUD(SpriteBatch spriteBatch, Character character)
{ {
GuiFrame.Draw(spriteBatch); GuiFrame.Draw(spriteBatch);
@@ -263,11 +271,11 @@ namespace Barotrauma.Items.Components
DrawMarker(spriteBatch, DrawMarker(spriteBatch,
(GameMain.GameSession.Map == null) ? "Start" : GameMain.GameSession.Map.CurrentLocation.Name, (GameMain.GameSession.Map == null) ? StartMarker : GameMain.GameSession.Map.CurrentLocation.Name,
(Level.Loaded.StartPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.5f)); (Level.Loaded.StartPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.5f));
DrawMarker(spriteBatch, DrawMarker(spriteBatch,
(GameMain.GameSession.Map == null) ? "End" : GameMain.GameSession.Map.SelectedLocation.Name, (GameMain.GameSession.Map == null) ? EndMarker : GameMain.GameSession.Map.SelectedLocation.Name,
(Level.Loaded.EndPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.5f)); (Level.Loaded.EndPosition - item.WorldPosition), displayScale, center, (rect.Width * 0.5f));
if (GameMain.GameSession.Mission != null) if (GameMain.GameSession.Mission != null)
@@ -284,6 +292,7 @@ namespace Barotrauma.Items.Components
foreach (Submarine sub in Submarine.Loaded) foreach (Submarine sub in Submarine.Loaded)
{ {
if (!sub.OnRadar) continue;
if (item.Submarine == sub || sub.DockedTo.Contains(item.Submarine)) continue; if (item.Submarine == sub || sub.DockedTo.Contains(item.Submarine)) continue;
if (sub.WorldPosition.Y > Level.Loaded.Size.Y) continue; if (sub.WorldPosition.Y > Level.Loaded.Size.Y) continue;
@@ -88,6 +88,8 @@ namespace Barotrauma.Items.Components
item.body.CollisionCategories = Physics.CollisionProjectile; item.body.CollisionCategories = Physics.CollisionProjectile;
item.body.CollidesWith = Physics.CollisionCharacter | Physics.CollisionWall | Physics.CollisionLevel; item.body.CollidesWith = Physics.CollisionCharacter | Physics.CollisionWall | Physics.CollisionLevel;
IsActive = true;
if (stickJoint == null || !doesStick) return; if (stickJoint == null || !doesStick) return;
if (stickTarget != null) if (stickTarget != null)
@@ -111,6 +113,8 @@ namespace Barotrauma.Items.Components
public override void Update(float deltaTime, Camera cam) public override void Update(float deltaTime, Camera cam)
{ {
ApplyStatusEffects(ActionType.OnActive, deltaTime, null);
if (stickJoint != null && stickJoint.JointTranslation < 0.01f) if (stickJoint != null && stickJoint.JointTranslation < 0.01f)
{ {
if (stickTarget != null) if (stickTarget != null)
@@ -174,6 +178,8 @@ namespace Barotrauma.Items.Components
ApplyStatusEffects(ActionType.OnUse, 1.0f); ApplyStatusEffects(ActionType.OnUse, 1.0f);
ApplyStatusEffects(ActionType.OnImpact, 1.0f); ApplyStatusEffects(ActionType.OnImpact, 1.0f);
IsActive = false;
item.body.FarseerBody.OnCollision -= OnProjectileCollision; item.body.FarseerBody.OnCollision -= OnProjectileCollision;
item.body.FarseerBody.IsBullet = false; item.body.FarseerBody.IsBullet = false;
@@ -122,7 +122,7 @@ namespace Barotrauma.Items.Components
base.Update(deltaTime, cam); base.Update(deltaTime, cam);
light.ParentSub = item.Submarine; light.ParentSub = item.Submarine;
ApplyStatusEffects(ActionType.OnActive, deltaTime); ApplyStatusEffects(ActionType.OnActive, deltaTime);
if (item.Container != null) if (item.Container != null)
@@ -7,6 +7,8 @@ namespace Barotrauma.Items.Components
{ {
private float maxPower; private float maxPower;
private float lastReceivedMessage;
[Editable, HasDefaultValue(1000.0f, true)] [Editable, HasDefaultValue(1000.0f, true)]
public float MaxPower public float MaxPower
{ {
@@ -73,13 +75,43 @@ namespace Barotrauma.Items.Components
} }
else if (connection.Name == "toggle") else if (connection.Name == "toggle")
{ {
IsOn = !IsOn; SetState(!IsOn,false,true);
} }
else if (connection.Name == "set_state") else if (connection.Name == "set_state")
{ {
IsOn = signal != "0"; SetState(signal != "0", false, true);
}
}
public void SetState(bool on, bool isNetworkMessage, bool sendNetworkMessage = false)
{
if (GameMain.Client != null && !isNetworkMessage) return;
IsOn = on;
if (sendNetworkMessage)
{
item.NewComponentEvent(this, false, true);
}
}
public override bool FillNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetBuffer message)
{
message.Write(IsOn);
return true;
}
public override void ReadNetworkData(Networking.NetworkEventType type, Lidgren.Network.NetIncomingMessage message, float sendingTime)
{
if (sendingTime < lastReceivedMessage) return;
if (GameMain.Server != null)
{
return;
} }
lastReceivedMessage = sendingTime;
SetState(message.ReadBoolean(), true);
} }
} }
} }
@@ -470,6 +470,14 @@ namespace Barotrauma.Items.Components
wireSprite.Depth + ((item.ID % 100) * 0.00001f)); wireSprite.Depth + ((item.ID % 100) * 0.00001f));
} }
public override void FlipX()
{
for (int i = 0; i < Nodes.Count; i++)
{
Nodes[i] = new Vector2(-Nodes[i].X, Nodes[i].Y);
}
}
public override XElement Save(XElement parentElement) public override XElement Save(XElement parentElement)
{ {
XElement componentElement = base.Save(parentElement); XElement componentElement = base.Save(parentElement);
@@ -347,6 +347,22 @@ namespace Barotrauma.Items.Components
return projectiles; return projectiles;
} }
public override void FlipX()
{
minRotation = (float)Math.PI - minRotation;
maxRotation = (float)Math.PI - maxRotation;
var temp = minRotation;
minRotation = maxRotation;
maxRotation = temp;
while (minRotation < 0)
{
minRotation += MathHelper.TwoPi;
maxRotation += MathHelper.TwoPi;
}
}
public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item sender, float power) public override void ReceiveSignal(int stepsTaken, string signal, Connection connection, Item sender, float power)
{ {
+46 -23
View File
@@ -63,9 +63,10 @@ namespace Barotrauma
protected int selectedSlot = -1; protected int selectedSlot = -1;
protected InventorySlot[] slots; protected InventorySlot[] slots;
public Item[] Items; public Item[] Items;
private bool isSubInventory;
public bool Locked; public bool Locked;
public Vector2 CenterPos public Vector2 CenterPos
@@ -232,9 +233,13 @@ namespace Barotrauma
} }
} }
public virtual void Update(float deltaTime) public virtual void Update(float deltaTime, bool subInventory = false)
{ {
if (slots == null) CreateSlots(); if (slots == null || isSubInventory != subInventory)
{
CreateSlots();
isSubInventory = subInventory;
}
for (int i = 0; i < capacity; i++) for (int i = 0; i < capacity; i++)
{ {
@@ -259,17 +264,15 @@ namespace Barotrauma
} }
public virtual void Draw(SpriteBatch spriteBatch) public virtual void Draw(SpriteBatch spriteBatch, bool subInventory = false)
{ {
string toolTip = ""; if (slots == null || isSubInventory != subInventory) return;
if (slots == null) CreateSlots();
for (int i = 0; i < capacity; i++) for (int i = 0; i < capacity; i++)
{ {
if (slots[i].Disabled) continue; if (slots[i].Disabled) continue;
//don't draw the slot if dragged an item out of it //don't draw the item if it's being dragged out of the slot
bool drawItem = draggingItem == null || draggingItem != Items[i] || slots[i].IsHighlighted; bool drawItem = draggingItem == null || draggingItem != Items[i] || slots[i].IsHighlighted;
DrawSlot(spriteBatch, slots[i], Items[i], drawItem); DrawSlot(spriteBatch, slots[i], Items[i], drawItem);
@@ -288,8 +291,20 @@ namespace Barotrauma
for (int i = 0; i < capacity; i++) for (int i = 0; i < capacity; i++)
{ {
if (slots[i].IsHighlighted && !slots[i].Disabled) if (slots[i].IsHighlighted && !slots[i].Disabled && Items[i] != null)
{ {
string toolTip = "";
if (GameMain.DebugDraw)
{
toolTip = Items[i].ToString();
}
else
{
toolTip = string.IsNullOrEmpty(Items[i].Description) ?
Items[i].Name :
Items[i].Name + '\n' + Items[i].Description;
}
DrawToolTip(spriteBatch, toolTip, slots[i].Rect); DrawToolTip(spriteBatch, toolTip, slots[i].Rect);
break; break;
} }
@@ -371,9 +386,27 @@ namespace Barotrauma
if (container.Inventory.slots == null) container.Inventory.CreateSlots(); if (container.Inventory.slots == null) container.Inventory.CreateSlots();
int itemCapacity = container.Capacity;
var slot = slots[slotIndex];
Rectangle containerRect = new Rectangle(slot.Rect.X - 5, slot.Rect.Y - (40 + 10) * itemCapacity - 5,
slot.Rect.Width + 10, slot.Rect.Height + (40 + 10) * itemCapacity + 10);
Rectangle subRect = slot.Rect;
subRect.Height = 40;
for (int i = 0; i < itemCapacity; i++)
{
subRect.Y = subRect.Y - subRect.Height - 10;
container.Inventory.slots[i].Rect = subRect;
}
}
container.Inventory.isSubInventory = true;
slots[slotIndex].State = GUIComponent.ComponentState.Hover; slots[slotIndex].State = GUIComponent.ComponentState.Hover;
container.Inventory.Update(deltaTime); container.Inventory.Update(deltaTime, true);
} }
public void DrawSubInventory(SpriteBatch spriteBatch, int slotIndex) public void DrawSubInventory(SpriteBatch spriteBatch, int slotIndex)
@@ -384,8 +417,7 @@ namespace Barotrauma
var container = item.GetComponent<ItemContainer>(); var container = item.GetComponent<ItemContainer>();
if (container == null) return; if (container == null) return;
if (container.Inventory.slots == null) container.Inventory.CreateSlots(); if (container.Inventory.slots == null || !container.Inventory.isSubInventory) return;
int itemCapacity = container.Capacity; int itemCapacity = container.Capacity;
@@ -398,20 +430,11 @@ namespace Barotrauma
var slot = slots[slotIndex]; var slot = slots[slotIndex];
Rectangle containerRect = new Rectangle(slot.Rect.X - 5, slot.Rect.Y - (40 + 10) * itemCapacity - 5, Rectangle containerRect = new Rectangle(slot.Rect.X - 5, slot.Rect.Y - (40 + 10) * itemCapacity - 5,
slot.Rect.Width + 10, slot.Rect.Height + (40 + 10) * itemCapacity + 10); slot.Rect.Width + 10, slot.Rect.Height + (40 + 10) * itemCapacity + 10);
Rectangle subRect = slot.Rect;
subRect.Height = 40;
GUI.DrawRectangle(spriteBatch, new Rectangle(containerRect.X, containerRect.Y, containerRect.Width, containerRect.Height - slot.Rect.Height - 5), Color.Black * 0.8f, true); GUI.DrawRectangle(spriteBatch, new Rectangle(containerRect.X, containerRect.Y, containerRect.Width, containerRect.Height - slot.Rect.Height - 5), Color.Black * 0.8f, true);
GUI.DrawRectangle(spriteBatch, containerRect, Color.White); GUI.DrawRectangle(spriteBatch, containerRect, Color.White);
for (int i = 0; i < itemCapacity; i++) container.Inventory.Draw(spriteBatch, true);
{
subRect.Y = subRect.Y - subRect.Height - 10;
container.Inventory.slots[i].Rect = subRect;
}
container.Inventory.Draw(spriteBatch);
if (!containerRect.Contains(PlayerInput.MousePosition)) if (!containerRect.Contains(PlayerInput.MousePosition))
{ {
File diff suppressed because it is too large Load Diff
+56 -9
View File
@@ -58,6 +58,8 @@ namespace Barotrauma
private set; private set;
} }
private bool canSpriteFlipX;
//if a matching itemprefab is not found when loading a sub, the game will attempt to find a prefab with a matching alias //if a matching itemprefab is not found when loading a sub, the game will attempt to find a prefab with a matching alias
//(allows changing item names while keeping backwards compatibility with older sub files) //(allows changing item names while keeping backwards compatibility with older sub files)
public string[] Aliases public string[] Aliases
@@ -116,21 +118,26 @@ namespace Barotrauma
private set; private set;
} }
public bool CanSpriteFlipX
{
get { return canSpriteFlipX; }
}
public Vector2 Size public Vector2 Size
{ {
get { return size; } get { return size; }
} }
public override void UpdatePlacing(SpriteBatch spriteBatch, Camera cam) public override void UpdatePlacing(Camera cam)
{ {
Vector2 position = Submarine.MouseToWorldGrid(cam, Submarine.MainSub); Vector2 position = Submarine.MouseToWorldGrid(cam, Submarine.MainSub);
if (PlayerInput.RightButtonClicked()) if (PlayerInput.RightButtonClicked())
{ {
selected = null; selected = null;
return; return;
} }
if (!resizeHorizontal && !resizeVertical) if (!resizeHorizontal && !resizeVertical)
{ {
if (PlayerInput.LeftButtonClicked()) if (PlayerInput.LeftButtonClicked())
@@ -138,16 +145,14 @@ namespace Barotrauma
var item = new Item(new Rectangle((int)position.X, (int)position.Y, (int)sprite.size.X, (int)sprite.size.Y), this, Submarine.MainSub); var item = new Item(new Rectangle((int)position.X, (int)position.Y, (int)sprite.size.X, (int)sprite.size.Y), this, Submarine.MainSub);
//constructor.Invoke(lobject); //constructor.Invoke(lobject);
item.Submarine = Submarine.MainSub; item.Submarine = Submarine.MainSub;
item.SetTransform(ConvertUnits.ToSimUnits(Submarine.MainSub==null ? item.Position : item.Position - Submarine.MainSub.Position), 0.0f); item.SetTransform(ConvertUnits.ToSimUnits(Submarine.MainSub == null ? item.Position : item.Position - Submarine.MainSub.Position), 0.0f);
item.FindHull(); item.FindHull();
placePosition = Vector2.Zero; placePosition = Vector2.Zero;
// selected = null; // selected = null;
return; return;
} }
sprite.Draw(spriteBatch, new Vector2(position.X + sprite.size.X / 2.0f, -position.Y + sprite.size.Y / 2.0f), SpriteColor);
} }
else else
{ {
@@ -172,17 +177,54 @@ namespace Barotrauma
item.Submarine = Submarine.MainSub; item.Submarine = Submarine.MainSub;
item.SetTransform(ConvertUnits.ToSimUnits(Submarine.MainSub == null ? item.Position : item.Position - Submarine.MainSub.Position), 0.0f); item.SetTransform(ConvertUnits.ToSimUnits(Submarine.MainSub == null ? item.Position : item.Position - Submarine.MainSub.Position), 0.0f);
item.FindHull(); item.FindHull();
//selected = null; //selected = null;
return; return;
} }
position = placePosition; position = placePosition;
} }
}
//if (PlayerInput.GetMouseState.RightButton == ButtonState.Pressed) selected = null;
}
public override void DrawPlacing(SpriteBatch spriteBatch,Camera cam)
{
Vector2 position = Submarine.MouseToWorldGrid(cam, Submarine.MainSub);
if (PlayerInput.RightButtonClicked())
{
selected = null;
return;
}
if (!resizeHorizontal && !resizeVertical)
{
sprite.Draw(spriteBatch, new Vector2(position.X + sprite.size.X / 2.0f, -position.Y + sprite.size.Y / 2.0f), SpriteColor);
}
else
{
Vector2 placeSize = size;
if (placePosition == Vector2.Zero)
{
if (PlayerInput.LeftButtonHeld()) placePosition = position;
}
else
{
if (resizeHorizontal)
placeSize.X = Math.Max(position.X - placePosition.X, size.X);
if (resizeVertical)
placeSize.Y = Math.Max(placePosition.Y - position.Y, size.Y);
position = placePosition;
}
if (sprite != null) sprite.DrawTiled(spriteBatch, new Vector2(position.X, -position.Y), placeSize, SpriteColor); if (sprite != null) sprite.DrawTiled(spriteBatch, new Vector2(position.X, -position.Y), placeSize, SpriteColor);
} }
//if (PlayerInput.GetMouseState.RightButton == ButtonState.Pressed) selected = null; //if (PlayerInput.GetMouseState.RightButton == ButtonState.Pressed) selected = null;
} }
@@ -270,6 +312,9 @@ namespace Barotrauma
DeconstructItems = new List<DeconstructItem>(); DeconstructItems = new List<DeconstructItem>();
DeconstructTime = 1.0f; DeconstructTime = 1.0f;
tags = new List<string>();
tags.AddRange(ToolBox.GetAttributeString(element, "tags", "").Split(','));
foreach (XElement subElement in element.Elements()) foreach (XElement subElement in element.Elements())
{ {
switch (subElement.Name.ToString().ToLowerInvariant()) switch (subElement.Name.ToString().ToLowerInvariant())
@@ -281,6 +326,8 @@ namespace Barotrauma
spriteFolder = Path.GetDirectoryName(filePath); spriteFolder = Path.GetDirectoryName(filePath);
} }
canSpriteFlipX = ToolBox.GetAttributeBool(subElement, "canflipx", true);
sprite = new Sprite(subElement, spriteFolder); sprite = new Sprite(subElement, spriteFolder);
size = sprite.size; size = sprite.size;
break; break;
+53 -34
View File
@@ -6,7 +6,35 @@ namespace Barotrauma
{ {
class ItemSpawner class ItemSpawner
{ {
private readonly Queue<Pair<ItemPrefab, object>> spawnQueue; class ItemSpawnInfo
{
public readonly ItemPrefab Prefab;
public readonly Vector2 Position;
public readonly Inventory Inventory;
public readonly Submarine Submarine;
public ItemSpawnInfo(ItemPrefab prefab, Vector2 worldPosition)
{
Prefab = prefab;
Position = worldPosition;
}
public ItemSpawnInfo(ItemPrefab prefab, Vector2 position, Submarine sub)
{
Prefab = prefab;
Position = position;
Submarine = sub;
}
public ItemSpawnInfo(ItemPrefab prefab, Inventory inventory)
{
Prefab = prefab;
Inventory = inventory;
}
}
private readonly Queue<ItemSpawnInfo> spawnQueue;
public List<Item> spawnItems = new List<Item>(); public List<Item> spawnItems = new List<Item>();
@@ -14,37 +42,31 @@ namespace Barotrauma
public ItemSpawner() public ItemSpawner()
{ {
spawnQueue = new Queue<Pair<ItemPrefab, object>>(); spawnQueue = new Queue<ItemSpawnInfo>();
} }
public void QueueItem(ItemPrefab itemPrefab, Vector2 worldPosition, bool isNetworkMessage = false) public void QueueItem(ItemPrefab itemPrefab, Vector2 worldPosition, bool isNetworkMessage = false)
{ {
if (!isNetworkMessage && GameMain.Client != null) //clients aren't allowed to spawn new items unless the server says so
{ if (!isNetworkMessage && GameMain.Client != null) return;
//clients aren't allowed to spawn new items unless the server says so
return; spawnQueue.Enqueue(new ItemSpawnInfo(itemPrefab, worldPosition));
} }
var itemInfo = new Pair<ItemPrefab, object>(); public void QueueItem(ItemPrefab itemPrefab, Vector2 position, Submarine sub, bool isNetworkMessage = false)
itemInfo.First = itemPrefab; {
itemInfo.Second = worldPosition; //clients aren't allowed to spawn new items unless the server says so
if (!isNetworkMessage && GameMain.Client != null) return;
spawnQueue.Enqueue(itemInfo); spawnQueue.Enqueue(new ItemSpawnInfo(itemPrefab, position, sub));
} }
public void QueueItem(ItemPrefab itemPrefab, Inventory inventory, bool isNetworkMessage = false) public void QueueItem(ItemPrefab itemPrefab, Inventory inventory, bool isNetworkMessage = false)
{ {
if (!isNetworkMessage && GameMain.Client != null) //clients aren't allowed to spawn new items unless the server says so
{ if (!isNetworkMessage && GameMain.Client != null) return;
//clients aren't allowed to spawn new items unless the server says so
return;
}
var itemInfo = new Pair<ItemPrefab, object>(); spawnQueue.Enqueue(new ItemSpawnInfo(itemPrefab, inventory));
itemInfo.First = itemPrefab;
itemInfo.Second = inventory;
spawnQueue.Enqueue(itemInfo);
} }
public void Update() public void Update()
@@ -58,23 +80,20 @@ namespace Barotrauma
{ {
var itemInfo = spawnQueue.Dequeue(); var itemInfo = spawnQueue.Dequeue();
if (itemInfo.Second is Vector2) Item spawnedItem = null;
if (itemInfo.Inventory != null)
{ {
var item = new Item(itemInfo.First, (Vector2)itemInfo.Second, null); spawnedItem = new Item(itemInfo.Prefab, Vector2.Zero, null);
AddToSpawnedList(item); itemInfo.Inventory.TryPutItem(spawnedItem, spawnedItem.AllowedSlots, false);
items.Add(item);
} }
else if (itemInfo.Second is Inventory) else
{ {
var item = new Item(itemInfo.First, Vector2.Zero, null); spawnedItem = new Item(itemInfo.Prefab, itemInfo.Position, itemInfo.Submarine);
AddToSpawnedList(item);
var inventory = (Inventory)itemInfo.Second;
inventory.TryPutItem(item, null);
items.Add(item);
} }
AddToSpawnedList(spawnedItem);
items.Add(spawnedItem);
} }
} }
+10 -4
View File
@@ -30,8 +30,13 @@ namespace Barotrauma
private float higherSurface; private float higherSurface;
private float lowerSurface; private float lowerSurface;
private Vector2 lerpedFlowForce;
//if set to true, hull connections of this gap won't be updated when changes are being done to hulls //if set to true, hull connections of this gap won't be updated when changes are being done to hulls
public bool DisableHullRechecks; public bool DisableHullRechecks;
//can ambient light get through the gap even if it's not open
public bool PassAmbientLight;
public float Open public float Open
{ {
@@ -48,8 +53,6 @@ namespace Barotrauma
get { return lerpedFlowForce; } get { return lerpedFlowForce; }
} }
private Vector2 lerpedFlowForce;
public Hull FlowTargetHull public Hull FlowTargetHull
{ {
get { return flowTargetHull; } get { return flowTargetHull; }
@@ -189,7 +192,7 @@ namespace Barotrauma
Color clr = (open == 0.0f) ? Color.Red : Color.Cyan; Color clr = (open == 0.0f) ? Color.Red : Color.Cyan;
if (isHighlighted) clr = Color.Gold; if (isHighlighted) clr = Color.Gold;
GUI.DrawRectangle(sb, new Rectangle(WorldRect.X, -WorldRect.Y, rect.Width, rect.Height), clr * 0.5f, true); GUI.DrawRectangle(sb, new Rectangle(WorldRect.X, -WorldRect.Y, rect.Width, rect.Height), clr * 0.5f, true,0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f));
for (int i = 0; i < linkedTo.Count; i++) for (int i = 0; i < linkedTo.Count; i++)
{ {
@@ -212,7 +215,10 @@ namespace Barotrauma
GUI.DrawRectangle(sb, GUI.DrawRectangle(sb,
new Vector2(WorldRect.X - 5, -WorldRect.Y - 5), new Vector2(WorldRect.X - 5, -WorldRect.Y - 5),
new Vector2(rect.Width + 10, rect.Height + 10), new Vector2(rect.Width + 10, rect.Height + 10),
Color.Red); Color.Red,
false,
0,
(int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f));
} }
} }
+110 -37
View File
@@ -16,6 +16,13 @@ namespace Barotrauma
{ {
public static List<Hull> hullList = new List<Hull>(); public static List<Hull> hullList = new List<Hull>();
private static List<EntityGrid> entityGrids = new List<EntityGrid>(); private static List<EntityGrid> entityGrids = new List<EntityGrid>();
public static List<EntityGrid> EntityGrids
{
get
{
return entityGrids;
}
}
public static bool ShowHulls = true; public static bool ShowHulls = true;
@@ -53,6 +60,8 @@ namespace Barotrauma
private bool update; private bool update;
public bool Visible = true;
private Sound currentFlowSound; private Sound currentFlowSound;
private int soundIndex; private int soundIndex;
private float soundVolume; private float soundVolume;
@@ -65,7 +74,7 @@ namespace Barotrauma
private float lastSentVolume, lastSentOxygen; private float lastSentVolume, lastSentOxygen;
private float lastNetworkUpdate; private float lastNetworkUpdate;
public List<Gap> ConnectedGaps; public List<Gap> ConnectedGaps;
public override string Name public override string Name
@@ -91,6 +100,9 @@ namespace Barotrauma
Item.UpdateHulls(); Item.UpdateHulls();
Gap.UpdateHulls(); Gap.UpdateHulls();
} }
surface = rect.Y - rect.Height + Volume / rect.Width;
Pressure = surface;
} }
} }
@@ -248,8 +260,8 @@ namespace Barotrauma
return rect; return rect;
} }
public static void GenerateEntityGrid(Submarine submarine) public static EntityGrid GenerateEntityGrid(Submarine submarine)
{ {
var newGrid = new EntityGrid(submarine, 200.0f); var newGrid = new EntityGrid(submarine, 200.0f);
@@ -259,6 +271,7 @@ namespace Barotrauma
{ {
if (hull.Submarine == submarine) newGrid.InsertEntity(hull); if (hull.Submarine == submarine) newGrid.InsertEntity(hull);
} }
return newGrid;
} }
public void AddToGrid(Submarine submarine) public void AddToGrid(Submarine submarine)
@@ -306,6 +319,9 @@ namespace Barotrauma
Item.UpdateHulls(); Item.UpdateHulls();
Gap.UpdateHulls(); Gap.UpdateHulls();
} }
surface = rect.Y - rect.Height + Volume / rect.Width;
Pressure = surface;
} }
public override void Remove() public override void Remove()
@@ -388,26 +404,21 @@ namespace Barotrauma
float strongestFlow = 0.0f; float strongestFlow = 0.0f;
foreach (Gap gap in ConnectedGaps) foreach (Gap gap in ConnectedGaps)
{ {
float gapFlow = gap.LerpedFlowForce.Length(); if (gap.IsRoomToRoom)
#if DEBUG
var asd = MapEntity.FindEntityByID(gap.ID);
if (asd != gap)
{ {
int adslkmfdlasfk = 9; //only the first linked hull plays the flow sound
if (gap.linkedTo[1] == this) continue;
} }
#endif
float gapFlow = gap.LerpedFlowForce.Length();
if (gapFlow > strongestFlow) if (gapFlow > strongestFlow)
{ {
strongestFlow = gapFlow; strongestFlow = gapFlow;
} }
} }
if (strongestFlow > 1.0f)
if (strongestFlow>0.1f)
{ {
soundVolume = soundVolume + ((strongestFlow < 100.0f) ? -deltaTime * 0.5f : deltaTime * 0.5f); soundVolume = soundVolume + ((strongestFlow < 100.0f) ? -deltaTime * 0.5f : deltaTime * 0.5f);
soundVolume = MathHelper.Clamp(soundVolume, 0.0f, 1.0f); soundVolume = MathHelper.Clamp(soundVolume, 0.0f, 1.0f);
@@ -424,8 +435,7 @@ namespace Barotrauma
} }
currentFlowSound = flowSound; currentFlowSound = flowSound;
soundIndex = currentFlowSound.Loop(soundIndex, soundVolume, WorldPosition, Math.Min(strongestFlow*5.0f, 2000.0f));
soundIndex = currentFlowSound.Loop(soundIndex, soundVolume, WorldPosition, 2000.0f);
} }
else else
{ {
@@ -478,11 +488,9 @@ namespace Barotrauma
waveVel[i] = waveVel[i] * -0.5f; waveVel[i] = waveVel[i] * -0.5f;
} }
//acceleration //acceleration
float a = -WaveStiffness * waveY[i] - waveVel[i] * WaveDampening; float a = -WaveStiffness * waveY[i] - waveVel[i] * WaveDampening;
waveVel[i] = waveVel[i] + a; waveVel[i] = waveVel[i] + a;
} }
for (int j = 0; j < 2; j++) for (int j = 0; j < 2; j++)
@@ -503,15 +511,21 @@ namespace Barotrauma
} }
} }
//interpolate the position of the rendered surface towards the "target surface"
surface = Math.Max(MathHelper.Lerp(surface, surfaceY, deltaTime*10.0f), rect.Y - rect.Height);
if (volume < FullVolume) if (volume < FullVolume)
{ {
LethalPressure -= 10.0f * deltaTime; LethalPressure -= 10.0f * deltaTime;
if (Volume == 0.0f) if (Volume == 0.0f)
{ {
//wait for the surface to be lerped back to bottom and the waves to settle until disabling update
if (surface > rect.Y - rect.Height + 1) return;
for (int i = 1; i < waveY.Length - 1; i++) for (int i = 1; i < waveY.Length - 1; i++)
{ {
if (waveY[i] > 0.1f) return; if (waveY[i] > 0.1f) return;
} }
update = false; update = false;
} }
} }
@@ -546,6 +560,18 @@ namespace Barotrauma
public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true) public override void Draw(SpriteBatch spriteBatch, bool editing, bool back = true)
{ {
//if (back) return; //if (back) return;
Rectangle drawRect;
if (!Visible)
{
drawRect =
Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height);
GUI.DrawRectangle(spriteBatch,
new Vector2(drawRect.X, -drawRect.Y),
new Vector2(rect.Width, rect.Height),
Color.Black,true,
0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f));
}
if (!ShowHulls && !GameMain.DebugDraw) return; if (!ShowHulls && !GameMain.DebugDraw) return;
@@ -553,17 +579,17 @@ namespace Barotrauma
if (aiTarget != null) aiTarget.Draw(spriteBatch); if (aiTarget != null) aiTarget.Draw(spriteBatch);
Rectangle drawRect = drawRect =
Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height); Submarine == null ? rect : new Rectangle((int)(Submarine.DrawPosition.X + rect.X), (int)(Submarine.DrawPosition.Y + rect.Y), rect.Width, rect.Height);
GUI.DrawRectangle(spriteBatch, GUI.DrawRectangle(spriteBatch,
new Vector2(drawRect.X, -drawRect.Y), new Vector2(drawRect.X, -drawRect.Y),
new Vector2(rect.Width, rect.Height), new Vector2(rect.Width, rect.Height),
Color.Blue); Color.Blue, false, 0, (int)Math.Max((1.5f / Screen.Selected.Cam.Zoom), 1.0f));
GUI.DrawRectangle(spriteBatch, GUI.DrawRectangle(spriteBatch,
new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height), new Rectangle(drawRect.X, -drawRect.Y, rect.Width, rect.Height),
Color.Red*((100.0f-OxygenPercentage)/400.0f), true); Color.Red * ((100.0f - OxygenPercentage) / 400.0f), true, 0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f));
if (GameMain.DebugDraw) if (GameMain.DebugDraw)
{ {
@@ -578,18 +604,10 @@ namespace Barotrauma
GUI.DrawRectangle(spriteBatch, GUI.DrawRectangle(spriteBatch,
new Vector2(drawRect.X + 5, -drawRect.Y + 5), new Vector2(drawRect.X + 5, -drawRect.Y + 5),
new Vector2(rect.Width - 10, rect.Height - 10), new Vector2(rect.Width - 10, rect.Height - 10),
isHighlighted ? Color.LightBlue*0.5f : Color.Red*0.5f, true); isHighlighted ? Color.LightBlue * 0.5f : Color.Red * 0.5f, true, 0, (int)Math.Max((1.5f / GameScreen.Selected.Cam.Zoom), 1.0f));
} }
} }
private float GetSurfaceY()
{
float top = rect.Y + Submarine.DrawPosition.Y;
float bottom = top - rect.Height;
return bottom + Volume / rect.Width;
}
public void Render(GraphicsDevice graphicsDevice, Camera cam) public void Render(GraphicsDevice graphicsDevice, Camera cam)
{ {
if (renderer.PositionInBuffer > renderer.vertices.Length - 6) return; if (renderer.PositionInBuffer > renderer.vertices.Length - 6) return;
@@ -599,10 +617,7 @@ namespace Barotrauma
//calculate where the surface should be based on the water volume //calculate where the surface should be based on the water volume
float top = rect.Y + submarinePos.Y; float top = rect.Y + submarinePos.Y;
float bottom = top - rect.Height; float bottom = top - rect.Height;
float surfaceY = bottom + Volume / rect.Width;
//interpolate the position of the rendered surface towards the "target surface"
surface = surface + ((surfaceY - submarinePos.Y) - surface) / 10.0f;
float drawSurface = surface + submarinePos.Y; float drawSurface = surface + submarinePos.Y;
Matrix transform = cam.Transform * Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f; Matrix transform = cam.Transform * Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
@@ -703,7 +718,6 @@ namespace Barotrauma
} }
var entities = EntityGrid.GetEntities(entityGrids, position, useWorldCoordinates); var entities = EntityGrid.GetEntities(entityGrids, position, useWorldCoordinates);
foreach (Hull hull in entities) foreach (Hull hull in entities)
{ {
if (Submarine.RectContains(useWorldCoordinates ? hull.WorldRect : hull.rect, position)) return hull; if (Submarine.RectContains(useWorldCoordinates ? hull.WorldRect : hull.rect, position)) return hull;
@@ -711,7 +725,7 @@ namespace Barotrauma
return null; return null;
} }
//returns the water block which contains the point (or null if it isn't inside any) //returns the water block which contains the point (or null if it isn't inside any)
public static Hull FindHullOld(Vector2 position, Hull guess = null, bool useWorldCoordinates = true) public static Hull FindHullOld(Vector2 position, Hull guess = null, bool useWorldCoordinates = true)
{ {
@@ -733,6 +747,65 @@ namespace Barotrauma
return null; return null;
} }
public static void DetectItemVisibility(Character c=null)
{
if (c==null)
{
foreach (Item it in Item.ItemList)
{
it.Visible = true;
}
}
else
{
Hull h = c.CurrentHull;
hullList.ForEach(j => j.Visible = false);
List<Hull> visibleHulls;
if (h == null || c.Submarine == null)
{
visibleHulls = hullList.FindAll(j => j.CanSeeOther(null, false));
}
else
{
visibleHulls = hullList.FindAll(j => h.CanSeeOther(j, true));
}
visibleHulls.ForEach(j => j.Visible = true);
foreach (Item it in Item.ItemList)
{
if (it.CurrentHull == null || visibleHulls.Contains(it.CurrentHull)) it.Visible = true;
else it.Visible = false;
}
}
}
private bool CanSeeOther(Hull other,bool allowIndirect=true)
{
if (other == this) return true;
if (other != null && other.Submarine==Submarine)
{
bool retVal = false;
foreach (Gap g in ConnectedGaps)
{
if (g.ConnectedWall != null && g.ConnectedWall.CastShadow) continue;
List<Hull> otherHulls = Hull.hullList.FindAll(h => h.ConnectedGaps.Contains(g) && h!=this);
retVal = otherHulls.Any(h => h == other);
if (!retVal && allowIndirect) retVal = otherHulls.Any(h => h.CanSeeOther(other, false));
if (retVal) return true;
}
}
else
{
foreach (Gap g in ConnectedGaps)
{
if (g.ConnectedDoor != null && !hullList.Any(h => h.ConnectedGaps.Contains(g) && h!=this)) return true;
}
List<MapEntity> structures = MapEntity.mapEntityList.FindAll(me => me is Structure && me.Rect.Intersects(Rect));
return structures.Any(st => !(st as Structure).CastShadow);
}
return false;
}
//public List<Gap> FindGaps() //public List<Gap> FindGaps()
//{ //{
// List<Gap> gaps = new List<Gap>(); // List<Gap> gaps = new List<Gap>();
+13 -13
View File
@@ -185,6 +185,8 @@ namespace Barotrauma
foreach (GraphEdge ge in graphEdges) foreach (GraphEdge ge in graphEdges)
{ {
if (ge.point1 == ge.point2) continue;
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
Site site = (i == 0) ? ge.site1 : ge.site2; Site site = (i == 0) ? ge.site1 : ge.site2;
@@ -408,31 +410,29 @@ namespace Barotrauma
bodyPoints[i] = ConvertUnits.ToSimUnits(bodyPoints[i]); bodyPoints[i] = ConvertUnits.ToSimUnits(bodyPoints[i]);
} }
if (cell.CellType == CellType.Empty) continue; if (cell.CellType == CellType.Empty) continue;
triangles = MathUtils.TriangulateConvexHull(bodyPoints, cell.Center); triangles = MathUtils.TriangulateConvexHull(bodyPoints, ConvertUnits.ToSimUnits(cell.Center));
Body edgeBody = new Body(GameMain.World); Body cellBody = new Body(GameMain.World);
for (int i = 0; i < triangles.Count; i++) for (int i = 0; i < triangles.Count; i++)
{ {
if (triangles[i][0].Y == triangles[i][1].Y && triangles[i][0].Y == triangles[i][2].Y) continue; if (triangles[i][0].Y == triangles[i][1].Y && triangles[i][0].Y == triangles[i][2].Y) continue;
if (triangles[i][0].X == triangles[i][1].X && triangles[i][0].X == triangles[i][2].X) continue; if (triangles[i][0].X == triangles[i][1].X && triangles[i][0].X == triangles[i][2].X) continue;
if (Vector2.DistanceSquared(triangles[i][0], triangles[i][1]) < 0.1f) continue;
if (Vector2.DistanceSquared(triangles[i][1], triangles[i][2]) < 0.1f) continue;
Vertices bodyVertices = new Vertices(triangles[i]); Vertices bodyVertices = new Vertices(triangles[i]);
FixtureFactory.AttachPolygon(bodyVertices, 5.0f, edgeBody); FixtureFactory.AttachPolygon(bodyVertices, 5.0f, cellBody);
} }
edgeBody.UserData = cell; cellBody.UserData = cell;
edgeBody.SleepingAllowed = false; cellBody.SleepingAllowed = false;
edgeBody.BodyType = BodyType.Kinematic; cellBody.BodyType = BodyType.Kinematic;
edgeBody.CollisionCategories = Physics.CollisionLevel; cellBody.CollisionCategories = Physics.CollisionLevel;
cell.body = edgeBody; cell.body = cellBody;
bodies.Add(edgeBody); bodies.Add(cellBody);
} }
return bodies; return bodies;
@@ -489,7 +489,7 @@ namespace Barotrauma
if (!MathUtils.IsValid(leftNormal)) if (!MathUtils.IsValid(leftNormal))
{ {
#if DEBUG #if DEBUG
DebugConsole.ThrowError("Invalid right normal"); DebugConsole.ThrowError("Invalid left normal");
#endif #endif
if (cell.body != null) if (cell.body != null)
{ {
+24 -4
View File
@@ -181,7 +181,7 @@ namespace Barotrauma
backgroundColor = generationParams.BackgroundColor; backgroundColor = generationParams.BackgroundColor;
float avgValue = (backgroundColor.R + backgroundColor.G + backgroundColor.G) / 3; float avgValue = (backgroundColor.R + backgroundColor.G + backgroundColor.G) / 3;
GameMain.LightManager.AmbientLight = new Color(backgroundColor * (60.0f / avgValue), 1.0f); GameMain.LightManager.AmbientLight = new Color(backgroundColor * (10.0f / avgValue), 1.0f);
float minWidth = Submarine.MainSub == null ? 0.0f : Math.Max(Submarine.MainSub.Borders.Width, Submarine.MainSub.Borders.Height); float minWidth = Submarine.MainSub == null ? 0.0f : Math.Max(Submarine.MainSub.Borders.Width, Submarine.MainSub.Borders.Height);
minWidth = Math.Max(minWidth, 6500.0f); minWidth = Math.Max(minWidth, 6500.0f);
@@ -757,7 +757,7 @@ namespace Barotrauma
int tries = 0; int tries = 0;
do do
{ {
Vector2 startPos = Level.Loaded.GetRandomInterestingPosition(true, spawnPosType); Vector2 startPos = Level.Loaded.GetRandomInterestingPosition(true, spawnPosType, true);
startPos += Rand.Vector(Rand.Range(0.0f, randomSpread, false), false); startPos += Rand.Vector(Rand.Range(0.0f, randomSpread, false), false);
@@ -784,11 +784,21 @@ namespace Barotrauma
return position; return position;
} }
public Vector2 GetRandomInterestingPosition(bool useSyncedRand, PositionType positionType) public Vector2 GetRandomInterestingPosition(bool useSyncedRand, PositionType positionType, bool avoidSubs)
{ {
if (!positionsOfInterest.Any()) return Size * 0.5f; if (!positionsOfInterest.Any()) return Size * 0.5f;
var matchingPositions = positionsOfInterest.FindAll(p => positionType.HasFlag(p.PositionType)); var matchingPositions = positionsOfInterest.FindAll(p => positionType.HasFlag(p.PositionType));
if (avoidSubs)
{
foreach (Submarine sub in Submarine.Loaded)
{
float minDist = Math.Max(sub.Borders.Width, sub.Borders.Height);
matchingPositions.RemoveAll(p => Vector2.Distance(p.Position, sub.WorldPosition) < minDist);
}
}
if (!matchingPositions.Any()) if (!matchingPositions.Any())
{ {
return positionsOfInterest[Rand.Int(positionsOfInterest.Count, !useSyncedRand)].Position; return positionsOfInterest[Rand.Int(positionsOfInterest.Count, !useSyncedRand)].Position;
@@ -797,13 +807,18 @@ namespace Barotrauma
return matchingPositions[Rand.Int(matchingPositions.Count, !useSyncedRand)].Position; return matchingPositions[Rand.Int(matchingPositions.Count, !useSyncedRand)].Position;
} }
public void Update (float deltaTime) public void Update(float deltaTime)
{ {
if (Submarine.MainSub != null) if (Submarine.MainSub != null)
{ {
WrappingWall.UpdateWallShift(Submarine.MainSub.WorldPosition, wrappingWalls); WrappingWall.UpdateWallShift(Submarine.MainSub.WorldPosition, wrappingWalls);
} }
if (Hull.renderer != null)
{
Hull.renderer.ScrollWater((float)deltaTime);
}
renderer.Update(deltaTime); renderer.Update(deltaTime);
} }
@@ -834,6 +849,11 @@ namespace Barotrauma
public void DrawBack(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, BackgroundCreatureManager backgroundSpriteManager = null) public void DrawBack(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, BackgroundCreatureManager backgroundSpriteManager = null)
{ {
float brightness = MathHelper.Clamp(50.0f + (cam.Position.Y - Size.Y) / 2000.0f, 10.0f, 40.0f);
float avgValue = (backgroundColor.R + backgroundColor.G + backgroundColor.G) / 3;
GameMain.LightManager.AmbientLight = new Color(backgroundColor * (brightness / avgValue), 1.0f);
graphics.Clear(backgroundColor); graphics.Clear(backgroundColor);
if (renderer == null) return; if (renderer == null) return;
@@ -133,33 +133,7 @@ namespace Barotrauma
get { return bottomHoleProbability; } get { return bottomHoleProbability; }
set { bottomHoleProbability = MathHelper.Clamp(value, 0.0f, 1.0f); } set { bottomHoleProbability = MathHelper.Clamp(value, 0.0f, 1.0f); }
} }
//public LevelGenerationParams()
//{
// Rand.SetSyncedSeed(ToolBox.StringToInt(seed));
// width = 100000.0f;
// height = 50000.0f;
// voronoiSiteInterval = 2000.0f;
// voronoiSiteVariance = new Vector2(voronoiSiteInterval, voronoiSiteInterval) * 0.4f;
// mainPathNodeIntervalRange = new Vector2(5000.0f, 10000.0f);
// float brightness = Rand.Range(1.0f, 1.3f, false);
// BackgroundColor = Color.Lerp(new Color(11, 18, 26), new Color(50, 46, 20), Rand.Range(0.0f, 1.0f, false)) * brightness;
// BackgroundColor = new Color(BackgroundColor, 1.0f);
// smallTunnelCount = 5;
// smallTunnelLengthRange = new Vector2(5000.0f, 10000.0f);
// ruinCount = 1;
// bottomHoleProbability = Rand.Range(0.1f, 0.8f, false);
// BackgroundSpriteAmount = (int)((new Vector2(width, height)).Length() / 100);
//}
public static LevelGenerationParams GetRandom(string seed) public static LevelGenerationParams GetRandom(string seed)
{ {
Rand.SetSyncedSeed(ToolBox.StringToInt(seed)); Rand.SetSyncedSeed(ToolBox.StringToInt(seed));
@@ -194,7 +168,7 @@ namespace Barotrauma
{ {
presets = new List<LevelGenerationParams>(); presets = new List<LevelGenerationParams>();
var files = GameMain.SelectedPackage.GetFilesOfType(ContentType.LevelGenerationPresets); var files = GameMain.SelectedPackage.GetFilesOfType(ContentType.LevelGenerationParameters);
if (!files.Any()) if (!files.Any())
{ {
files.Add("Content/Map/LevelGenerationParameters.xml"); files.Add("Content/Map/LevelGenerationParameters.xml");
@@ -202,7 +176,6 @@ namespace Barotrauma
foreach (string file in files) foreach (string file in files)
{ {
XDocument doc = ToolBox.TryLoadXml(file); XDocument doc = ToolBox.TryLoadXml(file);
if (doc == null || doc.Root == null) return; if (doc == null || doc.Root == null) return;
@@ -301,17 +301,30 @@ namespace Barotrauma.RuinGeneration
{ {
List<RuinShape> shapes = new List<RuinShape>(rooms); List<RuinShape> shapes = new List<RuinShape>(rooms);
shapes.AddRange(corridors); shapes.AddRange(corridors);
//MapEntityPrefab hullPrefab = MapEntityPrefab.list.Find(m => m.Name == "Hull");
foreach (RuinShape leaf in shapes) foreach (RuinShape leaf in shapes)
{ {
RuinStructureType wallType = RuinStructureType.Wall;
if (!(leaf is BTRoom))
{
wallType = RuinStructureType.CorridorWall;
}
//rooms further from the entrance are more likely to have hard-to-break walls
else if (Rand.Range(0.0f, leaf.DistanceFromEntrance, false) > 1.5f)
{
wallType = RuinStructureType.HeavyWall;
}
//generate walls --------------------------------------------------------------
foreach (Line wall in leaf.Walls) foreach (Line wall in leaf.Walls)
{ {
var structurePrefab = RuinStructure.GetRandom(leaf is BTRoom ? RuinStructureType.Wall : RuinStructureType.CorridorWall, leaf.GetLineAlignment(wall)); var structurePrefab = RuinStructure.GetRandom(wallType, leaf.GetLineAlignment(wall));
if (structurePrefab == null) continue; if (structurePrefab == null) continue;
float radius = (wall.A.X == wall.B.X) ? (structurePrefab.Prefab as StructurePrefab).Size.X * 0.5f : (structurePrefab.Prefab as StructurePrefab).Size.Y * 0.5f; float radius = (wall.A.X == wall.B.X) ?
(structurePrefab.Prefab as StructurePrefab).Size.X * 0.5f :
(structurePrefab.Prefab as StructurePrefab).Size.Y * 0.5f;
Rectangle rect = new Rectangle( Rectangle rect = new Rectangle(
(int)(wall.A.X - radius), (int)(wall.A.X - radius),
@@ -331,7 +344,7 @@ namespace Barotrauma.RuinGeneration
structure.SetCollisionCategory(Physics.CollisionLevel); structure.SetCollisionCategory(Physics.CollisionLevel);
} }
//generate backgrounds --------------------------------------------------------------
var background = RuinStructure.GetRandom(RuinStructureType.Back, Alignment.Center); var background = RuinStructure.GetRandom(RuinStructureType.Back, Alignment.Center);
if (background == null) continue; if (background == null) continue;
@@ -341,6 +354,7 @@ namespace Barotrauma.RuinGeneration
} }
//generate props --------------------------------------------------------------
for (int i = 0; i < shapes.Count*2; i++ ) for (int i = 0; i < shapes.Count*2; i++ )
{ {
Alignment[] alignments = new Alignment[] { Alignment.Top, Alignment.Bottom, Alignment.Right, Alignment.Left, Alignment.Center }; Alignment[] alignments = new Alignment[] { Alignment.Top, Alignment.Bottom, Alignment.Right, Alignment.Left, Alignment.Center };
@@ -383,9 +397,11 @@ namespace Barotrauma.RuinGeneration
} }
} }
//generate doors & sensors that close them -------------------------------------------------------------
var sensorPrefab = ItemPrefab.list.Find(ip => ip.Name == "Alien Motion Sensor") as ItemPrefab; var sensorPrefab = ItemPrefab.list.Find(ip => ip.Name == "Alien Motion Sensor") as ItemPrefab;
var wirePrefab = ItemPrefab.list.Find(ip => ip.Name == "Wire") as ItemPrefab; var wirePrefab = ItemPrefab.list.Find(ip => ip.Name == "Wire") as ItemPrefab;
foreach (Corridor corridor in corridors) foreach (Corridor corridor in corridors)
{ {
@@ -10,7 +10,7 @@ namespace Barotrauma.RuinGeneration
[Flags] [Flags]
enum RuinStructureType enum RuinStructureType
{ {
Wall = 1, CorridorWall = 2, Prop = 4, Back = 8, Door=16, Hatch=32 Wall = 1, CorridorWall = 2, Prop = 4, Back = 8, Door=16, Hatch=32, HeavyWall=64
} }
class RuinStructure class RuinStructure
@@ -88,7 +88,6 @@ namespace Barotrauma.RuinGeneration
foreach (RuinStructure ruinStructure in matchingStructures) foreach (RuinStructure ruinStructure in matchingStructures)
{ {
if (randomNumber <= ruinStructure.commonness) if (randomNumber <= ruinStructure.commonness)
{ {
return ruinStructure; return ruinStructure;
@@ -76,8 +76,8 @@ namespace Barotrauma
public void ScrollWater(float deltaTime) public void ScrollWater(float deltaTime)
{ {
wavePos.X += 0.006f*deltaTime; wavePos.X += 0.006f * deltaTime;
wavePos.Y += 0.006f*deltaTime; wavePos.Y += 0.006f * deltaTime;
} }
public void Render(GraphicsDevice graphicsDevice, Camera cam, RenderTarget2D texture, Matrix transform) public void Render(GraphicsDevice graphicsDevice, Camera cam, RenderTarget2D texture, Matrix transform)

Some files were not shown because too many files have changed in this diff Show More