Merge branch 'master' of bitbucket.org:Regalis11/barotrauma

This commit is contained in:
Sebastian Broberg
2016-03-03 20:18:35 +01:00
111 changed files with 1720 additions and 1204 deletions
+13 -4
View File
@@ -302,6 +302,9 @@
<Content Include="changelog.txt"> <Content Include="changelog.txt">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="config.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\BackgroundSprites\BackgroundCreaturePrefabs.xml"> <Content Include="Content\BackgroundSprites\BackgroundCreaturePrefabs.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@@ -693,9 +696,6 @@
<Content Include="Content\UI\inventoryIcons.png"> <Content Include="Content\UI\inventoryIcons.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\UI\orderSymbols.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\UI\statusIcons.png"> <Content Include="Content\UI\statusIcons.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@@ -874,6 +874,9 @@
<Content Include="Content\Missions.xml"> <Content Include="Content\Missions.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
<Content Include="Content\UI\uiIcons.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Content\waterbump.png"> <Content Include="Content\waterbump.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
@@ -972,6 +975,9 @@
<None Include="Content\Characters\Scorpion\scorpionidle2.ogg"> <None Include="Content\Characters\Scorpion\scorpionidle2.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\Content.mgcb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\effects.mgfx"> <None Include="Content\effects.mgfx">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@@ -1065,6 +1071,9 @@
<None Include="Content\Items\Weapons\stungrenade.ogg"> <None Include="Content\Items\Weapons\stungrenade.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\LargeFont.xnb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="Content\Map\TutorialSub.sub"> <None Include="Content\Map\TutorialSub.sub">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
@@ -1251,7 +1260,7 @@
<None Include="Content\Sounds\Water\WaterAmbience1.ogg"> <None Include="Content\Sounds\Water\WaterAmbience1.ogg">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="Content\watershader.mgfx"> <None Include="Content\watershader.xnb">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None> </None>
<None Include="packages.config" /> <None Include="packages.config" />
+1 -1
View File
@@ -9,7 +9,7 @@
<ErrorReportUrlHistory /> <ErrorReportUrlHistory />
<FallbackCulture>en-US</FallbackCulture> <FallbackCulture>en-US</FallbackCulture>
<VerifyUploadedFiles>false</VerifyUploadedFiles> <VerifyUploadedFiles>false</VerifyUploadedFiles>
<ProjectView>ProjectFiles</ProjectView> <ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup> </PropertyGroup>
<PropertyGroup> <PropertyGroup>
<ReferencePath> <ReferencePath>
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Character name ="mantis" humanoid="false"> <Character name ="mantis" humanoid="false" health="200">
<sound file="Content/Characters/Crawler/attack1.ogg" state="Attack" range="500"/> <sound file="Content/Characters/Crawler/attack1.ogg" state="Attack" range="500"/>
<sound file="Content/Characters/Crawler/attack2.ogg" state="Attack" range="500"/> <sound file="Content/Characters/Crawler/attack2.ogg" state="Attack" range="500"/>
+27 -1
View File
@@ -1,4 +1,5 @@
#----------------------------- Global Properties ----------------------------#
#----------------------------- Global Properties ----------------------------#
/outputDir:bin/$(Platform) /outputDir:bin/$(Platform)
/intermediateDir:obj/$(Platform) /intermediateDir:obj/$(Platform)
@@ -11,3 +12,28 @@
#---------------------------------- Content ---------------------------------# #---------------------------------- Content ---------------------------------#
#begin LargeFont.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:TextureFormat=Color
/build:LargeFont.spritefont
#begin SmallFont.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:TextureFormat=Color
/build:SmallFont.spritefont
#begin SpriteFont1.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:TextureFormat=Color
/build:SpriteFont1.spritefont
#begin watershader.fx
/importer:EffectImporter
/processor:EffectProcessor
/processorParam:DebugMode=Auto
/build:watershader.fx
@@ -16,7 +16,9 @@
<Body width="36" height="60" density="5"/> <Body width="36" height="60" density="5"/>
<Holdable slots="RightHand+LeftHand" holdpos="30,-15" handle1="0,10" handle2="0,-10"/> <Holdable slots="RightHand+LeftHand" holdpos="30,-15" handle1="0,10" handle2="0,-10">
<StatusEffect type="Always" target="Hull" oxygen="-50000.0"/>
</Holdable>
</Item> </Item>
<Item <Item
@@ -35,7 +37,7 @@
<Body radius="20" height="20" density="5"/> <Body radius="20" height="20" density="5"/>
<Holdable slots="RightHand+LeftHand" holdpos="30,-15" handle1="0,10" handle2="0,-10"> <Holdable slots="RightHand+LeftHand" holdpos="30,-15" handle1="0,10" handle2="0,-10">
<StatusEffect type="OnActive"> <StatusEffect type="Always">
<Fire/> <Fire/>
</StatusEffect> </StatusEffect>
</Holdable> </Holdable>
@@ -30,7 +30,7 @@ with.
<CharacterRegions> <CharacterRegions>
<CharacterRegion> <CharacterRegion>
<Start>&#32;</Start> <Start>&#32;</Start>
<End>&#126;</End> <End>&#1200;</End>
</CharacterRegion> </CharacterRegion>
<CharacterRegion> <CharacterRegion>
Binary file not shown.
+6 -6
View File
@@ -1,27 +1,27 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<Orders> <Orders>
<Order name="Follow" doingtext="Following" color="1.0,0.5,0.1,1.0"> <Order name="Follow" doingtext="Following" color="1.0,0.5,0.1,1.0">
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="0,0,64,64"/> <Sprite texture="Content/UI/uiIcons.png" sourcerect="0,0,64,64"/>
</Order> </Order>
<Order name="Wait" doingtext="Waiting" color="1.0,0.0,0.0,1.0"> <Order name="Wait" doingtext="Waiting" color="1.0,0.0,0.0,1.0">
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="128,0,64,64"/> <Sprite texture="Content/UI/uiIcons.png" sourcerect="128,0,64,64"/>
</Order> </Order>
<Order name="Dismissed" doingtext="Dismissed" color="0.0,1.0,0.0,1.0"> <Order name="Dismissed" doingtext="Dismissed" color="0.0,1.0,0.0,1.0">
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="64,0,64,64"/> <Sprite texture="Content/UI/uiIcons.png" sourcerect="64,0,64,64"/>
</Order> </Order>
<Order name="Operate Reactor" doingtext="Operating Reactor" targetitemtype="Reactor" options="Power up, Shutdown" color="1.0,0.78,0.05,1.0"> <Order name="Operate Reactor" doingtext="Operating Reactor" targetitemtype="Reactor" options="Power up, Shutdown" color="1.0,0.78,0.05,1.0">
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="192,0,64,64"/> <Sprite texture="Content/UI/uiIcons.png" sourcerect="192,0,64,64"/>
</Order> </Order>
<Order name="Operate Railgun" doingtext="Operating Railgun" targetitemtype="Turret" usecontroller="true" options="Fire at will, Hold fire" color="0.12,0.3,0.5,1.0"> <Order name="Operate Railgun" doingtext="Operating Railgun" targetitemtype="Turret" usecontroller="true" options="Fire at will, Hold fire" color="0.12,0.3,0.5,1.0">
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="0,64,64,64"/> <Sprite texture="Content/UI/uiIcons.png" sourcerect="0,64,64,64"/>
</Order> </Order>
<Order name="Fix Leaks" doingtext="Fixing Leaks" color="0.6,0.85,1.0,1.0"> <Order name="Fix Leaks" doingtext="Fixing Leaks" color="0.6,0.85,1.0,1.0">
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="64,64,64,64"/> <Sprite texture="Content/UI/uiIcons.png" sourcerect="64,64,64,64"/>
</Order> </Order>
</Orders> </Orders>
@@ -115,8 +115,8 @@
sizechangemin="0.1,0.1" sizechangemax="0.2,0.2" sizechangemin="0.1,0.1" sizechangemax="0.2,0.2"
startrotationmin ="-20.0" startrotationmax="20" startrotationmin ="-20.0" startrotationmax="20"
startcolor="1.0, 1.0, 1.0" startalpha="1.0" startcolor="1.0, 1.0, 1.0" startalpha="1.0"
colorchange="-0.6, -1.0, -4.2, -0.8" colorchange="-0.9, -1.5, -6.3, -1.2"
lifetime="5.0" lifetime="2.5"
growtime ="0.05" growtime ="0.05"
drawtarget="air" drawtarget="air"
collideswithwalls="true" collideswithwalls="true"
@@ -30,7 +30,7 @@ with.
<CharacterRegions> <CharacterRegions>
<CharacterRegion> <CharacterRegion>
<Start>&#32;</Start> <Start>&#32;</Start>
<End>&#126;</End> <End>&#1200;</End>
</CharacterRegion> </CharacterRegion>
<CharacterRegion> <CharacterRegion>
Binary file not shown.
+7 -2
View File
@@ -41,7 +41,7 @@ with.
If you uncomment this line, the default character will be substituted if you draw If you uncomment this line, the default character will be substituted if you draw
or measure text that contains characters which were not included in the font. or measure text that contains characters which were not included in the font.
--> -->
<!-- <DefaultCharacter>*</DefaultCharacter> --> <DefaultCharacter>_</DefaultCharacter>
<!-- <!--
CharacterRegions control what letters are available in the font. Every CharacterRegions control what letters are available in the font. Every
@@ -53,7 +53,12 @@ with.
<CharacterRegions> <CharacterRegions>
<CharacterRegion> <CharacterRegion>
<Start>&#32;</Start> <Start>&#32;</Start>
<End>&#159;</End> <End>&#1200;</End>
</CharacterRegion>
<CharacterRegion>
<Start>&#192;</Start>
<End>&#601;</End>
</CharacterRegion> </CharacterRegion>
</CharacterRegions> </CharacterRegions>
</Asset> </Asset>
Binary file not shown.
Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.
+72
View File
@@ -0,0 +1,72 @@
float xBlurDistance;
Texture xTexture;
sampler TextureSampler = sampler_state { Texture = <xTexture>; };
Texture xLosTexture;
sampler LosSampler = sampler_state { Texture = <xLosTexture>; };
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))/2.0f;
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 / 4;
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
{
pass Pass1
{
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.
Binary file not shown.
+3 -3
View File
@@ -9,7 +9,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")] [assembly: AssemblyConfiguration("")]
[assembly: AssemblyDescription("")] [assembly: AssemblyDescription("")]
[assembly: AssemblyCompany("")] [assembly: AssemblyCompany("")]
[assembly: AssemblyCopyright("Copyright © Undertow Games 2015")] [assembly: AssemblyCopyright("Copyright © Undertow Games 2016")]
[assembly: AssemblyTrademark("")] [assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")] [assembly: AssemblyCulture("")]
@@ -31,5 +31,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.3.1")] [assembly: AssemblyVersion("0.3.4.0")]
[assembly: AssemblyFileVersion("0.3.3.1")] [assembly: AssemblyFileVersion("0.3.4.0")]
+9 -3
View File
@@ -127,11 +127,11 @@ namespace Barotrauma
//UpdateTransform(); //UpdateTransform();
} }
public void UpdateTransform() public void UpdateTransform(bool interpolate = true)
{ {
Vector2 interpolatedPosition = Physics.Interpolate(prevPosition, position); Vector2 interpolatedPosition = interpolate ? Physics.Interpolate(prevPosition, position) : position;
float interpolatedZoom = Physics.Interpolate(prevZoom, zoom); float interpolatedZoom = interpolate ? Physics.Interpolate(prevZoom, zoom) : zoom;
worldView.X = (int)(interpolatedPosition.X - worldView.Width / 2.0); worldView.X = (int)(interpolatedPosition.X - worldView.Width / 2.0);
worldView.Y = (int)(interpolatedPosition.Y + worldView.Height / 2.0); worldView.Y = (int)(interpolatedPosition.Y + worldView.Height / 2.0);
@@ -149,6 +149,12 @@ namespace Barotrauma
viewMatrix; viewMatrix;
Sound.CameraPos = new Vector3(WorldViewCenter.X, WorldViewCenter.Y, 0.0f); Sound.CameraPos = new Vector3(WorldViewCenter.X, WorldViewCenter.Y, 0.0f);
if (!interpolate)
{
prevPosition = position;
prevZoom = zoom;
}
} }
public void MoveCamera(float deltaTime) public void MoveCamera(float deltaTime)
@@ -558,27 +558,12 @@ namespace Barotrauma
bool wallAttack = (wallAttackPos != Vector2.Zero && state == AiState.Attack); bool wallAttack = (wallAttackPos != Vector2.Zero && state == AiState.Attack);
message.Write(wallAttack); //message.Write(wallAttack);
//if (wallAttack)
//{
// Vector2 relativeWallAttackPos = wallAttackPos - Submarine.Loaded.SimPosition;
// message.WriteRangedSingle(MathHelper.Clamp(relativeWallAttackPos.X, -50.0f, 50.0f), -50.0f, 50.0f, 10);
// message.WriteRangedSingle(MathHelper.Clamp(relativeWallAttackPos.Y, -50.0f, 50.0f), -50.0f, 50.0f, 10);
//}
//message.Write(Velocity.X);
//message.Write(Velocity.Y);
//message.Write(Character.AnimController.RefLimb.SimPosition.X);
//message.Write(Character.AnimController.RefLimb.SimPosition.Y);
message.Write(MathUtils.AngleToByte(steeringManager.WanderAngle)); message.Write(MathUtils.AngleToByte(steeringManager.WanderAngle));
//message.WriteRangedSingle(MathHelper.Clamp(updateTargetsTimer,0.0f, UpdateTargetsInterval), 0.0f, UpdateTargetsInterval, 8);
//message.WriteRangedSingle(MathHelper.Clamp(raycastTimer, 0.0f, RaycastInterval), 0.0f, RaycastInterval, 8); coolDownTimer = MathHelper.Clamp(coolDownTimer, 0.0f, 30.0f);
//message.WriteRangedSingle(MathHelper.Clamp(coolDownTimer, 0.0f, attackCoolDown * 2.0f), 0.0f, attackCoolDown * 2.0f, 8); message.WriteRangedSingle(coolDownTimer, 0.0f, 30.0f, 8);
message.Write(targetEntity==null ? (ushort)0 : (targetEntity as Entity).ID); message.Write(targetEntity==null ? (ushort)0 : (targetEntity as Entity).ID);
} }
@@ -612,9 +597,8 @@ namespace Barotrauma
//targetPosition = new Vector2(message.ReadFloat(), message.ReadFloat()); //targetPosition = new Vector2(message.ReadFloat(), message.ReadFloat());
wanderAngle = MathUtils.ByteToAngle(message.ReadByte()); wanderAngle = MathUtils.ByteToAngle(message.ReadByte());
//updateTargetsTimer = message.ReadRangedSingle(0.0f, UpdateTargetsInterval, 8);
//raycastTimer = message.ReadRangedSingle(0.0f, RaycastInterval, 8); coolDownTimer = message.ReadRangedSingle(0.0f, 30.0f, 8);
//coolDownTimer = message.ReadRangedSingle(0.0f, attackCoolDown*2.0f, 8);
targetID = message.ReadUInt16(); targetID = message.ReadUInt16();
} }
@@ -629,14 +613,10 @@ namespace Barotrauma
return; return;
} }
//wallAttackPos = newWallAttackPos;
steeringManager.WanderAngle = wanderAngle; steeringManager.WanderAngle = wanderAngle;
//this.updateTargetsTimer = updateTargetsTimer;
//this.raycastTimer = raycastTimer;
//this.coolDownTimer = coolDownTimer;
if (targetID > 0) targetEntity = Entity.FindEntityByID(targetID) as IDamageable; if (targetID > 0) targetEntity = Entity.FindEntityByID(targetID) as IDamageable;
updateTargetsTimer = UpdateTargetsInterval;
} }
} }
@@ -647,14 +627,8 @@ namespace Barotrauma
//and if the target attacks the Character, the priority increases) //and if the target attacks the Character, the priority increases)
class AITargetMemory class AITargetMemory
{ {
//private AITarget target;
private float priority; private float priority;
//public AITarget Target
//{
// get { return target; }
//}
public float Priority public float Priority
{ {
get { return priority; } get { return priority; }
@@ -909,9 +909,8 @@ namespace Barotrauma
Vector2 shoulderPos = limbJoints[2].WorldAnchorA; Vector2 shoulderPos = limbJoints[2].WorldAnchorA;
Vector2 transformedHoldPos = shoulderPos; Vector2 transformedHoldPos = shoulderPos;
if (itemPos == Vector2.Zero || Anim == Animation.Climbing) if (itemPos == Vector2.Zero || Anim == Animation.Climbing || (leftHand.Disabled && rightHand.Disabled))
{ {
if (character.SelectedItems[1] == item) if (character.SelectedItems[1] == item)
{ {
transformedHoldPos = leftHand.pullJoint.WorldAnchorA - transformedHandlePos[1]; transformedHoldPos = leftHand.pullJoint.WorldAnchorA - transformedHandlePos[1];
@@ -815,25 +815,35 @@ namespace Barotrauma
{ {
if (inWater) if (inWater)
{ {
if (character is AICharacter) if (targetMovement.LengthSquared() > 0.01f)
{ {
correctionMovement = correctionMovement =
Vector2.Lerp(targetMovement, Vector2.Normalize(diff) * MathHelper.Clamp(dist * 8.0f, 0.1f, 8.0f), 0.5f); Vector2.Lerp(targetMovement, Vector2.Normalize(diff) * MathHelper.Clamp(dist * 5.0f, 0.1f, 5.0f), 0.2f);
} }
else else
{ {
foreach (Limb limb in Limbs) refLimb.body.LinearVelocity = Vector2.Lerp(
{ refLimb.LinearVelocity,
//if (limb.body.TargetPosition == Vector2.Zero) continue; Vector2.Normalize(diff) * MathHelper.Clamp(dist, 0.0f, 5.0f),
0.2f);
limb.body.SetTransform(limb.SimPosition + Vector2.Normalize(diff) * 0.1f, limb.Rotation); //foreach (Limb limb in Limbs)
} //{
// //if (limb.body.TargetPosition == Vector2.Zero) continue;
// // Vector2.Lerp(limb.LinearVelocity, Vector2.Normalize(diff) * MathHelper.Clamp(dist, 0.0f, 1.0f))
// limb.body.LinearVelocity = Vector2.Lerp(
// limb.LinearVelocity,
// Vector2.Normalize(diff) * MathHelper.Clamp(dist, 0.0f, 5.0f),
// 0.2f);
// //limb.body.TargetVelocity .SetTransform(limb.SimPosition + Vector2.Normalize(diff) * 0.1f, limb.Rotation);
//}
} }
} }
else else
{ {
//clamp the magnitude of the correction movement between 0.5f - 5.0f //clamp the magnitude of the correction movement between 0.5f - 5.0f
Vector2 newCorrectionMovement = Vector2.Normalize(diff) * MathHelper.Clamp(dist * 5.0f, 0.5f, 5.0f); Vector2 newCorrectionMovement = Vector2.Normalize(diff) * MathHelper.Clamp(dist*2.0f, 0.5f, 5.0f);
//heading in the right direction -> use the ''normal'' movement if it's faster than correctionMovement //heading in the right direction -> use the ''normal'' movement if it's faster than correctionMovement
//i.e. the character is close to the targetposition but the character is still running //i.e. the character is close to the targetposition but the character is still running
+17 -2
View File
@@ -53,6 +53,8 @@ namespace Barotrauma
public readonly bool IsNetworkPlayer; public readonly bool IsNetworkPlayer;
private bool networkUpdateSent;
private CharacterInventory inventory; private CharacterInventory inventory;
public float LastNetworkUpdate; public float LastNetworkUpdate;
@@ -955,6 +957,17 @@ namespace Barotrauma
if (isDead) return; if (isDead) return;
if (networkUpdateSent)
{
foreach (Key key in keys)
{
key.DequeueHit();
key.DequeueHeld();
}
networkUpdateSent = false;
}
if (needsAir) if (needsAir)
{ {
bool protectedFromPressure = PressureProtection > 0.0f; bool protectedFromPressure = PressureProtection > 0.0f;
@@ -1421,9 +1434,9 @@ namespace Barotrauma
return true; return true;
case NetworkEventType.EntityUpdate: case NetworkEventType.EntityUpdate:
message.Write(keys[(int)InputType.Use].DequeueHeld); message.Write(keys[(int)InputType.Use].GetHeldQueue);
bool secondaryHeld = keys[(int)InputType.Aim].DequeueHeld; bool secondaryHeld = keys[(int)InputType.Aim].GetHeldQueue;
message.Write(secondaryHeld); message.Write(secondaryHeld);
message.Write(keys[(int)InputType.Left].Held); message.Write(keys[(int)InputType.Left].Held);
@@ -1469,6 +1482,8 @@ namespace Barotrauma
message.Write(SimPosition.X); message.Write(SimPosition.X);
message.Write(SimPosition.Y); message.Write(SimPosition.Y);
networkUpdateSent = true;
return true; return true;
default: default:
#if DEBUG #if DEBUG
+11 -5
View File
@@ -12,7 +12,7 @@ namespace Barotrauma
[Flags] [Flags]
public enum TargetType public enum TargetType
{ {
This = 1, Parent = 2, Character = 4, Contained = 8, Nearby = 16, UseTarget=32 This = 1, Parent = 2, Character = 4, Contained = 8, Nearby = 16, UseTarget = 32, Hull = 64
} }
private TargetType targetTypes; private TargetType targetTypes;
@@ -273,20 +273,21 @@ namespace Barotrauma
if (disableDeltaTime) deltaTime = 1.0f; if (disableDeltaTime) deltaTime = 1.0f;
Type type = value.GetType(); Type type = value.GetType();
if (type == typeof(float)) if (type == typeof(float) ||
(type == typeof(int) && property.GetValue().GetType() == typeof(float)))
{ {
float floatValue = (float)value * deltaTime; float floatValue = Convert.ToSingle(value) * deltaTime;
if (!setValue) floatValue += (float)property.GetValue(); if (!setValue) floatValue += (float)property.GetValue();
property.TrySetValue(floatValue); property.TrySetValue(floatValue);
} }
else if (type == typeof(int)) else if (type == typeof(int) && value.GetType()==typeof(int))
{ {
int intValue = (int)((int)value * deltaTime); int intValue = (int)((int)value * deltaTime);
if (!setValue) intValue += (int)property.GetValue(); if (!setValue) intValue += (int)property.GetValue();
property.TrySetValue(intValue); property.TrySetValue(intValue);
} }
else if (type == typeof(bool)) else if (type == typeof(bool) && value.GetType() == typeof(bool))
{ {
property.TrySetValue((bool)value); property.TrySetValue((bool)value);
} }
@@ -294,6 +295,11 @@ namespace Barotrauma
{ {
property.TrySetValue((string)value); property.TrySetValue((string)value);
} }
else
{
DebugConsole.ThrowError("Couldn't apply value "+value.ToString()+" ("+type+") to property ''"+property.Name+"'' ("+property.GetValue().GetType()+")! "
+"Make sure the type of the value set in the config files matches the type of the property.");
}
} }
public static void UpdateAll(float deltaTime) public static void UpdateAll(float deltaTime)
+22 -1
View File
@@ -381,7 +381,8 @@ namespace Barotrauma
DebugConsole.ThrowError("Illegal symbols in filename (../)"); DebugConsole.ThrowError("Illegal symbols in filename (../)");
return; return;
} }
if (Submarine.SaveCurrent(fileName +".sub")) NewMessage("map saved", Color.Green);
if (Submarine.SaveCurrent(System.IO.Path.Combine(Submarine.SavePath, fileName +".sub"))) NewMessage("map saved", Color.Green);
Submarine.Loaded.CheckForErrors(); Submarine.Loaded.CheckForErrors();
break; break;
@@ -417,6 +418,20 @@ namespace Barotrauma
//Hull.DebugDraw = !Hull.DebugDraw; //Hull.DebugDraw = !Hull.DebugDraw;
//Ragdoll.DebugDraw = !Ragdoll.DebugDraw; //Ragdoll.DebugDraw = !Ragdoll.DebugDraw;
GameMain.DebugDraw = !GameMain.DebugDraw; GameMain.DebugDraw = !GameMain.DebugDraw;
break;
case "sendrandomdata":
int messageCount = 1;
if (commands.Length>1) int.TryParse(commands[1], out messageCount);
for (int i = 0; i < messageCount; i++ )
{
if (GameMain.Server!=null)
{
GameMain.Server.SendRandomData();
}
}
break; break;
case "netstats": case "netstats":
if (GameMain.Server == null) return; if (GameMain.Server == null) return;
@@ -479,6 +494,12 @@ namespace Barotrauma
DebugConsole.NewMessage("Deleted TutorialSub from the submarine folder", Color.Green); DebugConsole.NewMessage("Deleted TutorialSub from the submarine folder", Color.Green);
} }
if (System.IO.File.Exists(GameServer.SettingsFile))
{
System.IO.File.Delete(GameServer.SettingsFile);
DebugConsole.NewMessage("Deleted server settings", Color.Green);
}
if (System.IO.File.Exists("crashreport.txt")) if (System.IO.File.Exists("crashreport.txt"))
{ {
System.IO.File.Delete("crashreport.txt"); System.IO.File.Delete("crashreport.txt");
+35 -7
View File
@@ -43,6 +43,18 @@ namespace Barotrauma
public static Color ScreenOverlayColor; public static Color ScreenOverlayColor;
private static Sprite submarineIcon, arrow;
public static Sprite SubmarineIcon
{
get { return submarineIcon; }
}
public static Sprite Arrow
{
get { return arrow; }
}
public static void Init(ContentManager content) public static void Init(ContentManager content)
{ {
GUI.Font = ToolBox.TryLoadFont("SpriteFont1", content); GUI.Font = ToolBox.TryLoadFont("SpriteFont1", content);
@@ -72,6 +84,12 @@ namespace Barotrauma
t = new Texture2D(graphicsDevice, 1, 1); t = new Texture2D(graphicsDevice, 1, 1);
t.SetData(new Color[] { Color.White });// fill the texture with white t.SetData(new Color[] { Color.White });// fill the texture with white
submarineIcon = new Sprite("Content/UI/uiIcons.png", new Rectangle(0, 192, 64, 64), null);
submarineIcon.Origin = submarineIcon.size / 2;
arrow = new Sprite("Content/UI/uiIcons.png", new Rectangle(80, 240, 16, 16), null);
arrow.Origin = arrow.size / 2;
Style = new GUIStyle("Content/UI/style.xml"); Style = new GUIStyle("Content/UI/style.xml");
} }
@@ -304,24 +322,34 @@ namespace Barotrauma
return texture; return texture;
} }
public static bool DrawButton(SpriteBatch sb, Rectangle rect, string text, bool isHoldable = false) public static bool DrawButton(SpriteBatch sb, Rectangle rect, string text, Color color, bool isHoldable = false)
{ {
Color color = new Color(200, 200, 200);
bool clicked = false; bool clicked = false;
if (rect.Contains(PlayerInput.MousePosition)) if (rect.Contains(PlayerInput.MousePosition))
{ {
clicked = PlayerInput.LeftButtonHeld(); clicked = PlayerInput.LeftButtonHeld();
color = clicked ? new Color(100, 100, 100) : new Color(250, 250, 250); color = clicked ?
new Color((int)(color.R * 0.8f), (int)(color.G * 0.8f), (int)(color.B * 0.8f), color.A) :
new Color((int)(color.R * 1.2f), (int)(color.G * 1.2f), (int)(color.B * 1.2f), color.A);
if (!isHoldable) if (!isHoldable) clicked = PlayerInput.LeftButtonClicked();
clicked = PlayerInput.LeftButtonClicked();
} }
DrawRectangle(sb, rect, color, true); DrawRectangle(sb, rect, color, true);
sb.DrawString(Font, text, new Vector2(rect.X + 10, rect.Y + 10), Color.White);
Vector2 origin;
try
{
origin = Font.MeasureString(text)/2;
}
catch
{
origin = Vector2.Zero;
}
sb.DrawString(Font, text, new Vector2(rect.Center.X, rect.Center.Y) , Color.White, 0.0f, origin, 1.0f, SpriteEffects.None, 0.0f);
return clicked; return clicked;
} }
+1 -1
View File
@@ -7,7 +7,7 @@ namespace Barotrauma
{ {
public static Queue<GUIComponent> MessageBoxes = new Queue<GUIComponent>(); public static Queue<GUIComponent> MessageBoxes = new Queue<GUIComponent>();
const int DefaultWidth=400, DefaultHeight=200; const int DefaultWidth=400, DefaultHeight=250;
//public delegate bool OnClickedHandler(GUIButton button, object obj); //public delegate bool OnClickedHandler(GUIButton button, object obj);
//public OnClickedHandler OnClicked; //public OnClickedHandler OnClicked;
+3 -3
View File
@@ -157,8 +157,8 @@ namespace Barotrauma
Hyper.ComponentModel.HyperTypeDescriptionProvider.Add(typeof(Character)); Hyper.ComponentModel.HyperTypeDescriptionProvider.Add(typeof(Character));
Hyper.ComponentModel.HyperTypeDescriptionProvider.Add(typeof(Item)); Hyper.ComponentModel.HyperTypeDescriptionProvider.Add(typeof(Item));
Hyper.ComponentModel.HyperTypeDescriptionProvider.Add(typeof(Items.Components.ItemComponent));
//Event.Init("Content/randomevents.xml"); Hyper.ComponentModel.HyperTypeDescriptionProvider.Add(typeof(Hull));
} }
/// <summary> /// <summary>
@@ -195,7 +195,7 @@ namespace Barotrauma
Hull.renderer = new WaterRenderer(GraphicsDevice); Hull.renderer = new WaterRenderer(GraphicsDevice, Content);
TitleScreen.LoadState = 1.0f; TitleScreen.LoadState = 1.0f;
yield return CoroutineStatus.Running; yield return CoroutineStatus.Running;
@@ -172,6 +172,29 @@ namespace Barotrauma
combined = true; combined = true;
} }
//if moving the item between slots in the same inventory
else if (item.ParentInventory == this)
{
int currentIndex = Array.IndexOf(Items, item);
Item existingItem = Items[index];
Items[currentIndex] = null;
Items[index] = null;
//if the item in the slot can be moved to the slot of the moved item
if (TryPutItem(existingItem, currentIndex, false) &&
TryPutItem(item, index, false))
{
new Networking.NetworkEvent(Networking.NetworkEventType.InventoryUpdate, Owner.ID, true, true);
}
else
{
//swapping the items failed -> move them back to where they were
TryPutItem(item, currentIndex, false);
TryPutItem(existingItem, index, false);
}
}
return combined; return combined;
} }
@@ -252,7 +252,7 @@ namespace Barotrauma.Items.Components
item.Submarine = picker.Submarine; item.Submarine = picker.Submarine;
if (picker.SelectedConstruction != null && picker.SelectedConstruction.GetComponent<Controller>() != null) return; //if (picker.SelectedConstruction != null && picker.SelectedConstruction.GetComponent<Controller>() != null) return;
//item.sprite.Depth = picker.AnimController.GetLimb(LimbType.RightHand).sprite.Depth + 0.01f; //item.sprite.Depth = picker.AnimController.GetLimb(LimbType.RightHand).sprite.Depth + 0.01f;
@@ -76,7 +76,7 @@ namespace Barotrauma.Items.Components
{ {
foreach (Limb limb in character.AnimController.Limbs) foreach (Limb limb in character.AnimController.Limbs)
{ {
if (limb.WearingItems.Find(w => w.WearableComponent.Item != this.item)==null) continue; if (limb.WearingItems.Find(w => w.WearableComponent.Item == this.item)==null) continue;
limb.body.ApplyForce(propulsion); limb.body.ApplyForce(propulsion);
} }
@@ -210,6 +210,8 @@ namespace Barotrauma.Items.Components
limb.pullJoint.Enabled = false; limb.pullJoint.Enabled = false;
} }
if (character.SelectedConstruction == this.item) character.SelectedConstruction = null;
character.AnimController.Anim = AnimController.Animation.None; character.AnimController.Anim = AnimController.Animation.None;
} }
@@ -225,9 +227,6 @@ namespace Barotrauma.Items.Components
IsActive = false; IsActive = false;
CancelUsing(character); CancelUsing(character);
character = null; character = null;
}
else
{
return false; return false;
} }
} }
@@ -48,6 +48,24 @@ namespace Barotrauma.Items.Components
: base(item, element) : base(item, element)
{ {
IsActive = true; IsActive = true;
var button = new GUIButton(new Rectangle(160, 50, 30, 30), "-", GUI.Style, GuiFrame);
button.OnClicked = (GUIButton btn, object obj) =>
{
targetForce -= 1.0f;
item.NewComponentEvent(this, true, false);
return true;
};
button = new GUIButton(new Rectangle(200, 50, 30, 30), "+", GUI.Style, GuiFrame);
button.OnClicked = (GUIButton btn, object obj) =>
{
targetForce += 1.0f;
item.NewComponentEvent(this, true, false);
return true;
};
} }
public float CurrentVolume public float CurrentVolume
@@ -94,17 +112,6 @@ namespace Barotrauma.Items.Components
spriteBatch.DrawString(GUI.Font, "Force: " + (int)(targetForce) + " %", new Vector2(GuiFrame.Rect.X + 30, GuiFrame.Rect.Y + 30), Color.White); spriteBatch.DrawString(GUI.Font, "Force: " + (int)(targetForce) + " %", new Vector2(GuiFrame.Rect.X + 30, GuiFrame.Rect.Y + 30), Color.White);
if (GUI.DrawButton(spriteBatch, new Rectangle(GuiFrame.Rect.X + 280, GuiFrame.Rect.Y + 80, 40, 40), "-", true))
{
targetForce -= 1.0f;
item.NewComponentEvent(this, true, false);
}
if (GUI.DrawButton(spriteBatch, new Rectangle(GuiFrame.Rect.X + 280, GuiFrame.Rect.Y + 30, 40, 40), "+", true))
{
targetForce += 1.0f;
item.NewComponentEvent(this, true, false);
}
} }
public override void UpdateBroken(float deltaTime, Camera cam) public override void UpdateBroken(float deltaTime, Camera cam)
+13 -4
View File
@@ -286,7 +286,7 @@ namespace Barotrauma
} }
public Item(Rectangle newRect, ItemPrefab itemPrefab, Submarine submarine) public Item(Rectangle newRect, ItemPrefab itemPrefab, Submarine submarine)
: base(submarine) : base(itemPrefab, submarine)
{ {
prefab = itemPrefab; prefab = itemPrefab;
@@ -487,6 +487,7 @@ namespace Barotrauma
public void ApplyStatusEffect(StatusEffect effect, ActionType type, float deltaTime, Character character = null) public void ApplyStatusEffect(StatusEffect effect, ActionType type, float deltaTime, Character character = null)
{ {
if (condition == 0.0f && effect.type != ActionType.OnBroken) return; if (condition == 0.0f && effect.type != ActionType.OnBroken) return;
if (effect.type != type) return;
bool hasTargets = (effect.TargetNames == null); bool hasTargets = (effect.TargetNames == null);
@@ -501,7 +502,7 @@ namespace Barotrauma
List<IPropertyObject> targets = new List<IPropertyObject>(); List<IPropertyObject> targets = new List<IPropertyObject>();
if (containedItems!=null) if (containedItems != null)
{ {
if (effect.Targets.HasFlag(StatusEffect.TargetType.Contained)) if (effect.Targets.HasFlag(StatusEffect.TargetType.Contained))
{ {
@@ -528,9 +529,14 @@ namespace Barotrauma
} }
} }
if (!hasTargets) return; if (!hasTargets) return;
if (effect.Targets.HasFlag(StatusEffect.TargetType.Hull) && CurrentHull != null)
{
targets.Add(CurrentHull);
}
if (effect.Targets.HasFlag(StatusEffect.TargetType.This)) if (effect.Targets.HasFlag(StatusEffect.TargetType.This))
{ {
foreach (var pobject in AllPropertyObjects) foreach (var pobject in AllPropertyObjects)
@@ -576,6 +582,9 @@ namespace Barotrauma
public override void Update(Camera cam, float deltaTime) public override void Update(Camera cam, float deltaTime)
{ {
ApplyStatusEffects(ActionType.Always, deltaTime, null);
foreach (ItemComponent ic in components) foreach (ItemComponent ic in components)
{ {
if (ic.Parent != null) ic.IsActive = ic.Parent.IsActive; if (ic.Parent != null) ic.IsActive = ic.Parent.IsActive;
@@ -1210,7 +1219,7 @@ namespace Barotrauma
element.Add(new XAttribute("name", prefab.Name), element.Add(new XAttribute("name", prefab.Name),
new XAttribute("ID", ID)); new XAttribute("ID", ID));
if (prefab.ResizeHorizontal || prefab.ResizeVertical) if (ResizeHorizontal || ResizeVertical)
{ {
element.Add(new XAttribute("rect", element.Add(new XAttribute("rect",
(int)(rect.X - Submarine.HiddenSubPosition.X) + "," + (int)(rect.X - Submarine.HiddenSubPosition.X) + "," +
+7 -5
View File
@@ -116,11 +116,13 @@ namespace Barotrauma
if (!fireSources[i].CheckOverLap(fireSources[j])) continue; if (!fireSources[i].CheckOverLap(fireSources[j])) continue;
fireSources[j].position.X = Math.Min(fireSources[i].position.X, fireSources[j].position.X); float leftEdge = Math.Min(fireSources[i].position.X, fireSources[j].position.X);
fireSources[j].size.X = fireSources[j].size.X =
Math.Max(fireSources[i].position.X + fireSources[i].size.X, fireSources[j].position.X + fireSources[j].size.X) Math.Max(fireSources[i].position.X + fireSources[i].size.X, fireSources[j].position.X + fireSources[j].size.X)
- fireSources[j].position.X; - leftEdge;
fireSources[j].position.X = leftEdge;
fireSources[i].Remove(); fireSources[i].Remove();
} }
@@ -140,7 +142,7 @@ namespace Barotrauma
public void Update(float deltaTime) public void Update(float deltaTime)
{ {
float count = Rand.Range(0.0f, (float)Math.Sqrt(size.X)/3.0f); float count = Rand.Range(0.0f, size.X/50.0f);
if (fireSoundBasic != null) if (fireSoundBasic != null)
{ {
@@ -176,7 +178,7 @@ namespace Barotrauma
if (Rand.Int(20) == 1) particle.OnChangeHull = OnChangeHull; if (Rand.Int(20) == 1) particle.OnChangeHull = OnChangeHull;
particle.Size *= MathHelper.Clamp(size.X/100.0f * Math.Max(hull.Oxygen/hull.FullVolume, 0.4f), 0.5f, 4.0f); particle.Size *= MathHelper.Clamp(size.X/60.0f * Math.Max(hull.Oxygen/hull.FullVolume, 0.4f), 0.5f, 3.0f);
if (size.X < 100.0f) continue; if (size.X < 100.0f) continue;
@@ -218,7 +220,7 @@ namespace Barotrauma
if (particleHull.FireSources.Find(fs => pos.X > fs.position.X-100.0f && pos.X < fs.position.X+fs.size.X+100.0f)!=null) return; if (particleHull.FireSources.Find(fs => pos.X > fs.position.X-100.0f && pos.X < fs.position.X+fs.size.X+100.0f)!=null) return;
new FireSource(new Vector2(pos.X, particleHull.Rect.Y-particleHull.Rect.Height + 5.0f)); new FireSource(new Vector2(pos.X, particleHull.WorldRect.Y-particleHull.Rect.Height + 5.0f));
} }
private void DamageCharacters(float deltaTime) private void DamageCharacters(float deltaTime)
+75 -42
View File
@@ -20,15 +20,15 @@ namespace Barotrauma
//private Sound waterSound; //private Sound waterSound;
//a value between 0.0f-1.0f (0.0 = closed, 1.0f = open) //a value between 0.0f-1.0f (0.0 = closed, 1.0f = open)
float open; private float open;
//the force of the water flow which is exerted on physics bodies //the force of the water flow which is exerted on physics bodies
Vector2 flowForce; private Vector2 flowForce;
Hull flowTargetHull; private Hull flowTargetHull;
float higherSurface; private float higherSurface;
float lowerSurface; private float lowerSurface;
public float Open public float Open
@@ -39,11 +39,6 @@ namespace Barotrauma
public Door ConnectedDoor; public Door ConnectedDoor;
//public Vector2 FlowForce
//{
// get { return flowForce*soundVolume; }
//}
public Vector2 LerpedFlowForce public Vector2 LerpedFlowForce
{ {
get { return lerpedFlowForce; } get { return lerpedFlowForce; }
@@ -64,6 +59,20 @@ namespace Barotrauma
} }
} }
public override Rectangle Rect
{
get
{
return base.Rect;
}
set
{
base.Rect = value;
FindHulls();
}
}
public Gap(MapEntityPrefab prefab, Rectangle rectangle) public Gap(MapEntityPrefab prefab, Rectangle rectangle)
: this (rectangle, Submarine.Loaded) : this (rectangle, Submarine.Loaded)
{ } { }
@@ -73,7 +82,7 @@ namespace Barotrauma
{ } { }
public Gap(Rectangle newRect, bool isHorizontal, Submarine submarine) public Gap(Rectangle newRect, bool isHorizontal, Submarine submarine)
: base (submarine) : base (MapEntityPrefab.list.Find(m=> m.Name == "Gap"), submarine)
{ {
rect = newRect; rect = newRect;
linkedTo = new ObservableCollection<MapEntity>(); linkedTo = new ObservableCollection<MapEntity>();
@@ -154,9 +163,12 @@ namespace Barotrauma
if (GameMain.DebugDraw) if (GameMain.DebugDraw)
{ {
Vector2 center = new Vector2(WorldRect.X + rect.Width / 2.0f, -(WorldRect.Y - rect.Height/ 2.0f)); Vector2 center = new Vector2(WorldRect.X + rect.Width / 2.0f, -(WorldRect.Y - rect.Height/ 2.0f));
GUI.DrawLine(sb, center, center + flowForce/10.0f, Color.Red);
GUI.DrawLine(sb, center + Vector2.One * 5.0f, center + lerpedFlowForce / 10.0f + Vector2.One * 5.0f, Color.Orange);
GUI.DrawLine(sb, center, center + new Vector2(flowForce.X, -flowForce.Y)/10.0f, Color.Red);
GUI.DrawLine(sb, center + Vector2.One * 5.0f, center + new Vector2(lerpedFlowForce.X, -lerpedFlowForce.Y) / 10.0f + Vector2.One * 5.0f, Color.Orange);
} }
if (!editing || !ShowGaps) return; if (!editing || !ShowGaps) return;
@@ -166,33 +178,20 @@ namespace Barotrauma
GUI.DrawRectangle(sb, new Rectangle(WorldRect.X, -WorldRect.Y, rect.Width, rect.Height), clr * 0.5f, true); GUI.DrawRectangle(sb, new Rectangle(WorldRect.X, -WorldRect.Y, rect.Width, rect.Height), clr * 0.5f, true);
if (isHorizontal) for (int i = 0; i < linkedTo.Count; i++)
{ {
for (int i = 0; i < linkedTo.Count; i++ ) Vector2 dir = isHorizontal ?
{ new Vector2(Math.Sign(linkedTo[i].Rect.Center.X - rect.Center.X), 0.0f)
if (linkedTo[i].Rect.Center.X > rect.Center.X) : new Vector2(0.0f, Math.Sign((linkedTo[i].Rect.Y - linkedTo[i].Rect.Height / 2.0f) - (rect.Y - rect.Height / 2.0f)));
{
GUI.DrawRectangle(sb, new Rectangle(WorldRect.Right, -WorldRect.Y, 10, rect.Height), Color.Green * 0.3f, true); Vector2 arrowPos = new Vector2(WorldRect.Center.X, -(WorldRect.Y - WorldRect.Height / 2));
} arrowPos += new Vector2(dir.X * (WorldRect.Width / 2 + 10), dir.Y * (WorldRect.Height / 2 + 10));
else
{ GUI.Arrow.Draw(sb,
GUI.DrawRectangle(sb, new Rectangle(WorldRect.X - 10, -WorldRect.Y, 10, rect.Height), Color.Green * 0.3f, true); arrowPos,
} clr * 0.8f,
} GUI.Arrow.Origin, MathUtils.VectorToAngle(dir) + MathHelper.PiOver2,
} isHorizontal ? new Vector2(rect.Height / 16.0f, 1.0f) : new Vector2(rect.Width / 16.0f, 1.0f));
else
{
for (int i = 0; i < linkedTo.Count; i++)
{
if (linkedTo[i].Rect.Y - linkedTo[i].Rect.Height / 2.0f > rect.Y-rect.Height/2.0f)
{
GUI.DrawRectangle(sb, new Rectangle(WorldRect.X, -WorldRect.Y - 10, rect.Width, 10), Color.Green * 0.3f, true);
}
else
{
GUI.DrawRectangle(sb, new Rectangle(WorldRect.X, -WorldRect.Y + rect.Height, rect.Width, 10), Color.Green * 0.3f, true);
}
}
} }
if (isSelected) if (isSelected)
@@ -290,6 +289,25 @@ namespace Barotrauma
} }
if (flowTargetHull != null && lerpedFlowForce != Vector2.Zero)
{
foreach (Character character in Character.CharacterList)
{
if (character.AnimController.CurrentHull != flowTargetHull) continue;
foreach (Limb limb in character.AnimController.Limbs)
{
if (!limb.inWater) continue;
float dist = Vector2.Distance(limb.WorldPosition, WorldPosition);
if (dist > lerpedFlowForce.Length()) continue;
limb.body.ApplyForce(lerpedFlowForce / dist/10.0f);
}
}
}
} }
void UpdateRoomToRoom(float deltaTime) void UpdateRoomToRoom(float deltaTime)
@@ -444,7 +462,7 @@ namespace Barotrauma
if (open > 0.0f) if (open > 0.0f)
{ {
if (hull1.Volume>hull1.FullVolume && hull2.Volume>hull2.FullVolume) if (hull1.Volume > hull1.FullVolume - Hull.MaxCompress && hull2.Volume > hull2.FullVolume - Hull.MaxCompress)
{ {
float avgLethality = (hull1.LethalPressure + hull2.LethalPressure) / 2.0f; float avgLethality = (hull1.LethalPressure + hull2.LethalPressure) / 2.0f;
hull1.LethalPressure = avgLethality; hull1.LethalPressure = avgLethality;
@@ -497,21 +515,31 @@ namespace Barotrauma
lowerSurface = rect.Y; lowerSurface = rect.Y;
if (hull1.Volume < hull1.FullVolume - Hull.MaxCompress && if (hull1.Volume < hull1.FullVolume - Hull.MaxCompress &&
hull1.Surface > -rect.Y) hull1.Surface < rect.Y)
{ {
float vel = (rect.Y + hull1.Surface) * 0.03f;
if (rect.X > hull1.Rect.X + hull1.Rect.Width / 2.0f) if (rect.X > hull1.Rect.X + hull1.Rect.Width / 2.0f)
{ {
float vel = ((rect.Y - rect.Height / 2) - (hull1.Surface + hull1.WaveY[hull1.WaveY.Length - 1])) * 0.1f;
hull1.WaveVel[hull1.WaveY.Length - 1] += vel; hull1.WaveVel[hull1.WaveY.Length - 1] += vel;
hull1.WaveVel[hull1.WaveY.Length - 2] += vel; hull1.WaveVel[hull1.WaveY.Length - 2] += vel;
} }
else else
{ {
float vel = ((rect.Y - rect.Height / 2) - (hull1.Surface + hull1.WaveY[0])) * 0.1f;
hull1.WaveVel[0] += vel; hull1.WaveVel[0] += vel;
hull1.WaveVel[1] += vel; hull1.WaveVel[1] += vel;
} }
} }
else
{
hull1.LethalPressure += (Submarine.Loaded != null && Submarine.Loaded.AtDamageDepth) ? 100.0f * deltaTime : 10.0f * deltaTime;
}
} }
else else
{ {
@@ -523,7 +551,12 @@ namespace Barotrauma
{ {
flowForce = new Vector2(0.0f, delta); flowForce = new Vector2(0.0f, delta);
} }
if (hull1.Volume >= hull1.FullVolume - Hull.MaxCompress)
{
hull1.LethalPressure += (Submarine.Loaded != null && Submarine.Loaded.AtDamageDepth) ? 100.0f * deltaTime : 10.0f * deltaTime;
}
} }
} }
private void UpdateOxygen() private void UpdateOxygen()
+26 -14
View File
@@ -12,7 +12,7 @@ using Lidgren.Network;
namespace Barotrauma namespace Barotrauma
{ {
class Hull : MapEntity class Hull : MapEntity, IPropertyObject
{ {
public static List<Hull> hullList = new List<Hull>(); public static List<Hull> hullList = new List<Hull>();
private static EntityGrid entityGrid; private static EntityGrid entityGrid;
@@ -37,7 +37,11 @@ namespace Barotrauma
//how much excess water the room can contain (= more than the volume of the room) //how much excess water the room can contain (= more than the volume of the room)
public const float MaxCompress = 10000f; public const float MaxCompress = 10000f;
public readonly Dictionary<string, PropertyDescriptor> properties; public readonly Dictionary<string, ObjectProperty> properties;
public Dictionary<string, ObjectProperty> ObjectProperties
{
get { return properties; }
}
private float lethalPressure; private float lethalPressure;
@@ -71,6 +75,21 @@ namespace Barotrauma
} }
} }
public override Rectangle Rect
{
get
{
return base.Rect;
}
set
{
base.Rect = value;
Item.UpdateHulls();
Gap.UpdateHulls();
}
}
public override bool IsLinkable public override bool IsLinkable
{ {
get { return true; } get { return true; }
@@ -148,13 +167,13 @@ namespace Barotrauma
} }
public Hull(MapEntityPrefab prefab, Rectangle rectangle) public Hull(MapEntityPrefab prefab, Rectangle rectangle)
: this (rectangle, Submarine.Loaded) : this (prefab, rectangle, Submarine.Loaded)
{ {
} }
public Hull(Rectangle rectangle, Submarine submarine) public Hull(MapEntityPrefab prefab, Rectangle rectangle, Submarine submarine)
: base (submarine) : base (prefab, submarine)
{ {
rect = rectangle; rect = rectangle;
@@ -162,9 +181,7 @@ namespace Barotrauma
fireSources = new List<FireSource>(); fireSources = new List<FireSource>();
properties = TypeDescriptor.GetProperties(GetType()) properties = ObjectProperty.GetProperties(this);
.Cast<PropertyDescriptor>()
.ToDictionary(pr => pr.Name);
int arraySize = (rectangle.Width / WaveWidth + 1); int arraySize = (rectangle.Width / WaveWidth + 1);
waveY = new float[arraySize]; waveY = new float[arraySize];
@@ -434,11 +451,6 @@ namespace Barotrauma
update = false; update = false;
} }
} }
else
{
LethalPressure += ( Submarine.Loaded!=null && Submarine.Loaded.AtDamageDepth) ? 100.0f*deltaTime : 10.0f * deltaTime;
}
} }
public void HandleItems(float deltaTime, Item body) public void HandleItems(float deltaTime, Item body)
@@ -720,7 +732,7 @@ namespace Barotrauma
int.Parse(element.Attribute("height").Value)); int.Parse(element.Attribute("height").Value));
} }
Hull h = new Hull(rect, submarine); Hull h = new Hull(MapEntityPrefab.list.Find(m => m.Name == "Hull"), rect, submarine);
h.volume = ToolBox.GetAttributeFloat(element, "pressure", 0.0f); h.volume = ToolBox.GetAttributeFloat(element, "pressure", 0.0f);
@@ -2,6 +2,7 @@
using System.IO; using System.IO;
using Microsoft.Xna.Framework; using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
namespace Barotrauma namespace Barotrauma
{ {
@@ -25,20 +26,20 @@ namespace Barotrauma
get { return waterTexture; } get { return waterTexture; }
} }
public WaterRenderer(GraphicsDevice graphicsDevice) public WaterRenderer(GraphicsDevice graphicsDevice, ContentManager content)
{ {
#if WINDOWS #if WINDOWS
byte[] bytecode = File.ReadAllBytes("Content/watershader.mgfx"); waterEffect = content.Load<Effect>("watershader");
#endif #endif
#if LINUX #if LINUX
byte[] bytecode = File.ReadAllBytes("Content/watershader_opengl.mgfx");
#endif
waterEffect = new Effect(graphicsDevice, bytecode); waterEffect = content.Load<Effect>("watershader_opengl");
#endif
waterTexture = TextureLoader.FromFile("Content/waterbump.png"); waterTexture = TextureLoader.FromFile("Content/waterbump.png");
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 #if WINDOWS
//waterEffect.Parameters["xTexture"].SetValue(waterTexture); //waterEffect.Parameters["xTexture"].SetValue(waterTexture);
#endif #endif
+112 -8
View File
@@ -24,6 +24,8 @@ namespace Barotrauma
protected static Vector2 startMovingPos = Vector2.Zero; protected static Vector2 startMovingPos = Vector2.Zero;
private MapEntityPrefab prefab;
protected List<ushort> linkedToID; protected List<ushort> linkedToID;
//observable collection because some entities may need to be notified when the collection is modified //observable collection because some entities may need to be notified when the collection is modified
@@ -67,6 +69,9 @@ namespace Barotrauma
//the position and dimensions of the entity //the position and dimensions of the entity
protected Rectangle rect; protected Rectangle rect;
private static bool resizing;
private int resizeDirX, resizeDirY;
public virtual Rectangle Rect { public virtual Rectangle Rect {
get { return rect; } get { return rect; }
set { rect = value; } set { rect = value; }
@@ -139,12 +144,24 @@ namespace Barotrauma
set { isSelected = value; } set { isSelected = value; }
} }
protected bool ResizeHorizontal
{
get { return prefab == null ? false : prefab.ResizeHorizontal; }
}
protected bool ResizeVertical
{
get { return prefab == null ? false : prefab.ResizeVertical; }
}
public virtual string Name public virtual string Name
{ {
get { return ""; } get { return ""; }
} }
public MapEntity(Submarine submarine) : base(submarine) { } public MapEntity(MapEntityPrefab prefab, Submarine submarine) : base(submarine)
{
this.prefab = prefab;
}
public virtual void Move(Vector2 amount) public virtual void Move(Vector2 amount)
{ {
@@ -232,6 +249,12 @@ namespace Barotrauma
/// </summary> /// </summary>
public static void UpdateSelecting(Camera cam) public static void UpdateSelecting(Camera cam)
{ {
if (resizing)
{
if (selectedList.Count == 0) resizing = false;
return;
}
foreach (MapEntity e in mapEntityList) foreach (MapEntity e in mapEntityList)
{ {
e.isHighlighted = false; e.isHighlighted = false;
@@ -412,6 +435,11 @@ namespace Barotrauma
if (selectedList.Count == 1) if (selectedList.Count == 1)
{ {
selectedList[0].DrawEditing(spriteBatch, cam); selectedList[0].DrawEditing(spriteBatch, cam);
if (selectedList[0].ResizeHorizontal || selectedList[0].ResizeVertical)
{
selectedList[0].DrawResizing(spriteBatch, cam);
}
} }
else else
{ {
@@ -443,6 +471,89 @@ namespace Barotrauma
public virtual void DrawEditing(SpriteBatch spriteBatch, Camera cam) {} public virtual void DrawEditing(SpriteBatch spriteBatch, Camera cam) {}
private void DrawResizing(SpriteBatch spriteBatch, Camera cam)
{
isHighlighted = true;
int startX = ResizeHorizontal ? -1 : 0;
int StartY = ResizeVertical ? -1 : 0;
for (int x = startX; x < 2; x += 2)
{
for (int y = StartY; y < 2; y += 2)
{
Vector2 handlePos = cam.WorldToScreen(Position + new Vector2(x * (rect.Width * 0.5f + 5), y * (rect.Height * 0.5f + 5)));
bool highlighted = Vector2.Distance(PlayerInput.MousePosition, handlePos)<5.0f;
GUI.DrawRectangle(spriteBatch, handlePos - new Vector2(3.0f, 3.0f), new Vector2(6.0f, 6.0f), Color.White * (highlighted ? 1.0f : 0.6f), true);
if (highlighted)
{
if (PlayerInput.LeftButtonDown())
{
selectionPos = Vector2.Zero;
resizeDirX = x;
resizeDirY = y;
resizing = true;
}
}
}
}
if (resizing)
{
Vector2 placePosition = new Vector2(rect.X, rect.Y);
Vector2 placeSize = new Vector2(rect.Width, rect.Height);
Vector2 mousePos = Submarine.MouseToWorldGrid(cam);
if (resizeDirX >0)
{
mousePos.X = Math.Max(mousePos.X, rect.X + Submarine.GridSize.X);
placeSize.X = mousePos.X - placePosition.X;
}
else if (resizeDirX <0)
{
mousePos.X = Math.Min(mousePos.X, rect.Right - Submarine.GridSize.X);
placeSize.X = (placePosition.X + placeSize.X)-mousePos.X;
placePosition.X = mousePos.X;
}
if (resizeDirY < 0)
{
mousePos.Y = Math.Min(mousePos.Y, rect.Y - Submarine.GridSize.Y);
placeSize.Y = placePosition.Y-mousePos.Y;
}
else if (resizeDirY > 0)
{
mousePos.Y = Math.Max(mousePos.Y, rect.Y - rect.Height + Submarine.GridSize.X);
placeSize.Y = mousePos.Y - (rect.Y - rect.Height);
placePosition.Y = mousePos.Y;
}
if ((int)placePosition.X != rect.X || (int)placePosition.Y != rect.Y || (int)placeSize.X != rect.Width || (int)placeSize.Y != rect.Height)
{
Rect = new Rectangle((int)placePosition.X, (int)placePosition.Y, (int)placeSize.X, (int)placeSize.Y);
}
if (!PlayerInput.LeftButtonHeld())
{
resizing = false;
}
//if (resizeHorizontal) placeSize.X = position.X - placePosition.X;
//if (resizeVertical) placeSize.Y = placePosition.Y - position.Y;
//Rectangle newRect = Submarine.AbsRect(placePosition, placeSize);
//newRect.Width = (int)Math.Max(newRect.Width, Submarine.GridSize.X);
//newRect.Height = (int)Math.Max(newRect.Height, Submarine.GridSize.Y);
}
}
public static List<MapEntity> FindMapEntities(Vector2 pos) public static List<MapEntity> FindMapEntities(Vector2 pos)
{ {
List<MapEntity> foundEntities = new List<MapEntity>(); List<MapEntity> foundEntities = new List<MapEntity>();
@@ -518,13 +629,6 @@ namespace Barotrauma
{ {
mapEntityList[i].OnMapLoaded(); mapEntityList[i].OnMapLoaded();
} }
//mapEntityList.Sort((x, y) =>
//{
// return x.Name.CompareTo(y.Name);
//});
} }
+1 -1
View File
@@ -142,7 +142,7 @@ namespace Barotrauma
} }
public Structure(Rectangle rectangle, StructurePrefab sp, Submarine submarine) public Structure(Rectangle rectangle, StructurePrefab sp, Submarine submarine)
: base(submarine) : base(sp, submarine)
{ {
if (rectangle.Width == 0 || rectangle.Height == 0) return; if (rectangle.Width == 0 || rectangle.Height == 0) return;
+45 -34
View File
@@ -511,17 +511,17 @@ namespace Barotrauma
return true; return true;
} }
public static bool SaveCurrent(string fileName) public static bool SaveCurrent(string filePath)
{ {
if (loaded==null) if (loaded==null)
{ {
loaded = new Submarine(fileName); loaded = new Submarine(filePath);
// return; // return;
} }
loaded.filePath = SavePath + System.IO.Path.DirectorySeparatorChar + fileName; loaded.filePath = filePath;
return loaded.SaveAs(SavePath+System.IO.Path.DirectorySeparatorChar+fileName); return loaded.SaveAs(filePath);
} }
public void CheckForErrors() public void CheckForErrors()
@@ -590,7 +590,7 @@ namespace Barotrauma
{ {
try try
{ {
filePaths.AddRange(Directory.GetDirectories(subDirectory)); filePaths.AddRange(Directory.GetFiles(subDirectory).ToList());
} }
catch (Exception e) catch (Exception e)
{ {
@@ -604,6 +604,8 @@ namespace Barotrauma
//Map savedMap = new Map(mapPath); //Map savedMap = new Map(mapPath);
SavedSubmarines.Add(new Submarine(path)); SavedSubmarines.Add(new Submarine(path));
} }
if (GameMain.NetLobbyScreen!=null) GameMain.NetLobbyScreen.UpdateSubList();
} }
private XDocument OpenDoc(string file) private XDocument OpenDoc(string file)
@@ -629,10 +631,14 @@ namespace Barotrauma
if (extension == ".sub") if (extension == ".sub")
{ {
Stream stream = SaveUtil.DecompressFiletoStream(file); Stream stream = null;
if (stream == null) try
{ {
DebugConsole.ThrowError("Loading submarine ''" + file + "'' failed!"); stream = SaveUtil.DecompressFiletoStream(file);
}
catch (Exception e)
{
DebugConsole.ThrowError("Loading submarine ''" + file + "'' failed!", e);
return null; return null;
} }
@@ -713,37 +719,42 @@ namespace Barotrauma
} }
} }
Vector2 topLeft = new Vector2(Hull.hullList[0].Rect.X, Hull.hullList[0].Rect.Y); Vector2 center = Vector2.Zero;
Vector2 bottomRight = new Vector2(Hull.hullList[0].Rect.X, Hull.hullList[0].Rect.Y);
foreach (Hull hull in Hull.hullList) if (Hull.hullList.Any())
{ {
if (hull.Rect.X < topLeft.X) topLeft.X = hull.Rect.X; Vector2 topLeft = new Vector2(Hull.hullList[0].Rect.X, Hull.hullList[0].Rect.Y);
if (hull.Rect.Y > topLeft.Y) topLeft.Y = hull.Rect.Y; Vector2 bottomRight = new Vector2(Hull.hullList[0].Rect.X, Hull.hullList[0].Rect.Y);
foreach (Hull hull in Hull.hullList)
if (hull.Rect.Right > bottomRight.X) bottomRight.X = hull.Rect.Right;
if (hull.Rect.Y - hull.Rect.Height < bottomRight.Y) bottomRight.Y = hull.Rect.Y - hull.Rect.Height;
}
Vector2 center = (topLeft + bottomRight) / 2.0f;
center.X -= center.X % GridSize.X;
center.Y -= center.Y % GridSize.Y;
foreach (Item item in Item.ItemList)
{
var wire = item.GetComponent<Items.Components.Wire>();
if (wire == null) continue;
for (int i = 0; i < wire.Nodes.Count; i++)
{ {
wire.Nodes[i] -= center; if (hull.Rect.X < topLeft.X) topLeft.X = hull.Rect.X;
if (hull.Rect.Y > topLeft.Y) topLeft.Y = hull.Rect.Y;
if (hull.Rect.Right > bottomRight.X) bottomRight.X = hull.Rect.Right;
if (hull.Rect.Y - hull.Rect.Height < bottomRight.Y) bottomRight.Y = hull.Rect.Y - hull.Rect.Height;
} }
}
for (int i = 0; i < MapEntity.mapEntityList.Count; i++) center = (topLeft + bottomRight) / 2.0f;
{ center.X -= center.X % GridSize.X;
if (MapEntity.mapEntityList[i].Submarine == null) continue; center.Y -= center.Y % GridSize.Y;
MapEntity.mapEntityList[i].Move(-center); foreach (Item item in Item.ItemList)
{
var wire = item.GetComponent<Items.Components.Wire>();
if (wire == null) continue;
for (int i = 0; i < wire.Nodes.Count; i++)
{
wire.Nodes[i] -= center;
}
}
for (int i = 0; i < MapEntity.mapEntityList.Count; i++)
{
if (MapEntity.mapEntityList[i].Submarine == null) continue;
MapEntity.mapEntityList[i].Move(-center);
}
} }
subBody = new SubmarineBody(this); subBody = new SubmarineBody(this);
+14 -7
View File
@@ -226,25 +226,32 @@ namespace Barotrauma
if (dist > 1000.0f) if (dist > 1000.0f)
{ {
Vector2 moveAmount = ConvertUnits.ToSimUnits((Vector2)targetPosition) - body.Position; Vector2 moveAmount = ConvertUnits.ToSimUnits((Vector2)targetPosition) - body.Position;
Vector2 displayerMoveAmount = ConvertUnits.ToDisplayUnits(moveAmount); Vector2 displayMoveAmount = ConvertUnits.ToDisplayUnits(moveAmount);
body.SetTransform(body.Position + moveAmount, 0.0f); body.SetTransform(body.Position + moveAmount, 0.0f);
if (Character.Controlled != null) Character.Controlled.CursorPosition += displayerMoveAmount; if (Character.Controlled != null) Character.Controlled.CursorPosition += displayMoveAmount;
GameMain.GameScreen.Cam.Position += displayerMoveAmount; GameMain.GameScreen.Cam.Position += displayMoveAmount;
GameMain.GameScreen.Cam.UpdateTransform(); if (GameMain.GameScreen.Cam.TargetPos!=Vector2.Zero) GameMain.GameScreen.Cam.TargetPos += displayMoveAmount;
GameMain.GameScreen.Cam.UpdateTransform(false);
submarine.SetPrevTransform(submarine.Position);
submarine.UpdateTransform();
targetPosition = null; targetPosition = null;
} }
else if (dist > 50.0f) else if (dist > 50.0f)
{ {
Vector2 moveAmount = Vector2.Normalize((Vector2)targetPosition - Position); Vector2 moveAmount = Vector2.Normalize((Vector2)targetPosition - Position);
moveAmount *= ConvertUnits.ToSimUnits(Math.Min(dist, 100.0f)); moveAmount *= ConvertUnits.ToSimUnits(Math.Min(dist, 100.0f));
Vector2 displayerMoveAmount = ConvertUnits.ToDisplayUnits(moveAmount); Vector2 displayMoveAmount = ConvertUnits.ToDisplayUnits(moveAmount);
body.SetTransform(body.Position + moveAmount * deltaTime, 0.0f); body.SetTransform(body.Position + moveAmount * deltaTime, 0.0f);
GameMain.GameScreen.Cam.Position += displayerMoveAmount * deltaTime; GameMain.GameScreen.Cam.Position += displayMoveAmount * deltaTime;
if (Character.Controlled != null) Character.Controlled.CursorPosition += displayerMoveAmount; if (GameMain.GameScreen.Cam.TargetPos != Vector2.Zero) GameMain.GameScreen.Cam.TargetPos += displayMoveAmount;
if (Character.Controlled != null) Character.Controlled.CursorPosition += displayMoveAmount;
//GameMain.GameScreen.Cam.UpdateTransform(false);
} }
else else
{ {
+1 -1
View File
@@ -96,7 +96,7 @@ namespace Barotrauma
} }
public WayPoint(Rectangle newRect, Submarine submarine) public WayPoint(Rectangle newRect, Submarine submarine)
: base (submarine) : base (null, submarine)
{ {
rect = newRect; rect = newRect;
linkedTo = new ObservableCollection<MapEntity>(); linkedTo = new ObservableCollection<MapEntity>();
@@ -1,16 +1,49 @@
using Lidgren.Network; using Lidgren.Network;
using System; using System;
using System.IO; using System.IO;
using System.Text.RegularExpressions;
using System.Xml;
using System.Xml.Linq;
namespace Barotrauma.Networking namespace Barotrauma.Networking
{ {
class FileStreamReceiver class FileStreamReceiver : IDisposable
{ {
private NetClient s_client; const int MaxFileSize = 1000000;
private ulong s_length;
private ulong s_received; public delegate void OnFinished(FileStreamReceiver fileStreamReceiver);
private FileStream s_writeStream; private OnFinished onFinished;
private int s_timeStarted;
private NetClient client;
private ulong length;
private ulong received;
private FileStream writeStream;
private int timeStarted;
private string downloadFolder;
private FileTransferMessageType fileType;
public string FileName
{
get;
private set;
}
public ulong FileSize
{
get { return length; }
}
public ulong Received
{
get { return received; }
}
public FileTransferMessageType FileType
{
get { return fileType; }
}
public FileTransferStatus Status public FileTransferStatus Status
{ {
@@ -18,53 +51,263 @@ namespace Barotrauma.Networking
private set; private set;
} }
public string ErrorMessage
{
get;
private set;
}
public float BytesPerSecond public float BytesPerSecond
{ {
get; get;
private set; private set;
} }
public FileStreamReceiver(NetClient client) public float Progress
{ {
s_client = client; get { return (float)received / (float)length; }
}
public FileStreamReceiver(NetClient client, string filePath, FileTransferMessageType fileType, OnFinished onFinished)
{
this.client = client;
this.downloadFolder = filePath;
this.fileType = fileType;
this.onFinished = onFinished;
Status = FileTransferStatus.NotStarted; Status = FileTransferStatus.NotStarted;
} }
public void ReadMessage(NetIncomingMessage inc) public void ReadMessage(NetIncomingMessage inc)
{ {
int chunkLen = inc.LengthBytes; try
if (s_length == 0)
{ {
s_length = inc.ReadUInt64(); TryReadMessage(inc);
string filename = inc.ReadString(); }
s_writeStream = new FileStream(filename, FileMode.Create, FileAccess.Write, FileShare.None); catch (Exception e)
s_timeStarted = Environment.TickCount; {
ErrorMessage = "Error while receiving file ''"+FileName+"'' {"+e.Message+"}";
DeleteFile();
if (onFinished != null) onFinished(this);
}
}
private bool ValidateInitialData(byte type, string fileName, ulong fileSize)
{
if (fileSize > MaxFileSize)
{
ErrorMessage = "File too large (" + MathUtils.GetBytesReadable((long)fileSize) + ")";
return false;
}
if (type != (byte)fileType)
{
ErrorMessage = "Unexpected file type ''" + type + "'' (expected " + fileType + ")";
return false;
}
if (!Regex.Match(fileName, @"^[\w\- ]+[\w\-. ]*$").Success)
{
ErrorMessage = "Illegal characters in file name ''" + fileName + "''";
return false;
}
switch (type)
{
case (byte)FileTransferMessageType.Submarine:
if (Path.GetExtension(fileName) != ".sub")
{
ErrorMessage = "Wrong file extension ''" + Path.GetExtension(fileName) + "''! (Expected .sub)";
return false;
}
break;
}
return true;
}
public void DeleteFile()
{
if (FileName == null) return;
string file = Path.Combine(downloadFolder, FileName);
if (writeStream!=null)
{
writeStream.Flush();
writeStream.Close();
writeStream.Dispose();
writeStream = null;
}
Status = FileTransferStatus.Canceled;
if (File.Exists(file))
{
try
{
File.Delete(file);
}
catch (Exception e)
{
DebugConsole.ThrowError("Couldn't delete file ''" + file + "''!", e);
}
}
}
private void TryReadMessage(NetIncomingMessage inc)
{
if (Status == FileTransferStatus.Error ||
Status == FileTransferStatus.Finished ||
Status == FileTransferStatus.Canceled) return;
byte transferMessageType = inc.ReadByte();
//int chunkLen = inc.LengthBytes;
if (length == 0)
{
if (transferMessageType != (byte)FileTransferMessageType.Initiate) return;
if (!string.IsNullOrWhiteSpace(downloadFolder) && !Directory.Exists(downloadFolder))
{
Directory.CreateDirectory(downloadFolder);
}
byte fileTypeByte = inc.ReadByte();
length = inc.ReadUInt64();
FileName = inc.ReadString();
if (!ValidateInitialData(fileTypeByte, FileName, length))
{
Status = FileTransferStatus.Error;
DeleteFile();
if (onFinished != null) onFinished(this);
return;
}
writeStream = new FileStream(Path.Combine(downloadFolder, FileName), FileMode.Create, FileAccess.Write, FileShare.None);
timeStarted = Environment.TickCount;
Status = FileTransferStatus.NotStarted; Status = FileTransferStatus.NotStarted;
return; return;
} }
byte[] all = inc.ReadBytes(inc.LengthBytes);
s_received += (ulong)all.Length;
s_writeStream.Write(all, 0, all.Length);
int passed = Environment.TickCount - s_timeStarted; if (received + (ulong)inc.LengthBytes > length*1.1f)
{
ErrorMessage = "Receiving more data than expected (> " + MathUtils.GetBytesReadable((long)(received + (ulong)inc.LengthBytes)) + ")";
Status = FileTransferStatus.Error;
if (onFinished != null) onFinished(this);
return;
}
byte[] all = inc.ReadBytes(inc.LengthBytes - inc.PositionInBytes);
received += (ulong)all.Length;
writeStream.Write(all, 0, all.Length);
int passed = Environment.TickCount - timeStarted;
float psec = passed / 1000.0f; float psec = passed / 1000.0f;
BytesPerSecond = s_received / psec; BytesPerSecond = received / psec;
Status = FileTransferStatus.Receiving; Status = FileTransferStatus.Receiving;
if (s_received >= s_length)
{
s_writeStream.Flush();
s_writeStream.Close();
s_writeStream.Dispose();
Status = FileTransferStatus.Finished; if (received >= length)
{
writeStream.Flush();
writeStream.Close();
writeStream.Dispose();
writeStream = null;
Status = IsReceivedFileValid() ? FileTransferStatus.Finished : FileTransferStatus.Error;
if (onFinished!=null) onFinished(this);
if (Status == FileTransferStatus.Error) DeleteFile();
Dispose();
}
}
private bool IsReceivedFileValid()
{
switch (fileType)
{
case FileTransferMessageType.Submarine:
string file = Path.Combine(downloadFolder, FileName);
Stream stream = null;
try
{
stream = SaveUtil.DecompressFiletoStream(file);
}
catch (Exception e)
{
ErrorMessage = "Loading submarine ''" + file + "'' failed! {"+ e.Message + "}";
return false;
}
if (stream == null)
{
ErrorMessage = "Decompressing submarine file''" + file + "'' failed!";
return false;
}
try
{
stream.Position = 0;
XmlReaderSettings settings = new XmlReaderSettings();
settings.DtdProcessing = DtdProcessing.Prohibit;
settings.IgnoreProcessingInstructions = true;
using (var reader = XmlReader.Create(stream, settings))
{
while (reader.Read())
{
}
}
}
catch
{
stream.Close();
stream.Dispose();
ErrorMessage = "Parsing file ''"+file+"'' failed! The file may not be a valid submarine file.";
return false;
}
stream.Close();
stream.Dispose();
break;
}
return true;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
if (writeStream != null)
{
writeStream.Flush();
writeStream.Close();
writeStream.Dispose();
} }
} }
} }
} }
+106 -18
View File
@@ -1,21 +1,35 @@
using Lidgren.Network; using Lidgren.Network;
using System;
using System.IO; using System.IO;
namespace Barotrauma.Networking namespace Barotrauma.Networking
{ {
enum FileTransferStatus enum FileTransferStatus
{ {
NotStarted, Sending, Receiving, Finished, Error NotStarted, Sending, Receiving, Finished, Error, Canceled
} }
class FileStreamSender enum FileTransferMessageType
{ {
Unknown, Initiate, Submarine, Cancel
}
class FileStreamSender : IDisposable
{
public static TimeSpan MaxTransferDuration = new TimeSpan(0, 2, 0);
private FileStream inputStream; private FileStream inputStream;
private int sentOffset; private int sentOffset;
private int chunkLen; private int chunkLen;
private byte[] tempBuffer; private byte[] tempBuffer;
private NetConnection connection; private NetConnection connection;
float waitTimer;
DateTime startingTime;
private FileTransferMessageType fileType;
public FileTransferStatus Status public FileTransferStatus Status
{ {
get; get;
@@ -28,34 +42,83 @@ namespace Barotrauma.Networking
private set; private set;
} }
public string FilePath
public static FileStreamSender Create(NetConnection conn, string fileName)
{ {
if (!File.Exists(fileName)) get;
private set;
}
public float Progress
{
get { return inputStream == null ? 0.0f : (float)sentOffset / (float)inputStream.Length; }
}
public int Sent
{
get { return sentOffset; }
}
public long FileSize
{
get { return inputStream == null ? 0 : inputStream.Length; }
}
public static FileStreamSender Create(NetConnection conn, string filePath, FileTransferMessageType fileType)
{
if (!File.Exists(filePath))
{ {
DebugConsole.ThrowError("Sending a file failed. File ''"+fileName+"'' not found."); DebugConsole.ThrowError("Sending a file failed. File ''"+filePath+"'' not found.");
return null; return null;
} }
return new FileStreamSender(conn, fileName); FileStreamSender sender = null;
try
{
sender = new FileStreamSender(conn, filePath, fileType);
}
catch (Exception e)
{
DebugConsole.ThrowError("Couldn't open file ''"+filePath+"''",e);
}
return sender;
} }
private FileStreamSender(NetConnection conn, string fileName) private FileStreamSender(NetConnection conn, string filePath, FileTransferMessageType fileType)
{ {
connection = conn; connection = conn;
inputStream = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.Read); inputStream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.Read);
chunkLen = connection.Peer.Configuration.MaximumTransmissionUnit - 20; chunkLen = connection.Peer.Configuration.MaximumTransmissionUnit - 100;
tempBuffer = new byte[chunkLen]; tempBuffer = new byte[chunkLen];
sentOffset = 0; sentOffset = 0;
FileName = fileName; FilePath = filePath;
FileName = Path.GetFileName(filePath);
this.fileType = fileType;
Status = FileTransferStatus.NotStarted; Status = FileTransferStatus.NotStarted;
startingTime = DateTime.Now;
} }
public void Update() public void Update(float deltaTime)
{ {
if (inputStream == null) return; if (inputStream == null ||
Status == FileTransferStatus.Canceled ||
Status == FileTransferStatus.Error ||
Status == FileTransferStatus.Finished) return;
if (DateTime.Now > startingTime + MaxTransferDuration)
{
CancelTransfer();
return;
}
waitTimer -= deltaTime;
if (waitTimer > 0.0f) return;
if (!connection.CanSendImmediately(NetDeliveryMethod.ReliableOrdered, 1)) return; if (!connection.CanSendImmediately(NetDeliveryMethod.ReliableOrdered, 1)) return;
@@ -70,7 +133,10 @@ namespace Barotrauma.Networking
if (sentOffset == 0) if (sentOffset == 0)
{ {
// first message; send length, chunk length and file name // first message; send length, chunk length and file name
message = connection.Peer.CreateMessage(sendBytes + 8); message = connection.Peer.CreateMessage(sendBytes + 8 + 1);
message.Write((byte)PacketTypes.FileStream);
message.Write((byte)FileTransferMessageType.Initiate);
message.Write((byte)fileType);
message.Write((ulong)inputStream.Length); message.Write((ulong)inputStream.Length);
message.Write(Path.GetFileName(inputStream.Name)); message.Write(Path.GetFileName(inputStream.Name));
connection.SendMessage(message, NetDeliveryMethod.ReliableOrdered, 1); connection.SendMessage(message, NetDeliveryMethod.ReliableOrdered, 1);
@@ -78,22 +144,44 @@ namespace Barotrauma.Networking
Status = FileTransferStatus.Sending; Status = FileTransferStatus.Sending;
} }
message = connection.Peer.CreateMessage(sendBytes + 8); message = connection.Peer.CreateMessage(sendBytes + 8 + 1);
message.Write((byte)PacketTypes.FileStream);
message.Write((byte)fileType);
message.Write(tempBuffer, 0, sendBytes); message.Write(tempBuffer, 0, sendBytes);
connection.SendMessage(message, NetDeliveryMethod.ReliableOrdered, 1); connection.SendMessage(message, NetDeliveryMethod.ReliableOrdered, 1);
sentOffset += sendBytes; sentOffset += sendBytes;
waitTimer = connection.AverageRoundtripTime;
//Program.Output("Sent " + m_sentOffset + "/" + m_inputStream.Length + " bytes to " + m_connection); //Program.Output("Sent " + m_sentOffset + "/" + m_inputStream.Length + " bytes to " + m_connection);
if (remaining - sendBytes <= 0) if (remaining - sendBytes <= 0)
{ {
inputStream.Close(); //Dispose();
inputStream.Dispose();
inputStream = null;
Status = FileTransferStatus.Finished; Status = FileTransferStatus.Finished;
} }
} }
public void CancelTransfer()
{
Status = FileTransferStatus.Canceled;
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
protected virtual void Dispose(bool disposing)
{
inputStream.Close();
inputStream.Dispose();
inputStream = null;
}
} }
} }
+153 -45
View File
@@ -4,6 +4,7 @@ using Microsoft.Xna.Framework;
using System.Collections.Generic; using System.Collections.Generic;
using Barotrauma.Networking.ReliableMessages; using Barotrauma.Networking.ReliableMessages;
using FarseerPhysics; using FarseerPhysics;
using System.IO;
namespace Barotrauma.Networking namespace Barotrauma.Networking
{ {
@@ -15,6 +16,8 @@ namespace Barotrauma.Networking
private ReliableChannel reliableChannel; private ReliableChannel reliableChannel;
private FileStreamReceiver fileStreamReceiver;
private GUITickBox endRoundButton; private GUITickBox endRoundButton;
private bool connected; private bool connected;
@@ -35,6 +38,11 @@ namespace Barotrauma.Networking
get { return otherClients; } get { return otherClients; }
} }
public string ActiveFileTransferName
{
get { return (fileStreamReceiver == null || fileStreamReceiver.Status == FileTransferStatus.Finished) ? "" : fileStreamReceiver.FileName; }
}
public GameClient(string newName) public GameClient(string newName)
{ {
endRoundButton = new GUITickBox(new Rectangle(GameMain.GraphicsWidth - 170, 20, 20, 20), "End round", Alignment.TopLeft, inGameHUD); endRoundButton = new GUITickBox(new Rectangle(GameMain.GraphicsWidth - 170, 20, 20, 20), "End round", Alignment.TopLeft, inGameHUD);
@@ -99,7 +107,7 @@ namespace Barotrauma.Networking
NetOutgoingMessage outmsg = client.CreateMessage(); NetOutgoingMessage outmsg = client.CreateMessage();
client.Start(); client.Start();
outmsg.WriteEnum(PacketTypes.Login); outmsg.Write((byte)PacketTypes.Login);
outmsg.Write(myID); outmsg.Write(myID);
outmsg.Write(password); outmsg.Write(password);
outmsg.Write(GameMain.Version.ToString()); outmsg.Write(GameMain.Version.ToString());
@@ -221,7 +229,7 @@ namespace Barotrauma.Networking
{ {
// All manually sent messages are type of "Data" // All manually sent messages are type of "Data"
case NetIncomingMessageType.Data: case NetIncomingMessageType.Data:
byte packetType = (byte)inc.ReadEnum<PacketTypes>(); byte packetType = inc.ReadByte();
if (packetType == (byte)PacketTypes.LoggedIn) if (packetType == (byte)PacketTypes.LoggedIn)
{ {
myID = inc.ReadByte(); myID = inc.ReadByte();
@@ -262,7 +270,7 @@ namespace Barotrauma.Networking
CanStart = true; CanStart = true;
NetOutgoingMessage lobbyUpdateRequest = client.CreateMessage(); NetOutgoingMessage lobbyUpdateRequest = client.CreateMessage();
lobbyUpdateRequest.WriteEnum(PacketTypes.RequestNetLobbyUpdate); lobbyUpdateRequest.Write((byte)PacketTypes.RequestNetLobbyUpdate);
client.SendMessage(lobbyUpdateRequest, NetDeliveryMethod.ReliableUnordered); client.SendMessage(lobbyUpdateRequest, NetDeliveryMethod.ReliableUnordered);
} }
else if (packetType == (byte)PacketTypes.KickedOut) else if (packetType == (byte)PacketTypes.KickedOut)
@@ -445,12 +453,12 @@ namespace Barotrauma.Networking
{ {
if (inc.MessageType != NetIncomingMessageType.Data) continue; if (inc.MessageType != NetIncomingMessageType.Data) continue;
byte packetType = (byte)inc.ReadEnum<PacketTypes>(); byte packetType = inc.ReadByte();
if (packetType == (byte)PacketTypes.ReliableMessage) if (packetType == (byte)PacketTypes.ReliableMessage)
{ {
if (!reliableChannel.CheckMessage(inc)) continue; if (!reliableChannel.CheckMessage(inc)) continue;
packetType = (byte)inc.ReadEnum<PacketTypes>(); packetType = inc.ReadByte();
} }
switch (packetType) switch (packetType)
@@ -474,6 +482,35 @@ namespace Barotrauma.Networking
AddChatMessage(otherClient.name + " has joined the server", ChatMessageType.Server); AddChatMessage(otherClient.name + " has joined the server", ChatMessageType.Server);
break;
case (byte)PacketTypes.RequestFile:
bool accepted = inc.ReadBoolean();
if (!accepted)
{
new GUIMessageBox("File transfer canceled", inc.ReadString());
if (fileStreamReceiver!=null)
{
fileStreamReceiver.DeleteFile();
fileStreamReceiver.Dispose();
fileStreamReceiver = null;
}
}
break;
case (byte)PacketTypes.FileStream:
if (fileStreamReceiver == null)
{
//todo: unexpected file
}
else
{
fileStreamReceiver.ReadMessage(inc);
}
break; break;
case (byte)PacketTypes.PlayerLeft: case (byte)PacketTypes.PlayerLeft:
byte leavingID = inc.ReadByte(); byte leavingID = inc.ReadByte();
@@ -510,7 +547,7 @@ namespace Barotrauma.Networking
break; break;
case (byte)PacketTypes.Chatmessage: case (byte)PacketTypes.Chatmessage:
ChatMessageType messageType = inc.ReadEnum<ChatMessageType>(); ChatMessageType messageType = (ChatMessageType)inc.ReadByte();
AddChatMessage(inc.ReadString(), messageType); AddChatMessage(inc.ReadString(), messageType);
break; break;
@@ -678,6 +715,23 @@ namespace Barotrauma.Networking
{ {
base.Draw(spriteBatch); base.Draw(spriteBatch);
if (fileStreamReceiver != null &&
(fileStreamReceiver.Status == FileTransferStatus.Receiving || fileStreamReceiver.Status == FileTransferStatus.NotStarted))
{
Vector2 pos = Screen.Selected == GameMain.NetLobbyScreen ?
new Vector2(GameMain.NetLobbyScreen.SubList.Rect.X, GameMain.NetLobbyScreen.SubList.Rect.Bottom+5) : new Vector2(GameMain.GraphicsWidth / 2 - 200, 10);
GUI.DrawString(spriteBatch, pos, "Downloading " + fileStreamReceiver.FileName, Color.White);
GUI.DrawString(spriteBatch, pos + Vector2.UnitX*300,
MathUtils.GetBytesReadable((long)fileStreamReceiver.Received) + " / " + MathUtils.GetBytesReadable((long)fileStreamReceiver.FileSize), Color.White);
GUI.DrawProgressBar(spriteBatch, new Vector2(pos.X, -pos.Y - 20), new Vector2(300, 15), fileStreamReceiver.Progress, Color.Green);
if (GUI.DrawButton(spriteBatch, new Rectangle((int)pos.X + 310, (int)pos.Y + 20, 100, 15), "Cancel", new Color(0.88f, 0.25f, 0.15f, 0.8f)))
{
CancelFileTransfer();
}
}
if (!GameMain.DebugDraw) return; if (!GameMain.DebugDraw) return;
int width = 200, height = 300; int width = 200, height = 300;
@@ -694,21 +748,75 @@ namespace Barotrauma.Networking
} }
public override void Disconnect() public override void Disconnect()
{ {
NetOutgoingMessage msg = client.CreateMessage(); NetOutgoingMessage msg = client.CreateMessage();
msg.WriteEnum(PacketTypes.PlayerLeft); msg.Write((byte)PacketTypes.PlayerLeft);
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered); client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
client.Shutdown(""); client.Shutdown("");
GameMain.NetworkMember = null; GameMain.NetworkMember = null;
} }
public void RequestFile(string file, FileTransferMessageType fileType)
{
if (fileStreamReceiver!=null)
{
CancelFileTransfer();
}
NetOutgoingMessage msg = client.CreateMessage();
msg.Write((byte)PacketTypes.RequestFile);
msg.Write((byte)fileType);
msg.Write(file);
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
fileStreamReceiver = new FileStreamReceiver(client, Path.Combine(Submarine.SavePath, "Downloaded"), fileType, OnFileReceived);
}
private void OnFileReceived(FileStreamReceiver receiver)
{
if (receiver.Status == FileTransferStatus.Error)
{
new GUIMessageBox("Error while receiving file from server", receiver.ErrorMessage, 400, 350);
receiver.DeleteFile();
}
else if (receiver.Status == FileTransferStatus.Finished)
{
new GUIMessageBox("Download finished", "File ''" + receiver.FileName + "'' was downloaded succesfully.");
switch (receiver.FileType)
{
case FileTransferMessageType.Submarine:
Submarine.Preload();
break;
}
}
fileStreamReceiver = null;
}
private void CancelFileTransfer()
{
fileStreamReceiver.DeleteFile();
fileStreamReceiver.Dispose();
fileStreamReceiver = null;
NetOutgoingMessage msg = client.CreateMessage();
msg.Write((byte)PacketTypes.RequestFile);
msg.Write((byte)FileTransferMessageType.Cancel);
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
}
public void Vote(VoteType voteType, object userData) public void Vote(VoteType voteType, object userData)
{ {
NetOutgoingMessage msg = client.CreateMessage(); NetOutgoingMessage msg = client.CreateMessage();
msg.WriteEnum(PacketTypes.Vote); msg.Write((byte)PacketTypes.Vote);
msg.WriteEnum(voteType); msg.Write((byte)voteType);
switch (voteType) switch (voteType)
{ {
@@ -729,7 +837,7 @@ namespace Barotrauma.Networking
public bool SpectateClicked(GUIButton button, object userData) public bool SpectateClicked(GUIButton button, object userData)
{ {
NetOutgoingMessage msg = client.CreateMessage(); NetOutgoingMessage msg = client.CreateMessage();
msg.WriteEnum(PacketTypes.SpectateRequest); msg.Write((byte)PacketTypes.SpectateRequest);
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered); client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
@@ -760,7 +868,7 @@ namespace Barotrauma.Networking
if (characterInfo == null) return; if (characterInfo == null) return;
NetOutgoingMessage msg = client.CreateMessage(); NetOutgoingMessage msg = client.CreateMessage();
msg.WriteEnum(PacketTypes.CharacterInfo); msg.Write((byte)PacketTypes.CharacterInfo);
msg.Write(characterInfo.Name); msg.Write(characterInfo.Name);
msg.Write(characterInfo.Gender == Gender.Male); msg.Write(characterInfo.Gender == Gender.Male);
@@ -837,8 +945,8 @@ namespace Barotrauma.Networking
(myCharacter == null || myCharacter.IsDead)) ? ChatMessageType.Dead : ChatMessageType.Default; (myCharacter == null || myCharacter.IsDead)) ? ChatMessageType.Dead : ChatMessageType.Default;
ReliableMessage msg = reliableChannel.CreateMessage(); ReliableMessage msg = reliableChannel.CreateMessage();
msg.InnerMessage.WriteEnum(PacketTypes.Chatmessage); msg.InnerMessage.Write((byte)PacketTypes.Chatmessage);
msg.InnerMessage.WriteEnum(type); msg.InnerMessage.Write((byte)type);
msg.InnerMessage.Write(message); msg.InnerMessage.Write(message);
reliableChannel.SendMessage(msg, client.ServerConnection); reliableChannel.SendMessage(msg, client.ServerConnection);
@@ -848,41 +956,41 @@ namespace Barotrauma.Networking
/// sends some random data to the server (can be a networkevent or just something completely random) /// sends some random data to the server (can be a networkevent or just something completely random)
/// use for debugging purposes /// use for debugging purposes
/// </summary> /// </summary>
public void SendRandomData() //public void SendRandomData()
{ //{
NetOutgoingMessage msg = client.CreateMessage(); // NetOutgoingMessage msg = client.CreateMessage();
switch (Rand.Int(5)) // switch (Rand.Int(5))
{ // {
case 0: // case 0:
msg.WriteEnum(PacketTypes.NetworkEvent); // msg.WriteEnum(PacketTypes.NetworkEvent);
msg.WriteEnum(NetworkEventType.EntityUpdate); // msg.WriteEnum(NetworkEventType.EntityUpdate);
msg.Write(Rand.Int(MapEntity.mapEntityList.Count)); // msg.Write(Rand.Int(MapEntity.mapEntityList.Count));
break; // break;
case 1: // case 1:
msg.WriteEnum(PacketTypes.NetworkEvent); // msg.WriteEnum(PacketTypes.NetworkEvent);
msg.Write((byte)Enum.GetNames(typeof(NetworkEventType)).Length); // msg.Write((byte)Enum.GetNames(typeof(NetworkEventType)).Length);
msg.Write(Rand.Int(MapEntity.mapEntityList.Count)); // msg.Write(Rand.Int(MapEntity.mapEntityList.Count));
break; // break;
case 2: // case 2:
msg.WriteEnum(PacketTypes.NetworkEvent); // msg.WriteEnum(PacketTypes.NetworkEvent);
msg.WriteEnum(NetworkEventType.ComponentUpdate); // msg.WriteEnum(NetworkEventType.ComponentUpdate);
msg.Write((int)Item.ItemList[Rand.Int(Item.ItemList.Count)].ID); // msg.Write((int)Item.ItemList[Rand.Int(Item.ItemList.Count)].ID);
msg.Write(Rand.Int(8)); // msg.Write(Rand.Int(8));
break; // break;
case 3: // case 3:
msg.Write((byte)Enum.GetNames(typeof(PacketTypes)).Length); // msg.Write((byte)Enum.GetNames(typeof(PacketTypes)).Length);
break; // break;
} // }
int bitCount = Rand.Int(100); // int bitCount = Rand.Int(100);
for (int i = 0; i<bitCount; i++) // for (int i = 0; i<bitCount; i++)
{ // {
msg.Write(Rand.Int(2)==0); // msg.Write(Rand.Int(2)==0);
} // }
client.SendMessage(msg, (Rand.Int(2)==0) ? NetDeliveryMethod.ReliableOrdered : NetDeliveryMethod.Unreliable); // client.SendMessage(msg, (Rand.Int(2)==0) ? NetDeliveryMethod.ReliableOrdered : NetDeliveryMethod.Unreliable);
} //}
} }
} }
+184 -34
View File
@@ -30,6 +30,7 @@ namespace Barotrauma.Networking
private DateTime sparseUpdateTimer; private DateTime sparseUpdateTimer;
private DateTime refreshMasterTimer; private DateTime refreshMasterTimer;
private RestClient restClient;
private bool masterServerResponded; private bool masterServerResponded;
private ServerLog log; private ServerLog log;
@@ -96,6 +97,8 @@ namespace Barotrauma.Networking
banList = new BanList(); banList = new BanList();
LoadSettings();
//---------------------------------------- //----------------------------------------
@@ -160,17 +163,21 @@ namespace Barotrauma.Networking
private void RegisterToMasterServer() private void RegisterToMasterServer()
{ {
var client = new RestClient(NetConfig.MasterServerUrl); if (restClient==null)
{
restClient = new RestClient(NetConfig.MasterServerUrl);
}
var request = new RestRequest("masterserver.php", Method.GET); var request = new RestRequest("masterserver2.php", Method.GET);
request.AddParameter("action", "addserver"); request.AddParameter("action", "addserver");
request.AddParameter("servername", name); request.AddParameter("servername", name);
request.AddParameter("serverport", Port); request.AddParameter("serverport", Port);
request.AddParameter("playercount", PlayerCountToByte(ConnectedClients.Count, config.MaximumConnections)); request.AddParameter("currplayers", ConnectedClients.Count);
request.AddParameter("maxplayers", config.MaximumConnections);
request.AddParameter("password", string.IsNullOrWhiteSpace(password) ? 0 : 1); request.AddParameter("password", string.IsNullOrWhiteSpace(password) ? 0 : 1);
// execute the request // execute the request
RestResponse response = (RestResponse)client.Execute(request); RestResponse response = (RestResponse)restClient.Execute(request);
if (response.StatusCode != System.Net.HttpStatusCode.OK) if (response.StatusCode != System.Net.HttpStatusCode.OK)
{ {
@@ -190,12 +197,16 @@ namespace Barotrauma.Networking
private IEnumerable<object> RefreshMaster() private IEnumerable<object> RefreshMaster()
{ {
var client = new RestClient(NetConfig.MasterServerUrl); if (restClient == null)
{
restClient = new RestClient(NetConfig.MasterServerUrl);
}
var request = new RestRequest("masterserver.php", Method.GET); var request = new RestRequest("masterserver2.php", Method.GET);
request.AddParameter("action", "refreshserver"); request.AddParameter("action", "refreshserver");
request.AddParameter("gamestarted", gameStarted ? 1 : 0); request.AddParameter("gamestarted", gameStarted ? 1 : 0);
request.AddParameter("playercount", PlayerCountToByte(ConnectedClients.Count, config.MaximumConnections)); request.AddParameter("currplayers", ConnectedClients.Count);
request.AddParameter("maxplayers", config.MaximumConnections);
Log("Refreshing connection with master server...", Color.Cyan); Log("Refreshing connection with master server...", Color.Cyan);
@@ -203,7 +214,7 @@ namespace Barotrauma.Networking
sw.Start(); sw.Start();
masterServerResponded = false; masterServerResponded = false;
var restRequestHandle = client.ExecuteAsync(request, response => MasterServerCallBack(response)); var restRequestHandle = restClient.ExecuteAsync(request, response => MasterServerCallBack(response));
DateTime timeOut = DateTime.Now + new TimeSpan(0, 0, 15); DateTime timeOut = DateTime.Now + new TimeSpan(0, 0, 15);
while (!masterServerResponded) while (!masterServerResponded)
@@ -310,6 +321,8 @@ namespace Barotrauma.Networking
foreach (Client c in ConnectedClients) foreach (Client c in ConnectedClients)
{ {
if (c.FileStreamSender != null) UpdateFileTransfer(c, deltaTime);
c.ReliableChannel.Update(deltaTime); c.ReliableChannel.Update(deltaTime);
} }
@@ -420,7 +433,7 @@ namespace Barotrauma.Networking
// Notify the client that they have logged in // Notify the client that they have logged in
var outmsg = server.CreateMessage(); var outmsg = server.CreateMessage();
outmsg.WriteEnum(PacketTypes.LoggedIn); outmsg.Write((byte)PacketTypes.LoggedIn);
outmsg.Write(sender.ID); outmsg.Write(sender.ID);
outmsg.Write(gameStarted); outmsg.Write(gameStarted);
outmsg.Write(gameStarted && sender.Character!=null); outmsg.Write(gameStarted && sender.Character!=null);
@@ -445,7 +458,7 @@ namespace Barotrauma.Networking
//notify other clients about the new client //notify other clients about the new client
outmsg = server.CreateMessage(); outmsg = server.CreateMessage();
outmsg.WriteEnum(PacketTypes.PlayerJoined); outmsg.Write((byte)PacketTypes.PlayerJoined);
outmsg.Write(sender.name); outmsg.Write(sender.name);
outmsg.Write(sender.ID); outmsg.Write(sender.ID);
@@ -474,12 +487,12 @@ namespace Barotrauma.Networking
Client dataSender = ConnectedClients.Find(c => c.Connection == inc.SenderConnection); Client dataSender = ConnectedClients.Find(c => c.Connection == inc.SenderConnection);
if (dataSender == null) return; if (dataSender == null) return;
byte packetType = (byte)inc.ReadEnum<PacketTypes>(); byte packetType = inc.ReadByte();
if (packetType == (byte)PacketTypes.ReliableMessage) if (packetType == (byte)PacketTypes.ReliableMessage)
{ {
if (!dataSender.ReliableChannel.CheckMessage(inc)) return; if (!dataSender.ReliableChannel.CheckMessage(inc)) return;
packetType = (byte)inc.ReadEnum<PacketTypes>(); packetType = inc.ReadByte();
} }
switch (packetType) switch (packetType)
@@ -490,7 +503,7 @@ namespace Barotrauma.Networking
break; break;
case (byte)PacketTypes.Chatmessage: case (byte)PacketTypes.Chatmessage:
ChatMessageType messageType = inc.ReadEnum<ChatMessageType>(); ChatMessageType messageType = (ChatMessageType)inc.ReadByte();
SendChatMessage(inc.ReadString(), messageType); SendChatMessage(inc.ReadString(), messageType);
@@ -500,6 +513,48 @@ namespace Barotrauma.Networking
break; break;
case (byte)PacketTypes.CharacterInfo: case (byte)PacketTypes.CharacterInfo:
ReadCharacterData(inc); ReadCharacterData(inc);
break;
case (byte)PacketTypes.RequestFile:
if (!allowFileTransfers)
{
SendCancelTransferMessage(dataSender, "File transfers have been disabled by the server.");
break;
}
byte fileType = inc.ReadByte();
string fileName = fileType == (byte)FileTransferMessageType.Cancel ? "" : inc.ReadString();
switch (fileType)
{
case (byte)FileTransferMessageType.Submarine:
var requestedSubmarine = Submarine.SavedSubmarines.Find(s => s.Name == fileName);
if (requestedSubmarine==null)
{
//todo: ei voi ladata
}
else
{
if (dataSender.FileStreamSender != null) dataSender.FileStreamSender.CancelTransfer();
var fileStreamSender = FileStreamSender.Create(dataSender.Connection, requestedSubmarine.FilePath, FileTransferMessageType.Submarine);
if (fileStreamSender != null) dataSender.FileStreamSender = fileStreamSender;
}
break;
case (byte)FileTransferMessageType.Cancel:
if (dataSender.FileStreamSender != null)
{
dataSender.FileStreamSender.CancelTransfer();
}
break;
default:
DebugConsole.ThrowError("Unknown file type was requested ("+fileType+")");
break;
}
break; break;
case (byte)PacketTypes.ResendRequest: case (byte)PacketTypes.ResendRequest:
@@ -514,8 +569,8 @@ namespace Barotrauma.Networking
if (Voting.AllowEndVoting && EndVoteMax > 0 && if (Voting.AllowEndVoting && EndVoteMax > 0 &&
((float)EndVoteCount / (float)EndVoteMax) >= EndVoteRequiredRatio) ((float)EndVoteCount / (float)EndVoteMax) >= EndVoteRequiredRatio)
{ {
Log("Ending round by votes ("+EndVoteCount+"/"+(EndVoteMax-EndVoteCount)+")", Color.Cyan); Log("Ending round by votes (" + EndVoteCount + "/" + (EndVoteMax - EndVoteCount) + ")", Color.Cyan);
EndButtonHit(null,null); EndButtonHit(null, null);
} }
break; break;
case (byte)PacketTypes.RequestNetLobbyUpdate: case (byte)PacketTypes.RequestNetLobbyUpdate:
@@ -541,7 +596,7 @@ namespace Barotrauma.Networking
private void HandleConnectionApproval(NetIncomingMessage inc) private void HandleConnectionApproval(NetIncomingMessage inc)
{ {
if (inc.ReadEnum<PacketTypes>() != PacketTypes.Login) return; if ((PacketTypes)inc.ReadByte() != PacketTypes.Login) return;
DebugConsole.NewMessage("New player has joined the server", Color.White); DebugConsole.NewMessage("New player has joined the server", Color.White);
@@ -649,6 +704,8 @@ namespace Barotrauma.Networking
UpdateCrewFrame(); UpdateCrewFrame();
inc.SenderConnection.Approve(); inc.SenderConnection.Approve();
refreshMasterTimer = DateTime.Now;
} }
@@ -789,6 +846,14 @@ namespace Barotrauma.Networking
return false; return false;
} }
if (ConnectedClients.Any(c => c.FileStreamSender != null && c.FileStreamSender.FilePath == selectedSub.FilePath))
{
new GUIMessageBox("Couldn't start a round",
"Can't start a round while sending the selected submarine to clients. Cancel the transfers or wait for them to finish before starting.", 400, 400);
return false;
}
GameMain.ShowLoading(StartGame(selectedSub, selectedMode), false); GameMain.ShowLoading(StartGame(selectedSub, selectedMode), false);
return true; return true;
@@ -877,7 +942,6 @@ namespace Barotrauma.Networking
GameMain.GameScreen.Select(); GameMain.GameScreen.Select();
AddChatMessage("Press TAB to chat. Use ''d;'' to talk to dead players and spectators, and ''player name;'' to only send the message to a specific player.", ChatMessageType.Server); AddChatMessage("Press TAB to chat. Use ''d;'' to talk to dead players and spectators, and ''player name;'' to only send the message to a specific player.", ChatMessageType.Server);
yield return CoroutineStatus.Success; yield return CoroutineStatus.Success;
@@ -886,7 +950,7 @@ namespace Barotrauma.Networking
private NetOutgoingMessage CreateStartMessage(int seed, Submarine selectedSub, GameModePreset selectedMode) private NetOutgoingMessage CreateStartMessage(int seed, Submarine selectedSub, GameModePreset selectedMode)
{ {
NetOutgoingMessage msg = server.CreateMessage(); NetOutgoingMessage msg = server.CreateMessage();
msg.WriteEnum(PacketTypes.StartGame); msg.Write((byte)PacketTypes.StartGame);
msg.Write(seed); msg.Write(seed);
@@ -910,7 +974,7 @@ namespace Barotrauma.Networking
if (myCharacter != null) if (myCharacter != null)
{ {
msg.Write(0); msg.Write((byte)0);
WriteCharacterData(msg, myCharacter.Info.Name, myCharacter); WriteCharacterData(msg, myCharacter.Info.Name, myCharacter);
} }
@@ -949,7 +1013,7 @@ namespace Barotrauma.Networking
if (ConnectedClients.Count > 0) if (ConnectedClients.Count > 0)
{ {
NetOutgoingMessage msg = server.CreateMessage(); NetOutgoingMessage msg = server.CreateMessage();
msg.WriteEnum(PacketTypes.EndGame); msg.Write((byte)PacketTypes.EndGame);
msg.Write(endMessage); msg.Write(endMessage);
if (server.ConnectionsCount > 0) if (server.ConnectionsCount > 0)
@@ -989,7 +1053,9 @@ namespace Barotrauma.Networking
private void DisconnectClient(NetConnection senderConnection, string msg = "", string targetmsg = "") private void DisconnectClient(NetConnection senderConnection, string msg = "", string targetmsg = "")
{ {
Client client = ConnectedClients.Find(x => x.Connection == senderConnection); Client client = ConnectedClients.Find(x => x.Connection == senderConnection);
if (client != null) DisconnectClient(client, msg, targetmsg); if (client == null) return;
DisconnectClient(client, msg, targetmsg);
} }
private void DisconnectClient(Client client, string msg = "", string targetmsg = "") private void DisconnectClient(Client client, string msg = "", string targetmsg = "")
@@ -1007,14 +1073,14 @@ namespace Barotrauma.Networking
Log(msg, messageColor[(int)ChatMessageType.Server]); Log(msg, messageColor[(int)ChatMessageType.Server]);
NetOutgoingMessage outmsg = server.CreateMessage(); NetOutgoingMessage outmsg = server.CreateMessage();
outmsg.WriteEnum(PacketTypes.KickedOut); outmsg.Write((byte)PacketTypes.KickedOut);
outmsg.Write(targetmsg); outmsg.Write(targetmsg);
server.SendMessage(outmsg, client.Connection, NetDeliveryMethod.ReliableUnordered, 0); server.SendMessage(outmsg, client.Connection, NetDeliveryMethod.ReliableUnordered, 0);
ConnectedClients.Remove(client); ConnectedClients.Remove(client);
outmsg = server.CreateMessage(); outmsg = server.CreateMessage();
outmsg.WriteEnum(PacketTypes.PlayerLeft); outmsg.Write((byte)PacketTypes.PlayerLeft);
outmsg.Write(client.ID); outmsg.Write(client.ID);
outmsg.Write(msg); outmsg.Write(msg);
@@ -1025,9 +1091,17 @@ namespace Barotrauma.Networking
server.SendMessage(outmsg, server.Connections, NetDeliveryMethod.ReliableUnordered, 0); server.SendMessage(outmsg, server.Connections, NetDeliveryMethod.ReliableUnordered, 0);
} }
if (client.FileStreamSender != null)
{
client.FileStreamSender.Dispose();
client.FileStreamSender = null;
}
AddChatMessage(msg, ChatMessageType.Server); AddChatMessage(msg, ChatMessageType.Server);
UpdateCrewFrame(); UpdateCrewFrame();
refreshMasterTimer = DateTime.Now;
} }
private void UpdateCrewFrame() private void UpdateCrewFrame()
@@ -1073,6 +1147,65 @@ namespace Barotrauma.Networking
} }
} }
private void UpdateFileTransfer(Client client, float deltaTime)
{
if (client.FileStreamSender == null) return;
var clientNameBox = GameMain.NetLobbyScreen.PlayerList.FindChild(client.name);
var clientInfo = clientNameBox.FindChild(client.FileStreamSender);
if (clientInfo == null)
{
clientNameBox.ClearChildren();
clientInfo = new GUIFrame(new Rectangle(0, 0, 180, 0), Color.Transparent, Alignment.TopRight, null, clientNameBox);
clientInfo.UserData = client.FileStreamSender;
new GUIProgressBar(new Rectangle(0, 4, 160, clientInfo.Rect.Height - 8), Color.Green, GUI.Style, 0.0f, Alignment.Left, clientInfo).IsHorizontal = true;
new GUITextBlock(new Rectangle(0, 2, 160, 0), "", GUI.Style, Alignment.TopLeft, Alignment.Left | Alignment.CenterY, clientInfo, true, GUI.SmallFont);
var cancelButton = new GUIButton(new Rectangle(20, 0, 14, 0), "X", Alignment.Right, GUI.Style, clientInfo);
cancelButton.OnClicked = (GUIButton button, object userdata) =>
{
(cancelButton.Parent.UserData as FileStreamSender).CancelTransfer();
return true;
};
}
else
{
var progressBar = clientInfo.GetChild<GUIProgressBar>();
progressBar.BarSize = client.FileStreamSender.Progress;
var progressText = clientInfo.GetChild<GUITextBlock>();
progressText.Text = client.FileStreamSender.FileName + " " +
MathUtils.GetBytesReadable(client.FileStreamSender.Sent) + " / " + MathUtils.GetBytesReadable(client.FileStreamSender.FileSize);
}
client.FileStreamSender.Update(deltaTime);
if (client.FileStreamSender.Status != FileTransferStatus.Sending &&
client.FileStreamSender.Status != FileTransferStatus.NotStarted)
{
if (client.FileStreamSender.Status == FileTransferStatus.Canceled)
{
SendCancelTransferMessage(client, "File transfer was canceled by the server.");
}
clientNameBox.RemoveChild(clientInfo);
client.FileStreamSender.Dispose();
client.FileStreamSender = null;
}
}
private void SendCancelTransferMessage(Client client, string message)
{
var outmsg = server.CreateMessage();
outmsg.Write((byte)PacketTypes.RequestFile);
outmsg.Write(false);
outmsg.Write(message);
server.SendMessage(outmsg, client.Connection, NetDeliveryMethod.ReliableUnordered);
}
public void NewTraitor(Character traitor, Character target) public void NewTraitor(Character traitor, Character target)
{ {
Log(traitor.Name + " is the traitor and the target is " + target.Name, Color.Cyan); Log(traitor.Name + " is the traitor and the target is " + target.Name, Color.Cyan);
@@ -1086,7 +1219,7 @@ namespace Barotrauma.Networking
} }
NetOutgoingMessage msg = server.CreateMessage(); NetOutgoingMessage msg = server.CreateMessage();
msg.WriteEnum(PacketTypes.Traitor); msg.Write((byte)PacketTypes.Traitor);
msg.Write(target.Info.Name); msg.Write(target.Info.Name);
if (server.Connections.Count > 0) if (server.Connections.Count > 0)
{ {
@@ -1175,7 +1308,7 @@ namespace Barotrauma.Networking
try try
{ {
NetOutgoingMessage msg = server.CreateMessage(); NetOutgoingMessage msg = server.CreateMessage();
msg.WriteEnum(PacketTypes.VoteStatus); msg.Write((byte)PacketTypes.VoteStatus);
Voting.WriteData(msg, ConnectedClients); Voting.WriteData(msg, ConnectedClients);
server.SendMessage(msg, server.Connections, NetDeliveryMethod.ReliableUnordered, 0); server.SendMessage(msg, server.Connections, NetDeliveryMethod.ReliableUnordered, 0);
@@ -1199,7 +1332,7 @@ namespace Barotrauma.Networking
if (server.Connections.Count == 0) return true; if (server.Connections.Count == 0) return true;
NetOutgoingMessage msg = server.CreateMessage(); NetOutgoingMessage msg = server.CreateMessage();
msg.WriteEnum(PacketTypes.UpdateNetLobby); msg.Write((byte)PacketTypes.UpdateNetLobby);
GameMain.NetLobbyScreen.WriteData(msg); GameMain.NetLobbyScreen.WriteData(msg);
server.SendMessage(msg, server.Connections, NetDeliveryMethod.ReliableUnordered, 0); server.SendMessage(msg, server.Connections, NetDeliveryMethod.ReliableUnordered, 0);
@@ -1275,8 +1408,8 @@ namespace Barotrauma.Networking
foreach (Client c in recipients) foreach (Client c in recipients)
{ {
ReliableMessage msg = c.ReliableChannel.CreateMessage(); ReliableMessage msg = c.ReliableChannel.CreateMessage();
msg.InnerMessage.WriteEnum(PacketTypes.Chatmessage); msg.InnerMessage.Write((byte)PacketTypes.Chatmessage);
msg.InnerMessage.WriteEnum(type); msg.InnerMessage.Write((byte)type);
msg.InnerMessage.Write(message); msg.InnerMessage.Write(message);
c.ReliableChannel.SendMessage(msg, c.Connection); c.ReliableChannel.SendMessage(msg, c.Connection);
@@ -1343,7 +1476,7 @@ namespace Barotrauma.Networking
if (items == null || !items.Any()) return; if (items == null || !items.Any()) return;
NetOutgoingMessage message = server.CreateMessage(); NetOutgoingMessage message = server.CreateMessage();
message.WriteEnum(PacketTypes.NewItem); message.Write((byte)PacketTypes.NewItem);
Item.Spawner.FillNetworkData(message, items, inventories); Item.Spawner.FillNetworkData(message, items, inventories);
@@ -1466,13 +1599,13 @@ namespace Barotrauma.Networking
switch (Rand.Int(5)) switch (Rand.Int(5))
{ {
case 0: case 0:
msg.WriteEnum(PacketTypes.NetworkEvent); msg.Write((byte)PacketTypes.NetworkEvent);
msg.Write(Rand.Int(Enum.GetNames(typeof(NetworkEventType)).Length)); msg.Write((byte)Rand.Int(Enum.GetNames(typeof(NetworkEventType)).Length));
msg.Write(Rand.Int(MapEntity.mapEntityList.Count)); msg.Write((ushort)Rand.Int(MapEntity.mapEntityList.Count));
break; break;
case 1: case 1:
msg.WriteEnum(PacketTypes.NetworkEvent); msg.Write((byte)PacketTypes.NetworkEvent);
msg.WriteEnum(NetworkEventType.ComponentUpdate); msg.Write((byte)NetworkEventType.ComponentUpdate);
msg.Write((int)Item.ItemList[Rand.Int(Item.ItemList.Count)].ID); msg.Write((int)Item.ItemList[Rand.Int(Item.ItemList.Count)].ID);
msg.Write(Rand.Int(8)); msg.Write(Rand.Int(8));
break; break;
@@ -1497,12 +1630,27 @@ namespace Barotrauma.Networking
{ {
banList.Save(); banList.Save();
if (registeredToMaster && restClient != null)
{
var request = new RestRequest("masterserver2.php", Method.GET);
request.AddParameter("action", "removeserver");
restClient.Execute(request);
restClient = null;
}
if (saveServerLogs) if (saveServerLogs)
{ {
Log("Shutting down server...", Color.Cyan); Log("Shutting down server...", Color.Cyan);
log.Save(); log.Save();
} }
foreach (Client client in ConnectedClients)
{
if (client.FileStreamSender != null) client.FileStreamSender.Dispose();
}
server.Shutdown("The server has shut down"); server.Shutdown("The server has shut down");
} }
} }
@@ -1523,6 +1671,8 @@ namespace Barotrauma.Networking
public List<JobPrefab> jobPreferences; public List<JobPrefab> jobPreferences;
public JobPrefab assignedJob; public JobPrefab assignedJob;
public FileStreamSender FileStreamSender;
public bool Spectating; public bool Spectating;
public ReliableChannel ReliableChannel; public ReliableChannel ReliableChannel;
@@ -3,6 +3,8 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Xml;
using System.Xml.Linq;
namespace Barotrauma.Networking namespace Barotrauma.Networking
{ {
@@ -18,6 +20,8 @@ namespace Barotrauma.Networking
partial class GameServer : NetworkMember partial class GameServer : NetworkMember
{ {
public const string SettingsFile = "serversettings.xml";
public bool ShowNetStats; public bool ShowNetStats;
private TimeSpan refreshMasterInterval = new TimeSpan(0, 0, 30); private TimeSpan refreshMasterInterval = new TimeSpan(0, 0, 30);
@@ -45,6 +49,8 @@ namespace Barotrauma.Networking
private bool saveServerLogs = true; private bool saveServerLogs = true;
private bool allowFileTransfers = true;
public bool AutoRestart public bool AutoRestart
{ {
get { return (ConnectedClients.Count == 0) ? false : autoRestart; } get { return (ConnectedClients.Count == 0) ? false : autoRestart; }
@@ -89,27 +95,83 @@ namespace Barotrauma.Networking
public float EndVoteRequiredRatio = 0.5f; public float EndVoteRequiredRatio = 0.5f;
private void SaveSettings()
{
XmlWriterSettings settings = new XmlWriterSettings();
settings.Indent = true;
settings.NewLineOnAttributes = true;
using (var writer = XmlWriter.Create(SettingsFile, settings))
{
writer.WriteStartElement("serversettings");
writer.WriteAttributeString("AllowSpectating", allowSpectating.ToString());
writer.WriteAttributeString("RandomizeSeed", randomizeSeed.ToString());
writer.WriteAttributeString("EndRoundAtLevelEnd", endRoundAtLevelEnd.ToString());
writer.WriteAttributeString("AllowFileTransfers", allowFileTransfers.ToString());
writer.WriteAttributeString("MaxFileTransferDuration", ((int)FileStreamSender.MaxTransferDuration.TotalSeconds).ToString());
writer.WriteAttributeString("SaveServerLogs", saveServerLogs.ToString());
writer.WriteAttributeString("LinesPerLogFile", log.LinesPerFile.ToString());
writer.WriteAttributeString("SubSelection", subSelectionMode.ToString());
writer.WriteAttributeString("ModeSelection", modeSelectionMode.ToString());
writer.Flush();
}
}
private void LoadSettings()
{
XDocument doc = null;
if (System.IO.File.Exists(SettingsFile))
{
doc = ToolBox.TryLoadXml(SettingsFile);
}
else
{
return;
}
if (doc == null)
{
doc = new XDocument(new XElement("serversettings"));
}
allowSpectating = ToolBox.GetAttributeBool(doc.Root, "AllowSpectating", true);
randomizeSeed = ToolBox.GetAttributeBool(doc.Root, "RandomizeSeed", true);
endRoundAtLevelEnd = ToolBox.GetAttributeBool(doc.Root, "EndRoundAtLevelEnd", true);
allowFileTransfers = ToolBox.GetAttributeBool(doc.Root, "AllowFileTransfers", true);
saveServerLogs = ToolBox.GetAttributeBool(doc.Root, "SaveServerLogs", true);
log.LinesPerFile = ToolBox.GetAttributeInt(doc.Root, "LinesPerLogFile", 800);
subSelectionMode = SelectionMode.Manual;
Enum.TryParse<SelectionMode>(ToolBox.GetAttributeString(doc.Root, "SubSelection", "Manual"), out subSelectionMode);
modeSelectionMode = SelectionMode.Manual;
Enum.TryParse<SelectionMode>(ToolBox.GetAttributeString(doc.Root, "ModeSelection", "Manual"), out modeSelectionMode);
FileStreamSender.MaxTransferDuration = new TimeSpan(0,0,ToolBox.GetAttributeInt(doc.Root, "MaxFileTransferDuration", 150));
}
private void CreateSettingsFrame() private void CreateSettingsFrame()
{ {
settingsFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f); settingsFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f);
GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, 400, 400), null, Alignment.Center, GUI.Style, settingsFrame); GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, 400, 400), null, Alignment.Center, GUI.Style, settingsFrame);
innerFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
new GUITextBlock(new Rectangle(0, -15, 0, 20), "Server settings", GUI.Style, innerFrame, GUI.LargeFont); new GUITextBlock(new Rectangle(0, -5, 0, 20), "Server settings", GUI.Style, innerFrame, GUI.LargeFont);
var randomizeLevelBox = new GUITickBox(new Rectangle(0, 30, 20, 20), "Randomize level seed between rounds", Alignment.Left, innerFrame); int y = 40;
randomizeLevelBox.Selected = randomizeSeed;
randomizeLevelBox.OnSelected = (GUITickBox) =>
{
randomizeSeed = GUITickBox.Selected;
return true;
};
var endBox = new GUITickBox(new Rectangle(0, 60, 20, 20), "End round when destination reached", Alignment.Left, innerFrame); var endBox = new GUITickBox(new Rectangle(0, y, 20, 20), "End round when destination reached", Alignment.Left, innerFrame);
endBox.Selected = endRoundAtLevelEnd; endBox.Selected = endRoundAtLevelEnd;
endBox.OnSelected = (GUITickBox) => { endRoundAtLevelEnd = GUITickBox.Selected; return true; }; endBox.OnSelected = (GUITickBox) => { endRoundAtLevelEnd = GUITickBox.Selected; return true; };
var endVoteBox = new GUITickBox(new Rectangle(0, 90, 20, 20), "End round by voting", Alignment.Left, innerFrame);
y += 30;
var endVoteBox = new GUITickBox(new Rectangle(0, y, 20, 20), "End round by voting", Alignment.Left, innerFrame);
endVoteBox.Selected = Voting.AllowEndVoting; endVoteBox.Selected = Voting.AllowEndVoting;
endVoteBox.OnSelected = (GUITickBox) => endVoteBox.OnSelected = (GUITickBox) =>
{ {
@@ -118,9 +180,9 @@ namespace Barotrauma.Networking
return true; return true;
}; };
var votesRequiredText = new GUITextBlock(new Rectangle(20, 110, 20, 20), "Votes required: 50 %", GUI.Style, innerFrame, GUI.SmallFont); var votesRequiredText = new GUITextBlock(new Rectangle(20, y+20, 20, 20), "Votes required: 50 %", GUI.Style, innerFrame, GUI.SmallFont);
var votesRequiredSlider = new GUIScrollBar(new Rectangle(150,115, 100, 10), GUI.Style, 0.1f, innerFrame); var votesRequiredSlider = new GUIScrollBar(new Rectangle(150, y+22, 100, 10), GUI.Style, 0.1f, innerFrame);
votesRequiredSlider.UserData = votesRequiredText; votesRequiredSlider.UserData = votesRequiredText;
votesRequiredSlider.BarScroll = (EndVoteRequiredRatio - 0.5f) * 2.0f; votesRequiredSlider.BarScroll = (EndVoteRequiredRatio - 0.5f) * 2.0f;
votesRequiredSlider.OnMoved = (GUIScrollBar scrollBar, float barScroll) => votesRequiredSlider.OnMoved = (GUIScrollBar scrollBar, float barScroll) =>
@@ -128,14 +190,41 @@ namespace Barotrauma.Networking
GUITextBlock voteText = scrollBar.UserData as GUITextBlock; GUITextBlock voteText = scrollBar.UserData as GUITextBlock;
scrollBar.BarScroll = MathUtils.Round(barScroll, 0.2f); scrollBar.BarScroll = MathUtils.Round(barScroll, 0.2f);
EndVoteRequiredRatio = barScroll/2.0f + 0.5f; EndVoteRequiredRatio = barScroll / 2.0f + 0.5f;
voteText.Text = "Votes required: " + (int)MathUtils.Round(EndVoteRequiredRatio * 100.0f, 10.0f) + " %"; voteText.Text = "Votes required: " + (int)MathUtils.Round(EndVoteRequiredRatio * 100.0f, 10.0f) + " %";
return true; return true;
}; };
votesRequiredSlider.OnMoved(votesRequiredSlider, votesRequiredSlider.BarScroll); votesRequiredSlider.OnMoved(votesRequiredSlider, votesRequiredSlider.BarScroll);
new GUITextBlock(new Rectangle(0, 95+50, 100, 20), "Submarine selection:", GUI.Style, innerFrame); y += 40;
var selectionFrame = new GUIFrame(new Rectangle(0, 120 + 50, 300, 20), null, innerFrame);
var randomizeLevelBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Randomize level seed between rounds", Alignment.Left, innerFrame);
randomizeLevelBox.Selected = randomizeSeed;
randomizeLevelBox.OnSelected = (GUITickBox) =>
{
randomizeSeed = GUITickBox.Selected;
return true;
};
y += 40;
var shareSubsBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Share submarine files with players", Alignment.Left, innerFrame);
shareSubsBox.Selected = allowFileTransfers;
shareSubsBox.OnSelected = (GUITickBox) =>
{
allowFileTransfers = GUITickBox.Selected;
return true;
};
y += 40;
new GUITextBlock(new Rectangle(0, y, 100, 20), "Submarine selection:", GUI.Style, innerFrame);
var selectionFrame = new GUIFrame(new Rectangle(0, y+20, 300, 20), null, innerFrame);
for (int i = 0; i<3; i++) for (int i = 0; i<3; i++)
{ {
var selectionTick = new GUITickBox(new Rectangle(i * 100, 0, 20, 20), ((SelectionMode)i).ToString(), Alignment.Left, selectionFrame); var selectionTick = new GUITickBox(new Rectangle(i * 100, 0, 20, 20), ((SelectionMode)i).ToString(), Alignment.Left, selectionFrame);
@@ -144,8 +233,10 @@ namespace Barotrauma.Networking
selectionTick.UserData = (SelectionMode)i; selectionTick.UserData = (SelectionMode)i;
} }
new GUITextBlock(new Rectangle(0, 145 + 50, 100, 20), "Mode selection:", GUI.Style, innerFrame); y += 45;
selectionFrame = new GUIFrame(new Rectangle(0, 170 + 50, 300, 20), null, innerFrame);
new GUITextBlock(new Rectangle(0, y, 100, 20), "Mode selection:", GUI.Style, innerFrame);
selectionFrame = new GUIFrame(new Rectangle(0, y+20, 300, 20), null, innerFrame);
for (int i = 0; i<3; i++) for (int i = 0; i<3; i++)
{ {
var selectionTick = new GUITickBox(new Rectangle(i*100, 0, 20, 20), ((SelectionMode)i).ToString(), Alignment.Left, selectionFrame); var selectionTick = new GUITickBox(new Rectangle(i*100, 0, 20, 20), ((SelectionMode)i).ToString(), Alignment.Left, selectionFrame);
@@ -154,7 +245,9 @@ namespace Barotrauma.Networking
selectionTick.UserData = (SelectionMode)i; selectionTick.UserData = (SelectionMode)i;
} }
var allowSpecBox = new GUITickBox(new Rectangle(0, 210 + 50, 20, 20), "Allow spectating", Alignment.Left, innerFrame); y += 60;
var allowSpecBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Allow spectating", Alignment.Left, innerFrame);
allowSpecBox.Selected = allowSpectating; allowSpecBox.Selected = allowSpectating;
allowSpecBox.OnSelected = (GUITickBox) => allowSpecBox.OnSelected = (GUITickBox) =>
{ {
@@ -162,7 +255,9 @@ namespace Barotrauma.Networking
return true; return true;
}; };
var saveLogsBox = new GUITickBox(new Rectangle(0, 240 + 50, 20, 20), "Save server logs", Alignment.Left, innerFrame); y += 30;
var saveLogsBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Save server logs", Alignment.Left, innerFrame);
saveLogsBox.Selected = saveServerLogs; saveLogsBox.Selected = saveServerLogs;
saveLogsBox.OnSelected = (GUITickBox) => saveLogsBox.OnSelected = (GUITickBox) =>
{ {
@@ -225,6 +320,7 @@ namespace Barotrauma.Networking
else else
{ {
settingsFrame = null; settingsFrame = null;
SaveSettings();
} }
return false; return false;
@@ -5,14 +5,14 @@ namespace Barotrauma.Networking
{ {
static class NetBufferExtensions static class NetBufferExtensions
{ {
public static void WriteEnum(this NetBuffer buffer, Enum value) //public static void WriteEnum(this NetBuffer buffer, Enum value)
{ //{
buffer.WriteRangedInteger(0, Enum.GetValues(value.GetType()).Length - 1, Convert.ToInt32(value)); // buffer.WriteRangedInteger(0, Enum.GetValues(value.GetType()).Length - 1, Convert.ToInt32(value));
} //}
public static TEnum ReadEnum<TEnum>(this NetBuffer buffer) //public static TEnum ReadEnum<TEnum>(this NetBuffer buffer)
{ //{
return (TEnum)(object)buffer.ReadRangedInteger(0, Enum.GetValues(typeof(TEnum)).Length - 1); // return (TEnum)(object)buffer.ReadRangedInteger(0, Enum.GetValues(typeof(TEnum)).Length - 1);
} //}
} }
} }
+2 -2
View File
@@ -132,7 +132,7 @@ namespace Barotrauma.Networking
public bool FillData(NetBuffer message) public bool FillData(NetBuffer message)
{ {
message.WriteEnum(eventType); message.Write((byte)eventType);
Entity e = Entity.FindEntityByID(id); Entity e = Entity.FindEntityByID(id);
if (e == null) return false; if (e == null) return false;
@@ -189,7 +189,7 @@ namespace Barotrauma.Networking
try try
{ {
eventType = message.ReadEnum<NetworkEventType>(); eventType = (NetworkEventType)message.ReadByte();
id = message.ReadUInt16(); id = message.ReadUInt16();
} }
catch (Exception exception) catch (Exception exception)
+5 -22
View File
@@ -7,7 +7,7 @@ using Lidgren.Network;
namespace Barotrauma.Networking namespace Barotrauma.Networking
{ {
enum PacketTypes : int enum PacketTypes : byte
{ {
Unknown, Unknown,
@@ -33,6 +33,8 @@ namespace Barotrauma.Networking
ResendRequest, ReliableMessage, LatestMessageID, ResendRequest, ReliableMessage, LatestMessageID,
RequestFile, FileStream,
SpectateRequest SpectateRequest
} }
@@ -163,14 +165,14 @@ namespace Barotrauma.Networking
if (msgBytes.Count == 0) return null; if (msgBytes.Count == 0) return null;
NetOutgoingMessage message = netPeer.CreateMessage(); NetOutgoingMessage message = netPeer.CreateMessage();
message.WriteEnum(PacketTypes.NetworkEvent); message.Write((byte)PacketTypes.NetworkEvent);
message.Write((float)NetTime.Now); message.Write((float)NetTime.Now);
message.Write((byte)msgBytes.Count); message.Write((byte)msgBytes.Count);
foreach (byte[] msgData in msgBytes) foreach (byte[] msgData in msgBytes)
{ {
if (msgData.Length > 255) DebugConsole.ThrowError("too large networkevent (" + msgData.Length + " bytes)"); if (msgData.Length > 255) DebugConsole.ThrowError("Too large networkevent (" + msgData.Length + " bytes)");
message.Write((byte)msgData.Length); message.Write((byte)msgData.Length);
message.Write(msgData); message.Write(msgData);
@@ -295,25 +297,6 @@ namespace Barotrauma.Networking
} }
public virtual void Disconnect() { } public virtual void Disconnect() { }
protected byte PlayerCountToByte(int playerCount, int maxPlayers)
{
byte byteVal = (byte)playerCount;
byteVal |= (byte)((maxPlayers - 1) << 4);
return byteVal;
}
public static int ByteToPlayerCount(byte byteVal, out int maxPlayers)
{
maxPlayers = (byteVal >> 4)+1;
int playerCount = byteVal & (byte)((1 << 4) - 1);
return playerCount;
}
} }
} }
@@ -94,7 +94,7 @@ namespace Barotrauma.Networking.ReliableMessages
var reliableMessage = new ReliableMessage(message, messageID); var reliableMessage = new ReliableMessage(message, messageID);
message.WriteEnum(PacketTypes.ReliableMessage); message.Write((byte)PacketTypes.ReliableMessage);
message.Write(messageID); message.Write(messageID);
@@ -184,7 +184,7 @@ namespace Barotrauma.Networking.ReliableMessages
//Debug.WriteLine("Sending ack message: "+messageCount); //Debug.WriteLine("Sending ack message: "+messageCount);
NetOutgoingMessage message = sender.CreateMessage(); NetOutgoingMessage message = sender.CreateMessage();
message.WriteEnum(PacketTypes.LatestMessageID); message.Write((byte)PacketTypes.LatestMessageID);
message.Write(messageCount); message.Write(messageCount);
@@ -244,7 +244,7 @@ namespace Barotrauma.Networking.ReliableMessages
Debug.WriteLine("rerequest "+missingMessage.ID+" (try #"+missingMessage.ResendRequestsSent+")"); Debug.WriteLine("rerequest "+missingMessage.ID+" (try #"+missingMessage.ResendRequestsSent+")");
NetOutgoingMessage resendRequest = receiver.CreateMessage(); NetOutgoingMessage resendRequest = receiver.CreateMessage();
resendRequest.WriteEnum(PacketTypes.ResendRequest); resendRequest.Write((byte)PacketTypes.ResendRequest);
resendRequest.Write(missingMessage.ID); resendRequest.Write(missingMessage.ID);
@@ -443,6 +443,7 @@ namespace Barotrauma.Networking.ReliableMessages
public void SaveInnerMessage() public void SaveInnerMessage()
{ {
innerMessage.WritePadBits();
innerMessageBytes = innerMessage.PeekBytes(innerMessage.LengthBytes); innerMessageBytes = innerMessage.PeekBytes(innerMessage.LengthBytes);
//innerMessage = null; //innerMessage = null;
} }
+7 -1
View File
@@ -9,7 +9,7 @@ namespace Barotrauma.Networking
{ {
class ServerLog class ServerLog
{ {
const int LinesPerFile = 300; private int linesPerFile = 800;
public const string SavePath = "ServerLogs"; public const string SavePath = "ServerLogs";
@@ -21,6 +21,12 @@ namespace Barotrauma.Networking
private Queue<ColoredText> lines; private Queue<ColoredText> lines;
public int LinesPerFile
{
get { return linesPerFile; }
set { linesPerFile = Math.Max(10, linesPerFile); }
}
public ServerLog(string serverName) public ServerLog(string serverName)
{ {
this.serverName = serverName; this.serverName = serverName;
+18 -14
View File
@@ -155,24 +155,28 @@ namespace Barotrauma
if (held) heldQueue = true; if (held) heldQueue = true;
} }
public bool Dequeue public bool DequeueHit()
{ {
get bool value = hitQueue;
{ hitQueue = false;
bool value = hitQueue; return value;
hitQueue = false;
return value;
}
} }
public bool DequeueHeld public bool DequeueHeld()
{ {
get bool value = heldQueue;
{ heldQueue = false;
bool value = heldQueue; return value;
heldQueue = false; }
return value;
} public bool GetHeldQueue
{
get { return heldQueue; }
}
public bool GetHitQueue
{
get { return hitQueue; }
} }
+17 -9
View File
@@ -193,7 +193,7 @@ namespace Barotrauma
return editableProperties; return editableProperties;
} }
public static Dictionary<string, ObjectProperty> GetProperties(object obj) public static Dictionary<string, ObjectProperty> GetProperties(IPropertyObject obj)
{ {
var properties = TypeDescriptor.GetProperties(obj.GetType()).Cast<PropertyDescriptor>(); var properties = TypeDescriptor.GetProperties(obj.GetType()).Cast<PropertyDescriptor>();
@@ -207,7 +207,12 @@ namespace Barotrauma
return dictionary; return dictionary;
} }
public static Dictionary<string, ObjectProperty> InitProperties(object obj, XElement element) public static Dictionary<string, ObjectProperty> InitProperties(IPropertyObject obj)
{
return InitProperties(obj, null);
}
public static Dictionary<string, ObjectProperty> InitProperties(IPropertyObject obj, XElement element)
{ {
var properties = TypeDescriptor.GetProperties(obj.GetType()).Cast<PropertyDescriptor>(); var properties = TypeDescriptor.GetProperties(obj.GetType()).Cast<PropertyDescriptor>();
@@ -226,14 +231,17 @@ namespace Barotrauma
} }
} }
//go through all the attributes in the xml element if (element!=null)
//and set the value of the matching property if it is initializable
foreach (XAttribute attribute in element.Attributes())
{ {
ObjectProperty property = null; //go through all the attributes in the xml element
if (!dictionary.TryGetValue(attribute.Name.ToString().ToLower(), out property)) continue; //and set the value of the matching property if it is initializable
if (!property.Attributes.OfType<HasDefaultValue>().Any()) continue; foreach (XAttribute attribute in element.Attributes())
property.TrySetValue(attribute.Value); {
ObjectProperty property = null;
if (!dictionary.TryGetValue(attribute.Name.ToString().ToLower(), out property)) continue;
if (!property.Attributes.OfType<HasDefaultValue>().Any()) continue;
property.TrySetValue(attribute.Value);
}
} }
return dictionary; return dictionary;
+9 -1
View File
@@ -2,6 +2,7 @@
using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Input;
using System; using System;
using System.IO;
using System.Linq; using System.Linq;
namespace Barotrauma namespace Barotrauma
@@ -291,7 +292,14 @@ namespace Barotrauma
return false; return false;
} }
Submarine.SaveCurrent(nameBox.Text + ".sub"); string savePath = nameBox.Text + ".sub";
if (Submarine.Loaded != null)
{
savePath = Path.Combine(Path.GetDirectoryName(Submarine.Loaded.FilePath), savePath);
}
Submarine.SaveCurrent(savePath);
Submarine.Loaded.CheckForErrors(); Submarine.Loaded.CheckForErrors();
GUI.AddMessage("Submarine saved to " + Submarine.Loaded.FilePath, Color.Green, 3.0f); GUI.AddMessage("Submarine saved to " + Submarine.Loaded.FilePath, Color.Green, 3.0f);
+22
View File
@@ -200,6 +200,8 @@ namespace Barotrauma
if (GameMain.GameSession != null) GameMain.GameSession.Draw(spriteBatch); if (GameMain.GameSession != null) GameMain.GameSession.Draw(spriteBatch);
if (Character.Controlled == null && Submarine.Loaded != null) DrawSubmarineIndicator(spriteBatch, Submarine.Loaded);
GUI.Draw((float)deltaTime, spriteBatch, cam); GUI.Draw((float)deltaTime, spriteBatch, cam);
if (!PlayerInput.LeftButtonHeld()) Inventory.draggingItem = null; if (!PlayerInput.LeftButtonHeld()) Inventory.draggingItem = null;
@@ -348,5 +350,25 @@ namespace Barotrauma
GameMain.LightManager.DrawLOS(graphics, spriteBatch, cam); GameMain.LightManager.DrawLOS(graphics, spriteBatch, cam);
} }
private void DrawSubmarineIndicator(SpriteBatch spriteBatch, Submarine submarine)
{
Vector2 subDiff = submarine.WorldPosition - cam.Position;
if (Math.Abs(subDiff.X) > cam.WorldView.Width || Math.Abs(subDiff.Y) > cam.WorldView.Height)
{
Vector2 normalizedSubDiff = Vector2.Normalize(subDiff);
Vector2 iconPos =
cam.WorldToScreen(cam.Position) +
new Vector2(normalizedSubDiff.X * GameMain.GraphicsWidth * 0.4f, -normalizedSubDiff.Y * GameMain.GraphicsHeight * 0.4f);
GUI.SubmarineIcon.Draw(spriteBatch, iconPos, Color.LightBlue * 0.5f);
Vector2 arrowOffset = normalizedSubDiff * GUI.SubmarineIcon.size.X * 0.7f;
arrowOffset.Y = -arrowOffset.Y;
GUI.Arrow.Draw(spriteBatch, iconPos + arrowOffset, Color.LightBlue * 0.5f, MathUtils.VectorToAngle(arrowOffset) + MathHelper.PiOver2);
}
}
} }
} }
+106 -59
View File
@@ -37,6 +37,10 @@ namespace Barotrauma
public bool IsServer; public bool IsServer;
public string ServerName, ServerMessage; public string ServerName, ServerMessage;
const float NetworkUpdateInterval = 1.0f;
private float networkUpdateTimer;
private bool valueChanged;
private Sprite backgroundSprite; private Sprite backgroundSprite;
private GUITextBox serverMessage; private GUITextBox serverMessage;
@@ -51,6 +55,11 @@ namespace Barotrauma
get { return modeList; } get { return modeList; }
} }
public GUIListBox PlayerList
{
get { return playerList; }
}
public GUIFrame InfoFrame public GUIFrame InfoFrame
{ {
get { return infoFrame; } get { return infoFrame; }
@@ -183,24 +192,7 @@ namespace Barotrauma
voteText.UserData = "subvotes"; voteText.UserData = "subvotes";
voteText.Visible = false; voteText.Visible = false;
if (Submarine.SavedSubmarines.Count > 0) UpdateSubList();
{
foreach (Submarine sub in Submarine.SavedSubmarines)
{
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
sub.Name, GUI.Style,
Alignment.Left, Alignment.Left,
subList);
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
textBlock.UserData = sub;
}
}
else
{
DebugConsole.ThrowError("No saved submarines found!");
return;
}
columnX += columnWidth + 20; columnX += columnWidth + 20;
@@ -210,7 +202,6 @@ namespace Barotrauma
modeList = new GUIListBox(new Rectangle(columnX, 150, columnWidth, infoFrame.Rect.Height - 150 - 80), GUI.Style, infoFrame); modeList = new GUIListBox(new Rectangle(columnX, 150, columnWidth, infoFrame.Rect.Height - 150 - 80), GUI.Style, infoFrame);
modeList.OnSelected = VotableClicked; modeList.OnSelected = VotableClicked;
voteText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 30), "Votes: ", GUI.Style, Alignment.TopLeft, Alignment.TopRight, infoFrame); voteText = new GUITextBlock(new Rectangle(columnX, 120, columnWidth, 30), "Votes: ", GUI.Style, Alignment.TopLeft, Alignment.TopRight, infoFrame);
voteText.UserData = "modevotes"; voteText.UserData = "modevotes";
voteText.Visible = false; voteText.Visible = false;
@@ -327,7 +318,7 @@ namespace Barotrauma
modeList.OnSelected = VotableClicked; modeList.OnSelected = VotableClicked;
modeList.OnSelected = SelectMode; modeList.OnSelected = SelectMode;
subList.OnSelected = VotableClicked; subList.OnSelected = VotableClicked;
subList.OnSelected = SelectMap; subList.OnSelected = SelectSub;
traitorProbabilityButtons[0].OnClicked = ToggleTraitorsEnabled; traitorProbabilityButtons[0].OnClicked = ToggleTraitorsEnabled;
traitorProbabilityButtons[1].OnClicked = ToggleTraitorsEnabled; traitorProbabilityButtons[1].OnClicked = ToggleTraitorsEnabled;
@@ -449,8 +440,6 @@ namespace Barotrauma
UpdateJobPreferences(jobList); UpdateJobPreferences(jobList);
//UpdatePreviewPlayer(Game1.Client.CharacterInfo);
UpdatePreviewPlayer(characterInfo); UpdatePreviewPlayer(characterInfo);
} }
} }
@@ -485,7 +474,7 @@ namespace Barotrauma
GameMain.Server.AutoRestart = tickBox.Selected; GameMain.Server.AutoRestart = tickBox.Selected;
GameMain.Server.UpdateNetLobby(tickBox); valueChanged = true;
return true; return true;
} }
@@ -502,7 +491,7 @@ namespace Barotrauma
SetTraitorsEnabled((YesNoMaybe)index); SetTraitorsEnabled((YesNoMaybe)index);
if (GameMain.Server != null) GameMain.Server.UpdateNetLobby(null); valueChanged = true;
return true; return true;
} }
@@ -515,20 +504,51 @@ namespace Barotrauma
} }
private bool SelectMap(GUIComponent component, object obj) private bool SelectSub(GUIComponent component, object obj)
{ {
if (GameMain.Server != null) GameMain.Server.UpdateNetLobby(obj); valueChanged = true;
//Submarine sub = (Submarine)obj; var hash = (obj as Submarine).MD5Hash;
//submarine already loaded //hash will be null if opening the sub file failed -> don't select the sub
//if (Submarine.Loaded != null && sub.FilePath == Submarine.Loaded.FilePath) return true; if (string.IsNullOrWhiteSpace(hash.Hash))
{
(component as GUITextBlock).TextColor = Color.DarkRed * 0.8f;
component.CanBeFocused = false;
//sub.Load(); return false;
}
return true; return true;
} }
public void UpdateSubList()
{
if (subList == null) return;
subList.ClearChildren();
if (Submarine.SavedSubmarines.Count > 0)
{
foreach (Submarine sub in Submarine.SavedSubmarines)
{
GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25),
sub.Name, GUI.Style,
Alignment.Left, Alignment.Left,
subList);
textBlock.Padding = new Vector4(10.0f, 0.0f, 0.0f, 0.0f);
textBlock.UserData = sub;
}
}
else
{
DebugConsole.ThrowError("No saved submarines found!");
return;
}
}
public bool VotableClicked(GUIComponent component, object userData) public bool VotableClicked(GUIComponent component, object userData)
{ {
if (GameMain.Client == null) return false; if (GameMain.Client == null) return false;
@@ -558,7 +578,7 @@ namespace Barotrauma
{ {
if (GameMain.Server == null) return false; if (GameMain.Server == null) return false;
ServerName = text; ServerName = text;
GameMain.Server.UpdateNetLobby(null, null); valueChanged = true;
return true; return true;
} }
@@ -567,7 +587,7 @@ namespace Barotrauma
{ {
if (GameMain.Server == null) return false; if (GameMain.Server == null) return false;
ServerMessage = text; ServerMessage = text;
GameMain.Server.UpdateNetLobby(null, null); valueChanged = true;
return true; return true;
} }
@@ -575,7 +595,7 @@ namespace Barotrauma
public void AddPlayer(string name) public void AddPlayer(string name)
{ {
GUITextBlock textBlock = new GUITextBlock( GUITextBlock textBlock = new GUITextBlock(
new Rectangle(0, 0, 0, 25), name, new Rectangle(0, 0, playerList.Rect.Width-20, 25), name,
GUI.Style, Alignment.Left, Alignment.Left, GUI.Style, Alignment.Left, Alignment.Left,
playerList); playerList);
@@ -614,7 +634,7 @@ namespace Barotrauma
var closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Close", Alignment.BottomRight, GUI.Style, playerFrameInner); var closeButton = new GUIButton(new Rectangle(0, 0, 100, 20), "Close", Alignment.BottomRight, GUI.Style, playerFrameInner);
closeButton.OnClicked = ClosePlayerFrame; closeButton.OnClicked = ClosePlayerFrame;
return true; return false;
} }
private bool ClosePlayerFrame(GUIButton button, object userData) private bool ClosePlayerFrame(GUIButton button, object userData)
@@ -644,10 +664,7 @@ namespace Barotrauma
public void ClearPlayers() public void ClearPlayers()
{ {
for (int i = 1; i<playerList.CountChildren; i++) playerList.ClearChildren();
{
playerList.RemoveChild(playerList.children[i]);
}
} }
public override void Update(double deltaTime) public override void Update(double deltaTime)
@@ -693,6 +710,18 @@ namespace Barotrauma
if (GameMain.Server.BanList.BanFrame != null) GameMain.Server.BanList.BanFrame.Update((float)deltaTime); if (GameMain.Server.BanList.BanFrame != null) GameMain.Server.BanList.BanFrame.Update((float)deltaTime);
} }
if (valueChanged && GameMain.Server != null)
{
networkUpdateTimer -= (float)deltaTime;
if (networkUpdateTimer <= 0.0f)
{
GameMain.Server.UpdateNetLobby(null);
valueChanged = false;
networkUpdateTimer = NetworkUpdateInterval;
}
}
//durationBar.BarScroll = Math.Max(durationBar.BarScroll, 1.0f / 60.0f); //durationBar.BarScroll = Math.Max(durationBar.BarScroll, 1.0f / 60.0f);
} }
@@ -803,7 +832,7 @@ namespace Barotrauma
GameModePreset modePreset = obj as GameModePreset; GameModePreset modePreset = obj as GameModePreset;
if (modePreset == null) return false; if (modePreset == null) return false;
if (GameMain.Server != null) GameMain.Server.UpdateNetLobby(obj); valueChanged = true;
return true; return true;
} }
@@ -819,7 +848,7 @@ namespace Barotrauma
//textBox.Text = LevelSeed; //textBox.Text = LevelSeed;
//textBox.Selected = false; //textBox.Selected = false;
if (GameMain.Server != null) GameMain.Server.UpdateNetLobby(null); valueChanged = true;
return true; return true;
} }
@@ -901,29 +930,47 @@ namespace Barotrauma
public bool TrySelectSub(string subName, string md5Hash) public bool TrySelectSub(string subName, string md5Hash)
{ {
//already downloading the selected sub file
if (GameMain.Client.ActiveFileTransferName == subName+".sub") return false;
Submarine sub = Submarine.SavedSubmarines.Find(m => m.Name == subName); Submarine sub = Submarine.SavedSubmarines.Find(m => m.Name == subName);
if (sub == null) if (sub == null || sub.MD5Hash.Hash != md5Hash)
{ {
new GUIMessageBox("Submarine not found!","The submarine ''" + subName + "'' has been selected by the server. Matching file not found in your map folder."); string errorMsg = "";
return false; if (sub == null)
}
else
{
if (sub.MD5Hash.Hash != md5Hash)
{ {
new GUIMessageBox("Submarine not found!", errorMsg = "Submarine ''" + subName + "'' was selected by the server. Matching file not found in your submarine folder. ";
"Your version of the map file ''" + sub.Name + "'' doesn't match the server's version!" }
+"\nYour file: " + sub.Name + "(MD5 hash : " + sub.MD5Hash.Hash + ")" else if (sub.MD5Hash.Hash == null)
+"\nServer's file: " + subName + "(MD5 hash : " + md5Hash + ")"); {
return false; errorMsg = "Couldn't load submarine ''" + subName + "''. The file may be corrupted. ";
} }
else else
{ {
subList.Select(sub, true); errorMsg = "Your version of the submarine file ''" + sub.Name + "'' doesn't match the server's version! "
//map.Load(); + "Your MD5 hash: " + sub.MD5Hash.Hash + " \n"
return true; + "Server's MD5 hash: " + md5Hash + ". ";
} }
string downloadMsg = GameMain.Client.ActiveFileTransferName == "" ?
"Do you want to download the file from the server host?" :
"Do you want to download the file and cancel downloading ''" + GameMain.Client.ActiveFileTransferName + "''?";
var requestFileBox = new GUIMessageBox("Submarine not found!", errorMsg+downloadMsg, new string[] { "Yes", "No" }, 400, 300);
requestFileBox.Buttons[0].UserData = subName;
requestFileBox.Buttons[0].OnClicked += requestFileBox.Close;
requestFileBox.Buttons[0].OnClicked += (GUIButton button, object userdata) =>
{
GameMain.Client.RequestFile(userdata.ToString(), FileTransferMessageType.Submarine);
return true;
};
requestFileBox.Buttons[1].OnClicked += requestFileBox.Close;
return false;
} }
subList.Select(sub, true);
return true;
} }
public void WriteData(NetOutgoingMessage msg) public void WriteData(NetOutgoingMessage msg)
@@ -949,7 +996,7 @@ namespace Barotrauma
//msg.Write(AllowSubVoting); //msg.Write(AllowSubVoting);
//msg.Write(AllowModeVoting); //msg.Write(AllowModeVoting);
msg.Write(modeList.SelectedIndex); msg.Write((byte)modeList.SelectedIndex);
//msg.Write(durationBar.BarScroll); //msg.Write(durationBar.BarScroll);
msg.Write(LevelSeed); msg.Write(LevelSeed);
@@ -966,7 +1013,7 @@ namespace Barotrauma
public void ReadData(NetIncomingMessage msg) public void ReadData(NetIncomingMessage msg)
{ {
string mapName="", md5Hash=""; string mapName = "", md5Hash = "";
int modeIndex = 0; int modeIndex = 0;
//float durationScroll = 0.0f; //float durationScroll = 0.0f;
@@ -991,7 +1038,7 @@ namespace Barotrauma
//AllowSubVoting = msg.ReadBoolean(); //AllowSubVoting = msg.ReadBoolean();
//AllowModeVoting = msg.ReadBoolean(); //AllowModeVoting = msg.ReadBoolean();
modeIndex = msg.ReadInt32(); modeIndex = msg.ReadByte();
//durationScroll = msg.ReadFloat(); //durationScroll = msg.ReadFloat();
@@ -1003,7 +1050,7 @@ namespace Barotrauma
int playerCount = msg.ReadByte(); int playerCount = msg.ReadByte();
playerList.ClearChildren(); playerList.ClearChildren();
for (int i = 0; i<playerCount; i++) for (int i = 0; i < playerCount; i++)
{ {
AddPlayer(msg.ReadString()); AddPlayer(msg.ReadString());
} }
+7 -2
View File
@@ -128,7 +128,7 @@ namespace Barotrauma
voteText.UserData = "votes"; voteText.UserData = "votes";
} }
voteText.Text = votes.ToString(); voteText.Text = votes == 0 ? "" : votes.ToString();
} }
} }
@@ -233,6 +233,11 @@ namespace Barotrauma
AllowSubVoting = msg.ReadBoolean(); AllowSubVoting = msg.ReadBoolean();
if (allowSubVoting) if (allowSubVoting)
{ {
foreach (Submarine sub in Submarine.SavedSubmarines)
{
SetVoteText(GameMain.NetLobbyScreen.SubList, sub, 0);
}
int votableCount = msg.ReadByte(); int votableCount = msg.ReadByte();
for (int i = 0; i < votableCount; i++) for (int i = 0; i < votableCount; i++)
{ {
@@ -252,7 +257,7 @@ namespace Barotrauma
int votes = msg.ReadByte(); int votes = msg.ReadByte();
string modeName = msg.ReadString(); string modeName = msg.ReadString();
GameModePreset mode = GameModePreset.list.Find(m => m.Name == modeName); GameModePreset mode = GameModePreset.list.Find(m => m.Name == modeName);
SetVoteText(GameMain.NetLobbyScreen.SubList, mode, votes); SetVoteText(GameMain.NetLobbyScreen.ModeList, mode, votes);
} }
} }
+11 -8
View File
@@ -165,24 +165,27 @@ namespace Barotrauma
string port = arguments[1]; string port = arguments[1];
string serverName = arguments[2]; string serverName = arguments[2];
string gameStarted = (arguments.Length > 3) ? arguments[3] : ""; string gameStarted = (arguments.Length > 3) ? arguments[3] : "";
string playerCountStr = (arguments.Length > 4) ? arguments[4] : ""; string currPlayersStr = (arguments.Length > 4) ? arguments[4] : "";
string maxPlayersStr = (arguments.Length > 5) ? arguments[5] : "";
string hasPassWordStr = (arguments.Length > 5) ? arguments[5] : "";
var serverFrame = new GUIFrame(new Rectangle(0,0,0,20), (i%2 == 0) ? Color.Transparent : Color.White*0.2f, null, serverList); string hasPassWordStr = (arguments.Length > 6) ? arguments[6] : "";
serverFrame.UserData = IP+":"+port;
var serverFrame = new GUIFrame(new Rectangle(0, 0, 0, 20), (i % 2 == 0) ? Color.Transparent : Color.White * 0.2f, null, serverList);
serverFrame.UserData = IP + ":" + port;
serverFrame.HoverColor = Color.Gold * 0.2f; serverFrame.HoverColor = Color.Gold * 0.2f;
serverFrame.SelectedColor = Color.Gold * 0.5f; serverFrame.SelectedColor = Color.Gold * 0.5f;
var passwordBox = new GUITickBox(new Rectangle(columnX[0]/2, 0, 20, 20), "", Alignment.TopLeft, serverFrame); var passwordBox = new GUITickBox(new Rectangle(columnX[0] / 2, 0, 20, 20), "", Alignment.TopLeft, serverFrame);
passwordBox.Selected = hasPassWordStr == "1"; passwordBox.Selected = hasPassWordStr == "1";
passwordBox.Enabled = false; passwordBox.Enabled = false;
passwordBox.UserData = "password"; passwordBox.UserData = "password";
var nameText = new GUITextBlock(new Rectangle(columnX[0], 0, 0, 0), serverName, GUI.Style, serverFrame); var nameText = new GUITextBlock(new Rectangle(columnX[0], 0, 0, 0), serverName, GUI.Style, serverFrame);
int playerCount, maxPlayers; int playerCount = 0, maxPlayers = 1;
playerCount = GameClient.ByteToPlayerCount((byte)int.Parse(playerCountStr), out maxPlayers); int.TryParse(currPlayersStr, out playerCount);
int.TryParse(maxPlayersStr, out maxPlayers);
var playerCountText = new GUITextBlock(new Rectangle(columnX[1], 0, 0, 0), playerCount + "/" + maxPlayers, GUI.Style, serverFrame); var playerCountText = new GUITextBlock(new Rectangle(columnX[1], 0, 0, 0), playerCount + "/" + maxPlayers, GUI.Style, serverFrame);
@@ -208,7 +211,7 @@ namespace Barotrauma
if (client == null) yield return CoroutineStatus.Success; if (client == null) yield return CoroutineStatus.Success;
var request = new RestRequest("masterserver.php", Method.GET); var request = new RestRequest("masterserver2.php", Method.GET);
request.AddParameter("gamename", "barotrauma"); // adds to POST or URL querystring based on Method request.AddParameter("gamename", "barotrauma"); // adds to POST or URL querystring based on Method
request.AddParameter("action", "listservers"); // adds to POST or URL querystring based on Method request.AddParameter("action", "listservers"); // adds to POST or URL querystring based on Method
+23
View File
@@ -1,3 +1,26 @@
---------------------------------------------------------------------------------------------------------
v0.3.4.0
---------------------------------------------------------------------------------------------------------
Multiplayer:
- missing submarine files can be downloaded from the server host
- player syncing bugfixes (aiming is visible to other players, smoother movement in water)
- creature syncing bugfixes (less teleporting around)
- fixed the server lobby displaying wrong numbers of votes at the client's side
- fixed the server list displaying 16/16 players as 0/16
- saving server settings
Other:
- skyholder artifacts consume oxygen
- thermal artifacts catch fire even if they're not being held
- placed items/structures can be resized in the editor
- items in the inventory can be swapped between slots by dragging them on top of each other
- cyrillic character support
- slower underwater scooters
- fixed pressure building up in enclosed rooms full of water, even if there were no hull breaches
- an indicator which shows the direction of the sub when spectating
- fixed crashing when loading a submarine with no hulls
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
v0.3.3.1 v0.3.3.1
--------------------------------------------------------------------------------------------------------- ---------------------------------------------------------------------------------------------------------
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<config masterserverurl="http://www.undertowgames.com/baromaster" autocheckupdates="true" musicvolume="0.0" soundvolume="0.0">
<graphicsmode width="1280" height="720" fullscreen="false" />
<contentpackage path="Data/ContentPackages/Vanilla 0.3.xml" />
<keymapping Select="E" Use="0" Aim="1" Up="W" Down="S" Left="A" Right="D" Run="LeftShift" Chat="Tab" CrewOrders="C" />
</config>
-76
View File
@@ -5,10 +5,6 @@ VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Barotrauma", "Subsurface\Barotrauma.csproj", "{008C0F83-E914-4966-9135-EA885059EDD8}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Barotrauma", "Subsurface\Barotrauma.csproj", "{008C0F83-E914-4966-9135-EA885059EDD8}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Barotrauma_contentContent", "Subsurface_content\Subsurface_contentContent\Barotrauma_contentContent.contentproj", "{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Barotrauma_content", "Subsurface_content\Subsurface_content\Barotrauma_content.csproj", "{1E6BF44D-6E31-40CC-8321-3D5958C983E7}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Farseer Physics MonoGame", "Farseer Physics Engine 3.5\Farseer Physics MonoGame.csproj", "{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Farseer Physics MonoGame", "Farseer Physics Engine 3.5\Farseer Physics MonoGame.csproj", "{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}"
EndProject EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "Lidgren.Network\Lidgren.Network.csproj", "{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lidgren.Network", "Lidgren.Network\Lidgren.Network.csproj", "{49BA1C69-6104-41AC-A5D8-B54FA9F696E8}"
@@ -97,78 +93,6 @@ Global
{008C0F83-E914-4966-9135-EA885059EDD8}.Windows8|Mixed Platforms.Build.0 = Release|x86 {008C0F83-E914-4966-9135-EA885059EDD8}.Windows8|Mixed Platforms.Build.0 = Release|x86
{008C0F83-E914-4966-9135-EA885059EDD8}.Windows8|x86.ActiveCfg = Release|x86 {008C0F83-E914-4966-9135-EA885059EDD8}.Windows8|x86.ActiveCfg = Release|x86
{008C0F83-E914-4966-9135-EA885059EDD8}.Windows8|x86.Build.0 = Release|x86 {008C0F83-E914-4966-9135-EA885059EDD8}.Windows8|x86.Build.0 = Release|x86
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Android|Any CPU.ActiveCfg = Android|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Android|Mixed Platforms.ActiveCfg = Android|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Android|x86.ActiveCfg = Android|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Debug|Any CPU.ActiveCfg = PSM|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Debug|Mixed Platforms.ActiveCfg = PSM|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Debug|x86.ActiveCfg = PSM|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.iOS|Any CPU.ActiveCfg = iOS|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.iOS|Mixed Platforms.ActiveCfg = iOS|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.iOS|x86.ActiveCfg = iOS|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Linux|Any CPU.ActiveCfg = Linux|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Linux|Mixed Platforms.ActiveCfg = Linux|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Linux|x86.ActiveCfg = Linux|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.OSX|Any CPU.ActiveCfg = OSX|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.OSX|Mixed Platforms.ActiveCfg = OSX|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.OSX|x86.ActiveCfg = OSX|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.PSM|Any CPU.ActiveCfg = PSM|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.PSM|Mixed Platforms.ActiveCfg = PSM|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.PSM|x86.ActiveCfg = PSM|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Release|Any CPU.ActiveCfg = PSM|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Release|Mixed Platforms.ActiveCfg = PSM|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Release|x86.ActiveCfg = PSM|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Windows|Mixed Platforms.ActiveCfg = Windows|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Windows|x86.ActiveCfg = Windows|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Windows8|Any CPU.ActiveCfg = Windows8|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Windows8|Mixed Platforms.ActiveCfg = Windows8|Any CPU
{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}.Windows8|x86.ActiveCfg = Windows8|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Android|Any CPU.ActiveCfg = Android|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Android|Any CPU.Build.0 = Android|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Android|Mixed Platforms.ActiveCfg = Android|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Android|Mixed Platforms.Build.0 = Android|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Android|x86.ActiveCfg = Android|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Debug|Any CPU.ActiveCfg = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Debug|Any CPU.Build.0 = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Debug|Mixed Platforms.ActiveCfg = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Debug|Mixed Platforms.Build.0 = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Debug|x86.ActiveCfg = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.iOS|Any CPU.ActiveCfg = iOS|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.iOS|Any CPU.Build.0 = iOS|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.iOS|Mixed Platforms.ActiveCfg = iOS|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.iOS|Mixed Platforms.Build.0 = iOS|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.iOS|x86.ActiveCfg = iOS|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Linux|Any CPU.ActiveCfg = Linux|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Linux|Any CPU.Build.0 = Linux|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Linux|Mixed Platforms.ActiveCfg = Linux|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Linux|Mixed Platforms.Build.0 = Linux|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Linux|x86.ActiveCfg = Linux|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.OSX|Any CPU.ActiveCfg = OSX|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.OSX|Any CPU.Build.0 = OSX|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.OSX|Mixed Platforms.ActiveCfg = OSX|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.OSX|Mixed Platforms.Build.0 = OSX|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.OSX|x86.ActiveCfg = OSX|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.PSM|Any CPU.ActiveCfg = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.PSM|Any CPU.Build.0 = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.PSM|Mixed Platforms.ActiveCfg = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.PSM|Mixed Platforms.Build.0 = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.PSM|x86.ActiveCfg = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Release|Any CPU.ActiveCfg = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Release|Any CPU.Build.0 = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Release|Mixed Platforms.ActiveCfg = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Release|Mixed Platforms.Build.0 = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Release|x86.ActiveCfg = PSM|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Windows|Any CPU.ActiveCfg = Windows|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Windows|Any CPU.Build.0 = Windows|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Windows|Mixed Platforms.ActiveCfg = Windows|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Windows|Mixed Platforms.Build.0 = Windows|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Windows|x86.ActiveCfg = Windows|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Windows8|Any CPU.ActiveCfg = Windows8|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Windows8|Any CPU.Build.0 = Windows8|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Windows8|Mixed Platforms.ActiveCfg = Windows8|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Windows8|Mixed Platforms.Build.0 = Windows8|Any CPU
{1E6BF44D-6E31-40CC-8321-3D5958C983E7}.Windows8|x86.ActiveCfg = Windows8|Any CPU
{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Android|Any CPU.ActiveCfg = Release|x86 {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Android|Any CPU.ActiveCfg = Release|x86
{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Android|Mixed Platforms.ActiveCfg = Release|x86 {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Android|Mixed Platforms.ActiveCfg = Release|x86
{0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Android|Mixed Platforms.Build.0 = Release|x86 {0AAD36E3-51A5-4A07-AB60-5C8A66BD38B7}.Android|Mixed Platforms.Build.0 = Release|x86
Binary file not shown.
@@ -1,65 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.ContentPipeline.targets" />
<PropertyGroup>
<ProjectGuid>{1E6BF44D-6E31-40CC-8321-3D5958C983E7}</ProjectGuid>
<ProjectTypeGuids>{6D335F3A-9D43-41b4-9D22-F6F17C4BE596};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<Configuration Condition=" '$(Configuration)' == '' ">Windows</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ContentBuilder</RootNamespace>
<AssemblyName>IgnoreMe</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
<OutputPath>bin\$(Configuration)</OutputPath>
<XnaPlatform>Windows</XnaPlatform>
<XnaProfile>HiDef</XnaProfile>
<XnaCrossPlatformGroupID>c5d15975-8253-40b2-a958-76a62addbeca</XnaCrossPlatformGroupID>
<XnaOutputType>Library</XnaOutputType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Windows' ">
<MonoGamePlatform>Windows</MonoGamePlatform>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Windows8' ">
<MonoGamePlatform>Windows8</MonoGamePlatform>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Android' ">
<MonoGamePlatform>Android</MonoGamePlatform>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'iOS' ">
<MonoGamePlatform>iOS</MonoGamePlatform>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'OSX' ">
<MonoGamePlatform>OSX</MonoGamePlatform>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Linux' ">
<MonoGamePlatform>Linux</MonoGamePlatform>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'PSM' ">
<MonoGamePlatform>PSM</MonoGamePlatform>
</PropertyGroup>
<ItemGroup>
<Reference Include="mscorlib" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Subsurface_contentContent\Barotrauma_contentContent.contentproj">
<Name>Barotrauma_contentContent</Name>
<XnaReferenceType>Content</XnaReferenceType>
<Project>{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}</Project>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" />
<!--
To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
@@ -1,6 +0,0 @@
Content\SpriteFont1.xnb
Content\SmallFont.xnb
Content\LargeFont.xnb
Content\SpriteFont1.spritefont
Content\SmallFont.spritefont
Content\LargeFont.spritefont
@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>
@@ -1 +0,0 @@
Content\SpriteFont1.xnb
@@ -1 +0,0 @@
Content\SpriteFont1.xnb
@@ -1 +0,0 @@
Content\SpriteFont1.xnb
@@ -1,7 +0,0 @@
<stylecopresultscache>
<version>12</version>
<project key="-1410927846">
<configuration>
</configuration>
</project>
</stylecopresultscache>
@@ -1,6 +0,0 @@
Content\SpriteFont1.xnb
Content\SmallFont.xnb
Content\LargeFont.xnb
Content\SpriteFont1.spritefont
Content\SmallFont.spritefont
Content\LargeFont.spritefont
@@ -1,6 +0,0 @@
Content\SpriteFont1.xnb
Content\SmallFont.xnb
Content\LargeFont.xnb
Content\SpriteFont1.spritefont
Content\SmallFont.spritefont
Content\LargeFont.spritefont
@@ -1,65 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file contains an xml description of a font, and will be read by the XNA
Framework Content Pipeline. Follow the comments to customize the appearance
of the font in your game, and to change the characters which are available to draw
with.
-->
<XnaContent xmlns:Graphics="Microsoft.Xna.Framework.Content.Pipeline.Graphics">
<Asset Type="Graphics:FontDescription">
<!--
Modify this string to change the font that will be imported.
-->
<FontName>Verdana</FontName>
<!--
Size is a float value, measured in points. Modify this value to change
the size of the font.
-->
<Size>10</Size>
<!--
Spacing is a float value, measured in pixels. Modify this value to change
the amount of spacing in between characters.
-->
<Spacing>0</Spacing>
<!--
UseKerning controls the layout of the font. If this value is true, kerning information
will be used when placing characters.
-->
<UseKerning>true</UseKerning>
<!--
Style controls the style of the font. Valid entries are "Regular", "Bold", "Italic",
and "Bold, Italic", and are case sensitive.
-->
<Style>Regular</Style>
<!--
If you uncomment this line, the default character will be substituted if you draw
or measure text that contains characters which were not included in the font.
-->
<DefaultCharacter>_</DefaultCharacter>
<!--
CharacterRegions control what letters are available in the font. Every
character from Start to End will be built and made available for drawing. The
default range is from 32, (ASCII space), to 126, ('~'), covering the basic Latin
character set. The characters are ordered according to the Unicode standard.
See the documentation for more information.
-->
<CharacterRegions>
<CharacterRegion>
<Start>&#32;</Start>
<End>&#126;</End>
</CharacterRegion>
<CharacterRegion>
<Start>&#192;</Start>
<End>&#601;</End>
</CharacterRegion>
</CharacterRegions>
</Asset>
</XnaContent>
@@ -1 +0,0 @@
Windows.v4.0.HiDef
@@ -1,80 +0,0 @@
D:\Omat tiedostot\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
D:\Omat tiedostot\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
D:\Omat tiedostot\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
D:\Omat tiedostot\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
D:\Omat tiedostot\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
C:\Users\Joonas\Desktop\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
C:\Users\Joonas\Desktop\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Desktop\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
C:\Users\Joonas\Downloads\SBMR\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
C:\Users\Joonas\Downloads\SBMR\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
C:\Users\Joonas\Downloads\SBMR\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
C:\Users\Joonas\Downloads\SBMR\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Downloads\SBMR\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
E:\CBGAM\SBMR_1509\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
E:\CBGAM\SBMR_1509\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
E:\CBGAM\SBMR_1509\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
E:\CBGAM\SBMR_1509\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
E:\CBGAM\SBMR_1509\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
C:\Users\Joonas\Documents\CBGAM\SBMR_1809\SBMR_1509\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
C:\Users\Joonas\Documents\CBGAM\SBMR_1809\SBMR_1509\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
C:\Users\Joonas\Documents\CBGAM\SBMR_1809\SBMR_1509\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
C:\Users\Joonas\Documents\CBGAM\SBMR_1809\SBMR_1509\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Documents\CBGAM\SBMR_1809\SBMR_1509\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
C:\Users\Joonas\Documents\CBGAM\SBMR_1809_2\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
C:\Users\Joonas\Documents\CBGAM\SBMR_1809_2\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
C:\Users\Joonas\Documents\CBGAM\SBMR_1809_2\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
C:\Users\Joonas\Documents\CBGAM\SBMR_1809_2\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Documents\CBGAM\SBMR_1809_2\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
E:\CBGAM\SBMR_2909\SBMR_2909\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
E:\CBGAM\SBMR_2909\SBMR_2909\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
E:\CBGAM\SBMR_2909\SBMR_2909\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
E:\CBGAM\SBMR_2909\SBMR_2909\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
E:\CBGAM\SBMR_2909\SBMR_2909\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
E:\CBGAM\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
E:\CBGAM\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
E:\CBGAM\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
E:\CBGAM\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
E:\CBGAM\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
E:\CBGAM\SBMR_2710\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
E:\CBGAM\SBMR_2710\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
E:\CBGAM\SBMR_2710\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
E:\CBGAM\SBMR_2710\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
E:\CBGAM\SBMR_2710\SBMR\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
C:\Users\Joonas\Desktop\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
C:\Users\Joonas\Desktop\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Desktop\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SMBR_1311\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
C:\Users\Joonas\Desktop\SMBR_1311\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SMBR_1311\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
C:\Users\Joonas\Desktop\SMBR_1311\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Desktop\SMBR_1311\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_2111\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
C:\Users\Joonas\Desktop\SBMR_2111\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_2111\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
C:\Users\Joonas\Desktop\SBMR_2111\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Desktop\SBMR_2111\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_2811\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
C:\Users\Joonas\Desktop\SBMR_2811\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_2811\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
C:\Users\Joonas\Desktop\SBMR_2811\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Desktop\SBMR_2811\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
C:\Users\Joonas\Desktop\SBMR_1312\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
C:\Users\Joonas\Desktop\SBMR_1312\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_1312\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
C:\Users\Joonas\Desktop\SBMR_1312\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Desktop\SBMR_1312\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_1512\Sbmr_content\Sbmr_content\bin\PSM\Content\SpriteFont1.xnb
C:\Users\Joonas\Desktop\SBMR_1512\Sbmr_content\Sbmr_content\bin\PSM\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_1512\Sbmr_content\Sbmr_content\obj\PSM\Sbmr_content.csprojResolveAssemblyReference.cache
C:\Users\Joonas\Desktop\SBMR_1512\Sbmr_content\Sbmr_content\obj\PSM\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Desktop\SBMR_1512\Sbmr_content\Sbmr_content\obj\PSM\IgnoreMe.dll
@@ -1,6 +0,0 @@
Content\SpriteFont1.xnb
Content\SmallFont.xnb
Content\LargeFont.xnb
Content\SpriteFont1.spritefont
Content\SmallFont.spritefont
Content\LargeFont.spritefont
@@ -1,78 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:Pipeline="Microsoft.Xna.Framework.Content.Pipeline">
<Asset Type="Pipeline:BuildItemCollection">
<Item>
<Source>SpriteFont1.spritefont</Source>
<Name>SpriteFont1</Name>
<Importer>FontDescriptionImporter</Importer>
<Processor>FontDescriptionProcessor</Processor>
<Options>None</Options>
<Output>E:\Subsurface\Subsurface_content\Subsurface_content\bin\Windows\Content\SpriteFont1.xnb</Output>
<Time>2015-07-19T00:51:29.3427566+03:00</Time>
</Item>
<Item>
<Source>SmallFont.spritefont</Source>
<Name>SmallFont</Name>
<Importer>FontDescriptionImporter</Importer>
<Processor>FontDescriptionProcessor</Processor>
<Options>None</Options>
<Output>E:\Subsurface\Subsurface_content\Subsurface_content\bin\Windows\Content\SmallFont.xnb</Output>
<Time>2015-07-19T00:51:26.3565858+03:00</Time>
</Item>
<Item>
<Source>LargeFont.spritefont</Source>
<Name>LargeFont</Name>
<Importer>FontDescriptionImporter</Importer>
<Processor>FontDescriptionProcessor</Processor>
<Options>None</Options>
<Output>E:\Subsurface\Subsurface_content\Subsurface_content\bin\Windows\Content\LargeFont.xnb</Output>
<Time>2015-08-13T19:53:28.5907374+03:00</Time>
</Item>
<BuildSuccessful>true</BuildSuccessful>
<Settings>
<ContentProjectGUID>{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}</ContentProjectGUID>
<TargetPlatform>Windows</TargetPlatform>
<TargetProfile>HiDef</TargetProfile>
<BuildConfiguration>Windows</BuildConfiguration>
<CompressContent>false</CompressContent>
<RootDirectory>E:\Subsurface\Subsurface_content\Subsurface_contentContent\</RootDirectory>
<LoggerRootDirectory>E:\Subsurface\Subsurface_content\Subsurface_content\</LoggerRootDirectory>
<IntermediateDirectory>E:\Subsurface\Subsurface_content\Subsurface_content\obj\Windows\</IntermediateDirectory>
<OutputDirectory>E:\Subsurface\Subsurface_content\Subsurface_content\bin\Windows\Content\</OutputDirectory>
</Settings>
<Assemblies>
<Assembly>
<Key>C:\Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGameContentProcessors.dll</Key>
<Value>2015-02-12T06:10:24+02:00</Value>
</Assembly>
<Assembly>
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.XImporter.dll</Key>
<Value>2011-09-01T16:22:30+03:00</Value>
</Assembly>
<Assembly>
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.VideoImporters.dll</Key>
<Value>2011-09-01T16:22:30+03:00</Value>
</Assembly>
<Assembly>
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.dll</Key>
<Value>2011-09-01T16:22:30+03:00</Value>
</Assembly>
<Assembly>
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.FBXImporter.dll</Key>
<Value>2011-09-01T16:22:30+03:00</Value>
</Assembly>
<Assembly>
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.EffectImporter.dll</Key>
<Value>2011-09-01T16:22:30+03:00</Value>
</Assembly>
<Assembly>
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.AudioImporters.dll</Key>
<Value>2011-09-01T16:22:30+03:00</Value>
</Assembly>
<Assembly>
<Key>C:\Windows\Microsoft.Net\assembly\GAC_32\Microsoft.Xna.Framework.Content.Pipeline\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Content.Pipeline.dll</Key>
<Value>2014-09-15T20:04:13.234089+03:00</Value>
</Assembly>
</Assemblies>
</Asset>
</XnaContent>
@@ -1,10 +0,0 @@
C:\Users\Joonas\Desktop\SMBR_1311\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\Windows\Content\SpriteFont1.xnb
C:\Users\Joonas\Desktop\SMBR_1311\Sbmr_Solution\Sbmr_content\Sbmr_content\bin\Windows\IgnoreMe.dll
C:\Users\Joonas\Desktop\SMBR_1311\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\Windows\Sbmr_content.csprojResolveAssemblyReference.cache
C:\Users\Joonas\Desktop\SMBR_1311\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\Windows\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Desktop\SMBR_1311\Sbmr_Solution\Sbmr_content\Sbmr_content\obj\Windows\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\bin\Windows\Content\SpriteFont1.xnb
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\bin\Windows\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\obj\Windows\Sbmr_content.csprojResolveAssemblyReference.cache
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\obj\Windows\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\obj\Windows\IgnoreMe.dll
@@ -1,6 +0,0 @@
Content\SpriteFont1.xnb
Content\SmallFont.xnb
Content\LargeFont.xnb
Content\SpriteFont1.spritefont
Content\SmallFont.spritefont
Content\LargeFont.spritefont
@@ -1,60 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<XnaContent xmlns:Pipeline="Microsoft.Xna.Framework.Content.Pipeline">
<Asset Type="Pipeline:BuildItemCollection">
<Item>
<Source>SpriteFont1.spritefont</Source>
<Name>SpriteFont1</Name>
<Importer>FontDescriptionImporter</Importer>
<Processor>FontDescriptionProcessor</Processor>
<Options>None</Options>
<Output>C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\bin\Windows8\Content\SpriteFont1.xnb</Output>
<Time>2014-08-09T18:03:17.8614245+03:00</Time>
</Item>
<BuildSuccessful>true</BuildSuccessful>
<Settings>
<ContentProjectGUID>{8C1D2051-F0F3-457B-AAAE-4E155FC7C75C}</ContentProjectGUID>
<TargetPlatform>Windows</TargetPlatform>
<TargetProfile>HiDef</TargetProfile>
<BuildConfiguration>Windows8</BuildConfiguration>
<CompressContent>false</CompressContent>
<RootDirectory>C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_contentContent\</RootDirectory>
<LoggerRootDirectory>C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\</LoggerRootDirectory>
<IntermediateDirectory>C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\obj\Windows8\</IntermediateDirectory>
<OutputDirectory>C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\bin\Windows8\Content\</OutputDirectory>
</Settings>
<Assemblies>
<Assembly>
<Key>C:\Program Files (x86)\MSBuild\MonoGame\v3.0\MonoGameContentProcessors.dll</Key>
<Value>2014-04-06T00:56:18+03:00</Value>
</Assembly>
<Assembly>
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.XImporter.dll</Key>
<Value>2011-09-01T16:22:30+03:00</Value>
</Assembly>
<Assembly>
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.VideoImporters.dll</Key>
<Value>2011-09-01T16:22:30+03:00</Value>
</Assembly>
<Assembly>
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.TextureImporter.dll</Key>
<Value>2011-09-01T16:22:30+03:00</Value>
</Assembly>
<Assembly>
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.FBXImporter.dll</Key>
<Value>2011-09-01T16:22:30+03:00</Value>
</Assembly>
<Assembly>
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.EffectImporter.dll</Key>
<Value>2011-09-01T16:22:30+03:00</Value>
</Assembly>
<Assembly>
<Key>C:\Program Files (x86)\Microsoft XNA\XNA Game Studio\v4.0\References\Windows\x86\Microsoft.Xna.Framework.Content.Pipeline.AudioImporters.dll</Key>
<Value>2011-09-01T16:22:30+03:00</Value>
</Assembly>
<Assembly>
<Key>C:\Windows\Microsoft.Net\assembly\GAC_32\Microsoft.Xna.Framework.Content.Pipeline\v4.0_4.0.0.0__842cf8be1de50553\Microsoft.Xna.Framework.Content.Pipeline.dll</Key>
<Value>2014-09-15T20:04:13.234089+03:00</Value>
</Assembly>
</Assemblies>
</Asset>
</XnaContent>
@@ -1,5 +0,0 @@
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\bin\Windows8\Content\SpriteFont1.xnb
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\bin\Windows8\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\obj\Windows8\Microsoft.Xna.Framework.RuntimeProfile.txt
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\obj\Windows8\IgnoreMe.dll
C:\Users\Joonas\Desktop\SBMR_3011\Sbmr_content\Sbmr_content\obj\Windows8\Sbmr_content.csprojResolveAssemblyReference.cache

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