Merge branch 'master' into moStuff
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">ReleaseLinux</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||||
<ProductVersion>8.0.30703</ProductVersion>
|
<ProductVersion>8.0.30703</ProductVersion>
|
||||||
<SchemaVersion>2.0</SchemaVersion>
|
<SchemaVersion>2.0</SchemaVersion>
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
<RootNamespace>Barotrauma</RootNamespace>
|
<RootNamespace>Barotrauma</RootNamespace>
|
||||||
<AssemblyName>Barotrauma</AssemblyName>
|
<AssemblyName>BarotraumaClient</AssemblyName>
|
||||||
<FileAlignment>512</FileAlignment>
|
<FileAlignment>512</FileAlignment>
|
||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
<PublishUrl>publish\</PublishUrl>
|
<PublishUrl>publish\</PublishUrl>
|
||||||
@@ -28,37 +28,47 @@
|
|||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
|
||||||
<TargetFrameworkProfile />
|
<TargetFrameworkProfile />
|
||||||
</PropertyGroup>
|
<ReleaseVersion>0.7.0.1</ReleaseVersion>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<Optimize>false</Optimize>
|
|
||||||
<OutputPath>..\bin\Windows\Debug\</OutputPath>
|
|
||||||
<DefineConstants>TRACE;DEBUG;WINDOWS;CLIENT</DefineConstants>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<OutputPath>..\bin\Windows\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE;WINDOWS;CLIENT</DefineConstants>
|
|
||||||
<AllowedReferenceRelatedFileExtensions>
|
|
||||||
<!-- Prevent default XML and PDB files copied to output in RELEASE.
|
|
||||||
Only *.allowedextension files will be included, which doesn't exist in my case.
|
|
||||||
-->
|
|
||||||
.allowedextension
|
|
||||||
</AllowedReferenceRelatedFileExtensions>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<WarningLevel>4</WarningLevel>
|
|
||||||
<Prefer32Bit>false</Prefer32Bit>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseLinux|x86' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>..\bin\ReleaseLinux\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;LINUX;CLIENT</DefineConstants>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugLinux|x86' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..\bin\DebugLinux\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;LINUX;CLIENT;DEBUG</DefineConstants>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWindows|x86' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>..\bin\ReleaseWindows\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;WINDOWS;CLIENT</DefineConstants>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWindows|x86' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..\bin\DebugWindows\</OutputPath>
|
||||||
|
<DefineConstants>TRACE;WINDOWS;CLIENT;DEBUG</DefineConstants>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Source\Camera.cs" />
|
<Compile Include="Source\Camera.cs" />
|
||||||
@@ -93,7 +103,6 @@
|
|||||||
<Compile Include="Source\GameSession\CrewManager.cs" />
|
<Compile Include="Source\GameSession\CrewManager.cs" />
|
||||||
<Compile Include="Source\GameSession\GameMode.cs" />
|
<Compile Include="Source\GameSession\GameMode.cs" />
|
||||||
<Compile Include="Source\GameSession\GameModes\SinglePlayerCampaign.cs" />
|
<Compile Include="Source\GameSession\GameModes\SinglePlayerCampaign.cs" />
|
||||||
<Compile Include="Source\GameSession\GameModes\TraitorManager.cs" />
|
|
||||||
<Compile Include="Source\GameSession\GameModes\Tutorials\BasicTutorial.cs" />
|
<Compile Include="Source\GameSession\GameModes\Tutorials\BasicTutorial.cs" />
|
||||||
<Compile Include="Source\GameSession\GameModes\Tutorials\EditorTutorial.cs" />
|
<Compile Include="Source\GameSession\GameModes\Tutorials\EditorTutorial.cs" />
|
||||||
<Compile Include="Source\GameSession\GameModes\Tutorials\TutorialMode.cs" />
|
<Compile Include="Source\GameSession\GameModes\Tutorials\TutorialMode.cs" />
|
||||||
@@ -221,31 +230,32 @@
|
|||||||
<Compile Include="Source\Utils\ToolBox.cs" />
|
<Compile Include="Source\Utils\ToolBox.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="MonoGame.Framework, Version=3.6.0.1625, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Condition="$(DefineConstants.Contains('WINDOWS'))" Include="MonoGame.Framework.WindowsDX">
|
||||||
<HintPath>..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.6.0.1625\lib\net40\MonoGame.Framework.dll</HintPath>
|
<HintPath>..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.6.0.1625\lib\net40\MonoGame.Framework.dll</HintPath>
|
||||||
<Private>True</Private>
|
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="NVorbis, Version=0.8.4.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Condition="$(DefineConstants.Contains('WINDOWS'))" Include="PresentationCore" />
|
||||||
|
<Reference Condition="$(DefineConstants.Contains('WINDOWS'))" Include="SharpDX">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
<HintPath>..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.6.0.1625\lib\net40\SharpDX.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Condition="$(DefineConstants.Contains('WINDOWS'))" Include="NVorbis">
|
||||||
<HintPath>..\..\Libraries\NuGet\NVorbis.0.8.5.0\lib\NVorbis.dll</HintPath>
|
<HintPath>..\..\Libraries\NuGet\NVorbis.0.8.5.0\lib\NVorbis.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
<Reference Include="OpenTK, Version=1.1.0.0, Culture=neutral, PublicKeyToken=bad199fe84eb3df4, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\Libraries\NuGet\OpenTK.2.0.0\lib\net20\OpenTK.dll</HintPath>
|
<HintPath>..\..\Libraries\NuGet\OpenTK.2.0.0\lib\net20\OpenTK.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="PresentationCore" />
|
|
||||||
<Reference Include="RestSharp">
|
|
||||||
<HintPath>..\..\Libraries\NuGet\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="SharpDX, Version=2.6.3.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1, processorArchitecture=MSIL">
|
|
||||||
<SpecificVersion>False</SpecificVersion>
|
|
||||||
<HintPath>..\..\Libraries\NuGet\MonoGame.Framework.WindowsDX.3.6.0.1625\lib\net40\SharpDX.dll</HintPath>
|
|
||||||
</Reference>
|
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Drawing" />
|
<Reference Include="System.Drawing" />
|
||||||
<Reference Include="System.Windows.Forms" />
|
<Reference Include="System.Windows.Forms" />
|
||||||
<Reference Include="System.XML" />
|
<Reference Include="System.XML" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
|
<Reference Include="RestSharp">
|
||||||
|
<HintPath>..\..\Libraries\NuGet\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Condition="$(DefineConstants.Contains('LINUX'))" Include="MonoGame.Framework.DesktopGL">
|
||||||
|
<HintPath>..\..\Libraries\NuGet\MonoGame.Framework.DesktopGL.3.6.0.1625\lib\net40\MonoGame.Framework.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="freetype6.dll">
|
<Content Include="freetype6.dll">
|
||||||
@@ -257,6 +267,15 @@
|
|||||||
<Content Include="wrap_oal.dll">
|
<Content Include="wrap_oal.dll">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="MonoGame.Framework.dll.config">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="OpenTK.dll.config">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="SharpFont.dll.config">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
|
<BootstrapperPackage Include=".NETFramework,Version=v4.0">
|
||||||
@@ -281,10 +300,6 @@
|
|||||||
</BootstrapperPackage>
|
</BootstrapperPackage>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer Physics MonoGame.csproj">
|
|
||||||
<Project>{0aad36e3-51a5-4a07-ab60-5c8a66bd38b7}</Project>
|
|
||||||
<Name>Farseer Physics MonoGame</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.csproj">
|
<ProjectReference Include="..\..\Libraries\Hyper.ComponentModel\Hyper.ComponentModel.csproj">
|
||||||
<Project>{3b8f9edb-6e5e-450c-abc2-ec49075d0b50}</Project>
|
<Project>{3b8f9edb-6e5e-450c-abc2-ec49075d0b50}</Project>
|
||||||
<Name>Hyper.ComponentModel</Name>
|
<Name>Hyper.ComponentModel</Name>
|
||||||
@@ -297,9 +312,12 @@
|
|||||||
<Project>{c293db32-fa42-486d-b128-5a12522fae4e}</Project>
|
<Project>{c293db32-fa42-486d-b128-5a12522fae4e}</Project>
|
||||||
<Name>SharpFont</Name>
|
<Name>SharpFont</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\Libraries\Farseer Physics Engine 3.5\Farseer Physics MonoGame.csproj">
|
||||||
|
<Project>{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}</Project>
|
||||||
|
<Name>Farseer Physics MonoGame</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="OpenTK.dll.config" />
|
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<configuration>
|
||||||
|
<dllmap dll="SDL2.dll" os="osx" target="libSDL2-2.0.0.dylib" />
|
||||||
|
<dllmap dll="soft_oal.dll" os="osx" target="libopenal.1.dylib" />
|
||||||
|
<dllmap dll="SDL2.dll" os="linux" cpu="x86" target="./x86/libSDL2-2.0.so.0" />
|
||||||
|
<dllmap dll="soft_oal.dll" os="linux" cpu="x86" target="./x86/libopenal.so.1" />
|
||||||
|
<dllmap dll="SDL2.dll" os="linux" cpu="x86-64" target="./x64/libSDL2-2.0.so.0" />
|
||||||
|
<dllmap dll="soft_oal.dll" os="linux" cpu="x86-64" target="./x64/libopenal.so.1" />
|
||||||
|
</configuration>
|
||||||
+6
@@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<configuration>
|
||||||
|
<dllmap dll="freetype6" os="linux" target="libfreetype.so.6" />
|
||||||
|
<dllmap dll="freetype6" os="osx" target="/Library/Frameworks/Mono.framework/Libraries/libfreetype.6.dylib" />
|
||||||
|
<dllmap dll="freetype6" os="freebsd" target="libfreetype.so.6" />
|
||||||
|
</configuration>
|
||||||
@@ -62,8 +62,6 @@ namespace Barotrauma
|
|||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
//UpdateCharacters();
|
|
||||||
|
|
||||||
int buttonWidth = 130;
|
int buttonWidth = 130;
|
||||||
int spacing = 20;
|
int spacing = 20;
|
||||||
|
|
||||||
@@ -112,10 +110,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
var orderButton = new GUIButton(rect, order.Name, null, Alignment.TopCenter, Alignment.Center, "GUITextBox", frame);
|
var orderButton = new GUIButton(rect, order.Name, null, Alignment.TopCenter, Alignment.Center, "GUITextBox", frame);
|
||||||
orderButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
orderButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||||
/*orderButton.TextColor = Color.White;
|
|
||||||
orderButton.Color = Color.Black * 0.5f;
|
|
||||||
orderButton.HoverColor = Color.LightGray * 0.5f;
|
|
||||||
orderButton.OutlineColor = Color.LightGray * 0.8f;*/
|
|
||||||
orderButton.UserData = order;
|
orderButton.UserData = order;
|
||||||
orderButton.OnClicked = SetOrder;
|
orderButton.OnClicked = SetOrder;
|
||||||
|
|
||||||
@@ -160,24 +154,18 @@ namespace Barotrauma
|
|||||||
foreach (Character character in aliveCharacters)
|
foreach (Character character in aliveCharacters)
|
||||||
{
|
{
|
||||||
int rowCharacterCount = Math.Min(charactersPerRow, aliveCharacters.Count);
|
int rowCharacterCount = Math.Min(charactersPerRow, aliveCharacters.Count);
|
||||||
//if (i >= aliveCharacters.Count - charactersPerRow && aliveCharacters.Count % charactersPerRow > 0) rowCharacterCount = aliveCharacters.Count % charactersPerRow;
|
|
||||||
|
|
||||||
// rowCharacterCount = Math.Min(rowCharacterCount, aliveCharacters.Count - i);
|
|
||||||
int startX = -(150 * rowCharacterCount + spacing * (rowCharacterCount - 1)) / 2;
|
int startX = -(150 * rowCharacterCount + spacing * (rowCharacterCount - 1)) / 2;
|
||||||
|
|
||||||
|
|
||||||
int x = startX + (150 + spacing) * (i % Math.Min(charactersPerRow, aliveCharacters.Count));
|
int x = startX + (150 + spacing) * (i % Math.Min(charactersPerRow, aliveCharacters.Count));
|
||||||
int y = (105 + spacing)*((int)Math.Floor((double)i / charactersPerRow));
|
int y = (105 + spacing)*((int)Math.Floor((double)i / charactersPerRow));
|
||||||
|
|
||||||
GUIButton characterButton = new GUIButton(new Rectangle(x+75, y, 150, 40), "", null, Alignment.TopCenter, "GUITextBox", frame);
|
GUIFrame characterFrame = new GUIFrame(new Rectangle(x + 75, y, 150, 100), null, Alignment.TopCenter, null, frame);
|
||||||
|
characterFrame.UserData = character;
|
||||||
|
|
||||||
|
GUIButton characterButton = new GUIButton(new Rectangle(0, 0, 0, 40), "", null, Alignment.TopCenter, "GUITextBox", characterFrame);
|
||||||
characterButton.UserData = character;
|
characterButton.UserData = character;
|
||||||
characterButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
characterButton.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||||
|
|
||||||
characterButton.Color = Character.Controlled == character ? Color.Gold : Color.White;
|
characterButton.Color = Character.Controlled == character ? Color.Gold : Color.White;
|
||||||
/*characterButton.HoverColor = Color.LightGray * 0.5f;
|
|
||||||
characterButton.SelectedColor = Color.Gold * 0.6f;
|
|
||||||
characterButton.OutlineColor = Color.LightGray * 0.8f;*/
|
|
||||||
|
|
||||||
characterFrameBottom = Math.Max(characterFrameBottom, characterButton.Rect.Bottom);
|
characterFrameBottom = Math.Max(characterFrameBottom, characterButton.Rect.Bottom);
|
||||||
|
|
||||||
@@ -198,7 +186,7 @@ namespace Barotrauma
|
|||||||
var humanAi = character.AIController as HumanAIController;
|
var humanAi = character.AIController as HumanAIController;
|
||||||
if (humanAi != null && humanAi.CurrentOrder != null)
|
if (humanAi != null && humanAi.CurrentOrder != null)
|
||||||
{
|
{
|
||||||
CreateCharacterOrderFrame(characterButton, humanAi.CurrentOrder, humanAi.CurrentOrderOption);
|
CreateCharacterOrderFrame(characterFrame, humanAi.CurrentOrder, humanAi.CurrentOrderOption);
|
||||||
}
|
}
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
@@ -230,15 +218,18 @@ namespace Barotrauma
|
|||||||
|
|
||||||
foreach (GUIComponent child in frame.children)
|
foreach (GUIComponent child in frame.children)
|
||||||
{
|
{
|
||||||
var characterButton = child as GUIButton;
|
Character character = child.UserData as Character;
|
||||||
|
if (character == null) continue;
|
||||||
|
|
||||||
|
var characterButton = child.GetChild<GUIButton>();
|
||||||
characterButton.State = GUIComponent.ComponentState.None;
|
characterButton.State = GUIComponent.ComponentState.None;
|
||||||
|
|
||||||
if (!characterButton.Selected) continue;
|
if (!characterButton.Selected) continue;
|
||||||
characterButton.Selected = false;
|
characterButton.Selected = false;
|
||||||
|
|
||||||
CreateCharacterOrderFrame(characterButton, order, "");
|
CreateCharacterOrderFrame(characterButton.Parent, order, "");
|
||||||
|
|
||||||
var humanAi = (characterButton.UserData as Character).AIController as HumanAIController;
|
var humanAi = character.AIController as HumanAIController;
|
||||||
|
|
||||||
humanAi.SetOrder(order, "");
|
humanAi.SetOrder(order, "");
|
||||||
}
|
}
|
||||||
@@ -259,7 +250,7 @@ namespace Barotrauma
|
|||||||
var existingOrder = characterFrame.children.Find(c => c.UserData is Order);
|
var existingOrder = characterFrame.children.Find(c => c.UserData is Order);
|
||||||
if (existingOrder != null) characterFrame.RemoveChild(existingOrder);
|
if (existingOrder != null) characterFrame.RemoveChild(existingOrder);
|
||||||
|
|
||||||
var orderFrame = new GUIFrame(new Rectangle(-5, characterFrame.Rect.Height, characterFrame.Rect.Width, 30 + order.Options.Length * 15), "InnerFrame", characterFrame);
|
var orderFrame = new GUIFrame(new Rectangle(-5, 40, characterFrame.Rect.Width, 30 + order.Options.Length * 15), "InnerFrame", characterFrame);
|
||||||
/*orderFrame.OutlineColor = Color.LightGray * 0.5f;*/
|
/*orderFrame.OutlineColor = Color.LightGray * 0.5f;*/
|
||||||
orderFrame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
orderFrame.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||||
orderFrame.UserData = order;
|
orderFrame.UserData = order;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Barotrauma.Networking;
|
using Barotrauma.Networking;
|
||||||
using Barotrauma.Particles;
|
using Barotrauma.Particles;
|
||||||
using FarseerPhysics;
|
using FarseerPhysics;
|
||||||
using FarseerPhysics.Dynamics;
|
using FarseerPhysics.Dynamics;
|
||||||
@@ -178,7 +178,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (GameMain.NetworkMember != null && Character.controlled == this)
|
if (GameMain.NetworkMember != null && Character.controlled == this)
|
||||||
{
|
{
|
||||||
string chatMessage = InfoTextManager.GetInfoText("Self_CauseOfDeath." + causeOfDeath.ToString());
|
string chatMessage = TextManager.Get("Self_CauseOfDeath." + causeOfDeath.ToString());
|
||||||
if (GameMain.Client != null) chatMessage += " Your chat messages will only be visible to other dead players.";
|
if (GameMain.Client != null) chatMessage += " Your chat messages will only be visible to other dead players.";
|
||||||
|
|
||||||
GameMain.NetworkMember.AddChatMessage(chatMessage, ChatMessageType.Dead);
|
GameMain.NetworkMember.AddChatMessage(chatMessage, ChatMessageType.Dead);
|
||||||
@@ -290,7 +290,15 @@ namespace Barotrauma
|
|||||||
string name = Info.DisplayName;
|
string name = Info.DisplayName;
|
||||||
if (controlled == null && name != Info.Name) name += " (Disguised)";
|
if (controlled == null && name != Info.Name) name += " (Disguised)";
|
||||||
|
|
||||||
Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(name) * 0.5f / cam.Zoom;
|
Vector2 namePos = new Vector2(pos.X, pos.Y - 110.0f - (5.0f / cam.Zoom)) - GUI.Font.MeasureString(Info.Name) * 0.5f / cam.Zoom;
|
||||||
|
Vector2 screenSize = new Vector2(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||||
|
Vector2 viewportSize = new Vector2(cam.WorldView.Width, cam.WorldView.Height);
|
||||||
|
namePos.X -= cam.WorldView.X; namePos.Y += cam.WorldView.Y;
|
||||||
|
namePos *= screenSize / viewportSize;
|
||||||
|
namePos.X = (float)Math.Floor(namePos.X); namePos.Y = (float)Math.Floor(namePos.Y);
|
||||||
|
namePos *= viewportSize / screenSize;
|
||||||
|
namePos.X += cam.WorldView.X; namePos.Y -= cam.WorldView.Y;
|
||||||
|
|
||||||
Color nameColor = Color.White;
|
Color nameColor = Color.White;
|
||||||
|
|
||||||
if (Controlled != null && TeamID != Controlled.TeamID)
|
if (Controlled != null && TeamID != Controlled.TeamID)
|
||||||
|
|||||||
@@ -124,6 +124,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
character.SelectedCharacter.Inventory.Update(deltaTime);
|
character.SelectedCharacter.Inventory.Update(deltaTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Inventory.UpdateDragging();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,7 +207,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
grabHoldButton = new GUIButton(
|
grabHoldButton = new GUIButton(
|
||||||
new Rectangle(character.SelectedCharacter.Inventory.SlotPositions[0].ToPoint() + new Point(320, -60), new Point(130, 20)),
|
new Rectangle(character.SelectedCharacter.Inventory.SlotPositions[0].ToPoint() + new Point(320, -60), new Point(130, 20)),
|
||||||
"Grabbing: " + (character.AnimController.GrabLimb == LimbType.Torso ? "Torso" : "Hands"), "");
|
TextManager.Get("Grabbing") + ": " + TextManager.Get(character.AnimController.GrabLimb == LimbType.None ? "Hands" : character.AnimController.GrabLimb.ToString()), "");
|
||||||
|
|
||||||
grabHoldButton.OnClicked = (button, userData) =>
|
grabHoldButton.OnClicked = (button, userData) =>
|
||||||
{
|
{
|
||||||
@@ -223,7 +225,7 @@ namespace Barotrauma
|
|||||||
GameMain.Client.CreateEntityEvent(Character.Controlled, new object[] { NetEntityEvent.Type.Control });
|
GameMain.Client.CreateEntityEvent(Character.Controlled, new object[] { NetEntityEvent.Type.Control });
|
||||||
}
|
}
|
||||||
|
|
||||||
grabHoldButton.Text = "Grabbing: " + (Character.Controlled.AnimController.GrabLimb == LimbType.Torso ? "Torso" : "Hands");
|
grabHoldButton.Text = TextManager.Get("Grabbing") + ": " + TextManager.Get(character.AnimController.GrabLimb == LimbType.None ? "Hands" : character.AnimController.GrabLimb.ToString());
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -234,6 +236,11 @@ namespace Barotrauma
|
|||||||
if (grabHoldButton.Visible) grabHoldButton.Draw(spriteBatch);
|
if (grabHoldButton.Visible) grabHoldButton.Draw(spriteBatch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (character.Inventory != null && !character.LockHands && character.Stun >= -0.1f)
|
||||||
|
{
|
||||||
|
Inventory.DrawDragging(spriteBatch);
|
||||||
|
}
|
||||||
|
|
||||||
if (character.FocusedCharacter != null && character.FocusedCharacter.CanBeSelected)
|
if (character.FocusedCharacter != null && character.FocusedCharacter.CanBeSelected)
|
||||||
{
|
{
|
||||||
Vector2 startPos = character.DrawPosition + (character.FocusedCharacter.DrawPosition - character.DrawPosition) * 0.7f;
|
Vector2 startPos = character.DrawPosition + (character.FocusedCharacter.DrawPosition - character.DrawPosition) * 0.7f;
|
||||||
@@ -309,12 +316,10 @@ namespace Barotrauma
|
|||||||
if (suicideButton == null)
|
if (suicideButton == null)
|
||||||
{
|
{
|
||||||
suicideButton = new GUIButton(
|
suicideButton = new GUIButton(
|
||||||
new Rectangle(new Point(GameMain.GraphicsWidth / 2 - 60, 20), new Point(120, 20)), "Give in", "");
|
new Rectangle(new Point(GameMain.GraphicsWidth / 2 - 60, 20), new Point(120, 20)), TextManager.Get("GiveInButton"), "");
|
||||||
|
|
||||||
|
|
||||||
suicideButton.ToolTip = GameMain.NetworkMember == null ?
|
suicideButton.ToolTip = TextManager.Get(GameMain.NetworkMember == null ? "GiveInHelpSingleplayer" : "GiveInHelpMultiplayer");
|
||||||
"The character can no longer be revived if you give in." :
|
|
||||||
"Let go of your character and enter spectator mode (other players will no longer be able to revive you)";
|
|
||||||
|
|
||||||
suicideButton.OnClicked = (button, userData) =>
|
suicideButton.OnClicked = (button, userData) =>
|
||||||
{
|
{
|
||||||
@@ -344,7 +349,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (GameMain.DebugDraw)
|
if (GameMain.DebugDraw)
|
||||||
{
|
{
|
||||||
GUI.DrawString(spriteBatch, new Vector2(30, GameMain.GraphicsHeight - 260), "Stun: "+character.Stun, Color.White);
|
GUI.DrawString(spriteBatch, new Vector2(30, GameMain.GraphicsHeight - 260), TextManager.Get("Stun") + ": " + character.Stun, Color.White);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oxygenBar == null)
|
if (oxygenBar == null)
|
||||||
@@ -364,7 +369,7 @@ namespace Barotrauma
|
|||||||
oxygenBar.Draw(spriteBatch);
|
oxygenBar.Draw(spriteBatch);
|
||||||
if (!oxyMsgShown)
|
if (!oxyMsgShown)
|
||||||
{
|
{
|
||||||
GUI.AddMessage(InfoTextManager.GetInfoText("OxygenBarInfo"), new Vector2(oxygenBar.Rect.Right + 10, oxygenBar.Rect.Y), Alignment.Left, Color.White, 5.0f);
|
GUI.AddMessage(TextManager.Get("OxygenBarInfo"), new Vector2(oxygenBar.Rect.Right + 10, oxygenBar.Rect.Y), Alignment.Left, Color.White, 5.0f);
|
||||||
oxyMsgShown = true;
|
oxyMsgShown = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -394,7 +399,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (pressureMsgTimer > 0.5f && !pressureMsgShown)
|
if (pressureMsgTimer > 0.5f && !pressureMsgShown)
|
||||||
{
|
{
|
||||||
GUI.AddMessage(InfoTextManager.GetInfoText("PressureInfo"), new Vector2(40.0f, healthBar.Rect.Y - 60.0f), Alignment.Left, Color.White, 5.0f);
|
GUI.AddMessage(TextManager.Get("PressureInfo"), new Vector2(40.0f, healthBar.Rect.Y - 60.0f), Alignment.Left, Color.White, 5.0f);
|
||||||
pressureMsgShown = true;
|
pressureMsgShown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ namespace Barotrauma
|
|||||||
var skills = Job.Skills;
|
var skills = Job.Skills;
|
||||||
skills.Sort((s1, s2) => -s1.Level.CompareTo(s2.Level));
|
skills.Sort((s1, s2) => -s1.Level.CompareTo(s2.Level));
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(x, y, 200, 20), "Skills:", "", frame, font);
|
new GUITextBlock(new Rectangle(x, y, 200, 20), TextManager.Get("Skills") + ":", "", frame, font);
|
||||||
y += 20;
|
y += 20;
|
||||||
foreach (Skill skill in skills)
|
foreach (Skill skill in skills)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -145,6 +145,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
float rotation = msg.ReadFloat();
|
float rotation = msg.ReadFloat();
|
||||||
|
|
||||||
|
ReadStatus(msg);
|
||||||
|
|
||||||
|
msg.ReadPadBits();
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
if (GameMain.NetworkMember.Character == this)
|
if (GameMain.NetworkMember.Character == this)
|
||||||
{
|
{
|
||||||
@@ -193,9 +197,6 @@ namespace Barotrauma
|
|||||||
IsRemotePlayer = ownerID > 0;
|
IsRemotePlayer = ownerID > 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2:
|
|
||||||
ReadStatus(msg);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -10,19 +10,19 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (prevTimer % 0.1f > 0.05f && IncubationTimer % 0.1f < 0.05f)
|
if (prevTimer % 0.1f > 0.05f && IncubationTimer % 0.1f < 0.05f)
|
||||||
{
|
{
|
||||||
GUI.AddMessage(InfoTextManager.GetInfoText("HuskDormant"), Color.Red, 4.0f);
|
GUI.AddMessage(TextManager.Get("HuskDormant"), Color.Red, 4.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (IncubationTimer < 1.0f)
|
else if (IncubationTimer < 1.0f)
|
||||||
{
|
{
|
||||||
if (state == InfectionState.Dormant && Character.Controlled == character)
|
if (state == InfectionState.Dormant && Character.Controlled == character)
|
||||||
{
|
{
|
||||||
new GUIMessageBox("", InfoTextManager.GetInfoText("HuskCantSpeak"));
|
new GUIMessageBox("", TextManager.Get("HuskCantSpeak"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (state != InfectionState.Active && Character.Controlled == character)
|
else if (state != InfectionState.Active && Character.Controlled == character)
|
||||||
{
|
{
|
||||||
new GUIMessageBox("", InfoTextManager.GetInfoText("HuskActivate"));
|
new GUIMessageBox("", TextManager.Get("HuskActivate"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ namespace Barotrauma
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
string hitSound;
|
private Sound hitSound;
|
||||||
|
|
||||||
public string HitSound
|
public string HitSound
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -190,6 +190,23 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private static void InitProjectSpecific()
|
private static void InitProjectSpecific()
|
||||||
{
|
{
|
||||||
|
commands.Add(new Command("autohull", "", (string[] args) =>
|
||||||
|
{
|
||||||
|
if (Screen.Selected != GameMain.SubEditorScreen) return;
|
||||||
|
|
||||||
|
if (MapEntity.mapEntityList.Any(e => e is Hull || e is Gap))
|
||||||
|
{
|
||||||
|
ShowQuestionPrompt("This submarine already has hulls and/or gaps. This command will delete them. Do you want to continue? Y/N",
|
||||||
|
(option) => {
|
||||||
|
if (option.ToLower() == "y") GameMain.SubEditorScreen.AutoHull();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
GameMain.SubEditorScreen.AutoHull();
|
||||||
|
}
|
||||||
|
}));
|
||||||
|
|
||||||
commands.Add(new Command("startclient", "", (string[] args) =>
|
commands.Add(new Command("startclient", "", (string[] args) =>
|
||||||
{
|
{
|
||||||
if (args.Length == 0) return;
|
if (args.Length == 0) return;
|
||||||
@@ -249,6 +266,13 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Character.Controlled = character;
|
Character.Controlled = character;
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
return new string[][]
|
||||||
|
{
|
||||||
|
Character.CharacterList.Select(c => c.Name).Distinct().ToArray()
|
||||||
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
commands.Add(new Command("shake", "", (string[] args) =>
|
commands.Add(new Command("shake", "", (string[] args) =>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
@@ -427,12 +427,15 @@ namespace Barotrauma
|
|||||||
ScreenOverlayColor, true);
|
ScreenOverlayColor, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameMain.DebugDraw)
|
if (GameMain.ShowFPS || GameMain.DebugDraw)
|
||||||
{
|
{
|
||||||
DrawString(spriteBatch, new Vector2(10, 10),
|
DrawString(spriteBatch, new Vector2(10, 10),
|
||||||
"FPS: " + (int)GameMain.FrameCounter.AverageFramesPerSecond,
|
"FPS: " + (int)GameMain.FrameCounter.AverageFramesPerSecond,
|
||||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameMain.DebugDraw)
|
||||||
|
{
|
||||||
DrawString(spriteBatch, new Vector2(10, 25),
|
DrawString(spriteBatch, new Vector2(10, 25),
|
||||||
"Physics: " + GameMain.World.UpdateTime,
|
"Physics: " + GameMain.World.UpdateTime,
|
||||||
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
Color.White, Color.Black * 0.5f, 0, SmallFont);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using EventInput;
|
using EventInput;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
@@ -130,6 +130,37 @@ namespace Barotrauma
|
|||||||
get { return new Vector2(rect.Center.X, rect.Center.Y); }
|
get { return new Vector2(rect.Center.X, rect.Center.Y); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Rectangle ClampRect(Rectangle r)
|
||||||
|
{
|
||||||
|
if (parent == null) return r;
|
||||||
|
Rectangle parentRect = parent.ClampRect(parent.rect);
|
||||||
|
if (parentRect.Width <= 0 || parentRect.Height <= 0) return Rectangle.Empty;
|
||||||
|
if (parentRect.X > r.X)
|
||||||
|
{
|
||||||
|
int diff = parentRect.X - r.X;
|
||||||
|
r.X = parentRect.X;
|
||||||
|
r.Width -= diff;
|
||||||
|
}
|
||||||
|
if (parentRect.Y > r.Y)
|
||||||
|
{
|
||||||
|
int diff = parentRect.Y - r.Y;
|
||||||
|
r.Y = parentRect.Y;
|
||||||
|
r.Height -= diff;
|
||||||
|
}
|
||||||
|
if (parentRect.X + parentRect.Width < r.X + r.Width)
|
||||||
|
{
|
||||||
|
int diff = (r.X + r.Width) - (parentRect.X + parentRect.Width);
|
||||||
|
r.Width -= diff;
|
||||||
|
}
|
||||||
|
if (parentRect.Y + parentRect.Height < r.Y + r.Height)
|
||||||
|
{
|
||||||
|
int diff = (r.Y + r.Height) - (parentRect.Y + parentRect.Height);
|
||||||
|
r.Height -= diff;
|
||||||
|
}
|
||||||
|
if (r.Width <= 0 || r.Height <= 0) return Rectangle.Empty;
|
||||||
|
return r;
|
||||||
|
}
|
||||||
|
|
||||||
public virtual Rectangle Rect
|
public virtual Rectangle Rect
|
||||||
{
|
{
|
||||||
get { return rect; }
|
get { return rect; }
|
||||||
@@ -162,7 +193,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public virtual Rectangle MouseRect
|
public virtual Rectangle MouseRect
|
||||||
{
|
{
|
||||||
get { return CanBeFocused ? rect : Rectangle.Empty; }
|
get { return CanBeFocused ? ClampRect(rect) : Rectangle.Empty; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public Dictionary<ComponentState, List<UISprite>> sprites;
|
public Dictionary<ComponentState, List<UISprite>> sprites;
|
||||||
|
|||||||
@@ -283,7 +283,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return rect;
|
return ClampRect(rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public GUIMessage(string text, Color color, Vector2 position, float lifeTime, Alignment textAlignment, bool autoCenter)
|
public GUIMessage(string text, Color color, Vector2 position, float lifeTime, Alignment textAlignment, bool autoCenter)
|
||||||
{
|
{
|
||||||
coloredText = new ColoredText(text, color);
|
coloredText = new ColoredText(text, color, false);
|
||||||
pos = position;
|
pos = position;
|
||||||
this.lifeTime = lifeTime;
|
this.lifeTime = lifeTime;
|
||||||
this.Alignment = textAlignment;
|
this.Alignment = textAlignment;
|
||||||
|
|||||||
@@ -39,30 +39,33 @@ namespace Barotrauma
|
|||||||
this.Buttons[0].OnClicked = Close;
|
this.Buttons[0].OnClicked = Close;
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIMessageBox(string headerText, string text, string[] buttons, int width = DefaultWidth, int height = DefaultHeight, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null)
|
public GUIMessageBox(string headerText, string text, string[] buttons, int width = DefaultWidth, int height = 0, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null)
|
||||||
: base(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
: base(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
||||||
Color.Black * 0.5f, Alignment.TopLeft, null, parent)
|
Color.Black * 0.5f, Alignment.TopLeft, null, parent)
|
||||||
{
|
{
|
||||||
|
int headerHeight = 30;
|
||||||
|
|
||||||
|
var frame = new GUIFrame(new Rectangle(0, 0, width, height), null, Alignment.Center, "", this);
|
||||||
|
GUI.Style.Apply(frame, "", this);
|
||||||
|
|
||||||
if (height == 0)
|
if (height == 0)
|
||||||
{
|
{
|
||||||
string wrappedText = ToolBox.WrapText(text, width, GUI.Font);
|
string wrappedText = ToolBox.WrapText(text, frame.Rect.Width - frame.Padding.X - frame.Padding.Z, GUI.Font);
|
||||||
string[] lines = wrappedText.Split('\n');
|
string[] lines = wrappedText.Split('\n');
|
||||||
foreach (string line in lines)
|
foreach (string line in lines)
|
||||||
{
|
{
|
||||||
height += (int)GUI.Font.MeasureString(line).Y;
|
height += (int)GUI.Font.MeasureString(line).Y;
|
||||||
}
|
}
|
||||||
height += 220;
|
height += string.IsNullOrWhiteSpace(headerText) ? 220 : 220 - headerHeight;
|
||||||
}
|
}
|
||||||
|
frame.Rect = new Rectangle(frame.Rect.X, GameMain.GraphicsHeight / 2 - height/2, frame.Rect.Width, height);
|
||||||
|
|
||||||
var frame = new GUIFrame(new Rectangle(0, 0, width, height), null, Alignment.Center, "", this);
|
var header = new GUITextBlock(new Rectangle(0, 0, 0, headerHeight), headerText, null, null, textAlignment, "", frame, true);
|
||||||
GUI.Style.Apply(frame, "", this);
|
|
||||||
|
|
||||||
var header = new GUITextBlock(new Rectangle(0, 0, 0, 30), headerText, null, null, textAlignment, "", frame, true);
|
|
||||||
GUI.Style.Apply(header, "", this);
|
GUI.Style.Apply(header, "", this);
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(text))
|
if (!string.IsNullOrWhiteSpace(text))
|
||||||
{
|
{
|
||||||
var textBlock = new GUITextBlock(new Rectangle(0, 30, 0, height - 70), text,
|
var textBlock = new GUITextBlock(new Rectangle(0, string.IsNullOrWhiteSpace(headerText) ? 0 : headerHeight, 0, height - 70), text,
|
||||||
null, null, textAlignment, "", frame, true);
|
null, null, textAlignment, "", frame, true);
|
||||||
GUI.Style.Apply(textBlock, "", this);
|
GUI.Style.Apply(textBlock, "", this);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,7 +217,6 @@ namespace Barotrauma
|
|||||||
textBlock.Flash(color);
|
textBlock.Flash(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
//MouseState previousMouse;
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
if (!Visible) return;
|
if (!Visible) return;
|
||||||
@@ -225,7 +224,7 @@ namespace Barotrauma
|
|||||||
if (flashTimer > 0.0f) flashTimer -= deltaTime;
|
if (flashTimer > 0.0f) flashTimer -= deltaTime;
|
||||||
if (!Enabled) return;
|
if (!Enabled) return;
|
||||||
|
|
||||||
if (rect.Contains(PlayerInput.MousePosition) && Enabled &&
|
if (MouseRect.Contains(PlayerInput.MousePosition) && Enabled &&
|
||||||
(MouseOn == null || MouseOn == this || IsParentOf(MouseOn) || MouseOn.IsParentOf(this)))
|
(MouseOn == null || MouseOn == this || IsParentOf(MouseOn) || MouseOn.IsParentOf(this)))
|
||||||
{
|
{
|
||||||
state = ComponentState.Hover;
|
state = ComponentState.Hover;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
@@ -63,7 +63,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override Rectangle MouseRect
|
public override Rectangle MouseRect
|
||||||
{
|
{
|
||||||
get { return box.Rect; }
|
get { return ClampRect(box.Rect); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ScalableFont Font
|
public override ScalableFont Font
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Barotrauma.Networking;
|
using Barotrauma.Networking;
|
||||||
using Barotrauma.Particles;
|
using Barotrauma.Particles;
|
||||||
using FarseerPhysics;
|
using FarseerPhysics;
|
||||||
using FarseerPhysics.Dynamics;
|
using FarseerPhysics.Dynamics;
|
||||||
@@ -14,6 +14,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
class GameMain : Game
|
class GameMain : Game
|
||||||
{
|
{
|
||||||
|
public static bool ShowFPS = true;
|
||||||
public static bool DebugDraw;
|
public static bool DebugDraw;
|
||||||
|
|
||||||
public static FrameCounter FrameCounter;
|
public static FrameCounter FrameCounter;
|
||||||
@@ -224,7 +225,7 @@ namespace Barotrauma
|
|||||||
DebugConsole.Log(SelectedPackage == null ? "No content package selected" : "Content package \"" + SelectedPackage.Name + "\" selected");
|
DebugConsole.Log(SelectedPackage == null ? "No content package selected" : "Content package \"" + SelectedPackage.Name + "\" selected");
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
|
|
||||||
LightManager = new Lights.LightManager(base.GraphicsDevice);
|
LightManager = new Lights.LightManager(base.GraphicsDevice, Content);
|
||||||
|
|
||||||
Hull.renderer = new WaterRenderer(base.GraphicsDevice, Content);
|
Hull.renderer = new WaterRenderer(base.GraphicsDevice, Content);
|
||||||
TitleScreen.LoadState = 1.0f;
|
TitleScreen.LoadState = 1.0f;
|
||||||
@@ -292,6 +293,7 @@ namespace Barotrauma
|
|||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
|
|
||||||
ParticleManager = new ParticleManager("Content/Particles/ParticlePrefabs.xml", GameScreen.Cam);
|
ParticleManager = new ParticleManager("Content/Particles/ParticlePrefabs.xml", GameScreen.Cam);
|
||||||
|
ParticleManager.LoadPrefabs();
|
||||||
DecalManager = new DecalManager("Content/Particles/DecalPrefabs.xml");
|
DecalManager = new DecalManager("Content/Particles/DecalPrefabs.xml");
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
|
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ namespace Barotrauma
|
|||||||
img.Color = order.Color;
|
img.Color = order.Color;
|
||||||
img.CanBeFocused = false;
|
img.CanBeFocused = false;
|
||||||
|
|
||||||
orderListBox.children[characterIndex].ToolTip = "Order: " + order.Name;
|
orderListBox.children[characterIndex].ToolTip = TextManager.Get("Order") + ": " + order.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool SelectCharacterOrder(GUIComponent component, object selection)
|
public bool SelectCharacterOrder(GUIComponent component, object selection)
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
namespace Barotrauma
|
|
||||||
{
|
|
||||||
partial class TraitorManager
|
|
||||||
{
|
|
||||||
public static void CreateStartPopUp(string targetName)
|
|
||||||
{
|
|
||||||
new GUIMessageBox("You are the Traitor!",
|
|
||||||
"Your secret task is to assassinate " + targetName + "! Discretion is an utmost concern; sinking the submarine and killing the entire crew "
|
|
||||||
+ "will arouse suspicion amongst the Fleet. If possible, make the death look like an accident.", 400, 350);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -48,22 +48,22 @@ namespace Barotrauma
|
|||||||
|
|
||||||
innerFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
innerFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||||
|
|
||||||
var crewButton = new GUIButton(new Rectangle(0, -30, 100, 20), "Crew", "", innerFrame);
|
var crewButton = new GUIButton(new Rectangle(0, -30, 100, 20), TextManager.Get("Crew"), "", innerFrame);
|
||||||
crewButton.UserData = InfoFrameTab.Crew;
|
crewButton.UserData = InfoFrameTab.Crew;
|
||||||
crewButton.OnClicked = SelectInfoFrameTab;
|
crewButton.OnClicked = SelectInfoFrameTab;
|
||||||
|
|
||||||
var missionButton = new GUIButton(new Rectangle(100, -30, 100, 20), "Mission", "", innerFrame);
|
var missionButton = new GUIButton(new Rectangle(100, -30, 100, 20), TextManager.Get("Mission"), "", innerFrame);
|
||||||
missionButton.UserData = InfoFrameTab.Mission;
|
missionButton.UserData = InfoFrameTab.Mission;
|
||||||
missionButton.OnClicked = SelectInfoFrameTab;
|
missionButton.OnClicked = SelectInfoFrameTab;
|
||||||
|
|
||||||
if (GameMain.Server != null)
|
if (GameMain.Server != null)
|
||||||
{
|
{
|
||||||
var manageButton = new GUIButton(new Rectangle(200, -30, 130, 20), "Manage players", "", innerFrame);
|
var manageButton = new GUIButton(new Rectangle(200, -30, 130, 20), TextManager.Get("ManagePlayers"), "", innerFrame);
|
||||||
manageButton.UserData = InfoFrameTab.ManagePlayers;
|
manageButton.UserData = InfoFrameTab.ManagePlayers;
|
||||||
manageButton.OnClicked = SelectInfoFrameTab;
|
manageButton.OnClicked = SelectInfoFrameTab;
|
||||||
}
|
}
|
||||||
|
|
||||||
var closeButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Close", Alignment.BottomCenter, "", innerFrame);
|
var closeButton = new GUIButton(new Rectangle(0, 0, 80, 20), TextManager.Get("Close"), Alignment.BottomCenter, "", innerFrame);
|
||||||
closeButton.OnClicked = ToggleInfoFrame;
|
closeButton.OnClicked = ToggleInfoFrame;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -94,16 +94,14 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (Mission == null)
|
if (Mission == null)
|
||||||
{
|
{
|
||||||
new GUITextBlock(new Rectangle(0, 0, 0, 50), "No mission", "", infoFrame, true);
|
new GUITextBlock(new Rectangle(0, 0, 0, 50), TextManager.Get("NoMission"), "", infoFrame, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 0, 0, 40), Mission.Name, "", infoFrame, GUI.LargeFont);
|
new GUITextBlock(new Rectangle(0, 0, 0, 40), Mission.Name, "", infoFrame, GUI.LargeFont);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 50, 0, 20), "Reward: " + Mission.Reward, "", infoFrame, true);
|
new GUITextBlock(new Rectangle(0, 50, 0, 20), TextManager.Get("MissionReward").Replace("[reward]", Mission.Reward.ToString()), "", infoFrame, true);
|
||||||
new GUITextBlock(new Rectangle(0, 70, 0, 50), Mission.Description, "", infoFrame, true);
|
new GUITextBlock(new Rectangle(0, 70, 0, 50), Mission.Description, "", infoFrame, true);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddToGUIUpdateList()
|
public void AddToGUIUpdateList()
|
||||||
|
|||||||
@@ -43,8 +43,12 @@ namespace Barotrauma
|
|||||||
SoundPlayer.OverrideMusicType = gameOver ? "crewdead" : "endround";
|
SoundPlayer.OverrideMusicType = gameOver ? "crewdead" : "endround";
|
||||||
}
|
}
|
||||||
|
|
||||||
string summaryText = InfoTextManager.GetInfoText(gameOver ? "gameover" :
|
string summaryText = TextManager.Get(gameOver ? "RoundSummaryGameOver" :
|
||||||
(progress ? "progress" : "return"));
|
(progress ? "RoundSummaryProgress" : "RoundSummaryReturn"));
|
||||||
|
|
||||||
|
summaryText = summaryText
|
||||||
|
.Replace("[sub]", Submarine.MainSub.Name)
|
||||||
|
.Replace("[location]", GameMain.GameSession.StartLocation.Name);
|
||||||
|
|
||||||
var infoText = new GUITextBlock(new Rectangle(0, y, 0, 50), summaryText, "", innerFrame, true);
|
var infoText = new GUITextBlock(new Rectangle(0, y, 0, 50), summaryText, "", innerFrame, true);
|
||||||
y += infoText.Rect.Height;
|
y += infoText.Rect.Height;
|
||||||
@@ -56,7 +60,7 @@ namespace Barotrauma
|
|||||||
y += 30 + endText.Text.Split('\n').Length * 20;
|
y += 30 + endText.Text.Split('\n').Length * 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, y, 0, 20), "Crew status:", "", innerFrame, GUI.LargeFont);
|
new GUITextBlock(new Rectangle(0, y, 0, 20), TextManager.Get("RoundSummaryCrewStatus"), "", innerFrame, GUI.LargeFont);
|
||||||
y += 30;
|
y += 30;
|
||||||
|
|
||||||
GUIListBox listBox = new GUIListBox(new Rectangle(0,y,0,90), null, Alignment.TopLeft, "", innerFrame, true);
|
GUIListBox listBox = new GUIListBox(new Rectangle(0,y,0,90), null, Alignment.TopLeft, "", innerFrame, true);
|
||||||
@@ -78,25 +82,25 @@ namespace Barotrauma
|
|||||||
characterInfo.CreateCharacterFrame(characterFrame,
|
characterInfo.CreateCharacterFrame(characterFrame,
|
||||||
characterInfo.Job != null ? (characterInfo.Name + '\n' + "(" + characterInfo.Job.Name + ")") : characterInfo.Name, null);
|
characterInfo.Job != null ? (characterInfo.Name + '\n' + "(" + characterInfo.Job.Name + ")") : characterInfo.Name, null);
|
||||||
|
|
||||||
string statusText = "OK";
|
string statusText = TextManager.Get("StatusOK");
|
||||||
Color statusColor = Color.DarkGreen;
|
Color statusColor = Color.DarkGreen;
|
||||||
|
|
||||||
Character character = characterInfo.Character;
|
Character character = characterInfo.Character;
|
||||||
if (character == null || character.IsDead)
|
if (character == null || character.IsDead)
|
||||||
{
|
{
|
||||||
statusText = InfoTextManager.GetInfoText("CauseOfDeath." + characterInfo.CauseOfDeath.ToString());
|
statusText = TextManager.Get("CauseOfDeath." + characterInfo.CauseOfDeath.ToString());
|
||||||
statusColor = Color.DarkRed;
|
statusColor = Color.DarkRed;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (character.IsUnconscious)
|
if (character.IsUnconscious)
|
||||||
{
|
{
|
||||||
statusText = "Unconscious";
|
statusText = TextManager.Get("Unconscious");
|
||||||
statusColor = Color.DarkOrange;
|
statusColor = Color.DarkOrange;
|
||||||
}
|
}
|
||||||
else if (character.Health / character.MaxHealth < 0.8f)
|
else if (character.Health / character.MaxHealth < 0.8f)
|
||||||
{
|
{
|
||||||
statusText = "Injured";
|
statusText = TextManager.Get("Injured");
|
||||||
statusColor = Color.DarkOrange;
|
statusColor = Color.DarkOrange;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -113,7 +117,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (GameMain.GameSession.Mission != null)
|
if (GameMain.GameSession.Mission != null)
|
||||||
{
|
{
|
||||||
new GUITextBlock(new Rectangle(0, y, 0, 20), "Mission: " + GameMain.GameSession.Mission.Name, "", innerFrame, GUI.LargeFont);
|
new GUITextBlock(new Rectangle(0, y, 0, 20), TextManager.Get("Mission") + ": " + GameMain.GameSession.Mission.Name, "", innerFrame, GUI.LargeFont);
|
||||||
y += 30;
|
y += 30;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, y, innerFrame.Rect.Width - 170, 0),
|
new GUITextBlock(new Rectangle(0, y, innerFrame.Rect.Width - 170, 0),
|
||||||
@@ -127,7 +131,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (GameMain.GameSession.Mission.Completed && singleplayer)
|
if (GameMain.GameSession.Mission.Completed && singleplayer)
|
||||||
{
|
{
|
||||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Reward: " + GameMain.GameSession.Mission.Reward, "", Alignment.BottomLeft, Alignment.BottomLeft, innerFrame);
|
new GUITextBlock(new Rectangle(0, 0, 0, 30), TextManager.Get("Reward") + ": " + GameMain.GameSession.Mission.Reward, "", Alignment.BottomLeft, Alignment.BottomLeft, innerFrame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -52,11 +52,11 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
settingsFrame = new GUIFrame(new Rectangle(0, 0, 500, 500), null, Alignment.Center, "");
|
settingsFrame = new GUIFrame(new Rectangle(0, 0, 500, 500), null, Alignment.Center, "");
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, -30, 0, 30), "Settings", "", Alignment.TopCenter, Alignment.TopCenter, settingsFrame, false, GUI.LargeFont);
|
new GUITextBlock(new Rectangle(0, -30, 0, 30), TextManager.Get("Settings"), "", Alignment.TopCenter, Alignment.TopCenter, settingsFrame, false, GUI.LargeFont);
|
||||||
|
|
||||||
int x = 0, y = 10;
|
int x = 0, y = 10;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, y, 20, 20), "Resolution", "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
new GUITextBlock(new Rectangle(0, y, 20, 20), TextManager.Get("Resolution"), "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
||||||
var resolutionDD = new GUIDropDown(new Rectangle(0, y + 20, 180, 20), "", "", settingsFrame);
|
var resolutionDD = new GUIDropDown(new Rectangle(0, y + 20, 180, 20), "", "", settingsFrame);
|
||||||
resolutionDD.OnSelected = SelectResolution;
|
resolutionDD.OnSelected = SelectResolution;
|
||||||
|
|
||||||
@@ -82,11 +82,11 @@ namespace Barotrauma
|
|||||||
//fullScreenTick.OnSelected = ToggleFullScreen;
|
//fullScreenTick.OnSelected = ToggleFullScreen;
|
||||||
//fullScreenTick.Selected = FullScreenEnabled;
|
//fullScreenTick.Selected = FullScreenEnabled;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(x, y, 20, 20), "Display mode", "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
new GUITextBlock(new Rectangle(x, y, 20, 20), TextManager.Get("DisplayMode"), "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
||||||
var displayModeDD = new GUIDropDown(new Rectangle(x, y + 20, 180, 20), "", "", settingsFrame);
|
var displayModeDD = new GUIDropDown(new Rectangle(x, y + 20, 180, 20), "", "", settingsFrame);
|
||||||
displayModeDD.AddItem("Fullscreen", WindowMode.Fullscreen);
|
displayModeDD.AddItem(TextManager.Get("Fullscreen"), WindowMode.Fullscreen);
|
||||||
displayModeDD.AddItem("Windowed", WindowMode.Windowed);
|
displayModeDD.AddItem(TextManager.Get("Windowed"), WindowMode.Windowed);
|
||||||
displayModeDD.AddItem("Borderless windowed", WindowMode.BorderlessWindowed);
|
displayModeDD.AddItem(TextManager.Get("BorderlessWindowed"), WindowMode.BorderlessWindowed);
|
||||||
|
|
||||||
displayModeDD.SelectItem(GameMain.Config.WindowMode);
|
displayModeDD.SelectItem(GameMain.Config.WindowMode);
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
y += 70;
|
y += 70;
|
||||||
|
|
||||||
GUITickBox vsyncTickBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Enable vertical sync", Alignment.CenterY | Alignment.Left, settingsFrame);
|
GUITickBox vsyncTickBox = new GUITickBox(new Rectangle(0, y, 20, 20), TextManager.Get("EnableVSync"), Alignment.CenterY | Alignment.Left, settingsFrame);
|
||||||
vsyncTickBox.OnSelected = (GUITickBox box) =>
|
vsyncTickBox.OnSelected = (GUITickBox box) =>
|
||||||
{
|
{
|
||||||
VSyncEnabled = !VSyncEnabled;
|
VSyncEnabled = !VSyncEnabled;
|
||||||
@@ -108,13 +108,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
y += 70;
|
y += 70;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, y, 100, 20), "Sound volume:", "", settingsFrame);
|
new GUITextBlock(new Rectangle(0, y, 100, 20), TextManager.Get("SoundVolume"), "", settingsFrame);
|
||||||
GUIScrollBar soundScrollBar = new GUIScrollBar(new Rectangle(0, y + 20, 150, 20), "", 0.1f, settingsFrame);
|
GUIScrollBar soundScrollBar = new GUIScrollBar(new Rectangle(0, y + 20, 150, 20), "", 0.1f, settingsFrame);
|
||||||
soundScrollBar.BarScroll = SoundVolume;
|
soundScrollBar.BarScroll = SoundVolume;
|
||||||
soundScrollBar.OnMoved = ChangeSoundVolume;
|
soundScrollBar.OnMoved = ChangeSoundVolume;
|
||||||
soundScrollBar.Step = 0.05f;
|
soundScrollBar.Step = 0.05f;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, y + 40, 100, 20), "Music volume:", "", settingsFrame);
|
new GUITextBlock(new Rectangle(0, y + 40, 100, 20), TextManager.Get("MusicVolume"), "", settingsFrame);
|
||||||
GUIScrollBar musicScrollBar = new GUIScrollBar(new Rectangle(0, y + 60, 150, 20), "", 0.1f, settingsFrame);
|
GUIScrollBar musicScrollBar = new GUIScrollBar(new Rectangle(0, y + 60, 150, 20), "", 0.1f, settingsFrame);
|
||||||
musicScrollBar.BarScroll = MusicVolume;
|
musicScrollBar.BarScroll = MusicVolume;
|
||||||
musicScrollBar.OnMoved = ChangeMusicVolume;
|
musicScrollBar.OnMoved = ChangeMusicVolume;
|
||||||
@@ -123,7 +123,7 @@ namespace Barotrauma
|
|||||||
x = 200;
|
x = 200;
|
||||||
y = 10;
|
y = 10;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(x, y, 20, 20), "Content package", "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
new GUITextBlock(new Rectangle(x, y, 20, 20), TextManager.Get("ContentPackage"), "", Alignment.TopLeft, Alignment.TopLeft, settingsFrame);
|
||||||
var contentPackageDD = new GUIDropDown(new Rectangle(x, y + 20, 200, 20), "", "", settingsFrame);
|
var contentPackageDD = new GUIDropDown(new Rectangle(x, y + 20, 200, 20), "", "", settingsFrame);
|
||||||
contentPackageDD.OnSelected = SelectContentPackage;
|
contentPackageDD.OnSelected = SelectContentPackage;
|
||||||
|
|
||||||
@@ -135,7 +135,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
y += 50;
|
y += 50;
|
||||||
new GUITextBlock(new Rectangle(x, y, 100, 20), "Controls:", "", settingsFrame);
|
new GUITextBlock(new Rectangle(x, y, 100, 20), TextManager.Get("Controls"), "", settingsFrame);
|
||||||
y += 30;
|
y += 30;
|
||||||
var inputNames = Enum.GetNames(typeof(InputType));
|
var inputNames = Enum.GetNames(typeof(InputType));
|
||||||
for (int i = 0; i < inputNames.Length; i++)
|
for (int i = 0; i < inputNames.Length; i++)
|
||||||
@@ -151,7 +151,7 @@ namespace Barotrauma
|
|||||||
y += 20;
|
y += 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
applyButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Apply", Alignment.BottomRight, "", settingsFrame);
|
applyButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("ApplySettingsButton"), Alignment.BottomRight, "", settingsFrame);
|
||||||
applyButton.OnClicked = ApplyClicked;
|
applyButton.OnClicked = ApplyClicked;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +240,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
|
if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
|
||||||
{
|
{
|
||||||
new GUIMessageBox("Restart required", "You need to restart the game for the resolution changes to take effect.");
|
new GUIMessageBox(TextManager.Get("RestartRequiredLabel"), TextManager.Get("RestartRequiredText"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -119,7 +120,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public override void Update(float deltaTime, bool subInventory = false)
|
public override void Update(float deltaTime, bool isSubInventory = false)
|
||||||
{
|
{
|
||||||
base.Update(deltaTime);
|
base.Update(deltaTime);
|
||||||
|
|
||||||
@@ -161,19 +162,39 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
draggingItem = null;
|
||||||
GUI.PlayUISound(wasPut ? GUISoundType.PickItem : GUISoundType.PickItemFail);
|
GUI.PlayUISound(wasPut ? GUISoundType.PickItem : GUISoundType.PickItemFail);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedSlot > -1)
|
|
||||||
|
if (highlightedSubInventorySlot != null)
|
||||||
{
|
{
|
||||||
UpdateSubInventory(deltaTime, selectedSlot);
|
UpdateSubInventory(deltaTime, highlightedSubInventorySlot.SlotIndex);
|
||||||
|
if (highlightedSubInventory.slots == null ||
|
||||||
|
(!highlightedSubInventorySlot.Slot.InteractRect.Contains(PlayerInput.MousePosition) && !highlightedSubInventory.slots.Any(s => s.InteractRect.Contains(PlayerInput.MousePosition))))
|
||||||
|
{
|
||||||
|
highlightedSubInventory = null;
|
||||||
|
highlightedSubInventorySlot = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (selectedSlot?.Inventory == this)
|
||||||
|
{
|
||||||
|
var subInventory = GetSubInventory(selectedSlot.SlotIndex);
|
||||||
|
if (subInventory != null)
|
||||||
|
{
|
||||||
|
highlightedSubInventory = subInventory;
|
||||||
|
highlightedSubInventorySlot = selectedSlot;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (character == Character.Controlled)
|
if (character == Character.Controlled)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < capacity; i++)
|
for (int i = 0; i < capacity; i++)
|
||||||
{
|
{
|
||||||
if (selectedSlot != i &&
|
if ((selectedSlot == null || selectedSlot.SlotIndex != i) &&
|
||||||
Items[i] != null && Items[i].CanUseOnSelf && character.HasSelectedItem(Items[i]))
|
Items[i] != null && Items[i].CanUseOnSelf && character.HasSelectedItem(Items[i]))
|
||||||
{
|
{
|
||||||
//-3 because selected items are in slots 3 and 4 (hands)
|
//-3 because selected items are in slots 3 and 4 (hands)
|
||||||
@@ -224,7 +245,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
selectedSlot = -1;
|
selectedSlot = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawOwn(SpriteBatch spriteBatch)
|
public void DrawOwn(SpriteBatch spriteBatch)
|
||||||
@@ -274,7 +295,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < capacity; i++)
|
for (int i = 0; i < capacity; i++)
|
||||||
{
|
{
|
||||||
if (selectedSlot != i &&
|
if ((selectedSlot == null || selectedSlot.SlotIndex != i) &&
|
||||||
Items[i] != null && Items[i].CanUseOnSelf && character.HasSelectedItem(Items[i]))
|
Items[i] != null && Items[i].CanUseOnSelf && character.HasSelectedItem(Items[i]))
|
||||||
{
|
{
|
||||||
useOnSelfButton[i - 3].Draw(spriteBatch);
|
useOnSelfButton[i - 3].Draw(spriteBatch);
|
||||||
@@ -282,15 +303,11 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedSlot > -1)
|
for (int i = 0; i < capacity; i++)
|
||||||
{
|
{
|
||||||
DrawSubInventory(spriteBatch, selectedSlot);
|
if (slots[i].IsHighlighted)
|
||||||
|
|
||||||
if (selectedSlot > -1 &&
|
|
||||||
!slots[selectedSlot].IsHighlighted &&
|
|
||||||
(draggingItem == null || draggingItem.Container != Items[selectedSlot]))
|
|
||||||
{
|
{
|
||||||
selectedSlot = -1;
|
DrawSubInventory(spriteBatch, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
GuiFrame.Draw(spriteBatch);
|
GuiFrame.Draw(spriteBatch);
|
||||||
|
|
||||||
if (voltage < minVoltage && powerConsumption > 0.0f) return;
|
if (voltage < minVoltage && currPowerConsumption > 0.0f) return;
|
||||||
|
|
||||||
Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40);
|
Rectangle velRect = new Rectangle(x + 20, y + 20, width - 40, height - 40);
|
||||||
//GUI.DrawRectangle(spriteBatch, velRect, Color.White, false);
|
//GUI.DrawRectangle(spriteBatch, velRect, Color.White, false);
|
||||||
@@ -137,6 +137,8 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
GuiFrame.Update(1.0f / 60.0f);
|
GuiFrame.Update(1.0f / 60.0f);
|
||||||
|
|
||||||
|
if (voltage < minVoltage && currPowerConsumption > 0.0f) return;
|
||||||
|
|
||||||
if (Vector2.Distance(PlayerInput.MousePosition, new Vector2(GuiFrame.Rect.Center.X, GuiFrame.Rect.Center.Y)) < 200.0f)
|
if (Vector2.Distance(PlayerInput.MousePosition, new Vector2(GuiFrame.Rect.Center.X, GuiFrame.Rect.Center.Y)) < 200.0f)
|
||||||
{
|
{
|
||||||
if (PlayerInput.LeftButtonHeld())
|
if (PlayerInput.LeftButtonHeld())
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ namespace Barotrauma.Items.Components
|
|||||||
Item.Name + " (" + Name + ") to " + otherConnection.item.Name + " (" + otherConnection.Name + ")", ServerLog.MessageType.ItemInteraction);
|
Item.Name + " (" + Name + ") to " + otherConnection.item.Name + " (" + otherConnection.Name + ")", ServerLog.MessageType.ItemInteraction);
|
||||||
}
|
}
|
||||||
|
|
||||||
Wires[index] = draggingConnected;
|
AddLink(index, draggingConnected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using Microsoft.Xna.Framework;
|
|||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using Microsoft.Xna.Framework.Input;
|
using Microsoft.Xna.Framework.Input;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace Barotrauma.Items.Components
|
namespace Barotrauma.Items.Components
|
||||||
{
|
{
|
||||||
@@ -36,6 +37,12 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static Sprite wireSprite;
|
||||||
|
|
||||||
|
private static Wire draggingWire;
|
||||||
|
private static int? selectedNodeIndex;
|
||||||
|
private static int? highlightedNodeIndex;
|
||||||
|
|
||||||
public void Draw(SpriteBatch spriteBatch, bool editing)
|
public void Draw(SpriteBatch spriteBatch, bool editing)
|
||||||
{
|
{
|
||||||
if (sections.Count == 0 && !IsActive)
|
if (sections.Count == 0 && !IsActive)
|
||||||
@@ -69,7 +76,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
foreach (WireSection section in sections)
|
foreach (WireSection section in sections)
|
||||||
{
|
{
|
||||||
section.Draw(spriteBatch, item.Color, drawOffset, depth, 0.3f);
|
section.Draw(spriteBatch, item.Submarine == null ? Color.Green : item.Color, drawOffset, depth, 0.3f);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsActive && nodes.Count > 0 && Vector2.Distance(newNodePos, nodes[nodes.Count - 1]) > nodeDistance)
|
if (IsActive && nodes.Count > 0 && Vector2.Distance(newNodePos, nodes[nodes.Count - 1]) > nodeDistance)
|
||||||
@@ -91,14 +98,15 @@ namespace Barotrauma.Items.Components
|
|||||||
if (item.Submarine != null) drawPos += item.Submarine.Position + item.Submarine.HiddenSubPosition;
|
if (item.Submarine != null) drawPos += item.Submarine.Position + item.Submarine.HiddenSubPosition;
|
||||||
drawPos.Y = -drawPos.Y;
|
drawPos.Y = -drawPos.Y;
|
||||||
|
|
||||||
|
if ((highlightedNodeIndex == i && item.IsHighlighted) || (selectedNodeIndex == i && item.IsSelected))
|
||||||
|
{
|
||||||
|
GUI.DrawRectangle(spriteBatch, drawPos + new Vector2(-10, -10), new Vector2(20, 20), Color.Red, false, 0.0f);
|
||||||
|
}
|
||||||
|
|
||||||
if (item.IsSelected)
|
if (item.IsSelected)
|
||||||
{
|
{
|
||||||
GUI.DrawRectangle(spriteBatch, drawPos + new Vector2(-5, -5), new Vector2(10, 10), item.Color, true, 0.0f);
|
GUI.DrawRectangle(spriteBatch, drawPos + new Vector2(-5, -5), new Vector2(10, 10), item.Color, true, 0.0f);
|
||||||
|
|
||||||
if (highlightedNodeIndex == i)
|
|
||||||
{
|
|
||||||
GUI.DrawRectangle(spriteBatch, drawPos + new Vector2(-10, -10), new Vector2(20, 20), Color.Red, false, 0.0f);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -196,27 +204,35 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
//check which wire is highlighted with the cursor
|
//check which wire is highlighted with the cursor
|
||||||
Wire highlighted = null;
|
Wire highlighted = null;
|
||||||
float closestDist = 0.0f;
|
float closestDist = float.PositiveInfinity;
|
||||||
foreach (Wire w in wires)
|
foreach (Wire w in wires)
|
||||||
{
|
{
|
||||||
Vector2 mousePos = GameMain.SubEditorScreen.Cam.ScreenToWorld(PlayerInput.MousePosition);
|
Vector2 mousePos = GameMain.SubEditorScreen.Cam.ScreenToWorld(PlayerInput.MousePosition);
|
||||||
if (w.item.Submarine != null) mousePos -= (w.item.Submarine.Position + w.item.Submarine.HiddenSubPosition);
|
if (w.item.Submarine != null) mousePos -= (w.item.Submarine.Position + w.item.Submarine.HiddenSubPosition);
|
||||||
|
|
||||||
float dist = 0.0f;
|
float dist = 0.0f;
|
||||||
if (w.GetClosestNodeIndex(mousePos, highlighted == null ? nodeSelectDist : closestDist, out dist) > -1)
|
int highlightedNode = w.GetClosestNodeIndex(mousePos, highlighted == null ? nodeSelectDist : closestDist, out dist);
|
||||||
|
if (highlightedNode > -1)
|
||||||
{
|
{
|
||||||
|
if (dist < closestDist)
|
||||||
|
{
|
||||||
|
highlightedNodeIndex = highlightedNode;
|
||||||
highlighted = w;
|
highlighted = w;
|
||||||
closestDist = dist;
|
closestDist = dist;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (w.GetClosestSectionIndex(mousePos, highlighted == null ? sectionSelectDist : closestDist, out dist) > -1)
|
if (w.GetClosestSectionIndex(mousePos, highlighted == null ? sectionSelectDist : closestDist, out dist) > -1)
|
||||||
{
|
{
|
||||||
|
//prefer nodes over sections
|
||||||
|
if (dist + nodeSelectDist * 0.5f < closestDist)
|
||||||
|
{
|
||||||
|
highlightedNodeIndex = null;
|
||||||
highlighted = w;
|
highlighted = w;
|
||||||
closestDist = dist;
|
closestDist = dist + nodeSelectDist * 0.5f;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (highlighted != null)
|
if (highlighted != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -90,14 +90,26 @@ namespace Barotrauma.Items.Components
|
|||||||
GUI.DrawRectangle(spriteBatch, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
GUI.DrawRectangle(spriteBatch, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
||||||
Color.Green * 0.1f, true);
|
Color.Green * 0.1f, true);
|
||||||
|
|
||||||
|
Character closestCharacter = null;
|
||||||
|
float closestDist = float.PositiveInfinity;
|
||||||
|
|
||||||
foreach (Character c in visibleCharacters)
|
foreach (Character c in visibleCharacters)
|
||||||
{
|
{
|
||||||
if (c == character) continue;
|
if (c == character) continue;
|
||||||
|
|
||||||
float dist = Vector2.Distance(character.WorldPosition, c.WorldPosition);
|
float dist = Vector2.DistanceSquared(GameMain.GameScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), c.WorldPosition);
|
||||||
DrawCharacterInfo(spriteBatch, c, 1.0f - MathHelper.Max((dist - (Range - FadeOutRange)) / FadeOutRange, 0.0f));
|
if (dist < closestDist)
|
||||||
|
{
|
||||||
|
closestCharacter = c;
|
||||||
|
closestDist = dist;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (closestCharacter != null)
|
||||||
|
{
|
||||||
|
float dist = Vector2.Distance(GameMain.GameScreen.Cam.ScreenToWorld(PlayerInput.MousePosition), closestCharacter.WorldPosition);
|
||||||
|
DrawCharacterInfo(spriteBatch, closestCharacter, 1.0f - MathHelper.Max((dist - (Range - FadeOutRange)) / FadeOutRange, 0.0f));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawCharacterInfo(SpriteBatch spriteBatch, Character target, float alpha = 1.0f)
|
private void DrawCharacterInfo(SpriteBatch spriteBatch, Character target, float alpha = 1.0f)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace Barotrauma
|
|||||||
frame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
|
frame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
|
||||||
frame.UserData = item;
|
frame.UserData = item;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 0, 200, 20), "Attempting to fix " + item.Name, "", frame);
|
new GUITextBlock(new Rectangle(0, 0, 200, 20), TextManager.Get("FixHeader").Replace("[itemname]", item.Name), "", frame);
|
||||||
|
|
||||||
y = y + 40;
|
y = y + 40;
|
||||||
foreach (FixRequirement requirement in item.FixRequirements)
|
foreach (FixRequirement requirement in item.FixRequirements)
|
||||||
@@ -60,7 +60,7 @@ namespace Barotrauma
|
|||||||
reqFrame.UserData = requirement;
|
reqFrame.UserData = requirement;
|
||||||
|
|
||||||
|
|
||||||
var fixButton = new GUIButton(new Rectangle(0, 0, 50, 20), "Fix", "", reqFrame);
|
var fixButton = new GUIButton(new Rectangle(0, 0, 50, 20), TextManager.Get("Fix"), "", reqFrame);
|
||||||
fixButton.OnClicked = FixButtonPressed;
|
fixButton.OnClicked = FixButtonPressed;
|
||||||
fixButton.UserData = requirement;
|
fixButton.UserData = requirement;
|
||||||
|
|
||||||
|
|||||||
@@ -68,6 +68,22 @@ namespace Barotrauma
|
|||||||
|
|
||||||
partial class Inventory
|
partial class Inventory
|
||||||
{
|
{
|
||||||
|
protected class SlotReference
|
||||||
|
{
|
||||||
|
public readonly Inventory Inventory;
|
||||||
|
public readonly InventorySlot Slot;
|
||||||
|
public readonly int SlotIndex;
|
||||||
|
|
||||||
|
public bool IsSubSlot;
|
||||||
|
|
||||||
|
public SlotReference(Inventory inventory, InventorySlot slot, int slotIndex, bool isSubSlot)
|
||||||
|
{
|
||||||
|
Inventory = inventory;
|
||||||
|
Slot = slot;
|
||||||
|
SlotIndex = slotIndex;
|
||||||
|
IsSubSlot = isSubSlot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static InventorySlot draggingSlot;
|
public static InventorySlot draggingSlot;
|
||||||
public static Item draggingItem;
|
public static Item draggingItem;
|
||||||
@@ -80,9 +96,12 @@ namespace Barotrauma
|
|||||||
set { slotsPerRow = Math.Max(1, value); }
|
set { slotsPerRow = Math.Max(1, value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
protected int selectedSlot = -1;
|
protected static SlotReference highlightedSubInventorySlot;
|
||||||
|
protected static Inventory highlightedSubInventory;
|
||||||
|
|
||||||
protected InventorySlot[] slots;
|
protected static SlotReference selectedSlot;
|
||||||
|
|
||||||
|
public InventorySlot[] slots;
|
||||||
|
|
||||||
private Vector2 centerPos;
|
private Vector2 centerPos;
|
||||||
|
|
||||||
@@ -135,6 +154,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
slots[i] = new InventorySlot(slotRect);
|
slots[i] = new InventorySlot(slotRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (selectedSlot != null && selectedSlot.Inventory == this)
|
||||||
|
{
|
||||||
|
selectedSlot = new SlotReference(this, slots[selectedSlot.SlotIndex], selectedSlot.SlotIndex, selectedSlot.IsSubSlot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Update(float deltaTime, bool subInventory = false)
|
public virtual void Update(float deltaTime, bool subInventory = false)
|
||||||
@@ -150,22 +174,8 @@ namespace Barotrauma
|
|||||||
for (int i = 0; i < capacity; i++)
|
for (int i = 0; i < capacity; i++)
|
||||||
{
|
{
|
||||||
if (slots[i].Disabled) continue;
|
if (slots[i].Disabled) continue;
|
||||||
UpdateSlot(slots[i], i, Items[i], false);
|
UpdateSlot(slots[i], i, Items[i], subInventory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (draggingItem != null &&
|
|
||||||
(draggingSlot == null || (!draggingSlot.InteractRect.Contains(PlayerInput.MousePosition) && draggingItem.ParentInventory == this)))
|
|
||||||
{
|
|
||||||
if (!PlayerInput.LeftButtonHeld())
|
|
||||||
{
|
|
||||||
CreateNetworkEvent();
|
|
||||||
draggingItem.Drop();
|
|
||||||
|
|
||||||
GUI.PlayUISound(GUISoundType.DropItem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void UpdateSlot(InventorySlot slot, int slotIndex, Item item, bool isSubSlot)
|
protected void UpdateSlot(InventorySlot slot, int slotIndex, Item item, bool isSubSlot)
|
||||||
@@ -174,19 +184,15 @@ namespace Barotrauma
|
|||||||
|
|
||||||
slot.State = GUIComponent.ComponentState.None;
|
slot.State = GUIComponent.ComponentState.None;
|
||||||
|
|
||||||
if (!(this is CharacterInventory) && !mouseOn && selectedSlot == slotIndex)
|
|
||||||
{
|
|
||||||
selectedSlot = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mouseOn &&
|
if (mouseOn &&
|
||||||
(draggingItem != null || selectedSlot == slotIndex || selectedSlot == -1))
|
(draggingItem != null || selectedSlot == null || selectedSlot.Slot == slot) &&
|
||||||
|
(highlightedSubInventory == null || highlightedSubInventory == this || highlightedSubInventorySlot?.Slot == slot))
|
||||||
{
|
{
|
||||||
slot.State = GUIComponent.ComponentState.Hover;
|
slot.State = GUIComponent.ComponentState.Hover;
|
||||||
|
|
||||||
if (!isSubSlot && selectedSlot == -1)
|
if (selectedSlot == null || (!selectedSlot.IsSubSlot && isSubSlot))
|
||||||
{
|
{
|
||||||
selectedSlot = slotIndex;
|
selectedSlot = new SlotReference(this, slot, slotIndex, isSubSlot);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (draggingItem == null)
|
if (draggingItem == null)
|
||||||
@@ -203,38 +209,29 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
doubleClickedItem = item;
|
doubleClickedItem = item;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (draggingItem != Items[slotIndex])
|
protected Inventory GetSubInventory(int slotIndex)
|
||||||
{
|
{
|
||||||
//selectedSlot = slotIndex;
|
var item = Items[slotIndex];
|
||||||
if (TryPutItem(draggingItem, slotIndex, true, Character.Controlled))
|
if (item == null) return null;
|
||||||
{
|
|
||||||
if (slots != null) slots[slotIndex].ShowBorderHighlight(Color.White, 0.1f, 0.4f);
|
var container = item.GetComponent<ItemContainer>();
|
||||||
GUI.PlayUISound(GUISoundType.PickItem);
|
if (container == null) return null;
|
||||||
}
|
|
||||||
else
|
return container.Inventory;
|
||||||
{
|
|
||||||
if (slots != null) slots[slotIndex].ShowBorderHighlight(Color.Red, 0.1f, 0.9f);
|
|
||||||
GUI.PlayUISound(GUISoundType.PickItemFail);
|
|
||||||
}
|
|
||||||
draggingItem = null;
|
|
||||||
draggingSlot = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateSubInventory(float deltaTime, int slotIndex)
|
public void UpdateSubInventory(float deltaTime, int slotIndex)
|
||||||
{
|
{
|
||||||
var item = Items[slotIndex];
|
Inventory subInventory = GetSubInventory(slotIndex);
|
||||||
if (item == null) return;
|
if (subInventory == null) return;
|
||||||
|
|
||||||
var container = item.GetComponent<ItemContainer>();
|
if (subInventory.slots == null) subInventory.CreateSlots();
|
||||||
if (container == null) return;
|
|
||||||
|
|
||||||
if (container.Inventory.slots == null) container.Inventory.CreateSlots();
|
int itemCapacity = subInventory.Items.Length;
|
||||||
|
|
||||||
int itemCapacity = container.Capacity;
|
|
||||||
|
|
||||||
var slot = slots[slotIndex];
|
var slot = slots[slotIndex];
|
||||||
new Rectangle(slot.Rect.X - 5, slot.Rect.Y - (40 + 10) * itemCapacity - 5,
|
new Rectangle(slot.Rect.X - 5, slot.Rect.Y - (40 + 10) * itemCapacity - 5,
|
||||||
@@ -246,17 +243,17 @@ namespace Barotrauma
|
|||||||
for (int i = 0; i < itemCapacity; i++)
|
for (int i = 0; i < itemCapacity; i++)
|
||||||
{
|
{
|
||||||
subRect.Y = subRect.Y - subRect.Height - 10;
|
subRect.Y = subRect.Y - subRect.Height - 10;
|
||||||
container.Inventory.slots[i].Rect = subRect;
|
subInventory.slots[i].Rect = subRect;
|
||||||
container.Inventory.slots[i].InteractRect = subRect;
|
subInventory.slots[i].InteractRect = subRect;
|
||||||
container.Inventory.slots[i].InteractRect.Inflate(5, 5);
|
subInventory.slots[i].InteractRect.Inflate(5, 5);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
container.Inventory.isSubInventory = true;
|
subInventory.isSubInventory = true;
|
||||||
|
|
||||||
slots[slotIndex].State = GUIComponent.ComponentState.Hover;
|
slots[slotIndex].State = GUIComponent.ComponentState.Hover;
|
||||||
|
|
||||||
container.Inventory.Update(deltaTime, true);
|
subInventory.Update(deltaTime, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -274,17 +271,6 @@ namespace Barotrauma
|
|||||||
DrawSlot(spriteBatch, slots[i], Items[i], drawItem);
|
DrawSlot(spriteBatch, slots[i], Items[i], drawItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (draggingItem != null &&
|
|
||||||
(draggingSlot == null || (!draggingSlot.InteractRect.Contains(PlayerInput.MousePosition) && draggingItem.ParentInventory == this)))
|
|
||||||
{
|
|
||||||
Rectangle dragRect = new Rectangle(
|
|
||||||
(int)PlayerInput.MousePosition.X - 10,
|
|
||||||
(int)PlayerInput.MousePosition.Y - 10,
|
|
||||||
40, 40);
|
|
||||||
|
|
||||||
DrawSlot(spriteBatch, new InventorySlot(dragRect), draggingItem);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < capacity; i++)
|
for (int i = 0; i < capacity; i++)
|
||||||
{
|
{
|
||||||
if (slots[i].InteractRect.Contains(PlayerInput.MousePosition) && !slots[i].Disabled && Items[i] != null)
|
if (slots[i].InteractRect.Contains(PlayerInput.MousePosition) && !slots[i].Disabled && Items[i] != null)
|
||||||
@@ -373,9 +359,57 @@ namespace Barotrauma
|
|||||||
|
|
||||||
container.Inventory.Draw(spriteBatch, true);
|
container.Inventory.Draw(spriteBatch, true);
|
||||||
|
|
||||||
if (!containerRect.Contains(PlayerInput.MousePosition))
|
}
|
||||||
|
|
||||||
|
public static void UpdateDragging()
|
||||||
{
|
{
|
||||||
if (draggingItem == null || draggingItem.Container != item) selectedSlot = -1;
|
if (draggingItem != null && PlayerInput.LeftButtonReleased())
|
||||||
|
{
|
||||||
|
if (selectedSlot == null)
|
||||||
|
{
|
||||||
|
draggingItem.ParentInventory?.CreateNetworkEvent();
|
||||||
|
draggingItem.Drop();
|
||||||
|
GUI.PlayUISound(GUISoundType.DropItem);
|
||||||
|
}
|
||||||
|
else if (selectedSlot.Inventory.Items[selectedSlot.SlotIndex] != draggingItem)
|
||||||
|
{
|
||||||
|
Inventory selectedInventory = selectedSlot.Inventory;
|
||||||
|
int slotIndex = selectedSlot.SlotIndex;
|
||||||
|
if (selectedInventory.TryPutItem(draggingItem, slotIndex, true, Character.Controlled))
|
||||||
|
{
|
||||||
|
if (selectedInventory.slots != null) selectedInventory.slots[slotIndex].ShowBorderHighlight(Color.White, 0.1f, 0.4f);
|
||||||
|
GUI.PlayUISound(GUISoundType.PickItem);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (selectedInventory.slots != null) selectedInventory.slots[slotIndex].ShowBorderHighlight(Color.Red, 0.1f, 0.9f);
|
||||||
|
GUI.PlayUISound(GUISoundType.PickItemFail);
|
||||||
|
}
|
||||||
|
draggingItem = null;
|
||||||
|
draggingSlot = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
draggingItem = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedSlot != null && !selectedSlot.Slot.InteractRect.Contains(PlayerInput.MousePosition))
|
||||||
|
{
|
||||||
|
selectedSlot = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void DrawDragging(SpriteBatch spriteBatch)
|
||||||
|
{
|
||||||
|
if (draggingItem == null) return;
|
||||||
|
|
||||||
|
if (draggingSlot == null || (!draggingSlot.InteractRect.Contains(PlayerInput.MousePosition)))
|
||||||
|
{
|
||||||
|
Rectangle dragRect = new Rectangle(
|
||||||
|
(int)PlayerInput.MousePosition.X - 10,
|
||||||
|
(int)PlayerInput.MousePosition.Y - 10,
|
||||||
|
40, 40);
|
||||||
|
|
||||||
|
DrawSlot(spriteBatch, new InventorySlot(dragRect), draggingItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
body.FarseerBody.Enabled = false;
|
body.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((newPosition - SimPosition).Length() > body.LinearVelocity.Length() * 2.0f)
|
if ((newPosition - SimPosition).Length() > body.LinearVelocity.Length() * 2.0f)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Barotrauma.Lights;
|
using Barotrauma.Lights;
|
||||||
using Barotrauma.Particles;
|
using Barotrauma.Particles;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using System;
|
using System;
|
||||||
@@ -76,9 +76,9 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lightSource.Range = Math.Max(size.X, size.Y) * 10.0f / 2.0f;
|
|
||||||
lightSource.Color = new Color(1.0f, 0.45f, 0.3f) * Rand.Range(0.8f, 1.0f);
|
lightSource.Color = new Color(1.0f, 0.45f, 0.3f) * Rand.Range(0.8f, 1.0f);
|
||||||
lightSource.Position = position + Vector2.UnitY * 30.0f;
|
if (Math.Abs((lightSource.Range * 0.2f) - Math.Max(size.X, size.Y)) > 1.0f) lightSource.Range = Math.Max(size.X, size.Y) * 5.0f;
|
||||||
|
if (Vector2.DistanceSquared(lightSource.Position,position) > 5.0f) lightSource.Position = position + Vector2.UnitY * 30.0f;
|
||||||
|
|
||||||
if (size.X > 256.0f)
|
if (size.X > 256.0f)
|
||||||
{
|
{
|
||||||
|
|||||||
+1
-1
@@ -86,7 +86,7 @@ namespace Barotrauma
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (visibleSprites[i].Position.Z > sprite.Position.Z)
|
if (visibleSprites[i].Position.Z < sprite.Position.Z)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -63,6 +63,7 @@ namespace Barotrauma
|
|||||||
public void Update(float deltaTime)
|
public void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
dustOffset -= Vector2.UnitY * 10.0f * deltaTime;
|
dustOffset -= Vector2.UnitY * 10.0f * deltaTime;
|
||||||
|
while (dustOffset.Y <= -1024.0f) dustOffset.Y += 1024.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static VertexPositionColorTexture[] GetColoredVertices(VertexPositionTexture[] vertices, Color color)
|
public static VertexPositionColorTexture[] GetColoredVertices(VertexPositionTexture[] vertices, Color color)
|
||||||
@@ -108,7 +109,7 @@ namespace Barotrauma
|
|||||||
Vector2 backgroundPos = cam.WorldViewCenter;
|
Vector2 backgroundPos = cam.WorldViewCenter;
|
||||||
|
|
||||||
backgroundPos.Y = -backgroundPos.Y;
|
backgroundPos.Y = -backgroundPos.Y;
|
||||||
backgroundPos /= 20.0f;
|
backgroundPos *= 0.05f;
|
||||||
|
|
||||||
if (backgroundPos.Y < 1024)
|
if (backgroundPos.Y < 1024)
|
||||||
{
|
{
|
||||||
@@ -130,35 +131,38 @@ namespace Barotrauma
|
|||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
spriteBatch.Begin(SpriteSortMode.Deferred,
|
||||||
BlendState.AlphaBlend,
|
BlendState.AlphaBlend,
|
||||||
SamplerState.LinearWrap, DepthStencilState.Default, null, null,
|
SamplerState.LinearWrap, DepthStencilState.Default, null, null,
|
||||||
cam.Transform);
|
cam.Transform);
|
||||||
|
|
||||||
|
Vector2 origin = new Vector2(cam.WorldView.X, -cam.WorldView.Y);
|
||||||
|
Vector2 offset = -origin + dustOffset;
|
||||||
|
while (offset.X <= -1024.0f) offset.X += 1024.0f;
|
||||||
|
while (offset.X > 0.0f) offset.X -= 1024.0f;
|
||||||
|
while (offset.Y <= -1024.0f) offset.Y += 1024.0f;
|
||||||
|
while (offset.Y > 0.0f) offset.Y -= 1024.0f;
|
||||||
|
|
||||||
if (backgroundSpriteManager != null) backgroundSpriteManager.DrawSprites(spriteBatch, cam);
|
if (backgroundSpriteManager != null) backgroundSpriteManager.DrawSprites(spriteBatch, cam);
|
||||||
if (backgroundCreatureManager != null) backgroundCreatureManager.Draw(spriteBatch);
|
if (backgroundCreatureManager != null) backgroundCreatureManager.Draw(spriteBatch);
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
float scale = 1.0f - i * 0.2f;
|
float scale = 1.0f - i * 0.2f;
|
||||||
|
float recipScale = 1.0f / scale;
|
||||||
|
|
||||||
//alpha goes from 1.0 to 0.0 when scale is in the range of 0.2-0.1
|
//alpha goes from 1.0 to 0.0 when scale is in the range of 0.5-0.25
|
||||||
float alpha = (cam.Zoom * scale) < 0.2f ? (cam.Zoom * scale - 0.1f) * 10.0f : 1.0f;
|
float alpha = (cam.Zoom * scale) < 0.5f ? (cam.Zoom * scale - 0.25f) * 40.0f : 1.0f;
|
||||||
if (alpha <= 0.0f) continue;
|
if (alpha <= 0.0f) continue;
|
||||||
|
|
||||||
Vector2 offset = (new Vector2(cam.WorldViewCenter.X, cam.WorldViewCenter.Y) + dustOffset) * scale;
|
Vector2 offsetS = offset * scale + new Vector2(cam.WorldView.Width, cam.WorldView.Height) * (1.0f - scale) * 0.5f - new Vector2(256.0f * i);
|
||||||
Vector3 origin = new Vector3(cam.WorldView.Width, cam.WorldView.Height, 0.0f) * 0.5f;
|
while (offsetS.X <= -1024.0f*scale) offsetS.X += 1024.0f*scale;
|
||||||
|
while (offsetS.X > 0.0f) offsetS.X -= 1024.0f*scale;
|
||||||
|
while (offsetS.Y <= -1024.0f*scale) offsetS.Y += 1024.0f*scale;
|
||||||
|
while (offsetS.Y > 0.0f) offsetS.Y -= 1024.0f*scale;
|
||||||
|
|
||||||
dustParticles.SourceRect = new Rectangle(
|
Rectangle srcRect = new Rectangle(0, 0, 2048, 2048);
|
||||||
(int)((offset.X - origin.X + (i * 256)) / scale),
|
dustParticles.DrawTiled(spriteBatch, origin + offsetS, new Vector2(cam.WorldView.Width - offsetS.X, cam.WorldView.Height - offsetS.Y), Vector2.Zero, srcRect, Color.White * alpha, new Vector2(scale));
|
||||||
(int)((-offset.Y - origin.Y + (i * 256)) / scale),
|
|
||||||
(int)((cam.WorldView.Width) / scale),
|
|
||||||
(int)((cam.WorldView.Height) / scale));
|
|
||||||
|
|
||||||
spriteBatch.Draw(dustParticles.Texture,
|
|
||||||
new Vector2(cam.WorldViewCenter.X, -cam.WorldViewCenter.Y),
|
|
||||||
dustParticles.SourceRect, Color.White * alpha, 0.0f,
|
|
||||||
new Vector2(cam.WorldView.Width, cam.WorldView.Height) * 0.5f / scale, scale, SpriteEffects.None, 1.0f - scale);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
@@ -13,7 +13,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public VertexPositionTexture[] vertices = new VertexPositionTexture[DefaultBufferSize];
|
public VertexPositionTexture[] vertices = new VertexPositionTexture[DefaultBufferSize];
|
||||||
|
|
||||||
private Effect waterEffect;
|
public Effect waterEffect
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
private BasicEffect basicEffect;
|
private BasicEffect basicEffect;
|
||||||
|
|
||||||
public int PositionInBuffer = 0;
|
public int PositionInBuffer = 0;
|
||||||
@@ -39,12 +43,7 @@ namespace Barotrauma
|
|||||||
waterEffect.Parameters["xWaveWidth"].SetValue(0.05f);
|
waterEffect.Parameters["xWaveWidth"].SetValue(0.05f);
|
||||||
waterEffect.Parameters["xWaveHeight"].SetValue(0.05f);
|
waterEffect.Parameters["xWaveHeight"].SetValue(0.05f);
|
||||||
|
|
||||||
#if WINDOWS
|
|
||||||
//waterEffect.Parameters["xTexture"].SetValue(waterTexture);
|
|
||||||
#endif
|
|
||||||
#if LINUX
|
|
||||||
waterEffect.Parameters["xWaterBumpMap"].SetValue(waterTexture);
|
waterEffect.Parameters["xWaterBumpMap"].SetValue(waterTexture);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (basicEffect == null)
|
if (basicEffect == null)
|
||||||
{
|
{
|
||||||
@@ -64,13 +63,13 @@ namespace Barotrauma
|
|||||||
waterEffect.Parameters["xBlurDistance"].SetValue(blurAmount);
|
waterEffect.Parameters["xBlurDistance"].SetValue(blurAmount);
|
||||||
//waterEffect.CurrentTechnique.Passes[0].Apply();
|
//waterEffect.CurrentTechnique.Passes[0].Apply();
|
||||||
|
|
||||||
#if WINDOWS
|
//#if WINDOWS
|
||||||
waterEffect.Parameters["xTexture"].SetValue(texture);
|
waterEffect.Parameters["xTexture"].SetValue(texture);
|
||||||
spriteBatch.Draw(waterTexture, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
|
||||||
#elif LINUX
|
|
||||||
|
|
||||||
spriteBatch.Draw(texture, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
spriteBatch.Draw(texture, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||||
#endif
|
//#elif LINUX
|
||||||
|
|
||||||
|
// spriteBatch.Draw(texture, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||||
|
//#endif
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,7 +92,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
basicEffect.CurrentTechnique.Passes[0].Apply();
|
basicEffect.CurrentTechnique.Passes[0].Apply();
|
||||||
|
|
||||||
graphicsDevice.SamplerStates[0] = SamplerState.LinearWrap;
|
graphicsDevice.SamplerStates[0] = SamplerState.PointWrap;
|
||||||
graphicsDevice.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleList, vertices, 0, vertices.Length / 3);
|
graphicsDevice.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleList, vertices, 0, vertices.Length / 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
|
using Microsoft.Xna.Framework.Content;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
@@ -23,10 +24,25 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
public Color AmbientLight;
|
public Color AmbientLight;
|
||||||
|
|
||||||
RenderTarget2D lightMap, losTexture;
|
private float lightmapScale = 0.5f;
|
||||||
|
public RenderTarget2D lightMap
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
public RenderTarget2D losTexture
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
BasicEffect lightEffect;
|
BasicEffect lightEffect;
|
||||||
|
|
||||||
|
public Effect losEffect
|
||||||
|
{
|
||||||
|
get; private set;
|
||||||
|
}
|
||||||
|
|
||||||
private static Texture2D alphaClearTexture;
|
private static Texture2D alphaClearTexture;
|
||||||
|
|
||||||
private List<LightSource> lights;
|
private List<LightSource> lights;
|
||||||
@@ -36,35 +52,47 @@ namespace Barotrauma.Lights
|
|||||||
public bool LightingEnabled = true;
|
public bool LightingEnabled = true;
|
||||||
|
|
||||||
public bool ObstructVision;
|
public bool ObstructVision;
|
||||||
|
LightSource losSource;
|
||||||
|
|
||||||
private Texture2D visionCircle;
|
private Sprite visionCircle;
|
||||||
|
|
||||||
private Dictionary<Hull, Color> hullAmbientLights;
|
private Dictionary<Hull, Color> hullAmbientLights;
|
||||||
private Dictionary<Hull, Color> smoothedHullAmbientLights;
|
private Dictionary<Hull, Color> smoothedHullAmbientLights;
|
||||||
|
|
||||||
private float ambientLightUpdateTimer;
|
private float ambientLightUpdateTimer;
|
||||||
|
|
||||||
public LightManager(GraphicsDevice graphics)
|
public LightManager(GraphicsDevice graphics, ContentManager content)
|
||||||
{
|
{
|
||||||
lights = new List<LightSource>();
|
lights = new List<LightSource>();
|
||||||
|
|
||||||
AmbientLight = new Color(20, 20, 20, 255);
|
AmbientLight = new Color(20, 20, 20, 255);
|
||||||
|
|
||||||
visionCircle = Sprite.LoadTexture("Content/Lights/visioncircle.png");
|
//visionCircle = Sprite.LoadTexture("Content/Lights/visioncircle.png");
|
||||||
|
visionCircle = new Sprite("Content/Lights/visioncircle.png", new Vector2(0.2f, 0.5f));
|
||||||
|
|
||||||
var pp = graphics.PresentationParameters;
|
var pp = graphics.PresentationParameters;
|
||||||
|
|
||||||
lightMap = new RenderTarget2D(graphics,
|
lightMap = new RenderTarget2D(graphics,
|
||||||
GameMain.GraphicsWidth, GameMain.GraphicsHeight, false,
|
(int)(GameMain.GraphicsWidth*lightmapScale), (int)(GameMain.GraphicsHeight*lightmapScale), false,
|
||||||
pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount,
|
pp.BackBufferFormat, pp.DepthStencilFormat, pp.MultiSampleCount,
|
||||||
RenderTargetUsage.DiscardContents);
|
RenderTargetUsage.DiscardContents);
|
||||||
|
|
||||||
losTexture = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
losTexture = new RenderTarget2D(graphics, (int)(GameMain.GraphicsWidth*lightmapScale), (int)(GameMain.GraphicsHeight*lightmapScale), false, SurfaceFormat.Color, DepthFormat.None);
|
||||||
|
|
||||||
|
losSource = new LightSource(Vector2.Zero, GameMain.GraphicsWidth, Color.White, null, false);
|
||||||
|
losSource.texture = new Texture2D(graphics, 1, 1);
|
||||||
|
losSource.texture.SetData(new Color[] { Color.White });// fill the texture with white
|
||||||
|
|
||||||
|
#if WINDOWS
|
||||||
|
losEffect = content.Load<Effect>("losshader");
|
||||||
|
#else
|
||||||
|
losEffect = content.Load<Effect>("losshader_opengl");
|
||||||
|
#endif
|
||||||
|
|
||||||
if (lightEffect == null)
|
if (lightEffect == null)
|
||||||
{
|
{
|
||||||
lightEffect = new BasicEffect(GameMain.Instance.GraphicsDevice);
|
lightEffect = new BasicEffect(GameMain.Instance.GraphicsDevice);
|
||||||
lightEffect.VertexColorEnabled = false;
|
lightEffect.VertexColorEnabled = true;
|
||||||
|
|
||||||
lightEffect.TextureEnabled = true;
|
lightEffect.TextureEnabled = true;
|
||||||
lightEffect.Texture = LightSource.LightTexture;
|
lightEffect.Texture = LightSource.LightTexture;
|
||||||
@@ -142,7 +170,7 @@ namespace Barotrauma.Lights
|
|||||||
graphics.Clear(AmbientLight);
|
graphics.Clear(AmbientLight);
|
||||||
graphics.BlendState = BlendState.Additive;
|
graphics.BlendState = BlendState.Additive;
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null, null, cam.Transform);
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null, null, cam.Transform * Matrix.CreateScale(new Vector3(lightmapScale, lightmapScale, 1.0f)));
|
||||||
|
|
||||||
Matrix transform = cam.ShaderTransform
|
Matrix transform = cam.ShaderTransform
|
||||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||||
@@ -201,56 +229,43 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
public void UpdateObstructVision(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, Vector2 lookAtPosition)
|
public void UpdateObstructVision(GraphicsDevice graphics, SpriteBatch spriteBatch, Camera cam, Vector2 lookAtPosition)
|
||||||
{
|
{
|
||||||
if (!LosEnabled && !ObstructVision) return;
|
if (!LosEnabled || ViewTarget == null) return;
|
||||||
|
|
||||||
graphics.SetRenderTarget(losTexture);
|
graphics.SetRenderTarget(losTexture);
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, cam.Transform);
|
//--------------------------------------
|
||||||
|
|
||||||
|
graphics.Clear(Color.Black);
|
||||||
if (ObstructVision)
|
if (ObstructVision)
|
||||||
{
|
{
|
||||||
//graphics.Clear(Color.Black);
|
|
||||||
|
|
||||||
Vector2 diff = lookAtPosition - ViewTarget.WorldPosition;
|
Vector2 diff = lookAtPosition - ViewTarget.WorldPosition;
|
||||||
diff.Y = -diff.Y;
|
|
||||||
float rotation = MathUtils.VectorToAngle(diff);
|
float rotation = MathUtils.VectorToAngle(diff);
|
||||||
|
|
||||||
Vector2 scale = new Vector2(MathHelper.Clamp(diff.Length()/256.0f, 2.0f, 5.0f), 2.0f);
|
Vector2 scale = new Vector2(MathHelper.Clamp(diff.Length() / 256.0f, 2.0f, 5.0f), 2.0f) * 0.3f;
|
||||||
|
|
||||||
spriteBatch.Draw(visionCircle, new Vector2(ViewTarget.WorldPosition.X, -ViewTarget.WorldPosition.Y), null, Color.White, rotation,
|
visionCircle.size = new Vector2(visionCircle.SourceRect.Width * scale.X, visionCircle.SourceRect.Height * scale.Y);
|
||||||
new Vector2(LightSource.LightTexture.Width*0.2f, LightSource.LightTexture.Height/2), scale, SpriteEffects.None, 0.0f);
|
losSource.overrideLightTexture = visionCircle;
|
||||||
|
losSource.Rotation = rotation;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
graphics.Clear(Color.White);
|
losSource.overrideLightTexture = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
spriteBatch.End();
|
graphics.BlendState = BlendState.Additive;
|
||||||
|
|
||||||
//--------------------------------------
|
Vector2 pos = ViewTarget.Position;
|
||||||
|
losSource.Position = pos;
|
||||||
|
losSource.NeedsRecalculation = true;
|
||||||
|
losSource.ParentSub = ViewTarget.Submarine;
|
||||||
|
|
||||||
if (LosEnabled && ViewTarget != null)
|
Matrix transform = cam.ShaderTransform
|
||||||
{
|
|
||||||
Vector2 pos = ViewTarget.WorldPosition;
|
|
||||||
|
|
||||||
Rectangle camView = new Rectangle(cam.WorldView.X, cam.WorldView.Y - cam.WorldView.Height, cam.WorldView.Width, cam.WorldView.Height);
|
|
||||||
|
|
||||||
Matrix shadowTransform = cam.ShaderTransform
|
|
||||||
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
* Matrix.CreateOrthographic(GameMain.GraphicsWidth, GameMain.GraphicsHeight, -1, 1) * 0.5f;
|
||||||
|
|
||||||
var convexHulls = ConvexHull.GetHullsInRange(viewTarget.Position, cam.WorldView.Width*0.75f, viewTarget.Submarine);
|
losSource.Draw(spriteBatch, lightEffect, transform);
|
||||||
|
|
||||||
if (convexHulls != null)
|
graphics.BlendState = BlendState.AlphaBlend;
|
||||||
{
|
|
||||||
foreach (ConvexHull convexHull in convexHulls)
|
|
||||||
{
|
|
||||||
if (!convexHull.Intersects(camView)) continue;
|
|
||||||
//if (!camView.Intersects(convexHull.BoundingBox)) continue;
|
|
||||||
|
|
||||||
convexHull.DrawShadows(graphics, cam, pos, shadowTransform);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
graphics.SetRenderTarget(null);
|
graphics.SetRenderTarget(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -338,22 +353,11 @@ namespace Barotrauma.Lights
|
|||||||
{
|
{
|
||||||
if (!LightingEnabled) return;
|
if (!LightingEnabled) return;
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.Multiplicative, null, null, null, effect);
|
spriteBatch.Begin(SpriteSortMode.Deferred, CustomBlendStates.Multiplicative, null, null, null, null);
|
||||||
spriteBatch.Draw(lightMap, Vector2.Zero, Color.White);
|
spriteBatch.Draw(lightMap, new Rectangle(0,0,GameMain.GraphicsWidth,GameMain.GraphicsHeight), Color.White);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawLOS(SpriteBatch spriteBatch, Effect effect,bool renderingBackground)
|
|
||||||
{
|
|
||||||
if (!LosEnabled || ViewTarget == null) return;
|
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, renderingBackground ? CustomBlendStates.LOS : CustomBlendStates.Multiplicative, null, null, null, effect);
|
|
||||||
spriteBatch.Draw(losTexture, Vector2.Zero, Color.White);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
if (!renderingBackground) ObstructVision = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void ClearLights()
|
public void ClearLights()
|
||||||
{
|
{
|
||||||
lights.Clear();
|
lights.Clear();
|
||||||
@@ -376,16 +380,10 @@ namespace Barotrauma.Lights
|
|||||||
MultiplyWithAlpha = new BlendState();
|
MultiplyWithAlpha = new BlendState();
|
||||||
MultiplyWithAlpha.ColorDestinationBlend = MultiplyWithAlpha.AlphaDestinationBlend = Blend.One;
|
MultiplyWithAlpha.ColorDestinationBlend = MultiplyWithAlpha.AlphaDestinationBlend = Blend.One;
|
||||||
MultiplyWithAlpha.ColorSourceBlend = MultiplyWithAlpha.AlphaSourceBlend = Blend.DestinationAlpha;
|
MultiplyWithAlpha.ColorSourceBlend = MultiplyWithAlpha.AlphaSourceBlend = Blend.DestinationAlpha;
|
||||||
|
|
||||||
LOS = new BlendState();
|
|
||||||
LOS.ColorSourceBlend = LOS.AlphaSourceBlend = Blend.Zero;
|
|
||||||
LOS.ColorDestinationBlend = LOS.AlphaDestinationBlend = Blend.InverseSourceColor;
|
|
||||||
LOS.ColorBlendFunction = LOS.AlphaBlendFunction = BlendFunction.Add;
|
|
||||||
}
|
}
|
||||||
public static BlendState Multiplicative { get; private set; }
|
public static BlendState Multiplicative { get; private set; }
|
||||||
public static BlendState WriteToAlpha { get; private set; }
|
public static BlendState WriteToAlpha { get; private set; }
|
||||||
public static BlendState MultiplyWithAlpha { get; private set; }
|
public static BlendState MultiplyWithAlpha { get; private set; }
|
||||||
public static BlendState LOS { get; private set; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
@@ -17,8 +17,8 @@ namespace Barotrauma.Lights
|
|||||||
private Color color;
|
private Color color;
|
||||||
private float range;
|
private float range;
|
||||||
|
|
||||||
private Sprite overrideLightTexture;
|
public Sprite overrideLightTexture;
|
||||||
private Texture2D texture;
|
public Texture2D texture;
|
||||||
|
|
||||||
public Sprite LightSprite;
|
public Sprite LightSprite;
|
||||||
|
|
||||||
@@ -140,7 +140,7 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LightSource(Vector2 position, float range, Color color, Submarine submarine)
|
public LightSource(Vector2 position, float range, Color color, Submarine submarine, bool addLight=true)
|
||||||
{
|
{
|
||||||
hullsInRange = new List<ConvexHullList>();
|
hullsInRange = new List<ConvexHullList>();
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
diffToSub = new Dictionary<Submarine, Vector2>();
|
diffToSub = new Dictionary<Submarine, Vector2>();
|
||||||
|
|
||||||
GameMain.LightManager.AddLight(this);
|
if (addLight) GameMain.LightManager.AddLight(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*public void DrawShadows(GraphicsDevice graphics, Camera cam, Matrix shadowTransform)
|
/*public void DrawShadows(GraphicsDevice graphics, Camera cam, Matrix shadowTransform)
|
||||||
@@ -322,6 +322,7 @@ namespace Barotrauma.Lights
|
|||||||
hulls.AddRange(chList.List);
|
hulls.AddRange(chList.List);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float bounds = range*2;
|
||||||
//find convexhull segments that are close enough and facing towards the light source
|
//find convexhull segments that are close enough and facing towards the light source
|
||||||
List<Segment> visibleSegments = new List<Segment>();
|
List<Segment> visibleSegments = new List<Segment>();
|
||||||
List<SegmentPoint> points = new List<SegmentPoint>();
|
List<SegmentPoint> points = new List<SegmentPoint>();
|
||||||
@@ -336,6 +337,10 @@ namespace Barotrauma.Lights
|
|||||||
{
|
{
|
||||||
points.Add(s.Start);
|
points.Add(s.Start);
|
||||||
points.Add(s.End);
|
points.Add(s.End);
|
||||||
|
if (Math.Abs(s.Start.WorldPos.X - drawPos.X) > bounds) bounds = Math.Abs(s.Start.WorldPos.X - drawPos.X);
|
||||||
|
if (Math.Abs(s.Start.WorldPos.Y - drawPos.Y) > bounds) bounds = Math.Abs(s.Start.WorldPos.Y - drawPos.Y);
|
||||||
|
if (Math.Abs(s.End.WorldPos.X - drawPos.X) > bounds) bounds = Math.Abs(s.End.WorldPos.X - drawPos.X);
|
||||||
|
if (Math.Abs(s.End.WorldPos.Y - drawPos.Y) > bounds) bounds = Math.Abs(s.End.WorldPos.Y - drawPos.Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -344,14 +349,21 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
//(might be more effective to calculate if we actually need these extra points)
|
//(might be more effective to calculate if we actually need these extra points)
|
||||||
var boundaryCorners = new List<SegmentPoint> {
|
var boundaryCorners = new List<SegmentPoint> {
|
||||||
new SegmentPoint(new Vector2(drawPos.X + range*2, drawPos.Y + range*2)),
|
new SegmentPoint(new Vector2(drawPos.X + bounds, drawPos.Y + bounds)),
|
||||||
new SegmentPoint(new Vector2(drawPos.X + range*2, drawPos.Y - range*2)),
|
new SegmentPoint(new Vector2(drawPos.X + bounds, drawPos.Y - bounds)),
|
||||||
new SegmentPoint(new Vector2(drawPos.X - range*2, drawPos.Y - range*2)),
|
new SegmentPoint(new Vector2(drawPos.X - bounds, drawPos.Y - bounds)),
|
||||||
new SegmentPoint(new Vector2(drawPos.X - range*2, drawPos.Y + range*2))
|
new SegmentPoint(new Vector2(drawPos.X - bounds, drawPos.Y + bounds))
|
||||||
};
|
};
|
||||||
|
|
||||||
|
//points.Clear();
|
||||||
points.AddRange(boundaryCorners);
|
points.AddRange(boundaryCorners);
|
||||||
|
|
||||||
|
//visibleSegments.Clear();
|
||||||
|
for (int i=0;i<4;i++)
|
||||||
|
{
|
||||||
|
visibleSegments.Add(new Segment(boundaryCorners[i], boundaryCorners[(i + 1) % 4]));
|
||||||
|
}
|
||||||
|
|
||||||
var compareCCW = new CompareSegmentPointCW(drawPos);
|
var compareCCW = new CompareSegmentPointCW(drawPos);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -368,14 +380,16 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<Vector2> output = new List<Vector2>();
|
List<Vector2> output = new List<Vector2>();
|
||||||
|
//List<Pair<int, Vector2>> preOutput = new List<Pair<int, Vector2>>();
|
||||||
|
|
||||||
//remove points that are very close to each other
|
//remove points that are very close to each other
|
||||||
for (int i = 0; i < points.Count - 1; i++)
|
for (int i = 0; i < points.Count - 1; i++)
|
||||||
{
|
{
|
||||||
if (Math.Abs(points[i].WorldPos.X - points[i + 1].WorldPos.X) < 3 &&
|
if (Math.Abs(points[i].WorldPos.X - points[i + 1].WorldPos.X) < 6 &&
|
||||||
Math.Abs(points[i].WorldPos.Y - points[i + 1].WorldPos.Y) < 3)
|
Math.Abs(points[i].WorldPos.Y - points[i + 1].WorldPos.Y) < 6)
|
||||||
{
|
{
|
||||||
points.RemoveAt(i + 1);
|
points.RemoveAt(i + 1);
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,32 +399,52 @@ namespace Barotrauma.Lights
|
|||||||
Vector2 dirNormal = new Vector2(-dir.Y, dir.X)*3;
|
Vector2 dirNormal = new Vector2(-dir.Y, dir.X)*3;
|
||||||
|
|
||||||
//do two slightly offset raycasts to hit the segment itself and whatever's behind it
|
//do two slightly offset raycasts to hit the segment itself and whatever's behind it
|
||||||
Vector2 intersection1 = RayCast(drawPos, drawPos + dir * range * 2 - dirNormal, visibleSegments);
|
Pair<int,Vector2> intersection1 = RayCast(drawPos, drawPos + dir * bounds * 2 - dirNormal, visibleSegments);
|
||||||
Vector2 intersection2 = RayCast(drawPos, drawPos + dir * range * 2 + dirNormal, visibleSegments);
|
Pair<int,Vector2> intersection2 = RayCast(drawPos, drawPos + dir * bounds * 2 + dirNormal, visibleSegments);
|
||||||
|
|
||||||
//hit almost the same position -> only add one vertex to output
|
if (intersection1.First < 0) return new List<Vector2>();
|
||||||
if ((Math.Abs(intersection1.X - intersection2.X) < 5 &&
|
if (intersection2.First < 0) return new List<Vector2>();
|
||||||
Math.Abs(intersection1.Y - intersection2.Y) < 5))
|
Segment seg1 = visibleSegments[intersection1.First];
|
||||||
|
Segment seg2 = visibleSegments[intersection2.First];
|
||||||
|
|
||||||
|
bool isPoint1 = MathUtils.LineToPointDistance(seg1.Start.WorldPos, seg1.End.WorldPos, p.WorldPos) < 5.0f;
|
||||||
|
bool isPoint2 = MathUtils.LineToPointDistance(seg2.Start.WorldPos, seg2.End.WorldPos, p.WorldPos) < 5.0f;
|
||||||
|
|
||||||
|
//hit at the current segmentpoint -> place the segmentpoint into the list
|
||||||
|
if (isPoint1 && isPoint2)
|
||||||
{
|
{
|
||||||
output.Add(intersection1);
|
output.Add(p.WorldPos);
|
||||||
}
|
}
|
||||||
else
|
else if (intersection1.First != intersection2.First)
|
||||||
{
|
{
|
||||||
output.Add(intersection1);
|
output.Add(isPoint1 ? p.WorldPos : intersection1.Second);
|
||||||
output.Add(intersection2);
|
output.Add(isPoint2 ? p.WorldPos : intersection2.Second);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//remove points that are very close to each other
|
||||||
|
for (int i = 0; i < output.Count - 1; i++)
|
||||||
|
{
|
||||||
|
if (Math.Abs(output[i].X - output[i + 1].X) < 6 &&
|
||||||
|
Math.Abs(output[i].Y - output[i + 1].Y) < 6)
|
||||||
|
{
|
||||||
|
output.RemoveAt(i + 1);
|
||||||
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector2 RayCast(Vector2 rayStart, Vector2 rayEnd, List<Segment> segments)
|
private Pair<int,Vector2> RayCast(Vector2 rayStart, Vector2 rayEnd, List<Segment> segments)
|
||||||
{
|
{
|
||||||
float closestDist = 0.0f;
|
float closestDist = 0.0f;
|
||||||
Vector2? closestIntersection = null;
|
Vector2? closestIntersection = null;
|
||||||
|
int segment = -1;
|
||||||
|
|
||||||
foreach (Segment s in segments)
|
for (int i=0;i<segments.Count;i++)
|
||||||
{
|
{
|
||||||
|
Segment s = segments[i];
|
||||||
Vector2? intersection = MathUtils.GetAxisAlignedLineIntersection(rayStart, rayEnd, s.Start.WorldPos, s.End.WorldPos, s.IsHorizontal);
|
Vector2? intersection = MathUtils.GetAxisAlignedLineIntersection(rayStart, rayEnd, s.Start.WorldPos, s.End.WorldPos, s.IsHorizontal);
|
||||||
|
|
||||||
if (intersection != null)
|
if (intersection != null)
|
||||||
@@ -420,16 +454,20 @@ namespace Barotrauma.Lights
|
|||||||
{
|
{
|
||||||
closestDist = dist;
|
closestDist = dist;
|
||||||
closestIntersection = intersection;
|
closestIntersection = intersection;
|
||||||
|
segment = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return closestIntersection == null ? rayEnd : (Vector2)closestIntersection;
|
Pair<int,Vector2> retVal = new Pair<int,Vector2>();
|
||||||
|
retVal.Second = closestIntersection == null ? rayEnd : (Vector2)closestIntersection;
|
||||||
|
retVal.First = segment;
|
||||||
|
return retVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CalculateLightVertices(List<Vector2> rayCastHits)
|
private void CalculateLightVertices(List<Vector2> rayCastHits)
|
||||||
{
|
{
|
||||||
List<VertexPositionTexture> vertices = new List<VertexPositionTexture>();
|
List<VertexPositionColorTexture> vertices = new List<VertexPositionColorTexture>();
|
||||||
|
|
||||||
Vector2 drawPos = position;
|
Vector2 drawPos = position;
|
||||||
if (ParentSub != null) drawPos += ParentSub.DrawPosition;
|
if (ParentSub != null) drawPos += ParentSub.DrawPosition;
|
||||||
@@ -446,16 +484,19 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add a vertex for the center of the mesh
|
// Add a vertex for the center of the mesh
|
||||||
vertices.Add(new VertexPositionTexture(new Vector3(position.X, position.Y, 0),
|
vertices.Add(new VertexPositionColorTexture(new Vector3(position.X, position.Y, 0),
|
||||||
new Vector2(0.5f, 0.5f) + uvOffset));
|
Color.White,new Vector2(0.5f, 0.5f) + uvOffset));
|
||||||
|
|
||||||
// Add all the other encounter points as vertices
|
// Add all the other encounter points as vertices
|
||||||
// storing their world position as UV coordinates
|
// storing their world position as UV coordinates
|
||||||
foreach (Vector2 vertex in rayCastHits)
|
for (int i = 0; i < rayCastHits.Count; i++)
|
||||||
{
|
{
|
||||||
|
Vector2 vertex = rayCastHits[i];
|
||||||
|
Vector2 prevVertex = rayCastHits[i > 0 ? i - 1 : rayCastHits.Count - 1];
|
||||||
|
Vector2 nextVertex = rayCastHits[i < rayCastHits.Count - 1 ? i + 1 : 0];
|
||||||
Vector2 rawDiff = vertex - drawPos;
|
Vector2 rawDiff = vertex - drawPos;
|
||||||
Vector2 diff = rawDiff;
|
Vector2 diff = rawDiff;
|
||||||
diff /= range*2.0f;
|
diff /= range * 2.0f;
|
||||||
if (overrideLightTexture != null)
|
if (overrideLightTexture != null)
|
||||||
{
|
{
|
||||||
Vector2 originDiff = diff;
|
Vector2 originDiff = diff;
|
||||||
@@ -467,22 +508,52 @@ namespace Barotrauma.Lights
|
|||||||
diff += uvOffset;
|
diff += uvOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
vertices.Add(new VertexPositionTexture(new Vector3(position.X + rawDiff.X, position.Y + rawDiff.Y, 0),
|
Vector2 nDiff1 = vertex - nextVertex;
|
||||||
new Vector2(0.5f, 0.5f) + diff));
|
float tx = nDiff1.X; nDiff1.X = -nDiff1.Y; nDiff1.Y = tx;
|
||||||
|
nDiff1 /= Math.Max(Math.Abs(nDiff1.X), Math.Abs(nDiff1.Y));
|
||||||
|
Vector2 nDiff2 = prevVertex - vertex;
|
||||||
|
tx = nDiff2.X; nDiff2.X = -nDiff2.Y; nDiff2.Y = tx;
|
||||||
|
nDiff2 /= Math.Max(Math.Abs(nDiff2.X),Math.Abs(nDiff2.Y));
|
||||||
|
Vector2 nDiff = nDiff1 + nDiff2;
|
||||||
|
nDiff /= Math.Max(Math.Abs(nDiff.X), Math.Abs(nDiff.Y));
|
||||||
|
nDiff *= 50.0f;
|
||||||
|
if (Vector2.DistanceSquared(nDiff, rawDiff) > Vector2.DistanceSquared(-nDiff, rawDiff)) nDiff = -nDiff;
|
||||||
|
VertexPositionColorTexture fadeVert = new VertexPositionColorTexture(new Vector3(position.X + rawDiff.X + nDiff.X, position.Y + rawDiff.Y + nDiff.Y, 0),
|
||||||
|
Color.White * 0.0f, new Vector2(0.5f, 0.5f) + diff);
|
||||||
|
|
||||||
|
vertices.Add(new VertexPositionColorTexture(new Vector3(position.X + rawDiff.X, position.Y + rawDiff.Y, 0),
|
||||||
|
Color.White, new Vector2(0.5f, 0.5f) + diff));
|
||||||
|
vertices.Add(fadeVert);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the indices to form triangles
|
// Compute the indices to form triangles
|
||||||
List<short> indices = new List<short>();
|
List<short> indices = new List<short>();
|
||||||
for (int i = 0; i < rayCastHits.Count - 1; i++)
|
for (int i = 0; i < rayCastHits.Count-1; i++)
|
||||||
{
|
{
|
||||||
indices.Add(0);
|
indices.Add(0);
|
||||||
indices.Add((short)((i + 2) % vertices.Count));
|
indices.Add((short)((i*2 + 3) % vertices.Count));
|
||||||
indices.Add((short)((i + 1) % vertices.Count));
|
indices.Add((short)((i*2 + 1) % vertices.Count));
|
||||||
|
|
||||||
|
indices.Add((short)((i*2 + 1) % vertices.Count));
|
||||||
|
indices.Add((short)((i*2 + 3) % vertices.Count));
|
||||||
|
indices.Add((short)((i*2 + 4) % vertices.Count));
|
||||||
|
|
||||||
|
indices.Add((short)((i*2 + 2) % vertices.Count));
|
||||||
|
indices.Add((short)((i*2 + 1) % vertices.Count));
|
||||||
|
indices.Add((short)((i*2 + 4) % vertices.Count));
|
||||||
}
|
}
|
||||||
|
|
||||||
indices.Add(0);
|
indices.Add(0);
|
||||||
indices.Add((short)(1));
|
indices.Add((short)(1));
|
||||||
indices.Add((short)(vertices.Count - 1));
|
indices.Add((short)(vertices.Count - 2));
|
||||||
|
|
||||||
|
indices.Add((short)(1));
|
||||||
|
indices.Add((short)(vertices.Count-1));
|
||||||
|
indices.Add((short)(vertices.Count-2));
|
||||||
|
|
||||||
|
indices.Add((short)(1));
|
||||||
|
indices.Add((short)(2));
|
||||||
|
indices.Add((short)(vertices.Count-1));
|
||||||
|
|
||||||
vertexCount = vertices.Count;
|
vertexCount = vertices.Count;
|
||||||
indexCount = indices.Count;
|
indexCount = indices.Count;
|
||||||
@@ -491,19 +562,19 @@ namespace Barotrauma.Lights
|
|||||||
//now we just create a buffer for 64 verts and make it larger if needed
|
//now we just create a buffer for 64 verts and make it larger if needed
|
||||||
if (lightVolumeBuffer == null)
|
if (lightVolumeBuffer == null)
|
||||||
{
|
{
|
||||||
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionTexture.VertexDeclaration, Math.Max(64, (int)(vertexCount*1.5)), BufferUsage.None);
|
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionColorTexture.VertexDeclaration, Math.Max(64, (int)(vertexCount*1.5)), BufferUsage.None);
|
||||||
lightVolumeIndexBuffer = new DynamicIndexBuffer(GameMain.Instance.GraphicsDevice, typeof(short), Math.Max(64*3, (int)(indexCount * 1.5)), BufferUsage.None);
|
lightVolumeIndexBuffer = new DynamicIndexBuffer(GameMain.Instance.GraphicsDevice, typeof(short), Math.Max(64*3, (int)(indexCount * 1.5)), BufferUsage.None);
|
||||||
}
|
}
|
||||||
else if (vertexCount > lightVolumeBuffer.VertexCount)
|
else if (vertexCount > lightVolumeBuffer.VertexCount || indexCount > lightVolumeIndexBuffer.IndexCount)
|
||||||
{
|
{
|
||||||
lightVolumeBuffer.Dispose();
|
lightVolumeBuffer.Dispose();
|
||||||
lightVolumeIndexBuffer.Dispose();
|
lightVolumeIndexBuffer.Dispose();
|
||||||
|
|
||||||
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionTexture.VertexDeclaration, (int)(vertexCount*1.5), BufferUsage.None);
|
lightVolumeBuffer = new DynamicVertexBuffer(GameMain.Instance.GraphicsDevice, VertexPositionColorTexture.VertexDeclaration, (int)(vertexCount*1.5), BufferUsage.None);
|
||||||
lightVolumeIndexBuffer = new DynamicIndexBuffer(GameMain.Instance.GraphicsDevice, typeof(short), (int)(indexCount * 1.5), BufferUsage.None);
|
lightVolumeIndexBuffer = new DynamicIndexBuffer(GameMain.Instance.GraphicsDevice, typeof(short), (int)(indexCount * 1.5), BufferUsage.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
lightVolumeBuffer.SetData<VertexPositionTexture>(vertices.ToArray());
|
lightVolumeBuffer.SetData<VertexPositionColorTexture>(vertices.ToArray());
|
||||||
lightVolumeIndexBuffer.SetData<short>(indices.ToArray());
|
lightVolumeIndexBuffer.SetData<short>(indices.ToArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,7 +633,7 @@ namespace Barotrauma.Lights
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lightEffect.Texture = LightTexture;
|
lightEffect.Texture = texture??LightTexture;
|
||||||
}
|
}
|
||||||
lightEffect.CurrentTechnique.Passes[0].Apply();
|
lightEffect.CurrentTechnique.Passes[0].Apply();
|
||||||
|
|
||||||
@@ -571,6 +642,7 @@ namespace Barotrauma.Lights
|
|||||||
|
|
||||||
GameMain.Instance.GraphicsDevice.DrawIndexedPrimitives
|
GameMain.Instance.GraphicsDevice.DrawIndexedPrimitives
|
||||||
(
|
(
|
||||||
|
//PrimitiveType.LineList, 0, 0, indexCount / 2
|
||||||
PrimitiveType.TriangleList, 0, 0, indexCount / 3
|
PrimitiveType.TriangleList, 0, 0, indexCount / 3
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -94,24 +94,23 @@ namespace Barotrauma
|
|||||||
editingHUD.Padding = new Vector4(10, 10, 0, 0);
|
editingHUD.Padding = new Vector4(10, 10, 0, 0);
|
||||||
editingHUD.UserData = this;
|
editingHUD.UserData = this;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Linked submarine", "",
|
new GUITextBlock(new Rectangle(0, 0, 100, 20), TextManager.Get("LinkedSub"), "",
|
||||||
Alignment.TopLeft, Alignment.TopLeft, editingHUD, false, GUI.LargeFont);
|
Alignment.TopLeft, Alignment.TopLeft, editingHUD, false, GUI.LargeFont);
|
||||||
|
|
||||||
var pathBox = new GUITextBox(new Rectangle(10, 30, 300, 20), "", editingHUD);
|
var pathBox = new GUITextBox(new Rectangle(10, 30, 300, 20), "", editingHUD);
|
||||||
pathBox.Font = GUI.SmallFont;
|
pathBox.Font = GUI.SmallFont;
|
||||||
pathBox.Text = filePath;
|
pathBox.Text = filePath;
|
||||||
|
|
||||||
var reloadButton = new GUIButton(new Rectangle(320, 30, 80, 20), "Refresh", "", editingHUD);
|
var reloadButton = new GUIButton(new Rectangle(320, 30, 80, 20), TextManager.Get("ReloadLinkedSub"), "", editingHUD);
|
||||||
reloadButton.OnClicked = Reload;
|
reloadButton.OnClicked = Reload;
|
||||||
reloadButton.UserData = pathBox;
|
reloadButton.UserData = pathBox;
|
||||||
|
reloadButton.ToolTip = TextManager.Get("ReloadLinkedSubTooltip");
|
||||||
reloadButton.ToolTip = "Reload the linked submarine from the specified file";
|
|
||||||
|
|
||||||
y += 20;
|
y += 20;
|
||||||
|
|
||||||
if (!inGame)
|
if (!inGame)
|
||||||
{
|
{
|
||||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Hold space to link to a docking port",
|
new GUITextBlock(new Rectangle(0, 0, 0, 20), TextManager.Get("LinkLinkedSub"),
|
||||||
"", Alignment.TopRight, Alignment.TopRight, editingHUD, false, GUI.SmallFont);
|
"", Alignment.TopRight, Alignment.TopRight, editingHUD, false, GUI.SmallFont);
|
||||||
y += 25;
|
y += 25;
|
||||||
|
|
||||||
@@ -125,7 +124,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (!File.Exists(pathBox.Text))
|
if (!File.Exists(pathBox.Text))
|
||||||
{
|
{
|
||||||
new GUIMessageBox("Error", "Submarine file \"" + pathBox.Text + "\" not found!");
|
new GUIMessageBox(TextManager.Get("Error"), TextManager.Get("ReloadLinkedSubError").Replace("[file]", pathBox.Text));
|
||||||
pathBox.Flash(Color.Red);
|
pathBox.Flash(Color.Red);
|
||||||
pathBox.Text = filePath;
|
pathBox.Text = filePath;
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ using Microsoft.Xna.Framework.Graphics;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Xml.Linq;
|
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -149,14 +148,17 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
float newCutoff = Math.Min((sections[i].damage / prefab.Health), 0.65f);
|
float newCutoff = Math.Min((sections[i].damage / prefab.Health), 0.65f);
|
||||||
|
|
||||||
if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f)
|
if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f || color != Submarine.DamageEffectColor)
|
||||||
{
|
{
|
||||||
damageEffect.Parameters["aCutoff"].SetValue(newCutoff);
|
damageEffect.Parameters["aCutoff"].SetValue(newCutoff);
|
||||||
damageEffect.Parameters["cCutoff"].SetValue(newCutoff * 1.2f);
|
damageEffect.Parameters["cCutoff"].SetValue(newCutoff * 1.2f);
|
||||||
|
damageEffect.Parameters["inColor"].SetValue(color.ToVector4());
|
||||||
|
|
||||||
|
|
||||||
damageEffect.CurrentTechnique.Passes[0].Apply();
|
damageEffect.CurrentTechnique.Passes[0].Apply();
|
||||||
|
|
||||||
Submarine.DamageEffectCutoff = newCutoff;
|
Submarine.DamageEffectCutoff = newCutoff;
|
||||||
|
Submarine.DamageEffectColor = color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static float DamageEffectCutoff;
|
public static float DamageEffectCutoff;
|
||||||
|
public static Color DamageEffectColor;
|
||||||
|
|
||||||
public static void DrawDamageable(SpriteBatch spriteBatch, Effect damageEffect, bool editing = false)
|
public static void DrawDamageable(SpriteBatch spriteBatch, Effect damageEffect, bool editing = false)
|
||||||
{
|
{
|
||||||
@@ -105,15 +106,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public static bool SaveCurrent(string filePath)
|
public static bool SaveCurrent(string filePath)
|
||||||
{
|
{
|
||||||
if (Submarine.MainSub == null)
|
if (MainSub == null)
|
||||||
{
|
{
|
||||||
Submarine.MainSub = new Submarine(filePath);
|
MainSub = new Submarine(filePath);
|
||||||
// return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Submarine.MainSub.filePath = filePath;
|
MainSub.filePath = filePath;
|
||||||
|
return MainSub.SaveAs(filePath);
|
||||||
return Submarine.MainSub.SaveAs(filePath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CheckForErrors()
|
public void CheckForErrors()
|
||||||
@@ -122,7 +121,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (!Hull.hullList.Any())
|
if (!Hull.hullList.Any())
|
||||||
{
|
{
|
||||||
errorMsgs.Add("No hulls found in the submarine. Hulls determine the \"borders\" of an individual room and are required for water and air distribution to work correctly.");
|
errorMsgs.Add(TextManager.Get("NoHullsWarning"));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Item item in Item.ItemList)
|
foreach (Item item in Item.ItemList)
|
||||||
@@ -131,25 +130,24 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (!item.linkedTo.Any())
|
if (!item.linkedTo.Any())
|
||||||
{
|
{
|
||||||
errorMsgs.Add("The submarine contains vents which haven't been linked to an oxygen generator. Select a vent and click an oxygen generator while holding space to link them.");
|
errorMsgs.Add(TextManager.Get("DisconnectedVentsWarning"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WayPoint.WayPointList.Find(wp => !wp.MoveWithLevel && wp.SpawnType == SpawnType.Path) == null)
|
if (WayPoint.WayPointList.Find(wp => !wp.MoveWithLevel && wp.SpawnType == SpawnType.Path) == null)
|
||||||
{
|
{
|
||||||
errorMsgs.Add("No waypoints found in the submarine. AI controlled crew members won't be able to navigate without waypoints.");
|
errorMsgs.Add(TextManager.Get("NoWaypointsWarning"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WayPoint.WayPointList.Find(wp => wp.SpawnType == SpawnType.Cargo) == null)
|
if (WayPoint.WayPointList.Find(wp => wp.SpawnType == SpawnType.Cargo) == null)
|
||||||
{
|
{
|
||||||
errorMsgs.Add("The submarine doesn't have spawnpoints for cargo (which are used for determining where to place bought items). "
|
errorMsgs.Add(TextManager.Get("NoCargoSpawnpointWarning"));
|
||||||
+ "To fix this, create a new spawnpoint and change its \"spawn type\" parameter to \"cargo\".");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorMsgs.Any())
|
if (errorMsgs.Any())
|
||||||
{
|
{
|
||||||
new GUIMessageBox("Warning", string.Join("\n\n", errorMsgs), 400, 0);
|
new GUIMessageBox(TextManager.Get("Warning"), string.Join("\n\n", errorMsgs), 400, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (MapEntity e in MapEntity.mapEntityList)
|
foreach (MapEntity e in MapEntity.mapEntityList)
|
||||||
@@ -157,9 +155,9 @@ namespace Barotrauma
|
|||||||
if (Vector2.Distance(e.Position, HiddenSubPosition) > 20000)
|
if (Vector2.Distance(e.Position, HiddenSubPosition) > 20000)
|
||||||
{
|
{
|
||||||
var msgBox = new GUIMessageBox(
|
var msgBox = new GUIMessageBox(
|
||||||
"Warning",
|
TextManager.Get("Warning"),
|
||||||
"One or more structures have been placed very far from the submarine. Show the structures?",
|
TextManager.Get("FarAwayEntitiesWarning"),
|
||||||
new string[] { "Yes", "No" });
|
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||||
|
|
||||||
msgBox.Buttons[0].OnClicked += (btn, obj) =>
|
msgBox.Buttons[0].OnClicked += (btn, obj) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -132,10 +132,10 @@ namespace Barotrauma
|
|||||||
string trimmedName = text.ToLowerInvariant().Trim();
|
string trimmedName = text.ToLowerInvariant().Trim();
|
||||||
assignedJob = JobPrefab.List.Find(jp => jp.Name.ToLowerInvariant() == trimmedName);
|
assignedJob = JobPrefab.List.Find(jp => jp.Name.ToLowerInvariant() == trimmedName);
|
||||||
|
|
||||||
if (assignedJob != null && trimmedName != "none")
|
if (assignedJob != null && trimmedName != TextManager.Get("None").ToLowerInvariant())
|
||||||
{
|
{
|
||||||
textBox.Color = Color.Green;
|
textBox.Color = Color.Green;
|
||||||
textBox.Text = (assignedJob == null) ? "None" : assignedJob.Name;
|
textBox.Text = (assignedJob == null) ? TextManager.Get("None") : assignedJob.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
textBox.Deselect();
|
textBox.Deselect();
|
||||||
@@ -156,19 +156,19 @@ namespace Barotrauma
|
|||||||
int height = spawnType == SpawnType.Path ? 100 : 200;
|
int height = spawnType == SpawnType.Path ? 100 : 200;
|
||||||
int x = GameMain.GraphicsWidth / 2 - width / 2, y = 10;
|
int x = GameMain.GraphicsWidth / 2 - width / 2, y = 10;
|
||||||
|
|
||||||
editingHUD = new GUIFrame(new Rectangle(x, y, width, height), Color.Black * 0.5f);
|
editingHUD = new GUIFrame(new Rectangle(x, y, width, height));
|
||||||
editingHUD.Padding = new Vector4(10, 10, 0, 0);
|
editingHUD.Padding = new Vector4(10, 10, 20, 0);
|
||||||
editingHUD.UserData = this;
|
editingHUD.UserData = this;
|
||||||
|
|
||||||
if (spawnType == SpawnType.Path)
|
if (spawnType == SpawnType.Path)
|
||||||
{
|
{
|
||||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing waypoint", "", editingHUD);
|
new GUITextBlock(new Rectangle(0, 0, 100, 20), TextManager.Get("Editing")+" " +TextManager.Get("Waypoint"), "", editingHUD);
|
||||||
new GUITextBlock(new Rectangle(0, 20, 100, 20), "Hold space to link to another waypoint", "", editingHUD);
|
new GUITextBlock(new Rectangle(0, 20, 100, 20), TextManager.Get("LinkWaypoint"), "", editingHUD);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Editing spawnpoint", "", editingHUD);
|
new GUITextBlock(new Rectangle(0, 0, 100, 20), TextManager.Get("Editing") + " " + TextManager.Get("Spawnpoint"), "", editingHUD);
|
||||||
new GUITextBlock(new Rectangle(0, 25, 100, 20), "Spawn type: ", "", editingHUD);
|
new GUITextBlock(new Rectangle(0, 25, 100, 20), TextManager.Get("SpawnType") + ": ", "", editingHUD);
|
||||||
|
|
||||||
var spawnTypeText = new GUITextBlock(new Rectangle(0, 25, 200, 20), spawnType.ToString(), "", Alignment.Right, Alignment.TopLeft, editingHUD);
|
var spawnTypeText = new GUITextBlock(new Rectangle(0, 25, 200, 20), spawnType.ToString(), "", Alignment.Right, Alignment.TopLeft, editingHUD);
|
||||||
|
|
||||||
@@ -182,33 +182,33 @@ namespace Barotrauma
|
|||||||
|
|
||||||
y = 40 + 20;
|
y = 40 + 20;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, y, 100, 20), "ID Card desc:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD);
|
new GUITextBlock(new Rectangle(0, y, 100, 20), TextManager.Get("IDCardDescription"), "", Alignment.TopLeft, Alignment.CenterLeft, editingHUD, false, GUI.SmallFont);
|
||||||
GUITextBox propertyBox = new GUITextBox(new Rectangle(100, y, 350, 20), "", editingHUD);
|
GUITextBox propertyBox = new GUITextBox(new Rectangle(150, y, 0, 20), "", editingHUD);
|
||||||
propertyBox.MaxTextLength = 150;
|
propertyBox.MaxTextLength = 150;
|
||||||
propertyBox.Text = idCardDesc;
|
propertyBox.Text = idCardDesc;
|
||||||
propertyBox.OnEnterPressed = EnterIDCardDesc;
|
propertyBox.OnEnterPressed = EnterIDCardDesc;
|
||||||
propertyBox.OnTextChanged = TextBoxChanged;
|
propertyBox.OnTextChanged = TextBoxChanged;
|
||||||
propertyBox.ToolTip = "Characters spawning at this spawnpoint will have the specified description added to their ID card. This can be used to describe additional access levels their card has on the sub.";
|
propertyBox.ToolTip = TextManager.Get("IDCardDescriptionTooltip");
|
||||||
|
|
||||||
y = y + 30;
|
y = y + 30;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, y, 100, 20), "ID Card tags:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD);
|
new GUITextBlock(new Rectangle(0, y, 100, 20), TextManager.Get("IDCardTags"), "", Alignment.TopLeft, Alignment.CenterLeft, editingHUD, false, GUI.SmallFont);
|
||||||
propertyBox = new GUITextBox(new Rectangle(100, y, 350, 20), "", editingHUD);
|
propertyBox = new GUITextBox(new Rectangle(150, y, 0, 20), "", editingHUD);
|
||||||
propertyBox.MaxTextLength = 60;
|
propertyBox.MaxTextLength = 60;
|
||||||
propertyBox.Text = string.Join(", ", idCardTags);
|
propertyBox.Text = string.Join(", ", idCardTags);
|
||||||
propertyBox.OnEnterPressed = EnterIDCardTags;
|
propertyBox.OnEnterPressed = EnterIDCardTags;
|
||||||
propertyBox.OnTextChanged = TextBoxChanged;
|
propertyBox.OnTextChanged = TextBoxChanged;
|
||||||
propertyBox.ToolTip = "Characters spawning at this spawnpoint will have the specified tags added to their ID card. You can, for example, use these tags to limit access to some parts of the sub.";
|
propertyBox.ToolTip = TextManager.Get("IDCardTagsTooltip");
|
||||||
|
|
||||||
y = y + 30;
|
y = y + 30;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, y, 100, 20), "Assigned job:", Color.Transparent, Color.White, Alignment.TopLeft, null, editingHUD);
|
new GUITextBlock(new Rectangle(0, y, 100, 20), TextManager.Get("SpawnpointJobs"), "", Alignment.TopLeft, Alignment.CenterLeft, editingHUD, false, GUI.SmallFont);
|
||||||
propertyBox = new GUITextBox(new Rectangle(100, y, 350, 20), "", editingHUD);
|
propertyBox = new GUITextBox(new Rectangle(150, y, 0, 20), "", editingHUD);
|
||||||
propertyBox.MaxTextLength = 60;
|
propertyBox.MaxTextLength = 60;
|
||||||
propertyBox.Text = (assignedJob == null) ? "None" : assignedJob.Name;
|
propertyBox.Text = (assignedJob == null) ? "None" : assignedJob.Name;
|
||||||
propertyBox.OnEnterPressed = EnterAssignedJob;
|
propertyBox.OnEnterPressed = EnterAssignedJob;
|
||||||
propertyBox.OnTextChanged = TextBoxChanged;
|
propertyBox.OnTextChanged = TextBoxChanged;
|
||||||
propertyBox.ToolTip = "Only characters with the specified job will spawn at this spawnpoint.";
|
propertyBox.ToolTip = TextManager.Get("SpawnpointJobsTooltip");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -757,11 +757,6 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
if (respawnAllowed) respawnManager = new RespawnManager(this, GameMain.NetLobbyScreen.UsingShuttle ? GameMain.NetLobbyScreen.SelectedShuttle : null);
|
if (respawnAllowed) respawnManager = new RespawnManager(this, GameMain.NetLobbyScreen.UsingShuttle ? GameMain.NetLobbyScreen.SelectedShuttle : null);
|
||||||
|
|
||||||
if (isTraitor)
|
|
||||||
{
|
|
||||||
TraitorManager.CreateStartPopUp(traitorTargetName);
|
|
||||||
}
|
|
||||||
|
|
||||||
gameStarted = true;
|
gameStarted = true;
|
||||||
|
|
||||||
GameMain.GameScreen.Select();
|
GameMain.GameScreen.Select();
|
||||||
@@ -974,8 +969,14 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
private void ReadIngameUpdate(NetIncomingMessage inc)
|
private void ReadIngameUpdate(NetIncomingMessage inc)
|
||||||
{
|
{
|
||||||
|
List<IServerSerializable> entities = new List<IServerSerializable>();
|
||||||
|
|
||||||
float sendingTime = inc.ReadFloat() - inc.SenderConnection.RemoteTimeOffset;
|
float sendingTime = inc.ReadFloat() - inc.SenderConnection.RemoteTimeOffset;
|
||||||
|
|
||||||
|
ServerNetObject? prevObjHeader = null;
|
||||||
|
long prevBitPos = 0;
|
||||||
|
long prevBytePos = 0;
|
||||||
|
|
||||||
ServerNetObject objHeader;
|
ServerNetObject objHeader;
|
||||||
while ((objHeader = (ServerNetObject)inc.ReadByte()) != ServerNetObject.END_OF_MESSAGE)
|
while ((objHeader = (ServerNetObject)inc.ReadByte()) != ServerNetObject.END_OF_MESSAGE)
|
||||||
{
|
{
|
||||||
@@ -1004,15 +1005,51 @@ namespace Barotrauma.Networking
|
|||||||
break;
|
break;
|
||||||
case ServerNetObject.ENTITY_EVENT:
|
case ServerNetObject.ENTITY_EVENT:
|
||||||
case ServerNetObject.ENTITY_EVENT_INITIAL:
|
case ServerNetObject.ENTITY_EVENT_INITIAL:
|
||||||
entityEventManager.Read(objHeader, inc, sendingTime);
|
entityEventManager.Read(objHeader, inc, sendingTime, entities);
|
||||||
break;
|
break;
|
||||||
case ServerNetObject.CHAT_MESSAGE:
|
case ServerNetObject.CHAT_MESSAGE:
|
||||||
ChatMessage.ClientRead(inc);
|
ChatMessage.ClientRead(inc);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
DebugConsole.ThrowError("Error while reading update from server (unknown object header \""+objHeader+"\"!)");
|
DebugConsole.ThrowError("Error while reading update from server (unknown object header \""+objHeader+"\"!)");
|
||||||
|
if (prevObjHeader != null)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Previous object type: " + prevObjHeader.ToString());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Error occurred on the very first object!");
|
||||||
|
}
|
||||||
|
DebugConsole.ThrowError("Previous object was " + (inc.Position - prevBitPos) + " bits long (" + (inc.PositionInBytes - prevBytePos) + " bytes)");
|
||||||
|
if (prevObjHeader == ServerNetObject.ENTITY_EVENT || prevObjHeader == ServerNetObject.ENTITY_EVENT_INITIAL)
|
||||||
|
{
|
||||||
|
foreach (IServerSerializable ent in entities)
|
||||||
|
{
|
||||||
|
if (ent == null)
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError(" - NULL");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
Entity e = ent as Entity;
|
||||||
|
DebugConsole.ThrowError(" - "+e.ToString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DebugConsole.ThrowError("Writing object data to \"crashreport_object.bin\", please send this file to us at http://github.com/Regalis11/Barotrauma/issues");
|
||||||
|
|
||||||
|
FileStream fl = File.Open("crashreport_object.bin", FileMode.Create);
|
||||||
|
BinaryWriter sw = new BinaryWriter(fl);
|
||||||
|
|
||||||
|
sw.Write(inc.Data, (int)prevBytePos, (int)(inc.LengthBytes - prevBytePos));
|
||||||
|
|
||||||
|
sw.Close();
|
||||||
|
fl.Close();
|
||||||
|
|
||||||
|
throw new Exception("Error while reading update from server: please send us \"crashreport_object.bin\"!");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
prevObjHeader = objHeader;
|
||||||
|
prevBitPos = inc.Position;
|
||||||
|
prevBytePos = inc.PositionInBytes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-1
@@ -100,7 +100,7 @@ namespace Barotrauma.Networking
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Read the events from the message, ignoring ones we've already received
|
/// Read the events from the message, ignoring ones we've already received
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Read(ServerNetObject type, NetIncomingMessage msg, float sendingTime)
|
public void Read(ServerNetObject type, NetIncomingMessage msg, float sendingTime, List<IServerSerializable> entities)
|
||||||
{
|
{
|
||||||
UInt16 unreceivedEntityEventCount = 0;
|
UInt16 unreceivedEntityEventCount = 0;
|
||||||
|
|
||||||
@@ -128,6 +128,8 @@ namespace Barotrauma.Networking
|
|||||||
firstNewID = null;
|
firstNewID = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entities.Clear();
|
||||||
|
|
||||||
UInt16 firstEventID = msg.ReadUInt16();
|
UInt16 firstEventID = msg.ReadUInt16();
|
||||||
int eventCount = msg.ReadByte();
|
int eventCount = msg.ReadByte();
|
||||||
|
|
||||||
@@ -146,6 +148,7 @@ namespace Barotrauma.Networking
|
|||||||
byte msgLength = msg.ReadByte();
|
byte msgLength = msg.ReadByte();
|
||||||
|
|
||||||
IServerSerializable entity = Entity.FindEntityByID(entityID) as IServerSerializable;
|
IServerSerializable entity = Entity.FindEntityByID(entityID) as IServerSerializable;
|
||||||
|
entities.Add(entity);
|
||||||
|
|
||||||
//skip the event if we've already received it or if the entity isn't found
|
//skip the event if we've already received it or if the entity isn't found
|
||||||
if (thisEventID != (UInt16)(lastReceivedID + 1) || entity == null)
|
if (thisEventID != (UInt16)(lastReceivedID + 1) || entity == null)
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ namespace Barotrauma.Particles
|
|||||||
private float lifeTime;
|
private float lifeTime;
|
||||||
|
|
||||||
private Vector2 velocityChange;
|
private Vector2 velocityChange;
|
||||||
|
private Vector2 velocityChangeWater;
|
||||||
|
|
||||||
private Vector2 drawPosition;
|
private Vector2 drawPosition;
|
||||||
private float drawRotation;
|
private float drawRotation;
|
||||||
@@ -46,6 +47,8 @@ namespace Barotrauma.Particles
|
|||||||
|
|
||||||
private List<Gap> hullGaps;
|
private List<Gap> hullGaps;
|
||||||
|
|
||||||
|
private List<ParticleEmitter> subEmitters = new List<ParticleEmitter>();
|
||||||
|
|
||||||
private float animState;
|
private float animState;
|
||||||
private int animFrame;
|
private int animFrame;
|
||||||
|
|
||||||
@@ -71,6 +74,12 @@ namespace Barotrauma.Particles
|
|||||||
set { velocityChange = value; }
|
set { velocityChange = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Vector2 VelocityChangeWater
|
||||||
|
{
|
||||||
|
get { return velocityChangeWater; }
|
||||||
|
set { velocityChangeWater = value; }
|
||||||
|
}
|
||||||
|
|
||||||
public Vector2 Velocity
|
public Vector2 Velocity
|
||||||
{
|
{
|
||||||
get { return velocity; }
|
get { return velocity; }
|
||||||
@@ -90,6 +99,8 @@ namespace Barotrauma.Particles
|
|||||||
|
|
||||||
animState = 0;
|
animState = 0;
|
||||||
animFrame = 0;
|
animFrame = 0;
|
||||||
|
dragWait = 0;
|
||||||
|
dragVec = Vector2.Zero;
|
||||||
|
|
||||||
currentHull = Hull.FindHull(position, hullGuess);
|
currentHull = Hull.FindHull(position, hullGuess);
|
||||||
|
|
||||||
@@ -121,9 +132,16 @@ namespace Barotrauma.Particles
|
|||||||
alpha = prefab.StartAlpha;
|
alpha = prefab.StartAlpha;
|
||||||
|
|
||||||
velocityChange = prefab.VelocityChangeDisplay;
|
velocityChange = prefab.VelocityChangeDisplay;
|
||||||
|
velocityChangeWater = prefab.VelocityChangeWaterDisplay;
|
||||||
|
|
||||||
OnChangeHull = null;
|
OnChangeHull = null;
|
||||||
|
|
||||||
|
subEmitters.Clear();
|
||||||
|
foreach (ParticleEmitterPrefab emitterPrefab in prefab.SubEmitters)
|
||||||
|
{
|
||||||
|
subEmitters.Add(new ParticleEmitter(emitterPrefab));
|
||||||
|
}
|
||||||
|
|
||||||
if (prefab.DeleteOnCollision || prefab.CollidesWithWalls)
|
if (prefab.DeleteOnCollision || prefab.CollidesWithWalls)
|
||||||
{
|
{
|
||||||
hullGaps = currentHull == null ? new List<Gap>() : currentHull.ConnectedGaps;
|
hullGaps = currentHull == null ? new List<Gap>() : currentHull.ConnectedGaps;
|
||||||
@@ -158,18 +176,25 @@ namespace Barotrauma.Particles
|
|||||||
rotation += angularVelocity * deltaTime;
|
rotation += angularVelocity * deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (prefab.WaterDrag > 0.0f &&
|
bool inWater = (currentHull == null || (currentHull.Submarine != null && position.Y - currentHull.Submarine.DrawPosition.Y < currentHull.Surface));
|
||||||
(currentHull == null || (currentHull.Submarine != null && position.Y - currentHull.Submarine.DrawPosition.Y < currentHull.Surface)))
|
if (inWater)
|
||||||
|
{
|
||||||
|
velocity.X += velocityChangeWater.X * deltaTime;
|
||||||
|
velocity.Y += velocityChangeWater.Y * deltaTime;
|
||||||
|
if (prefab.WaterDrag > 0.0f)
|
||||||
{
|
{
|
||||||
ApplyDrag(prefab.WaterDrag, deltaTime);
|
ApplyDrag(prefab.WaterDrag, deltaTime);
|
||||||
}
|
}
|
||||||
else if (prefab.Drag > 0.0f)
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
velocity.X += velocityChange.X * deltaTime;
|
||||||
|
velocity.Y += velocityChange.Y * deltaTime;
|
||||||
|
if (prefab.Drag > 0.0f)
|
||||||
{
|
{
|
||||||
ApplyDrag(prefab.Drag, deltaTime);
|
ApplyDrag(prefab.Drag, deltaTime);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
velocity.X += velocityChange.X * deltaTime;
|
|
||||||
velocity.Y += velocityChange.Y * deltaTime;
|
|
||||||
|
|
||||||
size.X += sizeChange.X * deltaTime;
|
size.X += sizeChange.X * deltaTime;
|
||||||
size.Y += sizeChange.Y * deltaTime;
|
size.Y += sizeChange.Y * deltaTime;
|
||||||
@@ -191,6 +216,11 @@ namespace Barotrauma.Particles
|
|||||||
lifeTime -= deltaTime;
|
lifeTime -= deltaTime;
|
||||||
if (lifeTime <= 0.0f || alpha <= 0.0f || size.X <= 0.0f || size.Y <= 0.0f) return false;
|
if (lifeTime <= 0.0f || alpha <= 0.0f || size.X <= 0.0f || size.Y <= 0.0f) return false;
|
||||||
|
|
||||||
|
foreach (ParticleEmitter emitter in subEmitters)
|
||||||
|
{
|
||||||
|
emitter.Emit(deltaTime, position, currentHull);
|
||||||
|
}
|
||||||
|
|
||||||
if (!prefab.DeleteOnCollision && !prefab.CollidesWithWalls) return true;
|
if (!prefab.DeleteOnCollision && !prefab.CollidesWithWalls) return true;
|
||||||
|
|
||||||
if (currentHull == null)
|
if (currentHull == null)
|
||||||
@@ -201,7 +231,6 @@ namespace Barotrauma.Particles
|
|||||||
if (prefab.DeleteOnCollision) return false;
|
if (prefab.DeleteOnCollision) return false;
|
||||||
OnWallCollisionOutside(collidedHull);
|
OnWallCollisionOutside(collidedHull);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -258,7 +287,7 @@ namespace Barotrauma.Particles
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Hull newHull = Hull.FindHull(position);
|
Hull newHull = Hull.FindHull(position,currentHull);
|
||||||
if (newHull != currentHull)
|
if (newHull != currentHull)
|
||||||
{
|
{
|
||||||
currentHull = newHull;
|
currentHull = newHull;
|
||||||
@@ -281,8 +310,11 @@ namespace Barotrauma.Particles
|
|||||||
}
|
}
|
||||||
if (Math.Abs(velocity.X) < 0.0001f && Math.Abs(velocity.Y) < 0.0001f) return;
|
if (Math.Abs(velocity.X) < 0.0001f && Math.Abs(velocity.Y) < 0.0001f) return;
|
||||||
|
|
||||||
|
//TODO: some better way to handle particle drag
|
||||||
|
//this doesn't work that well because the drag vector is only updated every 0.5 seconds, allowing the particle to accelerate way more than it should
|
||||||
|
//(e.g. a falling particle can freely accelerate for 0.5 seconds before the drag takes effect)
|
||||||
dragWait--;
|
dragWait--;
|
||||||
if (dragWait<=0)
|
if (dragWait <= 0)
|
||||||
{
|
{
|
||||||
dragWait = 30;
|
dragWait = 30;
|
||||||
|
|
||||||
|
|||||||
@@ -32,13 +32,11 @@ namespace Barotrauma.Particles
|
|||||||
this.cam = cam;
|
this.cam = cam;
|
||||||
|
|
||||||
particles = new Particle[MaxParticles];
|
particles = new Particle[MaxParticles];
|
||||||
|
|
||||||
LoadPrefabs(configFile);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LoadPrefabs(string file)
|
public void LoadPrefabs()
|
||||||
{
|
{
|
||||||
XDocument doc = XMLExtensions.TryLoadXml(file);
|
XDocument doc = XMLExtensions.TryLoadXml(ConfigFile);
|
||||||
if (doc == null || doc.Root == null) return;
|
if (doc == null || doc.Root == null) return;
|
||||||
|
|
||||||
prefabs = new Dictionary<string, ParticlePrefab>();
|
prefabs = new Dictionary<string, ParticlePrefab>();
|
||||||
@@ -47,7 +45,7 @@ namespace Barotrauma.Particles
|
|||||||
{
|
{
|
||||||
if (prefabs.ContainsKey(element.Name.ToString()))
|
if (prefabs.ContainsKey(element.Name.ToString()))
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Error in " + file + "! Each particle prefab must have a unique name.");
|
DebugConsole.ThrowError("Error in " + ConfigFile + "! Each particle prefab must have a unique name.");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
prefabs.Add(element.Name.ToString(), new ParticlePrefab(element));
|
prefabs.Add(element.Name.ToString(), new ParticlePrefab(element));
|
||||||
|
|||||||
@@ -101,6 +101,20 @@ namespace Barotrauma.Particles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Vector2 velocityChangeWater;
|
||||||
|
public Vector2 VelocityChangeWaterDisplay { get; private set; }
|
||||||
|
|
||||||
|
[Editable(ToolTip = "How much the velocity of the particle changes per second when in water."), Serialize("0.0,0.0", false)]
|
||||||
|
public Vector2 VelocityChangeWater
|
||||||
|
{
|
||||||
|
get { return velocityChangeWater; }
|
||||||
|
private set
|
||||||
|
{
|
||||||
|
velocityChangeWater = value;
|
||||||
|
VelocityChangeWaterDisplay = ConvertUnits.ToDisplayUnits(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
[Editable(0.0f, 10000.0f, ToolTip = "Drag applied to the particle when it's moving through water."), Serialize(0.0f, false)]
|
[Editable(0.0f, 10000.0f, ToolTip = "Drag applied to the particle when it's moving through water."), Serialize(0.0f, false)]
|
||||||
public float CollisionRadius { get; private set; }
|
public float CollisionRadius { get; private set; }
|
||||||
|
|
||||||
@@ -164,6 +178,8 @@ namespace Barotrauma.Particles
|
|||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|
||||||
|
public readonly List<ParticleEmitterPrefab> SubEmitters = new List<ParticleEmitterPrefab>();
|
||||||
|
|
||||||
public Dictionary<string, SerializableProperty> SerializableProperties
|
public Dictionary<string, SerializableProperty> SerializableProperties
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
@@ -191,9 +207,20 @@ namespace Barotrauma.Particles
|
|||||||
case "animatedsprite":
|
case "animatedsprite":
|
||||||
Sprites.Add(new SpriteSheet(subElement));
|
Sprites.Add(new SpriteSheet(subElement));
|
||||||
break;
|
break;
|
||||||
|
case "particleemitter":
|
||||||
|
case "emitter":
|
||||||
|
case "subemitter":
|
||||||
|
SubEmitters.Add(new ParticleEmitterPrefab(subElement));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if velocity change in water is not given, it defaults to the normal velocity change
|
||||||
|
if (element.Attribute("velocitychangewater") == null)
|
||||||
|
{
|
||||||
|
VelocityChangeWater = VelocityChange;
|
||||||
|
}
|
||||||
|
|
||||||
if (element.Attribute("angularvelocity") != null)
|
if (element.Attribute("angularvelocity") != null)
|
||||||
{
|
{
|
||||||
AngularVelocityMin = element.GetAttributeFloat("angularvelocity", 0.0f);
|
AngularVelocityMin = element.GetAttributeFloat("angularvelocity", 0.0f);
|
||||||
|
|||||||
@@ -28,25 +28,25 @@ namespace Barotrauma
|
|||||||
this.newGameContainer = newGameContainer;
|
this.newGameContainer = newGameContainer;
|
||||||
this.loadGameContainer = loadGameContainer;
|
this.loadGameContainer = loadGameContainer;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 0, 0, 30), "Selected submarine:", null, null, Alignment.Left, "", newGameContainer);
|
new GUITextBlock(new Rectangle(0, 0, 0, 30), TextManager.Get("SelectedSub") + ":", null, null, Alignment.Left, "", newGameContainer);
|
||||||
subList = new GUIListBox(new Rectangle(0, 30, 230, newGameContainer.Rect.Height - 100), "", newGameContainer);
|
subList = new GUIListBox(new Rectangle(0, 30, 230, newGameContainer.Rect.Height - 100), "", newGameContainer);
|
||||||
|
|
||||||
UpdateSubList();
|
UpdateSubList();
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle((int)(subList.Rect.Width + 20), 0, 100, 20),
|
new GUITextBlock(new Rectangle((int)(subList.Rect.Width + 20), 0, 100, 20),
|
||||||
"Save name: ", "", Alignment.Left, Alignment.Left, newGameContainer);
|
TextManager.Get("SaveName") + ": ", "", Alignment.Left, Alignment.Left, newGameContainer);
|
||||||
|
|
||||||
saveNameBox = new GUITextBox(new Rectangle((int)(subList.Rect.Width + 30), 30, 180, 20),
|
saveNameBox = new GUITextBox(new Rectangle((int)(subList.Rect.Width + 30), 30, 180, 20),
|
||||||
Alignment.TopLeft, "", newGameContainer);
|
Alignment.TopLeft, "", newGameContainer);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle((int)(subList.Rect.Width + 20), 60, 100, 20),
|
new GUITextBlock(new Rectangle((int)(subList.Rect.Width + 20), 60, 100, 20),
|
||||||
"Map Seed: ", "", Alignment.Left, Alignment.Left, newGameContainer);
|
TextManager.Get("MapSeed") + ": ", "", Alignment.Left, Alignment.Left, newGameContainer);
|
||||||
|
|
||||||
seedBox = new GUITextBox(new Rectangle((int)(subList.Rect.Width + 30), 90, 180, 20),
|
seedBox = new GUITextBox(new Rectangle((int)(subList.Rect.Width + 30), 90, 180, 20),
|
||||||
Alignment.TopLeft, "", newGameContainer);
|
Alignment.TopLeft, "", newGameContainer);
|
||||||
seedBox.Text = ToolBox.RandomSeed(8);
|
seedBox.Text = ToolBox.RandomSeed(8);
|
||||||
|
|
||||||
var startButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, "", newGameContainer);
|
var startButton = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("StartCampaignButton"), Alignment.BottomRight, "", newGameContainer);
|
||||||
startButton.OnClicked = (GUIButton btn, object userData) =>
|
startButton.OnClicked = (GUIButton btn, object userData) =>
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(saveNameBox.Text))
|
if (string.IsNullOrWhiteSpace(saveNameBox.Text))
|
||||||
@@ -58,10 +58,9 @@ namespace Barotrauma
|
|||||||
Submarine selectedSub = subList.SelectedData as Submarine;
|
Submarine selectedSub = subList.SelectedData as Submarine;
|
||||||
if (selectedSub != null && selectedSub.HasTag(SubmarineTag.Shuttle))
|
if (selectedSub != null && selectedSub.HasTag(SubmarineTag.Shuttle))
|
||||||
{
|
{
|
||||||
var msgBox = new GUIMessageBox("Shuttle selected",
|
var msgBox = new GUIMessageBox(TextManager.Get("ShuttleSelected"),
|
||||||
"Most shuttles are not adequately equipped to deal with the dangers of the Europan depths. " +
|
TextManager.Get("ShuttleWarning"),
|
||||||
"Are you sure you want to choose a shuttle as your vessel?",
|
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||||
new string[] { "Yes", "No" });
|
|
||||||
|
|
||||||
string savePath = SaveUtil.CreateSavePath(isMultiplayer ? SaveUtil.SaveType.Multiplayer : SaveUtil.SaveType.Singleplayer, saveNameBox.Text);
|
string savePath = SaveUtil.CreateSavePath(isMultiplayer ? SaveUtil.SaveType.Multiplayer : SaveUtil.SaveType.Singleplayer, saveNameBox.Text);
|
||||||
msgBox.Buttons[0].OnClicked = (button, obj) => { StartNewGame?.Invoke(selectedSub, savePath, seedBox.Text); return true; };
|
msgBox.Buttons[0].OnClicked = (button, obj) => { StartNewGame?.Invoke(selectedSub, savePath, seedBox.Text); return true; };
|
||||||
@@ -110,7 +109,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
textBlock.TextColor = textBlock.TextColor * 0.85f;
|
textBlock.TextColor = textBlock.TextColor * 0.85f;
|
||||||
|
|
||||||
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
|
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), TextManager.Get("Shuttle"), "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
|
||||||
shuttleText.TextColor = textBlock.TextColor * 0.8f;
|
shuttleText.TextColor = textBlock.TextColor * 0.8f;
|
||||||
shuttleText.ToolTip = textBlock.ToolTip;
|
shuttleText.ToolTip = textBlock.ToolTip;
|
||||||
}
|
}
|
||||||
@@ -140,7 +139,7 @@ namespace Barotrauma
|
|||||||
textBlock.UserData = saveFile;
|
textBlock.UserData = saveFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
loadGameButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.Right | Alignment.Bottom, "", loadGameContainer);
|
loadGameButton = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("LoadButton"), Alignment.Right | Alignment.Bottom, "", loadGameContainer);
|
||||||
loadGameButton.OnClicked = (btn, obj) =>
|
loadGameButton.OnClicked = (btn, obj) =>
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(saveList.SelectedData as string)) return false;
|
if (string.IsNullOrWhiteSpace(saveList.SelectedData as string)) return false;
|
||||||
@@ -176,16 +175,16 @@ namespace Barotrauma
|
|||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), Path.GetFileNameWithoutExtension(fileName), "", Alignment.TopLeft, Alignment.TopLeft, saveFileFrame, false, GUI.LargeFont);
|
new GUITextBlock(new Rectangle(0, 0, 0, 20), Path.GetFileNameWithoutExtension(fileName), "", Alignment.TopLeft, Alignment.TopLeft, saveFileFrame, false, GUI.LargeFont);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 35, 0, 20), "Submarine: ", "", saveFileFrame).Font = GUI.SmallFont;
|
new GUITextBlock(new Rectangle(0, 35, 0, 20), TextManager.Get("Submarine") + ":", "", saveFileFrame).Font = GUI.SmallFont;
|
||||||
new GUITextBlock(new Rectangle(15, 52, 0, 20), subName, "", saveFileFrame).Font = GUI.SmallFont;
|
new GUITextBlock(new Rectangle(15, 52, 0, 20), subName, "", saveFileFrame).Font = GUI.SmallFont;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 70, 0, 20), "Last saved: ", "", saveFileFrame).Font = GUI.SmallFont;
|
new GUITextBlock(new Rectangle(0, 70, 0, 20), TextManager.Get("LastSaved") + ":", "", saveFileFrame).Font = GUI.SmallFont;
|
||||||
new GUITextBlock(new Rectangle(15, 85, 0, 20), saveTime, "", saveFileFrame).Font = GUI.SmallFont;
|
new GUITextBlock(new Rectangle(15, 85, 0, 20), saveTime, "", saveFileFrame).Font = GUI.SmallFont;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 105, 0, 20), "Map seed: ", "", saveFileFrame).Font = GUI.SmallFont;
|
new GUITextBlock(new Rectangle(0, 105, 0, 20), TextManager.Get("MapSeed") + ":", "", saveFileFrame).Font = GUI.SmallFont;
|
||||||
new GUITextBlock(new Rectangle(15, 120, 0, 20), mapseed, "", saveFileFrame).Font = GUI.SmallFont;
|
new GUITextBlock(new Rectangle(15, 120, 0, 20), mapseed, "", saveFileFrame).Font = GUI.SmallFont;
|
||||||
|
|
||||||
var deleteSaveButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Delete", Alignment.BottomCenter, "", saveFileFrame);
|
var deleteSaveButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("Delete"), Alignment.BottomCenter, "", saveFileFrame);
|
||||||
deleteSaveButton.UserData = fileName;
|
deleteSaveButton.UserData = fileName;
|
||||||
deleteSaveButton.OnClicked = DeleteSave;
|
deleteSaveButton.OnClicked = DeleteSave;
|
||||||
|
|
||||||
|
|||||||
@@ -56,12 +56,12 @@ namespace Barotrauma
|
|||||||
|
|
||||||
int crewColumnWidth = Math.Min(300, (container.Rect.Width - 40) / 2);
|
int crewColumnWidth = Math.Min(300, (container.Rect.Width - 40) / 2);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 0, 100, 20), "Crew:", "", tabs[(int)Tab.Crew], GUI.LargeFont);
|
new GUITextBlock(new Rectangle(0, 0, 100, 20), TextManager.Get("Crew") + ":", "", tabs[(int)Tab.Crew], GUI.LargeFont);
|
||||||
characterList = new GUIListBox(new Rectangle(0, 40, crewColumnWidth, 0), "", tabs[(int)Tab.Crew]);
|
characterList = new GUIListBox(new Rectangle(0, 40, crewColumnWidth, 0), "", tabs[(int)Tab.Crew]);
|
||||||
characterList.OnSelected = SelectCharacter;
|
characterList.OnSelected = SelectCharacter;
|
||||||
|
|
||||||
hireList = new GUIListBox(new Rectangle(0, 40, 300, 0), "", Alignment.Right, tabs[(int)Tab.Crew]);
|
hireList = new GUIListBox(new Rectangle(0, 40, 300, 0), "", Alignment.Right, tabs[(int)Tab.Crew]);
|
||||||
new GUITextBlock(new Rectangle(0, 0, 300, 20), "Hire:", "", Alignment.Right, Alignment.Left, tabs[(int)Tab.Crew], false, GUI.LargeFont);
|
new GUITextBlock(new Rectangle(0, 0, 300, 20), TextManager.Get("Hire") + ":", "", Alignment.Right, Alignment.Left, tabs[(int)Tab.Crew], false, GUI.LargeFont);
|
||||||
hireList.OnSelected = SelectCharacter;
|
hireList.OnSelected = SelectCharacter;
|
||||||
|
|
||||||
//---------------------------------------
|
//---------------------------------------
|
||||||
@@ -71,7 +71,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (GameMain.Client == null)
|
if (GameMain.Client == null)
|
||||||
{
|
{
|
||||||
startButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start",
|
startButton = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("StartCampaignButton"),
|
||||||
Alignment.BottomRight, "", tabs[(int)Tab.Map]);
|
Alignment.BottomRight, "", tabs[(int)Tab.Map]);
|
||||||
startButton.OnClicked = (GUIButton btn, object obj) => { StartRound?.Invoke(); return true; };
|
startButton.OnClicked = (GUIButton btn, object obj) => { StartRound?.Invoke(); return true; };
|
||||||
startButton.Enabled = false;
|
startButton.Enabled = false;
|
||||||
@@ -132,7 +132,7 @@ namespace Barotrauma
|
|||||||
hireList.ClearChildren();
|
hireList.ClearChildren();
|
||||||
hireList.Enabled = false;
|
hireList.Enabled = false;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 0, 0, 0), "No-one available for hire", Color.Transparent, Color.LightGray, Alignment.Center, Alignment.Center, "", hireList);
|
new GUITextBlock(new Rectangle(0, 0, 0, 0), TextManager.Get("HireUnavailable"), Color.Transparent, Color.LightGray, Alignment.Center, Alignment.Center, "", hireList);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,8 +204,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
var mission = GameMain.GameSession.Map.SelectedConnection.Mission;
|
var mission = GameMain.GameSession.Map.SelectedConnection.Mission;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 20, 0, 20), "Mission: " + mission.Name, "", locationPanel);
|
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 20, 0, 20), TextManager.Get("Mission") + ": " + mission.Name, "", locationPanel);
|
||||||
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 40, 0, 20), "Reward: " + mission.Reward + " credits", "", locationPanel);
|
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 40, 0, 20), TextManager.Get("Reward") + ": " + mission.Reward + " " + TextManager.Get("Credits"), "", locationPanel);
|
||||||
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 70, 0, 0), mission.Description, "", Alignment.TopLeft, Alignment.TopLeft, locationPanel, true, GUI.SmallFont);
|
new GUITextBlock(new Rectangle(0, titleText.Rect.Height + 70, 0, 0), mission.Description, "", Alignment.TopLeft, Alignment.TopLeft, locationPanel, true, GUI.SmallFont);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -337,7 +337,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public string GetMoney()
|
public string GetMoney()
|
||||||
{
|
{
|
||||||
return "Money: " + ((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", campaign.Money)) + " credits";
|
return TextManager.Get("Credits") + ": " + ((GameMain.GameSession == null) ? "0" : string.Format(CultureInfo.InvariantCulture, "{0:N0}", campaign.Money));
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool SelectCharacter(GUIComponent component, object selection)
|
private bool SelectCharacter(GUIComponent component, object selection)
|
||||||
@@ -375,7 +375,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (component.Parent == hireList)
|
if (component.Parent == hireList)
|
||||||
{
|
{
|
||||||
GUIButton hireButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Hire", Alignment.BottomCenter, "", characterPreviewFrame);
|
GUIButton hireButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("HireButton"), Alignment.BottomCenter, "", characterPreviewFrame);
|
||||||
hireButton.Enabled = campaign.Money >= characterInfo.Salary;
|
hireButton.Enabled = campaign.Money >= characterInfo.Salary;
|
||||||
hireButton.UserData = characterInfo;
|
hireButton.UserData = characterInfo;
|
||||||
hireButton.OnClicked = HireCharacter;
|
hireButton.OnClicked = HireCharacter;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Content;
|
using Microsoft.Xna.Framework.Content;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
@@ -14,7 +14,7 @@ namespace Barotrauma
|
|||||||
readonly RenderTarget2D renderTargetBackground;
|
readonly RenderTarget2D renderTargetBackground;
|
||||||
readonly RenderTarget2D renderTarget;
|
readonly RenderTarget2D renderTarget;
|
||||||
readonly RenderTarget2D renderTargetWater;
|
readonly RenderTarget2D renderTargetWater;
|
||||||
readonly RenderTarget2D renderTargetAir;
|
readonly RenderTarget2D renderTargetFinal;
|
||||||
|
|
||||||
private Effect damageEffect;
|
private Effect damageEffect;
|
||||||
|
|
||||||
@@ -27,9 +27,9 @@ namespace Barotrauma
|
|||||||
cam.Translate(new Vector2(-10.0f, 50.0f));
|
cam.Translate(new Vector2(-10.0f, 50.0f));
|
||||||
|
|
||||||
renderTargetBackground = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
renderTargetBackground = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||||
renderTarget = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
renderTarget = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight, false, SurfaceFormat.Color, DepthFormat.None, 0, RenderTargetUsage.PreserveContents);
|
||||||
renderTargetWater = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
renderTargetWater = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||||
renderTargetAir = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
renderTargetFinal = new RenderTarget2D(graphics, GameMain.GraphicsWidth, GameMain.GraphicsHeight, false, SurfaceFormat.Color, DepthFormat.None);
|
||||||
|
|
||||||
|
|
||||||
#if LINUX
|
#if LINUX
|
||||||
@@ -97,7 +97,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void DrawMap(GraphicsDevice graphics, SpriteBatch spriteBatch)
|
public void DrawMap(GraphicsDevice graphics, SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
|
|
||||||
foreach (Submarine sub in Submarine.Loaded)
|
foreach (Submarine sub in Submarine.Loaded)
|
||||||
{
|
{
|
||||||
sub.UpdateTransform();
|
sub.UpdateTransform();
|
||||||
@@ -113,64 +112,54 @@ namespace Barotrauma
|
|||||||
GameMain.LightManager.UpdateObstructVision(graphics, spriteBatch, cam, Character.Controlled.CursorWorldPosition);
|
GameMain.LightManager.UpdateObstructVision(graphics, spriteBatch, cam, Character.Controlled.CursorWorldPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
//1. draw the background, characters and the parts of the submarine that are behind them
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
graphics.SetRenderTarget(renderTargetBackground);
|
graphics.SetRenderTarget(renderTargetBackground);
|
||||||
|
|
||||||
if (Level.Loaded == null)
|
if (Level.Loaded == null)
|
||||||
{
|
{
|
||||||
graphics.Clear(new Color(11, 18, 26, 255));
|
graphics.Clear(new Color(11, 18, 26, 255));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//graphics.Clear(new Color(255, 255, 255, 255));
|
||||||
Level.Loaded.DrawBack(graphics, spriteBatch, cam);
|
Level.Loaded.DrawBack(graphics, spriteBatch, cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
//draw structures that are in water and not part of any sub (e.g. ruins)
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, cam.Transform);
|
|
||||||
Submarine.DrawBack(spriteBatch, false, s => s is Structure && s.Submarine == null);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
//draw alpha blended particles that are in water and behind subs
|
//draw alpha blended particles that are in water and behind subs
|
||||||
#if LINUX
|
#if LINUX
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, null, DepthStencilState.None, null, null, cam.Transform);
|
||||||
#else
|
#else
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, cam.Transform);
|
||||||
#endif
|
#endif
|
||||||
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.AlphaBlend);
|
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.AlphaBlend);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
//draw additive particles that are in water and behind subs
|
//draw additive particles that are in water and behind subs
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.Default, null, null, cam.Transform);
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.None, null, null, cam.Transform);
|
||||||
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.Additive);
|
GameMain.ParticleManager.Draw(spriteBatch, true, false, Particles.ParticleBlendState.Additive);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, cam.Transform);
|
||||||
//draw submarine structures that are behind water
|
Submarine.DrawBack(spriteBatch, false, s => s is Structure && ((Structure)s).ResizeVertical && ((Structure)s).ResizeHorizontal);
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, cam.Transform);
|
foreach (Structure s in Structure.WallList)
|
||||||
Submarine.DrawBack(spriteBatch, false, s => s is Structure && s.Submarine != null);
|
{
|
||||||
|
if ((s.ResizeVertical != s.ResizeHorizontal) && s.CastShadow)
|
||||||
|
{
|
||||||
|
GUI.DrawRectangle(spriteBatch, new Vector2(s.DrawPosition.X-s.WorldRect.Width/2,-s.DrawPosition.Y-s.WorldRect.Height/2), new Vector2(s.WorldRect.Width, s.WorldRect.Height), Color.Black, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
graphics.SetRenderTarget(renderTarget);
|
graphics.SetRenderTarget(renderTarget);
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, null);
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred,
|
|
||||||
BlendState.Opaque);
|
|
||||||
spriteBatch.Draw(renderTargetBackground, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
spriteBatch.Draw(renderTargetBackground, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, DepthStencilState.None, null, null, cam.Transform);
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
|
||||||
BlendState.AlphaBlend,
|
|
||||||
null, null, null, null,
|
|
||||||
cam.Transform);
|
|
||||||
|
|
||||||
Submarine.DrawBack(spriteBatch, false, s => !(s is Structure));
|
Submarine.DrawBack(spriteBatch, false, s => !(s is Structure));
|
||||||
|
Submarine.DrawBack(spriteBatch, false, s => s is Structure && !(((Structure)s).ResizeVertical && ((Structure)s).ResizeHorizontal));
|
||||||
foreach (Character c in Character.CharacterList) c.Draw(spriteBatch);
|
foreach (Character c in Character.CharacterList) c.Draw(spriteBatch);
|
||||||
|
spriteBatch.End();
|
||||||
|
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, null, null, cam.Transform);
|
||||||
|
|
||||||
|
Submarine.DrawFront(spriteBatch, false, null);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
//draw the rendertarget and particles that are only supposed to be drawn in water into renderTargetWater
|
//draw the rendertarget and particles that are only supposed to be drawn in water into renderTargetWater
|
||||||
graphics.SetRenderTarget(renderTargetWater);
|
graphics.SetRenderTarget(renderTargetWater);
|
||||||
|
|
||||||
@@ -187,18 +176,7 @@ namespace Barotrauma
|
|||||||
GameMain.ParticleManager.Draw(spriteBatch, true, true, Particles.ParticleBlendState.AlphaBlend);
|
GameMain.ParticleManager.Draw(spriteBatch, true, true, Particles.ParticleBlendState.AlphaBlend);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
//draw additive particles that are inside a sub
|
graphics.SetRenderTarget(renderTarget);
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.Default, null, null, cam.Transform);
|
|
||||||
GameMain.ParticleManager.Draw(spriteBatch, true, true, Particles.ParticleBlendState.Additive);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
//draw the rendertarget and particles that are only supposed to be drawn in air into renderTargetAir
|
|
||||||
|
|
||||||
graphics.SetRenderTarget(renderTargetAir);
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque);
|
|
||||||
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
//draw alpha blended particles that are not in water
|
//draw alpha blended particles that are not in water
|
||||||
#if LINUX
|
#if LINUX
|
||||||
@@ -210,39 +188,11 @@ namespace Barotrauma
|
|||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
//draw additive particles that are not in water
|
//draw additive particles that are not in water
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.DepthRead, null, null, cam.Transform);
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.None, null, null, cam.Transform);
|
||||||
GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.Additive);
|
GameMain.ParticleManager.Draw(spriteBatch, false, null, Particles.ParticleBlendState.Additive);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
if (Character.Controlled != null && GameMain.LightManager.LosEnabled)
|
graphics.SetRenderTarget(renderTargetFinal);
|
||||||
{
|
|
||||||
graphics.SetRenderTarget(renderTarget);
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Deferred,
|
|
||||||
BlendState.Opaque, null, null, null, lightBlur.Effect);
|
|
||||||
|
|
||||||
spriteBatch.Draw(renderTargetBackground, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
|
||||||
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
|
||||||
BlendState.AlphaBlend, SamplerState.LinearWrap,
|
|
||||||
null, null, null,
|
|
||||||
cam.Transform);
|
|
||||||
|
|
||||||
Submarine.DrawDamageable(spriteBatch, null, false);
|
|
||||||
Submarine.DrawFront(spriteBatch, false, s => s is Structure);
|
|
||||||
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
graphics.SetRenderTarget(null);
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
//2. pass the renderTarget to the water shader to do the water effect
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Hull.renderer.RenderBack(spriteBatch, renderTargetWater);
|
Hull.renderer.RenderBack(spriteBatch, renderTargetWater);
|
||||||
|
|
||||||
Array.Clear(Hull.renderer.vertices, 0, Hull.renderer.vertices.Length);
|
Array.Clear(Hull.renderer.vertices, 0, Hull.renderer.vertices.Length);
|
||||||
@@ -252,58 +202,48 @@ namespace Barotrauma
|
|||||||
hull.Render(graphics, cam);
|
hull.Render(graphics, cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
Hull.renderer.Render(graphics, cam, renderTargetAir, Cam.ShaderTransform);
|
Hull.renderer.Render(graphics, cam, renderTarget, Cam.ShaderTransform);
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
//3. draw the sections of the map that are on top of the water
|
|
||||||
//----------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
|
||||||
BlendState.AlphaBlend, SamplerState.LinearWrap,
|
|
||||||
null, null, null,
|
|
||||||
cam.Transform);
|
|
||||||
|
|
||||||
Submarine.DrawFront(spriteBatch, false, null);
|
|
||||||
|
|
||||||
spriteBatch.End();
|
|
||||||
|
|
||||||
spriteBatch.Begin(SpriteSortMode.Immediate,
|
spriteBatch.Begin(SpriteSortMode.Immediate,
|
||||||
BlendState.NonPremultiplied, SamplerState.LinearWrap,
|
BlendState.NonPremultiplied, SamplerState.LinearWrap,
|
||||||
null, null,
|
null, null,
|
||||||
damageEffect,
|
damageEffect,
|
||||||
cam.Transform);
|
cam.Transform);
|
||||||
|
|
||||||
Submarine.DrawDamageable(spriteBatch, damageEffect, false);
|
Submarine.DrawDamageable(spriteBatch, damageEffect, false);
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
GameMain.LightManager.DrawLightMap(spriteBatch, lightBlur.Effect);
|
//draw additive particles that are inside a sub
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, DepthStencilState.Default, null, null, cam.Transform);
|
||||||
spriteBatch.Begin(SpriteSortMode.BackToFront,
|
GameMain.ParticleManager.Draw(spriteBatch, true, true, Particles.ParticleBlendState.Additive);
|
||||||
BlendState.AlphaBlend, SamplerState.LinearWrap,
|
|
||||||
null, null, null,
|
|
||||||
cam.Transform);
|
|
||||||
|
|
||||||
if (Level.Loaded != null) Level.Loaded.DrawFront(spriteBatch);
|
|
||||||
|
|
||||||
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch, cam);
|
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
if (GameMain.LightManager.LightingEnabled)
|
||||||
if (Character.Controlled != null && GameMain.LightManager.LosEnabled)
|
|
||||||
{
|
{
|
||||||
GameMain.LightManager.DrawLOS(spriteBatch, lightBlur.Effect, false);
|
spriteBatch.Begin(SpriteSortMode.Deferred, Lights.CustomBlendStates.Multiplicative, null, DepthStencilState.None, null, null, null);
|
||||||
|
spriteBatch.Draw(GameMain.LightManager.lightMap, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||||
spriteBatch.Begin(SpriteSortMode.Immediate,
|
|
||||||
BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, RasterizerState.CullNone, null);
|
|
||||||
|
|
||||||
float r = Math.Min(CharacterHUD.damageOverlayTimer * 0.5f, 0.5f);
|
|
||||||
spriteBatch.Draw(renderTarget, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
|
||||||
Color.Lerp(GameMain.LightManager.AmbientLight * 0.5f, Color.Red, r));
|
|
||||||
|
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearWrap, DepthStencilState.None, null, null, cam.Transform);
|
||||||
|
foreach (Character c in Character.CharacterList) c.DrawFront(spriteBatch, cam);
|
||||||
|
|
||||||
|
if (Level.Loaded != null) Level.Loaded.DrawFront(spriteBatch);
|
||||||
|
spriteBatch.End();
|
||||||
|
|
||||||
|
graphics.SetRenderTarget(null);
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Opaque, SamplerState.PointClamp, DepthStencilState.None, null, null, null);
|
||||||
|
if (GameMain.LightManager.LosEnabled && Character.Controlled!=null)
|
||||||
|
{
|
||||||
|
float r = Math.Min(CharacterHUD.damageOverlayTimer * 0.5f, 0.5f);
|
||||||
|
spriteBatch.Draw(renderTargetBackground, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight),
|
||||||
|
Color.Lerp(GameMain.LightManager.AmbientLight * 0.5f, Color.Red, r));
|
||||||
|
spriteBatch.End();
|
||||||
|
GameMain.LightManager.losEffect.CurrentTechnique = GameMain.LightManager.losEffect.Techniques["LosShader"];
|
||||||
|
GameMain.LightManager.losEffect.Parameters["xTexture"].SetValue(renderTargetFinal);
|
||||||
|
GameMain.LightManager.losEffect.Parameters["xLosTexture"].SetValue(GameMain.LightManager.losTexture);
|
||||||
|
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, null, GameMain.LightManager.losEffect, null);
|
||||||
|
}
|
||||||
|
spriteBatch.Draw(renderTargetFinal, new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.White);
|
||||||
|
spriteBatch.End();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,16 +44,16 @@ namespace Barotrauma
|
|||||||
Alignment.BottomLeft, Alignment.BottomLeft, topPanel);
|
Alignment.BottomLeft, Alignment.BottomLeft, topPanel);
|
||||||
moneyText.TextGetter = GetMoney;
|
moneyText.TextGetter = GetMoney;
|
||||||
|
|
||||||
GUIButton button = new GUIButton(new Rectangle(-240, 0, 100, 30), "Map", null, Alignment.BottomRight, "", topPanel);
|
GUIButton button = new GUIButton(new Rectangle(-240, 0, 100, 30), TextManager.Get("Map"), null, Alignment.BottomRight, "", topPanel);
|
||||||
button.UserData = CampaignUI.Tab.Map;
|
button.UserData = CampaignUI.Tab.Map;
|
||||||
button.OnClicked = SelectTab;
|
button.OnClicked = SelectTab;
|
||||||
SelectTab(button, button.UserData);
|
SelectTab(button, button.UserData);
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(-120, 0, 100, 30), "Crew", null, Alignment.BottomRight, "", topPanel);
|
button = new GUIButton(new Rectangle(-120, 0, 100, 30), TextManager.Get("Crew"), null, Alignment.BottomRight, "", topPanel);
|
||||||
button.UserData = CampaignUI.Tab.Crew;
|
button.UserData = CampaignUI.Tab.Crew;
|
||||||
button.OnClicked = SelectTab;
|
button.OnClicked = SelectTab;
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(0, 0, 100, 30), "Store", null, Alignment.BottomRight, "", topPanel);
|
button = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("Store"), null, Alignment.BottomRight, "", topPanel);
|
||||||
button.UserData = CampaignUI.Tab.Store;
|
button.UserData = CampaignUI.Tab.Store;
|
||||||
button.OnClicked = SelectTab;
|
button.OnClicked = SelectTab;
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
locationTitle.Text = "Location: " + campaign.Map.CurrentLocation.Name;
|
locationTitle.Text = TextManager.Get("Location") + ": " + campaign.Map.CurrentLocation.Name;
|
||||||
|
|
||||||
bottomPanel.ClearChildren();
|
bottomPanel.ClearChildren();
|
||||||
campaignUI = new CampaignUI(campaign, bottomPanel);
|
campaignUI = new CampaignUI(campaign, bottomPanel);
|
||||||
|
|||||||
@@ -38,41 +38,41 @@ namespace Barotrauma
|
|||||||
290, y,
|
290, y,
|
||||||
500, 360);
|
500, 360);
|
||||||
|
|
||||||
GUIButton button = new GUIButton(new Rectangle(50, y, 200, 30), "Tutorial", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
GUIButton button = new GUIButton(new Rectangle(50, y, 200, 30), TextManager.Get("TutorialButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||||
|
|
||||||
button.Color = button.Color * 0.8f;
|
button.Color = button.Color * 0.8f;
|
||||||
button.OnClicked = TutorialButtonClicked;
|
button.OnClicked = TutorialButtonClicked;
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(50, y + 60, 200, 30), "New Game", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
button = new GUIButton(new Rectangle(50, y + 60, 200, 30), TextManager.Get("NewGameButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||||
button.Color = button.Color * 0.8f;
|
button.Color = button.Color * 0.8f;
|
||||||
button.UserData = Tab.NewGame;
|
button.UserData = Tab.NewGame;
|
||||||
button.OnClicked = SelectTab;
|
button.OnClicked = SelectTab;
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(50, y + 100, 200, 30), "Load Game", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
button = new GUIButton(new Rectangle(50, y + 100, 200, 30), TextManager.Get("LoadGameButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||||
button.Color = button.Color * 0.8f;
|
button.Color = button.Color * 0.8f;
|
||||||
button.UserData = Tab.LoadGame;
|
button.UserData = Tab.LoadGame;
|
||||||
button.OnClicked = SelectTab;
|
button.OnClicked = SelectTab;
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(50, y + 160, 200, 30), "Join Server", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
button = new GUIButton(new Rectangle(50, y + 160, 200, 30), TextManager.Get("JoinServerButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||||
button.Color = button.Color * 0.8f;
|
button.Color = button.Color * 0.8f;
|
||||||
//button.UserData = (int)Tabs.JoinServer;
|
//button.UserData = (int)Tabs.JoinServer;
|
||||||
button.OnClicked = JoinServerClicked;
|
button.OnClicked = JoinServerClicked;
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(50, y + 200, 200, 30), "Host Server", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
button = new GUIButton(new Rectangle(50, y + 200, 200, 30), TextManager.Get("HostServerButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||||
button.Color = button.Color * 0.8f;
|
button.Color = button.Color * 0.8f;
|
||||||
button.UserData = Tab.HostServer;
|
button.UserData = Tab.HostServer;
|
||||||
button.OnClicked = SelectTab;
|
button.OnClicked = SelectTab;
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(50, y + 260, 200, 30), "Submarine Editor", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
button = new GUIButton(new Rectangle(50, y + 260, 200, 30), TextManager.Get("SubEditorButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||||
button.Color = button.Color * 0.8f;
|
button.Color = button.Color * 0.8f;
|
||||||
button.OnClicked = (GUIButton btn, object userdata) => { GameMain.SubEditorScreen.Select(); return true; };
|
button.OnClicked = (GUIButton btn, object userdata) => { GameMain.SubEditorScreen.Select(); return true; };
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(50, y + 320, 200, 30), "Settings", null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
button = new GUIButton(new Rectangle(50, y + 320, 200, 30), TextManager.Get("SettingsButton"), null, Alignment.TopLeft, Alignment.Left, "", buttonsTab);
|
||||||
button.Color = button.Color * 0.8f;
|
button.Color = button.Color * 0.8f;
|
||||||
button.UserData = Tab.Settings;
|
button.UserData = Tab.Settings;
|
||||||
button.OnClicked = SelectTab;
|
button.OnClicked = SelectTab;
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(0, 0, 150, 30), "Quit", Alignment.BottomRight, "", buttonsTab);
|
button = new GUIButton(new Rectangle(0, 0, 150, 30), TextManager.Get("QuitButton"), Alignment.BottomRight, "", buttonsTab);
|
||||||
button.Color = button.Color * 0.8f;
|
button.Color = button.Color * 0.8f;
|
||||||
button.OnClicked = QuitClicked;
|
button.OnClicked = QuitClicked;
|
||||||
|
|
||||||
@@ -93,15 +93,15 @@ namespace Barotrauma
|
|||||||
|
|
||||||
menuTabs[(int)Tab.HostServer] = new GUIFrame(panelRect, "");
|
menuTabs[(int)Tab.HostServer] = new GUIFrame(panelRect, "");
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 0, 100, 30), "Server Name:", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
new GUITextBlock(new Rectangle(0, 0, 100, 30), TextManager.Get("ServerName"), "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||||
serverNameBox = new GUITextBox(new Rectangle(160, 0, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
|
serverNameBox = new GUITextBox(new Rectangle(160, 0, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 50, 100, 30), "Server port:", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
new GUITextBlock(new Rectangle(0, 50, 100, 30), TextManager.Get("ServerPort"), "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||||
portBox = new GUITextBox(new Rectangle(160, 50, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
|
portBox = new GUITextBox(new Rectangle(160, 50, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
|
||||||
portBox.Text = NetConfig.DefaultPort.ToString();
|
portBox.Text = NetConfig.DefaultPort.ToString();
|
||||||
portBox.ToolTip = "Server port";
|
portBox.ToolTip = "Server port";
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 100, 100, 30), "Max players:", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
new GUITextBlock(new Rectangle(0, 100, 100, 30), TextManager.Get("MaxPlayers"), "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||||
maxPlayersBox = new GUITextBox(new Rectangle(195, 100, 30, 30), null, null, Alignment.TopLeft, Alignment.Center, "", menuTabs[(int)Tab.HostServer]);
|
maxPlayersBox = new GUITextBox(new Rectangle(195, 100, 30, 30), null, null, Alignment.TopLeft, Alignment.Center, "", menuTabs[(int)Tab.HostServer]);
|
||||||
maxPlayersBox.Text = "8";
|
maxPlayersBox.Text = "8";
|
||||||
maxPlayersBox.Enabled = false;
|
maxPlayersBox.Enabled = false;
|
||||||
@@ -114,19 +114,16 @@ namespace Barotrauma
|
|||||||
plusPlayersBox.UserData = 1;
|
plusPlayersBox.UserData = 1;
|
||||||
plusPlayersBox.OnClicked = ChangeMaxPlayers;
|
plusPlayersBox.OnClicked = ChangeMaxPlayers;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 150, 100, 30), "Password (optional):", "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
new GUITextBlock(new Rectangle(0, 150, 100, 30), TextManager.Get("Password"), "", Alignment.TopLeft, Alignment.Left, menuTabs[(int)Tab.HostServer]);
|
||||||
passwordBox = new GUITextBox(new Rectangle(160, 150, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
|
passwordBox = new GUITextBox(new Rectangle(160, 150, 200, 30), null, null, Alignment.TopLeft, Alignment.Left, "", menuTabs[(int)Tab.HostServer]);
|
||||||
|
|
||||||
isPublicBox = new GUITickBox(new Rectangle(10, 200, 20, 20), "Public server", Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
|
isPublicBox = new GUITickBox(new Rectangle(10, 200, 20, 20), TextManager.Get("PublicServer"), Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
|
||||||
isPublicBox.ToolTip = "Public servers are shown in the list of available servers in the \"Join Server\" -tab";
|
isPublicBox.ToolTip = TextManager.Get("PublicServerToolTip");
|
||||||
|
|
||||||
|
useUpnpBox = new GUITickBox(new Rectangle(10, 250, 20, 20), TextManager.Get("AttemptUPnP"), Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
|
||||||
|
useUpnpBox.ToolTip = TextManager.Get("AttemptUPnPToolTip");
|
||||||
|
|
||||||
useUpnpBox = new GUITickBox(new Rectangle(10, 250, 20, 20), "Attempt UPnP port forwarding", Alignment.TopLeft, menuTabs[(int)Tab.HostServer]);
|
GUIButton hostButton = new GUIButton(new Rectangle(0, 0, 100, 30), TextManager.Get("StartServerButton"), Alignment.BottomRight, "", menuTabs[(int)Tab.HostServer]);
|
||||||
useUpnpBox.ToolTip = "UPnP can be used for forwarding ports on your router to allow players join the server."
|
|
||||||
+ " However, UPnP isn't supported by all routers, so you may need to setup port forwards manually"
|
|
||||||
+" if players are unable to join the server (see the readme for instructions).";
|
|
||||||
|
|
||||||
GUIButton hostButton = new GUIButton(new Rectangle(0, 0, 100, 30), "Start", Alignment.BottomRight, "", menuTabs[(int)Tab.HostServer]);
|
|
||||||
hostButton.OnClicked = HostServerClicked;
|
hostButton.OnClicked = HostServerClicked;
|
||||||
|
|
||||||
this.game = game;
|
this.game = game;
|
||||||
@@ -179,8 +176,10 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (GameMain.Config.UnsavedSettings)
|
if (GameMain.Config.UnsavedSettings)
|
||||||
{
|
{
|
||||||
var applyBox = new GUIMessageBox("Apply changes?", "Do you want to apply the settings or discard the changes?",
|
var applyBox = new GUIMessageBox(
|
||||||
new string[] {"Apply", "Discard"});
|
TextManager.Get("ApplySettingsLabel"),
|
||||||
|
TextManager.Get("ApplySettingsQuestion"),
|
||||||
|
new string[] { TextManager.Get("ApplySettingsYes"), TextManager.Get("ApplySettingsNo") });
|
||||||
applyBox.Buttons[0].OnClicked += applyBox.Close;
|
applyBox.Buttons[0].OnClicked += applyBox.Close;
|
||||||
applyBox.Buttons[0].OnClicked += ApplySettings;
|
applyBox.Buttons[0].OnClicked += ApplySettings;
|
||||||
applyBox.Buttons[0].UserData = tab;
|
applyBox.Buttons[0].UserData = tab;
|
||||||
@@ -216,7 +215,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
|
if (GameMain.GraphicsWidth != GameMain.Config.GraphicsWidth || GameMain.GraphicsHeight != GameMain.Config.GraphicsHeight)
|
||||||
{
|
{
|
||||||
new GUIMessageBox("Restart required", "You need to restart the game for the resolution changes to take effect.");
|
new GUIMessageBox(
|
||||||
|
TextManager.Get("RestartRequiredLabel"),
|
||||||
|
TextManager.Get("RestartRequiredText"));
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -354,7 +355,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (selectedSub == null)
|
if (selectedSub == null)
|
||||||
{
|
{
|
||||||
new GUIMessageBox("Submarine not selected", "Please select a submarine");
|
new GUIMessageBox(TextManager.Get("SubNotSelected"), TextManager.Get("SelectSubRequest"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -186,11 +186,11 @@ namespace Barotrauma
|
|||||||
if (GameMain.Server != null)
|
if (GameMain.Server != null)
|
||||||
{
|
{
|
||||||
if (!GameMain.Server.AutoRestart || GameMain.Server.ConnectedClients.Count == 0) return "";
|
if (!GameMain.Server.AutoRestart || GameMain.Server.ConnectedClients.Count == 0) return "";
|
||||||
return "Restarting in " + ToolBox.SecondsToReadableTime(Math.Max(GameMain.Server.AutoRestartTimer, 0));
|
return TextManager.Get("RestartingIn") + " " + ToolBox.SecondsToReadableTime(Math.Max(GameMain.Server.AutoRestartTimer, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autoRestartTimer == 0.0f) return "";
|
if (autoRestartTimer == 0.0f) return "";
|
||||||
return "Restarting in " + ToolBox.SecondsToReadableTime(Math.Max(autoRestartTimer, 0));
|
return TextManager.Get("RestartingIn") + " " + ToolBox.SecondsToReadableTime(Math.Max(autoRestartTimer, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetLobbyScreen()
|
public NetLobbyScreen()
|
||||||
@@ -251,11 +251,11 @@ namespace Barotrauma
|
|||||||
int columnWidth = infoFrame.Rect.Width / 3 - 5;
|
int columnWidth = infoFrame.Rect.Width / 3 - 5;
|
||||||
int columnX = 0;
|
int columnX = 0;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(columnX, 110, columnWidth, 30), "Submarine:", "", defaultModeContainer);
|
new GUITextBlock(new Rectangle(columnX, 110, columnWidth, 30), TextManager.Get("Submarine"), "", defaultModeContainer);
|
||||||
subList = new GUIListBox(new Rectangle(columnX, 140, columnWidth, defaultModeContainer.Rect.Height - 170), Color.White, "", defaultModeContainer);
|
subList = new GUIListBox(new Rectangle(columnX, 140, columnWidth, defaultModeContainer.Rect.Height - 170), Color.White, "", defaultModeContainer);
|
||||||
subList.OnSelected = VotableClicked;
|
subList.OnSelected = VotableClicked;
|
||||||
|
|
||||||
var voteText = new GUITextBlock(new Rectangle(columnX, 110, columnWidth, 30), "Votes: ", "", Alignment.TopLeft, Alignment.TopRight, defaultModeContainer);
|
var voteText = new GUITextBlock(new Rectangle(columnX, 110, columnWidth, 30), TextManager.Get("Votes"), "", Alignment.TopLeft, Alignment.TopRight, defaultModeContainer);
|
||||||
voteText.UserData = "subvotes";
|
voteText.UserData = "subvotes";
|
||||||
voteText.Visible = false;
|
voteText.Visible = false;
|
||||||
|
|
||||||
@@ -264,7 +264,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//respawn shuttle ------------------------------------------------------------------
|
//respawn shuttle ------------------------------------------------------------------
|
||||||
|
|
||||||
shuttleTickBox = new GUITickBox(new Rectangle(columnX, 110, 20, 20), "Respawn shuttle:",Alignment.Left, defaultModeContainer);
|
shuttleTickBox = new GUITickBox(new Rectangle(columnX, 110, 20, 20), TextManager.Get("RespawnShuttle"), Alignment.Left, defaultModeContainer);
|
||||||
shuttleList = new GUIDropDown(new Rectangle(columnX, 140, 200, 20), "", "", defaultModeContainer);
|
shuttleList = new GUIDropDown(new Rectangle(columnX, 140, 200, 20), "", "", defaultModeContainer);
|
||||||
shuttleTickBox.Selected = true;
|
shuttleTickBox.Selected = true;
|
||||||
shuttleTickBox.OnSelected = (GUITickBox box) =>
|
shuttleTickBox.OnSelected = (GUITickBox box) =>
|
||||||
@@ -276,11 +276,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//gamemode ------------------------------------------------------------------
|
//gamemode ------------------------------------------------------------------
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(columnX, 170, 0, 30), "Game mode: ", "", defaultModeContainer);
|
new GUITextBlock(new Rectangle(columnX, 170, 0, 30), TextManager.Get("GameMode"), "", defaultModeContainer);
|
||||||
modeList = new GUIListBox(new Rectangle(columnX, 200, columnWidth, defaultModeContainer.Rect.Height - 230), "", defaultModeContainer);
|
modeList = new GUIListBox(new Rectangle(columnX, 200, columnWidth, defaultModeContainer.Rect.Height - 230), "", defaultModeContainer);
|
||||||
modeList.OnSelected = VotableClicked;
|
modeList.OnSelected = VotableClicked;
|
||||||
|
|
||||||
voteText = new GUITextBlock(new Rectangle(columnX, 170, columnWidth, 30), "Votes: ", "", Alignment.TopLeft, Alignment.TopRight, defaultModeContainer);
|
voteText = new GUITextBlock(new Rectangle(columnX, 170, columnWidth, 30), TextManager.Get("Votes"), "", Alignment.TopLeft, Alignment.TopRight, defaultModeContainer);
|
||||||
voteText.UserData = "modevotes";
|
voteText.UserData = "modevotes";
|
||||||
voteText.Visible = false;
|
voteText.Visible = false;
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//mission type ------------------------------------------------------------------
|
//mission type ------------------------------------------------------------------
|
||||||
|
|
||||||
missionTypeBlock = new GUITextBlock(new Rectangle(columnX, -10, 300, 20), "Mission type:", "", Alignment.BottomLeft, Alignment.CenterLeft, defaultModeContainer);
|
missionTypeBlock = new GUITextBlock(new Rectangle(columnX, -10, 300, 20), TextManager.Get("MissionType"), "", Alignment.BottomLeft, Alignment.CenterLeft, defaultModeContainer);
|
||||||
missionTypeBlock.Padding = Vector4.Zero;
|
missionTypeBlock.Padding = Vector4.Zero;
|
||||||
missionTypeBlock.UserData = 0;
|
missionTypeBlock.UserData = 0;
|
||||||
|
|
||||||
@@ -309,7 +309,7 @@ namespace Barotrauma
|
|||||||
missionTypeButtons[0] = new GUIButton(new Rectangle(100, 0, 20, 20), "<", Alignment.BottomLeft, "", missionTypeBlock);
|
missionTypeButtons[0] = new GUIButton(new Rectangle(100, 0, 20, 20), "<", Alignment.BottomLeft, "", missionTypeBlock);
|
||||||
missionTypeButtons[0].UserData = -1;
|
missionTypeButtons[0].UserData = -1;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(120, 0, 80, 20), "Random", "", Alignment.BottomLeft, Alignment.Center, missionTypeBlock).UserData = 0;
|
new GUITextBlock(new Rectangle(120, 0, 80, 20), TextManager.Get("Random"), "", Alignment.BottomLeft, Alignment.Center, missionTypeBlock).UserData = 0;
|
||||||
|
|
||||||
missionTypeButtons[1] = new GUIButton(new Rectangle(200, 0, 20, 20), ">", Alignment.BottomLeft, "", missionTypeBlock);
|
missionTypeButtons[1] = new GUIButton(new Rectangle(200, 0, 20, 20), ">", Alignment.BottomLeft, "", missionTypeBlock);
|
||||||
missionTypeButtons[1].UserData = 1;
|
missionTypeButtons[1].UserData = 1;
|
||||||
@@ -332,7 +332,7 @@ namespace Barotrauma
|
|||||||
//seed ------------------------------------------------------------------
|
//seed ------------------------------------------------------------------
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(columnX, 110, 180, 20),
|
new GUITextBlock(new Rectangle(columnX, 110, 180, 20),
|
||||||
"Level Seed: ", "", Alignment.Left, Alignment.TopLeft, defaultModeContainer);
|
TextManager.Get("LevelSeed"), "", Alignment.Left, Alignment.TopLeft, defaultModeContainer);
|
||||||
|
|
||||||
seedBox = new GUITextBox(new Rectangle(columnX, 140, columnWidth / 2, 20),
|
seedBox = new GUITextBox(new Rectangle(columnX, 140, columnWidth / 2, 20),
|
||||||
Alignment.TopLeft, "", defaultModeContainer);
|
Alignment.TopLeft, "", defaultModeContainer);
|
||||||
@@ -341,14 +341,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//traitor probability ------------------------------------------------------------------
|
//traitor probability ------------------------------------------------------------------
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(columnX, 170, 20, 20), "Traitors:", "", defaultModeContainer);
|
new GUITextBlock(new Rectangle(columnX, 170, 20, 20), TextManager.Get("Traitors"), "", defaultModeContainer);
|
||||||
|
|
||||||
traitorProbabilityButtons = new GUIButton[2];
|
traitorProbabilityButtons = new GUIButton[2];
|
||||||
|
|
||||||
traitorProbabilityButtons[0] = new GUIButton(new Rectangle(columnX, 195, 20, 20), "<", "", defaultModeContainer);
|
traitorProbabilityButtons[0] = new GUIButton(new Rectangle(columnX, 195, 20, 20), "<", "", defaultModeContainer);
|
||||||
traitorProbabilityButtons[0].UserData = -1;
|
traitorProbabilityButtons[0].UserData = -1;
|
||||||
|
|
||||||
traitorProbabilityText = new GUITextBlock(new Rectangle(columnX + 20, 195, 80, 20), "No", null, null, Alignment.Center, "", defaultModeContainer);
|
traitorProbabilityText = new GUITextBlock(new Rectangle(columnX + 20, 195, 80, 20), TextManager.Get("No"), null, null, Alignment.Center, "", defaultModeContainer);
|
||||||
|
|
||||||
traitorProbabilityButtons[1] = new GUIButton(new Rectangle(columnX + 100, 195, 20, 20), ">", "", defaultModeContainer);
|
traitorProbabilityButtons[1] = new GUIButton(new Rectangle(columnX + 100, 195, 20, 20), ">", "", defaultModeContainer);
|
||||||
traitorProbabilityButtons[1].UserData = 1;
|
traitorProbabilityButtons[1].UserData = 1;
|
||||||
@@ -356,7 +356,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
//automatic restart ------------------------------------------------------------------
|
//automatic restart ------------------------------------------------------------------
|
||||||
|
|
||||||
autoRestartBox = new GUITickBox(new Rectangle(columnX, 230, 20, 20), "Automatic restart", Alignment.TopLeft, defaultModeContainer);
|
autoRestartBox = new GUITickBox(new Rectangle(columnX, 230, 20, 20), TextManager.Get("AutoRestart"), Alignment.TopLeft, defaultModeContainer);
|
||||||
autoRestartBox.OnSelected = ToggleAutoRestart;
|
autoRestartBox.OnSelected = ToggleAutoRestart;
|
||||||
|
|
||||||
var restartText = new GUITextBlock(new Rectangle(columnX, 255, 20, 20), "", "", defaultModeContainer);
|
var restartText = new GUITextBlock(new Rectangle(columnX, 255, 20, 20), "", "", defaultModeContainer);
|
||||||
@@ -374,7 +374,7 @@ namespace Barotrauma
|
|||||||
serverMessage.Wrap = true;
|
serverMessage.Wrap = true;
|
||||||
serverMessage.OnTextChanged = UpdateServerMessage;
|
serverMessage.OnTextChanged = UpdateServerMessage;
|
||||||
|
|
||||||
var showLogButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Server Log", Alignment.TopRight, "", infoFrame);
|
var showLogButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("ServerLog"), Alignment.TopRight, "", infoFrame);
|
||||||
showLogButton.UserData = "showlog";
|
showLogButton.UserData = "showlog";
|
||||||
showLogButton.OnClicked = (GUIButton button, object userData) =>
|
showLogButton.OnClicked = (GUIButton button, object userData) =>
|
||||||
{
|
{
|
||||||
@@ -436,13 +436,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
InfoFrame.FindChild("showlog").Visible = GameMain.Server != null;
|
InfoFrame.FindChild("showlog").Visible = GameMain.Server != null;
|
||||||
|
|
||||||
campaignViewButton = new GUIButton(new Rectangle(-80, 0, 120, 30), "Campaign view", Alignment.BottomRight, "", defaultModeContainer);
|
campaignViewButton = new GUIButton(new Rectangle(-80, 0, 120, 30), TextManager.Get("CampaignView"), Alignment.BottomRight, "", defaultModeContainer);
|
||||||
campaignViewButton.OnClicked = (btn, obj) => { ToggleCampaignView(true); return true; };
|
campaignViewButton.OnClicked = (btn, obj) => { ToggleCampaignView(true); return true; };
|
||||||
campaignViewButton.Visible = false;
|
campaignViewButton.Visible = false;
|
||||||
|
|
||||||
if (myPlayerFrame.children.Find(c => c.UserData as string == "playyourself") == null)
|
if (myPlayerFrame.children.Find(c => c.UserData as string == "playyourself") == null)
|
||||||
{
|
{
|
||||||
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), TextManager.Get("PlayYourself"), Alignment.TopLeft, myPlayerFrame);
|
||||||
playYourself.Selected = GameMain.NetworkMember.CharacterInfo != null;
|
playYourself.Selected = GameMain.NetworkMember.CharacterInfo != null;
|
||||||
playYourself.OnSelected = TogglePlayYourself;
|
playYourself.OnSelected = TogglePlayYourself;
|
||||||
playYourself.UserData = "playyourself";
|
playYourself.UserData = "playyourself";
|
||||||
@@ -476,10 +476,10 @@ namespace Barotrauma
|
|||||||
missionTypeButtons[0].OnClicked = ToggleMissionType;
|
missionTypeButtons[0].OnClicked = ToggleMissionType;
|
||||||
missionTypeButtons[1].OnClicked = ToggleMissionType;
|
missionTypeButtons[1].OnClicked = ToggleMissionType;
|
||||||
|
|
||||||
StartButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Start", Alignment.BottomRight, "", defaultModeContainer);
|
StartButton = new GUIButton(new Rectangle(0, 0, 80, 30), TextManager.Get("StartGameButton"), Alignment.BottomRight, "", defaultModeContainer);
|
||||||
StartButton.OnClicked = GameMain.Server.StartGameClicked;
|
StartButton.OnClicked = GameMain.Server.StartGameClicked;
|
||||||
|
|
||||||
GUIButton settingsButton = new GUIButton(new Rectangle(-110, 0, 80, 20), "Settings", Alignment.TopRight, "", infoFrame);
|
GUIButton settingsButton = new GUIButton(new Rectangle(-110, 0, 80, 20), TextManager.Get("ServerSettingsButton"), Alignment.TopRight, "", infoFrame);
|
||||||
settingsButton.OnClicked = GameMain.Server.ToggleSettingsFrame;
|
settingsButton.OnClicked = GameMain.Server.ToggleSettingsFrame;
|
||||||
settingsButton.UserData = "settingsButton";
|
settingsButton.UserData = "settingsButton";
|
||||||
|
|
||||||
@@ -513,7 +513,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (GameMain.Client.GameStarted)
|
if (GameMain.Client.GameStarted)
|
||||||
{
|
{
|
||||||
GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Spectate", Alignment.BottomRight, "", infoFrame);
|
GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), TextManager.Get("SpectateButton"), Alignment.BottomRight, "", infoFrame);
|
||||||
spectateButton.OnClicked = GameMain.Client.SpectateClicked;
|
spectateButton.OnClicked = GameMain.Client.SpectateClicked;
|
||||||
spectateButton.UserData = "spectateButton";
|
spectateButton.UserData = "spectateButton";
|
||||||
}
|
}
|
||||||
@@ -532,7 +532,7 @@ namespace Barotrauma
|
|||||||
if (GameMain.Client == null) return;
|
if (GameMain.Client == null) return;
|
||||||
|
|
||||||
infoFrame.RemoveChild(infoFrame.children.Find(c => c.UserData as string == "spectateButton"));
|
infoFrame.RemoveChild(infoFrame.children.Find(c => c.UserData as string == "spectateButton"));
|
||||||
GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), "Spectate", Alignment.BottomRight, "", infoFrame);
|
GUIButton spectateButton = new GUIButton(new Rectangle(0, 0, 80, 30), TextManager.Get("SpectateButton"), Alignment.BottomRight, "", infoFrame);
|
||||||
spectateButton.OnClicked = GameMain.Client.SpectateClicked;
|
spectateButton.OnClicked = GameMain.Client.SpectateClicked;
|
||||||
spectateButton.UserData = "spectateButton";
|
spectateButton.UserData = "spectateButton";
|
||||||
}
|
}
|
||||||
@@ -543,7 +543,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
myPlayerFrame.ClearChildren();
|
myPlayerFrame.ClearChildren();
|
||||||
|
|
||||||
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), TextManager.Get("PlayYourself"), Alignment.TopLeft, myPlayerFrame);
|
||||||
playYourself.Selected = GameMain.NetworkMember.CharacterInfo != null;
|
playYourself.Selected = GameMain.NetworkMember.CharacterInfo != null;
|
||||||
playYourself.OnSelected = TogglePlayYourself;
|
playYourself.OnSelected = TogglePlayYourself;
|
||||||
playYourself.UserData = "playyourself";
|
playYourself.UserData = "playyourself";
|
||||||
@@ -555,19 +555,19 @@ namespace Barotrauma
|
|||||||
toggleHead.UserData = 1;
|
toggleHead.UserData = 1;
|
||||||
toggleHead.OnClicked = ToggleHead;
|
toggleHead.OnClicked = ToggleHead;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(100, 30, 200, 30), "Gender: ", "", myPlayerFrame);
|
new GUITextBlock(new Rectangle(100, 30, 200, 30), TextManager.Get("Gender"), "", myPlayerFrame);
|
||||||
|
|
||||||
GUIButton maleButton = new GUIButton(new Rectangle(100, 50, 60, 20), "Male",
|
GUIButton maleButton = new GUIButton(new Rectangle(100, 50, 60, 20), TextManager.Get("Male"),
|
||||||
Alignment.TopLeft, "", myPlayerFrame);
|
Alignment.TopLeft, "", myPlayerFrame);
|
||||||
maleButton.UserData = Gender.Male;
|
maleButton.UserData = Gender.Male;
|
||||||
maleButton.OnClicked += SwitchGender;
|
maleButton.OnClicked += SwitchGender;
|
||||||
|
|
||||||
GUIButton femaleButton = new GUIButton(new Rectangle(170, 50, 60, 20), "Female",
|
GUIButton femaleButton = new GUIButton(new Rectangle(170, 50, 60, 20), TextManager.Get("Female"),
|
||||||
Alignment.TopLeft, "", myPlayerFrame);
|
Alignment.TopLeft, "", myPlayerFrame);
|
||||||
femaleButton.UserData = Gender.Female;
|
femaleButton.UserData = Gender.Female;
|
||||||
femaleButton.OnClicked += SwitchGender;
|
femaleButton.OnClicked += SwitchGender;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 120, 20, 30), "Job preferences:", "", myPlayerFrame);
|
new GUITextBlock(new Rectangle(0, 120, 20, 30), TextManager.Get("JobPreferences"), "", myPlayerFrame);
|
||||||
|
|
||||||
jobList = new GUIListBox(new Rectangle(0, 150, 0, 0), "", myPlayerFrame);
|
jobList = new GUIListBox(new Rectangle(0, 150, 0, 0), "", myPlayerFrame);
|
||||||
jobList.Enabled = false;
|
jobList.Enabled = false;
|
||||||
@@ -626,9 +626,9 @@ namespace Barotrauma
|
|||||||
GameMain.NetworkMember.CharacterInfo = null;
|
GameMain.NetworkMember.CharacterInfo = null;
|
||||||
GameMain.NetworkMember.Character = null;
|
GameMain.NetworkMember.Character = null;
|
||||||
|
|
||||||
new GUITextBlock(Rectangle.Empty, "Playing as a spectator", "", Alignment.Center, Alignment.Center, myPlayerFrame, true);
|
new GUITextBlock(Rectangle.Empty, TextManager.Get("PlayingAsSpectator"), "", Alignment.Center, Alignment.Center, myPlayerFrame, true);
|
||||||
|
|
||||||
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), "Play yourself", Alignment.TopLeft, myPlayerFrame);
|
var playYourself = new GUITickBox(new Rectangle(0, 0, 20, 20), TextManager.Get("PlayYourself"), Alignment.TopLeft, myPlayerFrame);
|
||||||
playYourself.OnSelected = TogglePlayYourself;
|
playYourself.OnSelected = TogglePlayYourself;
|
||||||
playYourself.UserData = "playyourself";
|
playYourself.UserData = "playyourself";
|
||||||
}
|
}
|
||||||
@@ -763,12 +763,12 @@ namespace Barotrauma
|
|||||||
if (matchingSub == null)
|
if (matchingSub == null)
|
||||||
{
|
{
|
||||||
subTextBlock.TextColor = new Color(subTextBlock.TextColor, 0.5f);
|
subTextBlock.TextColor = new Color(subTextBlock.TextColor, 0.5f);
|
||||||
subTextBlock.ToolTip = "Submarine not found in your submarine folder";
|
subTextBlock.ToolTip = TextManager.Get("SubNotFound");
|
||||||
}
|
}
|
||||||
else if (matchingSub.MD5Hash.Hash != sub.MD5Hash.Hash)
|
else if (matchingSub.MD5Hash.Hash != sub.MD5Hash.Hash)
|
||||||
{
|
{
|
||||||
subTextBlock.TextColor = new Color(subTextBlock.TextColor, 0.5f);
|
subTextBlock.TextColor = new Color(subTextBlock.TextColor, 0.5f);
|
||||||
subTextBlock.ToolTip = "Your version of the submarine doesn't match the servers version";
|
subTextBlock.ToolTip = TextManager.Get("SubDoesntMatch");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -780,7 +780,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (sub.HasTag(SubmarineTag.Shuttle))
|
if (sub.HasTag(SubmarineTag.Shuttle))
|
||||||
{
|
{
|
||||||
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", "", Alignment.Left, Alignment.CenterY | Alignment.Right, subTextBlock, false, GUI.SmallFont);
|
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), TextManager.Get("Shuttle"), "", Alignment.Left, Alignment.CenterY | Alignment.Right, subTextBlock, false, GUI.SmallFont);
|
||||||
shuttleText.TextColor = subTextBlock.TextColor * 0.8f;
|
shuttleText.TextColor = subTextBlock.TextColor * 0.8f;
|
||||||
shuttleText.ToolTip = subTextBlock.ToolTip;
|
shuttleText.ToolTip = subTextBlock.ToolTip;
|
||||||
}
|
}
|
||||||
@@ -896,14 +896,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 25, 150, 15), selectedClient.Connection.RemoteEndPoint.Address.ToString(), "", playerFrameInner);
|
new GUITextBlock(new Rectangle(0, 25, 150, 15), selectedClient.Connection.RemoteEndPoint.Address.ToString(), "", playerFrameInner);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 45, 0, 15), "Rank", "", playerFrameInner);
|
new GUITextBlock(new Rectangle(0, 45, 0, 15), TextManager.Get("Rank"), "", playerFrameInner);
|
||||||
var rankDropDown = new GUIDropDown(new Rectangle(0, 70, 150, 20), "Rank", "", playerFrameInner);
|
var rankDropDown = new GUIDropDown(new Rectangle(0, 70, 150, 20), TextManager.Get("Rank"), "", playerFrameInner);
|
||||||
rankDropDown.UserData = selectedClient;
|
rankDropDown.UserData = selectedClient;
|
||||||
foreach (PermissionPreset permissionPreset in PermissionPreset.List)
|
foreach (PermissionPreset permissionPreset in PermissionPreset.List)
|
||||||
{
|
{
|
||||||
rankDropDown.AddItem(permissionPreset.Name, permissionPreset, permissionPreset.Description);
|
rankDropDown.AddItem(permissionPreset.Name, permissionPreset, permissionPreset.Description);
|
||||||
}
|
}
|
||||||
rankDropDown.AddItem("Custom", null);
|
rankDropDown.AddItem(TextManager.Get("CustomRank"), null);
|
||||||
|
|
||||||
PermissionPreset currentPreset = PermissionPreset.List.Find(p =>
|
PermissionPreset currentPreset = PermissionPreset.List.Find(p =>
|
||||||
p.Permissions == selectedClient.Permissions &&
|
p.Permissions == selectedClient.Permissions &&
|
||||||
@@ -929,7 +929,7 @@ namespace Barotrauma
|
|||||||
permissionsBox.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
permissionsBox.Padding = new Vector4(5.0f, 5.0f, 5.0f, 5.0f);
|
||||||
permissionsBox.UserData = selectedClient;
|
permissionsBox.UserData = selectedClient;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 100, permissionsBox.Rect.Width, 15), "Permissions:", "", playerFrameInner);
|
new GUITextBlock(new Rectangle(0, 100, permissionsBox.Rect.Width, 15), TextManager.Get("Permissions"), "", playerFrameInner);
|
||||||
int x = 0, y = 0;
|
int x = 0, y = 0;
|
||||||
foreach (ClientPermissions permission in Enum.GetValues(typeof(ClientPermissions)))
|
foreach (ClientPermissions permission in Enum.GetValues(typeof(ClientPermissions)))
|
||||||
{
|
{
|
||||||
@@ -972,7 +972,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 100, (int)(playerFrameInner.Rect.Width * 0.5f), 15), "Permitted console commands:", "", Alignment.TopRight, Alignment.TopLeft, playerFrameInner, true);
|
new GUITextBlock(new Rectangle(0, 100, (int)(playerFrameInner.Rect.Width * 0.5f), 15), TextManager.Get("PermittedConsoleCommands"), "", Alignment.TopRight, Alignment.TopLeft, playerFrameInner, true);
|
||||||
var commandList = new GUIListBox(new Rectangle(0, 125, (int)(playerFrameInner.Rect.Width * 0.5f), 160), "", Alignment.TopRight, playerFrameInner);
|
var commandList = new GUIListBox(new Rectangle(0, 125, (int)(playerFrameInner.Rect.Width * 0.5f), 160), "", Alignment.TopRight, playerFrameInner);
|
||||||
commandList.UserData = selectedClient;
|
commandList.UserData = selectedClient;
|
||||||
foreach (DebugConsole.Command command in DebugConsole.Commands)
|
foreach (DebugConsole.Command command in DebugConsole.Commands)
|
||||||
@@ -1007,7 +1007,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (GameMain.Server != null || GameMain.Client.HasPermission(ClientPermissions.Kick))
|
if (GameMain.Server != null || GameMain.Client.HasPermission(ClientPermissions.Kick))
|
||||||
{
|
{
|
||||||
var kickButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Kick", Alignment.BottomLeft, "", playerFrameInner);
|
var kickButton = new GUIButton(new Rectangle(0, 0, 80, 20), TextManager.Get("Kick"), Alignment.BottomLeft, "", playerFrameInner);
|
||||||
kickButton.UserData = obj;
|
kickButton.UserData = obj;
|
||||||
kickButton.OnClicked += KickPlayer;
|
kickButton.OnClicked += KickPlayer;
|
||||||
kickButton.OnClicked += ClosePlayerFrame;
|
kickButton.OnClicked += ClosePlayerFrame;
|
||||||
@@ -1015,18 +1015,18 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (GameMain.Server != null || GameMain.Client.HasPermission(ClientPermissions.Ban))
|
if (GameMain.Server != null || GameMain.Client.HasPermission(ClientPermissions.Ban))
|
||||||
{
|
{
|
||||||
var banButton = new GUIButton(new Rectangle(90, 0, 80, 20), "Ban", Alignment.BottomLeft, "", playerFrameInner);
|
var banButton = new GUIButton(new Rectangle(90, 0, 80, 20), TextManager.Get("Ban"), Alignment.BottomLeft, "", playerFrameInner);
|
||||||
banButton.UserData = obj;
|
banButton.UserData = obj;
|
||||||
banButton.OnClicked += BanPlayer;
|
banButton.OnClicked += BanPlayer;
|
||||||
banButton.OnClicked += ClosePlayerFrame;
|
banButton.OnClicked += ClosePlayerFrame;
|
||||||
|
|
||||||
var rangebanButton = new GUIButton(new Rectangle(180, 0, 80, 20), "Ban range", Alignment.BottomLeft, "", playerFrameInner);
|
var rangebanButton = new GUIButton(new Rectangle(180, 0, 80, 20), TextManager.Get("BanRange"), Alignment.BottomLeft, "", playerFrameInner);
|
||||||
rangebanButton.UserData = obj;
|
rangebanButton.UserData = obj;
|
||||||
rangebanButton.OnClicked += BanPlayerRange;
|
rangebanButton.OnClicked += BanPlayerRange;
|
||||||
rangebanButton.OnClicked += ClosePlayerFrame;
|
rangebanButton.OnClicked += ClosePlayerFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
var closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Close", Alignment.BottomRight, "", playerFrameInner);
|
var closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("Close"), Alignment.BottomRight, "", playerFrameInner);
|
||||||
closeButton.OnClicked = ClosePlayerFrame;
|
closeButton.OnClicked = ClosePlayerFrame;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@@ -1163,7 +1163,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width - 20, 0),
|
GUITextBlock msg = new GUITextBlock(new Rectangle(0, 0, chatBox.Rect.Width - 20, 0),
|
||||||
(message.Type == ChatMessageType.Private ? "[PM] " : "") + message.TextWithSender,
|
(message.Type == ChatMessageType.Private ? TextManager.Get("PrivateMessageTag") + " " : "") + message.TextWithSender,
|
||||||
((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black * 0.1f, message.Color,
|
((chatBox.CountChildren % 2) == 0) ? Color.Transparent : Color.Black * 0.1f, message.Color,
|
||||||
Alignment.Left, Alignment.TopLeft, "", null, true, GUI.SmallFont);
|
Alignment.Left, Alignment.TopLeft, "", null, true, GUI.SmallFont);
|
||||||
msg.UserData = message;
|
msg.UserData = message;
|
||||||
@@ -1281,7 +1281,7 @@ namespace Barotrauma
|
|||||||
campaignUI = new CampaignUI(GameMain.GameSession.GameMode as CampaignMode, campaignContainer);
|
campaignUI = new CampaignUI(GameMain.GameSession.GameMode as CampaignMode, campaignContainer);
|
||||||
campaignUI.StartRound = () => { GameMain.Server.StartGame(); };
|
campaignUI.StartRound = () => { GameMain.Server.StartGame(); };
|
||||||
|
|
||||||
var backButton = new GUIButton(new Rectangle(0, -20, 100, 30), "Back", "", campaignContainer);
|
var backButton = new GUIButton(new Rectangle(0, -20, 100, 30), TextManager.Get("Back"), "", campaignContainer);
|
||||||
backButton.OnClicked += (btn, obj) => { ToggleCampaignView(false); return true; };
|
backButton.OnClicked += (btn, obj) => { ToggleCampaignView(false); return true; };
|
||||||
|
|
||||||
int buttonX = backButton.Rect.Width + 50;
|
int buttonX = backButton.Rect.Width + 50;
|
||||||
@@ -1297,7 +1297,7 @@ namespace Barotrauma
|
|||||||
buttonX += 110;
|
buttonX += 110;
|
||||||
}
|
}
|
||||||
|
|
||||||
var moneyText = new GUITextBlock(new Rectangle(120,0,200,20), "Money", "", Alignment.BottomLeft, Alignment.TopLeft, campaignContainer);
|
var moneyText = new GUITextBlock(new Rectangle(120,0,200,20), TextManager.Get("Credit"), "", Alignment.BottomLeft, Alignment.TopLeft, campaignContainer);
|
||||||
moneyText.TextGetter = campaignUI.GetMoney;
|
moneyText.TextGetter = campaignUI.GetMoney;
|
||||||
|
|
||||||
var restartText = new GUITextBlock(new Rectangle(-backButton.Rect.Width - 30, -10, 130, 30), "", "", Alignment.BottomRight, Alignment.BottomRight, campaignContainer);
|
var restartText = new GUITextBlock(new Rectangle(-backButton.Rect.Width - 30, -10, 130, 30), "", "", Alignment.BottomRight, Alignment.BottomRight, campaignContainer);
|
||||||
@@ -1332,7 +1332,7 @@ namespace Barotrauma
|
|||||||
if (jobPrefab == null) return false;
|
if (jobPrefab == null) return false;
|
||||||
|
|
||||||
jobInfoFrame = jobPrefab.CreateInfoFrame();
|
jobInfoFrame = jobPrefab.CreateInfoFrame();
|
||||||
GUIButton closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Close", Alignment.BottomRight, "", jobInfoFrame.children[0]);
|
GUIButton closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), TextManager.Get("Close"), Alignment.BottomRight, "", jobInfoFrame.children[0]);
|
||||||
closeButton.OnClicked = CloseJobInfo;
|
closeButton.OnClicked = CloseJobInfo;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1410,22 +1410,19 @@ namespace Barotrauma
|
|||||||
string errorMsg = "";
|
string errorMsg = "";
|
||||||
if (sub == null)
|
if (sub == null)
|
||||||
{
|
{
|
||||||
errorMsg = "Submarine \"" + subName + "\" was selected by the server. Matching file not found in your submarine folder. ";
|
errorMsg = TextManager.Get("SubNotFoundError").Replace("[subname]", subName) + " ";
|
||||||
}
|
}
|
||||||
else if (sub.MD5Hash.Hash == null)
|
else if (sub.MD5Hash.Hash == null)
|
||||||
{
|
{
|
||||||
errorMsg = "Couldn't load submarine \"" + subName + "\". The file may be corrupted. ";
|
errorMsg = TextManager.Get("SubLoadError").Replace("[subname]", subName) + " ";
|
||||||
|
|
||||||
if (matchingListSub != null) matchingListSub.TextColor = Color.Red;
|
if (matchingListSub != null) matchingListSub.TextColor = Color.Red;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
errorMsg = "Your version of the submarine file \"" + sub.Name + "\" doesn't match the server's version!\n"
|
errorMsg = TextManager.Get("SubDoesntMatchError").Replace("[subname]", sub.Name).Replace("[myhash]", sub.MD5Hash.ShortHash).Replace("[serverhash]", Md5Hash.GetShortHash(md5Hash)) + " ";
|
||||||
+ "Your MD5 hash: " + sub.MD5Hash.ShortHash + "\n"
|
|
||||||
+ "Server's MD5 hash: " + Md5Hash.GetShortHash(md5Hash) + "\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
errorMsg += "Do you want to download the file from the server host?";
|
errorMsg += TextManager.Get("DownloadSubQuestion");
|
||||||
|
|
||||||
//already showing a message about the same sub
|
//already showing a message about the same sub
|
||||||
if (GUIMessageBox.MessageBoxes.Any(mb => mb.UserData as string == "request" + subName))
|
if (GUIMessageBox.MessageBoxes.Any(mb => mb.UserData as string == "request" + subName))
|
||||||
@@ -1433,7 +1430,7 @@ namespace Barotrauma
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var requestFileBox = new GUIMessageBox("Submarine not found!", errorMsg, new string[] { "Yes", "No" }, 400, 300);
|
var requestFileBox = new GUIMessageBox(TextManager.Get("DownloadSubLabel"), errorMsg, new string[] { TextManager.Get("Yes"), TextManager.Get("No") }, 400, 300);
|
||||||
requestFileBox.UserData = "request" + subName;
|
requestFileBox.UserData = "request" + subName;
|
||||||
requestFileBox.Buttons[0].UserData = new string[] { subName, md5Hash };
|
requestFileBox.Buttons[0].UserData = new string[] { subName, md5Hash };
|
||||||
requestFileBox.Buttons[0].OnClicked += requestFileBox.Close;
|
requestFileBox.Buttons[0].OnClicked += requestFileBox.Close;
|
||||||
|
|||||||
@@ -16,7 +16,9 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
public float EmitTimer;
|
public float EmitTimer;
|
||||||
|
|
||||||
[Editable(), Serialize("0.0,0.0", false)]
|
public float BurstTimer;
|
||||||
|
|
||||||
|
[Editable(), Serialize("0.0,360.0", false)]
|
||||||
public Vector2 AngleRange { get; private set; }
|
public Vector2 AngleRange { get; private set; }
|
||||||
|
|
||||||
[Editable(), Serialize("0.0,0.0", false)]
|
[Editable(), Serialize("0.0,0.0", false)]
|
||||||
@@ -26,8 +28,12 @@ namespace Barotrauma
|
|||||||
public Vector2 ScaleRange { get; private set; }
|
public Vector2 ScaleRange { get; private set; }
|
||||||
|
|
||||||
[Editable(), Serialize(0, false)]
|
[Editable(), Serialize(0, false)]
|
||||||
public int ParticleAmount { get; private set; }
|
public int ParticleBurstAmount { get; private set; }
|
||||||
[Editable(), Serialize(0.0f, false)]
|
|
||||||
|
[Editable(), Serialize(1.0f, false)]
|
||||||
|
public float ParticleBurstInterval { get; private set; }
|
||||||
|
|
||||||
|
[Editable(), Serialize(1.0f, false)]
|
||||||
public float ParticlesPerSecond { get; private set; }
|
public float ParticlesPerSecond { get; private set; }
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
@@ -46,6 +52,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public Emitter()
|
public Emitter()
|
||||||
{
|
{
|
||||||
|
ScaleRange = Vector2.One;
|
||||||
|
AngleRange = new Vector2(0.0f, 360.0f);
|
||||||
|
ParticleBurstAmount = 1;
|
||||||
|
ParticleBurstInterval = 1.0f;
|
||||||
|
|
||||||
SerializableProperties = SerializableProperty.GetProperties(this);
|
SerializableProperties = SerializableProperty.GetProperties(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -179,6 +190,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private void SerializeToClipboard(ParticlePrefab prefab)
|
private void SerializeToClipboard(ParticlePrefab prefab)
|
||||||
{
|
{
|
||||||
|
#if WINDOWS
|
||||||
if (prefab == null) return;
|
if (prefab == null) return;
|
||||||
|
|
||||||
XmlWriterSettings settings = new XmlWriterSettings();
|
XmlWriterSettings settings = new XmlWriterSettings();
|
||||||
@@ -197,6 +209,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
Clipboard.SetText(sb.ToString());
|
Clipboard.SetText(sb.ToString());
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(double deltaTime)
|
public override void Update(double deltaTime)
|
||||||
@@ -208,6 +221,8 @@ namespace Barotrauma
|
|||||||
if (selectedPrefab != null)
|
if (selectedPrefab != null)
|
||||||
{
|
{
|
||||||
emitter.EmitTimer += (float)deltaTime;
|
emitter.EmitTimer += (float)deltaTime;
|
||||||
|
emitter.BurstTimer += (float)deltaTime;
|
||||||
|
|
||||||
|
|
||||||
if (emitter.ParticlesPerSecond > 0)
|
if (emitter.ParticlesPerSecond > 0)
|
||||||
{
|
{
|
||||||
@@ -219,10 +234,15 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < emitter.ParticleAmount; i++)
|
if (emitter.BurstTimer > emitter.ParticleBurstInterval)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < emitter.ParticleBurstAmount; i++)
|
||||||
{
|
{
|
||||||
Emit(Vector2.Zero);
|
Emit(Vector2.Zero);
|
||||||
}
|
}
|
||||||
|
emitter.BurstTimer = 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GameMain.ParticleManager.Update((float)deltaTime);
|
GameMain.ParticleManager.Update((float)deltaTime);
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ namespace Barotrauma
|
|||||||
menu = new GUIFrame(panelRect, null, Alignment.Center, "");
|
menu = new GUIFrame(panelRect, null, Alignment.Center, "");
|
||||||
menu.Padding = new Vector4(40.0f, 40.0f, 40.0f, 20.0f);
|
menu.Padding = new Vector4(40.0f, 40.0f, 40.0f, 20.0f);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, -25, 0, 30), "Join Server", "", Alignment.CenterX, Alignment.CenterX, menu, false, GUI.LargeFont);
|
new GUITextBlock(new Rectangle(0, -25, 0, 30), TextManager.Get("JoinServer"), "", Alignment.CenterX, Alignment.CenterX, menu, false, GUI.LargeFont);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 30, 0, 30), "Your Name:", "", menu);
|
new GUITextBlock(new Rectangle(0, 30, 0, 30), TextManager.Get("YourName"), "", menu);
|
||||||
clientNameBox = new GUITextBox(new Rectangle(0, 60, 200, 30), "", menu);
|
clientNameBox = new GUITextBox(new Rectangle(0, 60, 200, 30), "", menu);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 100, 0, 30), "Server IP:", "", menu);
|
new GUITextBlock(new Rectangle(0, 100, 0, 30), TextManager.Get("ServerIP"), "", menu);
|
||||||
ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), "", menu);
|
ipBox = new GUITextBox(new Rectangle(0, 130, 200, 30), "", menu);
|
||||||
|
|
||||||
int middleX = (int)(width * 0.35f);
|
int middleX = (int)(width * 0.35f);
|
||||||
@@ -80,35 +80,35 @@ namespace Barotrauma
|
|||||||
|
|
||||||
ScalableFont font = GUI.SmallFont; // serverList.Rect.Width < 400 ? GUI.SmallFont : GUI.Font;
|
ScalableFont font = GUI.SmallFont; // serverList.Rect.Width < 400 ? GUI.SmallFont : GUI.Font;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(middleX, 30, 0, 30), "Password", "", menu).Font = font;
|
new GUITextBlock(new Rectangle(middleX, 30, 0, 30), TextManager.Get("Password"), "", menu).Font = font;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(middleX + columnX[0], 30, 0, 30), "Name", "", menu).Font = font;
|
new GUITextBlock(new Rectangle(middleX + columnX[0], 30, 0, 30), TextManager.Get("ServerListName"), "", menu).Font = font;
|
||||||
new GUITextBlock(new Rectangle(middleX + columnX[1], 30, 0, 30), "Players", "", menu).Font = font;
|
new GUITextBlock(new Rectangle(middleX + columnX[1], 30, 0, 30), TextManager.Get("ServerListPlayers"), "", menu).Font = font;
|
||||||
new GUITextBlock(new Rectangle(middleX + columnX[2], 30, 0, 30), "Round started", "", menu).Font = font;
|
new GUITextBlock(new Rectangle(middleX + columnX[2], 30, 0, 30), TextManager.Get("ServerListRoundStarted"), "", menu).Font = font;
|
||||||
|
|
||||||
joinButton = new GUIButton(new Rectangle(-170, 0, 150, 30), "Refresh", Alignment.BottomRight, "", menu);
|
joinButton = new GUIButton(new Rectangle(-170, 0, 150, 30), TextManager.Get("ServerListRefresh"), Alignment.BottomRight, "", menu);
|
||||||
joinButton.OnClicked = RefreshServers;
|
joinButton.OnClicked = RefreshServers;
|
||||||
|
|
||||||
joinButton = new GUIButton(new Rectangle(0,0,150,30), "Join", Alignment.BottomRight, "", menu);
|
joinButton = new GUIButton(new Rectangle(0,0,150,30), TextManager.Get("ServerListJoin"), Alignment.BottomRight, "", menu);
|
||||||
joinButton.OnClicked = JoinServer;
|
joinButton.OnClicked = JoinServer;
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
int y = 180;
|
int y = 180;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, y, 200, 30), "Filter servers:", "", menu);
|
new GUITextBlock(new Rectangle(0, y, 200, 30), TextManager.Get("FilterServers"), "", menu);
|
||||||
searchBox = new GUITextBox(new Rectangle(0, y + 30, 200, 30), "", menu);
|
searchBox = new GUITextBox(new Rectangle(0, y + 30, 200, 30), "", menu);
|
||||||
searchBox.OnTextChanged += (txtBox, txt) => { FilterServers(); return true; };
|
searchBox.OnTextChanged += (txtBox, txt) => { FilterServers(); return true; };
|
||||||
filterPassword = new GUITickBox(new Rectangle(0, y + 60, 30, 30), "No password required", Alignment.TopLeft, menu);
|
filterPassword = new GUITickBox(new Rectangle(0, y + 60, 30, 30), TextManager.Get("FilterPassword"), Alignment.TopLeft, menu);
|
||||||
filterPassword.OnSelected += (tickBox) => { FilterServers(); return true; };
|
filterPassword.OnSelected += (tickBox) => { FilterServers(); return true; };
|
||||||
filterFull = new GUITickBox(new Rectangle(0, y + 90, 30, 30), "Hide full servers", Alignment.TopLeft, menu);
|
filterFull = new GUITickBox(new Rectangle(0, y + 90, 30, 30), TextManager.Get("FilterFullServers"), Alignment.TopLeft, menu);
|
||||||
filterFull.OnSelected += (tickBox) => { FilterServers(); return true; };
|
filterFull.OnSelected += (tickBox) => { FilterServers(); return true; };
|
||||||
filterEmpty = new GUITickBox(new Rectangle(0, y + 120, 30, 30), "Hide empty servers", Alignment.TopLeft, menu);
|
filterEmpty = new GUITickBox(new Rectangle(0, y + 120, 30, 30), TextManager.Get("FilterEmptyServers"), Alignment.TopLeft, menu);
|
||||||
filterEmpty.OnSelected += (tickBox) => { FilterServers(); return true; };
|
filterEmpty.OnSelected += (tickBox) => { FilterServers(); return true; };
|
||||||
|
|
||||||
//--------------------------------------------------------
|
//--------------------------------------------------------
|
||||||
|
|
||||||
GUIButton button = new GUIButton(new Rectangle(-20, -20, 100, 30), "Back", Alignment.TopLeft, "", menu);
|
GUIButton button = new GUIButton(new Rectangle(-20, -20, 100, 30), TextManager.Get("Back"), Alignment.TopLeft, "", menu);
|
||||||
button.OnClicked = GameMain.MainMenuScreen.SelectTab;
|
button.OnClicked = GameMain.MainMenuScreen.SelectTab;
|
||||||
button.SelectedColor = button.Color;
|
button.SelectedColor = button.Color;
|
||||||
|
|
||||||
@@ -139,7 +139,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (serverList.children.All(c => !c.Visible))
|
if (serverList.children.All(c => !c.Visible))
|
||||||
{
|
{
|
||||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), "No matching servers found.", "", serverList).UserData = "noresults";
|
new GUITextBlock(new Rectangle(0, 0, 0, 20), TextManager.Get("NoMatchingServers"), "", serverList).UserData = "noresults";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -165,7 +165,7 @@ namespace Barotrauma
|
|||||||
if (waitingForRefresh) return false;
|
if (waitingForRefresh) return false;
|
||||||
serverList.ClearChildren();
|
serverList.ClearChildren();
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Refreshing server list...", "", serverList);
|
new GUITextBlock(new Rectangle(0, 0, 0, 20), TextManager.Get("RefreshingServerList"), "", serverList);
|
||||||
|
|
||||||
CoroutineManager.StartCoroutine(WaitForRefresh());
|
CoroutineManager.StartCoroutine(WaitForRefresh());
|
||||||
|
|
||||||
@@ -195,13 +195,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(masterServerData))
|
if (string.IsNullOrWhiteSpace(masterServerData))
|
||||||
{
|
{
|
||||||
new GUITextBlock(new Rectangle(0, 0, 0, 20), "Couldn't find any servers", "", serverList);
|
new GUITextBlock(new Rectangle(0, 0, 0, 20), TextManager.Get("NoServers"), "", serverList);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (masterServerData.Substring(0, 5).ToLowerInvariant() == "error")
|
if (masterServerData.Substring(0, 5).ToLowerInvariant() == "error")
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Error while connecting to master server ("+masterServerData+")!");
|
DebugConsole.ThrowError("Error while connecting to master server (" + masterServerData + ")!");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -284,7 +284,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
serverList.ClearChildren();
|
serverList.ClearChildren();
|
||||||
restRequestHandle.Abort();
|
restRequestHandle.Abort();
|
||||||
new GUIMessageBox("Connection error", "Couldn't connect to master server (request timed out).");
|
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"), TextManager.Get("MasterServerTimeOutError"));
|
||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
}
|
}
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
@@ -293,7 +293,7 @@ namespace Barotrauma
|
|||||||
if (masterServerResponse.ErrorException != null)
|
if (masterServerResponse.ErrorException != null)
|
||||||
{
|
{
|
||||||
serverList.ClearChildren();
|
serverList.ClearChildren();
|
||||||
new GUIMessageBox("Connection error", "Error while connecting to master server {" + masterServerResponse.ErrorException + "}");
|
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"), TextManager.Get("MasterServerErrorException").Replace("[error]", masterServerResponse.ErrorException.ToString()));
|
||||||
}
|
}
|
||||||
else if (masterServerResponse.StatusCode != System.Net.HttpStatusCode.OK)
|
else if (masterServerResponse.StatusCode != System.Net.HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
@@ -302,19 +302,28 @@ namespace Barotrauma
|
|||||||
switch (masterServerResponse.StatusCode)
|
switch (masterServerResponse.StatusCode)
|
||||||
{
|
{
|
||||||
case System.Net.HttpStatusCode.NotFound:
|
case System.Net.HttpStatusCode.NotFound:
|
||||||
new GUIMessageBox("Connection error",
|
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
|
||||||
"Error while connecting to master server (404 - \"" + NetConfig.MasterServerUrl + "\" not found)");
|
TextManager.Get("MasterServerError404")
|
||||||
|
.Replace("[masterserverurl]", NetConfig.MasterServerUrl)
|
||||||
|
.Replace("[statuscode]", masterServerResponse.StatusCode.ToString())
|
||||||
|
.Replace("[statusdescription]", masterServerResponse.StatusDescription));
|
||||||
break;
|
break;
|
||||||
case System.Net.HttpStatusCode.ServiceUnavailable:
|
case System.Net.HttpStatusCode.ServiceUnavailable:
|
||||||
new GUIMessageBox("Connection error",
|
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
|
||||||
"Error while connecting to master server (505 - Service Unavailable) " +
|
TextManager.Get("MasterServerErrorUnavailable")
|
||||||
"The master server may be down for maintenance or temporarily overloaded. Please try again after in a few moments.");
|
.Replace("[masterserverurl]", NetConfig.MasterServerUrl)
|
||||||
|
.Replace("[statuscode]", masterServerResponse.StatusCode.ToString())
|
||||||
|
.Replace("[statusdescription]", masterServerResponse.StatusDescription));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
new GUIMessageBox("Connection error",
|
new GUIMessageBox(TextManager.Get("MasterServerErrorLabel"),
|
||||||
"Error while connecting to master server (" + masterServerResponse.StatusCode + ": " + masterServerResponse.StatusDescription + ")");
|
TextManager.Get("MasterServerError404")
|
||||||
|
.Replace("[masterserverurl]", NetConfig.MasterServerUrl)
|
||||||
|
.Replace("[statuscode]", masterServerResponse.StatusCode.ToString())
|
||||||
|
.Replace("[statusdescription]", masterServerResponse.StatusDescription));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -353,10 +362,10 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void JoinServer(string ip, bool hasPassword, string msg = "Password required")
|
/*public void JoinServer(string ip, bool hasPassword, string msg = "Password required")
|
||||||
{
|
{
|
||||||
CoroutineManager.StartCoroutine(ConnectToServer(ip));
|
CoroutineManager.StartCoroutine(ConnectToServer(ip));
|
||||||
}
|
}*/
|
||||||
|
|
||||||
private IEnumerable<object> ConnectToServer(string ip)
|
private IEnumerable<object> ConnectToServer(string ip)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -59,17 +59,17 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private string GetItemCount()
|
private string GetItemCount()
|
||||||
{
|
{
|
||||||
return "Items: " +Item.ItemList.Count;
|
return TextManager.Get("Items") + ": " + Item.ItemList.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetStructureCount()
|
private string GetStructureCount()
|
||||||
{
|
{
|
||||||
return "Structures: " + (MapEntity.mapEntityList.Count - Item.ItemList.Count);
|
return TextManager.Get("Structures") + ": " + (MapEntity.mapEntityList.Count - Item.ItemList.Count);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetTotalHullVolume()
|
private string GetTotalHullVolume()
|
||||||
{
|
{
|
||||||
return "Total Hull Volume:\n" + Hull.hullList.Sum(h => h.Volume);
|
return TextManager.Get("TotalHullVolume") + ":\n" + Hull.hullList.Sum(h => h.Volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
private string GetSelectedHullVolume()
|
private string GetSelectedHullVolume()
|
||||||
@@ -86,16 +86,16 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
buoyancyVol *= neutralPercentage;
|
buoyancyVol *= neutralPercentage;
|
||||||
string retVal = "Selected Hull Volume:\n" + selectedVol;
|
string retVal = TextManager.Get("SelectedHullVolume") + ":\n" + selectedVol;
|
||||||
if (selectedVol > 0.0f && buoyancyVol > 0.0f)
|
if (selectedVol > 0.0f && buoyancyVol > 0.0f)
|
||||||
{
|
{
|
||||||
if (buoyancyVol / selectedVol < 1.0f)
|
if (buoyancyVol / selectedVol < 1.0f)
|
||||||
{
|
{
|
||||||
retVal += " (optimal NeutralBallastLevel is " + (buoyancyVol / selectedVol).ToString("0.00") + ")";
|
retVal += " (" + TextManager.Get("OptimalBallastLevel").Replace("[value]", (buoyancyVol / selectedVol).ToString("0.00")) + ")";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
retVal += " (insufficient volume for buoyancy control)";
|
retVal += " (" + TextManager.Get("InsufficientBallast") + ")";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return retVal;
|
return retVal;
|
||||||
@@ -103,7 +103,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private string GetPhysicsBodyCount()
|
private string GetPhysicsBodyCount()
|
||||||
{
|
{
|
||||||
return "Physics bodies: " + GameMain.World.BodyList.Count;
|
return TextManager.Get("PhysicsBodies") + ": " + GameMain.World.BodyList.Count;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CharacterMode
|
public bool CharacterMode
|
||||||
@@ -137,7 +137,7 @@ namespace Barotrauma
|
|||||||
GUITextBlock selectedHullVolume = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", "", hullVolumeFrame, GUI.SmallFont);
|
GUITextBlock selectedHullVolume = new GUITextBlock(new Rectangle(0, 30, 0, 20), "", "", hullVolumeFrame, GUI.SmallFont);
|
||||||
selectedHullVolume.TextGetter = GetSelectedHullVolume;
|
selectedHullVolume.TextGetter = GetSelectedHullVolume;
|
||||||
|
|
||||||
var button = new GUIButton(new Rectangle(0, 0, 70, 20), "Open...", "", topPanel);
|
var button = new GUIButton(new Rectangle(0, 0, 70, 20), TextManager.Get("OpenSubButton"), "", topPanel);
|
||||||
button.OnClicked = (GUIButton btn, object data) =>
|
button.OnClicked = (GUIButton btn, object data) =>
|
||||||
{
|
{
|
||||||
saveFrame = null;
|
saveFrame = null;
|
||||||
@@ -147,7 +147,7 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
button = new GUIButton(new Rectangle(80,0,70,20), "Save", "", topPanel);
|
button = new GUIButton(new Rectangle(80,0,70,20), TextManager.Get("SaveSubButton"), "", topPanel);
|
||||||
button.OnClicked = (GUIButton btn, object data) =>
|
button.OnClicked = (GUIButton btn, object data) =>
|
||||||
{
|
{
|
||||||
loadFrame = null;
|
loadFrame = null;
|
||||||
@@ -160,11 +160,8 @@ namespace Barotrauma
|
|||||||
var nameLabel = new GUITextBlock(new Rectangle(170, 0, 150, 20), "", "", Alignment.TopLeft, Alignment.CenterLeft, topPanel, false, GUI.LargeFont);
|
var nameLabel = new GUITextBlock(new Rectangle(170, 0, 150, 20), "", "", Alignment.TopLeft, Alignment.CenterLeft, topPanel, false, GUI.LargeFont);
|
||||||
nameLabel.TextGetter = GetSubName;
|
nameLabel.TextGetter = GetSubName;
|
||||||
|
|
||||||
linkedSubBox = new GUIDropDown(new Rectangle(750, 0, 200, 20), "Add submarine", "", topPanel);
|
linkedSubBox = new GUIDropDown(new Rectangle(750, 0, 200, 20), TextManager.Get("AddSubButton"), "", topPanel);
|
||||||
linkedSubBox.ToolTip =
|
linkedSubBox.ToolTip = TextManager.Get("AddSubToolTip");
|
||||||
"Places another submarine into the current submarine file. " +
|
|
||||||
"Can be used for adding things such as smaller vessels, " +
|
|
||||||
"escape pods or detachable sections into the main submarine.";
|
|
||||||
|
|
||||||
foreach (Submarine sub in Submarine.SavedSubmarines)
|
foreach (Submarine sub in Submarine.SavedSubmarines)
|
||||||
{
|
{
|
||||||
@@ -196,7 +193,7 @@ namespace Barotrauma
|
|||||||
GUItabs[i] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "");
|
GUItabs[i] = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "");
|
||||||
GUItabs[i].Padding = new Vector4(10.0f, 30.0f, 10.0f, 20.0f);
|
GUItabs[i].Padding = new Vector4(10.0f, 30.0f, 10.0f, 20.0f);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(-200, 0, 100, 15), "Filter", "", Alignment.TopRight, Alignment.CenterRight, GUItabs[i], false, GUI.SmallFont);
|
new GUITextBlock(new Rectangle(-200, 0, 100, 15), TextManager.Get("FilterMapEntities"), "", Alignment.TopRight, Alignment.CenterRight, GUItabs[i], false, GUI.SmallFont);
|
||||||
|
|
||||||
GUITextBox searchBox = new GUITextBox(new Rectangle(-20, 0, 180, 15), null,null, Alignment.TopRight, Alignment.CenterLeft, "", GUItabs[i]);
|
GUITextBox searchBox = new GUITextBox(new Rectangle(-20, 0, 180, 15), null,null, Alignment.TopRight, Alignment.CenterLeft, "", GUItabs[i]);
|
||||||
searchBox.Font = GUI.SmallFont;
|
searchBox.Font = GUI.SmallFont;
|
||||||
@@ -244,37 +241,37 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
y += 10;
|
y += 10;
|
||||||
button = new GUIButton(new Rectangle(0, y, 0, 20), "Character mode", Alignment.Left, "", leftPanel);
|
button = new GUIButton(new Rectangle(0, y, 0, 20), TextManager.Get("CharacterModeButton"), Alignment.Left, "", leftPanel);
|
||||||
button.ToolTip = "Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.";
|
button.ToolTip = TextManager.Get("CharacterModeToolTip");
|
||||||
button.OnClicked = ToggleCharacterMode;
|
button.OnClicked = ToggleCharacterMode;
|
||||||
|
|
||||||
y += 25;
|
y += 25;
|
||||||
button = new GUIButton(new Rectangle(0, y, 0, 20), "Wiring mode", Alignment.Left, "", leftPanel);
|
button = new GUIButton(new Rectangle(0, y, 0, 20), TextManager.Get("WiringModeButton"), Alignment.Left, "", leftPanel);
|
||||||
//button.ToolTip = "Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.";
|
button.ToolTip = TextManager.Get("WiringModeToolTip");
|
||||||
button.OnClicked = ToggleWiringMode;
|
button.OnClicked = ToggleWiringMode;
|
||||||
|
|
||||||
y += 35;
|
y += 35;
|
||||||
button = new GUIButton(new Rectangle(0, y, 0, 20), "Generate waypoints", Alignment.Left, "", leftPanel);
|
button = new GUIButton(new Rectangle(0, y, 0, 20), TextManager.Get("GenerateWaypointsButton"), Alignment.Left, "", leftPanel);
|
||||||
button.ToolTip = "AI controlled crew members require waypoints to navigate around the sub.";
|
button.ToolTip = TextManager.Get("GenerateWaypointsToolTip");
|
||||||
button.OnClicked = GenerateWaypoints;
|
button.OnClicked = GenerateWaypoints;
|
||||||
|
|
||||||
y += 30;
|
y += 30;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, y, 0, 20), "Show:", "", leftPanel);
|
new GUITextBlock(new Rectangle(0, y, 0, 20), TextManager.Get("ShowEntitiesLabel"), "", leftPanel);
|
||||||
|
|
||||||
var tickBox = new GUITickBox(new Rectangle(0,y+20,20,20), "Waypoints", Alignment.TopLeft, leftPanel);
|
var tickBox = new GUITickBox(new Rectangle(0,y+20,20,20), TextManager.Get("ShowWaypoints"), Alignment.TopLeft, leftPanel);
|
||||||
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowWayPoints = !WayPoint.ShowWayPoints; return true; };
|
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowWayPoints = !WayPoint.ShowWayPoints; return true; };
|
||||||
tickBox.Selected = true;
|
tickBox.Selected = true;
|
||||||
tickBox = new GUITickBox(new Rectangle(0, y + 45, 20, 20), "Spawnpoints", Alignment.TopLeft, leftPanel);
|
tickBox = new GUITickBox(new Rectangle(0, y + 45, 20, 20), TextManager.Get("ShowSpawnpoints"), Alignment.TopLeft, leftPanel);
|
||||||
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowSpawnPoints = !WayPoint.ShowSpawnPoints; return true; };
|
tickBox.OnSelected = (GUITickBox obj) => { WayPoint.ShowSpawnPoints = !WayPoint.ShowSpawnPoints; return true; };
|
||||||
tickBox.Selected = true;
|
tickBox.Selected = true;
|
||||||
tickBox = new GUITickBox(new Rectangle(0, y + 70, 20, 20), "Links", Alignment.TopLeft, leftPanel);
|
tickBox = new GUITickBox(new Rectangle(0, y + 70, 20, 20), TextManager.Get("ShowLinks"), Alignment.TopLeft, leftPanel);
|
||||||
tickBox.OnSelected = (GUITickBox obj) => { Item.ShowLinks = !Item.ShowLinks; return true; };
|
tickBox.OnSelected = (GUITickBox obj) => { Item.ShowLinks = !Item.ShowLinks; return true; };
|
||||||
tickBox.Selected = true;
|
tickBox.Selected = true;
|
||||||
tickBox = new GUITickBox(new Rectangle(0, y + 95, 20, 20), "Hulls", Alignment.TopLeft, leftPanel);
|
tickBox = new GUITickBox(new Rectangle(0, y + 95, 20, 20), TextManager.Get("ShowHulls"), Alignment.TopLeft, leftPanel);
|
||||||
tickBox.OnSelected = (GUITickBox obj) => { Hull.ShowHulls = !Hull.ShowHulls; return true; };
|
tickBox.OnSelected = (GUITickBox obj) => { Hull.ShowHulls = !Hull.ShowHulls; return true; };
|
||||||
tickBox.Selected = true;
|
tickBox.Selected = true;
|
||||||
tickBox = new GUITickBox(new Rectangle(0, y + 120, 20, 20), "Gaps", Alignment.TopLeft, leftPanel);
|
tickBox = new GUITickBox(new Rectangle(0, y + 120, 20, 20), TextManager.Get("ShowGaps"), Alignment.TopLeft, leftPanel);
|
||||||
tickBox.OnSelected = (GUITickBox obj) => { Gap.ShowGaps = !Gap.ShowGaps; return true; };
|
tickBox.OnSelected = (GUITickBox obj) => { Gap.ShowGaps = !Gap.ShowGaps; return true; };
|
||||||
tickBox.Selected = true;
|
tickBox.Selected = true;
|
||||||
|
|
||||||
@@ -282,7 +279,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (y < GameMain.GraphicsHeight - 100)
|
if (y < GameMain.GraphicsHeight - 100)
|
||||||
{
|
{
|
||||||
new GUITextBlock(new Rectangle(0, y, 0, 15), "Previously used:", "", leftPanel);
|
new GUITextBlock(new Rectangle(0, y, 0, 15), TextManager.Get("PreviouslyUsedLabel"), "", leftPanel);
|
||||||
|
|
||||||
previouslyUsedList = new GUIListBox(new Rectangle(0, y + 20, 0, Math.Min(GameMain.GraphicsHeight - y - 80, 150)), "", leftPanel);
|
previouslyUsedList = new GUIListBox(new Rectangle(0, y + 20, 0, Math.Min(GameMain.GraphicsHeight - y - 80, 150)), "", leftPanel);
|
||||||
previouslyUsedList.OnSelected = SelectPrefab;
|
previouslyUsedList.OnSelected = SelectPrefab;
|
||||||
@@ -376,18 +373,21 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(nameBox.Text))
|
if (string.IsNullOrWhiteSpace(nameBox.Text))
|
||||||
{
|
{
|
||||||
GUI.AddMessage("Name your submarine before saving it", Color.Red, 3.0f);
|
GUI.AddMessage(TextManager.Get("SubNameMissingWarning"), Color.Red, 3.0f);
|
||||||
|
|
||||||
nameBox.Flash();
|
nameBox.Flash();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nameBox.Text.Contains("../"))
|
foreach (char illegalChar in Path.GetInvalidFileNameChars())
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Illegal symbols in filename (../)");
|
if (nameBox.Text.Contains(illegalChar))
|
||||||
|
{
|
||||||
|
GUI.AddMessage(TextManager.Get("SubNameIllegalCharsWarning").Replace("[illegalchar]", illegalChar.ToString()), Color.Red, 3.0f);
|
||||||
nameBox.Flash();
|
nameBox.Flash();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
string savePath = nameBox.Text + ".sub";
|
string savePath = nameBox.Text + ".sub";
|
||||||
|
|
||||||
@@ -403,7 +403,7 @@ namespace Barotrauma
|
|||||||
Submarine.SaveCurrent(savePath);
|
Submarine.SaveCurrent(savePath);
|
||||||
Submarine.MainSub.CheckForErrors();
|
Submarine.MainSub.CheckForErrors();
|
||||||
|
|
||||||
GUI.AddMessage("Submarine saved to " + Submarine.MainSub.FilePath, Color.Green, 3.0f);
|
GUI.AddMessage(TextManager.Get("SubSavedNotification").Replace("[filepath]", Submarine.MainSub.FilePath), Color.Green, 3.0f);
|
||||||
|
|
||||||
Submarine.RefreshSavedSubs();
|
Submarine.RefreshSavedSubs();
|
||||||
linkedSubBox.ClearChildren();
|
linkedSubBox.ClearChildren();
|
||||||
@@ -429,11 +429,11 @@ namespace Barotrauma
|
|||||||
saveFrame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "", null);
|
saveFrame = new GUIFrame(new Rectangle(GameMain.GraphicsWidth / 2 - width / 2, GameMain.GraphicsHeight / 2 - height / 2, width, height), "", null);
|
||||||
saveFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
saveFrame.Padding = new Vector4(10.0f, 10.0f, 10.0f, 10.0f);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0,0,200,30), "Save submarine", "", saveFrame, GUI.LargeFont);
|
new GUITextBlock(new Rectangle(0,0,200,30), TextManager.Get("SaveSubDialogHeader"), "", saveFrame, GUI.LargeFont);
|
||||||
|
|
||||||
y += 30;
|
y += 30;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0,y,150,20), "Name:", "", saveFrame);
|
new GUITextBlock(new Rectangle(0,y,150,20), TextManager.Get("SaveSubDialogName"), "", saveFrame);
|
||||||
y += 20;
|
y += 20;
|
||||||
|
|
||||||
nameBox = new GUITextBox(new Rectangle(5, y, 250, 20), "", saveFrame);
|
nameBox = new GUITextBox(new Rectangle(5, y, 250, 20), "", saveFrame);
|
||||||
@@ -442,7 +442,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
y += 30;
|
y += 30;
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, y, 150, 20), "Description:", "", saveFrame);
|
new GUITextBlock(new Rectangle(0, y, 150, 20), TextManager.Get("SaveSubDialogDescription"), "", saveFrame);
|
||||||
y += 20;
|
y += 20;
|
||||||
|
|
||||||
var descriptionBox = new GUITextBox(new Rectangle(5, y, 0, 100), null, null, Alignment.TopLeft,
|
var descriptionBox = new GUITextBox(new Rectangle(5, y, 0, 100), null, null, Alignment.TopLeft,
|
||||||
@@ -452,7 +452,7 @@ namespace Barotrauma
|
|||||||
descriptionBox.OnTextChanged = ChangeSubDescription;
|
descriptionBox.OnTextChanged = ChangeSubDescription;
|
||||||
|
|
||||||
y += descriptionBox.Rect.Height + 15;
|
y += descriptionBox.Rect.Height + 15;
|
||||||
new GUITextBlock(new Rectangle(0, y, 150, 20), "Settings:", "", saveFrame);
|
new GUITextBlock(new Rectangle(0, y, 150, 20), TextManager.Get("SaveSubDialogSettings"), "", saveFrame);
|
||||||
|
|
||||||
y += 20;
|
y += 20;
|
||||||
|
|
||||||
@@ -492,10 +492,10 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var saveButton = new GUIButton(new Rectangle(-90, 0, 80, 20), "Save", Alignment.Right | Alignment.Bottom, "", saveFrame);
|
var saveButton = new GUIButton(new Rectangle(-90, 0, 80, 20), TextManager.Get("SaveSubButton"), Alignment.Right | Alignment.Bottom, "", saveFrame);
|
||||||
saveButton.OnClicked = SaveSub;
|
saveButton.OnClicked = SaveSub;
|
||||||
|
|
||||||
var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Cancel", Alignment.Right | Alignment.Bottom, "", saveFrame);
|
var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), TextManager.Get("Cancel"), Alignment.Right | Alignment.Bottom, "", saveFrame);
|
||||||
cancelButton.OnClicked = (GUIButton btn, object userdata) =>
|
cancelButton.OnClicked = (GUIButton btn, object userdata) =>
|
||||||
{
|
{
|
||||||
saveFrame = null;
|
saveFrame = null;
|
||||||
@@ -537,13 +537,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (sub.HasTag(SubmarineTag.Shuttle))
|
if (sub.HasTag(SubmarineTag.Shuttle))
|
||||||
{
|
{
|
||||||
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), "Shuttle", "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
|
var shuttleText = new GUITextBlock(new Rectangle(0, 0, 0, 25), TextManager.Get("Shuttle"), "", Alignment.Left, Alignment.CenterY | Alignment.Right, textBlock, false, GUI.SmallFont);
|
||||||
shuttleText.TextColor = textBlock.TextColor * 0.8f;
|
shuttleText.TextColor = textBlock.TextColor * 0.8f;
|
||||||
shuttleText.ToolTip = textBlock.ToolTip;
|
shuttleText.ToolTip = textBlock.ToolTip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var deleteButton = new GUIButton(new Rectangle(0, 0, 70, 20), "Delete", Alignment.BottomLeft, "", loadFrame);
|
var deleteButton = new GUIButton(new Rectangle(0, 0, 70, 20), TextManager.Get("Delete"), Alignment.BottomLeft, "", loadFrame);
|
||||||
deleteButton.Enabled = false;
|
deleteButton.Enabled = false;
|
||||||
deleteButton.UserData = "delete";
|
deleteButton.UserData = "delete";
|
||||||
deleteButton.OnClicked = (btn, userdata) =>
|
deleteButton.OnClicked = (btn, userdata) =>
|
||||||
@@ -558,10 +558,10 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
var loadButton = new GUIButton(new Rectangle(-90, 0, 80, 20), "Load", Alignment.Right | Alignment.Bottom, "", loadFrame);
|
var loadButton = new GUIButton(new Rectangle(-90, 0, 80, 20), TextManager.Get("Load"), Alignment.Right | Alignment.Bottom, "", loadFrame);
|
||||||
loadButton.OnClicked = LoadSub;
|
loadButton.OnClicked = LoadSub;
|
||||||
|
|
||||||
var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), "Cancel", Alignment.Right | Alignment.Bottom, "", loadFrame);
|
var cancelButton = new GUIButton(new Rectangle(0, 0, 80, 20), TextManager.Get("Cancel"), Alignment.Right | Alignment.Bottom, "", loadFrame);
|
||||||
cancelButton.OnClicked = (GUIButton btn, object userdata) =>
|
cancelButton.OnClicked = (GUIButton btn, object userdata) =>
|
||||||
{
|
{
|
||||||
loadFrame = null;
|
loadFrame = null;
|
||||||
@@ -595,7 +595,10 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (sub == null) return;
|
if (sub == null) return;
|
||||||
|
|
||||||
var msgBox = new GUIMessageBox("Delete file?", "Are you sure you want to delete \"" + sub.Name + "\"", new string[] { "OK", "Cancel" });
|
var msgBox = new GUIMessageBox(
|
||||||
|
TextManager.Get("DeleteDialogLabel"),
|
||||||
|
TextManager.Get("DeleteDialogQuestion").Replace("[file]", sub.Name),
|
||||||
|
new string[] { TextManager.Get("Yes"), TextManager.Get("Cancel") });
|
||||||
msgBox.Buttons[0].OnClicked += (btn, userData) =>
|
msgBox.Buttons[0].OnClicked += (btn, userData) =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -606,7 +609,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("Couldn't delete file \"" + sub.FilePath + "\"!", e);
|
DebugConsole.ThrowError(TextManager.Get("DeleteFileError").Replace("[file]", sub.FilePath), e);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@@ -902,6 +905,304 @@ namespace Barotrauma
|
|||||||
previouslyUsedList.children.Insert(0, textBlock);
|
previouslyUsedList.children.Insert(0, textBlock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AutoHull()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < MapEntity.mapEntityList.Count; i++)
|
||||||
|
{
|
||||||
|
MapEntity h = MapEntity.mapEntityList[i];
|
||||||
|
if (h is Hull || h is Gap)
|
||||||
|
{
|
||||||
|
h.Remove();
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Vector2> wallPoints = new List<Vector2>();
|
||||||
|
Vector2 min = Vector2.Zero;
|
||||||
|
Vector2 max = Vector2.Zero;
|
||||||
|
|
||||||
|
List<MapEntity> mapEntityList = new List<MapEntity>();
|
||||||
|
|
||||||
|
foreach (MapEntity e in MapEntity.mapEntityList)
|
||||||
|
{
|
||||||
|
if (e is Item)
|
||||||
|
{
|
||||||
|
Item it = e as Item;
|
||||||
|
Door door = it.GetComponent<Door>();
|
||||||
|
if (door != null)
|
||||||
|
{
|
||||||
|
int halfW = e.WorldRect.Width / 2;
|
||||||
|
wallPoints.Add(new Vector2(e.WorldRect.X + halfW, -e.WorldRect.Y + e.WorldRect.Height));
|
||||||
|
mapEntityList.Add(it);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(e is Structure)) continue;
|
||||||
|
Structure s = e as Structure;
|
||||||
|
if (!s.HasBody) continue;
|
||||||
|
mapEntityList.Add(e);
|
||||||
|
|
||||||
|
if (e.Rect.Width > e.Rect.Height)
|
||||||
|
{
|
||||||
|
int halfH = e.WorldRect.Height / 2;
|
||||||
|
wallPoints.Add(new Vector2(e.WorldRect.X, -e.WorldRect.Y + halfH));
|
||||||
|
wallPoints.Add(new Vector2(e.WorldRect.X + e.WorldRect.Width, -e.WorldRect.Y + halfH));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int halfW = e.WorldRect.Width / 2;
|
||||||
|
wallPoints.Add(new Vector2(e.WorldRect.X + halfW, -e.WorldRect.Y));
|
||||||
|
wallPoints.Add(new Vector2(e.WorldRect.X + halfW, -e.WorldRect.Y + e.WorldRect.Height));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
min = wallPoints[0];
|
||||||
|
max = wallPoints[0];
|
||||||
|
for (int i = 0; i < wallPoints.Count; i++)
|
||||||
|
{
|
||||||
|
min.X = Math.Min(min.X, wallPoints[i].X);
|
||||||
|
min.Y = Math.Min(min.Y, wallPoints[i].Y);
|
||||||
|
max.X = Math.Max(max.X, wallPoints[i].X);
|
||||||
|
max.Y = Math.Max(max.Y, wallPoints[i].Y);
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Rectangle> hullRects = new List<Rectangle>();
|
||||||
|
hullRects.Add(new Rectangle((int)min.X, (int)min.Y, (int)(max.X - min.X), (int)(max.Y - min.Y)));
|
||||||
|
foreach (Vector2 point in wallPoints)
|
||||||
|
{
|
||||||
|
MathUtils.SplitRectanglesHorizontal(hullRects, point);
|
||||||
|
MathUtils.SplitRectanglesVertical(hullRects, point);
|
||||||
|
}
|
||||||
|
|
||||||
|
hullRects.Sort((a, b) =>
|
||||||
|
{
|
||||||
|
if (a.Y < b.Y) return -1;
|
||||||
|
if (a.Y > b.Y) return 1;
|
||||||
|
if (a.X < b.X) return -1;
|
||||||
|
if (a.X > b.X) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
for (int i = 0; i < hullRects.Count - 1; i++)
|
||||||
|
{
|
||||||
|
Rectangle rect = hullRects[i];
|
||||||
|
if (hullRects[i + 1].Y > rect.Y) continue;
|
||||||
|
|
||||||
|
Vector2 hullRPoint = new Vector2(rect.X + rect.Width - 8, rect.Y + rect.Height / 2);
|
||||||
|
Vector2 hullLPoint = new Vector2(rect.X, rect.Y + rect.Height / 2);
|
||||||
|
|
||||||
|
MapEntity container = null;
|
||||||
|
foreach (MapEntity e in mapEntityList)
|
||||||
|
{
|
||||||
|
Rectangle entRect = e.WorldRect;
|
||||||
|
entRect.Y = -entRect.Y;
|
||||||
|
if (entRect.Contains(hullRPoint))
|
||||||
|
{
|
||||||
|
if (!entRect.Contains(hullLPoint)) container = e;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
rect.Width += hullRects[i + 1].Width;
|
||||||
|
hullRects[i] = rect;
|
||||||
|
hullRects.RemoveAt(i + 1);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (MapEntity e in mapEntityList)
|
||||||
|
{
|
||||||
|
Rectangle entRect = e.WorldRect;
|
||||||
|
if (entRect.Width < entRect.Height) continue;
|
||||||
|
entRect.Y = -entRect.Y - 16;
|
||||||
|
for (int i = 0; i < hullRects.Count; i++)
|
||||||
|
{
|
||||||
|
Rectangle hullRect = hullRects[i];
|
||||||
|
if (entRect.Intersects(hullRect))
|
||||||
|
{
|
||||||
|
if (hullRect.Y < entRect.Y)
|
||||||
|
{
|
||||||
|
hullRect.Height = Math.Max((entRect.Y + 16 + entRect.Height / 2) - hullRect.Y, hullRect.Height);
|
||||||
|
hullRects[i] = hullRect;
|
||||||
|
}
|
||||||
|
else if (hullRect.Y + hullRect.Height <= entRect.Y + 16 + entRect.Height)
|
||||||
|
{
|
||||||
|
hullRects.RemoveAt(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (MapEntity e in mapEntityList)
|
||||||
|
{
|
||||||
|
Rectangle entRect = e.WorldRect;
|
||||||
|
if (entRect.Width < entRect.Height) continue;
|
||||||
|
entRect.Y = -entRect.Y;
|
||||||
|
for (int i = 0; i < hullRects.Count; i++)
|
||||||
|
{
|
||||||
|
Rectangle hullRect = hullRects[i];
|
||||||
|
if (entRect.Intersects(hullRect))
|
||||||
|
{
|
||||||
|
if (hullRect.Y >= entRect.Y - 8 && hullRect.Y + hullRect.Height <= entRect.Y + entRect.Height + 8)
|
||||||
|
{
|
||||||
|
hullRects.RemoveAt(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < hullRects.Count;)
|
||||||
|
{
|
||||||
|
Rectangle hullRect = hullRects[i];
|
||||||
|
Vector2 point = new Vector2(hullRect.X+2, hullRect.Y+hullRect.Height/2);
|
||||||
|
MapEntity container = null;
|
||||||
|
foreach (MapEntity e in mapEntityList)
|
||||||
|
{
|
||||||
|
Rectangle entRect = e.WorldRect;
|
||||||
|
entRect.Y = -entRect.Y;
|
||||||
|
if (entRect.Contains(point))
|
||||||
|
{
|
||||||
|
container = e;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
hullRects.RemoveAt(i);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (hullRects[i].Y <= hullRect.Y)
|
||||||
|
{
|
||||||
|
i++;
|
||||||
|
if (i >= hullRects.Count) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = hullRects.Count-1; i >= 0;)
|
||||||
|
{
|
||||||
|
Rectangle hullRect = hullRects[i];
|
||||||
|
Vector2 point = new Vector2(hullRect.X+hullRect.Width-2, hullRect.Y+hullRect.Height/2);
|
||||||
|
MapEntity container = null;
|
||||||
|
foreach (MapEntity e in mapEntityList)
|
||||||
|
{
|
||||||
|
Rectangle entRect = e.WorldRect;
|
||||||
|
entRect.Y = -entRect.Y;
|
||||||
|
if (entRect.Contains(point))
|
||||||
|
{
|
||||||
|
container = e;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
hullRects.RemoveAt(i); i--;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (hullRects[i].Y >= hullRect.Y)
|
||||||
|
{
|
||||||
|
i--;
|
||||||
|
if (i < 0) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hullRects.Sort((a, b) =>
|
||||||
|
{
|
||||||
|
if (a.X < b.X) return -1;
|
||||||
|
if (a.X > b.X) return 1;
|
||||||
|
if (a.Y < b.Y) return -1;
|
||||||
|
if (a.Y > b.Y) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
for (int i = 0; i < hullRects.Count - 1; i++)
|
||||||
|
{
|
||||||
|
Rectangle rect = hullRects[i];
|
||||||
|
if (hullRects[i + 1].Width != rect.Width) continue;
|
||||||
|
if (hullRects[i + 1].X > rect.X) continue;
|
||||||
|
|
||||||
|
Vector2 hullBPoint = new Vector2(rect.X + rect.Width / 2, rect.Y + rect.Height - 8);
|
||||||
|
Vector2 hullUPoint = new Vector2(rect.X + rect.Width / 2, rect.Y);
|
||||||
|
|
||||||
|
MapEntity container = null;
|
||||||
|
foreach (MapEntity e in mapEntityList)
|
||||||
|
{
|
||||||
|
Rectangle entRect = e.WorldRect;
|
||||||
|
entRect.Y = -entRect.Y;
|
||||||
|
if (entRect.Contains(hullBPoint))
|
||||||
|
{
|
||||||
|
if (!entRect.Contains(hullUPoint)) container = e;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (container == null)
|
||||||
|
{
|
||||||
|
rect.Height += hullRects[i + 1].Height;
|
||||||
|
hullRects[i] = rect;
|
||||||
|
hullRects.RemoveAt(i + 1);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < hullRects.Count;i++)
|
||||||
|
{
|
||||||
|
Rectangle rect = hullRects[i];
|
||||||
|
rect.Y -= 16;
|
||||||
|
rect.Height += 32;
|
||||||
|
hullRects[i] = rect;
|
||||||
|
}
|
||||||
|
|
||||||
|
hullRects.Sort((a, b) =>
|
||||||
|
{
|
||||||
|
if (a.Y < b.Y) return -1;
|
||||||
|
if (a.Y > b.Y) return 1;
|
||||||
|
if (a.X < b.X) return -1;
|
||||||
|
if (a.X > b.X) return 1;
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
|
for (int i = 0; i < hullRects.Count; i++)
|
||||||
|
{
|
||||||
|
for (int j = i+1; j < hullRects.Count; j++)
|
||||||
|
{
|
||||||
|
if (hullRects[j].Y <= hullRects[i].Y) continue;
|
||||||
|
if (hullRects[j].Intersects(hullRects[i]))
|
||||||
|
{
|
||||||
|
Rectangle rect = hullRects[i];
|
||||||
|
rect.Height = hullRects[j].Y - rect.Y;
|
||||||
|
hullRects[i] = rect;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (Rectangle rect in hullRects)
|
||||||
|
{
|
||||||
|
Rectangle hullRect = rect;
|
||||||
|
hullRect.Y = -hullRect.Y;
|
||||||
|
Hull newHull = new Hull(MapEntityPrefab.Find("Hull"),
|
||||||
|
hullRect,
|
||||||
|
Submarine.MainSub);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach (MapEntity e in mapEntityList)
|
||||||
|
{
|
||||||
|
if (!(e is Structure)) continue;
|
||||||
|
if (!(e as Structure).IsPlatform) continue;
|
||||||
|
|
||||||
|
Rectangle gapRect = e.WorldRect;
|
||||||
|
gapRect.Y -= 8;
|
||||||
|
gapRect.Height = 16;
|
||||||
|
Gap newGap = new Gap(MapEntityPrefab.Find("Gap"),
|
||||||
|
gapRect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override void AddToGUIUpdateList()
|
public override void AddToGUIUpdateList()
|
||||||
{
|
{
|
||||||
if (tutorial != null) tutorial.AddToGUIUpdateList();
|
if (tutorial != null) tutorial.AddToGUIUpdateList();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@@ -186,18 +186,23 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Color color)
|
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Color color)
|
||||||
{
|
{
|
||||||
DrawTiled(spriteBatch, pos, targetSize, startOffset, sourceRect, color);
|
DrawTiled(spriteBatch, pos, targetSize, startOffset, sourceRect, color, Vector2.One);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Rectangle sourceRect, Color color)
|
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Rectangle sourceRect, Color color)
|
||||||
|
{
|
||||||
|
DrawTiled(spriteBatch, pos, targetSize, startOffset, sourceRect, color, Vector2.One);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawTiled(SpriteBatch spriteBatch, Vector2 pos, Vector2 targetSize, Vector2 startOffset, Rectangle sourceRect, Color color, Vector2 scale)
|
||||||
{
|
{
|
||||||
//pos.X = (int)pos.X;
|
//pos.X = (int)pos.X;
|
||||||
//pos.Y = (int)pos.Y;
|
//pos.Y = (int)pos.Y;
|
||||||
|
|
||||||
//how many times the texture needs to be drawn on the x-axis
|
//how many times the texture needs to be drawn on the x-axis
|
||||||
int xTiles = (int)Math.Ceiling((targetSize.X + startOffset.X) / sourceRect.Width);
|
int xTiles = (int)Math.Ceiling((targetSize.X + startOffset.X) / (sourceRect.Width*scale.X));
|
||||||
//how many times the texture needs to be drawn on the y-axis
|
//how many times the texture needs to be drawn on the y-axis
|
||||||
int yTiles = (int)Math.Ceiling((targetSize.Y + startOffset.Y) / sourceRect.Height);
|
int yTiles = (int)Math.Ceiling((targetSize.Y + startOffset.Y) / (sourceRect.Height*scale.Y));
|
||||||
|
|
||||||
Vector2 position = pos - startOffset;
|
Vector2 position = pos - startOffset;
|
||||||
Rectangle drawRect = sourceRect;
|
Rectangle drawRect = sourceRect;
|
||||||
@@ -211,11 +216,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (x == xTiles - 1)
|
if (x == xTiles - 1)
|
||||||
{
|
{
|
||||||
drawRect.Width -= (int)((position.X + sourceRect.Width) - (pos.X + targetSize.X));
|
drawRect.Width -= (int)((position.X + sourceRect.Width*scale.X) - (pos.X + targetSize.X));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
drawRect.Width = sourceRect.Width;
|
drawRect.Width = (int)(sourceRect.Width*scale.X);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (position.X < pos.X)
|
if (position.X < pos.X)
|
||||||
@@ -234,11 +239,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (y == yTiles - 1)
|
if (y == yTiles - 1)
|
||||||
{
|
{
|
||||||
drawRect.Height -= (int)((position.Y + sourceRect.Height) - (pos.Y + targetSize.Y));
|
drawRect.Height -= (int)((position.Y + sourceRect.Height*scale.Y) - (pos.Y + targetSize.Y));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
drawRect.Height = sourceRect.Height;
|
drawRect.Height = (int)(sourceRect.Height*scale.Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (position.Y < pos.Y)
|
if (position.Y < pos.Y)
|
||||||
@@ -252,10 +257,10 @@ namespace Barotrauma
|
|||||||
spriteBatch.Draw(texture, position,
|
spriteBatch.Draw(texture, position,
|
||||||
drawRect, color, rotation, Vector2.Zero, 1.0f, effects, depth);
|
drawRect, color, rotation, Vector2.Zero, 1.0f, effects, depth);
|
||||||
|
|
||||||
position.Y += sourceRect.Height;
|
position.Y += sourceRect.Height*scale.Y;
|
||||||
}
|
}
|
||||||
|
|
||||||
position.X += sourceRect.Width;
|
position.X += sourceRect.Width*scale.X;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Color = Microsoft.Xna.Framework.Color;
|
using Color = Microsoft.Xna.Framework.Color;
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="MonoGame.Framework.DesktopGL" version="3.6.0.1625" targetFramework="net45" />
|
||||||
<package id="MonoGame.Framework.WindowsDX" version="3.6.0.1625" targetFramework="net45" />
|
<package id="MonoGame.Framework.WindowsDX" version="3.6.0.1625" targetFramework="net45" />
|
||||||
<package id="NVorbis" version="0.8.5.0" targetFramework="net45" />
|
<package id="NVorbis" version="0.8.5.0" targetFramework="net45" />
|
||||||
<package id="OpenTK" version="2.0.0" targetFramework="net45" />
|
<package id="OpenTK" version="2.0.0" targetFramework="net45" />
|
||||||
<package id="RestSharp" version="105.2.3" targetFramework="net45" />
|
<package id="RestSharp" version="105.2.3" targetFramework="net45" />
|
||||||
|
<package id="SharpDX" version="4.0.1" targetFramework="net45" />
|
||||||
</packages>
|
</packages>
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
<Configuration Condition=" '$(Configuration)' == '' ">ReleaseLinux</Configuration>
|
||||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
||||||
<ProjectGuid>{85232B20-074D-4723-B0C6-91495391E448}</ProjectGuid>
|
<ProjectGuid>{85232B20-074D-4723-B0C6-91495391E448}</ProjectGuid>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||||
@@ -27,30 +27,47 @@
|
|||||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||||
<UseApplicationTrust>false</UseApplicationTrust>
|
<UseApplicationTrust>false</UseApplicationTrust>
|
||||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||||
</PropertyGroup>
|
<ReleaseVersion>0.7.0.1</ReleaseVersion>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
|
|
||||||
<DebugSymbols>true</DebugSymbols>
|
|
||||||
<OutputPath>..\bin\Windows\Debug\</OutputPath>
|
|
||||||
<DefineConstants>TRACE;DEBUG;WINDOWS;SERVER</DefineConstants>
|
|
||||||
<DebugType>full</DebugType>
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
<Prefer32Bit>true</Prefer32Bit>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
|
|
||||||
<OutputPath>..\bin\Windows\Release\</OutputPath>
|
|
||||||
<DefineConstants>TRACE;WINDOWS;SERVER</DefineConstants>
|
|
||||||
<Optimize>true</Optimize>
|
|
||||||
<DebugType>pdbonly</DebugType>
|
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
|
||||||
<ErrorReport>prompt</ErrorReport>
|
|
||||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
|
||||||
<Prefer32Bit>true</Prefer32Bit>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
<ApplicationIcon>..\BarotraumaShared\Icon.ico</ApplicationIcon>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseLinux|x86' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>..\bin\ReleaseLinux</OutputPath>
|
||||||
|
<DefineConstants>TRACE;SERVER</DefineConstants>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugLinux|x86' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..\bin\DebugLinux</OutputPath>
|
||||||
|
<DefineConstants>TRACE;SERVER;DEBUG</DefineConstants>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'ReleaseWindows|x86' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>pdbonly</DebugType>
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<OutputPath>..\bin\ReleaseWindows</OutputPath>
|
||||||
|
<DefineConstants>TRACE;SERVER</DefineConstants>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'DebugWindows|x86' ">
|
||||||
|
<DebugSymbols>true</DebugSymbols>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
<Optimize>false</Optimize>
|
||||||
|
<OutputPath>..\bin\DebugWindows</OutputPath>
|
||||||
|
<DefineConstants>TRACE;SERVER;DEBUG</DefineConstants>
|
||||||
|
<WarningLevel>4</WarningLevel>
|
||||||
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using Barotrauma.Networking;
|
using Barotrauma.Networking;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Linq;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
@@ -94,6 +95,13 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
NewMessage("Set gamemode to " + GameMain.NetLobbyScreen.SelectedModeName, Color.Cyan);
|
NewMessage("Set gamemode to " + GameMain.NetLobbyScreen.SelectedModeName, Color.Cyan);
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
return new string[][]
|
||||||
|
{
|
||||||
|
GameModePreset.list.Select(gm => gm.Name).ToArray()
|
||||||
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
commands.Add(new Command("mission", "mission [name]/[index]: Select the mission type for the next round. The parameter can either be the name or the index number of the mission type (0 = first mission type, 1 = second mission type, etc).", (string[] args) =>
|
commands.Add(new Command("mission", "mission [name]/[index]: Select the mission type for the next round. The parameter can either be the name or the index number of the mission type (0 = first mission type, 1 = second mission type, etc).", (string[] args) =>
|
||||||
@@ -108,6 +116,13 @@ namespace Barotrauma
|
|||||||
GameMain.NetLobbyScreen.MissionTypeName = string.Join(" ", args);
|
GameMain.NetLobbyScreen.MissionTypeName = string.Join(" ", args);
|
||||||
}
|
}
|
||||||
NewMessage("Set mission to " + GameMain.NetLobbyScreen.MissionTypeName, Color.Cyan);
|
NewMessage("Set mission to " + GameMain.NetLobbyScreen.MissionTypeName, Color.Cyan);
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
return new string[][]
|
||||||
|
{
|
||||||
|
Mission.MissionTypes.ToArray()
|
||||||
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
commands.Add(new Command("sub|submarine", "submarine [name]: Select the submarine for the next round.", (string[] args) =>
|
commands.Add(new Command("sub|submarine", "submarine [name]: Select the submarine for the next round.", (string[] args) =>
|
||||||
@@ -120,6 +135,13 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
sub = GameMain.NetLobbyScreen.SelectedSub;
|
sub = GameMain.NetLobbyScreen.SelectedSub;
|
||||||
NewMessage("Selected sub: " + sub.Name + (sub.HasTag(SubmarineTag.Shuttle) ? " (shuttle)" : ""), Color.Cyan);
|
NewMessage("Selected sub: " + sub.Name + (sub.HasTag(SubmarineTag.Shuttle) ? " (shuttle)" : ""), Color.Cyan);
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
return new string[][]
|
||||||
|
{
|
||||||
|
Submarine.Loaded.Select(s => s.Name).ToArray()
|
||||||
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
commands.Add(new Command("shuttle", "shuttle [name]: Select the specified submarine as the respawn shuttle for the next round.", (string[] args) =>
|
commands.Add(new Command("shuttle", "shuttle [name]: Select the specified submarine as the respawn shuttle for the next round.", (string[] args) =>
|
||||||
@@ -132,6 +154,13 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
shuttle = GameMain.NetLobbyScreen.SelectedShuttle;
|
shuttle = GameMain.NetLobbyScreen.SelectedShuttle;
|
||||||
NewMessage("Selected shuttle: " + shuttle.Name + (shuttle.HasTag(SubmarineTag.Shuttle) ? "" : " (not shuttle)"), Color.Cyan);
|
NewMessage("Selected shuttle: " + shuttle.Name + (shuttle.HasTag(SubmarineTag.Shuttle) ? "" : " (not shuttle)"), Color.Cyan);
|
||||||
|
},
|
||||||
|
() =>
|
||||||
|
{
|
||||||
|
return new string[][]
|
||||||
|
{
|
||||||
|
Submarine.Loaded.Select(s => s.Name).ToArray()
|
||||||
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
commands.Add(new Command("startgame|startround|start", "start/startgame/startround: Start a new round.", (string[] args) =>
|
commands.Add(new Command("startgame|startround|start", "start/startgame/startround: Start a new round.", (string[] args) =>
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using FarseerPhysics.Dynamics;
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
@@ -133,24 +134,32 @@ namespace Barotrauma
|
|||||||
|
|
||||||
Timing.Accumulator = 0.0;
|
Timing.Accumulator = 0.0;
|
||||||
|
|
||||||
DateTime prevTime = DateTime.Now;
|
double frequency = (double)Stopwatch.Frequency;
|
||||||
|
if (frequency <= 1500)
|
||||||
|
{
|
||||||
|
DebugConsole.NewMessage("WARNING: Stopwatch frequency under 1500 ticks per second. Expect significant syncing accuracy issues.", Color.Yellow);
|
||||||
|
}
|
||||||
|
|
||||||
|
Stopwatch stopwatch = Stopwatch.StartNew();
|
||||||
|
long prevTicks = stopwatch.ElapsedTicks;
|
||||||
while (ShouldRun)
|
while (ShouldRun)
|
||||||
{
|
{
|
||||||
Timing.Accumulator += ((float)(DateTime.Now.Subtract(prevTime).Milliseconds) / 1000.0)/Timing.Step;
|
long currTicks = stopwatch.ElapsedTicks;
|
||||||
prevTime = DateTime.Now;
|
Timing.Accumulator += (double)(currTicks - prevTicks) / frequency;
|
||||||
while (Timing.Accumulator>0.0)
|
prevTicks = currTicks;
|
||||||
|
while (Timing.Accumulator>=Timing.Step)
|
||||||
{
|
{
|
||||||
DebugConsole.Update();
|
DebugConsole.Update();
|
||||||
if (Screen.Selected != null) Screen.Selected.Update((float)Timing.Step);
|
if (Screen.Selected != null) Screen.Selected.Update((float)Timing.Step);
|
||||||
Server.Update((float)Timing.Step);
|
Server.Update((float)Timing.Step);
|
||||||
CoroutineManager.Update((float)Timing.Step, (float)Timing.Step);
|
CoroutineManager.Update((float)Timing.Step, (float)Timing.Step);
|
||||||
|
|
||||||
Timing.Accumulator -= 1.0;
|
Timing.Accumulator -= Timing.Step;
|
||||||
}
|
}
|
||||||
int frameTime = DateTime.Now.Subtract(prevTime).Milliseconds;
|
int frameTime = (int)(((double)(stopwatch.ElapsedTicks - prevTicks) / frequency)*1000.0);
|
||||||
Thread.Sleep(Math.Max((int)(Timing.Step * 1000.0) - frameTime/2,0));
|
Thread.Sleep(Math.Max(((int)(Timing.Step * 1000.0) - frameTime)/2,0));
|
||||||
}
|
}
|
||||||
|
stopwatch.Stop();
|
||||||
|
|
||||||
CloseServer();
|
CloseServer();
|
||||||
|
|
||||||
|
|||||||
@@ -5,14 +5,10 @@ using System.IO;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
#if WINDOWS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
#if WINDOWS || LINUX
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The main class.
|
/// The main class.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -86,5 +82,4 @@ namespace Barotrauma
|
|||||||
sw.Close();
|
sw.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -226,7 +226,7 @@
|
|||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\damageshader.fx" />
|
<Content Include="$(MSBuildThisFileDirectory)Content\damageshader.fx" />
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\InfoTexts.xml">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Texts.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Artifacts\alientools.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Artifacts\alientools.png">
|
||||||
@@ -766,6 +766,9 @@
|
|||||||
<None Include="$(MSBuildThisFileDirectory)Content\blurshader.xnb">
|
<None Include="$(MSBuildThisFileDirectory)Content\blurshader.xnb">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="$(MSBuildThisFileDirectory)Content\blurshader_opengl.xnb">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Characters\Carrier\alarm1.ogg">
|
<None Include="$(MSBuildThisFileDirectory)Content\Characters\Carrier\alarm1.ogg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
@@ -907,6 +910,9 @@
|
|||||||
<None Include="$(MSBuildThisFileDirectory)Content\damageshader.xnb">
|
<None Include="$(MSBuildThisFileDirectory)Content\damageshader.xnb">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="$(MSBuildThisFileDirectory)Content\damageshader_opengl.xnb">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Exo2-Light.otf">
|
<None Include="$(MSBuildThisFileDirectory)Content\Exo2-Light.otf">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
@@ -1054,6 +1060,12 @@
|
|||||||
<None Include="$(MSBuildThisFileDirectory)Content\Items\Weapons\syringegun.ogg">
|
<None Include="$(MSBuildThisFileDirectory)Content\Items\Weapons\syringegun.ogg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
<None Include="$(MSBuildThisFileDirectory)Content\losshader.xnb">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="$(MSBuildThisFileDirectory)Content\losshader_opengl.xnb">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Map\TutorialSub.sub">
|
<None Include="$(MSBuildThisFileDirectory)Content\Map\TutorialSub.sub">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
@@ -1485,8 +1497,8 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\MultiplayerCampaign.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\MultiplayerCampaign.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\TraitorManager.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\TraitorManager.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameSession.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameSession.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\InfoTextManager.cs" />
|
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSettings.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSettings.cs" />
|
||||||
|
<Compile Include="$(MSBuildThisFileDirectory)Source\TextManager.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Items\CharacterInventory.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\Items\CharacterInventory.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Items\Components\DockingPort.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\Items\Components\DockingPort.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Items\Components\Door.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\Items\Components\Door.cs" />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<Character name="carrier" humanoid="false" health="1000" doesbleed="false">
|
<Character name="carrier" humanoid="false" health="1000" doesbleed="false" usebloodparticles="false">
|
||||||
|
|
||||||
<sound file="Content/Characters/Carrier/alarm1.ogg" state="Attack" range="2000"/>
|
<sound file="Content/Characters/Carrier/alarm1.ogg" state="Attack" range="2000"/>
|
||||||
<sound file="Content/Characters/Carrier/carrier1.ogg" state="Attack" range="2000"/>
|
<sound file="Content/Characters/Carrier/carrier1.ogg" state="Attack" range="2000"/>
|
||||||
|
|||||||
@@ -54,12 +54,12 @@
|
|||||||
|
|
||||||
<limb id = "8" width="50" height="320">
|
<limb id = "8" width="50" height="320">
|
||||||
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="755,552,137,470" depth="0.08" origin="0.5,0.5"/>
|
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="755,552,137,470" depth="0.08" origin="0.5,0.5"/>
|
||||||
<attack range="1400" damagerange="1300" duration="0.5" damage="30" stun="5.0" force="100" torque="-100" structuredamage="500" damagetype="slash"/>
|
<attack range="1000" hitdetectiontype="Contact" duration="0.25" damage="30" stun="5.0" force="100" torque="-100" structuredamage="500" damagetype="slash"/>
|
||||||
</limb>
|
</limb>
|
||||||
|
|
||||||
<limb id = "9" width="50" height="320">
|
<limb id = "9" width="50" height="320">
|
||||||
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="892,552,137,470" depth="0.08" origin="0.6,0.5"/>
|
<sprite texture="Content/Characters/Endworm/endworm.png" sourcerect="892,552,137,470" depth="0.08" origin="0.6,0.5"/>
|
||||||
<attack range="1400" damagerange="1300" duration="0.5" damage="30" stun="5.0" force="100" torque="100" structuredamage="500" damagetype="slash"/>
|
<attack range="1000" hitdetectiontype="Contact" duration="0.25" damage="30" stun="5.0" force="100" torque="100" structuredamage="500" damagetype="slash"/>
|
||||||
</limb>
|
</limb>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<Character name="fractalguardian" humanoid="false" health="500.0" doesbleed="false">
|
<Character name="fractalguardian" humanoid="false" health="500.0" doesbleed="false" usebloodparticles="false">
|
||||||
|
|
||||||
<sound file="Content/Characters/Fractalguardian/guardian1.ogg" state="Attack" range="3000" />
|
<sound file="Content/Characters/Fractalguardian/guardian1.ogg" state="Attack" range="3000" />
|
||||||
<sound file="Content/Characters/Fractalguardian/guardian2.ogg" state="Attack" range="3000" />
|
<sound file="Content/Characters/Fractalguardian/guardian2.ogg" state="Attack" range="3000" />
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<Character name="fractalguardian" humanoid="false" health="800.0" doesbleed="false">
|
<Character name="fractalguardian" humanoid="false" health="800.0" doesbleed="false" usebloodparticles="false">
|
||||||
|
|
||||||
<sound file="Content/Characters/Fractalguardian/guardian1.ogg" state="Attack" range="3000" />
|
<sound file="Content/Characters/Fractalguardian/guardian1.ogg" state="Attack" range="3000" />
|
||||||
<sound file="Content/Characters/Fractalguardian/guardian2.ogg" state="Attack" range="3000" />
|
<sound file="Content/Characters/Fractalguardian/guardian2.ogg" state="Attack" range="3000" />
|
||||||
|
|||||||
@@ -31,6 +31,12 @@
|
|||||||
/processorParam:DebugMode=Auto
|
/processorParam:DebugMode=Auto
|
||||||
/build:damageshader.fx
|
/build:damageshader.fx
|
||||||
|
|
||||||
|
#begin losshader.fx
|
||||||
|
/importer:EffectImporter
|
||||||
|
/processor:EffectProcessor
|
||||||
|
/processorParam:DebugMode=Auto
|
||||||
|
/build:losshader.fx
|
||||||
|
|
||||||
#begin utg_4.mp4
|
#begin utg_4.mp4
|
||||||
/importer:H264Importer
|
/importer:H264Importer
|
||||||
/processor:VideoProcessor
|
/processor:VideoProcessor
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
#----------------------------- Global Properties ----------------------------#
|
||||||
|
|
||||||
|
/outputDir:bin/$(Platform)
|
||||||
|
/intermediateDir:obj/$(Platform)
|
||||||
|
/platform:DesktopGL
|
||||||
|
/config:
|
||||||
|
/profile:Reach
|
||||||
|
/compress:False
|
||||||
|
|
||||||
|
#-------------------------------- References --------------------------------#
|
||||||
|
|
||||||
|
|
||||||
|
#---------------------------------- Content ---------------------------------#
|
||||||
|
|
||||||
|
#begin watershader_opengl.fx
|
||||||
|
/importer:EffectImporter
|
||||||
|
/processor:EffectProcessor
|
||||||
|
/processorParam:DebugMode=Auto
|
||||||
|
/build:watershader_opengl.fx
|
||||||
|
|
||||||
|
#begin blurshader_opengl.fx
|
||||||
|
/importer:EffectImporter
|
||||||
|
/processor:EffectProcessor
|
||||||
|
/processorParam:DebugMode=Auto
|
||||||
|
/build:blurshader_opengl.fx
|
||||||
|
|
||||||
|
#begin damageshader_opengl.fx
|
||||||
|
/importer:EffectImporter
|
||||||
|
/processor:EffectProcessor
|
||||||
|
/processorParam:DebugMode=Auto
|
||||||
|
/build:damageshader_opengl.fx
|
||||||
|
|
||||||
|
#begin losshader_opengl.fx
|
||||||
|
/importer:EffectImporter
|
||||||
|
/processor:EffectProcessor
|
||||||
|
/processorParam:DebugMode=Auto
|
||||||
|
/build:losshader_opengl.fx
|
||||||
|
|
||||||
|
#begin utg_4.mp4
|
||||||
|
/importer:H264Importer
|
||||||
|
/processor:VideoProcessor
|
||||||
|
/build:utg_4.mp4
|
||||||
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<infotexts>
|
|
||||||
<progress>[sub] has made its way to [location].</progress>
|
|
||||||
<progress>[sub] has arrived at [location].</progress>
|
|
||||||
<return>[sub] has returned to [location].</return>
|
|
||||||
<gameover>The ocean has claimed [sub] and its crew.</gameover>
|
|
||||||
|
|
||||||
<OxygenBarInfo>Running out of oxygen!</OxygenBarInfo>
|
|
||||||
<PressureInfo>Water pressure increasing!</PressureInfo>
|
|
||||||
|
|
||||||
<CauseOfDeath.Damage>Succumbed to their injuries</CauseOfDeath.Damage>
|
|
||||||
<CauseOfDeath.Bloodloss>Bled out</CauseOfDeath.Bloodloss>
|
|
||||||
<CauseOfDeath.Drowning>Drowned</CauseOfDeath.Drowning>
|
|
||||||
<CauseOfDeath.Suffocation>Suffocated</CauseOfDeath.Suffocation>
|
|
||||||
<CauseOfDeath.Pressure>Crushed by water pressure</CauseOfDeath.Pressure>
|
|
||||||
<CauseOfDeath.Burn>Burned to death</CauseOfDeath.Burn>
|
|
||||||
<CauseOfDeath.Husk>Taken over by a parasite</CauseOfDeath.Husk>
|
|
||||||
<CauseOfDeath.Disconnected>Disconnected</CauseOfDeath.Disconnected>
|
|
||||||
|
|
||||||
<Self_CauseOfDeath.Damage>You have succumbed to your injuries.</Self_CauseOfDeath.Damage>
|
|
||||||
<Self_CauseOfDeath.Bloodloss>You have bled out.</Self_CauseOfDeath.Bloodloss>
|
|
||||||
<Self_CauseOfDeath.Drowning>You have drowned.</Self_CauseOfDeath.Drowning>
|
|
||||||
<Self_CauseOfDeath.Suffocation>You have suffocated.</Self_CauseOfDeath.Suffocation>
|
|
||||||
<Self_CauseOfDeath.Pressure>You have been crushed by water pressure.</Self_CauseOfDeath.Pressure>
|
|
||||||
<Self_CauseOfDeath.Burn>You have burned to death.</Self_CauseOfDeath.Burn>
|
|
||||||
<Self_CauseOfDeath.Husk>The parasite has taken over your body.</Self_CauseOfDeath.Husk>
|
|
||||||
<Self_CauseOfDeath.Disconnected>You were disconnected from the server.</Self_CauseOfDeath.Disconnected>
|
|
||||||
|
|
||||||
<HuskDormant>Your throat feels sore</HuskDormant>
|
|
||||||
<HuskDormant>Your feel feverish</HuskDormant>
|
|
||||||
<HuskDormant>It feels as if something was stuck in your throat</HuskDormant>
|
|
||||||
<HuskDormant>Your muscles are aching</HuskDormant>
|
|
||||||
|
|
||||||
<HuskCantSpeak>You feel something moving in your throat. You try to scream but no sound comes out.</HuskCantSpeak>
|
|
||||||
|
|
||||||
<HuskActivate>A strange chitinous appendage bursts out from your mouth. Use it to inject eggs into a living body by pressing [Attack]!</HuskActivate>
|
|
||||||
|
|
||||||
|
|
||||||
</infotexts>
|
|
||||||
@@ -92,8 +92,7 @@
|
|||||||
<Item
|
<Item
|
||||||
name="Oxygenite Shard"
|
name="Oxygenite Shard"
|
||||||
category="Alien"
|
category="Alien"
|
||||||
|
tags="alien,smallitem,oxygensource"
|
||||||
tags="alien,smallitem"
|
|
||||||
impacttolerance="8">
|
impacttolerance="8">
|
||||||
|
|
||||||
<Deconstruct time="20">
|
<Deconstruct time="20">
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<Item
|
<Item
|
||||||
name="Oxygen Tank"
|
name="Oxygen Tank"
|
||||||
category="Equipment,Misc"
|
category="Equipment,Misc"
|
||||||
Tags="smallitem"
|
Tags="smallitem,oxygensource"
|
||||||
|
|
||||||
price="50">
|
price="50">
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
|
|
||||||
<Reactor canbeselected = "true">
|
<Reactor canbeselected = "true">
|
||||||
<GuiFrame rect="0,0,760,460" alignment="Center" style="ItemUI"/>
|
<GuiFrame rect="0,0,760,460" alignment="Center" style="ItemUI"/>
|
||||||
|
<RequiredSkill name="Construction" level="30"/>
|
||||||
<StatusEffect type="InWater" target="This" Temperature="-500.0"/>
|
<StatusEffect type="InWater" target="This" Temperature="-500.0"/>
|
||||||
<StatusEffect type="OnActive" target="Contained" targetnames="Fuel Rod, Heat Absorber, Temperature Control Circuit" Condition="-0.1" />
|
<StatusEffect type="OnActive" target="Contained" targetnames="Fuel Rod, Heat Absorber, Temperature Control Circuit" Condition="-0.1" />
|
||||||
<sound file="reactor.ogg" type="OnActive" range="2000.0" volume="FissionRate" volumemultiplier="0.02" loop="true"/>
|
<sound file="reactor.ogg" type="OnActive" range="2000.0" volume="FissionRate" volumemultiplier="0.02" loop="true"/>
|
||||||
@@ -55,8 +56,7 @@
|
|||||||
|
|
||||||
<Item
|
<Item
|
||||||
name="Fuel Rod"
|
name="Fuel Rod"
|
||||||
Tags="smallitem"
|
Tags="smallitem,reactorfuel"
|
||||||
|
|
||||||
price="200">
|
price="200">
|
||||||
|
|
||||||
<Deconstruct time="10">
|
<Deconstruct time="10">
|
||||||
@@ -75,8 +75,7 @@
|
|||||||
|
|
||||||
<Item
|
<Item
|
||||||
name="Incendium Fuel Rod"
|
name="Incendium Fuel Rod"
|
||||||
Tags="smallitem"
|
Tags="smallitem,reactorfuel"
|
||||||
|
|
||||||
spritecolor="0.5,0.0,0.0,1.0">
|
spritecolor="0.5,0.0,0.0,1.0">
|
||||||
|
|
||||||
<Deconstruct time="10">
|
<Deconstruct time="10">
|
||||||
|
|||||||
@@ -124,7 +124,7 @@
|
|||||||
|
|
||||||
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true">
|
<StatusEffect type="OnUse" Condition="-100.0" stun="10.0" disabledeltatime="true">
|
||||||
<sound file="Content/Items/Weapons/bigexplosion.ogg"/>
|
<sound file="Content/Items/Weapons/bigexplosion.ogg"/>
|
||||||
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0" severlimbsprobability="0.8" decal="explosion" decalsize="1.0"/>
|
<Explosion range="1000.0" structuredamage="1000" damage="1000" stun="10" force="50.0" severlimbsprobability="1.0" decal="explosion" decalsize="1.0"/>
|
||||||
</StatusEffect>
|
</StatusEffect>
|
||||||
|
|
||||||
<StatusEffect type="OnActive" target="This">
|
<StatusEffect type="OnActive" target="This">
|
||||||
|
|||||||
@@ -82,6 +82,121 @@
|
|||||||
<animatedsprite texture="Content/Particles/Smoke.png" sourcerect="0,0,4096,4096" columns="8" rows="8" origin="0.5,0.5"/>
|
<animatedsprite texture="Content/Particles/Smoke.png" sourcerect="0,0,4096,4096" columns="8" rows="8" origin="0.5,0.5"/>
|
||||||
</waterblood>
|
</waterblood>
|
||||||
|
|
||||||
|
<bloodtrail
|
||||||
|
lifetime="0.5"
|
||||||
|
angularvelocitymin="0"
|
||||||
|
angularvelocitymax="0"
|
||||||
|
startrotationmin="0"
|
||||||
|
startrotationmax="360"
|
||||||
|
rotatetodirection="False"
|
||||||
|
drag="0"
|
||||||
|
waterdrag="0.8"
|
||||||
|
velocitychange="0,0"
|
||||||
|
collisionradius="30"
|
||||||
|
collideswithwalls="False"
|
||||||
|
deleteoncollision="False"
|
||||||
|
friction="0.01"
|
||||||
|
restitution="0.2"
|
||||||
|
startsizemin="0.6,0.6"
|
||||||
|
startsizemax="1,1"
|
||||||
|
sizechangemin="0.2,0.2"
|
||||||
|
sizechangemax="0.5,0.5"
|
||||||
|
growtime="0.05"
|
||||||
|
startcolor="0.4941176,0,0,0.4941176"
|
||||||
|
startalpha="0.5"
|
||||||
|
colorchange="0,0,0,-1"
|
||||||
|
drawtarget="Both"
|
||||||
|
blendstate="AlphaBlend"
|
||||||
|
animduration="1"
|
||||||
|
loopanim="True">
|
||||||
|
<sprite texture="Content/Particles/spatter.png" sourcerect="0,0,128,128"/>
|
||||||
|
<sprite texture="Content/Particles/spatter.png" sourcerect="128,0,128,128"/>
|
||||||
|
<sprite texture="Content/Particles/spatter.png" sourcerect="0,128,128,128"/>
|
||||||
|
</bloodtrail>
|
||||||
|
|
||||||
|
<gib
|
||||||
|
lifetime="5"
|
||||||
|
angularvelocitymin="-500"
|
||||||
|
angularvelocitymax="500"
|
||||||
|
startrotationmin="0"
|
||||||
|
startrotationmax="360"
|
||||||
|
rotatetodirection="True"
|
||||||
|
drag="0"
|
||||||
|
waterdrag="0.3"
|
||||||
|
velocitychange="0,-8"
|
||||||
|
velocitychangewater="0,-1"
|
||||||
|
collisionradius="10"
|
||||||
|
collideswithwalls="True"
|
||||||
|
deleteoncollision="False"
|
||||||
|
friction="0.5"
|
||||||
|
restitution="0.1"
|
||||||
|
startsizemin="0.3,0.3"
|
||||||
|
startsizemax="0.6,0.6"
|
||||||
|
sizechangemin="-0.1,-0.1"
|
||||||
|
sizechangemax="-0.1,-0.1"
|
||||||
|
growtime="0"
|
||||||
|
startcolor="0.2980392,0,0,1"
|
||||||
|
startalpha="1"
|
||||||
|
colorchange="0,0,0,-0.3"
|
||||||
|
drawtarget="Both"
|
||||||
|
blendstate="AlphaBlend"
|
||||||
|
animduration="1"
|
||||||
|
loopanim="True">
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="0,64,32,32"/>
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="32,64,32,32"/>
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="64,64,32,32"/>
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="96,64,32,32"/>
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="128,64,32,32"/>
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="160,64,48,32"/>
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="208,64,48,32"/>
|
||||||
|
</gib>
|
||||||
|
|
||||||
|
<heavygib
|
||||||
|
lifetime="1"
|
||||||
|
angularvelocitymin="-500"
|
||||||
|
angularvelocitymax="500"
|
||||||
|
startrotationmin="0"
|
||||||
|
startrotationmax="360"
|
||||||
|
rotatetodirection="False"
|
||||||
|
drag="0"
|
||||||
|
waterdrag="0.3"
|
||||||
|
velocitychange="0,-8"
|
||||||
|
velocitychangewater="0,-1"
|
||||||
|
collisionradius="10"
|
||||||
|
collideswithwalls="True"
|
||||||
|
deleteoncollision="True"
|
||||||
|
friction="0.5"
|
||||||
|
restitution="0.5"
|
||||||
|
startsizemin="0.8,0.8"
|
||||||
|
startsizemax="1,1"
|
||||||
|
sizechangemin="-0.5,-0.5"
|
||||||
|
sizechangemax="-0.5,-0.5"
|
||||||
|
growtime="0"
|
||||||
|
startcolor="0.2980392,0,0,1"
|
||||||
|
startalpha="1"
|
||||||
|
colorchange="0,0,0,-0.3"
|
||||||
|
drawtarget="Both"
|
||||||
|
blendstate="AlphaBlend"
|
||||||
|
animduration="1"
|
||||||
|
loopanim="True">
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="0,64,32,32"/>
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="32,64,32,32"/>
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="64,64,32,32"/>
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="96,64,32,32"/>
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="128,64,32,32"/>
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="160,64,48,32"/>
|
||||||
|
<sprite texture="Content/Particles/shrapnel.png" sourcerect="208,64,48,32"/>
|
||||||
|
|
||||||
|
<ParticleEmitter
|
||||||
|
particle="bloodtrail"
|
||||||
|
particlespersecond="10"
|
||||||
|
position="0,0"
|
||||||
|
anglemin="0"
|
||||||
|
anglemax="360"
|
||||||
|
velocitymin="10"
|
||||||
|
velocitymax="20"/>
|
||||||
|
</heavygib>
|
||||||
|
|
||||||
<spark
|
<spark
|
||||||
startsizemin="0.5,0.2" startsizemax="1.0,0.7"
|
startsizemin="0.5,0.2" startsizemax="1.0,0.7"
|
||||||
sizechangemin="-0.5,-0.5" sizechangemax="-1.0,-1.0"
|
sizechangemin="-0.5,-0.5" sizechangemax="-1.0,-1.0"
|
||||||
@@ -314,7 +429,7 @@
|
|||||||
startcolor="1.0, 1.0, 1.0" startalpha="1.0"
|
startcolor="1.0, 1.0, 1.0" startalpha="1.0"
|
||||||
colorchange="0.0, 0.0, 0.0, -0.3"
|
colorchange="0.0, 0.0, 0.0, -0.3"
|
||||||
lifetime="10.0"
|
lifetime="10.0"
|
||||||
drawtarget="both"
|
drawtarget="water"
|
||||||
collideswithwalls="true"
|
collideswithwalls="true"
|
||||||
collisionradius="10.0"
|
collisionradius="10.0"
|
||||||
restitution="0.2"
|
restitution="0.2"
|
||||||
|
|||||||
@@ -0,0 +1,314 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
<infotexts>
|
||||||
|
<!-- Main menu buttons -->
|
||||||
|
<TutorialButton>Tutorial</TutorialButton>
|
||||||
|
<NewGameButton>New Game</NewGameButton>
|
||||||
|
<LoadGameButton>Load Game</LoadGameButton>
|
||||||
|
<JoinServerButton>Join Server</JoinServerButton>
|
||||||
|
<HostServerButton>Host Server</HostServerButton>
|
||||||
|
<SubEditorButton>Submarine Editor</SubEditorButton>
|
||||||
|
<SettingsButton>Settings</SettingsButton>
|
||||||
|
<QuitButton>Quit</QuitButton>
|
||||||
|
|
||||||
|
<!-- Host server menu -->
|
||||||
|
<ServerName>Server name</ServerName>
|
||||||
|
<ServerPort>Server port</ServerPort>
|
||||||
|
<MaxPlayers>Max players</MaxPlayers>
|
||||||
|
<Password>Password</Password>
|
||||||
|
<PublicServer>Public server</PublicServer>
|
||||||
|
<PublicServerToolTip>Public servers are shown in the list of available servers in the "Join Server" -tab.</PublicServerToolTip>
|
||||||
|
<AttemptUPnP>Attempt UPnP port forwarding</AttemptUPnP>
|
||||||
|
<AttemptUPnPToolTip>UPnP can be used for forwarding ports on your router to allow players join the server. However, UPnP isn't supported by all routers, so you may need to setup port forwards manually if players are unable to join the server (see the readme for instructions).</AttemptUPnPToolTip>
|
||||||
|
<StartServerButton>Start</StartServerButton>
|
||||||
|
|
||||||
|
<!-- Settings menu -->
|
||||||
|
<Settings>Settings</Settings>
|
||||||
|
<Resolution>Resolution</Resolution>
|
||||||
|
<DisplayMode>Display mode</DisplayMode>
|
||||||
|
<Fullscreen>Fullscreen</Fullscreen>
|
||||||
|
<Windowed>Windowed</Windowed>
|
||||||
|
<BorderlessWindowed>Borderless windowed</BorderlessWindowed>
|
||||||
|
<EnableVSync>Enable vertical sync</EnableVSync>
|
||||||
|
<SoundVolume>Sound volume</SoundVolume>
|
||||||
|
<MusicVolume>Music volume</MusicVolume>
|
||||||
|
<Controls>Controls</Controls>
|
||||||
|
<ContentPackage>Content package</ContentPackage>
|
||||||
|
<ApplySettingsButton>Apply</ApplySettingsButton>
|
||||||
|
<ApplySettingsLabel>Apply changes?</ApplySettingsLabel>
|
||||||
|
<ApplySettingsQuestion>Do you want to apply the settings or discard the changes?</ApplySettingsQuestion>
|
||||||
|
<ApplySettingsYes>Apply</ApplySettingsYes>
|
||||||
|
<ApplySettingsNo>Discard</ApplySettingsNo>
|
||||||
|
<RestartRequiredLabel>Restart required</RestartRequiredLabel>
|
||||||
|
<RestartRequiredText>You need to restart the game for the resolution changes to take effect.</RestartRequiredText>
|
||||||
|
|
||||||
|
<!-- Round summary -->
|
||||||
|
<RoundSummaryProgress>[sub] has made its way to [location].</RoundSummaryProgress>
|
||||||
|
<RoundSummaryProgress>[sub] has arrived at [location].</RoundSummaryProgress>
|
||||||
|
<RoundSummaryReturn>[sub] has returned to [location].</RoundSummaryReturn>
|
||||||
|
<RoundSummaryGameOver>The ocean has claimed [sub] and its crew.</RoundSummaryGameOver>
|
||||||
|
<RoundSummaryCrewStatus>Crew status</RoundSummaryCrewStatus>
|
||||||
|
|
||||||
|
<!-- Character HUD -->
|
||||||
|
<OxygenBarInfo>Running out of oxygen!</OxygenBarInfo>
|
||||||
|
<PressureInfo>Water pressure increasing!</PressureInfo>
|
||||||
|
<Grabbing>Grabbing</Grabbing>
|
||||||
|
<Stun>Stun</Stun>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Status -->
|
||||||
|
<StatusOK>OK</StatusOK>
|
||||||
|
<Unconscious>Unconscious</Unconscious>
|
||||||
|
<Injured>Injured</Injured>
|
||||||
|
|
||||||
|
<!-- Limbs -->
|
||||||
|
<LeftHand>Left hand</LeftHand>
|
||||||
|
<RightHand>Right hand</RightHand>
|
||||||
|
<Hands>Hands</Hands>
|
||||||
|
<LeftArm>Left arm</LeftArm>
|
||||||
|
<RightArm>Right arm</RightArm>
|
||||||
|
<LeftLeg>Left leg</LeftLeg>
|
||||||
|
<RightLeg>Right leg</RightLeg>
|
||||||
|
<LeftFoot>Left foot</LeftFoot>
|
||||||
|
<RightFoot>Right foot</RightFoot>
|
||||||
|
<Head>Head</Head>
|
||||||
|
<Torso>Torso</Torso>
|
||||||
|
<Tail>Tail</Tail>
|
||||||
|
<Legs>Legs</Legs>
|
||||||
|
<RightThigh>Right thigh</RightThigh>
|
||||||
|
<LeftThigh>Left thigh</LeftThigh>
|
||||||
|
<Waist>Waist</Waist>
|
||||||
|
|
||||||
|
<!-- Misc -->
|
||||||
|
<Yes>Yes</Yes>
|
||||||
|
<No>No</No>
|
||||||
|
<OK>OK</OK>
|
||||||
|
<Skills>Skills</Skills>
|
||||||
|
<Male>Male</Male>
|
||||||
|
<Female>Female</Female>
|
||||||
|
<Order>Order</Order>
|
||||||
|
<Submarine>Submarine</Submarine>
|
||||||
|
<Shuttle>Shuttle</Shuttle>
|
||||||
|
<RespawnShuttle>Respawn shuttle</RespawnShuttle>
|
||||||
|
<Editing>Editing</Editing>
|
||||||
|
<Error>Error</Error>
|
||||||
|
<Warning>Warning</Warning>
|
||||||
|
<None>None</None>
|
||||||
|
<Close>Close</Close>
|
||||||
|
<Cancel>Cancel</Cancel>
|
||||||
|
<Delete>Delete</Delete>
|
||||||
|
<Load>Load</Load>
|
||||||
|
<Back>Back</Back>
|
||||||
|
<ManagePlayers>Manage players</ManagePlayers>
|
||||||
|
|
||||||
|
<DeleteDialogLabel>Delete file?</DeleteDialogLabel>
|
||||||
|
<DeleteDialogQuestion>Are you sure you want to delete "[file]"?</DeleteDialogQuestion>
|
||||||
|
<DeleteFileError>Could not delete file "[file]"!</DeleteFileError>
|
||||||
|
|
||||||
|
<!-- Pronouns -->
|
||||||
|
<PronounMale>He</PronounMale>
|
||||||
|
<PronounPossessiveMale>His</PronounPossessiveMale>
|
||||||
|
<PronounReflexiveMale>Himself</PronounReflexiveMale>
|
||||||
|
<PronounFemale>She</PronounFemale>
|
||||||
|
<PronounPossessiveFemale>Her</PronounPossessiveFemale>
|
||||||
|
<PronounReflexiveFemale>Herself</PronounReflexiveFemale>
|
||||||
|
|
||||||
|
<!-- Mission info -->
|
||||||
|
<NoMission>No mission</NoMission>
|
||||||
|
<MissionReward>Reward: [reward]</MissionReward>
|
||||||
|
|
||||||
|
<!-- Campaign setup menu -->
|
||||||
|
<LoadButton>Load</LoadButton>
|
||||||
|
<DeleteButton>Delete</DeleteButton>
|
||||||
|
<SubNotSelected>Submarine not selected!</SubNotSelected>
|
||||||
|
<SelectSubRequest>Please select a submarine.</SelectSubRequest>
|
||||||
|
<SelectedSub>Selected submarine</SelectedSub>
|
||||||
|
<SaveName>Save name</SaveName>
|
||||||
|
<LastSaved>Last saved</LastSaved>
|
||||||
|
<MapSeed>Map seed</MapSeed>
|
||||||
|
<StartCampaignButton>Start</StartCampaignButton>
|
||||||
|
|
||||||
|
<ShuttleSelected>Shuttle selected</ShuttleSelected>
|
||||||
|
<ShuttleWarning>Most shuttles are not adequately equipped to deal with the dangers of the Europan depths. Are you sure you want to choose a shuttle as your vessel?</ShuttleWarning>
|
||||||
|
|
||||||
|
<!-- Campaign menu -->
|
||||||
|
<Map>Map</Map>
|
||||||
|
<Crew>Crew</Crew>
|
||||||
|
<Store>Store</Store>
|
||||||
|
<Hire>Hire</Hire>
|
||||||
|
<Location>Location</Location>
|
||||||
|
<HireUnavailable>No-one available for hire.</HireUnavailable>
|
||||||
|
<Mission>Mission</Mission>
|
||||||
|
<Reward>Reward</Reward>
|
||||||
|
<Credit>Credit</Credit>
|
||||||
|
<Credits>Credits</Credits>
|
||||||
|
|
||||||
|
<!-- Server list -->
|
||||||
|
<JoinServer>Join server</JoinServer>
|
||||||
|
<YourName>Your name</YourName>
|
||||||
|
<ServerIP>Server IP</ServerIP>
|
||||||
|
<ServerListName>Name</ServerListName>
|
||||||
|
<ServerListPlayers>Players</ServerListPlayers>
|
||||||
|
<ServerListRoundStarted>Round started</ServerListRoundStarted>
|
||||||
|
<ServerListRefresh>Refresh</ServerListRefresh>
|
||||||
|
<ServerListJoin>Join</ServerListJoin>
|
||||||
|
<FilterServers>Filter servers</FilterServers>
|
||||||
|
<FilterPassword>No password required</FilterPassword>
|
||||||
|
<FilterFullServers>Hide full servers</FilterFullServers>
|
||||||
|
<FilterEmptyServers>Hide empty servers</FilterEmptyServers>
|
||||||
|
<NoMatchingServers>No matching servers found.</NoMatchingServers>
|
||||||
|
<RefreshingServerList>Refreshing server list...</RefreshingServerList>
|
||||||
|
<NoServers>Could not find any servers.</NoServers>
|
||||||
|
<MasterServerErrorLabel>Connection error</MasterServerErrorLabel>
|
||||||
|
<MasterServerTimeOutError>Could not connect to master server (request timed out).</MasterServerTimeOutError>
|
||||||
|
<MasterServerErrorException>Error while connecting to master server { [error] }</MasterServerErrorException>
|
||||||
|
<MasterServerError404>Error while connecting to master server (404 - [masterserverurl] not found)</MasterServerError404>
|
||||||
|
<MasterServerErrorUnavailable>Error while connecting to master server (505 - Service Unavailable). The master server may be down for maintenance or temporarily overloaded. Please try again after in a few moments.</MasterServerErrorUnavailable>
|
||||||
|
<MasterServerErrorDefault>Error while connecting to master server ([statuscode]: [statusdescription])</MasterServerErrorDefault>
|
||||||
|
|
||||||
|
<!-- Server lobby -->
|
||||||
|
<RestartingIn>Restarting in</RestartingIn>
|
||||||
|
<Votes>Votes</Votes>
|
||||||
|
<GameMode>Game mode</GameMode>
|
||||||
|
<MissionType>Mission type</MissionType>
|
||||||
|
<Random>Random</Random>
|
||||||
|
<LevelSeed>Level seed</LevelSeed>
|
||||||
|
<Traitors>Traitors</Traitors>
|
||||||
|
<AutoRestart>Automatic restart</AutoRestart>
|
||||||
|
<ServerLog>Server log</ServerLog>
|
||||||
|
<CampaignView>Campaign view</CampaignView>
|
||||||
|
<PlayYourself>Play yourself</PlayYourself>
|
||||||
|
<StartGameButton>Start</StartGameButton>
|
||||||
|
<ServerSettingsButton>Settings</ServerSettingsButton>
|
||||||
|
<SpectateButton>Spectate</SpectateButton>
|
||||||
|
<Gender>Gender</Gender>
|
||||||
|
<JobPreferences>Job preferences</JobPreferences>
|
||||||
|
<PlayingAsSpectator>Playing as a spectator</PlayingAsSpectator>
|
||||||
|
<SubNotFound>Submarine not found in your submarine folder</SubNotFound>
|
||||||
|
<SubDoesntMatch>Your version of the submarine doesn't match the servers version</SubDoesntMatch>
|
||||||
|
<Rank>Rank</Rank>
|
||||||
|
<CustomRank>Custom</CustomRank>
|
||||||
|
<Permissions>Permissions</Permissions>
|
||||||
|
<PermittedConsoleCommands>Permitted console commands</PermittedConsoleCommands>
|
||||||
|
<Kick>Kick</Kick>
|
||||||
|
<Ban>Ban</Ban>
|
||||||
|
<BanRange>Ban range</BanRange>
|
||||||
|
<PrivateMessageTag>[PM]</PrivateMessageTag>
|
||||||
|
<SubNotFoundError>Submarine [subname] was selected by the server. Matching file not found in your submarine folder.</SubNotFoundError>
|
||||||
|
<SubLoadError>Could not load submarine [subname]. The file may be corrupted.</SubLoadError>
|
||||||
|
<SubDoesntMatchError>Your version of the submarine file [subname] does not match the server's version!\nYour MD5 hash: [myhash]\nServer's MD5 hash: [serverhash]\n</SubDoesntMatchError>
|
||||||
|
<DownloadSubLabel>Submarine not found!</DownloadSubLabel>
|
||||||
|
<DownloadSubQuestion>Do you want to download the file from the server host?</DownloadSubQuestion>
|
||||||
|
|
||||||
|
<!-- Sub editor -->
|
||||||
|
<Items>Items</Items>
|
||||||
|
<Structures>Structures</Structures>
|
||||||
|
<TotalHullVolume>Total hull volume</TotalHullVolume>
|
||||||
|
<SelectedHullVolume>Selected hull volume</SelectedHullVolume>
|
||||||
|
<OptimalBallastLevel>optimal neutral ballast level is [value]</OptimalBallastLevel>
|
||||||
|
<InsufficientBallast>insufficient volume for buoyancy control</InsufficientBallast>
|
||||||
|
<PhysicsBodies>Physics bodies</PhysicsBodies>
|
||||||
|
<OpenSubButton>Open...</OpenSubButton>
|
||||||
|
<SaveSubButton>Save</SaveSubButton>
|
||||||
|
<AddSubButton>Add submarine</AddSubButton>
|
||||||
|
<AddSubToolTip>Places another submarine into the current submarine file. Can be used for adding things such as smaller vessels, escape pods or detachable sections into the main submarine.</AddSubToolTip>
|
||||||
|
<FilterMapEntities>Filter</FilterMapEntities>
|
||||||
|
<CharacterModeButton>Character mode</CharacterModeButton>
|
||||||
|
<CharacterModeToolTip>Allows you to pick up and use items. Useful for things such as placing items inside closets, turning devices on/off and doing the wiring.</CharacterModeToolTip>
|
||||||
|
<WiringModeButton>Wiring mode</WiringModeButton>
|
||||||
|
<WiringModeToolTip>Allows you to connect wires between items.</WiringModeToolTip>
|
||||||
|
<GenerateWaypointsButton>Generate waypoints</GenerateWaypointsButton>
|
||||||
|
<GenerateWaypointsToolTip>AI controlled crew members require waypoints to navigate around the sub.</GenerateWaypointsToolTip>
|
||||||
|
<ShowEntitiesLabel>Show</ShowEntitiesLabel>
|
||||||
|
<ShowWaypoints>Waypoints</ShowWaypoints>
|
||||||
|
<ShowSpawnpoints>Spawnpoints</ShowSpawnpoints>
|
||||||
|
<ShowLinks>Links</ShowLinks>
|
||||||
|
<ShowHulls>Hulls</ShowHulls>
|
||||||
|
<ShowGaps>Gaps</ShowGaps>
|
||||||
|
<PreviouslyUsedLabel>Previously used</PreviouslyUsedLabel>
|
||||||
|
<SubNameMissingWarning>Name your submarine before saving it.</SubNameMissingWarning>
|
||||||
|
<SubNameIllegalCharsWarning>Illegal symbols in filename ([illegalchar])</SubNameIllegalCharsWarning>
|
||||||
|
<SubSavedNotification>Submarine saved to [filepath].</SubSavedNotification>
|
||||||
|
<SaveSubDialogHeader>Save submarine</SaveSubDialogHeader>
|
||||||
|
<SaveSubDialogName>Name</SaveSubDialogName>
|
||||||
|
<SaveSubDialogDescription>Description</SaveSubDialogDescription>
|
||||||
|
<SaveSubDialogSettings>Settings</SaveSubDialogSettings>
|
||||||
|
<NoHullsWarning>No hulls found in the submarine. Hulls determine the "borders" of an individual room and are required for water and air distribution to work correctly.</NoHullsWarning>
|
||||||
|
<DisconnectedVentsWarning>The submarine contains vents which haven't been linked to an oxygen generator. Select a vent and click an oxygen generator while holding space to link them.</DisconnectedVentsWarning>
|
||||||
|
<NoWaypointsWarning>No waypoints found in the submarine. AI controlled crew members won't be able to navigate without waypoints.</NoWaypointsWarning>
|
||||||
|
<NoCargoSpawnpointWarning>"The submarine does not have spawnpoints for cargo (which are used for determining where to place bought items). To fix this, create a new spawnpoint and change its "spawn type" parameter to "cargo".</NoCargoSpawnpointWarning>
|
||||||
|
<FarAwayEntitiesWarning>One or more structures have been placed very far from the submarine. Show the structures?</FarAwayEntitiesWarning>
|
||||||
|
|
||||||
|
<!-- Waypoints -->
|
||||||
|
<Waypoint>Waypoint</Waypoint>
|
||||||
|
<LinkWaypoint>Hold space to link to another waypoint</LinkWaypoint>
|
||||||
|
<Spawnpoint>Spawnpoint</Spawnpoint>
|
||||||
|
<SpawnType>Spawn type</SpawnType>
|
||||||
|
<IDCardDescription>ID Card description</IDCardDescription>
|
||||||
|
<IDCardDescriptionTooltip>Characters spawning at this spawnpoint will have the specified description added to their ID card. This can be used to describe additional access levels their card has on the sub.</IDCardDescriptionTooltip>
|
||||||
|
<IDCardTags>ID Card tags</IDCardTags>
|
||||||
|
<IDCardTagsTooltip>Characters spawning at this spawnpoint will have the specified tags added to their ID card. You can, for example, use these tags to limit access to some parts of the sub.</IDCardTagsTooltip>
|
||||||
|
<SpawnpointJobs>Assigned jobs</SpawnpointJobs>
|
||||||
|
<SpawnpointJobsTooltip>Only characters with the specified job will spawn at this spawnpoint.</SpawnpointJobsTooltip>
|
||||||
|
|
||||||
|
<!-- Linked subs -->
|
||||||
|
<LinkedSub>Linked submarine</LinkedSub>
|
||||||
|
<ReloadLinkedSub>Refresh</ReloadLinkedSub>
|
||||||
|
<ReloadLinkedSubTooltip>Reload the linked submarine from the specified file</ReloadLinkedSubTooltip>
|
||||||
|
<LinkLinkedSub>Hold space to link to a docking port</LinkLinkedSub>
|
||||||
|
<ReloadLinkedSubError>Submarine file [file] not found!</ReloadLinkedSubError>
|
||||||
|
|
||||||
|
<!-- Chat -->
|
||||||
|
<SpamFilterKicked>You have been kicked by the spam filter.</SpamFilterKicked>
|
||||||
|
<SpamFilterBlocked>You have been blocked by the spam filter. Try again after 10 seconds.</SpamFilterBlocked>
|
||||||
|
|
||||||
|
<!-- Item fixing -->
|
||||||
|
<FixHeader>Attempting to fix [itemname]</FixHeader>
|
||||||
|
<FixButton>Fix</FixButton>
|
||||||
|
|
||||||
|
<!-- Traitors -->
|
||||||
|
<NewTraitor>New traitor</NewTraitor>
|
||||||
|
<TraitorStartMessage>You are the Traitor! Your secret task is to assassinate [targetname]! Discretion is an utmost concern; sinking the submarine and killing the entire crew will arouse suspicion amongst the Fleet. If possible, make the death look like an accident.</TraitorStartMessage>
|
||||||
|
<TraitorMoreAgentsMessage>It is possible that there are other agents on this submarine. You don't know their names, but you do have a method of communication. Use the code words to greet the agent and code response to respond. Disguise such words in a normal-looking phrase so the crew doesn't suspect anything.\n\nThe code words are: [codewords].\nThe code response is: [coderesponse].</TraitorMoreAgentsMessage>
|
||||||
|
<TraitorStartMessageServer>[traitorname] is the traitor and the target is [targetname].</TraitorStartMessageServer>
|
||||||
|
|
||||||
|
<TraitorEndMessageSuccess>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task was successful.</TraitorEndMessageSuccess>
|
||||||
|
<TraitorEndMessageSuccessTraitorDead>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task was successful, but the traitor did not make it out alive either.</TraitorEndMessageSuccessTraitorDead>
|
||||||
|
<TraitorEndMessageSuccessTraitorDetained>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task was successful, but the traitor was succesfully detained.</TraitorEndMessageSuccessTraitorDetained>
|
||||||
|
<TraitorEndMessageFailure>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task was unsuccessful.</TraitorEndMessageFailure>
|
||||||
|
<TraitorEndMessageFailureTraitorDead>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname], but [genderpronoun] got [genderpronounreflexive] killed before completing it.</TraitorEndMessageFailureTraitorDead>
|
||||||
|
<TraitorEndMessageFailureTraitorDetained>[traitorname] was a traitor! [Genderpronounpossessive] task was to assassinate [targetname]. The task failed - [genderpronoun] was successfully detained.</TraitorEndMessageFailureTraitorDetained>
|
||||||
|
|
||||||
|
<!-- Causes of death -->
|
||||||
|
<CauseOfDeath.Damage>Succumbed to their injuries</CauseOfDeath.Damage>
|
||||||
|
<CauseOfDeath.Bloodloss>Bled out</CauseOfDeath.Bloodloss>
|
||||||
|
<CauseOfDeath.Drowning>Drowned</CauseOfDeath.Drowning>
|
||||||
|
<CauseOfDeath.Suffocation>Suffocated</CauseOfDeath.Suffocation>
|
||||||
|
<CauseOfDeath.Pressure>Crushed by water pressure</CauseOfDeath.Pressure>
|
||||||
|
<CauseOfDeath.Burn>Burned to death</CauseOfDeath.Burn>
|
||||||
|
<CauseOfDeath.Husk>Taken over by a parasite</CauseOfDeath.Husk>
|
||||||
|
<CauseOfDeath.Disconnected>Disconnected</CauseOfDeath.Disconnected>
|
||||||
|
|
||||||
|
<Self_CauseOfDeath.Damage>You have succumbed to your injuries.</Self_CauseOfDeath.Damage>
|
||||||
|
<Self_CauseOfDeath.Bloodloss>You have bled out.</Self_CauseOfDeath.Bloodloss>
|
||||||
|
<Self_CauseOfDeath.Drowning>You have drowned.</Self_CauseOfDeath.Drowning>
|
||||||
|
<Self_CauseOfDeath.Suffocation>You have suffocated.</Self_CauseOfDeath.Suffocation>
|
||||||
|
<Self_CauseOfDeath.Pressure>You have been crushed by water pressure.</Self_CauseOfDeath.Pressure>
|
||||||
|
<Self_CauseOfDeath.Burn>You have burned to death.</Self_CauseOfDeath.Burn>
|
||||||
|
<Self_CauseOfDeath.Husk>The parasite has taken over your body.</Self_CauseOfDeath.Husk>
|
||||||
|
<Self_CauseOfDeath.Disconnected>You were disconnected from the server.</Self_CauseOfDeath.Disconnected>
|
||||||
|
|
||||||
|
<GiveInButton>Give in</GiveInButton>
|
||||||
|
<GiveInHelpMultiplayer>Let go of your character and enter spectator mode (other players will no longer be able to revive you)</GiveInHelpMultiplayer>
|
||||||
|
<GiveInHelpSingleplayer>"The character can no longer be revived if you give in."</GiveInHelpSingleplayer>
|
||||||
|
|
||||||
|
<!-- Huskification -->
|
||||||
|
<HuskDormant>Your throat feels sore</HuskDormant>
|
||||||
|
<HuskDormant>Your feel feverish</HuskDormant>
|
||||||
|
<HuskDormant>It feels as if something was stuck in your throat</HuskDormant>
|
||||||
|
<HuskDormant>Your muscles are aching</HuskDormant>
|
||||||
|
<HuskCantSpeak>You feel something moving in your throat. You try to scream but no sound comes out.</HuskCantSpeak>
|
||||||
|
<HuskActivate>A strange chitinous appendage bursts out from your mouth. Use it to inject eggs into a living body by pressing [Attack]!</HuskActivate>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</infotexts>
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
// Pixel shader applies a one dimensional gaussian blur filter.
|
||||||
|
// This is used twice by the bloom postprocess, first to
|
||||||
|
// blur horizontally, and then again to blur vertically.
|
||||||
|
|
||||||
|
sampler TextureSampler : register(s0);
|
||||||
|
|
||||||
|
#define SAMPLE_COUNT 15
|
||||||
|
|
||||||
|
float2 SampleOffsets[SAMPLE_COUNT];
|
||||||
|
float SampleWeights[SAMPLE_COUNT];
|
||||||
|
|
||||||
|
|
||||||
|
float4 PixelShaderF(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||||
|
{
|
||||||
|
float4 c = 0;
|
||||||
|
|
||||||
|
// Combine a number of weighted image filter taps.
|
||||||
|
for (int i = 0; i < SAMPLE_COUNT; i++)
|
||||||
|
{
|
||||||
|
c += tex2D(TextureSampler, texCoord + SampleOffsets[i]) * SampleWeights[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
technique GaussianBlur
|
||||||
|
{
|
||||||
|
pass Pass1
|
||||||
|
{
|
||||||
|
PixelShader = compile ps_2_0 PixelShaderF();
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -1,10 +1,11 @@
|
|||||||
|
|
||||||
Texture xTexture;
|
Texture2D xTexture;
|
||||||
sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; };
|
sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; };
|
||||||
|
|
||||||
Texture xStencil;
|
Texture2D xStencil;
|
||||||
sampler StencilSampler = sampler_state { Texture = <xStencil>; };
|
sampler StencilSampler = sampler_state { Texture = <xStencil>; };
|
||||||
|
|
||||||
|
float4 inColor;
|
||||||
|
|
||||||
float aCutoff;
|
float aCutoff;
|
||||||
float aMultiplier;
|
float aMultiplier;
|
||||||
@@ -14,9 +15,9 @@ float cMultiplier;
|
|||||||
|
|
||||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||||
{
|
{
|
||||||
float4 c = tex2D(TextureSampler, texCoord);
|
float4 c = xTexture.Sample(TextureSampler, texCoord) * inColor;
|
||||||
|
|
||||||
float4 stencilColor = tex2D(StencilSampler, texCoord);
|
float4 stencilColor = xStencil.Sample(StencilSampler, texCoord);
|
||||||
|
|
||||||
float aDiff = stencilColor.a - aCutoff;
|
float aDiff = stencilColor.a - aCutoff;
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -0,0 +1,39 @@
|
|||||||
|
|
||||||
|
Texture xTexture;
|
||||||
|
sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; };
|
||||||
|
|
||||||
|
Texture xStencil;
|
||||||
|
sampler StencilSampler = sampler_state { Texture = <xStencil>; };
|
||||||
|
|
||||||
|
float4 inColor;
|
||||||
|
|
||||||
|
float aCutoff;
|
||||||
|
float aMultiplier;
|
||||||
|
|
||||||
|
float cCutoff;
|
||||||
|
float cMultiplier;
|
||||||
|
|
||||||
|
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||||
|
{
|
||||||
|
float4 c = tex2D(TextureSampler, texCoord) * inColor;
|
||||||
|
|
||||||
|
float4 stencilColor = tex2D(StencilSampler, texCoord);
|
||||||
|
|
||||||
|
float aDiff = stencilColor.a - aCutoff;
|
||||||
|
|
||||||
|
clip(aDiff);
|
||||||
|
|
||||||
|
float cDiff = stencilColor.a - cCutoff;
|
||||||
|
|
||||||
|
return float4(
|
||||||
|
lerp(stencilColor.rgb, c.rgb, clamp(cDiff * cMultiplier, 0.0f, 1.0f)),
|
||||||
|
min(aDiff * aMultiplier, c.a));
|
||||||
|
}
|
||||||
|
|
||||||
|
technique StencilShader
|
||||||
|
{
|
||||||
|
pass Pass1
|
||||||
|
{
|
||||||
|
PixelShader = compile ps_2_0 main();
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
Texture2D xTexture;
|
||||||
|
sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; };
|
||||||
|
|
||||||
|
Texture2D xLosTexture;
|
||||||
|
sampler LosSampler = sampler_state { Texture = <xLosTexture>; };
|
||||||
|
|
||||||
|
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||||
|
{
|
||||||
|
float4 losColor = xLosTexture.Sample(LosSampler, texCoord);
|
||||||
|
float4 sample = xTexture.Sample(TextureSampler, texCoord);
|
||||||
|
|
||||||
|
float4 outColor = float4(sample.x*losColor.x, sample.y*losColor.x, sample.z*losColor.x, losColor.x);
|
||||||
|
|
||||||
|
return outColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
technique LosShader
|
||||||
|
{
|
||||||
|
pass Pass1
|
||||||
|
{
|
||||||
|
PixelShader = compile ps_4_0_level_9_1 main();
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -0,0 +1,24 @@
|
|||||||
|
|
||||||
|
Texture2D xTexture;
|
||||||
|
sampler TextureSampler : register (s0) = sampler_state { Texture = <xTexture>; };
|
||||||
|
|
||||||
|
Texture2D xLosTexture;
|
||||||
|
sampler LosSampler = sampler_state { Texture = <xLosTexture>; };
|
||||||
|
|
||||||
|
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||||
|
{
|
||||||
|
float4 losColor = tex2D(LosSampler, texCoord);
|
||||||
|
float4 sample = tex2D(TextureSampler, texCoord);
|
||||||
|
|
||||||
|
float4 outColor = float4(sample.x*losColor.x, sample.y*losColor.x, sample.z*losColor.x, losColor.x);
|
||||||
|
|
||||||
|
return outColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
technique LosShader
|
||||||
|
{
|
||||||
|
pass Pass1
|
||||||
|
{
|
||||||
|
PixelShader = compile ps_2_0 main();
|
||||||
|
}
|
||||||
|
}
|
||||||
Binary file not shown.
@@ -1,13 +1,9 @@
|
|||||||
float xBlurDistance;
|
float xBlurDistance;
|
||||||
|
|
||||||
Texture xTexture;
|
Texture2D xTexture;
|
||||||
sampler TextureSampler = sampler_state { Texture = <xTexture>; };
|
sampler TextureSampler = sampler_state { Texture = <xTexture>; };
|
||||||
|
|
||||||
Texture xLosTexture;
|
Texture2D xWaterBumpMap;
|
||||||
sampler LosSampler = sampler_state { Texture = <xLosTexture>; };
|
|
||||||
|
|
||||||
|
|
||||||
Texture xWaterBumpMap;
|
|
||||||
sampler WaterBumpSampler =
|
sampler WaterBumpSampler =
|
||||||
sampler_state
|
sampler_state
|
||||||
{
|
{
|
||||||
@@ -26,8 +22,8 @@ float2 xBumpPos;
|
|||||||
|
|
||||||
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||||
{
|
{
|
||||||
float4 bumpColor = tex2D(WaterBumpSampler, texCoord+xWavePos+xBumpPos);
|
float4 bumpColor = xWaterBumpMap.Sample(WaterBumpSampler, texCoord+xWavePos+xBumpPos);
|
||||||
bumpColor = (bumpColor + tex2D(WaterBumpSampler, texCoord-xWavePos*2.0f+xBumpPos))*0.5f;
|
bumpColor = (bumpColor + xWaterBumpMap.Sample(WaterBumpSampler, texCoord-xWavePos*2.0f+xBumpPos))*0.5f;
|
||||||
|
|
||||||
float2 samplePos = texCoord;
|
float2 samplePos = texCoord;
|
||||||
|
|
||||||
@@ -35,26 +31,16 @@ float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoor
|
|||||||
samplePos.y+=(bumpColor.g-0.5f)*xWaveHeight;
|
samplePos.y+=(bumpColor.g-0.5f)*xWaveHeight;
|
||||||
|
|
||||||
float4 sample;
|
float4 sample;
|
||||||
sample = tex2D( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y+xBlurDistance));
|
sample = xTexture.Sample( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y+xBlurDistance));
|
||||||
sample += tex2D( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y-xBlurDistance));
|
sample += xTexture.Sample( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y-xBlurDistance));
|
||||||
sample += tex2D( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y-xBlurDistance));
|
sample += xTexture.Sample( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y-xBlurDistance));
|
||||||
sample += tex2D( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y+xBlurDistance));
|
sample += xTexture.Sample( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y+xBlurDistance));
|
||||||
|
|
||||||
sample = sample * 0.25;
|
sample = sample * 0.25;
|
||||||
|
|
||||||
return sample;
|
return sample;
|
||||||
}
|
}
|
||||||
|
|
||||||
float4 main2(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
|
||||||
{
|
|
||||||
float4 losColor = tex2D(LosSampler, texCoord);
|
|
||||||
|
|
||||||
float4 outColor = float4(losColor.x, losColor.y, losColor.z, color.w);
|
|
||||||
|
|
||||||
return outColor;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
technique WaterShader
|
technique WaterShader
|
||||||
{
|
{
|
||||||
pass Pass1
|
pass Pass1
|
||||||
@@ -62,11 +48,3 @@ technique WaterShader
|
|||||||
PixelShader = compile ps_4_0_level_9_1 main();
|
PixelShader = compile ps_4_0_level_9_1 main();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
technique LosShader
|
|
||||||
{
|
|
||||||
pass Pass1
|
|
||||||
{
|
|
||||||
PixelShader = compile ps_4_0_level_9_1 main2();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Binary file not shown.
@@ -0,0 +1,50 @@
|
|||||||
|
float xBlurDistance;
|
||||||
|
|
||||||
|
Texture xTexture;
|
||||||
|
sampler TextureSampler = sampler_state { Texture = <xTexture>; };
|
||||||
|
|
||||||
|
Texture xWaterBumpMap;
|
||||||
|
sampler WaterBumpSampler =
|
||||||
|
sampler_state
|
||||||
|
{
|
||||||
|
Texture = <xWaterBumpMap>;
|
||||||
|
MagFilter = LINEAR;
|
||||||
|
MinFilter = LINEAR;
|
||||||
|
MipFilter = LINEAR;
|
||||||
|
AddressU = WRAP;
|
||||||
|
AddressV = WRAP;
|
||||||
|
};
|
||||||
|
|
||||||
|
float xWaveWidth;
|
||||||
|
float xWaveHeight;
|
||||||
|
float2 xWavePos;
|
||||||
|
float2 xBumpPos;
|
||||||
|
|
||||||
|
float4 main(float4 position : SV_Position, float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
|
||||||
|
{
|
||||||
|
float4 bumpColor = tex2D(WaterBumpSampler, texCoord+xWavePos+xBumpPos);
|
||||||
|
bumpColor = (bumpColor + tex2D(WaterBumpSampler, texCoord-xWavePos*2.0f+xBumpPos))*0.5f;
|
||||||
|
|
||||||
|
float2 samplePos = texCoord;
|
||||||
|
|
||||||
|
samplePos.x+=(bumpColor.r-0.5f)*xWaveWidth;
|
||||||
|
samplePos.y+=(bumpColor.g-0.5f)*xWaveHeight;
|
||||||
|
|
||||||
|
float4 sample;
|
||||||
|
sample = tex2D( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y+xBlurDistance));
|
||||||
|
sample += tex2D( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y-xBlurDistance));
|
||||||
|
sample += tex2D( TextureSampler, float2(samplePos.x+xBlurDistance, samplePos.y-xBlurDistance));
|
||||||
|
sample += tex2D( TextureSampler, float2(samplePos.x-xBlurDistance, samplePos.y+xBlurDistance));
|
||||||
|
|
||||||
|
sample = sample * 0.25;
|
||||||
|
|
||||||
|
return sample;
|
||||||
|
}
|
||||||
|
|
||||||
|
technique WaterShader
|
||||||
|
{
|
||||||
|
pass Pass1
|
||||||
|
{
|
||||||
|
PixelShader = compile ps_2_0 main();
|
||||||
|
}
|
||||||
|
}
|
||||||
Regular → Executable
BIN
Binary file not shown.
+54
-11
@@ -1,29 +1,63 @@
|
|||||||
using Barotrauma.Items.Components;
|
using Barotrauma.Items.Components;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
class AIObjectiveContainItem: AIObjective
|
class AIObjectiveContainItem: AIObjective
|
||||||
{
|
{
|
||||||
private string itemName;
|
public int MinContainedAmount = 1;
|
||||||
|
|
||||||
|
private string[] itemNames;
|
||||||
|
|
||||||
private ItemContainer container;
|
private ItemContainer container;
|
||||||
|
|
||||||
bool isCompleted;
|
private bool isCompleted;
|
||||||
|
|
||||||
public bool IgnoreAlreadyContainedItems;
|
public bool IgnoreAlreadyContainedItems;
|
||||||
|
|
||||||
|
public Func<Item, float> GetItemPriority;
|
||||||
|
|
||||||
|
private AIObjectiveGetItem getItemObjective;
|
||||||
|
private AIObjectiveGoTo goToObjective;
|
||||||
|
|
||||||
public AIObjectiveContainItem(Character character, string itemName, ItemContainer container)
|
public AIObjectiveContainItem(Character character, string itemName, ItemContainer container)
|
||||||
|
: this(character, new string[] { itemName }, container)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public AIObjectiveContainItem(Character character, string[] itemNames, ItemContainer container)
|
||||||
: base (character, "")
|
: base (character, "")
|
||||||
{
|
{
|
||||||
this.itemName = itemName;
|
this.itemNames = itemNames;
|
||||||
this.container = container;
|
this.container = container;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsCompleted()
|
public override bool IsCompleted()
|
||||||
{
|
{
|
||||||
return isCompleted || container.Inventory.FindItem(itemName)!=null;
|
if (isCompleted) return true;
|
||||||
|
|
||||||
|
int containedItemCount = 0;
|
||||||
|
foreach (Item item in container.Inventory.Items)
|
||||||
|
{
|
||||||
|
if (item != null && itemNames.Any(name => item.Prefab.NameMatches(name) || item.HasTag(name))) containedItemCount++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return containedItemCount >= MinContainedAmount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override bool CanBeCompleted
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (goToObjective != null)
|
||||||
|
{
|
||||||
|
return goToObjective.CanBeCompleted;
|
||||||
|
}
|
||||||
|
|
||||||
|
return getItemObjective == null || !getItemObjective.CanBeCompleted;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override float GetPriority(AIObjectiveManager objectiveManager)
|
public override float GetPriority(AIObjectiveManager objectiveManager)
|
||||||
@@ -41,12 +75,13 @@ namespace Barotrauma
|
|||||||
if (isCompleted) return;
|
if (isCompleted) return;
|
||||||
|
|
||||||
//get the item that should be contained
|
//get the item that should be contained
|
||||||
var itemToContain = character.Inventory.FindItem(itemName);
|
var itemToContain = character.Inventory.FindItem(itemNames);
|
||||||
if (itemToContain == null)
|
if (itemToContain == null)
|
||||||
{
|
{
|
||||||
var getItem = new AIObjectiveGetItem(character, itemName);
|
getItemObjective = new AIObjectiveGetItem(character, itemNames);
|
||||||
getItem.IgnoreContainedItems = IgnoreAlreadyContainedItems;
|
getItemObjective.GetItemPriority = GetItemPriority;
|
||||||
AddSubObjective(getItem);
|
getItemObjective.IgnoreContainedItems = IgnoreAlreadyContainedItems;
|
||||||
|
AddSubObjective(getItemObjective);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,9 +98,10 @@ namespace Barotrauma
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Vector2.Distance(character.Position, container.Item.Position) > container.Item.InteractDistance
|
if (Vector2.Distance(character.Position, container.Item.Position) > container.Item.InteractDistance
|
||||||
&& !container.Item.IsInsideTrigger(character.Position))
|
&& !container.Item.IsInsideTrigger(character.WorldPosition))
|
||||||
{
|
{
|
||||||
AddSubObjective(new AIObjectiveGoTo(container.Item, character));
|
goToObjective = new AIObjectiveGoTo(container.Item, character);
|
||||||
|
AddSubObjective(goToObjective);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,8 +115,15 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
AIObjectiveContainItem objective = otherObjective as AIObjectiveContainItem;
|
AIObjectiveContainItem objective = otherObjective as AIObjectiveContainItem;
|
||||||
if (objective == null) return false;
|
if (objective == null) return false;
|
||||||
|
if (objective.container != container) return false;
|
||||||
|
if (objective.itemNames.Length != itemNames.Length) return false;
|
||||||
|
|
||||||
return objective.itemName == itemName && objective.container == container;
|
for (int i = 0; i < itemNames.Length; i++)
|
||||||
|
{
|
||||||
|
if (objective.itemNames[i] != itemNames[i]) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+23
-16
@@ -11,12 +11,20 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public override bool IsCompleted()
|
public override bool IsCompleted()
|
||||||
{
|
{
|
||||||
var item = character.Inventory.FindItem(gearName);
|
for (int i = 0; i < character.Inventory.Items.Length; i++)
|
||||||
if (item == null) return false;
|
{
|
||||||
|
if (CharacterInventory.limbSlots[i] == InvSlotType.Any || character.Inventory.Items[i] == null) continue;
|
||||||
|
if (character.Inventory.Items[i].Prefab.NameMatches(gearName) || character.Inventory.Items[i].HasTag(gearName))
|
||||||
|
{
|
||||||
|
var containedItems = character.Inventory.Items[i].ContainedItems;
|
||||||
|
if (containedItems == null) continue;
|
||||||
|
|
||||||
var containedItems = item.ContainedItems;
|
var oxygenTank = Array.Find(containedItems, it => (it.Prefab.NameMatches("Oxygen Tank") || it.HasTag("oxygensource")) && it.Condition > 0.0f);
|
||||||
var oxygenTank = Array.Find(containedItems, i => i.Prefab.NameMatches("Oxygen Tank") && i.Condition > 0.0f);
|
if (oxygenTank != null) return true;
|
||||||
return oxygenTank != null;
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AIObjectiveFindDivingGear(Character character, bool needDivingSuit)
|
public AIObjectiveFindDivingGear(Character character, bool needDivingSuit)
|
||||||
@@ -41,25 +49,24 @@ namespace Barotrauma
|
|||||||
var containedItems = item.ContainedItems;
|
var containedItems = item.ContainedItems;
|
||||||
if (containedItems == null) return;
|
if (containedItems == null) return;
|
||||||
|
|
||||||
//check if there's an oxygen tank in the mask
|
//check if there's an oxygen tank in the mask/suit
|
||||||
var oxygenTank = Array.Find(containedItems, i => i.Prefab.NameMatches("Oxygen Tank"));
|
foreach (Item containedItem in containedItems)
|
||||||
|
|
||||||
if (oxygenTank != null)
|
|
||||||
{
|
{
|
||||||
if (oxygenTank.Condition > 0.0f)
|
if (containedItem == null) continue;
|
||||||
|
if (containedItem.Condition <= 0.0f)
|
||||||
{
|
{
|
||||||
|
containedItem.Drop();
|
||||||
|
}
|
||||||
|
else if (containedItem.Prefab.NameMatches("Oxygen Tank") || containedItem.HasTag("oxygensource"))
|
||||||
|
{
|
||||||
|
//we've got an oxygen source inside the mask/suit, all good
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
oxygenTank.Drop();
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (!(subObjective is AIObjectiveContainItem) || subObjective.IsCompleted())
|
if (!(subObjective is AIObjectiveContainItem) || subObjective.IsCompleted())
|
||||||
{
|
{
|
||||||
subObjective = new AIObjectiveContainItem(character, "Oxygen Tank", item.GetComponent<ItemContainer>());
|
subObjective = new AIObjectiveContainItem(character, new string[] { "Oxygen Tank", "oxygensource" }, item.GetComponent<ItemContainer>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -106,6 +106,9 @@ namespace Barotrauma
|
|||||||
if (gap.ConnectedWall == null) continue;
|
if (gap.ConnectedWall == null) continue;
|
||||||
if (gap.ConnectedDoor != null || gap.Open <= 0.0f) continue;
|
if (gap.ConnectedDoor != null || gap.Open <= 0.0f) continue;
|
||||||
|
|
||||||
|
//TODO: prevent the AI characters from fixing leaks in the enemy sub in sub-vs-sub missions if/when multiplayer bots are implemented
|
||||||
|
if (gap.Submarine == null) continue;
|
||||||
|
|
||||||
float gapPriority = GetGapFixPriority(gap);
|
float gapPriority = GetGapFixPriority(gap);
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|||||||
@@ -1,14 +1,16 @@
|
|||||||
using Barotrauma.Items.Components;
|
using Barotrauma.Items.Components;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
class AIObjectiveGetItem : AIObjective
|
class AIObjectiveGetItem : AIObjective
|
||||||
{
|
{
|
||||||
private string itemName;
|
public Func<Item, float> GetItemPriority;
|
||||||
|
|
||||||
|
private string[] itemNames;
|
||||||
|
|
||||||
private Item targetItem, moveToTarget;
|
private Item targetItem, moveToTarget;
|
||||||
|
|
||||||
@@ -20,6 +22,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private AIObjectiveGoTo goToObjective;
|
private AIObjectiveGoTo goToObjective;
|
||||||
|
|
||||||
|
private float currItemPriority;
|
||||||
|
|
||||||
private bool equip;
|
private bool equip;
|
||||||
|
|
||||||
public override bool CanBeCompleted
|
public override bool CanBeCompleted
|
||||||
@@ -49,8 +53,13 @@ namespace Barotrauma
|
|||||||
this.targetItem = targetItem;
|
this.targetItem = targetItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AIObjectiveGetItem(Character character, string itemName, bool equip=false)
|
public AIObjectiveGetItem(Character character, string itemName, bool equip = false)
|
||||||
: base (character, "")
|
: this(character, new string[] { itemName }, equip)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public AIObjectiveGetItem(Character character, string[] itemNames, bool equip = false)
|
||||||
|
: base(character, "")
|
||||||
{
|
{
|
||||||
canBeCompleted = true;
|
canBeCompleted = true;
|
||||||
|
|
||||||
@@ -58,15 +67,19 @@ namespace Barotrauma
|
|||||||
|
|
||||||
currSearchIndex = 0;
|
currSearchIndex = 0;
|
||||||
|
|
||||||
this.itemName = itemName;
|
this.itemNames = itemNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Act(float deltaTime)
|
protected override void Act(float deltaTime)
|
||||||
{
|
{
|
||||||
FindTargetItem();
|
FindTargetItem();
|
||||||
if (targetItem == null || moveToTarget == null) return;
|
if (targetItem == null || moveToTarget == null)
|
||||||
|
{
|
||||||
|
character?.AIController?.SteeringManager?.Reset();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (Vector2.Distance(character.Position, moveToTarget.Position) < targetItem.InteractDistance*2.0f)
|
if (Vector2.Distance(character.Position, moveToTarget.Position) < targetItem.InteractDistance * 2.0f)
|
||||||
{
|
{
|
||||||
int targetSlot = -1;
|
int targetSlot = -1;
|
||||||
if (equip)
|
if (equip)
|
||||||
@@ -83,7 +96,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (slots.HasFlag(InvSlotType.Any)) continue;
|
if (slots.HasFlag(InvSlotType.Any)) continue;
|
||||||
|
|
||||||
for (int i = 0; i<character.Inventory.Items.Length; i++)
|
for (int i = 0; i < character.Inventory.Items.Length; i++)
|
||||||
{
|
{
|
||||||
//slot not needed by the item, continue
|
//slot not needed by the item, continue
|
||||||
if (!slots.HasFlag(CharacterInventory.limbSlots[i])) continue;
|
if (!slots.HasFlag(CharacterInventory.limbSlots[i])) continue;
|
||||||
@@ -111,9 +124,13 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (goToObjective == null)
|
if (goToObjective == null || moveToTarget != goToObjective.Target)
|
||||||
{
|
{
|
||||||
bool gettingDivingGear = itemName == "diving" || itemName == "Diving Gear";
|
//check if we're already looking for a diving gear
|
||||||
|
bool gettingDivingGear = (targetItem != null && targetItem.Prefab.NameMatches("Diving Gear") || targetItem.HasTag("diving")) ||
|
||||||
|
(itemNames != null && (itemNames.Contains("diving") || itemNames.Contains("Diving Gear")));
|
||||||
|
|
||||||
|
//don't attempt to get diving gear to reach the destination if the item we're trying to get is diving gear
|
||||||
goToObjective = new AIObjectiveGoTo(moveToTarget, character, false, !gettingDivingGear);
|
goToObjective = new AIObjectiveGoTo(moveToTarget, character, false, !gettingDivingGear);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,7 +144,7 @@ namespace Barotrauma
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void FindTargetItem()
|
private void FindTargetItem()
|
||||||
{
|
{
|
||||||
if (itemName == null)
|
if (itemNames == null)
|
||||||
{
|
{
|
||||||
if (targetItem == null) canBeCompleted = false;
|
if (targetItem == null) canBeCompleted = false;
|
||||||
return;
|
return;
|
||||||
@@ -143,20 +160,37 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (item.CurrentHull == null || item.Condition <= 0.0f) continue;
|
if (item.CurrentHull == null || item.Condition <= 0.0f) continue;
|
||||||
if (IgnoreContainedItems && item.Container != null) continue;
|
if (IgnoreContainedItems && item.Container != null) continue;
|
||||||
if (item.Name != itemName && !item.HasTag(itemName)) continue;
|
if (!itemNames.Any(name => item.Prefab.NameMatches(name) || item.HasTag(name))) continue;
|
||||||
|
|
||||||
//if the item is inside a character's inventory, don't steal it
|
//if the item is inside a character's inventory, don't steal it unless the character is dead
|
||||||
if (item.ParentInventory is CharacterInventory) continue;
|
if (item.ParentInventory is CharacterInventory)
|
||||||
|
|
||||||
//if the item is inside an item, which is inside a character's inventory, don't steal it
|
|
||||||
if (item.ParentInventory != null && item.ParentInventory.Owner is Item)
|
|
||||||
{
|
{
|
||||||
if (((Item)item.ParentInventory.Owner).ParentInventory is CharacterInventory) continue;
|
Character owner = item.ParentInventory.Owner as Character;
|
||||||
|
if (owner != null && !owner.IsDead) continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//ignore if item is further away than the currently targeted item
|
//if the item is inside an item, which is inside a character's inventory, don't steal it
|
||||||
Item rootContainer = item.GetRootContainer();
|
Item rootContainer = item.GetRootContainer();
|
||||||
if (moveToTarget != null && Vector2.DistanceSquared((rootContainer ?? item).Position, character.Position) > currDist) continue;
|
if (rootContainer != null && rootContainer.ParentInventory is CharacterInventory)
|
||||||
|
{
|
||||||
|
Character owner = rootContainer.ParentInventory.Owner as Character;
|
||||||
|
if (owner != null && !owner.IsDead) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
float itemPriority = 0.0f;
|
||||||
|
if (GetItemPriority != null)
|
||||||
|
{
|
||||||
|
//ignore if the item has zero priority
|
||||||
|
itemPriority = GetItemPriority(item);
|
||||||
|
if (itemPriority <= 0.0f) continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
itemPriority = itemPriority - Vector2.Distance((rootContainer ?? item).Position, character.Position) * 0.01f;
|
||||||
|
|
||||||
|
//ignore if the item has a lower priority than the currently selected one
|
||||||
|
if (moveToTarget != null && itemPriority < currItemPriority) continue;
|
||||||
|
|
||||||
|
currItemPriority = itemPriority;
|
||||||
|
|
||||||
targetItem = item;
|
targetItem = item;
|
||||||
moveToTarget = rootContainer ?? item;
|
moveToTarget = rootContainer ?? item;
|
||||||
@@ -170,18 +204,39 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
AIObjectiveGetItem getItem = otherObjective as AIObjectiveGetItem;
|
AIObjectiveGetItem getItem = otherObjective as AIObjectiveGetItem;
|
||||||
if (getItem == null) return false;
|
if (getItem == null) return false;
|
||||||
return (getItem.itemName == itemName);
|
if (getItem.equip != equip) return false;
|
||||||
|
if (getItem.itemNames != null && itemNames != null)
|
||||||
|
{
|
||||||
|
if (getItem.itemNames.Length != itemNames.Length) return false;
|
||||||
|
for (int i = 0; i < getItem.itemNames.Length; i++)
|
||||||
|
{
|
||||||
|
if (getItem.itemNames[i] != itemNames[i]) return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (getItem.itemNames == null && itemNames == null)
|
||||||
|
{
|
||||||
|
return getItem.targetItem == targetItem;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool IsCompleted()
|
public override bool IsCompleted()
|
||||||
{
|
{
|
||||||
if (itemName!=null)
|
if (itemNames != null)
|
||||||
{
|
{
|
||||||
return character.Inventory.FindItem(itemName) != null;
|
foreach (string itemName in itemNames)
|
||||||
|
{
|
||||||
|
var matchingItem = character.Inventory.FindItem(itemName);
|
||||||
|
if (matchingItem != null && (!equip || character.HasEquippedItem(matchingItem))) return true;
|
||||||
}
|
}
|
||||||
else if (targetItem!= null)
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (targetItem != null)
|
||||||
{
|
{
|
||||||
return character.Inventory.Items.Contains(targetItem);
|
return character.Inventory.Items.Contains(targetItem) && (!equip || character.HasEquippedItem(targetItem));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
//re-enable collider
|
//re-enable collider
|
||||||
if (!Collider.FarseerBody.Enabled)
|
if (!Collider.Enabled)
|
||||||
{
|
{
|
||||||
var lowestLimb = FindLowestLimb();
|
var lowestLimb = FindLowestLimb();
|
||||||
|
|
||||||
@@ -87,7 +87,7 @@ namespace Barotrauma
|
|||||||
Math.Max(lowestLimb.SimPosition.Y + (Collider.radius + Collider.height / 2), Collider.SimPosition.Y)),
|
Math.Max(lowestLimb.SimPosition.Y + (Collider.radius + Collider.height / 2), Collider.SimPosition.Y)),
|
||||||
0.0f);
|
0.0f);
|
||||||
|
|
||||||
Collider.FarseerBody.Enabled = true;
|
Collider.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResetPullJoints();
|
ResetPullJoints();
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
|
|
||||||
//re-enable collider
|
//re-enable collider
|
||||||
if (!Collider.FarseerBody.Enabled)
|
if (!Collider.Enabled)
|
||||||
{
|
{
|
||||||
var lowestLimb = FindLowestLimb();
|
var lowestLimb = FindLowestLimb();
|
||||||
|
|
||||||
@@ -115,7 +115,7 @@ namespace Barotrauma
|
|||||||
Collider.Rotation);
|
Collider.Rotation);
|
||||||
|
|
||||||
Collider.FarseerBody.ResetDynamics();
|
Collider.FarseerBody.ResetDynamics();
|
||||||
Collider.FarseerBody.Enabled = true;
|
Collider.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (swimming)
|
if (swimming)
|
||||||
@@ -1034,7 +1034,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Limb targetLimb = target.AnimController.GetLimb(GrabLimb);
|
Limb targetLimb = target.AnimController.GetLimb(GrabLimb);
|
||||||
|
|
||||||
if (targetLimb == null || targetLimb.IsSevered)
|
//grab hands if GrabLimb is not specified (or torso if the character has no hands)
|
||||||
|
if (GrabLimb == LimbType.None || targetLimb.IsSevered)
|
||||||
{
|
{
|
||||||
targetLimb = target.AnimController.GetLimb(LimbType.Torso);
|
targetLimb = target.AnimController.GetLimb(LimbType.Torso);
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
|
|||||||
@@ -527,7 +527,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void SeverLimbJoint(LimbJoint limbJoint)
|
public void SeverLimbJoint(LimbJoint limbJoint)
|
||||||
{
|
{
|
||||||
if (!limbJoint.CanBeSevered)
|
if (!limbJoint.CanBeSevered || limbJoint.IsSevered)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -541,12 +541,29 @@ namespace Barotrauma
|
|||||||
GetConnectedLimbs(connectedLimbs, checkedJoints, MainLimb);
|
GetConnectedLimbs(connectedLimbs, checkedJoints, MainLimb);
|
||||||
foreach (Limb limb in Limbs)
|
foreach (Limb limb in Limbs)
|
||||||
{
|
{
|
||||||
if (!connectedLimbs.Contains(limb))
|
if (connectedLimbs.Contains(limb)) continue;
|
||||||
{
|
|
||||||
limb.IsSevered = true;
|
limb.IsSevered = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CLIENT
|
||||||
|
if (character.UseBloodParticles)
|
||||||
|
{
|
||||||
|
foreach (Limb limb in new Limb[] { limbJoint.LimbA, limbJoint.LimbB })
|
||||||
|
{
|
||||||
|
for (int i = 0; i < MathHelper.Clamp(limb.Mass * 2.0f, 1.0f, 50.0f); i++)
|
||||||
|
{
|
||||||
|
GameMain.ParticleManager.CreateParticle("gib", limb.WorldPosition, Rand.Range(0.0f, MathHelper.TwoPi), Rand.Range(200.0f, 700.0f), character.CurrentHull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < MathHelper.Clamp(limb.Mass * 2.0f, 1.0f, 10.0f); i++)
|
||||||
|
{
|
||||||
|
GameMain.ParticleManager.CreateParticle("heavygib", limb.WorldPosition, Rand.Range(0.0f, MathHelper.TwoPi), Rand.Range(50.0f, 250.0f), character.CurrentHull);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (GameMain.Server != null)
|
if (GameMain.Server != null)
|
||||||
{
|
{
|
||||||
GameMain.Server.CreateEntityEvent(character, new object[] { NetEntityEvent.Type.Status });
|
GameMain.Server.CreateEntityEvent(character, new object[] { NetEntityEvent.Type.Status });
|
||||||
@@ -1469,5 +1486,12 @@ namespace Barotrauma
|
|||||||
list.Remove(this);
|
list.Remove(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RemoveAll()
|
||||||
|
{
|
||||||
|
for (int i = list.Count - 1; i >= 0; i--)
|
||||||
|
{
|
||||||
|
list[i].Remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ namespace Barotrauma
|
|||||||
Any = Blunt | Slash | Burn
|
Any = Blunt | Slash | Burn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum HitDetection
|
||||||
|
{
|
||||||
|
Distance,
|
||||||
|
Contact
|
||||||
|
}
|
||||||
|
|
||||||
struct AttackResult
|
struct AttackResult
|
||||||
{
|
{
|
||||||
public readonly float Damage;
|
public readonly float Damage;
|
||||||
@@ -39,89 +45,86 @@ namespace Barotrauma
|
|||||||
|
|
||||||
partial class Attack
|
partial class Attack
|
||||||
{
|
{
|
||||||
public readonly float Range;
|
[Serialize(HitDetection.Distance, false)]
|
||||||
public readonly float DamageRange;
|
public HitDetection HitDetectionType { get; private set; }
|
||||||
public readonly float Duration;
|
|
||||||
|
|
||||||
public readonly DamageType DamageType;
|
[Serialize(0.0f, false)]
|
||||||
|
public float Range { get; private set; }
|
||||||
|
|
||||||
private readonly float structureDamage;
|
[Serialize(0.0f, false)]
|
||||||
private readonly float damage;
|
public float DamageRange { get; private set; }
|
||||||
private readonly float bleedingDamage;
|
|
||||||
|
|
||||||
private readonly bool onlyHumans;
|
[Serialize(0.0f, false)]
|
||||||
|
public float Duration { get; private set; }
|
||||||
|
|
||||||
private readonly List<StatusEffect> statusEffects;
|
[Serialize(DamageType.None, false)]
|
||||||
|
public DamageType DamageType { get; private set; }
|
||||||
|
|
||||||
public readonly float Force;
|
[Serialize(0.0f, false)]
|
||||||
|
public float StructureDamage { get; private set; }
|
||||||
|
|
||||||
public readonly float Torque;
|
[Serialize(0.0f, false)]
|
||||||
|
public float Damage { get; private set; }
|
||||||
|
|
||||||
public readonly float TargetForce;
|
[Serialize(0.0f, false)]
|
||||||
|
public float BleedingDamage { get; private set; }
|
||||||
|
|
||||||
public readonly float SeverLimbsProbability;
|
[Serialize(0.0f, false)]
|
||||||
|
public float Stun { get; private set; }
|
||||||
|
|
||||||
|
[Serialize(false, false)]
|
||||||
|
public bool OnlyHumans { get; private set; }
|
||||||
|
|
||||||
|
[Serialize(0.0f, false)]
|
||||||
|
public float Force { get; private set; }
|
||||||
|
|
||||||
|
[Serialize(0.0f, false)]
|
||||||
|
public float Torque { get; private set; }
|
||||||
|
|
||||||
|
[Serialize(0.0f, false)]
|
||||||
|
public float TargetForce { get; private set; }
|
||||||
|
|
||||||
|
[Serialize(0.0f, false)]
|
||||||
|
public float SeverLimbsProbability { get; set; }
|
||||||
|
|
||||||
|
[Serialize(0.0f, false)]
|
||||||
|
public float Priority { get; private set; }
|
||||||
|
|
||||||
//the indices of the limbs Force is applied on
|
//the indices of the limbs Force is applied on
|
||||||
//(if none, force is applied only to the limb the attack is attached to)
|
//(if none, force is applied only to the limb the attack is attached to)
|
||||||
public readonly List<int> ApplyForceOnLimbs;
|
public readonly List<int> ApplyForceOnLimbs;
|
||||||
|
|
||||||
public readonly float Stun;
|
private readonly List<StatusEffect> statusEffects;
|
||||||
|
|
||||||
private float priority;
|
|
||||||
|
|
||||||
public float GetDamage(float deltaTime)
|
public float GetDamage(float deltaTime)
|
||||||
{
|
{
|
||||||
return (Duration == 0.0f) ? damage : damage * deltaTime;
|
return (Duration == 0.0f) ? Damage : Damage * deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetBleedingDamage(float deltaTime)
|
public float GetBleedingDamage(float deltaTime)
|
||||||
{
|
{
|
||||||
return (Duration == 0.0f) ? bleedingDamage : bleedingDamage * deltaTime;
|
return (Duration == 0.0f) ? BleedingDamage : BleedingDamage * deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public float GetStructureDamage(float deltaTime)
|
public float GetStructureDamage(float deltaTime)
|
||||||
{
|
{
|
||||||
return (Duration == 0.0f) ? structureDamage : structureDamage * deltaTime;
|
return (Duration == 0.0f) ? StructureDamage : StructureDamage * deltaTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Attack(float damage, float structureDamage, float bleedingDamage, float range = 0.0f)
|
public Attack(float damage, float structureDamage, float bleedingDamage, float range = 0.0f)
|
||||||
{
|
{
|
||||||
Range = range;
|
Range = range;
|
||||||
DamageRange = range;
|
DamageRange = range;
|
||||||
this.damage = damage;
|
this.Damage = damage;
|
||||||
this.structureDamage = structureDamage;
|
this.StructureDamage = structureDamage;
|
||||||
this.bleedingDamage = bleedingDamage;
|
this.BleedingDamage = bleedingDamage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Attack(XElement element)
|
public Attack(XElement element)
|
||||||
{
|
{
|
||||||
try
|
SerializableProperty.DeserializeProperties(this, element);
|
||||||
{
|
|
||||||
DamageType = (DamageType)Enum.Parse(typeof(DamageType), element.GetAttributeString("damagetype", "None"), true);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
DamageType = DamageType.None;
|
|
||||||
}
|
|
||||||
|
|
||||||
damage = element.GetAttributeFloat("damage", 0.0f);
|
|
||||||
structureDamage = element.GetAttributeFloat("structuredamage", 0.0f);
|
|
||||||
bleedingDamage = element.GetAttributeFloat("bleedingdamage", 0.0f);
|
|
||||||
Stun = element.GetAttributeFloat("stun", 0.0f);
|
|
||||||
|
|
||||||
SeverLimbsProbability = element.GetAttributeFloat("severlimbsprobability", 0.0f);
|
|
||||||
|
|
||||||
Force = element.GetAttributeFloat("force", 0.0f);
|
|
||||||
TargetForce = element.GetAttributeFloat("targetforce", 0.0f);
|
|
||||||
Torque = element.GetAttributeFloat("torque", 0.0f);
|
|
||||||
|
|
||||||
Range = element.GetAttributeFloat("range", 0.0f);
|
|
||||||
DamageRange = element.GetAttributeFloat("damagerange", Range);
|
DamageRange = element.GetAttributeFloat("damagerange", Range);
|
||||||
Duration = element.GetAttributeFloat("duration", 0.0f);
|
|
||||||
|
|
||||||
priority = element.GetAttributeFloat("priority", 1.0f);
|
|
||||||
|
|
||||||
onlyHumans = element.GetAttributeBool("onlyhumans", false);
|
|
||||||
|
|
||||||
InitProjSpecific(element);
|
InitProjSpecific(element);
|
||||||
|
|
||||||
@@ -158,7 +161,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public AttackResult DoDamage(Character attacker, IDamageable target, Vector2 worldPosition, float deltaTime, bool playSound = true)
|
public AttackResult DoDamage(Character attacker, IDamageable target, Vector2 worldPosition, float deltaTime, bool playSound = true)
|
||||||
{
|
{
|
||||||
if (onlyHumans)
|
if (OnlyHumans)
|
||||||
{
|
{
|
||||||
Character character = target as Character;
|
Character character = target as Character;
|
||||||
if (character != null && character.ConfigPath != Character.HumanConfigFile) return new AttackResult();
|
if (character != null && character.ConfigPath != Character.HumanConfigFile) return new AttackResult();
|
||||||
@@ -189,7 +192,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (targetLimb == null) return new AttackResult();
|
if (targetLimb == null) return new AttackResult();
|
||||||
|
|
||||||
if (onlyHumans)
|
if (OnlyHumans)
|
||||||
{
|
{
|
||||||
if (targetLimb.character != null && targetLimb.character.ConfigPath != Character.HumanConfigFile) return new AttackResult();
|
if (targetLimb.character != null && targetLimb.character.ConfigPath != Character.HumanConfigFile) return new AttackResult();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -344,18 +344,18 @@ namespace Barotrauma
|
|||||||
if (GameMain.Client != null) return;
|
if (GameMain.Client != null) return;
|
||||||
|
|
||||||
float newHealth = MathHelper.Clamp(value, minHealth, maxHealth);
|
float newHealth = MathHelper.Clamp(value, minHealth, maxHealth);
|
||||||
if (newHealth == health) return;
|
//if (newHealth == health) return;
|
||||||
|
|
||||||
health = newHealth;
|
health = newHealth;
|
||||||
|
|
||||||
if (GameMain.Server != null)
|
/*if (GameMain.Server != null)
|
||||||
{
|
{
|
||||||
if (Math.Abs(health - lastSentHealth) > (maxHealth - minHealth) / 255.0f || Math.Sign(health) != Math.Sign(lastSentHealth))
|
if (Math.Abs(health - lastSentHealth) > (maxHealth - minHealth) / 255.0f || Math.Sign(health) != Math.Sign(lastSentHealth))
|
||||||
{
|
{
|
||||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||||
lastSentHealth = health;
|
lastSentHealth = health;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,12 +374,12 @@ namespace Barotrauma
|
|||||||
if (!DoesBleed) return;
|
if (!DoesBleed) return;
|
||||||
|
|
||||||
float newBleeding = MathHelper.Clamp(value, 0.0f, 5.0f);
|
float newBleeding = MathHelper.Clamp(value, 0.0f, 5.0f);
|
||||||
if (newBleeding == bleeding) return;
|
//if (newBleeding == bleeding) return;
|
||||||
|
|
||||||
bleeding = newBleeding;
|
bleeding = newBleeding;
|
||||||
|
|
||||||
if (GameMain.Server != null)
|
/*if (GameMain.Server != null)
|
||||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -426,6 +426,12 @@ namespace Barotrauma
|
|||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool UseBloodParticles
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
|
|
||||||
public float BleedingDecreaseSpeed
|
public float BleedingDecreaseSpeed
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
@@ -634,6 +640,7 @@ namespace Barotrauma
|
|||||||
health = maxHealth;
|
health = maxHealth;
|
||||||
|
|
||||||
DoesBleed = doc.Root.GetAttributeBool("doesbleed", true);
|
DoesBleed = doc.Root.GetAttributeBool("doesbleed", true);
|
||||||
|
UseBloodParticles = doc.Root.GetAttributeBool("usebloodparticles", true);
|
||||||
BleedingDecreaseSpeed = doc.Root.GetAttributeFloat("bleedingdecreasespeed", 0.05f);
|
BleedingDecreaseSpeed = doc.Root.GetAttributeFloat("bleedingdecreasespeed", 0.05f);
|
||||||
|
|
||||||
needsAir = doc.Root.GetAttributeBool("needsair", false);
|
needsAir = doc.Root.GetAttributeBool("needsair", false);
|
||||||
@@ -1046,6 +1053,17 @@ namespace Barotrauma
|
|||||||
return !inventory.IsInLimbSlot(item, InvSlotType.Any);
|
return !inventory.IsInLimbSlot(item, InvSlotType.Any);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool HasEquippedItem(string itemName)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < inventory.Items.Length; i++)
|
||||||
|
{
|
||||||
|
if (CharacterInventory.limbSlots[i] == InvSlotType.Any || inventory.Items[i] == null) continue;
|
||||||
|
if (inventory.Items[i].Prefab.NameMatches(itemName) || inventory.Items[i].HasTag(itemName)) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public bool HasSelectedItem(Item item)
|
public bool HasSelectedItem(Item item)
|
||||||
{
|
{
|
||||||
return selectedItems.Contains(item);
|
return selectedItems.Contains(item);
|
||||||
@@ -1541,11 +1559,11 @@ namespace Barotrauma
|
|||||||
if (stunTimer > 0.0f)
|
if (stunTimer > 0.0f)
|
||||||
{
|
{
|
||||||
stunTimer -= deltaTime;
|
stunTimer -= deltaTime;
|
||||||
if (stunTimer < 0.0f && GameMain.Server != null)
|
/*if (stunTimer < 0.0f && GameMain.Server != null)
|
||||||
{
|
{
|
||||||
//stun ended -> notify clients
|
//stun ended -> notify clients
|
||||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||||
}
|
} */
|
||||||
}
|
}
|
||||||
|
|
||||||
//Skip health effects as critical health handles it differently
|
//Skip health effects as critical health handles it differently
|
||||||
@@ -1575,8 +1593,8 @@ namespace Barotrauma
|
|||||||
if (IsRagdolled)
|
if (IsRagdolled)
|
||||||
{
|
{
|
||||||
if (AnimController is HumanoidAnimController) ((HumanoidAnimController)AnimController).Crouching = false;
|
if (AnimController is HumanoidAnimController) ((HumanoidAnimController)AnimController).Crouching = false;
|
||||||
if(GameMain.Server != null)
|
/*if(GameMain.Server != null)
|
||||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });*/
|
||||||
AnimController.ResetPullJoints();
|
AnimController.ResetPullJoints();
|
||||||
selectedConstruction = null;
|
selectedConstruction = null;
|
||||||
return;
|
return;
|
||||||
@@ -1831,11 +1849,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if ((newStun <= stunTimer && !allowStunDecrease) || !MathUtils.IsValid(newStun)) return;
|
if ((newStun <= stunTimer && !allowStunDecrease) || !MathUtils.IsValid(newStun)) return;
|
||||||
|
|
||||||
if (GameMain.Server != null &&
|
/*if (GameMain.Server != null &&
|
||||||
(Math.Sign(newStun) != Math.Sign(stunTimer) || Math.Abs(newStun - stunTimer) > 0.1f))
|
(Math.Sign(newStun) != Math.Sign(stunTimer) || Math.Abs(newStun - stunTimer) > 0.1f))
|
||||||
{
|
{
|
||||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (Math.Sign(newStun) != Math.Sign(stunTimer)) AnimController.ResetPullJoints();
|
if (Math.Sign(newStun) != Math.Sign(stunTimer)) AnimController.ResetPullJoints();
|
||||||
|
|
||||||
@@ -1894,11 +1912,11 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameMain.NetworkMember != null)
|
/*if (GameMain.NetworkMember != null)
|
||||||
{
|
{
|
||||||
if (GameMain.Server != null)
|
if (GameMain.Server != null)
|
||||||
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
GameMain.Server.CreateEntityEvent(this, new object[] { NetEntityEvent.Type.Status });
|
||||||
}
|
}*/
|
||||||
|
|
||||||
AnimController.Frozen = false;
|
AnimController.Frozen = false;
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user