(c1468d39d) Overhauled docking interface (WIP)
This commit is contained in:
@@ -43,12 +43,8 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\MultiPlayerCampaign.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\MultiPlayerCampaign.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\SinglePlayerCampaign.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\SinglePlayerCampaign.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\BasicTutorial.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\BasicTutorial.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\CaptainTutorial.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\ContextualTutorial.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\DoctorTutorial.cs" />
|
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\EditorTutorial.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\EditorTutorial.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\EngineerTutorial.cs" />
|
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\MechanicTutorial.cs" />
|
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\OfficerTutorial.cs" />
|
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\ScenarioTutorial.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\ScenarioTutorial.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\Tutorial.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\Tutorial.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\TutorialMode.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\GameSession\GameModes\Tutorials\TutorialMode.cs" />
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
./Barotrauma
|
exec mono "./Barotrauma.exe" MONO_LOG_LEVEL=debug "$@"
|
||||||
|
|||||||
@@ -60,6 +60,9 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Concentus, Version=1.1.6.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\Libraries\NuGet\Concentus.1.1.7\lib\portable-net45+win+wpa81+wp80\Concentus.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="GameAnalytics.Mono, Version=1.0.6710.29255, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="GameAnalytics.Mono, Version=1.0.6710.29255, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll</HintPath>
|
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -129,10 +132,6 @@
|
|||||||
</BootstrapperPackage>
|
</BootstrapperPackage>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.csproj">
|
|
||||||
<Project>{0e7fee6a-15e5-4a4e-943c-80276003478c}</Project>
|
|
||||||
<Name>Concentus</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.csproj">
|
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.csproj">
|
||||||
<Project>{3af0347c-5a9b-4421-868c-8ee3dbfaebc6}</Project>
|
<Project>{3af0347c-5a9b-4421-868c-8ee3dbfaebc6}</Project>
|
||||||
<Name>Facepunch.Steamworks</Name>
|
<Name>Facepunch.Steamworks</Name>
|
||||||
@@ -187,18 +186,12 @@
|
|||||||
<None Include="Content\Effects\watershader_opengl.xnb">
|
<None Include="Content\Effects\watershader_opengl.xnb">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="lib64\libMonoPosixHelper.so">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="libopenal.so.1">
|
<None Include="libopenal.so.1">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="libsteam_api64.so">
|
<None Include="libsteam_api64.so">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="libvlc.so">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
<None Include="Barotrauma">
|
<None Include="Barotrauma">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
|||||||
@@ -59,6 +59,9 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Concentus, Version=1.1.6.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\Libraries\NuGet\Concentus.1.1.7\lib\portable-net45+win+wpa81+wp80\Concentus.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="GameAnalytics.Mono, Version=1.0.6710.29255, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="GameAnalytics.Mono, Version=1.0.6710.29255, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll</HintPath>
|
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -128,10 +131,6 @@
|
|||||||
</BootstrapperPackage>
|
</BootstrapperPackage>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.csproj">
|
|
||||||
<Project>{0e7fee6a-15e5-4a4e-943c-80276003478c}</Project>
|
|
||||||
<Name>Concentus</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.csproj">
|
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.csproj">
|
||||||
<Project>{3af0347c-5a9b-4421-868c-8ee3dbfaebc6}</Project>
|
<Project>{3af0347c-5a9b-4421-868c-8ee3dbfaebc6}</Project>
|
||||||
<Name>Facepunch.Steamworks</Name>
|
<Name>Facepunch.Steamworks</Name>
|
||||||
|
|||||||
@@ -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.8.10.0")]
|
[assembly: AssemblyVersion("0.8.9.10")]
|
||||||
[assembly: AssemblyFileVersion("0.8.10.0")]
|
[assembly: AssemblyFileVersion("0.8.9.10")]
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace Barotrauma
|
|||||||
if (distSqrd > 10.0f || !character.AllowInput)
|
if (distSqrd > 10.0f || !character.AllowInput)
|
||||||
{
|
{
|
||||||
Collider.TargetRotation = newRotation;
|
Collider.TargetRotation = newRotation;
|
||||||
SetPosition(newPosition, lerp: distSqrd < 5.0f, ignorePlatforms: false);
|
SetPosition(newPosition, lerp: distSqrd < 5.0f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -238,16 +238,20 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
float errorMagnitude = positionError.Length();
|
float errorMagnitude = positionError.Length();
|
||||||
if (errorMagnitude > 0.5f)
|
if (errorMagnitude > 0.01f)
|
||||||
{
|
|
||||||
character.MemLocalState.Clear();
|
|
||||||
SetPosition(serverPos.Position, lerp: true, ignorePlatforms: false);
|
|
||||||
}
|
|
||||||
else if (errorMagnitude > 0.01f)
|
|
||||||
{
|
{
|
||||||
Collider.TargetPosition = Collider.SimPosition + positionError;
|
Collider.TargetPosition = Collider.SimPosition + positionError;
|
||||||
Collider.TargetRotation = Collider.Rotation + rotationError;
|
Collider.TargetRotation = Collider.Rotation + rotationError;
|
||||||
Collider.MoveToTargetPosition(lerp: true);
|
Collider.MoveToTargetPosition(lerp: true);
|
||||||
|
if (errorMagnitude > 0.5f)
|
||||||
|
{
|
||||||
|
character.MemLocalState.Clear();
|
||||||
|
foreach (Limb limb in Limbs)
|
||||||
|
{
|
||||||
|
limb.body.TargetPosition = limb.body.SimPosition + positionError;
|
||||||
|
limb.body.MoveToTargetPosition(lerp: true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -436,15 +440,14 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color? color = null;
|
//foreach (Limb limb in Limbs)
|
||||||
if (character.ExternalHighlight)
|
//{
|
||||||
{
|
// limb.Draw(spriteBatch, cam);
|
||||||
color = Color.Lerp(Color.White, Color.OrangeRed, (float)Math.Sin(Timing.TotalTime * 3.5f));
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < limbs.Length; i++)
|
for (int i = 0; i < limbs.Length; i++)
|
||||||
{
|
{
|
||||||
inversedLimbDrawOrder[i].Draw(spriteBatch, cam, color);
|
inversedLimbDrawOrder[i].Draw(spriteBatch, cam);
|
||||||
}
|
}
|
||||||
LimbJoints.ForEach(j => j.Draw(spriteBatch));
|
LimbJoints.ForEach(j => j.Draw(spriteBatch));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,8 @@ namespace Barotrauma
|
|||||||
if (controlled == value) return;
|
if (controlled == value) return;
|
||||||
controlled = value;
|
controlled = value;
|
||||||
if (controlled != null) controlled.Enabled = true;
|
if (controlled != null) controlled.Enabled = true;
|
||||||
CharacterHealth.OpenHealthWindow = null;
|
CharacterHealth.OpenHealthWindow = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,33 +111,6 @@ namespace Barotrauma
|
|||||||
get { return gibEmitters; }
|
get { return gibEmitters; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ObjectiveEntity
|
|
||||||
{
|
|
||||||
public Entity Entity;
|
|
||||||
public Sprite Sprite;
|
|
||||||
public Color Color;
|
|
||||||
|
|
||||||
public ObjectiveEntity(Entity entity, Sprite sprite, Color? color = null)
|
|
||||||
{
|
|
||||||
Entity = entity;
|
|
||||||
Sprite = sprite;
|
|
||||||
if (color.HasValue)
|
|
||||||
{
|
|
||||||
Color = color.Value;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Color = Color.White;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<ObjectiveEntity> activeObjectiveEntities = new List<ObjectiveEntity>();
|
|
||||||
public IEnumerable<ObjectiveEntity> ActiveObjectiveEntities
|
|
||||||
{
|
|
||||||
get { return activeObjectiveEntities; }
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void InitProjSpecific(XDocument doc)
|
partial void InitProjSpecific(XDocument doc)
|
||||||
{
|
{
|
||||||
soundInterval = doc.Root.GetAttributeFloat("soundinterval", 10.0f);
|
soundInterval = doc.Root.GetAttributeFloat("soundinterval", 10.0f);
|
||||||
@@ -164,6 +138,7 @@ namespace Barotrauma
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
hudProgressBars = new Dictionary<object, HUDProgressBar>();
|
hudProgressBars = new Dictionary<object, HUDProgressBar>();
|
||||||
}
|
}
|
||||||
@@ -760,20 +735,6 @@ namespace Barotrauma
|
|||||||
soundTimer = soundInterval;
|
soundTimer = soundInterval;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddActiveObjectiveEntity(Entity entity, Sprite sprite, Color? color = null)
|
|
||||||
{
|
|
||||||
if (activeObjectiveEntities.Any(aoe => aoe.Entity == entity)) return;
|
|
||||||
ObjectiveEntity objectiveEntity = new ObjectiveEntity(entity, sprite, color);
|
|
||||||
activeObjectiveEntities.Add(objectiveEntity);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void RemoveActiveObjectiveEntity(Entity entity)
|
|
||||||
{
|
|
||||||
ObjectiveEntity found = activeObjectiveEntities.Find(aoe => aoe.Entity == entity);
|
|
||||||
if (found == null) return;
|
|
||||||
activeObjectiveEntities.Remove(found);
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void ImplodeFX()
|
partial void ImplodeFX()
|
||||||
{
|
{
|
||||||
Vector2 centerOfMass = AnimController.GetCenterOfMass();
|
Vector2 centerOfMass = AnimController.GetCenterOfMass();
|
||||||
|
|||||||
@@ -85,8 +85,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (character.Inventory != null)
|
if (character.Inventory != null)
|
||||||
{
|
{
|
||||||
if (!character.LockHands && character.Stun < 0.1f &&
|
if (!character.LockHands && character.Stun < 0.1f)
|
||||||
(character.SelectedConstruction == null || character.SelectedConstruction.GetComponent<Controller>() == null))
|
|
||||||
{
|
{
|
||||||
character.Inventory.Update(deltaTime, cam);
|
character.Inventory.Update(deltaTime, cam);
|
||||||
}
|
}
|
||||||
@@ -169,12 +168,7 @@ namespace Barotrauma
|
|||||||
DrawOrderIndicator(spriteBatch, cam, character, character.CurrentOrder, 1.0f);
|
DrawOrderIndicator(spriteBatch, cam, character, character.CurrentOrder, 1.0f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Character.ObjectiveEntity objectiveEntity in character.ActiveObjectiveEntities)
|
|
||||||
{
|
|
||||||
DrawObjectiveIndicator(spriteBatch, cam, character, objectiveEntity, 1.0f);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (Item brokenItem in brokenItems)
|
foreach (Item brokenItem in brokenItems)
|
||||||
{
|
{
|
||||||
float dist = Vector2.Distance(character.WorldPosition, brokenItem.WorldPosition);
|
float dist = Vector2.Distance(character.WorldPosition, brokenItem.WorldPosition);
|
||||||
@@ -321,7 +315,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
if (character.Inventory != null && !character.LockHands)
|
if (character.Inventory != null && !character.LockHands)
|
||||||
{
|
{
|
||||||
character.Inventory.Locked = (character.SelectedConstruction != null && character.SelectedConstruction.GetComponent<Controller>() != null);
|
|
||||||
character.Inventory.DrawOwn(spriteBatch);
|
character.Inventory.DrawOwn(spriteBatch);
|
||||||
character.Inventory.CurrentLayout = CharacterHealth.OpenHealthWindow == null && character.SelectedCharacter == null ?
|
character.Inventory.CurrentLayout = CharacterHealth.OpenHealthWindow == null && character.SelectedCharacter == null ?
|
||||||
CharacterInventory.Layout.Default :
|
CharacterInventory.Layout.Default :
|
||||||
@@ -366,33 +359,17 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private static void DrawOrderIndicator(SpriteBatch spriteBatch, Camera cam, Character character, Order order, float iconAlpha = 1.0f)
|
private static void DrawOrderIndicator(SpriteBatch spriteBatch, Camera cam, Character character, Order order, float iconAlpha = 1.0f)
|
||||||
{
|
{
|
||||||
if (order.TargetAllCharacters && !order.HasAppropriateJob(character)) { return; }
|
if (order.TargetAllCharacters && !order.HasAppropriateJob(character)) return;
|
||||||
|
|
||||||
Entity target = order.ConnectedController != null ? order.ConnectedController.Item : order.TargetEntity;
|
Entity target = order.ConnectedController != null ? order.ConnectedController.Item : order.TargetEntity;
|
||||||
if (target == null) { return; }
|
if (target == null) return;
|
||||||
|
|
||||||
//don't show the indicator if far away and not inside the same sub
|
if (!orderIndicatorCount.ContainsKey(target)) orderIndicatorCount.Add(target, 0);
|
||||||
//prevents exploiting the indicators in locating the sub
|
|
||||||
if (character.Submarine != target.Submarine &&
|
|
||||||
Vector2.DistanceSquared(character.WorldPosition, target.WorldPosition) > 1000.0f * 1000.0f)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!orderIndicatorCount.ContainsKey(target)) { orderIndicatorCount.Add(target, 0); }
|
|
||||||
|
|
||||||
Vector2 drawPos = target.WorldPosition + Vector2.UnitX * order.SymbolSprite.size.X * 1.5f * orderIndicatorCount[target];
|
Vector2 drawPos = target.WorldPosition + Vector2.UnitX * order.SymbolSprite.size.X * 1.5f * orderIndicatorCount[target];
|
||||||
GUI.DrawIndicator(spriteBatch, drawPos, cam, 100.0f, order.SymbolSprite, order.Color * iconAlpha);
|
GUI.DrawIndicator(spriteBatch, drawPos, cam, 100.0f, order.SymbolSprite, order.Color * iconAlpha);
|
||||||
|
|
||||||
orderIndicatorCount[target] = orderIndicatorCount[target] + 1;
|
orderIndicatorCount[target] = orderIndicatorCount[target] + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void DrawObjectiveIndicator(SpriteBatch spriteBatch, Camera cam, Character character, Character.ObjectiveEntity objectiveEntity, float iconAlpha = 1.0f)
|
|
||||||
{
|
|
||||||
if (objectiveEntity == null) return;
|
|
||||||
|
|
||||||
Vector2 drawPos = objectiveEntity.Entity.WorldPosition;// + Vector2.UnitX * objectiveEntity.Sprite.size.X * 1.5f;
|
|
||||||
GUI.DrawIndicator(spriteBatch, drawPos, cam, 100.0f, objectiveEntity.Sprite, objectiveEntity.Color * iconAlpha);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -136,17 +136,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUIButton CPRButton
|
|
||||||
{
|
|
||||||
get { return cprButton; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public float HealthBarPulsateTimer
|
|
||||||
{
|
|
||||||
get { return healthBarPulsateTimer; }
|
|
||||||
set { healthBarPulsateTimer = MathHelper.Clamp(value, 0.0f, 10.0f); }
|
|
||||||
}
|
|
||||||
|
|
||||||
static CharacterHealth()
|
static CharacterHealth()
|
||||||
{
|
{
|
||||||
damageOverlay = new Sprite("Content/UI/damageOverlay.png", Vector2.Zero);
|
damageOverlay = new Sprite("Content/UI/damageOverlay.png", Vector2.Zero);
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ namespace Barotrauma
|
|||||||
if (text[i] == '\n')
|
if (text[i] == '\n')
|
||||||
{
|
{
|
||||||
currentLineX = 0.0f;
|
currentLineX = 0.0f;
|
||||||
retVal.Y += baseHeight * 1.8f;
|
retVal.Y += baseHeight * 18 / 10;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
uint charIndex = text[i];
|
uint charIndex = text[i];
|
||||||
|
|||||||
@@ -129,8 +129,6 @@ namespace Barotrauma
|
|||||||
get { return pauseMenuOpen; }
|
get { return pauseMenuOpen; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool PreventPauseMenuToggle = false;
|
|
||||||
|
|
||||||
public static Color ScreenOverlayColor
|
public static Color ScreenOverlayColor
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
@@ -1415,7 +1413,6 @@ namespace Barotrauma
|
|||||||
public static void TogglePauseMenu()
|
public static void TogglePauseMenu()
|
||||||
{
|
{
|
||||||
if (Screen.Selected == GameMain.MainMenuScreen) return;
|
if (Screen.Selected == GameMain.MainMenuScreen) return;
|
||||||
if (PreventPauseMenuToggle) return;
|
|
||||||
|
|
||||||
settingsMenuOpen = false;
|
settingsMenuOpen = false;
|
||||||
|
|
||||||
@@ -1549,9 +1546,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (GameMain.GameSession != null)
|
if (GameMain.GameSession != null)
|
||||||
{
|
{
|
||||||
if (Tutorial.Initialized)
|
if (ContextualTutorial.Initialized && GameMain.GameSession.GameMode is SinglePlayerCampaign)
|
||||||
{
|
{
|
||||||
((TutorialMode)GameMain.GameSession.GameMode).Tutorial.Stop();
|
((SinglePlayerCampaign)GameMain.GameSession.GameMode).ContextualTutorial.Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameSettings.SendUserStatistics)
|
if (GameSettings.SendUserStatistics)
|
||||||
|
|||||||
@@ -168,11 +168,6 @@ namespace Barotrauma
|
|||||||
if (frame != null) frame.ApplyStyle(style);
|
if (frame != null) frame.ApplyStyle(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Flash(Color? color = null, float flashDuration = 1.5f, bool useRectangleFlash = false, Vector2? flashRectInflate = null)
|
|
||||||
{
|
|
||||||
Frame.Flash(color, flashDuration, useRectangleFlash, flashRectInflate);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Draw(SpriteBatch spriteBatch)
|
protected override void Draw(SpriteBatch spriteBatch)
|
||||||
{
|
{
|
||||||
//do nothing
|
//do nothing
|
||||||
|
|||||||
@@ -121,22 +121,17 @@ namespace Barotrauma
|
|||||||
protected Color selectedColor;
|
protected Color selectedColor;
|
||||||
protected Color pressedColor;
|
protected Color pressedColor;
|
||||||
|
|
||||||
private CoroutineHandle pulsateCoroutine;
|
|
||||||
|
|
||||||
protected ComponentState state;
|
protected ComponentState state;
|
||||||
|
|
||||||
protected Color flashColor;
|
protected Color flashColor;
|
||||||
protected float flashDuration = 1.5f;
|
protected float flashDuration = 1.5f;
|
||||||
private bool useRectangleFlash;
|
|
||||||
public float FlashTimer
|
|
||||||
{
|
|
||||||
get { return flashTimer; }
|
|
||||||
}
|
|
||||||
protected float flashTimer;
|
protected float flashTimer;
|
||||||
private Vector2 flashRectInflate;
|
private Vector2 flashRectInflate;
|
||||||
|
|
||||||
public bool IgnoreLayoutGroups;
|
public bool IgnoreLayoutGroups;
|
||||||
|
|
||||||
|
public bool IgnoreLayoutGroups;
|
||||||
|
|
||||||
public virtual ScalableFont Font
|
public virtual ScalableFont Font
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
@@ -269,8 +264,6 @@ namespace Barotrauma
|
|||||||
set { pressedColor = value; }
|
set { pressedColor = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ExternalHighlight = false;
|
|
||||||
|
|
||||||
private RectTransform rectTransform;
|
private RectTransform rectTransform;
|
||||||
public RectTransform RectTransform
|
public RectTransform RectTransform
|
||||||
{
|
{
|
||||||
@@ -445,21 +438,11 @@ namespace Barotrauma
|
|||||||
int flashCycleCount = (int)Math.Max(flashDuration, 1);
|
int flashCycleCount = (int)Math.Max(flashDuration, 1);
|
||||||
float flashCycleDuration = flashDuration / flashCycleCount;
|
float flashCycleDuration = flashDuration / flashCycleCount;
|
||||||
|
|
||||||
Rectangle flashRect = Rect;
|
|
||||||
flashRect.Inflate(flashRectInflate.X, flashRectInflate.Y);
|
|
||||||
|
|
||||||
//MathHelper.Pi * 0.8f -> the curve goes from 144 deg to 0,
|
//MathHelper.Pi * 0.8f -> the curve goes from 144 deg to 0,
|
||||||
//i.e. quickly bumps up from almost full brightness to full and then fades out
|
//i.e. quickly bumps up from almost full brightness to full and then fades out
|
||||||
if (!useRectangleFlash)
|
GUI.UIGlow.Draw(spriteBatch,
|
||||||
{
|
rect,
|
||||||
GUI.UIGlow.Draw(spriteBatch,
|
flashColor * (float)Math.Sin(flashTimer % flashCycleDuration / flashCycleDuration * MathHelper.Pi * 0.8f));
|
||||||
flashRect,
|
|
||||||
flashColor * (float)Math.Sin(flashTimer % flashCycleDuration / flashCycleDuration * MathHelper.Pi * 0.8f));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GUI.DrawRectangle(spriteBatch, flashRect, flashColor * (float)Math.Sin(flashTimer % flashCycleDuration / flashCycleDuration * MathHelper.Pi * 0.8f), true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -507,11 +490,9 @@ namespace Barotrauma
|
|||||||
color = new Color(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, a);
|
color = new Color(color.R / 255.0f, color.G / 255.0f, color.B / 255.0f, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Flash(Color? color = null, float flashDuration = 1.5f, bool useRectangleFlash = false, Vector2? flashRectInflate = null)
|
public virtual void Flash(Color? color = null, float flashDuration = 1.5f)
|
||||||
{
|
{
|
||||||
flashTimer = flashDuration;
|
flashTimer = flashDuration;
|
||||||
this.flashRectInflate = flashRectInflate ?? Vector2.Zero;
|
|
||||||
this.useRectangleFlash = useRectangleFlash;
|
|
||||||
this.flashDuration = flashDuration;
|
this.flashDuration = flashDuration;
|
||||||
flashColor = (color == null) ? Color.Red : (Color)color;
|
flashColor = (color == null) ? Color.Red : (Color)color;
|
||||||
}
|
}
|
||||||
@@ -529,7 +510,9 @@ namespace Barotrauma
|
|||||||
while (t < duration)
|
while (t < duration)
|
||||||
{
|
{
|
||||||
t += CoroutineManager.DeltaTime;
|
t += CoroutineManager.DeltaTime;
|
||||||
|
|
||||||
SetAlpha(MathHelper.Lerp(startA, to, t / duration));
|
SetAlpha(MathHelper.Lerp(startA, to, t / duration));
|
||||||
|
|
||||||
yield return CoroutineStatus.Running;
|
yield return CoroutineStatus.Running;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -542,30 +525,9 @@ namespace Barotrauma
|
|||||||
|
|
||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
}
|
}
|
||||||
|
#endregion
|
||||||
|
|
||||||
public void Pulsate(Vector2 startScale, Vector2 endScale, float duration)
|
protected virtual void SetAlpha(float a)
|
||||||
{
|
|
||||||
if (CoroutineManager.IsCoroutineRunning(pulsateCoroutine))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pulsateCoroutine = CoroutineManager.StartCoroutine(DoPulsate(startScale, endScale, duration), "Pulsate" + ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<object> DoPulsate(Vector2 startScale, Vector2 endScale, float duration)
|
|
||||||
{
|
|
||||||
float t = 0.0f;
|
|
||||||
while (t < duration)
|
|
||||||
{
|
|
||||||
t += CoroutineManager.DeltaTime;
|
|
||||||
RectTransform.LocalScale = Vector2.Lerp(startScale, endScale, (float)Math.Sin(t / duration * MathHelper.Pi));
|
|
||||||
yield return CoroutineStatus.Running;
|
|
||||||
}
|
|
||||||
RectTransform.LocalScale = startScale;
|
|
||||||
yield return CoroutineStatus.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void ApplyStyle(GUIComponentStyle style)
|
|
||||||
{
|
{
|
||||||
if (style == null) return;
|
if (style == null) return;
|
||||||
|
|
||||||
@@ -578,7 +540,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
OutlineColor = style.OutlineColor;
|
OutlineColor = style.OutlineColor;
|
||||||
|
|
||||||
this.style = style;
|
public virtual void Flash(Color? color = null, float flashDuration = 1.5f, bool useRectangleFlash = false, Vector2? flashRectInflate = null)
|
||||||
|
{
|
||||||
|
flashTimer = flashDuration;
|
||||||
|
this.flashRectInflate = flashRectInflate ?? Vector2.Zero;
|
||||||
|
this.useRectangleFlash = useRectangleFlash;
|
||||||
|
this.flashDuration = flashDuration;
|
||||||
|
flashColor = (color == null) ? Color.Red : (Color)color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,22 +41,33 @@ namespace Barotrauma
|
|||||||
InnerFrame = new GUIFrame(new RectTransform(new Point(width, height), RectTransform, Anchor.Center) { IsFixedSize = false }, style: null);
|
InnerFrame = new GUIFrame(new RectTransform(new Point(width, height), RectTransform, Anchor.Center) { IsFixedSize = false }, style: null);
|
||||||
GUI.Style.Apply(InnerFrame, "", this);
|
GUI.Style.Apply(InnerFrame, "", this);
|
||||||
|
|
||||||
|
InnerFrame = new GUIFrame(new RectTransform(new Point(width, height), RectTransform, Anchor.Center) { IsFixedSize = false }, style: null);
|
||||||
|
GUI.Style.Apply(InnerFrame, "", this);
|
||||||
|
|
||||||
Content = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.85f), InnerFrame.RectTransform, Anchor.Center)) { AbsoluteSpacing = 5 };
|
Content = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.85f), InnerFrame.RectTransform, Anchor.Center)) { AbsoluteSpacing = 5 };
|
||||||
Tag = tag;
|
Tag = tag;
|
||||||
|
|
||||||
|
if (height == 0)
|
||||||
|
{
|
||||||
|
string wrappedText = ToolBox.WrapText(text, Content.Rect.Width, GUI.Font);
|
||||||
|
string[] lines = wrappedText.Split('\n');
|
||||||
|
foreach (string line in lines)
|
||||||
|
{
|
||||||
|
height += (int)GUI.Font.MeasureString(line).Y;
|
||||||
|
}
|
||||||
|
height += string.IsNullOrWhiteSpace(headerText) ? 220 : 220 - headerHeight;
|
||||||
|
}
|
||||||
|
InnerFrame.RectTransform.NonScaledSize = new Point(InnerFrame.Rect.Width, height);
|
||||||
|
|
||||||
Header = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), Content.RectTransform),
|
Header = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), Content.RectTransform),
|
||||||
headerText, textAlignment: Alignment.Center, wrap: true);
|
headerText, textAlignment: Alignment.Center, wrap: true);
|
||||||
GUI.Style.Apply(Header, "", this);
|
GUI.Style.Apply(Header, "", this);
|
||||||
Header.RectTransform.MinSize = new Point(0, Header.Rect.Height);
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(text))
|
if (height == 0)
|
||||||
{
|
{
|
||||||
Text = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), Content.RectTransform),
|
Text = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), Content.RectTransform),
|
||||||
text, textAlignment: textAlignment, wrap: true);
|
text, textAlignment: textAlignment, wrap: true);
|
||||||
GUI.Style.Apply(Text, "", this);
|
GUI.Style.Apply(Text, "", this);
|
||||||
Text.RectTransform.NonScaledSize = Text.RectTransform.MinSize = Text.RectTransform.MaxSize =
|
|
||||||
new Point(Text.Rect.Width, Text.Rect.Height);
|
|
||||||
Text.RectTransform.IsFixedSize = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.15f), Content.RectTransform, Anchor.BottomCenter, maxSize: new Point(1000, 50)),
|
var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.15f), Content.RectTransform, Anchor.BottomCenter, maxSize: new Point(1000, 50)),
|
||||||
@@ -65,22 +76,7 @@ namespace Barotrauma
|
|||||||
AbsoluteSpacing = 5,
|
AbsoluteSpacing = 5,
|
||||||
IgnoreLayoutGroups = true
|
IgnoreLayoutGroups = true
|
||||||
};
|
};
|
||||||
buttonContainer.RectTransform.NonScaledSize = buttonContainer.RectTransform.MinSize = buttonContainer.RectTransform.MaxSize =
|
|
||||||
new Point(buttonContainer.Rect.Width, (int)(30 * GUI.Scale));
|
|
||||||
buttonContainer.RectTransform.IsFixedSize = true;
|
|
||||||
|
|
||||||
if (height == 0)
|
|
||||||
{
|
|
||||||
height += Header.Rect.Height + Content.AbsoluteSpacing;
|
|
||||||
height += (Text == null ? 0 : Text.Rect.Height) + Content.AbsoluteSpacing;
|
|
||||||
height += buttonContainer.Rect.Height;
|
|
||||||
|
|
||||||
InnerFrame.RectTransform.NonScaledSize =
|
|
||||||
new Point(InnerFrame.Rect.Width, (int)Math.Max(height / Content.RectTransform.RelativeSize.Y, height + 50));
|
|
||||||
Content.RectTransform.NonScaledSize =
|
|
||||||
new Point(Content.Rect.Width, height);
|
|
||||||
}
|
|
||||||
|
|
||||||
Buttons = new List<GUIButton>(buttons.Length);
|
Buttons = new List<GUIButton>(buttons.Length);
|
||||||
for (int i = 0; i < buttons.Length; i++)
|
for (int i = 0; i < buttons.Length; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
|
|
||||||
namespace Barotrauma
|
namespace Barotrauma
|
||||||
{
|
{
|
||||||
@@ -249,7 +247,7 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
textPos = new Vector2(padding.X + (rect.Width - padding.Z - padding.X) / 2.0f, padding.Y + (rect.Height - padding.Y - padding.W) / 2.0f);
|
textPos = new Vector2(rect.Width / 2.0f, rect.Height / 2.0f);
|
||||||
origin = TextSize * 0.5f;
|
origin = TextSize * 0.5f;
|
||||||
|
|
||||||
if (textAlignment.HasFlag(Alignment.Left) && !overflowClipActive)
|
if (textAlignment.HasFlag(Alignment.Left) && !overflowClipActive)
|
||||||
|
|||||||
@@ -365,9 +365,9 @@ namespace Barotrauma
|
|||||||
OnDeselected?.Invoke(this, Keys.None);
|
OnDeselected?.Invoke(this, Keys.None);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Flash(Color? color = null, float flashDuration = 1.5f, bool useRectangleFlash = false, Vector2? flashRectOffset = null)
|
public override void Flash(Color? color = null, float flashDuration = 1.5f)
|
||||||
{
|
{
|
||||||
textBlock.Flash(color, flashDuration, useRectangleFlash, flashRectOffset);
|
textBlock.Flash(color, flashDuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Update(float deltaTime)
|
protected override void Update(float deltaTime)
|
||||||
|
|||||||
@@ -44,11 +44,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public Color TextColor
|
public Color TextColor
|
||||||
{
|
{
|
||||||
get { return text.TextColor; }
|
get { return box; }
|
||||||
set { text.TextColor = value; }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Rectangle MouseRect
|
public GUITextBlock TextBlock
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
@@ -57,17 +56,14 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override ScalableFont Font
|
public override string ToolTip
|
||||||
{
|
{
|
||||||
get
|
get { return base.ToolTip; }
|
||||||
{
|
|
||||||
return base.Font;
|
|
||||||
}
|
|
||||||
|
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
base.Font = value;
|
base.ToolTip = value;
|
||||||
if (text != null) text.Font = value;
|
box.ToolTip = value;
|
||||||
|
text.ToolTip = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,11 +72,6 @@ namespace Barotrauma
|
|||||||
get { return box; }
|
get { return box; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public GUITextBlock TextBlock
|
|
||||||
{
|
|
||||||
get { return text; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override string ToolTip
|
public override string ToolTip
|
||||||
{
|
{
|
||||||
get { return base.ToolTip; }
|
get { return base.ToolTip; }
|
||||||
@@ -128,7 +119,6 @@ namespace Barotrauma
|
|||||||
private void ResizeBox()
|
private void ResizeBox()
|
||||||
{
|
{
|
||||||
box.RectTransform.NonScaledSize = new Point(RectTransform.NonScaledSize.Y);
|
box.RectTransform.NonScaledSize = new Point(RectTransform.NonScaledSize.Y);
|
||||||
text.RectTransform.NonScaledSize = new Point(Rect.Width - box.Rect.Width, text.Rect.Height);
|
|
||||||
text.RectTransform.AbsoluteOffset = new Point(box.Rect.Width, 0);
|
text.RectTransform.AbsoluteOffset = new Point(box.Rect.Width, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,9 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
class VideoPlayer
|
class VideoPlayer
|
||||||
{
|
{
|
||||||
public bool IsPlaying;
|
|
||||||
|
|
||||||
private Video currentVideo;
|
private Video currentVideo;
|
||||||
private string filePath;
|
private string filePath;
|
||||||
|
private bool isPlaying;
|
||||||
|
|
||||||
private GUIFrame background, videoFrame, textFrame;
|
private GUIFrame background, videoFrame, textFrame;
|
||||||
private GUITextBlock title, textContent, objectiveTitle, objectiveText;
|
private GUITextBlock title, textContent, objectiveTitle, objectiveText;
|
||||||
@@ -25,14 +24,12 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private Point scaledVideoResolution;
|
private Point scaledVideoResolution;
|
||||||
private readonly int borderSize = 20;
|
private readonly int borderSize = 20;
|
||||||
private readonly Point buttonSize = new Point(120, 30);
|
private readonly Point buttonSize = new Point(160, 50);
|
||||||
private readonly int titleHeight = 30;
|
private readonly int titleHeight = 30;
|
||||||
private readonly int objectiveFrameHeight = 60;
|
private readonly int objectiveFrameHeight = 60;
|
||||||
private readonly int textHeight = 25;
|
private readonly int textHeight = 25;
|
||||||
|
|
||||||
private bool useTextOnRightSide = false;
|
public struct TextSettings
|
||||||
|
|
||||||
public class TextSettings
|
|
||||||
{
|
{
|
||||||
public string Text;
|
public string Text;
|
||||||
public int Width;
|
public int Width;
|
||||||
@@ -44,7 +41,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class VideoSettings
|
public struct VideoSettings
|
||||||
{
|
{
|
||||||
public string File;
|
public string File;
|
||||||
|
|
||||||
@@ -65,14 +62,7 @@ namespace Barotrauma
|
|||||||
background = new GUIFrame(new RectTransform(Point.Zero, GUI.Canvas, Anchor.Center), "InnerFrame", backgroundColor);
|
background = new GUIFrame(new RectTransform(Point.Zero, GUI.Canvas, Anchor.Center), "InnerFrame", backgroundColor);
|
||||||
videoFrame = new GUIFrame(new RectTransform(Point.Zero, background.RectTransform, Anchor.Center, Pivot.Center), "SonarFrame");
|
videoFrame = new GUIFrame(new RectTransform(Point.Zero, background.RectTransform, Anchor.Center, Pivot.Center), "SonarFrame");
|
||||||
|
|
||||||
if (useTextOnRightSide)
|
textFrame = new GUIFrame(new RectTransform(Point.Zero, videoFrame.RectTransform, Anchor.CenterLeft, Pivot.CenterLeft), "TextFrame");
|
||||||
{
|
|
||||||
textFrame = new GUIFrame(new RectTransform(Point.Zero, videoFrame.RectTransform, Anchor.CenterLeft, Pivot.CenterLeft), "TextFrame");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
textFrame = new GUIFrame(new RectTransform(Point.Zero, videoFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), "TextFrame");
|
|
||||||
}
|
|
||||||
|
|
||||||
videoView = new GUICustomComponent(new RectTransform(Point.Zero, videoFrame.RectTransform, Anchor.Center), (spriteBatch, guiCustomComponent) => { DrawVideo(spriteBatch, guiCustomComponent.Rect); });
|
videoView = new GUICustomComponent(new RectTransform(Point.Zero, videoFrame.RectTransform, Anchor.Center), (spriteBatch, guiCustomComponent) => { DrawVideo(spriteBatch, guiCustomComponent.Rect); });
|
||||||
title = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopLeft, Pivot.TopLeft), string.Empty, font: GUI.VideoTitleFont, textColor: new Color(253, 174, 0), textAlignment: Alignment.Left);
|
title = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopLeft, Pivot.TopLeft), string.Empty, font: GUI.VideoTitleFont, textColor: new Color(253, 174, 0), textAlignment: Alignment.Left);
|
||||||
@@ -80,7 +70,7 @@ namespace Barotrauma
|
|||||||
textContent = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopLeft, Pivot.TopLeft), string.Empty, font: GUI.Font, textAlignment: Alignment.TopLeft);
|
textContent = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopLeft, Pivot.TopLeft), string.Empty, font: GUI.Font, textAlignment: Alignment.TopLeft);
|
||||||
|
|
||||||
objectiveTitle = new GUITextBlock(new RectTransform(new Vector2(1f, 0f), textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), string.Empty, font: GUI.ObjectiveTitleFont, textAlignment: Alignment.CenterRight, textColor: Color.White);
|
objectiveTitle = new GUITextBlock(new RectTransform(new Vector2(1f, 0f), textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), string.Empty, font: GUI.ObjectiveTitleFont, textAlignment: Alignment.CenterRight, textColor: Color.White);
|
||||||
objectiveTitle.Text = TextManager.Get("Tutorial.NewObjective");
|
objectiveTitle.Text = TextManager.Get("NewObjective");
|
||||||
objectiveText = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), string.Empty, font: GUI.ObjectiveNameFont, textColor: new Color(4, 180, 108), textAlignment: Alignment.CenterRight);
|
objectiveText = new GUITextBlock(new RectTransform(Point.Zero, textFrame.RectTransform, Anchor.TopCenter, Pivot.TopCenter), string.Empty, font: GUI.ObjectiveNameFont, textColor: new Color(4, 180, 108), textAlignment: Alignment.CenterRight);
|
||||||
|
|
||||||
objectiveTitle.Visible = objectiveText.Visible = false;
|
objectiveTitle.Visible = objectiveText.Visible = false;
|
||||||
@@ -88,12 +78,12 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void Play()
|
public void Play()
|
||||||
{
|
{
|
||||||
IsPlaying = true;
|
isPlaying = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
IsPlaying = false;
|
isPlaying = false;
|
||||||
if (currentVideo == null) return;
|
if (currentVideo == null) return;
|
||||||
currentVideo.Dispose();
|
currentVideo.Dispose();
|
||||||
currentVideo = null;
|
currentVideo = null;
|
||||||
@@ -109,6 +99,13 @@ namespace Barotrauma
|
|||||||
public void Update()
|
public void Update()
|
||||||
{
|
{
|
||||||
if (currentVideo == null) return;
|
if (currentVideo == null) return;
|
||||||
|
|
||||||
|
if (PlayerInput.KeyHit(Keys.Enter) || PlayerInput.KeyHit(Keys.Escape))
|
||||||
|
{
|
||||||
|
DisposeVideo(null, null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (currentVideo.IsPlaying) return;
|
if (currentVideo.IsPlaying) return;
|
||||||
|
|
||||||
currentVideo.Dispose();
|
currentVideo.Dispose();
|
||||||
@@ -118,7 +115,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void AddToGUIUpdateList(bool ignoreChildren = false, int order = 0)
|
public void AddToGUIUpdateList(bool ignoreChildren = false, int order = 0)
|
||||||
{
|
{
|
||||||
if (!IsPlaying) return;
|
if (!isPlaying) return;
|
||||||
background.AddToGUIUpdateList(ignoreChildren, order);
|
background.AddToGUIUpdateList(ignoreChildren, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -142,7 +139,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
currentVideo = CreateVideo(scaledVideoResolution);
|
currentVideo = CreateVideo(scaledVideoResolution);
|
||||||
title.Text = TextManager.Get(contentId);
|
title.Text = TextManager.Get(contentId);
|
||||||
textContent.Text = textSettings != null ? textSettings.Text : string.Empty;
|
textContent.Text = textSettings.Text;
|
||||||
objectiveText.Text = objective;
|
objectiveText.Text = objective;
|
||||||
|
|
||||||
AdjustFrames(videoSettings, textSettings);
|
AdjustFrames(videoSettings, textSettings);
|
||||||
@@ -168,8 +165,7 @@ namespace Barotrauma
|
|||||||
title.TextScale = textContent.TextScale = objectiveText.TextScale = objectiveTitle.TextScale = GUI.Scale;
|
title.TextScale = textContent.TextScale = objectiveText.TextScale = objectiveTitle.TextScale = GUI.Scale;
|
||||||
|
|
||||||
int scaledBorderSize = (int)(borderSize * GUI.Scale);
|
int scaledBorderSize = (int)(borderSize * GUI.Scale);
|
||||||
int scaledTextWidth = 0;
|
int scaledTextWidth = (int)(textSettings.Width * GUI.Scale);
|
||||||
if (textSettings != null) scaledTextWidth = useTextOnRightSide ? (int)(textSettings.Width * GUI.Scale) : scaledVideoResolution.X / 2;
|
|
||||||
int scaledTitleHeight = (int)(titleHeight * GUI.Scale);
|
int scaledTitleHeight = (int)(titleHeight * GUI.Scale);
|
||||||
int scaledTextHeight = (int)(textHeight * GUI.Scale);
|
int scaledTextHeight = (int)(textHeight * GUI.Scale);
|
||||||
int scaledObjectiveFrameHeight = (int)(objectiveFrameHeight * GUI.Scale);
|
int scaledObjectiveFrameHeight = (int)(objectiveFrameHeight * GUI.Scale);
|
||||||
@@ -184,21 +180,13 @@ namespace Barotrauma
|
|||||||
title.RectTransform.NonScaledSize += new Point(scaledTextWidth, scaledTitleHeight);
|
title.RectTransform.NonScaledSize += new Point(scaledTextWidth, scaledTitleHeight);
|
||||||
title.RectTransform.AbsoluteOffset = new Point((int)(5 * GUI.Scale), (int)(10 * GUI.Scale));
|
title.RectTransform.AbsoluteOffset = new Point((int)(5 * GUI.Scale), (int)(10 * GUI.Scale));
|
||||||
|
|
||||||
if (textSettings != null && !string.IsNullOrEmpty(textSettings.Text))
|
if (!string.IsNullOrEmpty(textSettings.Text))
|
||||||
{
|
{
|
||||||
textSettings.Text = ToolBox.WrapText(textSettings.Text, scaledTextWidth, GUI.Font);
|
textSettings.Text = ToolBox.WrapText(textSettings.Text, scaledTextWidth, GUI.Font);
|
||||||
int wrappedHeight = textSettings.Text.Split('\n').Length * scaledTextHeight;
|
int wrappedHeight = textSettings.Text.Split('\n').Length * scaledTextHeight;
|
||||||
|
|
||||||
textFrame.RectTransform.NonScaledSize += new Point(scaledTextWidth + scaledBorderSize, wrappedHeight + scaledBorderSize + scaledButtonSize.Y + scaledTitleHeight);
|
textFrame.RectTransform.NonScaledSize += new Point(scaledTextWidth + scaledBorderSize, wrappedHeight + scaledBorderSize + scaledButtonSize.Y + scaledTitleHeight);
|
||||||
|
textFrame.RectTransform.AbsoluteOffset = new Point(scaledVideoResolution.X + scaledBorderSize * 2, 0);
|
||||||
if (useTextOnRightSide)
|
|
||||||
{
|
|
||||||
textFrame.RectTransform.AbsoluteOffset = new Point(scaledVideoResolution.X + scaledBorderSize * 2, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
textFrame.RectTransform.AbsoluteOffset = new Point(0, scaledVideoResolution.Y + scaledBorderSize * 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
textContent.RectTransform.NonScaledSize += new Point(scaledTextWidth, wrappedHeight);
|
textContent.RectTransform.NonScaledSize += new Point(scaledTextWidth, wrappedHeight);
|
||||||
textContent.RectTransform.AbsoluteOffset = new Point(0, scaledBorderSize + scaledTitleHeight);
|
textContent.RectTransform.AbsoluteOffset = new Point(0, scaledBorderSize + scaledTitleHeight);
|
||||||
@@ -221,41 +209,22 @@ namespace Barotrauma
|
|||||||
objectiveTitle.Visible = objectiveText.Visible = false;
|
objectiveTitle.Visible = objectiveText.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int totalFrameWidth = videoFrame.Rect.Width + textFrame.Rect.Width + scaledBorderSize * 2;
|
||||||
|
int xOffset = videoFrame.Rect.Width / 2 + scaledBorderSize - (videoFrame.Rect.Width / 2 - textFrame.Rect.Width / 2);
|
||||||
|
|
||||||
|
|
||||||
|
videoFrame.RectTransform.AbsoluteOffset = new Point(-xOffset, (int)(50 * GUI.Scale));
|
||||||
|
|
||||||
if (okButton != null)
|
if (okButton != null)
|
||||||
{
|
{
|
||||||
textFrame.RemoveChild(okButton);
|
textFrame.RemoveChild(okButton);
|
||||||
okButton = null;
|
okButton = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (textSettings != null)
|
okButton = new GUIButton(new RectTransform(scaledButtonSize, textFrame.RectTransform, Anchor.BottomRight, Pivot.BottomRight) { AbsoluteOffset = new Point(scaledBorderSize, scaledBorderSize) }, TextManager.Get("OK"))
|
||||||
{
|
{
|
||||||
if (useTextOnRightSide)
|
OnClicked = DisposeVideo
|
||||||
{
|
};
|
||||||
int totalFrameWidth = videoFrame.Rect.Width + textFrame.Rect.Width + scaledBorderSize * 2;
|
|
||||||
int xOffset = videoFrame.Rect.Width / 2 + scaledBorderSize - (videoFrame.Rect.Width / 2 - textFrame.Rect.Width / 2);
|
|
||||||
videoFrame.RectTransform.AbsoluteOffset = new Point(-xOffset, (int)(50 * GUI.Scale));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int totalFrameHeight = videoFrame.Rect.Height + textFrame.Rect.Height + scaledBorderSize * 2;
|
|
||||||
int yOffset = videoFrame.Rect.Height / 2 + scaledBorderSize - (videoFrame.Rect.Height / 2 - textFrame.Rect.Height / 2);
|
|
||||||
videoFrame.RectTransform.AbsoluteOffset = new Point(0, -yOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
okButton = new GUIButton(new RectTransform(scaledButtonSize, textFrame.RectTransform, Anchor.BottomRight, Pivot.BottomRight) { AbsoluteOffset = new Point(scaledBorderSize, scaledBorderSize) }, TextManager.Get("OK"))
|
|
||||||
{
|
|
||||||
OnClicked = DisposeVideo
|
|
||||||
};
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
videoFrame.RectTransform.AbsoluteOffset = new Point(0, (int)(100 * GUI.Scale));
|
|
||||||
|
|
||||||
okButton = new GUIButton(new RectTransform(scaledButtonSize, videoFrame.RectTransform, Anchor.TopLeft, Pivot.TopLeft) { AbsoluteOffset = new Point(scaledBorderSize, scaledBorderSize) }, TextManager.Get("Back"))
|
|
||||||
{
|
|
||||||
OnClicked = DisposeVideo
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Video CreateVideo(Point resolution)
|
private Video CreateVideo(Point resolution)
|
||||||
@@ -276,7 +245,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private void DrawVideo(SpriteBatch spriteBatch, Rectangle rect)
|
private void DrawVideo(SpriteBatch spriteBatch, Rectangle rect)
|
||||||
{
|
{
|
||||||
if (!IsPlaying) return;
|
if (!isPlaying) return;
|
||||||
spriteBatch.Draw(currentVideo.GetTexture(), rect, Color.White);
|
spriteBatch.Draw(currentVideo.GetTexture(), rect, Color.White);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -178,6 +178,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
GUI.KeyboardDispatcher = new EventInput.KeyboardDispatcher(Window);
|
GUI.KeyboardDispatcher = new EventInput.KeyboardDispatcher(Window);
|
||||||
|
|
||||||
|
GUI.KeyboardDispatcher = new EventInput.KeyboardDispatcher(Window);
|
||||||
|
|
||||||
|
|
||||||
|
PerformanceCounter = new PerformanceCounter();
|
||||||
|
|
||||||
PerformanceCounter = new PerformanceCounter();
|
PerformanceCounter = new PerformanceCounter();
|
||||||
|
|
||||||
@@ -521,20 +525,11 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the file paths of all files of the given type in the content packages.
|
/// Returns the file paths of all files of the given type in the currently selected content packages.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
public IEnumerable<string> GetFilesOfType(ContentType type)
|
||||||
/// <param name="searchAllContentPackages">If true, also returns files in content packages that are installed but not currently selected.</param>
|
|
||||||
public IEnumerable<string> GetFilesOfType(ContentType type, bool searchAllContentPackages = false)
|
|
||||||
{
|
{
|
||||||
if (searchAllContentPackages)
|
return ContentPackage.GetFilesOfType(SelectedPackages, type);
|
||||||
{
|
|
||||||
return ContentPackage.GetFilesOfType(ContentPackage.List, type);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ContentPackage.GetFilesOfType(SelectedPackages, type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -627,12 +622,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
((GUIMessageBox)GUIMessageBox.VisibleBox).Close();
|
((GUIMessageBox)GUIMessageBox.VisibleBox).Close();
|
||||||
}
|
}
|
||||||
else if (Tutorial.Initialized && Tutorial.ContentRunning)
|
|
||||||
{
|
|
||||||
(GameMain.GameSession.GameMode as TutorialMode).Tutorial.CloseActiveContentGUI();
|
|
||||||
}
|
|
||||||
else if ((Character.Controlled?.SelectedConstruction == null || !Character.Controlled.SelectedConstruction.ActiveHUDs.Any(ic => ic.GuiFrame != null))
|
else if ((Character.Controlled?.SelectedConstruction == null || !Character.Controlled.SelectedConstruction.ActiveHUDs.Any(ic => ic.GuiFrame != null))
|
||||||
&& Inventory.SelectedSlot == null && CharacterHealth.OpenHealthWindow == null)
|
&& Inventory.SelectedSlot == null && CharacterHealth.OpenHealthWindow == null)
|
||||||
{
|
{
|
||||||
// Otherwise toggle pausing, unless another window/interface is open.
|
// Otherwise toggle pausing, unless another window/interface is open.
|
||||||
GUI.TogglePauseMenu();
|
GUI.TogglePauseMenu();
|
||||||
@@ -640,7 +631,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
GUI.ClearUpdateList();
|
GUI.ClearUpdateList();
|
||||||
paused = (DebugConsole.IsOpen || GUI.PauseMenuOpen || GUI.SettingsMenuOpen || Tutorial.ContentRunning) &&
|
paused = (DebugConsole.IsOpen || GUI.PauseMenuOpen || GUI.SettingsMenuOpen || ContextualTutorial.ContentRunning) &&
|
||||||
(NetworkMember == null || !NetworkMember.GameStarted);
|
(NetworkMember == null || !NetworkMember.GameStarted);
|
||||||
|
|
||||||
Screen.Selected.AddToGUIUpdateList();
|
Screen.Selected.AddToGUIUpdateList();
|
||||||
@@ -659,9 +650,9 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Screen.Selected.Update(Timing.Step);
|
Screen.Selected.Update(Timing.Step);
|
||||||
}
|
}
|
||||||
else if (Tutorial.Initialized && Tutorial.ContentRunning)
|
else if (ContextualTutorial.Initialized && ContextualTutorial.ContentRunning && GameSession.GameMode is SinglePlayerCampaign)
|
||||||
{
|
{
|
||||||
(GameSession.GameMode as TutorialMode).Update((float)Timing.Step);
|
(GameSession.GameMode as SinglePlayerCampaign).ContextualTutorial.Update((float)Timing.Step);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NetworkMember != null)
|
if (NetworkMember != null)
|
||||||
@@ -726,7 +717,7 @@ namespace Barotrauma
|
|||||||
PerformanceCounter.DrawTimeGraph.Update(sw.ElapsedTicks / (float)TimeSpan.TicksPerMillisecond);
|
PerformanceCounter.DrawTimeGraph.Update(sw.ElapsedTicks / (float)TimeSpan.TicksPerMillisecond);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowCampaignDisclaimer(Action onContinue)
|
public void ShowCampaignDisclaimer()
|
||||||
{
|
{
|
||||||
var msgBox = new GUIMessageBox(TextManager.Get("CampaignDisclaimerTitle"), TextManager.Get("CampaignDisclaimerText"),
|
var msgBox = new GUIMessageBox(TextManager.Get("CampaignDisclaimerTitle"), TextManager.Get("CampaignDisclaimerText"),
|
||||||
new string[] { TextManager.Get("CampaignRoadMapTitle"), TextManager.Get("OK") });
|
new string[] { TextManager.Get("CampaignRoadMapTitle"), TextManager.Get("OK") });
|
||||||
@@ -735,15 +726,13 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
var roadMap = new GUIMessageBox(TextManager.Get("CampaignRoadMapTitle"), TextManager.Get("CampaignRoadMapText"),
|
var roadMap = new GUIMessageBox(TextManager.Get("CampaignRoadMapTitle"), TextManager.Get("CampaignRoadMapText"),
|
||||||
new string[] { TextManager.Get("Back"), TextManager.Get("OK") });
|
new string[] { TextManager.Get("Back"), TextManager.Get("OK") });
|
||||||
|
roadMap.Buttons[0].OnClicked = (_, __) => { ShowCampaignDisclaimer(); return true; };
|
||||||
roadMap.Buttons[0].OnClicked += roadMap.Close;
|
roadMap.Buttons[0].OnClicked += roadMap.Close;
|
||||||
roadMap.Buttons[0].OnClicked += (_, __) => { ShowCampaignDisclaimer(onContinue); return true; };
|
|
||||||
roadMap.Buttons[1].OnClicked += roadMap.Close;
|
roadMap.Buttons[1].OnClicked += roadMap.Close;
|
||||||
roadMap.Buttons[1].OnClicked += (_, __) => { onContinue?.Invoke(); return true; };
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
||||||
msgBox.Buttons[1].OnClicked += msgBox.Close;
|
msgBox.Buttons[1].OnClicked += msgBox.Close;
|
||||||
msgBox.Buttons[1].OnClicked += (_, __) => { onContinue?.Invoke(); return true; };
|
|
||||||
|
|
||||||
Config.CampaignDisclaimerShown = true;
|
Config.CampaignDisclaimerShown = true;
|
||||||
Config.SaveNewPlayerConfig();
|
Config.SaveNewPlayerConfig();
|
||||||
@@ -753,13 +742,12 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
var msgBox = new GUIMessageBox(TextManager.Get("EditorDisclaimerTitle"), TextManager.Get("EditorDisclaimerText"));
|
var msgBox = new GUIMessageBox(TextManager.Get("EditorDisclaimerTitle"), TextManager.Get("EditorDisclaimerText"));
|
||||||
var linkHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.25f), msgBox.Content.RectTransform)) { Stretch = true, RelativeSpacing = 0.025f };
|
var linkHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.25f), msgBox.Content.RectTransform)) { Stretch = true, RelativeSpacing = 0.025f };
|
||||||
linkHolder.RectTransform.MaxSize = new Point(int.MaxValue, linkHolder.Rect.Height);
|
|
||||||
List<Pair<string, string>> links = new List<Pair<string, string>>()
|
List<Pair<string, string>> links = new List<Pair<string, string>>()
|
||||||
{
|
{
|
||||||
new Pair<string, string>(TextManager.Get("EditorDisclaimerWikiLink"),TextManager.Get("EditorDisclaimerWikiUrl")),
|
new Pair<string, string>(TextManager.Get("EditorDisclaimerWikiLink"),TextManager.Get("EditorDisclaimerWikiUrl")),
|
||||||
new Pair<string, string>(TextManager.Get("EditorDisclaimerDiscordLink"),TextManager.Get("EditorDisclaimerDiscordUrl")),
|
new Pair<string, string>(TextManager.Get("EditorDisclaimerDiscordLink"),TextManager.Get("EditorDisclaimerDiscordUrl")),
|
||||||
new Pair<string, string>(TextManager.Get("EditorDisclaimerForumLink"),TextManager.Get("EditorDisclaimerForumUrl")),
|
new Pair<string, string>(TextManager.Get("EditorDisclaimerForumLink"),TextManager.Get("EditorDisclaimerForumUrl")),
|
||||||
};
|
};
|
||||||
foreach (var link in links)
|
foreach (var link in links)
|
||||||
{
|
{
|
||||||
new GUIButton(new RectTransform(new Vector2(1.0f, 0.2f), linkHolder.RectTransform), link.First, style: "MainMenuGUIButton", textAlignment: Alignment.Left)
|
new GUIButton(new RectTransform(new Vector2(1.0f, 0.2f), linkHolder.RectTransform), link.First, style: "MainMenuGUIButton", textAlignment: Alignment.Left)
|
||||||
@@ -779,6 +767,19 @@ namespace Barotrauma
|
|||||||
Config.SaveNewPlayerConfig();
|
Config.SaveNewPlayerConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ToDo: Move texts/links to localization, when possible.
|
||||||
|
public void ShowBugReporter()
|
||||||
|
{
|
||||||
|
var msgBox = new GUIMessageBox("", "");
|
||||||
|
var linkHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.5f), msgBox.Content.RectTransform)) { Stretch = true, RelativeSpacing = 0.05f };
|
||||||
|
|
||||||
|
msgBox.Text.RectTransform.MaxSize = new Point(int.MaxValue, msgBox.Text.Rect.Height);
|
||||||
|
linkHolder.RectTransform.MaxSize = new Point(int.MaxValue, linkHolder.Rect.Height);
|
||||||
|
msgBox.RectTransform.MinSize = new Point(0, msgBox.Rect.Height + linkHolder.Rect.Height + msgBox.Buttons.First().Rect.Height * 8);
|
||||||
|
Config.EditorDisclaimerShown = true;
|
||||||
|
Config.SaveNewPlayerConfig();
|
||||||
|
}
|
||||||
|
|
||||||
// ToDo: Move texts/links to localization, when possible.
|
// ToDo: Move texts/links to localization, when possible.
|
||||||
public void ShowBugReporter()
|
public void ShowBugReporter()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,8 +49,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private GUIComponent orderTargetFrame, orderTargetFrameShadow;
|
private GUIComponent orderTargetFrame, orderTargetFrameShadow;
|
||||||
|
|
||||||
public bool AllowCharacterSwitch = true;
|
|
||||||
|
|
||||||
public bool ToggleCrewAreaOpen
|
public bool ToggleCrewAreaOpen
|
||||||
{
|
{
|
||||||
get { return toggleCrewAreaOpen; }
|
get { return toggleCrewAreaOpen; }
|
||||||
@@ -65,8 +63,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<GUIButton> OrderOptionButtons = new List<GUIButton>();
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructors
|
#region Constructors
|
||||||
@@ -477,10 +473,7 @@ namespace Barotrauma
|
|||||||
orderButtonFrame.RectTransform;
|
orderButtonFrame.RectTransform;
|
||||||
|
|
||||||
var btn = new GUIButton(new RectTransform(new Point(iconSize, iconSize), btnParent, Anchor.CenterLeft),
|
var btn = new GUIButton(new RectTransform(new Point(iconSize, iconSize), btnParent, Anchor.CenterLeft),
|
||||||
style: null)
|
style: null);
|
||||||
{
|
|
||||||
UserData = order
|
|
||||||
};
|
|
||||||
|
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.5f), btn.RectTransform, Anchor.Center), "OuterGlow")
|
new GUIFrame(new RectTransform(new Vector2(1.5f), btn.RectTransform, Anchor.Center), "OuterGlow")
|
||||||
{
|
{
|
||||||
@@ -572,7 +565,6 @@ namespace Barotrauma
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public bool CharacterClicked(GUIComponent component, object selection)
|
public bool CharacterClicked(GUIComponent component, object selection)
|
||||||
{
|
{
|
||||||
if (!AllowCharacterSwitch) { return false; }
|
|
||||||
Character character = selection as Character;
|
Character character = selection as Character;
|
||||||
if (character == null || character.IsDead || character.IsUnconscious) return false;
|
if (character == null || character.IsDead || character.IsUnconscious) return false;
|
||||||
SelectCharacter(character);
|
SelectCharacter(character);
|
||||||
@@ -837,6 +829,12 @@ namespace Barotrauma
|
|||||||
matchingItems.RemoveAll(it => it.Submarine != submarine && !submarine.DockedTo.Contains(it.Submarine));
|
matchingItems.RemoveAll(it => it.Submarine != submarine && !submarine.DockedTo.Contains(it.Submarine));
|
||||||
matchingItems.RemoveAll(it => it.Submarine != null && it.Submarine.IsOutpost);
|
matchingItems.RemoveAll(it => it.Submarine != null && it.Submarine.IsOutpost);
|
||||||
}
|
}
|
||||||
|
var characterElement = characterListBox.Content.FindChild(character);
|
||||||
|
GUIButton orderBtn = characterElement.FindChild(order, recursive: true) as GUIButton;
|
||||||
|
if (orderBtn.Frame.FlashTimer <= 0)
|
||||||
|
{
|
||||||
|
orderBtn.Flash(color, 1.5f, false, flashRectInflate);
|
||||||
|
}
|
||||||
|
|
||||||
//more than one target item -> create a minimap-like selection with a pic of the sub
|
//more than one target item -> create a minimap-like selection with a pic of the sub
|
||||||
if (matchingItems.Count > 1)
|
if (matchingItems.Count > 1)
|
||||||
@@ -916,12 +914,9 @@ namespace Barotrauma
|
|||||||
if (Character.Controlled == null) return false;
|
if (Character.Controlled == null) return false;
|
||||||
SetCharacterOrder(character, userData as Order, option, Character.Controlled);
|
SetCharacterOrder(character, userData as Order, option, Character.Controlled);
|
||||||
orderTargetFrame = null;
|
orderTargetFrame = null;
|
||||||
OrderOptionButtons.Clear();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
OrderOptionButtons.Add(optionButton);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -954,13 +949,9 @@ namespace Barotrauma
|
|||||||
if (Character.Controlled == null) return false;
|
if (Character.Controlled == null) return false;
|
||||||
SetCharacterOrder(character, userData as Order, option, Character.Controlled);
|
SetCharacterOrder(character, userData as Order, option, Character.Controlled);
|
||||||
orderTargetFrame = null;
|
orderTargetFrame = null;
|
||||||
OrderOptionButtons.Clear();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
OrderOptionButtons.Add(optionButton);
|
|
||||||
|
|
||||||
//lines between the order buttons
|
//lines between the order buttons
|
||||||
if (i < order.Options.Length - 1)
|
if (i < order.Options.Length - 1)
|
||||||
{
|
{
|
||||||
@@ -976,24 +967,6 @@ namespace Barotrauma
|
|||||||
color: matchingItems.Count > 1 ? Color.Black * 0.9f : Color.Black * 0.7f);
|
color: matchingItems.Count > 1 ? Color.Black * 0.9f : Color.Black * 0.7f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HighlightOrderButton(Character character, string orderAiTag, Color color, Vector2? flashRectInflate = null)
|
|
||||||
{
|
|
||||||
var order = Order.PrefabList.Find(o => o.AITag == orderAiTag);
|
|
||||||
if (order == null)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError("Could not find an order with the AI tag \"" + orderAiTag + "\".\n" + Environment.StackTrace);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
var characterElement = characterListBox.Content.FindChild(character);
|
|
||||||
GUIButton orderBtn = characterElement.FindChild(order, recursive: true) as GUIButton;
|
|
||||||
if (orderBtn.Frame.FlashTimer <= 0)
|
|
||||||
{
|
|
||||||
orderBtn.Flash(color, 1.5f, false, flashRectInflate);
|
|
||||||
}
|
|
||||||
|
|
||||||
//orderBtn.Pulsate(Vector2.One, Vector2.One * 2.0f, 1.5f);
|
|
||||||
}
|
|
||||||
|
|
||||||
#region Updating and drawing the UI
|
#region Updating and drawing the UI
|
||||||
|
|
||||||
private void DrawMiniMapOverlay(SpriteBatch spriteBatch, GUICustomComponent container)
|
private void DrawMiniMapOverlay(SpriteBatch spriteBatch, GUICustomComponent container)
|
||||||
@@ -1051,7 +1024,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void SelectNextCharacter()
|
public void SelectNextCharacter()
|
||||||
{
|
{
|
||||||
if (!AllowCharacterSwitch) { return; }
|
|
||||||
if (GameMain.IsMultiplayer) { return; }
|
if (GameMain.IsMultiplayer) { return; }
|
||||||
if (characters.None()) { return; }
|
if (characters.None()) { return; }
|
||||||
SelectCharacter(characters[TryAdjustIndex(1)]);
|
SelectCharacter(characters[TryAdjustIndex(1)]);
|
||||||
@@ -1059,7 +1031,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public void SelectPreviousCharacter()
|
public void SelectPreviousCharacter()
|
||||||
{
|
{
|
||||||
if (!AllowCharacterSwitch) { return; }
|
|
||||||
if (GameMain.IsMultiplayer) { return; }
|
if (GameMain.IsMultiplayer) { return; }
|
||||||
if (characters.None()) { return; }
|
if (characters.None()) { return; }
|
||||||
SelectCharacter(characters[TryAdjustIndex(-1)]);
|
SelectCharacter(characters[TryAdjustIndex(-1)]);
|
||||||
@@ -1067,7 +1038,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private void SelectCharacter(Character character)
|
private void SelectCharacter(Character character)
|
||||||
{
|
{
|
||||||
if (!AllowCharacterSwitch) { return; }
|
|
||||||
//make the previously selected character wait in place for some time
|
//make the previously selected character wait in place for some time
|
||||||
//(so they don't immediately start idling and walking away from their station)
|
//(so they don't immediately start idling and walking away from their station)
|
||||||
if (Character.Controlled?.AIController?.ObjectiveManager != null)
|
if (Character.Controlled?.AIController?.ObjectiveManager != null)
|
||||||
|
|||||||
@@ -9,6 +9,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
class SinglePlayerCampaign : CampaignMode
|
class SinglePlayerCampaign : CampaignMode
|
||||||
{
|
{
|
||||||
|
public ContextualTutorial ContextualTutorial;
|
||||||
|
|
||||||
private GUIButton endRoundButton;
|
private GUIButton endRoundButton;
|
||||||
|
|
||||||
private bool crewDead;
|
private bool crewDead;
|
||||||
@@ -39,6 +41,13 @@ namespace Barotrauma
|
|||||||
CrewManager.AddCharacterInfo(new CharacterInfo(Character.HumanConfigFile, "", jobPrefab));
|
CrewManager.AddCharacterInfo(new CharacterInfo(Character.HumanConfigFile, "", jobPrefab));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContextualTutorial = Tutorial.Tutorials.Find(t => t is ContextualTutorial) as ContextualTutorial;
|
||||||
|
|
||||||
|
if (ContextualTutorial.Selected) // Selected when starting a new game -> initialize
|
||||||
|
{
|
||||||
|
ContextualTutorial.Initialize();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Start()
|
public override void Start()
|
||||||
@@ -56,6 +65,11 @@ namespace Barotrauma
|
|||||||
endTimer = 5.0f;
|
endTimer = 5.0f;
|
||||||
isRunning = true;
|
isRunning = true;
|
||||||
CrewManager.InitSinglePlayerRound();
|
CrewManager.InitSinglePlayerRound();
|
||||||
|
|
||||||
|
if (ContextualTutorial.Initialized)
|
||||||
|
{
|
||||||
|
ContextualTutorial.Start();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool TryHireCharacter(Location location, CharacterInfo characterInfo)
|
public bool TryHireCharacter(Location location, CharacterInfo characterInfo)
|
||||||
@@ -148,6 +162,11 @@ namespace Barotrauma
|
|||||||
base.AddToGUIUpdateList();
|
base.AddToGUIUpdateList();
|
||||||
CrewManager.AddToGUIUpdateList();
|
CrewManager.AddToGUIUpdateList();
|
||||||
endRoundButton.AddToGUIUpdateList();
|
endRoundButton.AddToGUIUpdateList();
|
||||||
|
|
||||||
|
if (ContextualTutorial.Initialized)
|
||||||
|
{
|
||||||
|
ContextualTutorial.AddToGUIUpdateList();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
@@ -156,6 +175,11 @@ namespace Barotrauma
|
|||||||
|
|
||||||
base.Update(deltaTime);
|
base.Update(deltaTime);
|
||||||
|
|
||||||
|
if (ContextualTutorial.Initialized)
|
||||||
|
{
|
||||||
|
ContextualTutorial.Update(deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
if (!GUI.DisableHUD && !GUI.DisableUpperHUD)
|
if (!GUI.DisableHUD && !GUI.DisableUpperHUD)
|
||||||
{
|
{
|
||||||
endRoundButton.UpdateManually(deltaTime);
|
endRoundButton.UpdateManually(deltaTime);
|
||||||
@@ -292,6 +316,7 @@ namespace Barotrauma
|
|||||||
TextManager.Get("QuitButton"));
|
TextManager.Get("QuitButton"));
|
||||||
quitButton.OnClicked += GameMain.LobbyScreen.QuitToMainMenu;
|
quitButton.OnClicked += GameMain.LobbyScreen.QuitToMainMenu;
|
||||||
quitButton.OnClicked += (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Remove(GUIMessageBox.VisibleBox); return true; };
|
quitButton.OnClicked += (GUIButton button, object obj) => { GUIMessageBox.MessageBoxes.Remove(GUIMessageBox.VisibleBox); return true; };
|
||||||
|
quitButton.OnClicked += (GUIButton button, object obj) => { if (ContextualTutorial.Initialized) ContextualTutorial.Stop(); return true; };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,6 +401,10 @@ namespace Barotrauma
|
|||||||
case "map":
|
case "map":
|
||||||
campaign.map = Map.LoadNew(subElement);
|
campaign.map = Map.LoadNew(subElement);
|
||||||
break;
|
break;
|
||||||
|
case "contextualtutorial":
|
||||||
|
campaign.ContextualTutorial.Initialize(); // Initialize when saved element found
|
||||||
|
campaign.ContextualTutorial.LoadPartiallyComplete(subElement);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,6 +440,12 @@ namespace Barotrauma
|
|||||||
new XAttribute("cheatsenabled", CheatsEnabled));
|
new XAttribute("cheatsenabled", CheatsEnabled));
|
||||||
CrewManager.Save(modeElement);
|
CrewManager.Save(modeElement);
|
||||||
Map.Save(modeElement);
|
Map.Save(modeElement);
|
||||||
|
|
||||||
|
if (ContextualTutorial.Initialized)
|
||||||
|
{
|
||||||
|
ContextualTutorial.SavePartiallyComplete(modeElement);
|
||||||
|
}
|
||||||
|
|
||||||
element.Add(modeElement);
|
element.Add(modeElement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -303,7 +303,7 @@ namespace Barotrauma.Tutorials
|
|||||||
|
|
||||||
yield return new WaitForSeconds(1.0f);
|
yield return new WaitForSeconds(1.0f);
|
||||||
|
|
||||||
infoBox = CreateInfoFrame("", "Uh-oh... Something enormous just appeared on the sonar.");
|
infoBox = CreateInfoFrame("Uh-oh... Something enormous just appeared on the sonar.");
|
||||||
|
|
||||||
List<Structure> windows = new List<Structure>();
|
List<Structure> windows = new List<Structure>();
|
||||||
foreach (Structure s in Structure.WallList)
|
foreach (Structure s in Structure.WallList)
|
||||||
|
|||||||
+272
-19
@@ -1,20 +1,25 @@
|
|||||||
/*using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using System;
|
using System;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Barotrauma.Items.Components;
|
using Barotrauma.Items.Components;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using Microsoft.Xna.Framework.Input;
|
||||||
|
|
||||||
namespace Barotrauma.Tutorials
|
namespace Barotrauma.Tutorials
|
||||||
{
|
{
|
||||||
class ContextualTutorial : Tutorial
|
class ContextualTutorial : Tutorial
|
||||||
{
|
{
|
||||||
public ContextualTutorial(XElement element) : base(element)
|
|
||||||
{
|
|
||||||
//Name = "ContextualTutorial";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool Selected = false;
|
public static bool Selected = false;
|
||||||
|
public static bool ContentRunning = false;
|
||||||
|
public static bool Initialized = false;
|
||||||
|
|
||||||
|
private enum ContentTypes { None = 0, Video = 1, TextOnly = 2 };
|
||||||
|
|
||||||
|
private TutorialSegment activeSegment;
|
||||||
|
private List<TutorialSegment> segments;
|
||||||
|
|
||||||
|
private VideoPlayer videoPlayer;
|
||||||
|
|
||||||
private Steering navConsole;
|
private Steering navConsole;
|
||||||
private Reactor reactor;
|
private Reactor reactor;
|
||||||
@@ -28,24 +33,83 @@ namespace Barotrauma.Tutorials
|
|||||||
private List<Pair<Character, float>> characterTimeOnSonar;
|
private List<Pair<Character, float>> characterTimeOnSonar;
|
||||||
private float requiredTimeOnSonar = 5f;
|
private float requiredTimeOnSonar = 5f;
|
||||||
|
|
||||||
|
private bool started = false;
|
||||||
|
private string playableContentPath;
|
||||||
|
|
||||||
private float tutorialTimer;
|
private float tutorialTimer;
|
||||||
|
|
||||||
private bool disableTutorialOnDeficiencyFound = true;
|
private bool disableTutorialOnDeficiencyFound = true;
|
||||||
|
|
||||||
|
private GUIFrame holderFrame, objectiveFrame;
|
||||||
|
private List<TutorialSegment> activeObjectives = new List<TutorialSegment>();
|
||||||
|
private string objectiveTranslated;
|
||||||
|
|
||||||
private float floodTutorialTimer = 0.0f;
|
private float floodTutorialTimer = 0.0f;
|
||||||
private const float floodTutorialDelay = 2.0f;
|
private const float floodTutorialDelay = 2.0f;
|
||||||
private float medicalTutorialTimer = 0.0f;
|
private float medicalTutorialTimer = 0.0f;
|
||||||
private const float medicalTutorialDelay = 2.0f;
|
private const float medicalTutorialDelay = 2.0f;
|
||||||
|
|
||||||
|
private Point screenResolution;
|
||||||
|
private float prevUIScale;
|
||||||
|
|
||||||
|
private class TutorialSegment
|
||||||
|
{
|
||||||
|
public string Id;
|
||||||
|
public string Objective;
|
||||||
|
public ContentTypes ContentType;
|
||||||
|
public XElement TextContent;
|
||||||
|
public XElement VideoContent;
|
||||||
|
public bool IsTriggered;
|
||||||
|
public GUIButton ReplayButton;
|
||||||
|
public GUITextBlock LinkedTitle, LinkedText;
|
||||||
|
|
||||||
|
public TutorialSegment(XElement config)
|
||||||
|
{
|
||||||
|
Id = config.GetAttributeString("id", "Missing ID");
|
||||||
|
Objective = TextManager.Get(config.GetAttributeString("objective", string.Empty), true);
|
||||||
|
Enum.TryParse(config.GetAttributeString("contenttype", "None"), true, out ContentType);
|
||||||
|
IsTriggered = config.GetAttributeBool("istriggered", false);
|
||||||
|
|
||||||
|
switch (ContentType)
|
||||||
|
{
|
||||||
|
case ContentTypes.None:
|
||||||
|
break;
|
||||||
|
case ContentTypes.Video:
|
||||||
|
VideoContent = config.Element("Video");
|
||||||
|
TextContent = config.Element("Text");
|
||||||
|
break;
|
||||||
|
case ContentTypes.TextOnly:
|
||||||
|
TextContent = config.Element("Text");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ContextualTutorial(XElement element) : base(element)
|
||||||
|
{
|
||||||
|
playableContentPath = element.GetAttributeString("playablecontentpath", "");
|
||||||
|
segments = new List<TutorialSegment>();
|
||||||
|
|
||||||
|
foreach (var segment in element.Elements("Segment"))
|
||||||
|
{
|
||||||
|
segments.Add(new TutorialSegment(segment));
|
||||||
|
}
|
||||||
|
|
||||||
|
Name = "ContextualTutorial";
|
||||||
|
}
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
|
||||||
|
|
||||||
for (int i = 0; i < segments.Count; i++)
|
for (int i = 0; i < segments.Count; i++)
|
||||||
{
|
{
|
||||||
segments[i].IsTriggered = false;
|
segments[i].IsTriggered = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Initialized) return;
|
||||||
|
Initialized = true;
|
||||||
|
|
||||||
|
base.Initialize();
|
||||||
|
videoPlayer = new VideoPlayer();
|
||||||
characterTimeOnSonar = new List<Pair<Character, float>>();
|
characterTimeOnSonar = new List<Pair<Character, float>>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,7 +167,10 @@ namespace Barotrauma.Tutorials
|
|||||||
|
|
||||||
base.Start();
|
base.Start();
|
||||||
injuredMember = null;
|
injuredMember = null;
|
||||||
activeContentSegment = null;
|
activeObjectives.Clear();
|
||||||
|
objectiveTranslated = TextManager.Get("Objective");
|
||||||
|
CreateObjectiveFrame();
|
||||||
|
activeSegment = null;
|
||||||
tutorialTimer = floodTutorialTimer = medicalTutorialTimer = 0.0f;
|
tutorialTimer = floodTutorialTimer = medicalTutorialTimer = 0.0f;
|
||||||
subStartingPosition = Vector2.Zero;
|
subStartingPosition = Vector2.Zero;
|
||||||
characterTimeOnSonar.Clear();
|
characterTimeOnSonar.Clear();
|
||||||
@@ -116,10 +183,10 @@ namespace Barotrauma.Tutorials
|
|||||||
#if DEBUG
|
#if DEBUG
|
||||||
if (reactor == null || navConsole == null || sonar == null)
|
if (reactor == null || navConsole == null || sonar == null)
|
||||||
{
|
{
|
||||||
infoBox = CreateInfoFrame("Error", "Submarine not compatible with the tutorial:"
|
infoBox = CreateInfoFrame("Submarine not compatible with the tutorial:"
|
||||||
+ "\nReactor - " + (reactor != null ? "OK" : "Tag 'reactor' not found")
|
+ "\nReactor - " + (reactor != null ? "OK" : "Tag 'reactor' not found")
|
||||||
+ "\nNavigation Console - " + (navConsole != null ? "OK" : "Tag 'command' not found")
|
+ "\nNavigation Console - " + (navConsole != null ? "OK" : "Tag 'command' not found")
|
||||||
+ "\nSonar - " + (sonar != null ? "OK" : "Not found under Navigation Console"), hasButton: true);
|
+ "\nSonar - " + (sonar != null ? "OK" : "Not found under Navigation Console"), true);
|
||||||
CoroutineManager.StartCoroutine(WaitForErrorClosed());
|
CoroutineManager.StartCoroutine(WaitForErrorClosed());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -155,15 +222,62 @@ namespace Barotrauma.Tutorials
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public override void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
base.Stop();
|
started = ContentRunning = Initialized = false;
|
||||||
|
videoPlayer.Remove();
|
||||||
|
videoPlayer = null;
|
||||||
characterTimeOnSonar = null;
|
characterTimeOnSonar = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void CreateObjectiveFrame()
|
||||||
|
{
|
||||||
|
holderFrame = new GUIFrame(new RectTransform(new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight), GUI.Canvas, Anchor.Center));
|
||||||
|
objectiveFrame = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.ObjectiveAnchor, holderFrame.RectTransform), style: null);
|
||||||
|
|
||||||
|
for (int i = 0; i < activeObjectives.Count; i++)
|
||||||
|
{
|
||||||
|
CreateObjectiveGUI(activeObjectives[i], i);
|
||||||
|
}
|
||||||
|
|
||||||
|
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||||
|
prevUIScale = GUI.Scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void AddToGUIUpdateList()
|
||||||
|
{
|
||||||
|
if (videoPlayer != null)
|
||||||
|
{
|
||||||
|
videoPlayer.AddToGUIUpdateList(order: 100);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GUI.DisableHUD) return;
|
||||||
|
if (GameMain.GraphicsWidth != screenResolution.X || GameMain.GraphicsHeight != screenResolution.Y || prevUIScale != GUI.Scale)
|
||||||
|
{
|
||||||
|
CreateObjectiveFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (objectiveFrame != null && activeObjectives.Count > 0)
|
||||||
|
{
|
||||||
|
objectiveFrame.AddToGUIUpdateList(order: -1);
|
||||||
|
}
|
||||||
|
base.AddToGUIUpdateList();
|
||||||
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
base.Update(deltaTime);
|
if (videoPlayer != null)
|
||||||
|
{
|
||||||
|
videoPlayer.Update();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (infoBox != null)
|
||||||
|
{
|
||||||
|
if (PlayerInput.KeyHit(Keys.Enter) || PlayerInput.KeyHit(Keys.Escape))
|
||||||
|
{
|
||||||
|
CloseInfoFrame(null, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!started || ContentRunning) return;
|
if (!started || ContentRunning) return;
|
||||||
|
|
||||||
@@ -171,12 +285,93 @@ namespace Barotrauma.Tutorials
|
|||||||
|
|
||||||
for (int i = 0; i < segments.Count; i++)
|
for (int i = 0; i < segments.Count; i++)
|
||||||
{
|
{
|
||||||
if (segments[i].IsTriggered || HasObjective(segments[i])) continue;
|
if (segments[i].IsTriggered || activeObjectives.Contains(segments[i])) continue;
|
||||||
if (CheckContextualTutorials(i, deltaTime)) // Found a relevant tutorial, halt finding new ones
|
if (CheckContextualTutorials(i, deltaTime)) // Found a relevant tutorial, halt finding new ones
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < activeObjectives.Count; i++)
|
||||||
|
{
|
||||||
|
CheckActiveObjectives(activeObjectives[i], deltaTime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClosePreTextAndTriggerVideoCallback()
|
||||||
|
{
|
||||||
|
videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(activeSegment.VideoContent), new VideoPlayer.TextSettings(activeSegment.VideoContent), activeSegment.Id, true, activeSegment.Objective, CurrentSegmentStopCallback);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CurrentSegmentStopCallback()
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(activeSegment.Objective))
|
||||||
|
{
|
||||||
|
AddNewObjective(activeSegment);
|
||||||
|
}
|
||||||
|
|
||||||
|
activeSegment = null;
|
||||||
|
ContentRunning = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddNewObjective(TutorialSegment segment)
|
||||||
|
{
|
||||||
|
activeObjectives.Add(segment);
|
||||||
|
CreateObjectiveGUI(segment, activeObjectives.Count - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreateObjectiveGUI(TutorialSegment segment, int index)
|
||||||
|
{
|
||||||
|
Point replayButtonSize = new Point((int)(GUI.ObjectiveNameFont.MeasureString(segment.Objective).X * GUI.Scale), (int)(GUI.ObjectiveNameFont.MeasureString(segment.Objective).Y * 1.45f * GUI.Scale));
|
||||||
|
|
||||||
|
segment.ReplayButton = new GUIButton(new RectTransform(replayButtonSize, objectiveFrame.RectTransform, Anchor.TopRight, Pivot.TopRight) { AbsoluteOffset = new Point(0, (replayButtonSize.Y + (int)(20f * GUI.Scale)) * index) }, style: null);
|
||||||
|
segment.ReplayButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||||
|
{
|
||||||
|
ReplaySegmentVideo(segment);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
int yOffset = (int)((GUI.ObjectiveNameFont.MeasureString(objectiveTranslated).Y / 2f + 5) * GUI.Scale);
|
||||||
|
segment.LinkedTitle = new GUITextBlock(new RectTransform(new Point(replayButtonSize.X, yOffset), segment.ReplayButton.RectTransform, Anchor.Center, Pivot.BottomCenter) { AbsoluteOffset = new Point((int)(10 * GUI.Scale), 0) }, objectiveTranslated, textColor: Color.White, font: GUI.ObjectiveTitleFont, textAlignment: Alignment.CenterRight);
|
||||||
|
segment.LinkedText = new GUITextBlock(new RectTransform(new Point(replayButtonSize.X, yOffset), segment.ReplayButton.RectTransform, Anchor.Center, Pivot.TopCenter) { AbsoluteOffset = new Point((int)(10 * GUI.Scale), 0) }, segment.Objective, textColor: new Color(4, 180, 108), font: GUI.ObjectiveNameFont, textAlignment: Alignment.CenterRight);
|
||||||
|
|
||||||
|
segment.LinkedTitle.TextScale = segment.LinkedText.TextScale = GUI.Scale;
|
||||||
|
|
||||||
|
segment.LinkedTitle.Color = segment.LinkedTitle.HoverColor = segment.LinkedTitle.PressedColor = segment.LinkedTitle.SelectedColor = Color.Transparent;
|
||||||
|
segment.LinkedText.Color = segment.LinkedText.HoverColor = segment.LinkedText.PressedColor = segment.LinkedText.SelectedColor = Color.Transparent;
|
||||||
|
segment.ReplayButton.Color = segment.ReplayButton.HoverColor = segment.ReplayButton.PressedColor = segment.ReplayButton.SelectedColor = Color.Transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RemoveCompletedObjective(TutorialSegment objective)
|
||||||
|
{
|
||||||
|
objective.IsTriggered = true;
|
||||||
|
|
||||||
|
int checkMarkHeight = (int)(objective.ReplayButton.Rect.Height * 1.2f);
|
||||||
|
int checkMarkWidth = (int)(checkMarkHeight * 0.93f);
|
||||||
|
|
||||||
|
Color color = new Color(4, 180, 108);
|
||||||
|
RectTransform rectTA = new RectTransform(new Point(checkMarkWidth, checkMarkHeight), objective.ReplayButton.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft);
|
||||||
|
rectTA.AbsoluteOffset = new Point(-rectTA.Rect.Width - 5, 0);
|
||||||
|
GUIImage checkmark = new GUIImage(rectTA, "CheckMark");
|
||||||
|
checkmark.Color = color;
|
||||||
|
|
||||||
|
RectTransform rectTB = new RectTransform(new Vector2(1.1f, .8f), objective.LinkedText.RectTransform, Anchor.Center, Pivot.Center);
|
||||||
|
GUIImage stroke = new GUIImage(rectTB, "Stroke");
|
||||||
|
stroke.Color = color;
|
||||||
|
|
||||||
|
CoroutineManager.StartCoroutine(WaitForObjectiveEnd(objective));
|
||||||
|
}
|
||||||
|
|
||||||
|
private IEnumerable<object> WaitForObjectiveEnd(TutorialSegment objective)
|
||||||
|
{
|
||||||
|
yield return new WaitForSeconds(2.0f);
|
||||||
|
objectiveFrame.RemoveChild(objective.ReplayButton);
|
||||||
|
activeObjectives.Remove(objective);
|
||||||
|
|
||||||
|
for (int i = 0; i < activeObjectives.Count; i++)
|
||||||
|
{
|
||||||
|
activeObjectives[i].ReplayButton.RectTransform.AbsoluteOffset = new Point(0, (activeObjectives[i].ReplayButton.Rect.Height + 20) * i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool CheckContextualTutorials(int index, float deltaTime)
|
private bool CheckContextualTutorials(int index, float deltaTime)
|
||||||
@@ -331,7 +526,17 @@ namespace Barotrauma.Tutorials
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void CheckActiveObjectives(TutorialSegment objective, float deltaTime)
|
private bool HasObjective(string objectiveName)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < activeObjectives.Count; i++)
|
||||||
|
{
|
||||||
|
if (activeObjectives[i].Id == objectiveName) return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CheckActiveObjectives(TutorialSegment objective, float deltaTime)
|
||||||
{
|
{
|
||||||
switch(objective.Id)
|
switch(objective.Id)
|
||||||
{
|
{
|
||||||
@@ -499,9 +704,50 @@ namespace Barotrauma.Tutorials
|
|||||||
return characterTimeOnSonar.Find(ct => ct.Second >= requiredTimeOnSonar && !ct.First.IsDead) != null;
|
return characterTimeOnSonar.Find(ct => ct.Second >= requiredTimeOnSonar && !ct.First.IsDead) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void TriggerTutorialSegment(int index, params object[] args)
|
private void TriggerTutorialSegment(int index, params object[] args)
|
||||||
{
|
{
|
||||||
base.TriggerTutorialSegment(index, args);
|
Inventory.draggingItem = null;
|
||||||
|
ContentRunning = true;
|
||||||
|
activeSegment = segments[index];
|
||||||
|
|
||||||
|
string tutorialText = TextManager.GetFormatted(activeSegment.TextContent.GetAttributeString("tag", ""), true, args);
|
||||||
|
string objectiveText = string.Empty;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(activeSegment.Objective))
|
||||||
|
{
|
||||||
|
if (args.Length == 0)
|
||||||
|
{
|
||||||
|
objectiveText = activeSegment.Objective;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
objectiveText = string.Format(activeSegment.Objective, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
activeSegment.Objective = objectiveText;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
activeSegment.IsTriggered = true; // Complete at this stage only if no related objective
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (activeSegment.ContentType)
|
||||||
|
{
|
||||||
|
case ContentTypes.None:
|
||||||
|
break;
|
||||||
|
case ContentTypes.Video:
|
||||||
|
infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Id), tutorialText,
|
||||||
|
activeSegment.TextContent.GetAttributeInt("width", 300),
|
||||||
|
activeSegment.TextContent.GetAttributeInt("height", 80),
|
||||||
|
activeSegment.TextContent.GetAttributeString("anchor", "Center"), true, ClosePreTextAndTriggerVideoCallback);
|
||||||
|
break;
|
||||||
|
case ContentTypes.TextOnly:
|
||||||
|
infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Id), tutorialText,
|
||||||
|
activeSegment.TextContent.GetAttributeInt("width", 300),
|
||||||
|
activeSegment.TextContent.GetAttributeInt("height", 80),
|
||||||
|
activeSegment.TextContent.GetAttributeString("anchor", "Center"), true, CurrentSegmentStopCallback);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < segments.Count; i++)
|
for (int i = 0; i < segments.Count; i++)
|
||||||
{
|
{
|
||||||
@@ -511,10 +757,17 @@ namespace Barotrauma.Tutorials
|
|||||||
CoroutineManager.StartCoroutine(WaitToStop()); // Completed
|
CoroutineManager.StartCoroutine(WaitToStop()); // Completed
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ReplaySegmentVideo(TutorialSegment segment)
|
||||||
|
{
|
||||||
|
if (ContentRunning) return;
|
||||||
|
ContentRunning = true;
|
||||||
|
videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, callback: () => ContentRunning = false);
|
||||||
|
}
|
||||||
|
|
||||||
private IEnumerable<object> WaitToStop()
|
private IEnumerable<object> WaitToStop()
|
||||||
{
|
{
|
||||||
while (ContentRunning) yield return null;
|
while (ContentRunning) yield return null;
|
||||||
Stop();
|
Stop();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|||||||
+25
-203
@@ -1,118 +1,44 @@
|
|||||||
using Barotrauma.Items.Components;
|
using System;
|
||||||
using Microsoft.Xna.Framework;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace Barotrauma.Tutorials
|
namespace Barotrauma.Tutorials
|
||||||
{
|
{
|
||||||
class ScenarioTutorial : Tutorial
|
class ScenarioTutorial : Tutorial
|
||||||
{
|
{
|
||||||
private CoroutineHandle tutorialCoroutine;
|
|
||||||
|
|
||||||
private Character character;
|
private Character character;
|
||||||
private string spawnSub;
|
|
||||||
private SpawnType spawnPointType;
|
private SpawnType spawnPointType;
|
||||||
private string submarinePath;
|
private string submarinePath;
|
||||||
private string startOutpostPath;
|
|
||||||
private string endOutpostPath;
|
|
||||||
private string levelSeed;
|
private string levelSeed;
|
||||||
private string levelParams;
|
|
||||||
|
|
||||||
private Submarine startOutpost = null;
|
|
||||||
private Submarine endOutpost = null;
|
|
||||||
private bool currentTutorialCompleted = false;
|
|
||||||
private float fadeOutTime = 3f;
|
|
||||||
protected float waitBeforeFade = 4f;
|
|
||||||
|
|
||||||
// Colors
|
|
||||||
protected Color highlightColor = Color.OrangeRed;
|
|
||||||
protected Color uiHighlightColor = new Color(150, 50, 0);
|
|
||||||
protected Color buttonHighlightColor = new Color(255, 100, 0);
|
|
||||||
protected Color inaccessibleColor = Color.Red;
|
|
||||||
protected Color accessibleColor = Color.Green;
|
|
||||||
|
|
||||||
public ScenarioTutorial(XElement element) : base(element)
|
public ScenarioTutorial(XElement element) : base(element)
|
||||||
{
|
{
|
||||||
submarinePath = element.GetAttributeString("submarinepath", "");
|
submarinePath = element.GetAttributeString("submarinepath", "");
|
||||||
startOutpostPath = element.GetAttributeString("startoutpostpath", "");
|
|
||||||
endOutpostPath = element.GetAttributeString("endoutpostpath", "");
|
|
||||||
|
|
||||||
levelSeed = element.GetAttributeString("levelseed", "tuto");
|
levelSeed = element.GetAttributeString("levelseed", "tuto");
|
||||||
levelParams = element.GetAttributeString("levelparams", "");
|
Enum.TryParse(element.GetAttributeString("spawnpointtype", "Human"), true, out spawnPointType);
|
||||||
|
|
||||||
spawnSub = element.GetAttributeString("spawnsub", "");
|
|
||||||
Enum.TryParse(element.GetAttributeString("spawnpointtype", "Human"), true, out spawnPointType);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
base.Initialize();
|
base.Initialize();
|
||||||
currentTutorialCompleted = false;
|
|
||||||
GameMain.Instance.ShowLoading(Loading());
|
GameMain.Instance.ShowLoading(Loading());
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<object> Loading()
|
|
||||||
{
|
|
||||||
Submarine.MainSub = Submarine.Load(submarinePath, "", true);
|
|
||||||
|
|
||||||
LevelGenerationParams generationParams = LevelGenerationParams.LevelParams.Find(p => p.Name == levelParams);
|
|
||||||
|
|
||||||
yield return CoroutineStatus.Running;
|
|
||||||
|
|
||||||
GameMain.GameSession = new GameSession(Submarine.MainSub, "",
|
|
||||||
GameModePreset.List.Find(g => g.Identifier == "tutorial"));
|
|
||||||
(GameMain.GameSession.GameMode as TutorialMode).Tutorial = this;
|
|
||||||
|
|
||||||
if (generationParams != null)
|
|
||||||
{
|
|
||||||
Biome biome = LevelGenerationParams.GetBiomes().Find(b => generationParams.AllowedBiomes.Contains(b));
|
|
||||||
|
|
||||||
if (startOutpostPath != string.Empty)
|
|
||||||
{
|
|
||||||
startOutpost = Submarine.Load(startOutpostPath, "", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (endOutpostPath != string.Empty)
|
|
||||||
{
|
|
||||||
endOutpost = Submarine.Load(endOutpostPath, "", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
Level tutorialLevel = new Level(levelSeed, 0, 0, generationParams, biome, startOutpost, endOutpost);
|
|
||||||
GameMain.GameSession.StartRound(tutorialLevel);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
GameMain.GameSession.StartRound(levelSeed);
|
|
||||||
}
|
|
||||||
|
|
||||||
GameMain.GameSession.EventManager.Events.Clear();
|
|
||||||
GameMain.GameSession.EventManager.Enabled = false;
|
|
||||||
GameMain.GameScreen.Select();
|
|
||||||
|
|
||||||
yield return CoroutineStatus.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Start()
|
public override void Start()
|
||||||
{
|
{
|
||||||
base.Start();
|
base.Start();
|
||||||
|
|
||||||
Submarine.MainSub.GodMode = true;
|
WayPoint wayPoint = WayPoint.GetRandom(spawnPointType, null);
|
||||||
|
|
||||||
CharacterInfo charInfo = configElement.Element("Character") == null ?
|
|
||||||
new CharacterInfo(Character.HumanConfigFile, "", JobPrefab.List.Find(jp => jp.Identifier == "engineer")) :
|
|
||||||
new CharacterInfo(configElement.Element("Character"));
|
|
||||||
|
|
||||||
WayPoint wayPoint = GetSpawnPoint(charInfo);
|
|
||||||
|
|
||||||
if (wayPoint == null)
|
if (wayPoint == null)
|
||||||
{
|
{
|
||||||
DebugConsole.ThrowError("A waypoint with the spawntype \"" + spawnPointType + "\" is required for the tutorial event");
|
DebugConsole.ThrowError("A waypoint with the spawntype \"" + spawnPointType + "\" is required for the tutorial event");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CharacterInfo charInfo = configElement.Element("Character") == null ?
|
||||||
|
new CharacterInfo(Character.HumanConfigFile, "", JobPrefab.List.Find(jp => jp.Identifier == "engineer")) :
|
||||||
|
new CharacterInfo(configElement.Element("Character"));
|
||||||
|
|
||||||
character = Character.Create(charInfo, wayPoint.WorldPosition, "", false, false);
|
character = Character.Create(charInfo, wayPoint.WorldPosition, "", false, false);
|
||||||
Character.Controlled = character;
|
Character.Controlled = character;
|
||||||
character.GiveJobItems(null);
|
character.GiveJobItems(null);
|
||||||
@@ -126,82 +52,22 @@ namespace Barotrauma.Tutorials
|
|||||||
idCard.AddTag("com");
|
idCard.AddTag("com");
|
||||||
idCard.AddTag("eng");
|
idCard.AddTag("eng");
|
||||||
|
|
||||||
tutorialCoroutine = CoroutineManager.StartCoroutine(UpdateState());
|
CoroutineManager.StartCoroutine(UpdateState());
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddToGUIUpdateList()
|
private IEnumerable<object> Loading()
|
||||||
{
|
{
|
||||||
if (!currentTutorialCompleted)
|
Submarine.MainSub = Submarine.Load(submarinePath, "", true);
|
||||||
{
|
yield return CoroutineStatus.Running;
|
||||||
base.AddToGUIUpdateList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private WayPoint GetSpawnPoint(CharacterInfo charInfo)
|
GameMain.GameSession = new GameSession(Submarine.MainSub, "",
|
||||||
{
|
GameModePreset.List.Find(g => g.Identifier == "tutorial"));
|
||||||
Submarine spawnSub = null;
|
(GameMain.GameSession.GameMode as TutorialMode).tutorial = this;
|
||||||
|
GameMain.GameSession.StartRound(levelSeed);
|
||||||
|
GameMain.GameSession.EventManager.Events.Clear();
|
||||||
|
GameMain.GameScreen.Select();
|
||||||
|
|
||||||
if (this.spawnSub != string.Empty)
|
yield return CoroutineStatus.Success;
|
||||||
{
|
|
||||||
switch (this.spawnSub)
|
|
||||||
{
|
|
||||||
case "startoutpost":
|
|
||||||
spawnSub = startOutpost;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "endoutpost":
|
|
||||||
spawnSub = endOutpost;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
spawnSub = Submarine.MainSub;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return WayPoint.GetRandom(spawnPointType, charInfo.Job, spawnSub);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected bool HasOrder(Character character, string aiTag, string option = null)
|
|
||||||
{
|
|
||||||
if (character.CurrentOrder?.AITag == aiTag)
|
|
||||||
{
|
|
||||||
if (option == null)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
HumanAIController humanAI = character.AIController as HumanAIController;
|
|
||||||
return humanAI.CurrentOrderOption == option;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void SetHighlight(Item item, bool state)
|
|
||||||
{
|
|
||||||
if (item.ExternalHighlight == state) return;
|
|
||||||
item.SpriteColor = (state) ? highlightColor : Color.White;
|
|
||||||
item.ExternalHighlight = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void SetHighlight(Structure structure, bool state)
|
|
||||||
{
|
|
||||||
structure.SpriteColor = (state) ? highlightColor : Color.White;
|
|
||||||
structure.ExternalHighlight = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void SetHighlight(Character character, bool state)
|
|
||||||
{
|
|
||||||
character.ExternalHighlight = state;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void SetDoorAccess(Door door, LightComponent light, bool state)
|
|
||||||
{
|
|
||||||
if (state && door != null) door.requiredItems.Clear();
|
|
||||||
if (light != null) light.LightColor = (state) ? accessibleColor : inaccessibleColor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
@@ -209,47 +75,27 @@ namespace Barotrauma.Tutorials
|
|||||||
base.Update(deltaTime);
|
base.Update(deltaTime);
|
||||||
if (character != null)
|
if (character != null)
|
||||||
{
|
{
|
||||||
if (character.Oxygen < 1)
|
if (Character.Controlled == null)
|
||||||
{
|
{
|
||||||
character.Oxygen = 1;
|
CoroutineManager.StopCoroutines("TutorialMode.UpdateState");
|
||||||
}
|
|
||||||
if (character.IsDead)
|
|
||||||
{
|
|
||||||
CoroutineManager.StartCoroutine(Dead());
|
|
||||||
}
|
|
||||||
else if (Character.Controlled == null)
|
|
||||||
{
|
|
||||||
if (tutorialCoroutine != null)
|
|
||||||
{
|
|
||||||
CoroutineManager.StopCoroutines(tutorialCoroutine);
|
|
||||||
}
|
|
||||||
infoBox = null;
|
infoBox = null;
|
||||||
}
|
}
|
||||||
else if (Character.Controlled.IsDead)
|
else if (Character.Controlled.IsDead)
|
||||||
{
|
{
|
||||||
|
Character.Controlled = null;
|
||||||
|
|
||||||
|
CoroutineManager.StopCoroutines("TutorialMode.UpdateState");
|
||||||
|
infoBox = null;
|
||||||
CoroutineManager.StartCoroutine(Dead());
|
CoroutineManager.StartCoroutine(Dead());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Stop()
|
|
||||||
{
|
|
||||||
if (tutorialCoroutine != null)
|
|
||||||
{
|
|
||||||
CoroutineManager.StopCoroutines(tutorialCoroutine);
|
|
||||||
}
|
|
||||||
base.Stop();
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<object> Dead()
|
private IEnumerable<object> Dead()
|
||||||
{
|
{
|
||||||
GUI.PreventPauseMenuToggle = true;
|
|
||||||
Character.Controlled = character = null;
|
|
||||||
Stop();
|
|
||||||
|
|
||||||
yield return new WaitForSeconds(3.0f);
|
yield return new WaitForSeconds(3.0f);
|
||||||
|
|
||||||
var messageBox = new GUIMessageBox(TextManager.Get("Tutorial.TryAgainHeader"), TextManager.Get("Tutorial.TryAgain"), new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
var messageBox = new GUIMessageBox("You have died", "Do you want to try again?", new string[] { "Yes", "No" });
|
||||||
|
|
||||||
messageBox.Buttons[0].OnClicked += Restart;
|
messageBox.Buttons[0].OnClicked += Restart;
|
||||||
messageBox.Buttons[0].OnClicked += messageBox.Close;
|
messageBox.Buttons[0].OnClicked += messageBox.Close;
|
||||||
@@ -260,29 +106,5 @@ namespace Barotrauma.Tutorials
|
|||||||
|
|
||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected IEnumerable<object> TutorialCompleted()
|
|
||||||
{
|
|
||||||
GUI.PreventPauseMenuToggle = true;
|
|
||||||
|
|
||||||
Character.Controlled.ClearInputs();
|
|
||||||
Character.Controlled = null;
|
|
||||||
|
|
||||||
yield return new WaitForSeconds(waitBeforeFade);
|
|
||||||
|
|
||||||
var endCinematic = new RoundEndCinematic(Submarine.MainSub, GameMain.GameScreen.Cam, fadeOutTime);
|
|
||||||
currentTutorialCompleted = Completed = true;
|
|
||||||
while (endCinematic.Running) yield return null;
|
|
||||||
Stop();
|
|
||||||
GameMain.MainMenuScreen.ReturnToMainMenu(null, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void Heal(Character character)
|
|
||||||
{
|
|
||||||
character.SetAllDamage(0.0f, 0.0f, 0.0f);
|
|
||||||
character.Oxygen = 100.0f;
|
|
||||||
character.Bloodloss = 0.0f;
|
|
||||||
character.SetStun(0.0f, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,74 +1,21 @@
|
|||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Input;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Linq;
|
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Barotrauma.Items.Components;
|
|
||||||
using Barotrauma.Extensions;
|
|
||||||
|
|
||||||
namespace Barotrauma.Tutorials
|
namespace Barotrauma.Tutorials
|
||||||
{
|
{
|
||||||
abstract class Tutorial
|
abstract class Tutorial
|
||||||
{
|
{
|
||||||
#region Tutorial variables
|
|
||||||
public static bool Initialized = false;
|
|
||||||
public static bool ContentRunning = false;
|
|
||||||
public static List<Tutorial> Tutorials;
|
public static List<Tutorial> Tutorials;
|
||||||
|
|
||||||
protected bool started = false;
|
|
||||||
protected GUIComponent infoBox;
|
protected GUIComponent infoBox;
|
||||||
private Action infoBoxClosedCallback;
|
private Action infoBoxClosedCallback;
|
||||||
protected XElement configElement;
|
protected XElement configElement;
|
||||||
|
|
||||||
protected VideoPlayer videoPlayer;
|
private enum TutorialType { None, Scenario, Contextual };
|
||||||
protected enum TutorialContentTypes { None = 0, Video = 1, ManualVideo = 2, TextOnly = 3 };
|
private TutorialType tutorialType = TutorialType.None;
|
||||||
protected string playableContentPath;
|
|
||||||
protected Point screenResolution;
|
|
||||||
protected float prevUIScale;
|
|
||||||
|
|
||||||
private GUIFrame holderFrame, objectiveFrame;
|
|
||||||
private List<TutorialSegment> activeObjectives = new List<TutorialSegment>();
|
|
||||||
private string objectiveTranslated;
|
|
||||||
|
|
||||||
protected TutorialSegment activeContentSegment;
|
|
||||||
protected List<TutorialSegment> segments;
|
|
||||||
|
|
||||||
protected class TutorialSegment
|
|
||||||
{
|
|
||||||
public string Id;
|
|
||||||
public string Objective;
|
|
||||||
public TutorialContentTypes ContentType;
|
|
||||||
public XElement TextContent;
|
|
||||||
public XElement VideoContent;
|
|
||||||
public bool IsTriggered;
|
|
||||||
public GUIButton ReplayButton;
|
|
||||||
public GUITextBlock LinkedTitle, LinkedText;
|
|
||||||
public object[] Args;
|
|
||||||
|
|
||||||
public TutorialSegment(XElement config)
|
|
||||||
{
|
|
||||||
Id = config.GetAttributeString("id", "Missing ID");
|
|
||||||
Objective = TextManager.Get(config.GetAttributeString("objective", string.Empty), true);
|
|
||||||
Enum.TryParse(config.GetAttributeString("contenttype", "None"), true, out ContentType);
|
|
||||||
IsTriggered = config.GetAttributeBool("istriggered", false);
|
|
||||||
|
|
||||||
switch (ContentType)
|
|
||||||
{
|
|
||||||
case TutorialContentTypes.None:
|
|
||||||
break;
|
|
||||||
case TutorialContentTypes.Video:
|
|
||||||
case TutorialContentTypes.ManualVideo:
|
|
||||||
VideoContent = config.Element("Video");
|
|
||||||
TextContent = config.Element("Text");
|
|
||||||
break;
|
|
||||||
case TutorialContentTypes.TextOnly:
|
|
||||||
TextContent = config.Element("Text");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public string Name
|
public string Name
|
||||||
{
|
{
|
||||||
@@ -87,9 +34,7 @@ namespace Barotrauma.Tutorials
|
|||||||
GameMain.Config.SaveNewPlayerConfig();
|
GameMain.Config.SaveNewPlayerConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Tutorial Controls
|
|
||||||
public static void Init()
|
public static void Init()
|
||||||
{
|
{
|
||||||
Tutorials = new List<Tutorial>();
|
Tutorials = new List<Tutorial>();
|
||||||
@@ -161,85 +106,27 @@ namespace Barotrauma.Tutorials
|
|||||||
configElement = element;
|
configElement = element;
|
||||||
Name = element.GetAttributeString("name", "Unnamed");
|
Name = element.GetAttributeString("name", "Unnamed");
|
||||||
completed = GameMain.Config.CompletedTutorialNames.Contains(Name);
|
completed = GameMain.Config.CompletedTutorialNames.Contains(Name);
|
||||||
playableContentPath = element.GetAttributeString("playablecontentpath", "");
|
Enum.TryParse(element.GetAttributeString("tutorialtype", "Scenario"), true, out tutorialType);
|
||||||
|
|
||||||
segments = new List<TutorialSegment>();
|
|
||||||
|
|
||||||
foreach (var segment in element.Elements("Segment"))
|
|
||||||
{
|
|
||||||
segments.Add(new TutorialSegment(segment));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Initialize()
|
public virtual void Initialize()
|
||||||
{
|
{
|
||||||
if (Initialized) return;
|
|
||||||
Initialized = true;
|
|
||||||
videoPlayer = new VideoPlayer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Start()
|
public virtual void Start()
|
||||||
{
|
{
|
||||||
activeObjectives.Clear();
|
|
||||||
objectiveTranslated = TextManager.Get("Tutorial.Objective");
|
|
||||||
CreateObjectiveFrame();
|
|
||||||
|
|
||||||
// Setup doors: Clear all requirements, unless the door is setup as locked.
|
|
||||||
foreach (var item in Item.ItemList)
|
|
||||||
{
|
|
||||||
var door = item.GetComponent<Door>();
|
|
||||||
if (door != null)
|
|
||||||
{
|
|
||||||
if (door.requiredItems.Values.None(ris => ris.None(ri => ri.Identifiers.None(i => i == "locked"))))
|
|
||||||
{
|
|
||||||
door.requiredItems.Clear();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void AddToGUIUpdateList()
|
public virtual void AddToGUIUpdateList()
|
||||||
{
|
{
|
||||||
if (GameMain.GraphicsWidth != screenResolution.X || GameMain.GraphicsHeight != screenResolution.Y || prevUIScale != GUI.Scale)
|
|
||||||
{
|
|
||||||
CreateObjectiveFrame();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (objectiveFrame != null && activeObjectives.Count > 0)
|
|
||||||
{
|
|
||||||
objectiveFrame.AddToGUIUpdateList(order: -1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (infoBox != null) infoBox.AddToGUIUpdateList(order: 100);
|
if (infoBox != null) infoBox.AddToGUIUpdateList(order: 100);
|
||||||
if (videoPlayer != null) videoPlayer.AddToGUIUpdateList(order: 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Update(float deltaTime)
|
public virtual void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
if (videoPlayer != null)
|
|
||||||
{
|
|
||||||
videoPlayer.Update();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (activeObjectives != null)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < activeObjectives.Count; i++)
|
|
||||||
{
|
|
||||||
CheckActiveObjectives(activeObjectives[i], deltaTime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void CloseActiveContentGUI()
|
|
||||||
{
|
|
||||||
if (videoPlayer.IsPlaying)
|
|
||||||
{
|
|
||||||
videoPlayer.Stop();
|
|
||||||
}
|
|
||||||
else if (infoBox != null)
|
|
||||||
{
|
|
||||||
CloseInfoFrame(null, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual IEnumerable<object> UpdateState()
|
public virtual IEnumerable<object> UpdateState()
|
||||||
@@ -247,231 +134,6 @@ namespace Barotrauma.Tutorials
|
|||||||
yield return CoroutineStatus.Success;
|
yield return CoroutineStatus.Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected bool Restart(GUIButton button, object obj)
|
|
||||||
{
|
|
||||||
GUI.PreventPauseMenuToggle = false;
|
|
||||||
TutorialMode.StartTutorial(this);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void TriggerTutorialSegment(int index, params object[] args)
|
|
||||||
{
|
|
||||||
Inventory.draggingItem = null;
|
|
||||||
ContentRunning = true;
|
|
||||||
activeContentSegment = segments[index];
|
|
||||||
segments[index].Args = args;
|
|
||||||
|
|
||||||
string tutorialText = TextManager.GetFormatted(activeContentSegment.TextContent.GetAttributeString("tag", ""), true, args);
|
|
||||||
tutorialText = TextManager.ParseInputTypes(tutorialText);
|
|
||||||
string objectiveText = string.Empty;
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(activeContentSegment.Objective))
|
|
||||||
{
|
|
||||||
if (args.Length == 0)
|
|
||||||
{
|
|
||||||
objectiveText = activeContentSegment.Objective;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
objectiveText = string.Format(activeContentSegment.Objective, args);
|
|
||||||
}
|
|
||||||
objectiveText = TextManager.ParseInputTypes(objectiveText);
|
|
||||||
activeContentSegment.Objective = objectiveText;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
activeContentSegment.IsTriggered = true; // Complete at this stage only if no related objective
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
switch (activeContentSegment.ContentType)
|
|
||||||
{
|
|
||||||
case TutorialContentTypes.None:
|
|
||||||
break;
|
|
||||||
case TutorialContentTypes.Video:
|
|
||||||
infoBox = CreateInfoFrame(TextManager.Get(activeContentSegment.Id), tutorialText,
|
|
||||||
activeContentSegment.TextContent.GetAttributeInt("width", 300),
|
|
||||||
activeContentSegment.TextContent.GetAttributeInt("height", 80),
|
|
||||||
activeContentSegment.TextContent.GetAttributeString("anchor", "Center"), true, () => LoadVideo(activeContentSegment));
|
|
||||||
break;
|
|
||||||
case TutorialContentTypes.ManualVideo:
|
|
||||||
infoBox = CreateInfoFrame(TextManager.Get(activeContentSegment.Id), tutorialText,
|
|
||||||
activeContentSegment.TextContent.GetAttributeInt("width", 300),
|
|
||||||
activeContentSegment.TextContent.GetAttributeInt("height", 80),
|
|
||||||
activeContentSegment.TextContent.GetAttributeString("anchor", "Center"), true, StopCurrentContentSegment, () => LoadVideo(activeContentSegment, false));
|
|
||||||
break;
|
|
||||||
case TutorialContentTypes.TextOnly:
|
|
||||||
infoBox = CreateInfoFrame(TextManager.Get(activeContentSegment.Id), tutorialText,
|
|
||||||
activeContentSegment.TextContent.GetAttributeInt("width", 300),
|
|
||||||
activeContentSegment.TextContent.GetAttributeInt("height", 80),
|
|
||||||
activeContentSegment.TextContent.GetAttributeString("anchor", "Center"), true, StopCurrentContentSegment);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public virtual void Stop()
|
|
||||||
{
|
|
||||||
started = ContentRunning = Initialized = false;
|
|
||||||
infoBox = null;
|
|
||||||
if (videoPlayer != null)
|
|
||||||
{
|
|
||||||
videoPlayer.Remove();
|
|
||||||
videoPlayer = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Objectives
|
|
||||||
private void CreateObjectiveFrame()
|
|
||||||
{
|
|
||||||
holderFrame = new GUIFrame(new RectTransform(new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight), GUI.Canvas, Anchor.Center));
|
|
||||||
objectiveFrame = new GUIFrame(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.ObjectiveAnchor, holderFrame.RectTransform), style: null);
|
|
||||||
|
|
||||||
for (int i = 0; i < activeObjectives.Count; i++)
|
|
||||||
{
|
|
||||||
CreateObjectiveGUI(activeObjectives[i], i, activeObjectives[i].ContentType);
|
|
||||||
}
|
|
||||||
|
|
||||||
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
|
||||||
prevUIScale = GUI.Scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void StopCurrentContentSegment()
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(activeContentSegment.Objective))
|
|
||||||
{
|
|
||||||
AddNewObjective(activeContentSegment, activeContentSegment.ContentType);
|
|
||||||
}
|
|
||||||
|
|
||||||
activeContentSegment = null;
|
|
||||||
ContentRunning = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void CheckActiveObjectives(TutorialSegment objective, float deltaTime)
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected bool HasObjective(TutorialSegment segment)
|
|
||||||
{
|
|
||||||
return activeObjectives.Contains(segment);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void AddNewObjective(TutorialSegment segment, TutorialContentTypes type)
|
|
||||||
{
|
|
||||||
activeObjectives.Add(segment);
|
|
||||||
CreateObjectiveGUI(segment, activeObjectives.Count - 1, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CreateObjectiveGUI(TutorialSegment segment, int index, TutorialContentTypes type)
|
|
||||||
{
|
|
||||||
Point replayButtonSize = new Point((int)(GUI.ObjectiveNameFont.MeasureString(segment.Objective).X * GUI.Scale), (int)(GUI.ObjectiveNameFont.MeasureString(segment.Objective).Y * 1.45f * GUI.Scale));
|
|
||||||
|
|
||||||
segment.ReplayButton = new GUIButton(new RectTransform(replayButtonSize, objectiveFrame.RectTransform, Anchor.TopRight, Pivot.TopRight) { AbsoluteOffset = new Point(0, (replayButtonSize.Y + (int)(20f * GUI.Scale)) * index) }, style: null);
|
|
||||||
segment.ReplayButton.OnClicked += (GUIButton btn, object userdata) =>
|
|
||||||
{
|
|
||||||
if (type == TutorialContentTypes.Video)
|
|
||||||
{
|
|
||||||
ReplaySegmentVideo(segment);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ShowSegmentText(segment);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
string objectiveText = TextManager.ParseInputTypes(objectiveTranslated);
|
|
||||||
int yOffset = (int)((GUI.ObjectiveNameFont.MeasureString(objectiveText).Y / 2f + 5));
|
|
||||||
segment.LinkedTitle = new GUITextBlock(new RectTransform(new Point((int)GUI.ObjectiveNameFont.MeasureString(objectiveText).X, yOffset), segment.ReplayButton.RectTransform, Anchor.CenterRight, Pivot.BottomRight) { AbsoluteOffset = new Point((int)(-10 * GUI.Scale), 0) },
|
|
||||||
objectiveText, textColor: Color.White, font: GUI.ObjectiveTitleFont, textAlignment: Alignment.CenterRight);
|
|
||||||
segment.LinkedText = new GUITextBlock(new RectTransform(new Point(replayButtonSize.X, yOffset), segment.ReplayButton.RectTransform, Anchor.Center, Pivot.TopCenter) { AbsoluteOffset = new Point((int)(10 * GUI.Scale), 0) },
|
|
||||||
TextManager.ParseInputTypes(segment.Objective), textColor: new Color(4, 180, 108), font: GUI.ObjectiveNameFont, textAlignment: Alignment.CenterRight);
|
|
||||||
|
|
||||||
segment.LinkedTitle.Color = segment.LinkedTitle.HoverColor = segment.LinkedTitle.PressedColor = segment.LinkedTitle.SelectedColor = Color.Transparent;
|
|
||||||
segment.LinkedText.Color = segment.LinkedText.HoverColor = segment.LinkedText.PressedColor = segment.LinkedText.SelectedColor = Color.Transparent;
|
|
||||||
segment.ReplayButton.Color = segment.ReplayButton.HoverColor = segment.ReplayButton.PressedColor = segment.ReplayButton.SelectedColor = Color.Transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ReplaySegmentVideo(TutorialSegment segment)
|
|
||||||
{
|
|
||||||
if (ContentRunning) return;
|
|
||||||
ContentRunning = true;
|
|
||||||
videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, callback: () => ContentRunning = false);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ShowSegmentText(TutorialSegment segment)
|
|
||||||
{
|
|
||||||
if (ContentRunning) return;
|
|
||||||
Inventory.draggingItem = null;
|
|
||||||
ContentRunning = true;
|
|
||||||
|
|
||||||
string tutorialText = TextManager.GetFormatted(segment.TextContent.GetAttributeString("tag", ""), true, segment.Args);
|
|
||||||
|
|
||||||
Action videoAction = null;
|
|
||||||
|
|
||||||
if (segment.ContentType != TutorialContentTypes.TextOnly)
|
|
||||||
{
|
|
||||||
videoAction = () => LoadVideo(segment, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
infoBox = CreateInfoFrame(TextManager.Get(segment.Id), tutorialText,
|
|
||||||
segment.TextContent.GetAttributeInt("width", 300),
|
|
||||||
segment.TextContent.GetAttributeInt("height", 80),
|
|
||||||
segment.TextContent.GetAttributeString("anchor", "Center"), true, () => ContentRunning = false, videoAction);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void RemoveCompletedObjective(TutorialSegment segment)
|
|
||||||
{
|
|
||||||
if (!HasObjective(segment)) return;
|
|
||||||
segment.IsTriggered = true;
|
|
||||||
segment.ReplayButton.OnClicked = null;
|
|
||||||
|
|
||||||
int checkMarkHeight = (int)(segment.ReplayButton.Rect.Height * 1.2f);
|
|
||||||
int checkMarkWidth = (int)(checkMarkHeight * 0.93f);
|
|
||||||
|
|
||||||
Color color = new Color(4, 180, 108);
|
|
||||||
|
|
||||||
int objectiveTextWidth = segment.LinkedText.Rect.Width;
|
|
||||||
int objectiveTitleWidth = segment.LinkedTitle.Rect.Width;
|
|
||||||
|
|
||||||
RectTransform rectTA;
|
|
||||||
if (objectiveTextWidth > objectiveTitleWidth)
|
|
||||||
{
|
|
||||||
rectTA = new RectTransform(new Point(checkMarkWidth, checkMarkHeight), segment.ReplayButton.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft);
|
|
||||||
rectTA.AbsoluteOffset = new Point(-rectTA.Rect.Width - 5, 0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rectTA = new RectTransform(new Point(checkMarkWidth, checkMarkHeight), segment.ReplayButton.RectTransform, Anchor.BottomLeft, Pivot.BottomLeft);
|
|
||||||
rectTA.AbsoluteOffset = new Point(-rectTA.Rect.Width - 5 - (objectiveTitleWidth), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
GUIImage checkmark = new GUIImage(rectTA, "CheckMark");
|
|
||||||
checkmark.Color = checkmark.SelectedColor = checkmark.HoverColor = checkmark.PressedColor = color;
|
|
||||||
|
|
||||||
RectTransform rectTB = new RectTransform(new Vector2(1.1f, .8f), segment.LinkedText.RectTransform, Anchor.Center, Pivot.Center);
|
|
||||||
GUIImage stroke = new GUIImage(rectTB, "Stroke");
|
|
||||||
stroke.Color = stroke.SelectedColor = stroke.HoverColor = stroke.PressedColor = color;
|
|
||||||
|
|
||||||
CoroutineManager.StartCoroutine(WaitForObjectiveEnd(segment));
|
|
||||||
}
|
|
||||||
|
|
||||||
private IEnumerable<object> WaitForObjectiveEnd(TutorialSegment objective)
|
|
||||||
{
|
|
||||||
yield return new WaitForSeconds(2.0f);
|
|
||||||
objectiveFrame.RemoveChild(objective.ReplayButton);
|
|
||||||
activeObjectives.Remove(objective);
|
|
||||||
|
|
||||||
for (int i = 0; i < activeObjectives.Count; i++)
|
|
||||||
{
|
|
||||||
activeObjectives[i].ReplayButton.RectTransform.AbsoluteOffset = new Point(0, (activeObjectives[i].ReplayButton.Rect.Height + 20) * i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region InfoFrame
|
|
||||||
protected bool CloseInfoFrame(GUIButton button, object userData)
|
protected bool CloseInfoFrame(GUIButton button, object userData)
|
||||||
{
|
{
|
||||||
infoBox = null;
|
infoBox = null;
|
||||||
@@ -479,130 +141,87 @@ namespace Barotrauma.Tutorials
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected GUIComponent CreateInfoFrame(string title, string text, int width = 300, int height = 80, string anchorStr = "", bool hasButton = false, Action callback = null, Action showVideo = null)
|
protected GUIComponent CreateInfoFrame(string text, bool hasButton = false, Action callback = null)
|
||||||
{
|
{
|
||||||
if (hasButton) height += 60;
|
int width = 300;
|
||||||
|
int height = hasButton ? 110 : 80;
|
||||||
|
|
||||||
|
string wrappedText = ToolBox.WrapText(text, width, GUI.Font);
|
||||||
|
|
||||||
|
height += wrappedText.Split('\n').Length * 25;
|
||||||
|
|
||||||
|
var infoBlock = new GUIFrame(new RectTransform(new Point(width, height), GUI.Canvas, Anchor.TopRight) { AbsoluteOffset = new Point(20) });
|
||||||
|
infoBlock.Flash(Color.Green);
|
||||||
|
|
||||||
|
var textBlock = new GUITextBlock(new RectTransform(new Vector2(0.9f, 0.7f), infoBlock.RectTransform, Anchor.Center),
|
||||||
|
text, wrap: true);
|
||||||
|
|
||||||
|
infoBoxClosedCallback = callback;
|
||||||
|
|
||||||
|
if (hasButton)
|
||||||
|
{
|
||||||
|
var okButton = new GUIButton(new RectTransform(new Point(160, 50), infoBlock.RectTransform, Anchor.BottomCenter, Pivot.TopCenter) { AbsoluteOffset = new Point(0, -10) },
|
||||||
|
TextManager.Get("OK"))
|
||||||
|
{
|
||||||
|
OnClicked = CloseInfoFrame
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GUI.PlayUISound(GUISoundType.UIMessage);
|
||||||
|
|
||||||
|
return infoBlock;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected GUIComponent CreateInfoFrame(string title, string text, int width, int height, string anchorStr, bool hasButton = false, Action callback = null)
|
||||||
|
{
|
||||||
|
if (hasButton) height += 30;
|
||||||
|
|
||||||
string wrappedText = ToolBox.WrapText(text, width, GUI.Font);
|
string wrappedText = ToolBox.WrapText(text, width, GUI.Font);
|
||||||
|
|
||||||
height += (int)(GUI.Font.MeasureString(wrappedText).Y + 50);
|
height += wrappedText.Split('\n').Length * 25;
|
||||||
|
|
||||||
if (title.Length > 0)
|
if (title.Length > 0)
|
||||||
{
|
{
|
||||||
height += 35;
|
height += 35;
|
||||||
}
|
}
|
||||||
|
|
||||||
Anchor anchor = Anchor.TopRight;
|
Anchor anchor = Anchor.TopRight;
|
||||||
|
Enum.TryParse(anchorStr, out anchor);
|
||||||
|
|
||||||
if (anchorStr != string.Empty)
|
var infoBlock = new GUIFrame(new RectTransform(new Point((int)(width * GUI.Scale), (int)(height * GUI.Scale)), GUI.Canvas, anchor) { AbsoluteOffset = new Point(20) });
|
||||||
{
|
|
||||||
Enum.TryParse(anchorStr, out anchor);
|
|
||||||
}
|
|
||||||
|
|
||||||
var background = new GUIFrame(new RectTransform(new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight), GUI.Canvas, Anchor.Center), "InnerFrame", new Color(0, 0, 0, 1f));
|
|
||||||
|
|
||||||
var infoBlock = new GUIFrame(new RectTransform(new Point((int)(width * GUI.Scale), (int)(height * GUI.Scale)), background.RectTransform, anchor) { AbsoluteOffset = new Point(20) });
|
|
||||||
infoBlock.Flash(Color.Green);
|
infoBlock.Flash(Color.Green);
|
||||||
|
|
||||||
var infoContent = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.8f), infoBlock.RectTransform, Anchor.Center))
|
|
||||||
{
|
|
||||||
Stretch = true,
|
|
||||||
AbsoluteSpacing = 5
|
|
||||||
};
|
|
||||||
|
|
||||||
if (title.Length > 0)
|
if (title.Length > 0)
|
||||||
{
|
{
|
||||||
var titleBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoContent.RectTransform),
|
var titleBlock = new GUITextBlock(new RectTransform(new Vector2(1f, .35f), infoBlock.RectTransform, Anchor.TopCenter,
|
||||||
title, font: GUI.VideoTitleFont, textAlignment: Alignment.Center, textColor: new Color(253, 174, 0));
|
Pivot.TopCenter), title, font: GUI.VideoTitleFont, textAlignment: Alignment.Center, textColor: new Color(253, 174, 0));
|
||||||
titleBlock.RectTransform.IsFixedSize = true;
|
titleBlock.TextScale = GUI.Scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
var textBlock = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.0f), infoContent.RectTransform), text, wrap: true);
|
var textBlock = new GUITextBlock(new RectTransform(new Vector2(0.9f, 1f), infoBlock.RectTransform, Anchor.BottomCenter),
|
||||||
textBlock.RectTransform.IsFixedSize = true;
|
text, wrap: true);
|
||||||
|
textBlock.TextScale = GUI.Scale;
|
||||||
|
|
||||||
infoBoxClosedCallback = callback;
|
infoBoxClosedCallback = callback;
|
||||||
|
|
||||||
if (hasButton)
|
if (hasButton)
|
||||||
{
|
{
|
||||||
var buttonContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.3f), infoContent.RectTransform) { MinSize = new Point(0, 30), MaxSize = new Point((int) infoContent.Rect.X, 60) }, isHorizontal: true)
|
var okButton = new GUIButton(new RectTransform(new Point(160, 50), infoBlock.RectTransform, Anchor.BottomCenter, Pivot.TopCenter) { AbsoluteOffset = new Point(0, -10) },
|
||||||
{
|
TextManager.Get("OK"))
|
||||||
Stretch = true,
|
|
||||||
RelativeSpacing = 0.1f
|
|
||||||
};
|
|
||||||
buttonContainer.RectTransform.IsFixedSize = true;
|
|
||||||
|
|
||||||
if (showVideo != null)
|
|
||||||
{
|
|
||||||
var videoButton = new GUIButton(new RectTransform(new Vector2(0.4f, 1.0f), buttonContainer.RectTransform),
|
|
||||||
TextManager.Get("Video"), style: "GUIButtonLarge")
|
|
||||||
{
|
|
||||||
OnClicked = (GUIButton button, object obj) =>
|
|
||||||
{
|
|
||||||
showVideo();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var okButton = new GUIButton(new RectTransform(new Vector2(0.6f, 1.0f), buttonContainer.RectTransform),
|
|
||||||
TextManager.Get("OK"), style: "GUIButtonLarge")
|
|
||||||
{
|
{
|
||||||
OnClicked = CloseInfoFrame
|
OnClicked = CloseInfoFrame
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
infoBlock.RectTransform.NonScaledSize = new Point(infoBlock.Rect.Width, (int)(infoContent.Children.Sum(c => c.Rect.Height + infoContent.AbsoluteSpacing) / infoContent.RectTransform.RelativeSize.Y));
|
|
||||||
|
|
||||||
GUI.PlayUISound(GUISoundType.UIMessage);
|
GUI.PlayUISound(GUISoundType.UIMessage);
|
||||||
|
|
||||||
return background;
|
return infoBlock;
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Video
|
|
||||||
protected void LoadVideo(TutorialSegment segment, bool showText = true)
|
|
||||||
{
|
|
||||||
if (videoPlayer == null) videoPlayer = new VideoPlayer();
|
|
||||||
if (showText)
|
|
||||||
{
|
|
||||||
videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), new VideoPlayer.TextSettings(segment.VideoContent), segment.Id, true, segment.Objective, StopCurrentContentSegment);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
videoPlayer.LoadContent(playableContentPath, new VideoPlayer.VideoSettings(segment.VideoContent), null, segment.Id, true, segment.Objective, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Highlights
|
|
||||||
protected void HighlightInventorySlot(Inventory inventory, string identifier, Color color, float fadeInDuration, float fadeOutDuration, float scaleUpAmount)
|
|
||||||
{
|
|
||||||
if (inventory.slots == null) { return; }
|
|
||||||
for (int i = 0; i < inventory.Items.Length; i++)
|
|
||||||
{
|
|
||||||
if (inventory.Items[i] != null && inventory.Items[i].Prefab.Identifier == identifier)
|
|
||||||
{
|
|
||||||
HighlightInventorySlot(inventory, i, color, fadeInDuration, fadeOutDuration, scaleUpAmount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void HighlightInventorySlotWithTag(Inventory inventory, string tag, Color color, float fadeInDuration, float fadeOutDuration, float scaleUpAmount)
|
protected bool Restart(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
if (inventory.slots == null) { return; }
|
TutorialMode.StartTutorial(this);
|
||||||
for (int i = 0; i < inventory.Items.Length; i++)
|
return true;
|
||||||
{
|
|
||||||
if (inventory.Items[i] != null && inventory.Items[i].HasTag(tag))
|
|
||||||
{
|
|
||||||
HighlightInventorySlot(inventory, i, color, fadeInDuration, fadeOutDuration, scaleUpAmount);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void HighlightInventorySlot(Inventory inventory, int index, Color color, float fadeInDuration, float fadeOutDuration, float scaleUpAmount)
|
|
||||||
{
|
|
||||||
if (inventory.slots == null || index < 0 || inventory.slots[index].HighlightTimer > 0) return;
|
|
||||||
inventory.slots[index].ShowBorderHighlight(color, fadeInDuration, fadeOutDuration, scaleUpAmount);
|
|
||||||
}
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
class TutorialMode : GameMode
|
class TutorialMode : GameMode
|
||||||
{
|
{
|
||||||
public Tutorial Tutorial;
|
public Tutorial tutorial;
|
||||||
|
|
||||||
public static void StartTutorial(Tutorial tutorial)
|
public static void StartTutorial(Tutorial tutorial)
|
||||||
{
|
{
|
||||||
@@ -19,20 +19,18 @@ namespace Barotrauma
|
|||||||
public override void Start()
|
public override void Start()
|
||||||
{
|
{
|
||||||
base.Start();
|
base.Start();
|
||||||
GameMain.GameSession.CrewManager = new CrewManager(true);
|
tutorial.Start();
|
||||||
Tutorial.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void AddToGUIUpdateList()
|
public override void AddToGUIUpdateList()
|
||||||
{
|
{
|
||||||
base.AddToGUIUpdateList();
|
tutorial.AddToGUIUpdateList();
|
||||||
Tutorial.AddToGUIUpdateList();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
base.Update(deltaTime);
|
base.Update(deltaTime);
|
||||||
Tutorial.Update(deltaTime);
|
tutorial.Update(deltaTime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -657,15 +657,13 @@ namespace Barotrauma
|
|||||||
{ Stretch = true, RelativeSpacing = 0.02f };
|
{ Stretch = true, RelativeSpacing = 0.02f };
|
||||||
|
|
||||||
var inputNames = Enum.GetValues(typeof(InputType));
|
var inputNames = Enum.GetValues(typeof(InputType));
|
||||||
var inputNameBlocks = new List<GUITextBlock>();
|
|
||||||
for (int i = 0; i < inputNames.Length; i++)
|
for (int i = 0; i < inputNames.Length; i++)
|
||||||
{
|
{
|
||||||
var inputContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.06f),(i <= (inputNames.Length / 2.2f) ? inputColumnLeft : inputColumnRight).RectTransform))
|
var inputContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.06f),(i <= (inputNames.Length / 2.2f) ? inputColumnLeft : inputColumnRight).RectTransform))
|
||||||
{ Stretch = true, IsHorizontal = true, RelativeSpacing = 0.05f, Color = new Color(12, 14, 15, 215) };
|
{ Stretch = true, IsHorizontal = true, RelativeSpacing = 0.05f, Color = new Color(12, 14, 15, 215) };
|
||||||
var inputName = new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), inputContainer.RectTransform, Anchor.TopLeft) { MinSize = new Point(150, 0) },
|
new GUITextBlock(new RectTransform(new Vector2(0.3f, 1.0f), inputContainer.RectTransform, Anchor.TopLeft) { MinSize = new Point(150, 0) },
|
||||||
TextManager.Get("InputType." + ((InputType)i)) + ": ", font: GUI.SmallFont) { ForceUpperCase = true };
|
TextManager.Get("InputType." + ((InputType)i)) + ": ", font: GUI.SmallFont) { ForceUpperCase = true };
|
||||||
inputNameBlocks.Add(inputName);
|
var keyBox = new GUITextBox(new RectTransform(new Vector2(0.7f, 1.0f), inputContainer.RectTransform),
|
||||||
var keyBox = new GUITextBox(new RectTransform(new Vector2(0.5f, 1.0f), inputContainer.RectTransform),
|
|
||||||
text: keyMapping[i].ToString(), font: GUI.SmallFont)
|
text: keyMapping[i].ToString(), font: GUI.SmallFont)
|
||||||
{
|
{
|
||||||
UserData = i
|
UserData = i
|
||||||
@@ -674,14 +672,12 @@ namespace Barotrauma
|
|||||||
keyBox.SelectedColor = Color.Gold * 0.3f;
|
keyBox.SelectedColor = Color.Gold * 0.3f;
|
||||||
}
|
}
|
||||||
|
|
||||||
GUITextBlock.AutoScaleAndNormalize(inputNameBlocks);
|
|
||||||
|
|
||||||
var resetControlsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.07f), controlsLayoutGroup.RectTransform), isHorizontal: true)
|
var resetControlsHolder = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.07f), controlsLayoutGroup.RectTransform), isHorizontal: true)
|
||||||
{
|
{
|
||||||
RelativeSpacing = 0.02f
|
RelativeSpacing = 0.02f
|
||||||
};
|
};
|
||||||
|
|
||||||
var defaultBindingsButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetDefaultBindings"))
|
new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetDefaultBindings"))
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("SetDefaultBindingsToolTip"),
|
ToolTip = TextManager.Get("SetDefaultBindingsToolTip"),
|
||||||
OnClicked = (button, data) =>
|
OnClicked = (button, data) =>
|
||||||
@@ -691,7 +687,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var legacyBindingsButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetLegacyBindings"))
|
new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), resetControlsHolder.RectTransform), TextManager.Get("SetLegacyBindings"))
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("SetLegacyBindingsToolTip"),
|
ToolTip = TextManager.Get("SetLegacyBindingsToolTip"),
|
||||||
OnClicked = (button, data) =>
|
OnClicked = (button, data) =>
|
||||||
@@ -701,8 +697,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
GUITextBlock.AutoScaleAndNormalize(defaultBindingsButton.TextBlock, legacyBindingsButton.TextBlock);
|
|
||||||
|
|
||||||
//spacing
|
//spacing
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
|
new GUIFrame(new RectTransform(new Vector2(1.0f, 0.02f), generalLayoutGroup.RectTransform), style: null);
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,6 @@ namespace Barotrauma
|
|||||||
limbSlotIcons.Add(InvSlotType.Head, new Sprite("Content/UI/IconAtlas.png", new Rectangle(896 + margin, 128 + margin, 128 - margin * 2, 128 - margin * 2)));
|
limbSlotIcons.Add(InvSlotType.Head, new Sprite("Content/UI/IconAtlas.png", new Rectangle(896 + margin, 128 + margin, 128 - margin * 2, 128 - margin * 2)));
|
||||||
limbSlotIcons.Add(InvSlotType.LeftHand, new Sprite("Content/UI/IconAtlas.png", new Rectangle(640 + margin, 383 + margin, 128 - margin * 2, 128 - margin * 2)));
|
limbSlotIcons.Add(InvSlotType.LeftHand, new Sprite("Content/UI/IconAtlas.png", new Rectangle(640 + margin, 383 + margin, 128 - margin * 2, 128 - margin * 2)));
|
||||||
limbSlotIcons.Add(InvSlotType.RightHand, new Sprite("Content/UI/IconAtlas.png", new Rectangle(768 + margin, 383 + margin, 128 - margin * 2, 128 - margin * 2)));
|
limbSlotIcons.Add(InvSlotType.RightHand, new Sprite("Content/UI/IconAtlas.png", new Rectangle(768 + margin, 383 + margin, 128 - margin * 2, 128 - margin * 2)));
|
||||||
limbSlotIcons.Add(InvSlotType.OuterClothes, new Sprite("Content/UI/IconAtlas.png", new Rectangle(768 + margin, 896 + margin, 128 - margin * 2, 128 - margin * 2)));
|
|
||||||
}
|
}
|
||||||
SlotPositions = new Vector2[SlotTypes.Length];
|
SlotPositions = new Vector2[SlotTypes.Length];
|
||||||
CurrentLayout = Layout.Default;
|
CurrentLayout = Layout.Default;
|
||||||
@@ -793,7 +792,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
base.Draw(spriteBatch);
|
base.Draw(spriteBatch);
|
||||||
|
|
||||||
if (hideButton != null && hideButton.Visible && !Locked)
|
if (hideButton != null && hideButton.Visible)
|
||||||
{
|
{
|
||||||
hideButton.DrawManually(spriteBatch, alsoChildren: true);
|
hideButton.DrawManually(spriteBatch, alsoChildren: true);
|
||||||
}
|
}
|
||||||
@@ -835,7 +834,6 @@ namespace Barotrauma
|
|||||||
color = Color.White;
|
color = Color.White;
|
||||||
highlightedQuickUseSlot = slots[i];
|
highlightedQuickUseSlot = slots[i];
|
||||||
}
|
}
|
||||||
if (Locked) { color *= 0.3f; }
|
|
||||||
|
|
||||||
var quickUseIndicator = Items[i].AllowedSlots.Any(a => a == InvSlotType.Any) ?
|
var quickUseIndicator = Items[i].AllowedSlots.Any(a => a == InvSlotType.Any) ?
|
||||||
EquipIndicator : DropIndicator;
|
EquipIndicator : DropIndicator;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
if (light.LightSprite != null && (item.body == null || item.body.Enabled) && lightBrightness > 0.0f)
|
if (light.LightSprite != null && (item.body == null || item.body.Enabled) && lightBrightness > 0.0f)
|
||||||
{
|
{
|
||||||
light.LightSprite.Draw(spriteBatch, new Vector2(item.DrawPosition.X, -item.DrawPosition.Y), lightColor * lightBrightness, 0.0f, item.Scale, SpriteEffects.None, item.SpriteDepth - 0.0001f);
|
light.LightSprite.Draw(spriteBatch, new Vector2(item.DrawPosition.X, -item.DrawPosition.Y), lightColor * lightBrightness, 0.0f, 1.0f, Microsoft.Xna.Framework.Graphics.SpriteEffects.None, item.SpriteDepth - 0.0001f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,10 +9,6 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
partial class Deconstructor : Powered, IServerSerializable, IClientSerializable
|
partial class Deconstructor : Powered, IServerSerializable, IClientSerializable
|
||||||
{
|
{
|
||||||
public GUIButton ActivateButton
|
|
||||||
{
|
|
||||||
get { return activateButton; }
|
|
||||||
}
|
|
||||||
private GUIButton activateButton;
|
private GUIButton activateButton;
|
||||||
private GUIComponent inputInventoryHolder, outputInventoryHolder;
|
private GUIComponent inputInventoryHolder, outputInventoryHolder;
|
||||||
private GUICustomComponent inputInventoryOverlay;
|
private GUICustomComponent inputInventoryOverlay;
|
||||||
@@ -48,6 +44,7 @@ namespace Barotrauma.Items.Components
|
|||||||
Visible = false,
|
Visible = false,
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
|
|
||||||
outputInventoryHolder = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.3f), paddedFrame.RectTransform), style: null);
|
outputInventoryHolder = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.3f), paddedFrame.RectTransform), style: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +71,7 @@ namespace Barotrauma.Items.Components
|
|||||||
public override void UpdateHUD(Character character, float deltaTime, Camera cam)
|
public override void UpdateHUD(Character character, float deltaTime, Camera cam)
|
||||||
{
|
{
|
||||||
inSufficientPowerWarning.Visible = powerConsumption > 0 && voltage < minVoltage;
|
inSufficientPowerWarning.Visible = powerConsumption > 0 && voltage < minVoltage;
|
||||||
//activateButton.Enabled = !inSufficientPowerWarning.Visible;
|
activateButton.Enabled = !inSufficientPowerWarning.Visible;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool ToggleActive(GUIButton button, object obj)
|
private bool ToggleActive(GUIButton button, object obj)
|
||||||
|
|||||||
@@ -30,25 +30,25 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
partial void InitProjSpecific(XElement element)
|
partial void InitProjSpecific(XElement element)
|
||||||
{
|
{
|
||||||
var content = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.8f), GuiFrame.RectTransform, Anchor.Center))
|
powerIndicator = new GUITickBox(new RectTransform(new Point(30, 30), GuiFrame.RectTransform) { RelativeOffset = new Vector2(0.05f, 0.15f) },
|
||||||
{
|
|
||||||
Stretch = true,
|
|
||||||
RelativeSpacing = 0.05f
|
|
||||||
};
|
|
||||||
|
|
||||||
powerIndicator = new GUITickBox(new RectTransform(new Point(30, 30), content.RectTransform),
|
|
||||||
TextManager.Get("EnginePowered"), style: "IndicatorLightGreen")
|
TextManager.Get("EnginePowered"), style: "IndicatorLightGreen")
|
||||||
{
|
{
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
|
|
||||||
string powerLabel = TextManager.Get("EngineForce");
|
string powerLabel = TextManager.Get("EngineForce");
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.3f), content.RectTransform), "", textAlignment: Alignment.Center)
|
new GUITextBlock(new RectTransform(new Vector2(0.9f, 0.3f), GuiFrame.RectTransform, Anchor.BottomCenter)
|
||||||
|
{ RelativeOffset = new Vector2(0.0f, 0.4f) }, "", textAlignment: Alignment.Center)
|
||||||
{
|
{
|
||||||
TextGetter = () => { return powerLabel + ": " + (int)(targetForce) + " %"; }
|
TextGetter = () => { return powerLabel + ": " + (int)(targetForce) + " %"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
forceSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.3f), content.RectTransform), barSize: 0.2f, style: "GUISlider")
|
var sliderArea = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.25f), GuiFrame.RectTransform, Anchor.BottomCenter)
|
||||||
|
{ RelativeOffset = new Vector2(0.0f, 0.2f) }, isHorizontal: true);
|
||||||
|
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(0.2f, 1.0f), sliderArea.RectTransform), TextManager.Get("EngineBackwards"),
|
||||||
|
font: GUI.SmallFont, textAlignment: Alignment.Center);
|
||||||
|
forceSlider = new GUIScrollBar(new RectTransform(new Vector2(0.6f, 1.0f), sliderArea.RectTransform), barSize: 0.25f, style: "GUISlider")
|
||||||
{
|
{
|
||||||
Step = 0.05f,
|
Step = 0.05f,
|
||||||
OnMoved = (GUIScrollBar scrollBar, float barScroll) =>
|
OnMoved = (GUIScrollBar scrollBar, float barScroll) =>
|
||||||
@@ -66,16 +66,8 @@ namespace Barotrauma.Items.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
new GUITextBlock(new RectTransform(new Vector2(0.2f, 1.0f), sliderArea.RectTransform), TextManager.Get("EngineForwards"),
|
||||||
var textArea = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.2f), content.RectTransform), isHorizontal: true)
|
font: GUI.SmallFont, textAlignment: Alignment.Center);
|
||||||
{
|
|
||||||
Stretch = true
|
|
||||||
};
|
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), textArea.RectTransform), TextManager.Get("EngineBackwards"),
|
|
||||||
font: GUI.SmallFont, textAlignment: Alignment.CenterLeft);
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), textArea.RectTransform), TextManager.Get("EngineForwards"),
|
|
||||||
font: GUI.SmallFont, textAlignment: Alignment.CenterRight);
|
|
||||||
|
|
||||||
foreach (XElement subElement in element.Elements())
|
foreach (XElement subElement in element.Elements())
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,10 +15,6 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private GUIFrame selectedItemFrame;
|
private GUIFrame selectedItemFrame;
|
||||||
|
|
||||||
public GUIButton ActivateButton
|
|
||||||
{
|
|
||||||
get { return activateButton; }
|
|
||||||
}
|
|
||||||
private GUIButton activateButton;
|
private GUIButton activateButton;
|
||||||
|
|
||||||
private GUITextBox itemFilterBox;
|
private GUITextBox itemFilterBox;
|
||||||
@@ -26,10 +22,6 @@ namespace Barotrauma.Items.Components
|
|||||||
private GUIComponent inputInventoryHolder, outputInventoryHolder;
|
private GUIComponent inputInventoryHolder, outputInventoryHolder;
|
||||||
private GUICustomComponent inputInventoryOverlay, outputInventoryOverlay;
|
private GUICustomComponent inputInventoryOverlay, outputInventoryOverlay;
|
||||||
|
|
||||||
public FabricationRecipe SelectedItem
|
|
||||||
{
|
|
||||||
get { return selectedItem; }
|
|
||||||
}
|
|
||||||
private FabricationRecipe selectedItem;
|
private FabricationRecipe selectedItem;
|
||||||
|
|
||||||
private GUIComponent inSufficientPowerWarning;
|
private GUIComponent inSufficientPowerWarning;
|
||||||
@@ -81,31 +73,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
|
|
||||||
CreateRecipes();
|
|
||||||
|
|
||||||
activateButton = new GUIButton(new RectTransform(new Vector2(0.8f, 0.07f), paddedFrame.RectTransform),
|
|
||||||
TextManager.Get("FabricatorCreate"), style: "GUIButtonLarge")
|
|
||||||
{
|
|
||||||
OnClicked = StartButtonClicked,
|
|
||||||
UserData = selectedItem,
|
|
||||||
Enabled = false
|
|
||||||
};
|
|
||||||
|
|
||||||
inSufficientPowerWarning = new GUITextBlock(new RectTransform(Vector2.One, activateButton.RectTransform), TextManager.Get("FabricatorNoPower"),
|
|
||||||
textColor: Color.Orange, textAlignment: Alignment.Center, color: Color.Black, style: "OuterGlow")
|
|
||||||
{
|
|
||||||
HoverColor = Color.Black,
|
|
||||||
IgnoreLayoutGroups = true,
|
|
||||||
Visible = false,
|
|
||||||
CanBeFocused = false
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void CreateRecipes()
|
|
||||||
{
|
|
||||||
itemList.Content.RectTransform.ClearChildren();
|
|
||||||
|
|
||||||
foreach (FabricationRecipe fi in fabricationRecipes)
|
foreach (FabricationRecipe fi in fabricationRecipes)
|
||||||
{
|
{
|
||||||
GUIFrame frame = new GUIFrame(new RectTransform(new Point(itemList.Rect.Width, 30), itemList.Content.RectTransform), style: null)
|
GUIFrame frame = new GUIFrame(new RectTransform(new Point(itemList.Rect.Width, 30), itemList.Content.RectTransform), style: null)
|
||||||
@@ -133,6 +101,23 @@ namespace Barotrauma.Items.Components
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activateButton = new GUIButton(new RectTransform(new Vector2(0.8f, 0.07f), paddedFrame.RectTransform),
|
||||||
|
TextManager.Get("FabricatorCreate"), style: "GUIButtonLarge")
|
||||||
|
{
|
||||||
|
OnClicked = StartButtonClicked,
|
||||||
|
UserData = selectedItem,
|
||||||
|
Enabled = false
|
||||||
|
};
|
||||||
|
|
||||||
|
inSufficientPowerWarning = new GUITextBlock(new RectTransform(Vector2.One, activateButton.RectTransform), TextManager.Get("FabricatorNoPower"),
|
||||||
|
textColor: Color.Orange, textAlignment: Alignment.Center, color: Color.Black, style: "OuterGlow")
|
||||||
|
{
|
||||||
|
HoverColor = Color.Black,
|
||||||
|
IgnoreLayoutGroups = true,
|
||||||
|
Visible = false,
|
||||||
|
CanBeFocused = false
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
partial void OnItemLoadedProjSpecific()
|
partial void OnItemLoadedProjSpecific()
|
||||||
@@ -164,15 +149,13 @@ namespace Barotrauma.Items.Components
|
|||||||
return string.Compare(item1.DisplayName, item2.DisplayName);
|
return string.Compare(item1.DisplayName, item2.DisplayName);
|
||||||
});
|
});
|
||||||
|
|
||||||
var sufficientSkillsText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.15f), itemList.Content.RectTransform),
|
var sufficientSkillsText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.15f), itemList.Content.RectTransform), "Sufficient skills to fabricate:", textColor: Color.LightGreen)
|
||||||
TextManager.Get("fabricatorsufficientskills", returnNull: true) ?? "Sufficient skills to fabricate", textColor: Color.LightGreen)
|
|
||||||
{
|
{
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
sufficientSkillsText.RectTransform.SetAsFirstChild();
|
sufficientSkillsText.RectTransform.SetAsFirstChild();
|
||||||
|
|
||||||
var insufficientSkillsText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.15f), itemList.Content.RectTransform),
|
var insufficientSkillsText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.15f), itemList.Content.RectTransform), "Insufficient skills to fabricate:", textColor: Color.Orange)
|
||||||
TextManager.Get("fabricatorinsufficientskills", returnNull: true) ?? "Insufficient skills to fabricate", textColor: Color.Orange)
|
|
||||||
{
|
{
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
@@ -258,7 +241,6 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawOutputOverLay(SpriteBatch spriteBatch, GUICustomComponent overlayComponent)
|
private void DrawOutputOverLay(SpriteBatch spriteBatch, GUICustomComponent overlayComponent)
|
||||||
{
|
{
|
||||||
overlayComponent.RectTransform.SetAsLastChild();
|
overlayComponent.RectTransform.SetAsLastChild();
|
||||||
@@ -381,29 +363,6 @@ namespace Barotrauma.Items.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HighlightRecipe(string identifier, Color color)
|
|
||||||
{
|
|
||||||
foreach (GUIComponent child in itemList.Content.Children)
|
|
||||||
{
|
|
||||||
FabricationRecipe recipe = child.UserData as FabricationRecipe;
|
|
||||||
if (recipe?.DisplayName == null) { continue; }
|
|
||||||
if (recipe.TargetItem.Identifier == identifier)
|
|
||||||
{
|
|
||||||
if (child.FlashTimer > 0.0f) return;
|
|
||||||
child.Flash(color, 1.5f, false);
|
|
||||||
|
|
||||||
for (int i = 0; i < child.CountChildren; i++)
|
|
||||||
{
|
|
||||||
var grandChild = child.GetChild(i);
|
|
||||||
if (grandChild is GUITextBlock) continue;
|
|
||||||
grandChild.Flash(color, 1.5f, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool StartButtonClicked(GUIButton button, object obj)
|
private bool StartButtonClicked(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
if (selectedItem == null) { return false; }
|
if (selectedItem == null) { return false; }
|
||||||
|
|||||||
@@ -10,10 +10,6 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
partial class Pump : Powered, IServerSerializable, IClientSerializable
|
partial class Pump : Powered, IServerSerializable, IClientSerializable
|
||||||
{
|
{
|
||||||
public GUIScrollBar IsActiveSlider
|
|
||||||
{
|
|
||||||
get { return isActiveSlider; }
|
|
||||||
}
|
|
||||||
private GUIScrollBar isActiveSlider;
|
private GUIScrollBar isActiveSlider;
|
||||||
private GUIScrollBar pumpSpeedSlider;
|
private GUIScrollBar pumpSpeedSlider;
|
||||||
private GUITickBox powerIndicator;
|
private GUITickBox powerIndicator;
|
||||||
@@ -53,6 +49,7 @@ namespace Barotrauma.Items.Components
|
|||||||
};
|
};
|
||||||
var sliderHandle = isActiveSlider.GetChild<GUIButton>();
|
var sliderHandle = isActiveSlider.GetChild<GUIButton>();
|
||||||
sliderHandle.RectTransform.NonScaledSize = new Point(84, sliderHandle.Rect.Height);
|
sliderHandle.RectTransform.NonScaledSize = new Point(84, sliderHandle.Rect.Height);
|
||||||
|
|
||||||
isActiveSlider.OnMoved = (GUIScrollBar scrollBar, float barScroll) =>
|
isActiveSlider.OnMoved = (GUIScrollBar scrollBar, float barScroll) =>
|
||||||
{
|
{
|
||||||
bool active = scrollBar.BarScroll < 0.5f;
|
bool active = scrollBar.BarScroll < 0.5f;
|
||||||
|
|||||||
@@ -11,16 +11,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
partial class Reactor : Powered, IServerSerializable, IClientSerializable
|
partial class Reactor : Powered, IServerSerializable, IClientSerializable
|
||||||
{
|
{
|
||||||
public GUIScrollBar AutoTempSlider
|
|
||||||
{
|
|
||||||
get { return autoTempSlider; }
|
|
||||||
}
|
|
||||||
private GUIScrollBar autoTempSlider;
|
private GUIScrollBar autoTempSlider;
|
||||||
|
|
||||||
public GUIScrollBar OnOffSwitch
|
|
||||||
{
|
|
||||||
get { return onOffSwitch; }
|
|
||||||
}
|
|
||||||
private GUIScrollBar onOffSwitch;
|
private GUIScrollBar onOffSwitch;
|
||||||
|
|
||||||
private const int GraphSize = 25;
|
private const int GraphSize = 25;
|
||||||
@@ -36,16 +27,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private Sprite graphLine;
|
private Sprite graphLine;
|
||||||
|
|
||||||
public GUIScrollBar FissionRateScrollBar
|
|
||||||
{
|
|
||||||
get { return fissionRateScrollBar; }
|
|
||||||
}
|
|
||||||
private GUIScrollBar fissionRateScrollBar;
|
private GUIScrollBar fissionRateScrollBar;
|
||||||
|
|
||||||
public GUIScrollBar TurbineOutputScrollBar
|
|
||||||
{
|
|
||||||
get { return turbineOutputScrollBar; }
|
|
||||||
}
|
|
||||||
private GUIScrollBar turbineOutputScrollBar;
|
private GUIScrollBar turbineOutputScrollBar;
|
||||||
|
|
||||||
private float[] outputGraph = new float[GraphSize];
|
private float[] outputGraph = new float[GraphSize];
|
||||||
@@ -110,8 +92,8 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
GUIFrame columnLeft = new GUIFrame(new RectTransform(new Vector2(0.2f, 1.0f), paddedFrame.RectTransform), style: null);
|
GUIFrame columnLeft = new GUIFrame(new RectTransform(new Vector2(0.2f, 1.0f), paddedFrame.RectTransform), style: null);
|
||||||
leftHUDColumn = columnLeft;
|
leftHUDColumn = columnLeft;
|
||||||
GUIFrame columnMid = new GUIFrame(new RectTransform(new Vector2(0.5f, 1.0f), paddedFrame.RectTransform), style: null);
|
GUIFrame columnMid = new GUIFrame(new RectTransform(new Vector2(0.45f, 1.0f), paddedFrame.RectTransform), style: null);
|
||||||
GUIFrame columnRight = new GUIFrame(new RectTransform(new Vector2(0.3f, 1.0f), paddedFrame.RectTransform), style: null);
|
GUIFrame columnRight = new GUIFrame(new RectTransform(new Vector2(0.35f, 1.0f), paddedFrame.RectTransform), style: null);
|
||||||
|
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
//left column
|
//left column
|
||||||
@@ -136,7 +118,6 @@ namespace Barotrauma.Items.Components
|
|||||||
btnText.SetTextPos();
|
btnText.SetTextPos();
|
||||||
warningButtons.Add(warningTexts[i], warningBtn);
|
warningButtons.Add(warningTexts[i], warningBtn);
|
||||||
}
|
}
|
||||||
GUITextBlock.AutoScaleAndNormalize(warningButtons.Values.Select(b => b.TextBlock));
|
|
||||||
|
|
||||||
inventoryContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.45f), columnLeft.RectTransform, Anchor.BottomLeft), style: null);
|
inventoryContainer = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.45f), columnLeft.RectTransform, Anchor.BottomLeft), style: null);
|
||||||
|
|
||||||
@@ -144,37 +125,33 @@ namespace Barotrauma.Items.Components
|
|||||||
//mid column
|
//mid column
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
criticalHeatWarning = new GUITickBox(new RectTransform(new Point(columnMid.Rect.Width / 3, 30), columnMid.RectTransform),
|
criticalHeatWarning = new GUITickBox(new RectTransform(new Point(30, 30), columnMid.RectTransform),
|
||||||
TextManager.Get("ReactorWarningCriticalTemp"), font: GUI.SmallFont, style: "IndicatorLightRed")
|
TextManager.Get("ReactorWarningCriticalTemp"), font: GUI.SmallFont, style: "IndicatorLightRed")
|
||||||
{
|
{
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
lowTemperatureWarning = new GUITickBox(new RectTransform(new Point(columnMid.Rect.Width / 3, 30), columnMid.RectTransform) { RelativeOffset = new Vector2(0.27f, 0.0f) },
|
lowTemperatureWarning = new GUITickBox(new RectTransform(new Point(30, 30), columnMid.RectTransform) { RelativeOffset = new Vector2(0.3f, 0.0f) },
|
||||||
TextManager.Get("ReactorWarningCriticalLowTemp"), font: GUI.SmallFont, style: "IndicatorLightRed")
|
TextManager.Get("ReactorWarningCriticalLowTemp"), font: GUI.SmallFont, style: "IndicatorLightRed")
|
||||||
{
|
{
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
criticalOutputWarning = new GUITickBox(new RectTransform(new Point(columnMid.Rect.Width / 3, 30), columnMid.RectTransform) { RelativeOffset = new Vector2(0.66f, 0.0f) },
|
criticalOutputWarning = new GUITickBox(new RectTransform(new Point(30, 30), columnMid.RectTransform) { RelativeOffset = new Vector2(0.75f, 0.0f) },
|
||||||
TextManager.Get("ReactorWarningCriticalOutput"), font: GUI.SmallFont, style: "IndicatorLightRed")
|
TextManager.Get("ReactorWarningCriticalOutput"), font: GUI.SmallFont, style: "IndicatorLightRed")
|
||||||
{
|
{
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
|
|
||||||
GUITextBlock.AutoScaleAndNormalize(criticalHeatWarning.TextBlock, lowTemperatureWarning.TextBlock, criticalOutputWarning.TextBlock);
|
|
||||||
|
|
||||||
float gaugeOffset = criticalHeatWarning.Rect.Height / (float)columnMid.Rect.Height + 0.05f;
|
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.05f), columnMid.RectTransform) { RelativeOffset = new Vector2(0.0f, gaugeOffset) },
|
new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.05f), columnMid.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.25f) },
|
||||||
TextManager.Get("ReactorFissionRate"));
|
TextManager.Get("ReactorFissionRate"));
|
||||||
new GUICustomComponent(new RectTransform(new Vector2(0.5f, 0.5f), columnMid.RectTransform) { RelativeOffset = new Vector2(0.0f, gaugeOffset + 0.05f) },
|
new GUICustomComponent(new RectTransform(new Vector2(0.5f, 0.5f), columnMid.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.3f) },
|
||||||
DrawFissionRateMeter, null)
|
DrawFissionRateMeter, null)
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("ReactorTipFissionRate")
|
ToolTip = TextManager.Get("ReactorTipFissionRate")
|
||||||
};
|
};
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.05f), columnMid.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, gaugeOffset) },
|
new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.05f), columnMid.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.25f) },
|
||||||
TextManager.Get("ReactorTurbineOutput"));
|
TextManager.Get("ReactorTurbineOutput"));
|
||||||
new GUICustomComponent(new RectTransform(new Vector2(0.5f, 0.5f), columnMid.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, gaugeOffset + 0.05f) },
|
new GUICustomComponent(new RectTransform(new Vector2(0.5f, 0.5f), columnMid.RectTransform, Anchor.TopRight) { RelativeOffset = new Vector2(0.0f, 0.3f) },
|
||||||
DrawTurbineOutputMeter, null)
|
DrawTurbineOutputMeter, null)
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("ReactorTipTurbineOutput")
|
ToolTip = TextManager.Get("ReactorTipTurbineOutput")
|
||||||
@@ -214,13 +191,12 @@ namespace Barotrauma.Items.Components
|
|||||||
//right column
|
//right column
|
||||||
//----------------------------------------------------------
|
//----------------------------------------------------------
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.7f, 0.1f), columnRight.RectTransform), TextManager.Get("ReactorAutoTemp"))
|
new GUITextBlock(new RectTransform(new Point(100, 20), columnRight.RectTransform), TextManager.Get("ReactorAutoTemp"))
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("ReactorTipAutoTemp"),
|
ToolTip = TextManager.Get("ReactorTipAutoTemp")
|
||||||
AutoScale = true
|
|
||||||
};
|
};
|
||||||
autoTempSlider = new GUIScrollBar(new RectTransform(new Vector2(0.6f, 0.15f), columnRight.RectTransform) { RelativeOffset = new Vector2(0.0f, 0.1f) },
|
autoTempSlider = new GUIScrollBar(new RectTransform(new Point(100, 30), columnRight.RectTransform) { AbsoluteOffset = new Point(0, 30) },
|
||||||
barSize: 0.55f, style: "OnOffSlider")
|
barSize: 0.5f, style: "OnOffSlider")
|
||||||
{
|
{
|
||||||
ToolTip = TextManager.Get("ReactorTipAutoTemp"),
|
ToolTip = TextManager.Get("ReactorTipAutoTemp"),
|
||||||
IsBooleanSwitch = true,
|
IsBooleanSwitch = true,
|
||||||
@@ -232,10 +208,8 @@ namespace Barotrauma.Items.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var sliderSprite = autoTempSlider.Frame.Style.Sprites[GUIComponent.ComponentState.None].First();
|
|
||||||
autoTempSlider.RectTransform.MaxSize = sliderSprite.Sprite.size.ToPoint();
|
onOffSwitch = new GUIScrollBar(new RectTransform(new Point(50, 80), columnRight.RectTransform, Anchor.TopRight),
|
||||||
|
|
||||||
onOffSwitch = new GUIScrollBar(new RectTransform(new Vector2(0.4f, 0.3f), columnRight.RectTransform, Anchor.TopRight),
|
|
||||||
barSize: 0.2f, style: "OnOffLever")
|
barSize: 0.2f, style: "OnOffLever")
|
||||||
{
|
{
|
||||||
IsBooleanSwitch = true,
|
IsBooleanSwitch = true,
|
||||||
@@ -248,8 +222,6 @@ namespace Barotrauma.Items.Components
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
var switchSprite = onOffSwitch.Frame.Style.Sprites[GUIComponent.ComponentState.None].First();
|
|
||||||
onOffSwitch.RectTransform.MaxSize = switchSprite.Sprite.size.ToPoint();
|
|
||||||
|
|
||||||
var lever = onOffSwitch.GetChild<GUIButton>();
|
var lever = onOffSwitch.GetChild<GUIButton>();
|
||||||
lever.RectTransform.NonScaledSize = new Point(lever.Rect.Width + 30, lever.Rect.Height);
|
lever.RectTransform.NonScaledSize = new Point(lever.Rect.Width + 30, lever.Rect.Height);
|
||||||
|
|||||||
@@ -20,10 +20,6 @@ namespace Barotrauma.Items.Components
|
|||||||
private bool unsentChanges;
|
private bool unsentChanges;
|
||||||
private float networkUpdateTimer;
|
private float networkUpdateTimer;
|
||||||
|
|
||||||
public GUITickBox ActiveTickBox
|
|
||||||
{
|
|
||||||
get { return activeTickBox; }
|
|
||||||
}
|
|
||||||
private GUITickBox activeTickBox, passiveTickBox;
|
private GUITickBox activeTickBox, passiveTickBox;
|
||||||
private GUITextBlock signalWarningText;
|
private GUITextBlock signalWarningText;
|
||||||
|
|
||||||
@@ -64,6 +60,8 @@ namespace Barotrauma.Items.Components
|
|||||||
new Color(255, 255, 255)
|
new Color(255, 255, 255)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private float prevDockingDist;
|
||||||
|
|
||||||
public Vector2 DisplayOffset { get; private set; }
|
public Vector2 DisplayOffset { get; private set; }
|
||||||
|
|
||||||
public float DisplayRadius { get; private set; }
|
public float DisplayRadius { get; private set; }
|
||||||
@@ -285,8 +283,31 @@ namespace Barotrauma.Items.Components
|
|||||||
sonarBlips.Add(flowBlip);
|
sonarBlips.Add(flowBlip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Steering steering = item.GetComponent<Steering>();
|
||||||
|
if (steering != null && steering.DockingModeEnabled)
|
||||||
|
{
|
||||||
|
float dockingDist = Vector2.Distance(steering.DockingSource.Item.WorldPosition, steering.DockingTarget.Item.WorldPosition);
|
||||||
|
if (prevDockingDist > steering.DockingAssistThreshold && dockingDist <= steering.DockingAssistThreshold)
|
||||||
|
{
|
||||||
|
zoom = Math.Max(zoom, MathHelper.Lerp(MinZoom, MaxZoom, 0.5f));
|
||||||
|
}
|
||||||
|
else if (prevDockingDist > steering.DockingAssistThreshold * 0.6f && dockingDist <= steering.DockingAssistThreshold * 0.6f)
|
||||||
|
{
|
||||||
|
zoom = Math.Max(zoom, MathHelper.Lerp(MinZoom, MaxZoom, 0.75f));
|
||||||
|
}
|
||||||
|
else if (prevDockingDist > steering.DockingAssistThreshold * 0.3f && dockingDist <= steering.DockingAssistThreshold * 0.3f)
|
||||||
|
{
|
||||||
|
zoom = Math.Max(zoom, MaxZoom);
|
||||||
|
}
|
||||||
|
prevDockingDist = Math.Min(dockingDist, prevDockingDist);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
prevDockingDist = float.MaxValue;
|
||||||
|
}
|
||||||
|
|
||||||
if (IsActive)
|
if (IsActive)
|
||||||
{
|
{
|
||||||
float pingRadius = DisplayRadius * pingState / zoom;
|
float pingRadius = DisplayRadius * pingState / zoom;
|
||||||
@@ -370,7 +391,6 @@ namespace Barotrauma.Items.Components
|
|||||||
DisplayOffset = Vector2.Zero;
|
DisplayOffset = Vector2.Zero;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (sonarBlips.Count > 0)
|
if (sonarBlips.Count > 0)
|
||||||
{
|
{
|
||||||
zoomSqrt = (float)Math.Sqrt(zoom);
|
zoomSqrt = (float)Math.Sqrt(zoom);
|
||||||
@@ -535,61 +555,12 @@ namespace Barotrauma.Items.Components
|
|||||||
Steering steering = item.GetComponent<Steering>();
|
Steering steering = item.GetComponent<Steering>();
|
||||||
if (steering != null && steering.DockingModeEnabled)
|
if (steering != null && steering.DockingModeEnabled)
|
||||||
{
|
{
|
||||||
DisplayOffset =
|
DrawDockingIndicator(spriteBatch, steering, ref transducerCenter);
|
||||||
Vector2.Lerp(DisplayOffset,
|
|
||||||
(steering.DockingSource.Item.WorldPosition + steering.DockingTarget.Item.WorldPosition) / 2.0f - transducerCenter,
|
|
||||||
0.1f);
|
|
||||||
transducerCenter += DisplayOffset;
|
|
||||||
|
|
||||||
Vector2 sourcePortDiff = (steering.DockingSource.Item.WorldPosition - transducerCenter) * scale;
|
|
||||||
Vector2 sourcePortPos = new Vector2(sourcePortDiff.X, -sourcePortDiff.Y);
|
|
||||||
Vector2 targetPortDiff = (steering.DockingTarget.Item.WorldPosition - transducerCenter) * scale;
|
|
||||||
Vector2 targetPortPos = new Vector2(targetPortDiff.X, -targetPortDiff.Y);
|
|
||||||
|
|
||||||
Vector2 midPos = (sourcePortPos + targetPortPos) / 2.0f;
|
|
||||||
|
|
||||||
System.Diagnostics.Debug.Assert(steering.DockingSource.IsHorizontal == steering.DockingTarget.IsHorizontal);
|
|
||||||
|
|
||||||
float xDist = Math.Abs(steering.DockingSource.Item.WorldPosition.X - steering.DockingTarget.Item.WorldPosition.X);
|
|
||||||
float normalizedXDist = xDist / steering.DockingSource.DistanceTolerance.X;
|
|
||||||
float yDist = Math.Abs(steering.DockingSource.Item.WorldPosition.Y - steering.DockingTarget.Item.WorldPosition.Y);
|
|
||||||
float normalizedYDist = yDist / steering.DockingSource.DistanceTolerance.Y;
|
|
||||||
|
|
||||||
Color xColor = normalizedXDist <= 1.0f ? Color.Lime : Color.Lerp(Color.Orange, Color.Red, normalizedXDist - 1.0f);
|
|
||||||
Color yColor = normalizedYDist <= 1.0f ? Color.Lime : Color.Lerp(Color.Orange, Color.Red, normalizedYDist - 1.0f);
|
|
||||||
|
|
||||||
if (steering.DockingSource.IsHorizontal)
|
|
||||||
{
|
|
||||||
if (yDist < steering.DockingSource.DistanceTolerance.Y)
|
|
||||||
{
|
|
||||||
DrawLine(spriteBatch, sourcePortPos, new Vector2(targetPortPos.X, sourcePortPos.Y), xColor, width: 3);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DrawLine(spriteBatch, sourcePortPos, new Vector2(midPos.X, sourcePortPos.Y), xColor, width: 3);
|
|
||||||
DrawLine(spriteBatch, targetPortPos, new Vector2(midPos.X, targetPortPos.Y), xColor, width: 3);
|
|
||||||
DrawLine(spriteBatch, new Vector2(midPos.X, sourcePortPos.Y), new Vector2(midPos.X, targetPortPos.Y), yColor, width: 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (xDist < steering.DockingSource.DistanceTolerance.X)
|
|
||||||
{
|
|
||||||
DrawLine(spriteBatch, sourcePortPos, new Vector2(sourcePortPos.X, targetPortPos.Y), yColor, width: 3);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DrawLine(spriteBatch, sourcePortPos, new Vector2(sourcePortPos.X, midPos.Y), yColor, width: 3);
|
|
||||||
DrawLine(spriteBatch, targetPortPos, new Vector2(targetPortPos.X, midPos.Y), yColor, width: 3);
|
|
||||||
DrawLine(spriteBatch, new Vector2(sourcePortPos.X, midPos.Y), new Vector2(targetPortPos.X, midPos.Y), xColor, width: 3);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DisplayOffset = Vector2.Lerp(DisplayOffset, Vector2.Zero, 0.1f);
|
DisplayOffset = Vector2.Lerp(DisplayOffset, Vector2.Zero, 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach (DockingPort dockingPort in DockingPort.List)
|
foreach (DockingPort dockingPort in DockingPort.List)
|
||||||
{
|
{
|
||||||
@@ -610,7 +581,101 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
GUI.DrawLine(spriteBatch, center + offset - size / 2, center + offset + size / 2, Color.LightGreen, width: (int)(zoom));
|
GUI.DrawLine(spriteBatch, center + offset - size / 2, center + offset + size / 2, Color.LightGreen, width: (int)(zoom));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawDockingIndicator(SpriteBatch spriteBatch, Steering steering, ref Vector2 transducerCenter)
|
||||||
|
{
|
||||||
|
float scale = displayScale * zoom;
|
||||||
|
|
||||||
|
Vector2 worldFocusPos = (steering.DockingSource.Item.WorldPosition + steering.DockingTarget.Item.WorldPosition) / 2.0f;
|
||||||
|
worldFocusPos.X = steering.DockingTarget.Item.WorldPosition.X;
|
||||||
|
|
||||||
|
DisplayOffset = Vector2.Lerp(DisplayOffset, worldFocusPos - transducerCenter, 0.1f);
|
||||||
|
transducerCenter += DisplayOffset;
|
||||||
|
|
||||||
|
Vector2 sourcePortDiff = (steering.DockingSource.Item.WorldPosition - transducerCenter) * scale;
|
||||||
|
Vector2 sourcePortPos = new Vector2(sourcePortDiff.X, -sourcePortDiff.Y);
|
||||||
|
Vector2 targetPortDiff = (steering.DockingTarget.Item.WorldPosition - transducerCenter) * scale;
|
||||||
|
Vector2 targetPortPos = new Vector2(targetPortDiff.X, -targetPortDiff.Y);
|
||||||
|
|
||||||
|
Vector2 midPos = (sourcePortPos + targetPortPos) / 2.0f;
|
||||||
|
|
||||||
|
System.Diagnostics.Debug.Assert(steering.DockingSource.IsHorizontal == steering.DockingTarget.IsHorizontal);
|
||||||
|
float dist = Vector2.Distance(steering.DockingSource.Item.WorldPosition, steering.DockingTarget.Item.WorldPosition);
|
||||||
|
dist *= Physics.DisplayToRealWorldRatio;
|
||||||
|
|
||||||
|
Vector2 dockingDir = Vector2.Normalize(sourcePortPos - targetPortPos);
|
||||||
|
if (steering.DockingSource.IsHorizontal)
|
||||||
|
{
|
||||||
|
dockingDir = new Vector2(Math.Sign(dockingDir.X), 0.0f);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dockingDir = new Vector2(0.0f, Math.Sign(dockingDir.Y));
|
||||||
|
}
|
||||||
|
|
||||||
|
Color staticLineColor = Color.White * 0.8f;
|
||||||
|
|
||||||
|
float sector = MathHelper.ToRadians(MathHelper.Lerp(10.0f, 45.0f, MathHelper.Clamp(dist / 20.0f, 0.0f, 1.0f)));
|
||||||
|
float sectorLength = DisplayRadius;
|
||||||
|
//use law of cosines to calculate the length of the center line
|
||||||
|
float midLength = (float)(Math.Cos(sector) * sectorLength);
|
||||||
|
|
||||||
|
Vector2 midNormal = new Vector2(-dockingDir.Y, dockingDir.X);
|
||||||
|
|
||||||
|
DrawLine(spriteBatch, targetPortPos, targetPortPos + dockingDir * midLength, staticLineColor, width: 2);
|
||||||
|
DrawLine(spriteBatch, targetPortPos,
|
||||||
|
targetPortPos + MathUtils.RotatePoint(dockingDir, sector) * sectorLength, staticLineColor, width: 2);
|
||||||
|
DrawLine(spriteBatch, targetPortPos,
|
||||||
|
targetPortPos + MathUtils.RotatePoint(dockingDir, -sector) * sectorLength, staticLineColor, width: 2);
|
||||||
|
|
||||||
|
for (float z = 0; z < 1.0f; z += 0.1f * zoom)
|
||||||
|
{
|
||||||
|
Vector2 linePos = targetPortPos + dockingDir * midLength * z;
|
||||||
|
DrawLine(spriteBatch, linePos + midNormal * 3.0f, linePos - midNormal * 3.0f, staticLineColor, width: 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
float indicatorSector = sector * 0.75f;
|
||||||
|
float indicatorSectorLength = (float)(midLength / Math.Cos(indicatorSector));
|
||||||
|
|
||||||
|
bool withinSector =
|
||||||
|
Vector2.Dot(dockingDir, MathUtils.RotatePoint(dockingDir, indicatorSector)) <
|
||||||
|
Vector2.Dot(dockingDir, Vector2.Normalize(steering.DockingSource.Item.WorldPosition - steering.DockingTarget.Item.WorldPosition));
|
||||||
|
|
||||||
|
Color indicatorColor = withinSector ? Color.LightGreen * 0.9f : Color.Red * 0.9f;
|
||||||
|
|
||||||
|
DrawLine(spriteBatch, targetPortPos,
|
||||||
|
targetPortPos + MathUtils.RotatePoint(dockingDir,indicatorSector) * indicatorSectorLength, indicatorColor, width: 2);
|
||||||
|
DrawLine(spriteBatch, targetPortPos,
|
||||||
|
targetPortPos + MathUtils.RotatePoint(dockingDir, -indicatorSector) * indicatorSectorLength, indicatorColor, width: 2);
|
||||||
|
|
||||||
|
/*if (steering.DockingSource.IsHorizontal)
|
||||||
|
{
|
||||||
|
if (yDist < steering.DockingSource.DistanceTolerance.Y)
|
||||||
|
{
|
||||||
|
DrawLine(spriteBatch, sourcePortPos, new Vector2(targetPortPos.X, sourcePortPos.Y), xColor, width: 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawLine(spriteBatch, sourcePortPos, new Vector2(midPos.X, sourcePortPos.Y), xColor, width: 3);
|
||||||
|
DrawLine(spriteBatch, targetPortPos, new Vector2(midPos.X, targetPortPos.Y), xColor, width: 3);
|
||||||
|
DrawLine(spriteBatch, new Vector2(midPos.X, sourcePortPos.Y), new Vector2(midPos.X, targetPortPos.Y), yColor, width: 3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (xDist < steering.DockingSource.DistanceTolerance.X)
|
||||||
|
{
|
||||||
|
DrawLine(spriteBatch, sourcePortPos, new Vector2(sourcePortPos.X, targetPortPos.Y), yColor, width: 3);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DrawLine(spriteBatch, sourcePortPos, new Vector2(sourcePortPos.X, midPos.Y), yColor, width: 3);
|
||||||
|
DrawLine(spriteBatch, targetPortPos, new Vector2(targetPortPos.X, midPos.Y), yColor, width: 3);
|
||||||
|
DrawLine(spriteBatch, new Vector2(sourcePortPos.X, midPos.Y), new Vector2(targetPortPos.X, midPos.Y), xColor, width: 3);
|
||||||
|
}
|
||||||
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateDisruptions(Vector2 pingSource, float worldPingRadius, float worldPrevPingRadius)
|
private void UpdateDisruptions(Vector2 pingSource, float worldPingRadius, float worldPrevPingRadius)
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ namespace Barotrauma.Items.Components
|
|||||||
private Vector2 keyboardInput = Vector2.Zero;
|
private Vector2 keyboardInput = Vector2.Zero;
|
||||||
private float inputCumulation;
|
private float inputCumulation;
|
||||||
|
|
||||||
private bool? swapDestinationOrder;
|
|
||||||
|
|
||||||
private bool levelStartSelected;
|
private bool levelStartSelected;
|
||||||
public bool LevelStartSelected
|
public bool LevelStartSelected
|
||||||
{
|
{
|
||||||
@@ -425,15 +423,6 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
public override void UpdateHUD(Character character, float deltaTime, Camera cam)
|
public override void UpdateHUD(Character character, float deltaTime, Camera cam)
|
||||||
{
|
{
|
||||||
if (swapDestinationOrder == null)
|
|
||||||
{
|
|
||||||
swapDestinationOrder = item.Submarine != null && item.Submarine.FlippedX;
|
|
||||||
if (swapDestinationOrder.Value)
|
|
||||||
{
|
|
||||||
levelStartTickBox.RectTransform.SetAsLastChild();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (steerArea.Rect.Contains(PlayerInput.MousePosition))
|
if (steerArea.Rect.Contains(PlayerInput.MousePosition))
|
||||||
{
|
{
|
||||||
if (!PlayerInput.KeyDown(InputType.Deselect) && !PlayerInput.KeyHit(InputType.Deselect))
|
if (!PlayerInput.KeyDown(InputType.Deselect) && !PlayerInput.KeyHit(InputType.Deselect))
|
||||||
|
|||||||
@@ -10,10 +10,6 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
partial class Repairable : ItemComponent, IDrawableComponent
|
partial class Repairable : ItemComponent, IDrawableComponent
|
||||||
{
|
{
|
||||||
public GUIButton RepairButton
|
|
||||||
{
|
|
||||||
get { return repairButton; }
|
|
||||||
}
|
|
||||||
private GUIButton repairButton;
|
private GUIButton repairButton;
|
||||||
private GUIProgressBar progressBar;
|
private GUIProgressBar progressBar;
|
||||||
|
|
||||||
|
|||||||
@@ -18,14 +18,6 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private static Wire draggingConnected;
|
private static Wire draggingConnected;
|
||||||
|
|
||||||
private Color flashColor;
|
|
||||||
private float flashDuration = 1.5f;
|
|
||||||
public float FlashTimer
|
|
||||||
{
|
|
||||||
get { return flashTimer; }
|
|
||||||
}
|
|
||||||
private float flashTimer;
|
|
||||||
|
|
||||||
public static void DrawConnections(SpriteBatch spriteBatch, ConnectionPanel panel, Character character)
|
public static void DrawConnections(SpriteBatch spriteBatch, ConnectionPanel panel, Character character)
|
||||||
{
|
{
|
||||||
Rectangle panelRect = panel.GuiFrame.Rect;
|
Rectangle panelRect = panel.GuiFrame.Rect;
|
||||||
@@ -182,38 +174,14 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flashTimer > 0.0f)
|
|
||||||
{
|
|
||||||
//the number of flashes depends on the duration, 1 flash per 1 full second
|
|
||||||
int flashCycleCount = (int)Math.Max(flashDuration, 1);
|
|
||||||
float flashCycleDuration = flashDuration / flashCycleCount;
|
|
||||||
|
|
||||||
//MathHelper.Pi * 0.8f -> the curve goes from 144 deg to 0,
|
|
||||||
//i.e. quickly bumps up from almost full brightness to full and then fades out
|
|
||||||
connectionSpriteHighlight.Draw(spriteBatch, position, flashColor * (float)Math.Sin(flashTimer % flashCycleDuration / flashCycleDuration * MathHelper.Pi * 0.8f));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Wires.Any(w => w != null && w != draggingConnected))
|
if (Wires.Any(w => w != null && w != draggingConnected))
|
||||||
{
|
{
|
||||||
int screwIndex = (int)Math.Floor(position.Y / 30.0f) % screwSprites.Count;
|
int screwIndex = (int)Math.Floor(position.Y / 30.0f) % screwSprites.Count;
|
||||||
screwSprites[screwIndex].Draw(spriteBatch, position);
|
screwSprites[screwIndex].Draw(spriteBatch, position);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Flash(Color? color = null, float flashDuration = 1.5f)
|
|
||||||
{
|
|
||||||
flashTimer = flashDuration;
|
|
||||||
this.flashDuration = flashDuration;
|
|
||||||
flashColor = (color == null) ? Color.Red : (Color)color;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateFlashTimer(float deltaTime)
|
|
||||||
{
|
|
||||||
if (flashTimer <= 0) return;
|
|
||||||
flashTimer -= deltaTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void DrawWire(SpriteBatch spriteBatch, Wire wire, Item item, Vector2 end, Vector2 start, bool mouseIn, Wire equippedWire, ConnectionPanel panel, string label)
|
private static void DrawWire(SpriteBatch spriteBatch, Wire wire, Item item, Vector2 end, Vector2 start, bool mouseIn, Wire equippedWire, ConnectionPanel panel, string label)
|
||||||
{
|
{
|
||||||
if (draggingConnected == wire)
|
if (draggingConnected == wire)
|
||||||
|
|||||||
@@ -92,25 +92,6 @@ namespace Barotrauma.Items.Components
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HighlightElement(int index, Color color, float duration, float pulsateAmount = 0.0f)
|
|
||||||
{
|
|
||||||
if (index < 0 || index >= uiElements.Count) { return; }
|
|
||||||
uiElements[index].Flash(color, duration);
|
|
||||||
|
|
||||||
if (pulsateAmount > 0.0f)
|
|
||||||
{
|
|
||||||
if (uiElements[index] is GUIButton button)
|
|
||||||
{
|
|
||||||
button.Frame.Pulsate(Vector2.One, Vector2.One * (1.0f + pulsateAmount), duration);
|
|
||||||
button.Frame.RectTransform.SetPosition(Anchor.Center);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
uiElements[index].Pulsate(Vector2.One, Vector2.One * (1.0f + pulsateAmount), duration);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void UpdateLabelsProjSpecific()
|
partial void UpdateLabelsProjSpecific()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < labels.Length && i < uiElements.Count; i++)
|
for (int i = 0; i < labels.Length && i < uiElements.Count; i++)
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ namespace Barotrauma
|
|||||||
public Color Color;
|
public Color Color;
|
||||||
|
|
||||||
public Color HighlightColor;
|
public Color HighlightColor;
|
||||||
public float HighlightScaleUpAmount;
|
|
||||||
private CoroutineHandle highlightCoroutine;
|
private CoroutineHandle highlightCoroutine;
|
||||||
public float HighlightTimer;
|
public float HighlightTimer;
|
||||||
|
|
||||||
@@ -81,7 +80,7 @@ namespace Barotrauma
|
|||||||
return rect.Contains(PlayerInput.MousePosition);
|
return rect.Contains(PlayerInput.MousePosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ShowBorderHighlight(Color color, float fadeInDuration, float fadeOutDuration, float scaleUpAmount = 0.5f)
|
public void ShowBorderHighlight(Color color, float fadeInDuration, float fadeOutDuration)
|
||||||
{
|
{
|
||||||
if (highlightCoroutine != null)
|
if (highlightCoroutine != null)
|
||||||
{
|
{
|
||||||
@@ -89,7 +88,6 @@ namespace Barotrauma
|
|||||||
highlightCoroutine = null;
|
highlightCoroutine = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
HighlightScaleUpAmount = scaleUpAmount;
|
|
||||||
highlightCoroutine = CoroutineManager.StartCoroutine(UpdateBorderHighlight(color, fadeInDuration, fadeOutDuration));
|
highlightCoroutine = CoroutineManager.StartCoroutine(UpdateBorderHighlight(color, fadeInDuration, fadeOutDuration));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -802,7 +800,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (slot.HighlightColor.A > 0)
|
if (slot.HighlightColor.A > 0)
|
||||||
{
|
{
|
||||||
float inflateAmount = (slot.HighlightColor.A / 255.0f) * slot.HighlightScaleUpAmount * 0.5f;
|
float scaleUpAmount = 0.5f;
|
||||||
|
float inflateAmount = (slot.HighlightColor.A / 255.0f) * scaleUpAmount * 0.5f;
|
||||||
rect.Inflate(rect.Width * inflateAmount, rect.Height * inflateAmount);
|
rect.Inflate(rect.Width * inflateAmount, rect.Height * inflateAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -820,9 +819,8 @@ namespace Barotrauma
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Sprite slotSprite = slot.SlotSprite ?? slotSpriteSmall;
|
Sprite slotSprite = slot.SlotSprite ?? slotSpriteSmall;
|
||||||
Color slotColor = slot.IsHighlighted ? Color.White : Color.White * 0.8f;
|
|
||||||
if (inventory != null && inventory.Locked) { slotColor = Color.Gray * 0.5f; }
|
spriteBatch.Draw(slotSprite.Texture, rect, slotSprite.SourceRect, slot.IsHighlighted ? Color.White : Color.White * 0.8f);
|
||||||
spriteBatch.Draw(slotSprite.Texture, rect, slotSprite.SourceRect, slotColor);
|
|
||||||
|
|
||||||
if (item != null && drawItem)
|
if (item != null && drawItem)
|
||||||
{
|
{
|
||||||
@@ -874,17 +872,14 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
indicatorSprite.Draw(spriteBatch, containedIndicatorArea.Center.ToVector2(),
|
indicatorSprite.Draw(spriteBatch, containedIndicatorArea.Center.ToVector2(),
|
||||||
(inventory != null && inventory.Locked) ? Color.DarkGray * 0.5f : Color.DarkGray * 0.9f,
|
Color.DarkGray * 0.9f,
|
||||||
origin: indicatorSprite.size / 2,
|
origin: indicatorSprite.size / 2,
|
||||||
rotate: 0.0f,
|
rotate: 0.0f,
|
||||||
scale: indicatorScale);
|
scale: indicatorScale);
|
||||||
|
|
||||||
Color indicatorColor = ToolBox.GradientLerp(containedState, Color.Red, Color.Orange, Color.Green);
|
|
||||||
if (inventory != null && inventory.Locked) { indicatorColor *= 0.5f; }
|
|
||||||
|
|
||||||
spriteBatch.Draw(indicatorSprite.Texture, containedIndicatorArea.Center.ToVector2(),
|
spriteBatch.Draw(indicatorSprite.Texture, containedIndicatorArea.Center.ToVector2(),
|
||||||
sourceRectangle: new Rectangle(indicatorSprite.SourceRect.Location, new Point((int)(indicatorSprite.SourceRect.Width * containedState), indicatorSprite.SourceRect.Height)),
|
sourceRectangle: new Rectangle(indicatorSprite.SourceRect.Location, new Point((int)(indicatorSprite.SourceRect.Width * containedState), indicatorSprite.SourceRect.Height)),
|
||||||
color: indicatorColor,
|
color: ToolBox.GradientLerp(containedState, Color.Red, Color.Orange, Color.Green),
|
||||||
rotation: 0.0f,
|
rotation: 0.0f,
|
||||||
origin: indicatorSprite.size / 2,
|
origin: indicatorSprite.size / 2,
|
||||||
scale: indicatorScale,
|
scale: indicatorScale,
|
||||||
@@ -924,7 +919,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
Color spriteColor = sprite == item.Sprite ? item.GetSpriteColor() : item.GetInventoryIconColor();
|
Color spriteColor = sprite == item.Sprite ? item.GetSpriteColor() : item.GetInventoryIconColor();
|
||||||
if (inventory != null && inventory.Locked) { spriteColor *= 0.5f; }
|
|
||||||
if (CharacterHealth.OpenHealthWindow != null && !item.UseInHealthInterface)
|
if (CharacterHealth.OpenHealthWindow != null && !item.UseInHealthInterface)
|
||||||
{
|
{
|
||||||
spriteColor = Color.Lerp(spriteColor, Color.TransparentBlack, 0.5f);
|
spriteColor = Color.Lerp(spriteColor, Color.TransparentBlack, 0.5f);
|
||||||
@@ -936,10 +930,7 @@ namespace Barotrauma
|
|||||||
sprite.Draw(spriteBatch, itemPos, spriteColor, rotation, scale);
|
sprite.Draw(spriteBatch, itemPos, spriteColor, rotation, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (inventory != null &&
|
if (inventory != null && Character.Controlled?.Inventory == inventory && slot.QuickUseKey != Keys.None)
|
||||||
!inventory.Locked &&
|
|
||||||
Character.Controlled?.Inventory == inventory &&
|
|
||||||
slot.QuickUseKey != Keys.None)
|
|
||||||
{
|
{
|
||||||
GUI.DrawString(spriteBatch, rect.Location.ToVector2(),
|
GUI.DrawString(spriteBatch, rect.Location.ToVector2(),
|
||||||
slot.QuickUseKey.ToString().Substring(1, 1),
|
slot.QuickUseKey.ToString().Substring(1, 1),
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ namespace Barotrauma
|
|||||||
if (!Visible || (!editing && hiddenInGame)) return;
|
if (!Visible || (!editing && hiddenInGame)) return;
|
||||||
if (editing && !ShowItems) return;
|
if (editing && !ShowItems) return;
|
||||||
|
|
||||||
Color color = IsHighlighted && !GUI.DisableItemHighlights && Screen.Selected != GameMain.GameScreen ? Color.Orange : GetSpriteColor();
|
Color color = isHighlighted && !GUI.DisableItemHighlights && Screen.Selected != GameMain.GameScreen ? Color.Orange : GetSpriteColor();
|
||||||
//if (IsSelected && editing) color = Color.Lerp(color, Color.Gold, 0.5f);
|
//if (IsSelected && editing) color = Color.Lerp(color, Color.Gold, 0.5f);
|
||||||
|
|
||||||
BrokenItemSprite fadeInBrokenSprite = null;
|
BrokenItemSprite fadeInBrokenSprite = null;
|
||||||
|
|||||||
@@ -326,6 +326,33 @@ namespace Barotrauma
|
|||||||
Color.Green, width: 2);
|
Color.Green, width: 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (MapEntity e in linkedTo)
|
||||||
|
{
|
||||||
|
if (e is Hull)
|
||||||
|
{
|
||||||
|
Hull linkedHull = (Hull)e;
|
||||||
|
Rectangle connectedHullRect = e.Submarine == null ?
|
||||||
|
linkedHull.rect :
|
||||||
|
new Rectangle(
|
||||||
|
(int)(Submarine.DrawPosition.X + linkedHull.WorldPosition.X),
|
||||||
|
(int)(Submarine.DrawPosition.Y + linkedHull.WorldPosition.Y),
|
||||||
|
linkedHull.WorldRect.Width, linkedHull.WorldRect.Height);
|
||||||
|
|
||||||
|
//center of the hull
|
||||||
|
Rectangle currentHullRect = Submarine == null ?
|
||||||
|
WorldRect :
|
||||||
|
new Rectangle(
|
||||||
|
(int)(Submarine.DrawPosition.X + WorldPosition.X),
|
||||||
|
(int)(Submarine.DrawPosition.Y + WorldPosition.Y),
|
||||||
|
WorldRect.Width, WorldRect.Height);
|
||||||
|
|
||||||
|
GUI.DrawLine(spriteBatch,
|
||||||
|
new Vector2(currentHullRect.X, -currentHullRect.Y),
|
||||||
|
new Vector2(connectedHullRect.X, -connectedHullRect.Y),
|
||||||
|
Color.Green, width: 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateVertices(GraphicsDevice graphicsDevice, Camera cam, WaterRenderer renderer)
|
public static void UpdateVertices(GraphicsDevice graphicsDevice, Camera cam, WaterRenderer renderer)
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace Barotrauma
|
|||||||
drawRect = new Rectangle(
|
drawRect = new Rectangle(
|
||||||
(int)(drawRect.X * scale) + drawArea.Center.X, -((int)((drawRect.Y - drawRect.Height) * scale) + drawArea.Center.Y),
|
(int)(drawRect.X * scale) + drawArea.Center.X, -((int)((drawRect.Y - drawRect.Height) * scale) + drawArea.Center.Y),
|
||||||
(int)(drawRect.Width * scale), (int)(drawRect.Height * scale));
|
(int)(drawRect.Width * scale), (int)(drawRect.Height * scale));
|
||||||
entity.First.DrawPlacing(spriteBatch, drawRect, entity.First.Scale * scale);
|
entity.First.DrawPlacing(spriteBatch, drawRect, scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Rectangle drawRect = entity.Second;
|
Rectangle drawRect = entity.Second;
|
||||||
drawRect.Location += Submarine.MouseToWorldGrid(cam, Submarine.MainSub).ToPoint();
|
drawRect.Location += Submarine.MouseToWorldGrid(cam, Submarine.MainSub).ToPoint();
|
||||||
entity.First.DrawPlacing(spriteBatch, drawRect, entity.First.Scale);
|
entity.First.DrawPlacing(spriteBatch, drawRect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
using Barotrauma.Extensions;
|
using Barotrauma.Extensions;
|
||||||
using Barotrauma.Lights;
|
using Barotrauma.Lights;
|
||||||
using Barotrauma.Networking;
|
using Barotrauma.Networking;
|
||||||
using FarseerPhysics;
|
|
||||||
using FarseerPhysics.Dynamics;
|
|
||||||
using FarseerPhysics.Dynamics.Contacts;
|
|
||||||
using Lidgren.Network;
|
using Lidgren.Network;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
using Microsoft.Xna.Framework.Graphics;
|
using Microsoft.Xna.Framework.Graphics;
|
||||||
@@ -45,21 +42,7 @@ namespace Barotrauma
|
|||||||
MathHelper.Clamp(value.Y, 0.01f, 10));
|
MathHelper.Clamp(value.Y, 0.01f, 10));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string specialTag;
|
|
||||||
[Editable, Serialize("", true)]
|
|
||||||
public string SpecialTag
|
|
||||||
{
|
|
||||||
get { return specialTag; }
|
|
||||||
set { specialTag = value; }
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only for testing in the debug build. Not saved.
|
|
||||||
#if DEBUG
|
|
||||||
[Editable, Serialize(true, false)]
|
|
||||||
#endif
|
|
||||||
public bool DrawTiled { get; protected set; } = true;
|
|
||||||
|
|
||||||
protected Vector2 textureOffset = Vector2.Zero;
|
protected Vector2 textureOffset = Vector2.Zero;
|
||||||
[Editable(MinValueFloat = -1000f, MaxValueFloat = 1000f, ValueStep = 10f), Serialize("0.0, 0.0", true)]
|
[Editable(MinValueFloat = -1000f, MaxValueFloat = 1000f, ValueStep = 10f), Serialize("0.0, 0.0", true)]
|
||||||
public Vector2 TextureOffset
|
public Vector2 TextureOffset
|
||||||
@@ -168,20 +151,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Vector2 pos = ConvertUnits.ToDisplayUnits(f2.Body.Position);
|
Vector2 pos = ConvertUnits.ToDisplayUnits(f2.Body.Position);
|
||||||
|
|
||||||
int section = FindSectionIndex(pos);
|
|
||||||
if (section > -1)
|
|
||||||
{
|
|
||||||
Vector2 normal = contact.Manifold.LocalNormal;
|
|
||||||
|
|
||||||
float impact = Vector2.Dot(f2.Body.LinearVelocity, -normal) * f2.Body.Mass * 0.1f;
|
|
||||||
if (impact > 10.0f)
|
|
||||||
{
|
|
||||||
SoundPlayer.PlayDamageSound("StructureBlunt", impact, SectionPosition(section, true), tags: Tags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool IsVisible(Rectangle worldView)
|
public override bool IsVisible(Rectangle worldView)
|
||||||
{
|
{
|
||||||
Rectangle worldRect = WorldRect;
|
Rectangle worldRect = WorldRect;
|
||||||
@@ -218,7 +187,7 @@ namespace Barotrauma
|
|||||||
if (HasBody && !ShowWalls) return;
|
if (HasBody && !ShowWalls) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Color color = IsHighlighted ? Color.Orange : spriteColor;
|
Color color = isHighlighted ? Color.Orange : spriteColor;
|
||||||
if (IsSelected && editing)
|
if (IsSelected && editing)
|
||||||
{
|
{
|
||||||
//color = Color.Lerp(color, Color.Gold, 0.5f);
|
//color = Color.Lerp(color, Color.Gold, 0.5f);
|
||||||
|
|||||||
@@ -1079,8 +1079,6 @@ namespace Barotrauma.Networking
|
|||||||
bool isTraitor = inc.ReadBoolean();
|
bool isTraitor = inc.ReadBoolean();
|
||||||
string traitorTargetName = isTraitor ? inc.ReadString() : null;
|
string traitorTargetName = isTraitor ? inc.ReadString() : null;
|
||||||
|
|
||||||
bool allowRagdollButton = inc.ReadBoolean();
|
|
||||||
|
|
||||||
serverSettings.ReadMonsterEnabled(inc);
|
serverSettings.ReadMonsterEnabled(inc);
|
||||||
|
|
||||||
GameModePreset gameMode = GameModePreset.List.Find(gm => gm.Identifier == modeIdentifier);
|
GameModePreset gameMode = GameModePreset.List.Find(gm => gm.Identifier == modeIdentifier);
|
||||||
@@ -1097,7 +1095,6 @@ namespace Barotrauma.Networking
|
|||||||
GameMain.LightManager.LosMode = (LosMode)losMode;
|
GameMain.LightManager.LosMode = (LosMode)losMode;
|
||||||
|
|
||||||
serverSettings.AllowDisguises = disguisesAllowed;
|
serverSettings.AllowDisguises = disguisesAllowed;
|
||||||
serverSettings.AllowRagdollButton = allowRagdollButton;
|
|
||||||
|
|
||||||
if (campaign == null)
|
if (campaign == null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ namespace Barotrauma.Networking
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
GUIFrame innerFrame = new GUIFrame(new RectTransform(new Vector2(0.5f, 0.5f), LogFrame.RectTransform, Anchor.Center) { MinSize = new Point(700, 500) });
|
GUIFrame innerFrame = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.4f), LogFrame.RectTransform, Anchor.Center) { MinSize = new Point(600, 420) });
|
||||||
GUIFrame paddedFrame = new GUIFrame(new RectTransform(new Vector2(0.95f, 0.85f), innerFrame.RectTransform, Anchor.Center) { RelativeOffset = new Vector2(0.0f, -0.03f) }, style: null);
|
GUIFrame paddedFrame = new GUIFrame(new RectTransform(new Vector2(0.9f, 0.85f), innerFrame.RectTransform, Anchor.Center) { RelativeOffset = new Vector2(0.0f, -0.03f) }, style: null);
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(0.75f, 0.05f), paddedFrame.RectTransform, Anchor.TopRight), TextManager.Get("ServerLog.Filter"), font: GUI.SmallFont);
|
new GUITextBlock(new RectTransform(new Vector2(0.75f, 0.05f), paddedFrame.RectTransform, Anchor.TopRight), TextManager.Get("ServerLog.Filter"), font: GUI.SmallFont);
|
||||||
GUITextBox searchBox = new GUITextBox(new RectTransform(new Vector2(0.6f, 0.05f), paddedFrame.RectTransform, Anchor.TopRight), font: GUI.SmallFont);
|
GUITextBox searchBox = new GUITextBox(new RectTransform(new Vector2(0.6f, 0.05f), paddedFrame.RectTransform, Anchor.TopRight), font: GUI.SmallFont);
|
||||||
@@ -45,12 +45,20 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
listBox = new GUIListBox(new RectTransform(new Vector2(0.75f, 0.95f), paddedFrame.RectTransform, Anchor.BottomRight));
|
listBox = new GUIListBox(new RectTransform(new Vector2(0.75f, 0.95f), paddedFrame.RectTransform, Anchor.BottomRight));
|
||||||
|
|
||||||
|
var tickBoxContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.2f, 0.95f), paddedFrame.RectTransform, Anchor.BottomLeft));
|
||||||
|
|
||||||
var tickBoxContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.25f, 0.95f), paddedFrame.RectTransform, Anchor.BottomLeft));
|
var tickBoxContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.25f, 0.95f), paddedFrame.RectTransform, Anchor.BottomLeft));
|
||||||
int y = 30;
|
int y = 30;
|
||||||
List<GUITickBox> tickBoxes = new List<GUITickBox>();
|
List<GUITickBox> tickBoxes = new List<GUITickBox>();
|
||||||
foreach (MessageType msgType in Enum.GetValues(typeof(MessageType)))
|
foreach (MessageType msgType in Enum.GetValues(typeof(MessageType)))
|
||||||
{
|
{
|
||||||
var tickBox = new GUITickBox(new RectTransform(new Point(tickBoxContainer.Rect.Width, 30), tickBoxContainer.RectTransform), TextManager.Get("ServerLog." + messageTypeName[(int)msgType]), font: GUI.SmallFont)
|
var tickBox = new GUITickBox(new RectTransform(new Point(20, 20), tickBoxContainer.RectTransform), TextManager.Get("ServerLog." + messageTypeName[(int)msgType]), font: GUI.SmallFont)
|
||||||
|
{
|
||||||
|
Selected = true,
|
||||||
|
TextColor = messageColor[(int)msgType]
|
||||||
|
};
|
||||||
|
|
||||||
|
tickBox.OnSelected += (GUITickBox tb) =>
|
||||||
{
|
{
|
||||||
Selected = true,
|
Selected = true,
|
||||||
TextColor = messageColor[(int)msgType],
|
TextColor = messageColor[(int)msgType],
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ namespace Barotrauma.Networking
|
|||||||
OnClicked = SelectSettingsTab
|
OnClicked = SelectSettingsTab
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
GUITextBlock.AutoScaleAndNormalize(tabButtons.Select(b => b.TextBlock));
|
|
||||||
SelectSettingsTab(tabButtons[0], 0);
|
SelectSettingsTab(tabButtons[0], 0);
|
||||||
|
|
||||||
//"Close"
|
//"Close"
|
||||||
@@ -504,8 +504,6 @@ namespace Barotrauma.Networking
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
GUITextBlock.AutoScaleAndNormalize(buttonHolder.Children.Select(c => ((GUIButton)c).TextBlock));
|
|
||||||
|
|
||||||
foreach (ItemPrefab ip in MapEntityPrefab.List.Where(p => p is ItemPrefab).Select(p => p as ItemPrefab))
|
foreach (ItemPrefab ip in MapEntityPrefab.List.Where(p => p is ItemPrefab).Select(p => p as ItemPrefab))
|
||||||
{
|
{
|
||||||
if (!ip.CanBeBought && !ip.Tags.Contains("smallitem")) continue;
|
if (!ip.CanBeBought && !ip.Tags.Contains("smallitem")) continue;
|
||||||
|
|||||||
@@ -583,23 +583,6 @@ namespace Barotrauma.Steam
|
|||||||
ContentPackage contentPackage = new ContentPackage(metaDataFilePath);
|
ContentPackage contentPackage = new ContentPackage(metaDataFilePath);
|
||||||
string newContentPackagePath = GetWorkshopItemContentPackagePath(contentPackage);
|
string newContentPackagePath = GetWorkshopItemContentPackagePath(contentPackage);
|
||||||
|
|
||||||
if (!contentPackage.IsCompatible())
|
|
||||||
{
|
|
||||||
errorMsg = TextManager.Get(contentPackage.GameVersion <= new Version(0, 0, 0, 0) ? "IncompatibleContentPackageUnknownVersion" : "IncompatibleContentPackage")
|
|
||||||
.Replace("[packagename]", contentPackage.Name)
|
|
||||||
.Replace("[packageversion]", contentPackage.GameVersion.ToString())
|
|
||||||
.Replace("[gameversion]", GameMain.Version.ToString());
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (contentPackage.CorePackage && !contentPackage.ContainsRequiredCorePackageFiles(out List<ContentType> missingContentTypes))
|
|
||||||
{
|
|
||||||
errorMsg = TextManager.Get("ContentPackageMissingCoreFiles")
|
|
||||||
.Replace("[packagename]", contentPackage.Name)
|
|
||||||
.Replace("[missingfiletypes]", string.Join(", ", missingContentTypes));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var allPackageFiles = Directory.GetFiles(item.Directory.FullName, "*", SearchOption.AllDirectories);
|
var allPackageFiles = Directory.GetFiles(item.Directory.FullName, "*", SearchOption.AllDirectories);
|
||||||
List<string> nonContentFiles = new List<string>();
|
List<string> nonContentFiles = new List<string>();
|
||||||
foreach (string file in allPackageFiles)
|
foreach (string file in allPackageFiles)
|
||||||
@@ -616,7 +599,9 @@ namespace Barotrauma.Steam
|
|||||||
|
|
||||||
if (!allowFileOverwrite)
|
if (!allowFileOverwrite)
|
||||||
{
|
{
|
||||||
if (File.Exists(newContentPackagePath) && !CheckFileEquality(newContentPackagePath, metaDataFilePath))
|
// TODO: If you create a new mod via the workshop interface and enable it, it will show the error msg, but still allows you to enable the content.
|
||||||
|
|
||||||
|
if (File.Exists(newContentPackagePath))
|
||||||
{
|
{
|
||||||
errorMsg = TextManager.Get("WorkshopErrorOverwriteOnEnable")
|
errorMsg = TextManager.Get("WorkshopErrorOverwriteOnEnable")
|
||||||
.Replace("[itemname]", item.Title)
|
.Replace("[itemname]", item.Title)
|
||||||
@@ -628,7 +613,7 @@ namespace Barotrauma.Steam
|
|||||||
foreach (ContentFile contentFile in contentPackage.Files)
|
foreach (ContentFile contentFile in contentPackage.Files)
|
||||||
{
|
{
|
||||||
string sourceFile = Path.Combine(item.Directory.FullName, contentFile.Path);
|
string sourceFile = Path.Combine(item.Directory.FullName, contentFile.Path);
|
||||||
if (File.Exists(sourceFile) && File.Exists(contentFile.Path) && !CheckFileEquality(sourceFile, contentFile.Path))
|
if (File.Exists(sourceFile) && File.Exists(contentFile.Path))
|
||||||
{
|
{
|
||||||
errorMsg = TextManager.Get("WorkshopErrorOverwriteOnEnable")
|
errorMsg = TextManager.Get("WorkshopErrorOverwriteOnEnable")
|
||||||
.Replace("[itemname]", item.Title)
|
.Replace("[itemname]", item.Title)
|
||||||
@@ -644,41 +629,12 @@ namespace Barotrauma.Steam
|
|||||||
foreach (ContentFile contentFile in contentPackage.Files)
|
foreach (ContentFile contentFile in contentPackage.Files)
|
||||||
{
|
{
|
||||||
string sourceFile = Path.Combine(item.Directory.FullName, contentFile.Path);
|
string sourceFile = Path.Combine(item.Directory.FullName, contentFile.Path);
|
||||||
|
if (!File.Exists(sourceFile)) { continue; }
|
||||||
//path not allowed -> the content file must be a reference to an external file (such as some vanilla file outside the Mods folder)
|
|
||||||
if (!ContentPackage.IsModFilePathAllowed(contentFile))
|
if (!ContentPackage.IsModFilePathAllowed(contentFile))
|
||||||
{
|
{
|
||||||
//the content package is trying to copy a file to a prohibited path, which is not allowed
|
DebugConsole.ThrowError(TextManager.Get("WorkshopErrorIllegalPathOnEnable").Replace("[filename]", contentFile.Path));
|
||||||
if (File.Exists(sourceFile))
|
|
||||||
{
|
|
||||||
errorMsg = TextManager.Get("WorkshopErrorIllegalPathOnEnable").Replace("[filename]", contentFile.Path);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//not trying to copy anything, so this is a reference to an external file
|
|
||||||
//if the external file doesn't exist, we cannot enable the package
|
|
||||||
else if (!File.Exists(contentFile.Path))
|
|
||||||
{
|
|
||||||
//TODO: add the error message to localization
|
|
||||||
errorMsg = TextManager.Get("WorkshopErrorEnableFailed").Replace("[itemname]", item.Title) + " {File \"" + contentFile.Path + "\" not found.}";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if (!File.Exists(sourceFile))
|
|
||||||
{
|
|
||||||
if (File.Exists(contentFile.Path))
|
|
||||||
{
|
|
||||||
//the file is already present in the game folder, all good
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
//file not present in either the mod or the game folder -> cannot enable the package
|
|
||||||
//TODO: add the error message to localization
|
|
||||||
errorMsg = TextManager.Get("WorkshopErrorEnableFailed").Replace("[itemname]", item.Title) + " {File \"" + contentFile.Path + "\" not found.}";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//make sure the destination directory exists
|
//make sure the destination directory exists
|
||||||
Directory.CreateDirectory(Path.GetDirectoryName(contentFile.Path));
|
Directory.CreateDirectory(Path.GetDirectoryName(contentFile.Path));
|
||||||
@@ -700,7 +656,7 @@ namespace Barotrauma.Steam
|
|||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
errorMsg = TextManager.Get("WorkshopErrorEnableFailed").Replace("[itemname]", item.Title) + " {" + e.Message + "}";
|
errorMsg = TextManager.Get("WorkshopErrorEnableFailed").Replace("[itemname]", item.Title) + " " + e.Message;
|
||||||
DebugConsole.NewMessage(errorMsg, Microsoft.Xna.Framework.Color.Red);
|
DebugConsole.NewMessage(errorMsg, Microsoft.Xna.Framework.Color.Red);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -729,22 +685,6 @@ namespace Barotrauma.Steam
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool CheckFileEquality(string filePath1, string filePath2)
|
|
||||||
{
|
|
||||||
if (filePath1 == filePath2)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
using (FileStream fs1 = File.OpenRead(filePath1))
|
|
||||||
using (FileStream fs2 = File.OpenRead(filePath2))
|
|
||||||
{
|
|
||||||
Md5Hash hash1 = new Md5Hash(fs1);
|
|
||||||
Md5Hash hash2 = new Md5Hash(fs2);
|
|
||||||
return hash1.Hash == hash2.Hash;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disables a workshop item by removing the files from the game folder.
|
/// Disables a workshop item by removing the files from the game folder.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -871,7 +811,7 @@ namespace Barotrauma.Steam
|
|||||||
{
|
{
|
||||||
foreach (ContentFile contentFile in contentPackage.Files)
|
foreach (ContentFile contentFile in contentPackage.Files)
|
||||||
{
|
{
|
||||||
if (!File.Exists(contentFile.Path)) { return false; }
|
if (!File.Exists(contentFile.Path)) return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -76,8 +76,7 @@ namespace Barotrauma.Networking
|
|||||||
if (!GUIMessageBox.MessageBoxes.Any(mb => mb.UserData as string == "capturedevicenotfound"))
|
if (!GUIMessageBox.MessageBoxes.Any(mb => mb.UserData as string == "capturedevicenotfound"))
|
||||||
{
|
{
|
||||||
GUI.SettingsMenuOpen = false;
|
GUI.SettingsMenuOpen = false;
|
||||||
new GUIMessageBox(TextManager.Get("Error"),
|
new GUIMessageBox(TextManager.Get("Error"), TextManager.Get("VoipCaptureDeviceNotFound"))
|
||||||
TextManager.Get("VoipCaptureDeviceNotFound", returnNull: true) ?? "Could not start voice capture, suitable capture device not found.")
|
|
||||||
{
|
{
|
||||||
UserData = "capturedevicenotfound"
|
UserData = "capturedevicenotfound"
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ namespace Barotrauma
|
|||||||
private GUIListBox saveList;
|
private GUIListBox saveList;
|
||||||
|
|
||||||
private GUITextBox saveNameBox, seedBox;
|
private GUITextBox saveNameBox, seedBox;
|
||||||
|
private GUITickBox contextualTutorialBox;
|
||||||
|
|
||||||
|
private GUILayoutGroup subPreviewContainer;
|
||||||
|
|
||||||
private GUILayoutGroup subPreviewContainer;
|
private GUILayoutGroup subPreviewContainer;
|
||||||
|
|
||||||
@@ -23,6 +26,14 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public Action<Submarine, string, string> StartNewGame;
|
public Action<Submarine, string, string> StartNewGame;
|
||||||
public Action<string> LoadGame;
|
public Action<string> LoadGame;
|
||||||
|
public bool TutorialSelected
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (contextualTutorialBox == null) return false;
|
||||||
|
return contextualTutorialBox.Selected;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private readonly bool isMultiplayer;
|
private readonly bool isMultiplayer;
|
||||||
|
|
||||||
@@ -59,6 +70,12 @@ namespace Barotrauma
|
|||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.02f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, TextManager.Get("MapSeed") + ":");
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.02f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, TextManager.Get("MapSeed") + ":");
|
||||||
seedBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, ToolBox.RandomSeed(8));
|
seedBox = new GUITextBox(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, ToolBox.RandomSeed(8));
|
||||||
|
|
||||||
|
if (!isMultiplayer)
|
||||||
|
{
|
||||||
|
contextualTutorialBox = new GUITickBox(new RectTransform(new Point(32, 32), leftColumn.RectTransform), TextManager.Get("TutorialActive"));
|
||||||
|
UpdateTutorialSelection();
|
||||||
|
}
|
||||||
|
|
||||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.02f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, TextManager.Get("SelectedSub") + ":");
|
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.02f), leftColumn.RectTransform) { MinSize = new Point(0, 20) }, TextManager.Get("SelectedSub") + ":");
|
||||||
var filterContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), isHorizontal: true)
|
var filterContainer = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.05f), leftColumn.RectTransform), isHorizontal: true)
|
||||||
{
|
{
|
||||||
@@ -385,7 +402,14 @@ namespace Barotrauma
|
|||||||
},
|
},
|
||||||
Enabled = false
|
Enabled = false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void UpdateTutorialSelection()
|
||||||
|
{
|
||||||
|
if (isMultiplayer) return;
|
||||||
|
Tutorial contextualTutorial = Tutorial.Tutorials.Find(t => t is ContextualTutorial);
|
||||||
|
contextualTutorialBox.Selected = (contextualTutorial != null) ? !GameMain.Config.CompletedTutorialNames.Contains(contextualTutorial.Name) : true;
|
||||||
|
}
|
||||||
|
|
||||||
private bool SelectSaveFile(GUIComponent component, object obj)
|
private bool SelectSaveFile(GUIComponent component, object obj)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -78,6 +78,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
var tabValues = Enum.GetValues(typeof(Tab));
|
var tabValues = Enum.GetValues(typeof(Tab));
|
||||||
|
float minTextScale = 1.0f;
|
||||||
foreach (Tab tab in tabValues)
|
foreach (Tab tab in tabValues)
|
||||||
{
|
{
|
||||||
var tabButton = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), tabButtonContainer.RectTransform),
|
var tabButton = new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), tabButtonContainer.RectTransform),
|
||||||
@@ -92,12 +93,17 @@ namespace Barotrauma
|
|||||||
var buttonSprite = tabButton.Style.Sprites[GUIComponent.ComponentState.None][0];
|
var buttonSprite = tabButton.Style.Sprites[GUIComponent.ComponentState.None][0];
|
||||||
tabButton.RectTransform.MaxSize = new Point(
|
tabButton.RectTransform.MaxSize = new Point(
|
||||||
(int)(tabButton.Rect.Height * (buttonSprite.Sprite.size.X / buttonSprite.Sprite.size.Y)), int.MaxValue);
|
(int)(tabButton.Rect.Height * (buttonSprite.Sprite.size.X / buttonSprite.Sprite.size.Y)), int.MaxValue);
|
||||||
|
|
||||||
tabButtons.Add(tabButton);
|
tabButtons.Add(tabButton);
|
||||||
tabButton.Font = GUI.LargeFont;
|
tabButton.Font = GUI.LargeFont;
|
||||||
|
tabButton.TextBlock.AutoScale = true;
|
||||||
|
minTextScale = Math.Min(tabButton.TextBlock.TextScale, minTextScale);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
GUITextBlock.AutoScaleAndNormalize(tabButtons.Select(t => t.TextBlock));
|
|
||||||
|
foreach (GUIButton tabButton in tabButtons)
|
||||||
|
{
|
||||||
|
tabButton.TextBlock.TextScale = minTextScale;
|
||||||
|
}
|
||||||
|
|
||||||
// crew tab -------------------------------------------------------------------------
|
// crew tab -------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -59,10 +59,10 @@ namespace Barotrauma
|
|||||||
Stretch = true,
|
Stretch = true,
|
||||||
RelativeSpacing = 0.02f
|
RelativeSpacing = 0.02f
|
||||||
};
|
};
|
||||||
|
|
||||||
// === CAMPAIGN
|
// === CAMPAIGN
|
||||||
var campaignHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 1.0f), parent: buttonsParent.RectTransform) { RelativeOffset = new Vector2(0.1f, 0.0f) }, isHorizontal: true);
|
var campaignHolder = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 1.0f), parent: buttonsParent.RectTransform) { RelativeOffset = new Vector2(0.1f, 0.0f) }, isHorizontal: true);
|
||||||
|
|
||||||
new GUIImage(new RectTransform(new Vector2(0.2f, 0.7f), campaignHolder.RectTransform), "MainMenuCampaignIcon")
|
new GUIImage(new RectTransform(new Vector2(0.2f, 0.7f), campaignHolder.RectTransform), "MainMenuCampaignIcon")
|
||||||
{
|
{
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
@@ -84,17 +84,6 @@ namespace Barotrauma
|
|||||||
RelativeSpacing = 0.035f
|
RelativeSpacing = 0.035f
|
||||||
};
|
};
|
||||||
|
|
||||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), campaignList.RectTransform), "Tutorial", textAlignment: Alignment.Left, style: "MainMenuGUIButton")
|
|
||||||
{
|
|
||||||
ForceUpperCase = true,
|
|
||||||
UserData = Tab.Tutorials,
|
|
||||||
OnClicked = (tb, userdata) =>
|
|
||||||
{
|
|
||||||
SelectTab(tb, userdata);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), campaignList.RectTransform), TextManager.Get("LoadGameButton"), textAlignment: Alignment.Left, style: "MainMenuGUIButton")
|
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), campaignList.RectTransform), TextManager.Get("LoadGameButton"), textAlignment: Alignment.Left, style: "MainMenuGUIButton")
|
||||||
{
|
{
|
||||||
ForceUpperCase = true,
|
ForceUpperCase = true,
|
||||||
@@ -195,10 +184,6 @@ namespace Barotrauma
|
|||||||
UserData = Tab.SteamWorkshop,
|
UserData = Tab.SteamWorkshop,
|
||||||
OnClicked = SelectTab
|
OnClicked = SelectTab
|
||||||
};
|
};
|
||||||
|
|
||||||
#if OSX && !DEBUG
|
|
||||||
steamWorkshopButton.Text += " (Not yet available on MacOS)";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), customizeList.RectTransform), TextManager.Get("SubEditorButton"), textAlignment: Alignment.Left, style: "MainMenuGUIButton")
|
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), customizeList.RectTransform), TextManager.Get("SubEditorButton"), textAlignment: Alignment.Left, style: "MainMenuGUIButton")
|
||||||
@@ -335,11 +320,13 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UpdateTutorialList();
|
||||||
|
|
||||||
this.game = game;
|
this.game = game;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Selection
|
#region Selection
|
||||||
public override void Select()
|
public override void Select()
|
||||||
{
|
{
|
||||||
base.Select();
|
base.Select();
|
||||||
@@ -354,6 +341,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
ResetButtonStates(null);
|
ResetButtonStates(null);
|
||||||
|
|
||||||
|
UpdateTutorialList();
|
||||||
|
|
||||||
|
ResetButtonStates(null);
|
||||||
|
|
||||||
GameAnalyticsManager.SetCustomDimension01("");
|
GameAnalyticsManager.SetCustomDimension01("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,14 +388,9 @@ namespace Barotrauma
|
|||||||
switch (selectedTab)
|
switch (selectedTab)
|
||||||
{
|
{
|
||||||
case Tab.NewGame:
|
case Tab.NewGame:
|
||||||
if (!GameMain.Config.CampaignDisclaimerShown)
|
|
||||||
{
|
|
||||||
selectedTab = 0;
|
|
||||||
GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.NewGame); });
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
campaignSetupUI.CreateDefaultSaveName();
|
campaignSetupUI.CreateDefaultSaveName();
|
||||||
campaignSetupUI.RandomizeSeed();
|
campaignSetupUI.RandomizeSeed();
|
||||||
|
campaignSetupUI.UpdateTutorialSelection();
|
||||||
campaignSetupUI.UpdateSubList(Submarine.SavedSubmarines);
|
campaignSetupUI.UpdateSubList(Submarine.SavedSubmarines);
|
||||||
break;
|
break;
|
||||||
case Tab.LoadGame:
|
case Tab.LoadGame:
|
||||||
@@ -421,13 +407,6 @@ namespace Barotrauma
|
|||||||
case Tab.HostServer:
|
case Tab.HostServer:
|
||||||
break;
|
break;
|
||||||
case Tab.Tutorials:
|
case Tab.Tutorials:
|
||||||
if (!GameMain.Config.CampaignDisclaimerShown)
|
|
||||||
{
|
|
||||||
selectedTab = 0;
|
|
||||||
GameMain.Instance.ShowCampaignDisclaimer(() => { SelectTab(null, Tab.Tutorials); });
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
UpdateTutorialList();
|
|
||||||
break;
|
break;
|
||||||
case Tab.CharacterEditor:
|
case Tab.CharacterEditor:
|
||||||
Submarine.MainSub = null;
|
Submarine.MainSub = null;
|
||||||
@@ -458,8 +437,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public bool ReturnToMainMenu(GUIButton button, object obj)
|
public bool ReturnToMainMenu(GUIButton button, object obj)
|
||||||
{
|
{
|
||||||
GUI.PreventPauseMenuToggle = false;
|
|
||||||
|
|
||||||
if (Selected != this)
|
if (Selected != this)
|
||||||
{
|
{
|
||||||
Select();
|
Select();
|
||||||
@@ -484,7 +461,7 @@ namespace Barotrauma
|
|||||||
otherButton.Selected = false;
|
otherButton.Selected = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private void QuickStart()
|
private void QuickStart()
|
||||||
{
|
{
|
||||||
@@ -702,7 +679,6 @@ namespace Barotrauma
|
|||||||
GameMain.TitleScreen.TitleSize.Y / 2.0f * GameMain.TitleScreen.Scale + 30.0f),
|
GameMain.TitleScreen.TitleSize.Y / 2.0f * GameMain.TitleScreen.Scale + 30.0f),
|
||||||
0.1f);
|
0.1f);
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
#if !OSX
|
|
||||||
if (Steam.SteamManager.USE_STEAM)
|
if (Steam.SteamManager.USE_STEAM)
|
||||||
{
|
{
|
||||||
if (GameMain.Config.UseSteamMatchmaking)
|
if (GameMain.Config.UseSteamMatchmaking)
|
||||||
@@ -712,16 +688,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
steamWorkshopButton.Enabled = Steam.SteamManager.IsInitialized;
|
steamWorkshopButton.Enabled = Steam.SteamManager.IsInitialized;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
if (Steam.SteamManager.USE_STEAM)
|
|
||||||
{
|
|
||||||
if (GameMain.Config.UseSteamMatchmaking)
|
|
||||||
{
|
|
||||||
joinServerButton.Enabled = Steam.SteamManager.IsInitialized;
|
|
||||||
hostServerButton.Enabled = Steam.SteamManager.IsInitialized;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#else
|
#else
|
||||||
joinServerButton.Enabled = true;
|
joinServerButton.Enabled = true;
|
||||||
hostServerButton.Enabled = true;
|
hostServerButton.Enabled = true;
|
||||||
@@ -806,11 +772,13 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
selectedSub = new Submarine(Path.Combine(SaveUtil.TempPath, selectedSub.Name + ".sub"), "");
|
selectedSub = new Submarine(Path.Combine(SaveUtil.TempPath, selectedSub.Name + ".sub"), "");
|
||||||
|
|
||||||
|
ContextualTutorial.Selected = campaignSetupUI.TutorialSelected;
|
||||||
GameMain.GameSession = new GameSession(selectedSub, saveName,
|
GameMain.GameSession = new GameSession(selectedSub, saveName,
|
||||||
GameModePreset.List.Find(g => g.Identifier == "singleplayercampaign"));
|
GameModePreset.List.Find(g => g.Identifier == "singleplayercampaign"));
|
||||||
(GameMain.GameSession.GameMode as CampaignMode).GenerateMap(mapSeed);
|
(GameMain.GameSession.GameMode as CampaignMode).GenerateMap(mapSeed);
|
||||||
|
|
||||||
|
|
||||||
GameMain.LobbyScreen.Select();
|
GameMain.LobbyScreen.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -832,7 +800,7 @@ namespace Barotrauma
|
|||||||
GameMain.LobbyScreen.Select();
|
GameMain.LobbyScreen.Select();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region UI Methods
|
#region UI Methods
|
||||||
private void CreateHostServerFields()
|
private void CreateHostServerFields()
|
||||||
{
|
{
|
||||||
Vector2 textLabelSize = new Vector2(1.0f, 0.1f);
|
Vector2 textLabelSize = new Vector2(1.0f, 0.1f);
|
||||||
@@ -913,7 +881,7 @@ namespace Barotrauma
|
|||||||
OnClicked = HostServerClicked
|
OnClicked = HostServerClicked
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -309,23 +309,14 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int prevIndex = -1;
|
|
||||||
var existingFrame = listBox.Content.FindChild(item);
|
var existingFrame = listBox.Content.FindChild(item);
|
||||||
if (existingFrame != null)
|
if (existingFrame != null) { listBox.Content.RemoveChild(existingFrame); }
|
||||||
{
|
|
||||||
prevIndex = listBox.Content.GetChildIndex(existingFrame);
|
|
||||||
listBox.Content.RemoveChild(existingFrame);
|
|
||||||
}
|
|
||||||
|
|
||||||
var itemFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.1f), listBox.Content.RectTransform, minSize: new Point(0, 80)),
|
var itemFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.1f), listBox.Content.RectTransform, minSize: new Point(0, 80)),
|
||||||
style: "ListBoxElement")
|
style: "ListBoxElement")
|
||||||
{
|
{
|
||||||
UserData = item
|
UserData = item
|
||||||
};
|
};
|
||||||
if (prevIndex > -1)
|
|
||||||
{
|
|
||||||
itemFrame.RectTransform.RepositionChildInHierarchy(prevIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
var innerFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.9f), itemFrame.RectTransform, Anchor.Center), isHorizontal: true)
|
var innerFrame = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.9f), itemFrame.RectTransform, Anchor.Center), isHorizontal: true)
|
||||||
{
|
{
|
||||||
@@ -338,7 +329,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
new GUIImage(new RectTransform(new Point(iconSize), innerFrame.RectTransform), itemPreviewSprites[item.PreviewImageUrl], scaleToFit: true)
|
new GUIImage(new RectTransform(new Point(iconSize), innerFrame.RectTransform), itemPreviewSprites[item.PreviewImageUrl], scaleToFit: true)
|
||||||
{
|
{
|
||||||
UserData = "previewimage",
|
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -346,7 +336,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
new GUIImage(new RectTransform(new Point(iconSize), innerFrame.RectTransform), SteamManager.Instance.DefaultPreviewImage, scaleToFit: true)
|
new GUIImage(new RectTransform(new Point(iconSize), innerFrame.RectTransform), SteamManager.Instance.DefaultPreviewImage, scaleToFit: true)
|
||||||
{
|
{
|
||||||
UserData = "previewimage",
|
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
try
|
try
|
||||||
@@ -394,7 +383,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
var titleText = new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), rightColumn.RectTransform), EnsureUTF8(item.Title), textAlignment: Alignment.CenterLeft, wrap: true)
|
var titleText = new GUITextBlock(new RectTransform(new Vector2(0.5f, 0.0f), rightColumn.RectTransform), EnsureUTF8(item.Title), textAlignment: Alignment.CenterLeft, wrap: true)
|
||||||
{
|
{
|
||||||
UserData = "titletext",
|
|
||||||
CanBeFocused = false
|
CanBeFocused = false
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -559,17 +547,7 @@ namespace Barotrauma
|
|||||||
itemPreviewSprites.Add(item.PreviewImageUrl, newSprite);
|
itemPreviewSprites.Add(item.PreviewImageUrl, newSprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CreateWorkshopItemFrame(item, listBox);
|
||||||
var previewImage = listBox.Content.FindChild(item)?.GetChildByUserData("previewimage") as GUIImage;
|
|
||||||
if (previewImage != null)
|
|
||||||
{
|
|
||||||
previewImage.Sprite = newSprite;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
CreateWorkshopItemFrame(item, listBox);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modsPreviewFrame.FindChild(item) != null)
|
if (modsPreviewFrame.FindChild(item) != null)
|
||||||
{
|
{
|
||||||
ShowItemPreview(item, modsPreviewFrame);
|
ShowItemPreview(item, modsPreviewFrame);
|
||||||
@@ -597,7 +575,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool ToggleItemEnabled(GUITickBox tickBox)
|
private bool ToggleItemEnabled(GUITickBox tickBox)
|
||||||
{
|
{
|
||||||
if (!(tickBox.UserData is Facepunch.Steamworks.Workshop.Item item)) { return false; }
|
Facepunch.Steamworks.Workshop.Item item = tickBox.UserData as Facepunch.Steamworks.Workshop.Item;
|
||||||
|
if (item == null) { return false; }
|
||||||
|
|
||||||
var updateButton = tickBox.Parent.FindChild("updatebutton");
|
var updateButton = tickBox.Parent.FindChild("updatebutton");
|
||||||
|
|
||||||
@@ -606,9 +585,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (!SteamManager.EnableWorkShopItem(item, false, out errorMsg))
|
if (!SteamManager.EnableWorkShopItem(item, false, out errorMsg))
|
||||||
{
|
{
|
||||||
tickBox.Visible = false;
|
tickBox.Enabled = false;
|
||||||
tickBox.Selected = false;
|
|
||||||
if (tickBox.Parent.GetChildByUserData("titletext") is GUITextBlock titleText) { titleText.TextColor = Color.Red; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -317,11 +317,10 @@ namespace Barotrauma
|
|||||||
Stretch = true
|
Stretch = true
|
||||||
};
|
};
|
||||||
|
|
||||||
entityCategoryButtons.Add(
|
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), tabButtonHolder.RectTransform), TextManager.Get("MapEntityCategory.All"), style: "GUITabButton")
|
||||||
new GUIButton(new RectTransform(new Vector2(1.0f, 1.0f), tabButtonHolder.RectTransform), TextManager.Get("MapEntityCategory.All"), style: "GUITabButton")
|
{
|
||||||
{
|
OnClicked = (btn, userdata) => { ClearFilter(); return true; }
|
||||||
OnClicked = (btn, userdata) => { ClearFilter(); return true; }
|
};
|
||||||
});
|
|
||||||
|
|
||||||
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
|
foreach (MapEntityCategory category in Enum.GetValues(typeof(MapEntityCategory)))
|
||||||
{
|
{
|
||||||
@@ -338,8 +337,6 @@ namespace Barotrauma
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
GUITextBlock.AutoScaleAndNormalize(entityCategoryButtons.Select(b => b.TextBlock));
|
|
||||||
|
|
||||||
entityList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.9f), entityListHolder.RectTransform, Anchor.BottomCenter))
|
entityList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.9f), entityListHolder.RectTransform, Anchor.BottomCenter))
|
||||||
{
|
{
|
||||||
OnSelected = SelectPrefab,
|
OnSelected = SelectPrefab,
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
float ambienceVolume = 0.8f;
|
float ambienceVolume = 0.8f;
|
||||||
if (Character.Controlled != null && !Character.Controlled.Removed)
|
if (Character.Controlled != null)
|
||||||
{
|
{
|
||||||
AnimController animController = Character.Controlled.AnimController;
|
AnimController animController = Character.Controlled.AnimController;
|
||||||
if (animController.HeadInWater)
|
if (animController.HeadInWater)
|
||||||
|
|||||||
@@ -58,6 +58,9 @@
|
|||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Reference Include="Concentus, Version=1.1.6.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
|
<HintPath>..\..\Libraries\NuGet\Concentus.1.1.7\lib\portable-net45+win+wpa81+wp80\Concentus.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="GameAnalytics.Mono, Version=1.0.6710.29255, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="GameAnalytics.Mono, Version=1.0.6710.29255, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll</HintPath>
|
<HintPath>..\..\Libraries\NuGet\GameAnalytics.Mono.SDK.1.1.12\lib\net45\GameAnalytics.Mono.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -212,10 +215,6 @@
|
|||||||
</BootstrapperPackage>
|
</BootstrapperPackage>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\Libraries\Concentus\CSharp\Concentus\Concentus.csproj">
|
|
||||||
<Project>{0e7fee6a-15e5-4a4e-943c-80276003478c}</Project>
|
|
||||||
<Name>Concentus</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.csproj">
|
<ProjectReference Include="..\..\Libraries\Facepunch.Steamworks\Facepunch.Steamworks.csproj">
|
||||||
<Project>{3af0347c-5a9b-4421-868c-8ee3dbfaebc6}</Project>
|
<Project>{3af0347c-5a9b-4421-868c-8ee3dbfaebc6}</Project>
|
||||||
<Name>Facepunch.Steamworks</Name>
|
<Name>Facepunch.Steamworks</Name>
|
||||||
|
|||||||
@@ -1,35 +1,35 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<configuration>
|
<configuration>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="SharpDX" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
<assemblyIdentity name="SharpDX" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="SharpDX.MediaFoundation" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
<assemblyIdentity name="SharpDX.MediaFoundation" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="SharpDX.XAudio2" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
<assemblyIdentity name="SharpDX.XAudio2" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="SharpDX.DXGI" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
<assemblyIdentity name="SharpDX.DXGI" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="SharpDX.Direct3D11" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
<assemblyIdentity name="SharpDX.Direct3D11" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="SharpDX.Direct2D1" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
<assemblyIdentity name="SharpDX.Direct2D1" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="SharpDX.XInput" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
<assemblyIdentity name="SharpDX.XInput" publicKeyToken="b4dcf0f35e5521f1" culture="neutral" />
|
||||||
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
<bindingRedirect oldVersion="0.0.0.0-4.2.0.0" newVersion="4.2.0.0" />
|
||||||
</dependentAssembly>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<packages>
|
<packages>
|
||||||
|
<package id="Concentus" version="1.1.7" targetFramework="net45" />
|
||||||
<package id="GameAnalytics.Mono.SDK" version="1.1.12" targetFramework="net45" />
|
<package id="GameAnalytics.Mono.SDK" version="1.1.12" targetFramework="net45" />
|
||||||
<package id="Microsoft.NETCore.Platforms" version="3.0.0-preview.19073.11" targetFramework="net45" />
|
<package id="Microsoft.NETCore.Platforms" version="3.0.0-preview.19073.11" targetFramework="net45" />
|
||||||
<package id="MonoGame.Framework.DesktopGL" version="3.7.1.189" targetFramework="net45" />
|
<package id="MonoGame.Framework.DesktopGL" version="3.7.1.189" targetFramework="net45" />
|
||||||
|
|||||||
@@ -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.8.10.0")]
|
[assembly: AssemblyVersion("0.8.9.10")]
|
||||||
[assembly: AssemblyFileVersion("0.8.10.0")]
|
[assembly: AssemblyFileVersion("0.8.9.10")]
|
||||||
|
|||||||
@@ -216,7 +216,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup Condition="$(Configuration.EndsWith('Linux'))">
|
<ItemGroup Condition="'$(Configuration)|$(Platform)' == 'DebugLinux|x64'">
|
||||||
<None Include="Launch_BarotraumaServer">
|
<None Include="Launch_BarotraumaServer">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
|
|||||||
@@ -146,20 +146,11 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the file paths of all files of the given type in the content packages.
|
/// Returns the file paths of all files of the given type in the currently selected content packages.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="type"></param>
|
public IEnumerable<string> GetFilesOfType(ContentType type)
|
||||||
/// <param name="searchAllContentPackages">If true, also returns files in content packages that are installed but not currently selected.</param>
|
|
||||||
public IEnumerable<string> GetFilesOfType(ContentType type, bool searchAllContentPackages = false)
|
|
||||||
{
|
{
|
||||||
if (searchAllContentPackages)
|
return ContentPackage.GetFilesOfType(SelectedPackages, type);
|
||||||
{
|
|
||||||
return ContentPackage.GetFilesOfType(ContentPackage.List, type);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return ContentPackage.GetFilesOfType(SelectedPackages, type);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartServer()
|
public void StartServer()
|
||||||
|
|||||||
@@ -1960,8 +1960,6 @@ namespace Barotrauma.Networking
|
|||||||
msg.Write(false);
|
msg.Write(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
msg.Write(serverSettings.AllowRagdollButton);
|
|
||||||
|
|
||||||
serverSettings.WriteMonsterEnabled(msg);
|
serverSettings.WriteMonsterEnabled(msg);
|
||||||
|
|
||||||
CompressOutgoingMessage(msg);
|
CompressOutgoingMessage(msg);
|
||||||
|
|||||||
@@ -12,7 +12,6 @@
|
|||||||
<Item file="Content/Items/Jobgear/Assistant/assistant_gear.xml" />
|
<Item file="Content/Items/Jobgear/Assistant/assistant_gear.xml" />
|
||||||
<Item file="Content/Items/Jobgear/Watchman/watchman_gear.xml" />
|
<Item file="Content/Items/Jobgear/Watchman/watchman_gear.xml" />
|
||||||
<Item file="Content/Items/Jobgear/Security/securityofficer_gear.xml" />
|
<Item file="Content/Items/Jobgear/Security/securityofficer_gear.xml" />
|
||||||
<Item file="Content/Items/Jobgear/Clown/clown.xml" />
|
|
||||||
<Item file="Content/Items/Jobgear/misc.xml" />
|
<Item file="Content/Items/Jobgear/misc.xml" />
|
||||||
<Item file="Content/Items/CreatureLoot/creatureloot.xml" />
|
<Item file="Content/Items/CreatureLoot/creatureloot.xml" />
|
||||||
<Item file="Content/Items/Diving/divinggear.xml" />
|
<Item file="Content/Items/Diving/divinggear.xml" />
|
||||||
@@ -74,11 +73,14 @@
|
|||||||
<Character file="Content/Characters/Hammerhead/Hammerhead.xml" />
|
<Character file="Content/Characters/Hammerhead/Hammerhead.xml" />
|
||||||
<Outpost file="Content/Map/Outposts/Outpost.sub" />
|
<Outpost file="Content/Map/Outposts/Outpost.sub" />
|
||||||
<Submarine file="Submarines/Orca.sub" />
|
<Submarine file="Submarines/Orca.sub" />
|
||||||
|
<Submarine file="Submarines/Berilia.sub" />
|
||||||
<Submarine file="Submarines/Typhon.sub" />
|
<Submarine file="Submarines/Typhon.sub" />
|
||||||
<Submarine file="Submarines/Selkie.sub" />
|
<Submarine file="Submarines/Selkie.sub" />
|
||||||
<Submarine file="Submarines/Bunyip.sub" />
|
<Submarine file="Submarines/Bunyip.sub" />
|
||||||
<Submarine file="Submarines/Humpback.sub" />
|
<Submarine file="Submarines/Humpback.sub" />
|
||||||
<Submarine file="Submarines/Dugong.sub" />
|
<Submarine file="Submarines/Dugong.sub" />
|
||||||
|
<Submarine file="Submarines/Remora.sub" />
|
||||||
|
<Submarine file="Submarines/RemoraDrone.sub" />
|
||||||
<Submarine file="Submarines/Venture.sub" />
|
<Submarine file="Submarines/Venture.sub" />
|
||||||
<Text file="Content/Texts/EnglishVanilla.xml" />
|
<Text file="Content/Texts/EnglishVanilla.xml" />
|
||||||
<UIStyle file="Content/UI/style.xml"/>
|
<UIStyle file="Content/UI/style.xml"/>
|
||||||
|
|||||||
@@ -181,7 +181,6 @@
|
|||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Map\Entity.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\Map\Entity.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Map\EntityGrid.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\Map\EntityGrid.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Map\Explosion.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\Map\Explosion.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Map\DummyFireSource.cs" />
|
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Map\FireSource.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\Map\FireSource.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Map\Gap.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\Map\Gap.cs" />
|
||||||
<Compile Include="$(MSBuildThisFileDirectory)Source\Map\Hull.cs" />
|
<Compile Include="$(MSBuildThisFileDirectory)Source\Map\Hull.cs" />
|
||||||
|
|||||||
@@ -364,18 +364,9 @@
|
|||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Assemblies\airlock doors.xml">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Assemblies\airlock doors.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Assemblies\AutoDoor.xml">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Assemblies\AutoHatch.xml">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Assemblies\Automatic Bilge Pump.xml">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Assemblies\Automatic Bilge Pump.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Assemblies\WindowedAutoDoor.xml">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Door\door2.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Door\door2.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -388,18 +379,6 @@
|
|||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Assistant\assistant_gear.xml">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Assistant\assistant_gear.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Clown\clown_legs_female.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Clown\clown_legs_male.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Clown\clown_torso_female.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Clown\clown_torso_male.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Engineer\engineer_gear.xml">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Engineer\engineer_gear.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -430,12 +409,6 @@
|
|||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Mechanic\mechanic_torso_male_2.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Mechanic\mechanic_torso_male_2.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Clown\clown.xml">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Old\clownshirt.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Watchman\watchman_gear.xml">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Watchman\watchman_gear.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -472,70 +445,34 @@
|
|||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Map\LabelLetters.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Map\LabelLetters.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Map\OpbgMaintenanceBay.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Map\OpbgShop.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Map\OpbgSocialCenter.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Map\OutpostWall_A.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Map\OutpostWall_A.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Map\OutpostWall_B.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\ContextualTutorial\1_CommandReactor\BaroTutorial_CommandReactor.mp4">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Map\OutpostWall_C.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\ContextualTutorial\2_NavConsole\BaroTutorial_NavConsole.mp4">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_command.mp4">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\ContextualTutorial\3_Flood\BaroTutorial_Flood.mp4">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_cpr.mp4">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\ContextualTutorial\4_Reactor\BaroTutorial_Reactor.mp4">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_deconstruct.mp4">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\ContextualTutorial\5_EnemyOnSonar\BaroTutorial_EnemyOnSonar.mp4">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_equip.mp4">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\ContextualTutorial\6_Degrading2\BaroTutorial_Degrading.mp4">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_fabricate.mp4">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\ContextualTutorial\7_Medical\BaroTutorial_Medical.mp4">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_inventory.mp4">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\ContextualTutorial\8_Approach1\BaroTutorial_Approach.mp4">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_leaks.mp4">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\ContextualTutorial\9_SwitchCharacter\BaroTutorial_SwitchCharacter.mp4">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_loaders.mp4">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_medinterface1.mp4">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_medinterface2.mp4">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_navigation.mp4">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_ranged.mp4">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_reactor.mp4">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_undock.mp4">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_unequip.mp4">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialVideos\tutorial_wiring.mp4">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\UI\tutorialAtlas.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\UI\tutorialAtlas.png">
|
||||||
@@ -1207,9 +1144,6 @@
|
|||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Lights\pointlight_falloff.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Lights\pointlight_falloff.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Lights\light_fluorescent_L2.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Map\AlienBackground1.png">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Map\AlienBackground1.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -1701,6 +1635,15 @@
|
|||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Captain\captain_gear.xml">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Captain\captain_gear.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\clownmask.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\clownpants.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\clownshirt.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Medic\medic_gear.xml">
|
<Content Include="$(MSBuildThisFileDirectory)Content\Items\Jobgear\Medic\medic_gear.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -2166,19 +2109,9 @@
|
|||||||
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Impact\SoftImpact3.ogg">
|
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Impact\SoftImpact3.ogg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Tutorials\Dugong_Tutorial.sub">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialOutpost.sub">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="$(MSBuildThisFileDirectory)Submarines\Berilia.sub">
|
<None Include="$(MSBuildThisFileDirectory)Submarines\Berilia.sub">
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Submarines\Dugong_Tutorial.sub">
|
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Include="$(MSBuildThisFileDirectory)Submarines\TutorialOutpost.sub" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Characters\Carrier\CARRIER_alarmLoop.ogg">
|
<None Include="$(MSBuildThisFileDirectory)Content\Characters\Carrier\CARRIER_alarmLoop.ogg">
|
||||||
@@ -3133,6 +3066,9 @@
|
|||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Water\SplashLoop.ogg" />
|
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Water\SplashLoop.ogg" />
|
||||||
|
<None Include="$(MSBuildThisFileDirectory)Content\Tutorials\TutorialSub.sub">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Ambient\Ambient1.ogg">
|
<None Include="$(MSBuildThisFileDirectory)Content\Sounds\Ambient\Ambient1.ogg">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
@@ -3329,10 +3265,10 @@
|
|||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Submarines\Remora.sub">
|
<None Include="$(MSBuildThisFileDirectory)Submarines\Remora.sub">
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Submarines\RemoraDrone.sub">
|
<None Include="$(MSBuildThisFileDirectory)Submarines\RemoraDrone.sub">
|
||||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</None>
|
</None>
|
||||||
<None Include="$(MSBuildThisFileDirectory)Submarines\Selkie.sub">
|
<None Include="$(MSBuildThisFileDirectory)Submarines\Selkie.sub">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
|||||||
@@ -320,9 +320,8 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
State = AIState.Idle;
|
State = AIState.Idle;
|
||||||
}
|
}
|
||||||
else if (Character.Health < fleeHealthThreshold && SwarmBehavior == null)
|
else if (Character.Health < fleeHealthThreshold)
|
||||||
{
|
{
|
||||||
// Don't flee from damage if in a swarm.
|
|
||||||
State = AIState.Escape;
|
State = AIState.Escape;
|
||||||
}
|
}
|
||||||
else if (targetingPriority != null)
|
else if (targetingPriority != null)
|
||||||
@@ -331,6 +330,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LatchOntoAI?.Update(this, deltaTime);
|
||||||
|
|
||||||
if (SelectedAiTarget != null && (SelectedAiTarget.Entity == null || SelectedAiTarget.Entity.Removed))
|
if (SelectedAiTarget != null && (SelectedAiTarget.Entity == null || SelectedAiTarget.Entity.Removed))
|
||||||
{
|
{
|
||||||
State = AIState.Idle;
|
State = AIState.Idle;
|
||||||
@@ -368,15 +369,8 @@ namespace Barotrauma
|
|||||||
default:
|
default:
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
LatchOntoAI?.Update(this, deltaTime);
|
SwarmBehavior?.Update(deltaTime);
|
||||||
IsSteeringThroughGap = false;
|
|
||||||
if (SwarmBehavior != null)
|
|
||||||
{
|
|
||||||
SwarmBehavior.IsActive = State == AIState.Idle && Character.CurrentHull == null;
|
|
||||||
SwarmBehavior.Refresh();
|
|
||||||
SwarmBehavior.UpdateSteering(deltaTime);
|
|
||||||
}
|
|
||||||
steeringManager.Update(Character.AnimController.GetCurrentSpeed(run));
|
steeringManager.Update(Character.AnimController.GetCurrentSpeed(run));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -499,7 +493,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!IsLatchedOnSub)
|
if (!IsProperlyLatchedOnSub)
|
||||||
{
|
{
|
||||||
UpdateWallTarget();
|
UpdateWallTarget();
|
||||||
}
|
}
|
||||||
@@ -558,7 +552,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
WallSection section = wallTarget.Structure.GetSection(wallTarget.SectionIndex);
|
WallSection section = wallTarget.Structure.GetSection(wallTarget.SectionIndex);
|
||||||
Vector2 targetPos = wallTarget.Structure.SectionPosition(wallTarget.SectionIndex, true);
|
Vector2 targetPos = wallTarget.Structure.SectionPosition(wallTarget.SectionIndex, true);
|
||||||
if (section?.gap != null && SteerThroughGap(wallTarget.Structure, section, targetPos, deltaTime))
|
if (section?.gap != null && section.gap.IsRoomToRoom && SteerThroughGap(wallTarget.Structure, section, targetPos, deltaTime))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -799,21 +793,9 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsSteeringThroughGap { get; private set; }
|
|
||||||
private bool SteerThroughGap(Structure wall, WallSection section, Vector2 targetWorldPos, float deltaTime)
|
private bool SteerThroughGap(Structure wall, WallSection section, Vector2 targetWorldPos, float deltaTime)
|
||||||
{
|
{
|
||||||
IsSteeringThroughGap = true;
|
|
||||||
SelectedAiTarget = wall.AiTarget;
|
|
||||||
wallTarget = null;
|
|
||||||
LatchOntoAI?.DeattachFromBody();
|
|
||||||
Character.AnimController.ReleaseStuckLimbs();
|
|
||||||
Hull targetHull = section.gap?.FlowTargetHull;
|
Hull targetHull = section.gap?.FlowTargetHull;
|
||||||
float distance = Vector2.Distance(Character.WorldPosition, targetWorldPos);
|
|
||||||
float maxDistance = Math.Min(wall.Rect.Width, wall.Rect.Height);
|
|
||||||
if (distance > maxDistance)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (targetHull != null)
|
if (targetHull != null)
|
||||||
{
|
{
|
||||||
if (wall.IsHorizontal)
|
if (wall.IsHorizontal)
|
||||||
@@ -824,7 +806,16 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
targetWorldPos.X = targetHull.WorldRect.Center.X;
|
targetWorldPos.X = targetHull.WorldRect.Center.X;
|
||||||
}
|
}
|
||||||
steeringManager.SteeringManual(deltaTime, Vector2.Normalize(targetWorldPos - Character.WorldPosition));
|
LatchOntoAI?.DeattachFromBody();
|
||||||
|
Character.AnimController.ReleaseStuckLimbs();
|
||||||
|
if (steeringManager is IndoorsSteeringManager)
|
||||||
|
{
|
||||||
|
steeringManager.SteeringManual(deltaTime, Vector2.Normalize(targetWorldPos - Character.WorldPosition));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
steeringManager.SteeringSeek(ConvertUnits.ToSimUnits(targetWorldPos));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@@ -1056,43 +1047,19 @@ namespace Barotrauma
|
|||||||
#region Targeting
|
#region Targeting
|
||||||
private bool IsLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub;
|
private bool IsLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub;
|
||||||
|
|
||||||
|
private bool IsProperlyLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub && SelectedAiTarget?.Entity == wallTarget?.Structure;
|
||||||
|
|
||||||
//goes through all the AItargets, evaluates how preferable it is to attack the target,
|
//goes through all the AItargets, evaluates how preferable it is to attack the target,
|
||||||
//whether the Character can see/hear the target and chooses the most preferable target within
|
//whether the Character can see/hear the target and chooses the most preferable target within
|
||||||
//sight/hearing range
|
//sight/hearing range
|
||||||
public AITarget UpdateTargets(Character character, out TargetingPriority priority)
|
public AITarget UpdateTargets(Character character, out TargetingPriority priority)
|
||||||
{
|
{
|
||||||
if ((SelectedAiTarget != null || wallTarget != null) && IsLatchedOnSub)
|
if (IsProperlyLatchedOnSub)
|
||||||
{
|
{
|
||||||
var wall = SelectedAiTarget.Entity as Structure;
|
// If attached to a valid target, just keep the target.
|
||||||
if (wall == null)
|
// Priority not used in this case.
|
||||||
{
|
priority = null;
|
||||||
wall = wallTarget?.Structure;
|
return SelectedAiTarget;
|
||||||
}
|
|
||||||
// The target is not a wall or it's not the same as we are attached to -> release
|
|
||||||
bool releaseTarget = wall == null || !wall.Bodies.Contains(LatchOntoAI.AttachJoints[0].BodyB);
|
|
||||||
if (!releaseTarget)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < wall.Sections.Length; i++)
|
|
||||||
{
|
|
||||||
if (CanPassThroughHole(wall, i))
|
|
||||||
{
|
|
||||||
releaseTarget = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (releaseTarget)
|
|
||||||
{
|
|
||||||
SelectedAiTarget = null;
|
|
||||||
wallTarget = null;
|
|
||||||
LatchOntoAI.DeattachFromBody();
|
|
||||||
}
|
|
||||||
else if (SelectedAiTarget?.Entity == wallTarget?.Structure)
|
|
||||||
{
|
|
||||||
// If attached to a valid target, just keep the target.
|
|
||||||
// Priority not used in this case.
|
|
||||||
priority = null;
|
|
||||||
return SelectedAiTarget;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
AITarget newTarget = null;
|
AITarget newTarget = null;
|
||||||
priority = null;
|
priority = null;
|
||||||
@@ -1175,7 +1142,7 @@ namespace Barotrauma
|
|||||||
else if (target.Entity != null)
|
else if (target.Entity != null)
|
||||||
{
|
{
|
||||||
//skip the target if it's a room and the character is already inside a sub
|
//skip the target if it's a room and the character is already inside a sub
|
||||||
if (character.CurrentHull != null && target.Entity is Hull) { continue; }
|
if (character.CurrentHull != null && target.Entity is Hull) continue;
|
||||||
|
|
||||||
Door door = null;
|
Door door = null;
|
||||||
if (target.Entity is Item item)
|
if (target.Entity is Item item)
|
||||||
@@ -1204,37 +1171,23 @@ namespace Barotrauma
|
|||||||
// Ignore structures that doesn't have a body (not walls)
|
// Ignore structures that doesn't have a body (not walls)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (s.IsPlatform)
|
// Ignore walls when inside.
|
||||||
{
|
valueModifier = character.CurrentHull == null ? 1 : 0;
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (character.CurrentHull != null)
|
|
||||||
{
|
|
||||||
// Ignore walls when inside.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
valueModifier = 1;
|
|
||||||
float wallMaxHealth = 400; // Anything more than this is ignored -> 200 = 1
|
|
||||||
// Prefer weaker targets.
|
|
||||||
valueModifier *= MathHelper.Lerp(1.5f, 0.5f, MathUtils.InverseLerp(0, 1, s.Health / wallMaxHealth));
|
|
||||||
if (aggressiveBoarding)
|
if (aggressiveBoarding)
|
||||||
{
|
{
|
||||||
var hulls = s.Submarine.GetHulls(false);
|
|
||||||
for (int i = 0; i < s.Sections.Length; i++)
|
for (int i = 0; i < s.Sections.Length; i++)
|
||||||
{
|
{
|
||||||
var section = s.Sections[i];
|
var section = s.Sections[i];
|
||||||
if (section.gap != null)
|
if (CanPassThroughHole(s, i))
|
||||||
{
|
{
|
||||||
if (CanPassThroughHole(s, i))
|
// Ignore walls that can be passed through
|
||||||
{
|
valueModifier = 0;
|
||||||
bool leadsInside = !section.gap.IsRoomToRoom && section.gap.FlowTargetHull != null && hulls.Any(h => h.Rect.Intersects(section.rect));
|
break;
|
||||||
valueModifier *= leadsInside ? 5 : 0;
|
}
|
||||||
}
|
else if (section.gap != null)
|
||||||
else
|
{
|
||||||
{
|
// up to 100% priority increase for every gap in the wall
|
||||||
// up to 100% priority increase for every gap in the wall
|
valueModifier *= 1 + section.gap.Open;
|
||||||
valueModifier *= 1 + section.gap.Open;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -223,10 +223,8 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isDiving = character.AnimController.InWater && character.AnimController.HeadInWater;
|
|
||||||
|
|
||||||
//only humanoids can climb ladders
|
//only humanoids can climb ladders
|
||||||
if (!isDiving && character.AnimController is HumanoidAnimController && IsNextLadderSameAsCurrent)
|
if (character.AnimController is HumanoidAnimController && IsNextLadderSameAsCurrent)
|
||||||
{
|
{
|
||||||
if (character.SelectedConstruction != currentPath.CurrentNode.Ladders.Item &&
|
if (character.SelectedConstruction != currentPath.CurrentNode.Ladders.Item &&
|
||||||
currentPath.CurrentNode.Ladders.Item.IsInsideTrigger(character.WorldPosition))
|
currentPath.CurrentNode.Ladders.Item.IsInsideTrigger(character.WorldPosition))
|
||||||
@@ -236,7 +234,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
var collider = character.AnimController.Collider;
|
var collider = character.AnimController.Collider;
|
||||||
if (character.IsClimbing && !isDiving)
|
if (character.IsClimbing)
|
||||||
{
|
{
|
||||||
Vector2 diff = currentPath.CurrentNode.SimPosition - pos;
|
Vector2 diff = currentPath.CurrentNode.SimPosition - pos;
|
||||||
bool nextLadderSameAsCurrent = IsNextLadderSameAsCurrent;
|
bool nextLadderSameAsCurrent = IsNextLadderSameAsCurrent;
|
||||||
@@ -280,12 +278,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
else if (character.AnimController.InWater)
|
else if (character.AnimController.InWater)
|
||||||
{
|
{
|
||||||
// If the character is underwater, we don't need the ladders anymore
|
|
||||||
if (character.IsClimbing && isDiving)
|
|
||||||
{
|
|
||||||
character.AnimController.Anim = AnimController.Animation.None;
|
|
||||||
character.SelectedConstruction = null;
|
|
||||||
}
|
|
||||||
if (Vector2.DistanceSquared(pos, currentPath.CurrentNode.SimPosition) < MathUtils.Pow(collider.radius * 3, 2))
|
if (Vector2.DistanceSquared(pos, currentPath.CurrentNode.SimPosition) < MathUtils.Pow(collider.radius * 3, 2))
|
||||||
{
|
{
|
||||||
currentPath.SkipToNextNode();
|
currentPath.SkipToNextNode();
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ namespace Barotrauma
|
|||||||
get { return attachJoints.Count > 0; }
|
get { return attachJoints.Count > 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsAttachedToSub => IsAttached && (attachTargetBody?.UserData is Submarine || attachTargetBody?.UserData is Entity entity && entity.Submarine != null);
|
public bool IsAttachedToSub => IsAttached && attachTargetBody?.UserData is Entity entity && (entity is Submarine sub || entity?.Submarine != null);
|
||||||
|
|
||||||
public LatchOntoAI(XElement element, EnemyAIController enemyAI)
|
public LatchOntoAI(XElement element, EnemyAIController enemyAI)
|
||||||
{
|
{
|
||||||
@@ -190,7 +190,7 @@ namespace Barotrauma
|
|||||||
case AIController.AIState.Attack:
|
case AIController.AIState.Attack:
|
||||||
if (enemyAI.AttackingLimb != null)
|
if (enemyAI.AttackingLimb != null)
|
||||||
{
|
{
|
||||||
if (attachToSub && !enemyAI.IsSteeringThroughGap && wallAttachPos != Vector2.Zero && attachTargetBody != null)
|
if (attachToSub && wallAttachPos != Vector2.Zero && attachTargetBody != null)
|
||||||
{
|
{
|
||||||
// is not attached or is attached to something else
|
// is not attached or is attached to something else
|
||||||
if (!IsAttached || IsAttached && attachJoints[0].BodyB == attachTargetBody)
|
if (!IsAttached || IsAttached && attachJoints[0].BodyB == attachTargetBody)
|
||||||
|
|||||||
@@ -14,16 +14,11 @@ namespace Barotrauma
|
|||||||
private float maxDistFromCenter;
|
private float maxDistFromCenter;
|
||||||
private float cohesion;
|
private float cohesion;
|
||||||
|
|
||||||
public List<AICharacter> Members { get; private set; } = new List<AICharacter>();
|
private List<AICharacter> members = new List<AICharacter>();
|
||||||
public HashSet<AICharacter> ActiveMembers { get; private set; } = new HashSet<AICharacter>();
|
|
||||||
|
|
||||||
private EnemyAIController ai;
|
private AIController ai;
|
||||||
|
|
||||||
public bool IsActive { get; set; }
|
public SwarmBehavior(XElement element, AIController ai)
|
||||||
public bool IsEnoughMembers => ActiveMembers.Count > 1;
|
|
||||||
|
|
||||||
|
|
||||||
public SwarmBehavior(XElement element, EnemyAIController ai)
|
|
||||||
{
|
{
|
||||||
this.ai = ai;
|
this.ai = ai;
|
||||||
minDistFromClosest = ConvertUnits.ToSimUnits(element.GetAttributeFloat("mindistfromclosest", 10.0f));
|
minDistFromClosest = ConvertUnits.ToSimUnits(element.GetAttributeFloat("mindistfromclosest", 10.0f));
|
||||||
@@ -37,36 +32,21 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (character.AIController is EnemyAIController enemyAI && enemyAI.SwarmBehavior != null)
|
if (character.AIController is EnemyAIController enemyAI && enemyAI.SwarmBehavior != null)
|
||||||
{
|
{
|
||||||
enemyAI.SwarmBehavior.Members = swarm.ToList();
|
enemyAI.SwarmBehavior.members = swarm.ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Refresh()
|
public void Update(float deltaTime)
|
||||||
{
|
{
|
||||||
Members.RemoveAll(m => m.IsDead || m.Removed);
|
members.RemoveAll(m => m.IsDead || m.Removed);
|
||||||
foreach (var member in Members)
|
if (members.Count < 2) { return; }
|
||||||
{
|
|
||||||
if (!member.AIController.Enabled && member.IsRemotePlayer || Character.Controlled == member || !((EnemyAIController)member.AIController).SwarmBehavior.IsActive)
|
|
||||||
{
|
|
||||||
ActiveMembers.Remove(member);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ActiveMembers.Add(member);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void UpdateSteering(float deltaTime)
|
|
||||||
{
|
|
||||||
if (!IsActive) { return; }
|
|
||||||
if (!IsEnoughMembers) { return; }
|
|
||||||
//calculate the "center of mass" of the swarm and the distance to the closest character in the swarm
|
//calculate the "center of mass" of the swarm and the distance to the closest character in the swarm
|
||||||
float closestDistSqr = float.MaxValue;
|
float closestDistSqr = float.MaxValue;
|
||||||
Vector2 center = Vector2.Zero;
|
Vector2 center = Vector2.Zero;
|
||||||
AICharacter closest = null;
|
AICharacter closest = null;
|
||||||
foreach (AICharacter member in Members)
|
foreach (AICharacter member in members)
|
||||||
{
|
{
|
||||||
center += member.SimPosition;
|
center += member.SimPosition;
|
||||||
if (member == ai.Character) { continue; }
|
if (member == ai.Character) { continue; }
|
||||||
@@ -77,7 +57,7 @@ namespace Barotrauma
|
|||||||
closest = member;
|
closest = member;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
center /= Members.Count;
|
center /= members.Count;
|
||||||
|
|
||||||
if (closest == null) { return; }
|
if (closest == null) { return; }
|
||||||
|
|
||||||
@@ -103,11 +83,11 @@ namespace Barotrauma
|
|||||||
if (cohesion > 0.0f)
|
if (cohesion > 0.0f)
|
||||||
{
|
{
|
||||||
Vector2 avgVel = Vector2.Zero;
|
Vector2 avgVel = Vector2.Zero;
|
||||||
foreach (AICharacter member in Members)
|
foreach (AICharacter member in members)
|
||||||
{
|
{
|
||||||
avgVel += member.AnimController.TargetMovement;
|
avgVel += member.AnimController.TargetMovement;
|
||||||
}
|
}
|
||||||
avgVel /= Members.Count;
|
avgVel /= members.Count;
|
||||||
ai.SteeringManager.SteeringManual(deltaTime, avgVel * cohesion);
|
ai.SteeringManager.SteeringManual(deltaTime, avgVel * cohesion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -293,27 +293,6 @@ namespace Barotrauma
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameMain.NetworkMember == null || !GameMain.NetworkMember.IsClient)
|
|
||||||
{
|
|
||||||
//stop dragging if there's something between the pull limb and the target
|
|
||||||
Vector2 sourceSimPos = mouthLimb.SimPosition;
|
|
||||||
Vector2 targetSimPos = target.SimPosition;
|
|
||||||
if (character.Submarine != null && character.SelectedCharacter.Submarine == null)
|
|
||||||
{
|
|
||||||
targetSimPos -= character.Submarine.SimPosition;
|
|
||||||
}
|
|
||||||
else if (character.Submarine == null && character.SelectedCharacter.Submarine != null)
|
|
||||||
{
|
|
||||||
sourceSimPos -= character.SelectedCharacter.Submarine.SimPosition;
|
|
||||||
}
|
|
||||||
var body = Submarine.CheckVisibility(sourceSimPos, targetSimPos, ignoreSubs: true);
|
|
||||||
if (body != null)
|
|
||||||
{
|
|
||||||
character.DeselectCharacter();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Character targetCharacter = target;
|
Character targetCharacter = target;
|
||||||
float eatSpeed = character.Mass / targetCharacter.Mass * 0.1f;
|
float eatSpeed = character.Mass / targetCharacter.Mass * 0.1f;
|
||||||
eatTimer += deltaTime * eatSpeed;
|
eatTimer += deltaTime * eatSpeed;
|
||||||
@@ -751,6 +730,22 @@ namespace Barotrauma
|
|||||||
limb?.body.SmoothRotate(angle, torque, wrapAngle: false);
|
limb?.body.SmoothRotate(angle, torque, wrapAngle: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SmoothRotateWithoutWrapping(Limb limb, float angle, Limb referenceLimb, float torque)
|
||||||
|
{
|
||||||
|
//make sure the angle "has the same number of revolutions" as the reference limb
|
||||||
|
//(e.g. we don't want to rotate the legs to 0 if the torso is at 360, because that'd blow up the hip joints)
|
||||||
|
while (referenceLimb.Rotation - angle > MathHelper.TwoPi)
|
||||||
|
{
|
||||||
|
angle += MathHelper.TwoPi;
|
||||||
|
}
|
||||||
|
while (referenceLimb.Rotation - angle < -MathHelper.TwoPi)
|
||||||
|
{
|
||||||
|
angle -= MathHelper.TwoPi;
|
||||||
|
}
|
||||||
|
|
||||||
|
limb?.body.SmoothRotate(angle, torque, wrapAngle: false);
|
||||||
|
}
|
||||||
|
|
||||||
public override void Flip()
|
public override void Flip()
|
||||||
{
|
{
|
||||||
base.Flip();
|
base.Flip();
|
||||||
|
|||||||
@@ -560,8 +560,7 @@ namespace Barotrauma
|
|||||||
//TODO: take into account that the feet aren't necessarily in CurrentHull
|
//TODO: take into account that the feet aren't necessarily in CurrentHull
|
||||||
//full slowdown (1.5f) when water is up to the torso
|
//full slowdown (1.5f) when water is up to the torso
|
||||||
surfaceY = ConvertUnits.ToSimUnits(currentHull.Surface);
|
surfaceY = ConvertUnits.ToSimUnits(currentHull.Surface);
|
||||||
float bottomPos = Math.Max(colliderPos.Y, currentHull.Rect.Y - currentHull.Rect.Height);
|
slowdownAmount = MathHelper.Clamp((surfaceY - colliderPos.Y) / TorsoPosition.Value, 0.0f, 1.0f) * 1.5f;
|
||||||
slowdownAmount = MathHelper.Clamp((surfaceY - bottomPos) / TorsoPosition.Value, 0.0f, 1.0f) * 1.5f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
float maxSpeed = Math.Max(TargetMovement.Length() - slowdownAmount, 1.0f);
|
float maxSpeed = Math.Max(TargetMovement.Length() - slowdownAmount, 1.0f);
|
||||||
|
|||||||
@@ -426,7 +426,7 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanSpeak;
|
private bool canSpeak;
|
||||||
|
|
||||||
private bool speechImpedimentSet;
|
private bool speechImpedimentSet;
|
||||||
|
|
||||||
@@ -436,7 +436,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (!CanSpeak || IsUnconscious || Stun > 0.0f || IsDead) return 100.0f;
|
if (!canSpeak || IsUnconscious || Stun > 0.0f || IsDead) return 100.0f;
|
||||||
return speechImpediment;
|
return speechImpediment;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
@@ -710,7 +710,7 @@ namespace Barotrauma
|
|||||||
displayName = TextManager.Get($"Character.{Path.GetFileName(Path.GetDirectoryName(file))}", true);
|
displayName = TextManager.Get($"Character.{Path.GetFileName(Path.GetDirectoryName(file))}", true);
|
||||||
|
|
||||||
IsHumanoid = doc.Root.GetAttributeBool("humanoid", false);
|
IsHumanoid = doc.Root.GetAttributeBool("humanoid", false);
|
||||||
CanSpeak = doc.Root.GetAttributeBool("canspeak", false);
|
canSpeak = doc.Root.GetAttributeBool("canspeak", false);
|
||||||
needsAir = doc.Root.GetAttributeBool("needsair", false);
|
needsAir = doc.Root.GetAttributeBool("needsair", false);
|
||||||
Noise = doc.Root.GetAttributeFloat("noise", 100f);
|
Noise = doc.Root.GetAttributeFloat("noise", 100f);
|
||||||
|
|
||||||
@@ -853,7 +853,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (characterConfigFiles == null)
|
if (characterConfigFiles == null)
|
||||||
{
|
{
|
||||||
characterConfigFiles = GameMain.Instance.GetFilesOfType(ContentType.Character, searchAllContentPackages: true);
|
characterConfigFiles = GameMain.Instance.GetFilesOfType(ContentType.Character);
|
||||||
}
|
}
|
||||||
return characterConfigFiles;
|
return characterConfigFiles;
|
||||||
}
|
}
|
||||||
@@ -2555,9 +2555,11 @@ namespace Barotrauma
|
|||||||
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
|
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CharacterList.Remove(this);
|
#if CLIENT
|
||||||
|
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (Controlled == this) { Controlled = null; }
|
CharacterList.Remove(this);
|
||||||
|
|
||||||
if (Inventory != null)
|
if (Inventory != null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -399,7 +399,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
ID = idCounter;
|
ID = idCounter;
|
||||||
idCounter++;
|
idCounter++;
|
||||||
Name = element.GetAttributeString("name", "");
|
Name = element.GetAttributeString("name", "unnamed");
|
||||||
string genderStr = element.GetAttributeString("gender", "male").ToLowerInvariant();
|
string genderStr = element.GetAttributeString("gender", "male").ToLowerInvariant();
|
||||||
File = element.GetAttributeString("file", "");
|
File = element.GetAttributeString("file", "");
|
||||||
SourceElement = GetConfig(File).Root;
|
SourceElement = GetConfig(File).Root;
|
||||||
@@ -423,29 +423,6 @@ namespace Barotrauma
|
|||||||
element.GetAttributeInt("beardindex", -1),
|
element.GetAttributeInt("beardindex", -1),
|
||||||
element.GetAttributeInt("moustacheindex", -1),
|
element.GetAttributeInt("moustacheindex", -1),
|
||||||
element.GetAttributeInt("faceattachmentindex", -1));
|
element.GetAttributeInt("faceattachmentindex", -1));
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Name))
|
|
||||||
{
|
|
||||||
if (SourceElement.Element("name") != null)
|
|
||||||
{
|
|
||||||
string firstNamePath = SourceElement.Element("name").GetAttributeString("firstname", "");
|
|
||||||
if (firstNamePath != "")
|
|
||||||
{
|
|
||||||
firstNamePath = firstNamePath.Replace("[GENDER]", (Head.gender == Gender.Female) ? "female" : "male");
|
|
||||||
Name = ToolBox.GetRandomLine(firstNamePath);
|
|
||||||
}
|
|
||||||
|
|
||||||
string lastNamePath = SourceElement.Element("name").GetAttributeString("lastname", "");
|
|
||||||
if (lastNamePath != "")
|
|
||||||
{
|
|
||||||
lastNamePath = lastNamePath.Replace("[GENDER]", (Head.gender == Gender.Female) ? "female" : "male");
|
|
||||||
if (Name != "") Name += " ";
|
|
||||||
Name += ToolBox.GetRandomLine(lastNamePath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
StartItemsGiven = element.GetAttributeBool("startitemsgiven", false);
|
StartItemsGiven = element.GetAttributeBool("startitemsgiven", false);
|
||||||
string personalityName = element.GetAttributeString("personality", "");
|
string personalityName = element.GetAttributeString("personality", "");
|
||||||
ragdollFileName = element.GetAttributeString("ragdoll", string.Empty);
|
ragdollFileName = element.GetAttributeString("ragdoll", string.Empty);
|
||||||
|
|||||||
@@ -217,7 +217,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
return corePackageRequiredFiles.All(fileType => Files.Any(file => file.Type == fileType));
|
return corePackageRequiredFiles.All(fileType => Files.Any(file => file.Type == fileType));
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool ContainsRequiredCorePackageFiles(out List<ContentType> missingContentTypes)
|
public bool ContainsRequiredCorePackageFiles(out List<ContentType> missingContentTypes)
|
||||||
{
|
{
|
||||||
missingContentTypes = new List<ContentType>();
|
missingContentTypes = new List<ContentType>();
|
||||||
@@ -231,25 +230,6 @@ namespace Barotrauma
|
|||||||
return missingContentTypes.Count == 0;
|
return missingContentTypes.Count == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Make sure all the files defined in the content package are present
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
public bool VerifyFiles(out List<string> errorMessages)
|
|
||||||
{
|
|
||||||
errorMessages = new List<string>();
|
|
||||||
foreach (ContentFile file in Files)
|
|
||||||
{
|
|
||||||
if (!File.Exists(file.Path))
|
|
||||||
{
|
|
||||||
errorMessages.Add("File \"" + file.Path + "\" not found.");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return errorMessages.Count == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ContentPackage CreatePackage(string name, string path, bool corePackage)
|
public static ContentPackage CreatePackage(string name, string path, bool corePackage)
|
||||||
{
|
{
|
||||||
ContentPackage newPackage = new ContentPackage()
|
ContentPackage newPackage = new ContentPackage()
|
||||||
@@ -418,13 +398,6 @@ namespace Barotrauma
|
|||||||
return path == "Mods";
|
return path == "Mods";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/// <summary>
|
|
||||||
/// Are mods allowed to install a file into the specified path. If a content package XML includes files
|
|
||||||
/// with a prohibited path, they are treated as references to external files. For example, a mod could include
|
|
||||||
/// some vanilla files in the XML, in which case the game will simply use the vanilla files present in the game folder.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="path"></param>
|
|
||||||
/// <returns></returns>
|
|
||||||
public static bool IsModFilePathAllowed(string path)
|
public static bool IsModFilePathAllowed(string path)
|
||||||
{
|
{
|
||||||
while (true)
|
while (true)
|
||||||
@@ -449,6 +422,16 @@ namespace Barotrauma
|
|||||||
return contentPackages.SelectMany(f => f.Files).Where(f => f.Type == type).Select(f => f.Path);
|
return contentPackages.SelectMany(f => f.Files).Where(f => f.Type == type).Select(f => f.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public IEnumerable<string> GetFilesOfType(ContentType type)
|
||||||
|
{
|
||||||
|
return Files.Where(f => f.Type == type).Select(f => f.Path);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IEnumerable<string> GetFilesOfType(IEnumerable<ContentPackage> contentPackages, ContentType type)
|
||||||
|
{
|
||||||
|
return contentPackages.SelectMany(f => f.Files).Where(f => f.Type == type).Select(f => f.Path);
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerable<string> GetFilesOfType(ContentType type)
|
public IEnumerable<string> GetFilesOfType(ContentType type)
|
||||||
{
|
{
|
||||||
return Files.Where(f => f.Type == type).Select(f => f.Path);
|
return Files.Where(f => f.Type == type).Select(f => f.Path);
|
||||||
|
|||||||
@@ -34,33 +34,14 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
Level.Loaded.TryGetInterestingPosition(true, Level.PositionType.MainPath, Level.Loaded.Size.X * 0.3f, out Vector2 spawnPos);
|
Level.Loaded.TryGetInterestingPosition(true, Level.PositionType.MainPath, Level.Loaded.Size.X * 0.3f, out Vector2 spawnPos);
|
||||||
|
|
||||||
//bool isClient = GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient;
|
bool isClient = GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient;
|
||||||
//for (int i = 0; i < monsterCount; i++)
|
|
||||||
//{
|
|
||||||
// monsters.Add(Character.Create(monsterFile, spawnPos, ToolBox.RandomSeed(8), null, isClient, true, false));
|
|
||||||
//}
|
|
||||||
//monsters.ForEach(m => m.Enabled = false);
|
|
||||||
//SwarmBehavior.CreateSwarm(monsters.Cast<AICharacter>());
|
|
||||||
//sonarPositions.Add(spawnPos);
|
|
||||||
|
|
||||||
float offsetAmount = 500;
|
|
||||||
for (int i = 0; i < monsterCount; i++)
|
for (int i = 0; i < monsterCount; i++)
|
||||||
{
|
{
|
||||||
CoroutineManager.InvokeAfter(() =>
|
monsters.Add(Character.Create(monsterFile, spawnPos, ToolBox.RandomSeed(8), null, isClient, true, false));
|
||||||
{
|
|
||||||
bool isClient = GameMain.NetworkMember != null && GameMain.NetworkMember.IsClient;
|
|
||||||
var monster = Character.Create(monsterFile, spawnPos + Rand.Vector(offsetAmount, Rand.RandSync.Server), i.ToString(), null, isClient, true, true);
|
|
||||||
monster.Enabled = false;
|
|
||||||
monsters.Add(monster);
|
|
||||||
if (monsters.Count == monsterCount)
|
|
||||||
{
|
|
||||||
//this will do nothing if the monsters have no swarm behavior defined,
|
|
||||||
//otherwise it'll make the spawned characters act as a swarm
|
|
||||||
SwarmBehavior.CreateSwarm(monsters.Cast<AICharacter>());
|
|
||||||
sonarPositions.Add(spawnPos);
|
|
||||||
}
|
|
||||||
}, Rand.Range(0f, monsterCount / 2, Rand.RandSync.Server));
|
|
||||||
}
|
}
|
||||||
|
monsters.ForEach(m => m.Enabled = false);
|
||||||
|
SwarmBehavior.CreateSwarm(monsters.Cast<AICharacter>());
|
||||||
|
sonarPositions.Add(spawnPos);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update(float deltaTime)
|
public override void Update(float deltaTime)
|
||||||
|
|||||||
@@ -604,14 +604,13 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
foreach (ContentPackage contentPackage in SelectedContentPackages)
|
foreach (ContentPackage contentPackage in SelectedContentPackages)
|
||||||
{
|
{
|
||||||
bool packageOk = contentPackage.VerifyFiles(out List<string> errorMessages);
|
|
||||||
if (!packageOk)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError("Error in content package \"" + contentPackage.Name + "\":\n" + string.Join("\n", errorMessages));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
foreach (ContentFile file in contentPackage.Files)
|
foreach (ContentFile file in contentPackage.Files)
|
||||||
{
|
{
|
||||||
|
if (!System.IO.File.Exists(file.Path))
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Error in content package \"" + contentPackage.Name + "\" - file \"" + file.Path + "\" not found.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ToolBox.IsProperFilenameCase(file.Path);
|
ToolBox.IsProperFilenameCase(file.Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -971,14 +970,13 @@ namespace Barotrauma
|
|||||||
|
|
||||||
foreach (ContentPackage contentPackage in SelectedContentPackages)
|
foreach (ContentPackage contentPackage in SelectedContentPackages)
|
||||||
{
|
{
|
||||||
bool packageOk = contentPackage.VerifyFiles(out List<string> errorMessages);
|
|
||||||
if (!packageOk)
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError("Error in content package \"" + contentPackage.Name + "\":\n" + string.Join("\n", errorMessages));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
foreach (ContentFile file in contentPackage.Files)
|
foreach (ContentFile file in contentPackage.Files)
|
||||||
{
|
{
|
||||||
|
if (!System.IO.File.Exists(file.Path))
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Error in content package \"" + contentPackage.Name + "\" - file \"" + file.Path + "\" not found.");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ToolBox.IsProperFilenameCase(file.Path);
|
ToolBox.IsProperFilenameCase(file.Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -293,35 +293,10 @@ namespace Barotrauma.Items.Components
|
|||||||
//steer closer if almost in range
|
//steer closer if almost in range
|
||||||
if (dist > Range)
|
if (dist > Range)
|
||||||
{
|
{
|
||||||
Vector2 standPos = new Vector2(Math.Sign(-fromItemToLeak.X), Math.Sign(-fromItemToLeak.Y)) / 2;
|
Vector2 standPos = leak.IsHorizontal ? new Vector2(Math.Sign(-fromItemToLeak.X), 0.0f) : new Vector2(0.0f, Math.Sign(-fromItemToLeak.Y) * 0.5f);
|
||||||
if (!character.AnimController.InWater)
|
standPos = leak.WorldPosition + standPos * Range;
|
||||||
{
|
Vector2 dir = Vector2.Normalize(standPos - character.WorldPosition);
|
||||||
if (leak.IsHorizontal)
|
character.AIController.SteeringManager.SteeringManual(deltaTime, dir / 2);
|
||||||
{
|
|
||||||
standPos.X *= 2;
|
|
||||||
standPos.Y = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
standPos.X = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (character.AIController.SteeringManager is IndoorsSteeringManager indoorSteering)
|
|
||||||
{
|
|
||||||
if (indoorSteering.CurrentPath != null && !indoorSteering.IsPathDirty && indoorSteering.CurrentPath.Unreachable)
|
|
||||||
{
|
|
||||||
Vector2 dir = Vector2.Normalize(standPos - character.WorldPosition);
|
|
||||||
character.AIController.SteeringManager.SteeringManual(deltaTime, dir / 2);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
character.AIController.SteeringManager.SteeringSeek(standPos);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
character.AIController.SteeringManager.SteeringSeek(standPos);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -330,29 +305,30 @@ namespace Barotrauma.Items.Components
|
|||||||
// Too close -> steer away
|
// Too close -> steer away
|
||||||
character.AIController.SteeringManager.SteeringManual(deltaTime, Vector2.Normalize(character.SimPosition - leak.SimPosition) / 2);
|
character.AIController.SteeringManager.SteeringManual(deltaTime, Vector2.Normalize(character.SimPosition - leak.SimPosition) / 2);
|
||||||
}
|
}
|
||||||
else if (dist <= Range)
|
|
||||||
{
|
|
||||||
// In range
|
|
||||||
character.AIController.SteeringManager.Reset();
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
character.AIController.SteeringManager.Reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sinTime += deltaTime;
|
sinTime += deltaTime;
|
||||||
character.CursorPosition = leak.Position + VectorExtensions.Forward(Item.body.TransformedRotation + (float)Math.Sin(sinTime), dist);
|
character.CursorPosition = leak.Position + VectorExtensions.Forward(Item.body.TransformedRotation + (float)Math.Sin(sinTime), dist);
|
||||||
if (item.RequireAimToUse)
|
if (item.RequireAimToUse)
|
||||||
{
|
{
|
||||||
character.SetInput(InputType.Aim, false, true);
|
character.SetInput(InputType.Aim, false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Press the trigger only when the tool is approximately facing the target.
|
// Press the trigger only when the tool is approximately facing the target.
|
||||||
var angle = VectorExtensions.Angle(VectorExtensions.Forward(item.body.TransformedRotation), fromItemToLeak);
|
// If the character is climbing, ignore the check, because we cannot aim while climbing.
|
||||||
if (angle < MathHelper.PiOver4)
|
if (VectorExtensions.Angle(VectorExtensions.Forward(item.body.TransformedRotation), fromItemToLeak) < MathHelper.PiOver4)
|
||||||
{
|
{
|
||||||
character.SetInput(InputType.Shoot, false, true);
|
character.SetInput(InputType.Shoot, false, true);
|
||||||
Use(deltaTime, character);
|
Use(deltaTime, character);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sinTime -= deltaTime * 2;
|
||||||
|
}
|
||||||
|
|
||||||
bool leakFixed = (leak.Open <= 0.0f || leak.Removed) &&
|
bool leakFixed = (leak.Open <= 0.0f || leak.Removed) &&
|
||||||
(leak.ConnectedWall == null || leak.ConnectedWall.Sections.Average(s => s.damage) < 1);
|
(leak.ConnectedWall == null || leak.ConnectedWall.Sections.Average(s => s.damage) < 1);
|
||||||
|
|||||||
@@ -801,7 +801,10 @@ namespace Barotrauma.Items.Components
|
|||||||
string msg = TextManager.Get(Msg, true);
|
string msg = TextManager.Get(Msg, true);
|
||||||
if (msg != null)
|
if (msg != null)
|
||||||
{
|
{
|
||||||
msg = TextManager.ParseInputTypes(msg);
|
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
||||||
|
{
|
||||||
|
msg = msg.Replace("[" + inputType.ToString().ToLowerInvariant() + "]", GameMain.Config.KeyBind(inputType).ToString());
|
||||||
|
}
|
||||||
DisplayMsg = msg;
|
DisplayMsg = msg;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -13,11 +13,6 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private ItemContainer inputContainer, outputContainer;
|
private ItemContainer inputContainer, outputContainer;
|
||||||
|
|
||||||
public ItemContainer InputContainer
|
|
||||||
{
|
|
||||||
get { return inputContainer; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemContainer OutputContainer
|
public ItemContainer OutputContainer
|
||||||
{
|
{
|
||||||
get { return outputContainer; }
|
get { return outputContainer; }
|
||||||
|
|||||||
@@ -23,16 +23,6 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
private ItemContainer inputContainer, outputContainer;
|
private ItemContainer inputContainer, outputContainer;
|
||||||
|
|
||||||
public ItemContainer InputContainer
|
|
||||||
{
|
|
||||||
get { return inputContainer; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemContainer OutputContainer
|
|
||||||
{
|
|
||||||
get { return outputContainer; }
|
|
||||||
}
|
|
||||||
|
|
||||||
private float progressState;
|
private float progressState;
|
||||||
|
|
||||||
public Fabricator(Item item, XElement element)
|
public Fabricator(Item item, XElement element)
|
||||||
@@ -108,23 +98,7 @@ namespace Barotrauma.Items.Components
|
|||||||
{
|
{
|
||||||
return (picker != null);
|
return (picker != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveFabricationRecipes(List<string> allowedIdentifiers)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < fabricationRecipes.Count; i++)
|
|
||||||
{
|
|
||||||
if (!allowedIdentifiers.Contains(fabricationRecipes[i].TargetItem.Identifier))
|
|
||||||
{
|
|
||||||
fabricationRecipes.RemoveAt(i);
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CreateRecipes();
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void CreateRecipes();
|
|
||||||
|
|
||||||
private void StartFabricating(FabricationRecipe selectedItem, Character user)
|
private void StartFabricating(FabricationRecipe selectedItem, Character user)
|
||||||
{
|
{
|
||||||
if (selectedItem == null) return;
|
if (selectedItem == null) return;
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ namespace Barotrauma.Items.Components
|
|||||||
int clockDir = (int)Math.Round((angle / MathHelper.TwoPi) * 12);
|
int clockDir = (int)Math.Round((angle / MathHelper.TwoPi) * 12);
|
||||||
if (clockDir == 0) clockDir = 12;
|
if (clockDir == 0) clockDir = 12;
|
||||||
|
|
||||||
return TextManager.Get("roomname.subdiroclock").Replace("[dir]", clockDir.ToString());
|
return TextManager.Get("SubDirOClock").Replace("[dir]", clockDir.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Vector2 GetTransducerCenter()
|
private Vector2 GetTransducerCenter()
|
||||||
|
|||||||
@@ -206,16 +206,6 @@ namespace Barotrauma
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsFull()
|
|
||||||
{
|
|
||||||
for (int i = 0; i < capacity; i++)
|
|
||||||
{
|
|
||||||
if (Items[i] == null) return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected bool TrySwapping(int index, Item item, Character user, bool createNetworkEvent)
|
protected bool TrySwapping(int index, Item item, Character user, bool createNetworkEvent)
|
||||||
{
|
{
|
||||||
if (item?.ParentInventory == null || Items[index] == null) return false;
|
if (item?.ParentInventory == null || Items[index] == null) return false;
|
||||||
|
|||||||
@@ -1149,10 +1149,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
body.SetTransform(body.SimPosition - Submarine.SimPosition, body.Rotation);
|
body.SetTransform(body.SimPosition - Submarine.SimPosition, body.Rotation);
|
||||||
}
|
}
|
||||||
else if (Submarine != null && prevSub != null && Submarine != prevSub)
|
|
||||||
{
|
|
||||||
body.SetTransform(body.SimPosition + prevSub.SimPosition - Submarine.SimPosition, body.Rotation);
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2 displayPos = ConvertUnits.ToDisplayUnits(body.SimPosition);
|
Vector2 displayPos = ConvertUnits.ToDisplayUnits(body.SimPosition);
|
||||||
rect.X = (int)(displayPos.X - rect.Width / 2.0f);
|
rect.X = (int)(displayPos.X - rect.Width / 2.0f);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace Barotrauma
|
|||||||
flames = true;
|
flames = true;
|
||||||
underwaterBubble = true;
|
underwaterBubble = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Explosion(XElement element, string parentDebugName)
|
public Explosion(XElement element, string parentDebugName)
|
||||||
{
|
{
|
||||||
attack = new Attack(element, parentDebugName + ", Explosion");
|
attack = new Attack(element, parentDebugName + ", Explosion");
|
||||||
@@ -62,16 +62,6 @@ namespace Barotrauma
|
|||||||
CameraShake = element.GetAttributeFloat("camerashake", attack.Range * 0.1f);
|
CameraShake = element.GetAttributeFloat("camerashake", attack.Range * 0.1f);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DisableParticles()
|
|
||||||
{
|
|
||||||
sparks = false;
|
|
||||||
shockwave = false;
|
|
||||||
smoke = false;
|
|
||||||
flash = false;
|
|
||||||
flames = false;
|
|
||||||
underwaterBubble = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Triplet<Explosion, Vector2, float>> GetRecentExplosions(float maxSecondsAgo)
|
public List<Triplet<Explosion, Vector2, float>> GetRecentExplosions(float maxSecondsAgo)
|
||||||
{
|
{
|
||||||
return prevExplosions.FindAll(e => e.Third >= Timing.TotalTime - maxSecondsAgo);
|
return prevExplosions.FindAll(e => e.Third >= Timing.TotalTime - maxSecondsAgo);
|
||||||
|
|||||||
@@ -14,15 +14,15 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
const float OxygenConsumption = 50.0f;
|
const float OxygenConsumption = 50.0f;
|
||||||
const float GrowSpeed = 5.0f;
|
const float GrowSpeed = 5.0f;
|
||||||
|
|
||||||
|
private Hull hull;
|
||||||
|
|
||||||
protected Hull hull;
|
private Vector2 position;
|
||||||
|
private Vector2 size;
|
||||||
protected Vector2 position;
|
|
||||||
protected Vector2 size;
|
|
||||||
|
|
||||||
private Entity Submarine;
|
private Entity Submarine;
|
||||||
|
|
||||||
protected bool removed;
|
private bool removed;
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
private List<Decal> burnDecals = new List<Decal>();
|
private List<Decal> burnDecals = new List<Decal>();
|
||||||
@@ -182,16 +182,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void ReduceOxygen(float deltaTime)
|
|
||||||
{
|
|
||||||
hull.Oxygen -= size.X * deltaTime * OxygenConsumption;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected virtual void AdjustXPos(float growModifier, float deltaTime)
|
|
||||||
{
|
|
||||||
position.X -= GrowSpeed * growModifier * 0.5f * deltaTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
partial void UpdateProjSpecific(float growModifier);
|
partial void UpdateProjSpecific(float growModifier);
|
||||||
|
|
||||||
private void OnChangeHull(Vector2 pos, Hull particleHull)
|
private void OnChangeHull(Vector2 pos, Hull particleHull)
|
||||||
|
|||||||
@@ -138,9 +138,6 @@ namespace Barotrauma
|
|||||||
public Submarine StartOutpost { get; private set; }
|
public Submarine StartOutpost { get; private set; }
|
||||||
public Submarine EndOutpost { get; private set; }
|
public Submarine EndOutpost { get; private set; }
|
||||||
|
|
||||||
private Submarine preSelectedStartOutpost;
|
|
||||||
private Submarine preSelectedEndOutpost;
|
|
||||||
|
|
||||||
public string Seed
|
public string Seed
|
||||||
{
|
{
|
||||||
get { return seed; }
|
get { return seed; }
|
||||||
@@ -212,7 +209,7 @@ namespace Barotrauma
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="difficulty">A scalar between 0-100</param>
|
/// <param name="difficulty">A scalar between 0-100</param>
|
||||||
/// <param name="sizeFactor">A scalar between 0-1 (0 = the minimum width defined in the generation params is used, 1 = the max width is used)</param>
|
/// <param name="sizeFactor">A scalar between 0-1 (0 = the minimum width defined in the generation params is used, 1 = the max width is used)</param>
|
||||||
public Level(string seed, float difficulty, float sizeFactor, LevelGenerationParams generationParams, Biome biome, Submarine startOutpost = null, Submarine endOutPost = null)
|
public Level(string seed, float difficulty, float sizeFactor, LevelGenerationParams generationParams, Biome biome)
|
||||||
: base(null)
|
: base(null)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -228,9 +225,6 @@ namespace Barotrauma
|
|||||||
(width / GridCellSize) * GridCellSize,
|
(width / GridCellSize) * GridCellSize,
|
||||||
(generationParams.Height / GridCellSize) * GridCellSize);
|
(generationParams.Height / GridCellSize) * GridCellSize);
|
||||||
|
|
||||||
preSelectedStartOutpost = startOutpost;
|
|
||||||
preSelectedEndOutpost = endOutPost;
|
|
||||||
|
|
||||||
//remove from entity dictionary
|
//remove from entity dictionary
|
||||||
base.Remove();
|
base.Remove();
|
||||||
}
|
}
|
||||||
@@ -1516,24 +1510,14 @@ namespace Barotrauma
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//only create a starting outpost in campaign and tutorial modes
|
//only create a starting outpost in campaign mode
|
||||||
if (!IsModeStartOutpostCompatible() && ((i == 0) == !Mirrored))
|
if (GameMain.GameSession?.GameMode as CampaignMode == null && ((i == 0) == !Mirrored))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Submarine outpost = null;
|
string outpostFile = outpostFiles.GetRandom(Rand.RandSync.Server);
|
||||||
|
var outpost = new Submarine(outpostFile, tryLoad: false);
|
||||||
if (i == 0 && preSelectedStartOutpost == null || i == 1 && preSelectedEndOutpost == null)
|
|
||||||
{
|
|
||||||
string outpostFile = outpostFiles.GetRandom(Rand.RandSync.Server);
|
|
||||||
outpost = new Submarine(outpostFile, tryLoad: false);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
outpost = (i == 0) ? preSelectedStartOutpost : preSelectedEndOutpost;
|
|
||||||
}
|
|
||||||
|
|
||||||
outpost.Load(unloadPrevious: false);
|
outpost.Load(unloadPrevious: false);
|
||||||
outpost.MakeOutpost();
|
outpost.MakeOutpost();
|
||||||
|
|
||||||
@@ -1585,15 +1569,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsModeStartOutpostCompatible()
|
|
||||||
{
|
|
||||||
#if CLIENT
|
|
||||||
return GameMain.GameSession?.GameMode as CampaignMode != null || GameMain.GameSession?.GameMode as TutorialMode != null;
|
|
||||||
#else
|
|
||||||
return GameMain.GameSession?.GameMode as CampaignMode != null;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Remove()
|
public override void Remove()
|
||||||
{
|
{
|
||||||
base.Remove();
|
base.Remove();
|
||||||
|
|||||||
@@ -635,6 +635,24 @@ namespace Barotrauma
|
|||||||
var character = ((Limb)f2.Body.UserData).character;
|
var character = ((Limb)f2.Body.UserData).character;
|
||||||
if (character.DisableImpactDamageTimer > 0.0f || ((Limb)f2.Body.UserData).Mass < 100.0f) return true;
|
if (character.DisableImpactDamageTimer > 0.0f || ((Limb)f2.Body.UserData).Mass < 100.0f) return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Prefab.Platform && Prefab.StairDirection == Direction.None)
|
||||||
|
{
|
||||||
|
Vector2 pos = ConvertUnits.ToDisplayUnits(f2.Body.Position);
|
||||||
|
|
||||||
|
int section = FindSectionIndex(pos);
|
||||||
|
if (section > -1)
|
||||||
|
{
|
||||||
|
Vector2 normal = contact.Manifold.LocalNormal;
|
||||||
|
|
||||||
|
float impact = Vector2.Dot(f2.Body.LinearVelocity, -normal) * f2.Body.Mass * 0.1f;
|
||||||
|
if (impact < 10.0f) return true;
|
||||||
|
#if CLIENT
|
||||||
|
SoundPlayer.PlayDamageSound("StructureBlunt", impact, SectionPosition(section, true), tags: Tags);
|
||||||
|
#endif
|
||||||
|
AddDamage(section, impact);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OnImpactProjSpecific(f1, f2, contact);
|
OnImpactProjSpecific(f1, f2, contact);
|
||||||
|
|
||||||
|
|||||||
@@ -431,12 +431,6 @@ namespace Barotrauma
|
|||||||
else if (ic is Pickable pickable)
|
else if (ic is Pickable pickable)
|
||||||
{
|
{
|
||||||
//prevent picking up (or deattaching) items
|
//prevent picking up (or deattaching) items
|
||||||
#if CLIENT
|
|
||||||
if (GameMain.GameSession?.GameMode is TutorialMode)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
pickable.CanBePicked = false;
|
pickable.CanBePicked = false;
|
||||||
pickable.CanBeSelected = false;
|
pickable.CanBeSelected = false;
|
||||||
}
|
}
|
||||||
@@ -542,6 +536,20 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
maxX = Math.Min(maxX, ruin.Area.X - 100.0f);
|
maxX = Math.Min(maxX, ruin.Area.X - 100.0f);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
maxX = Math.Min(maxX, ruin.Area.X - 100.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (minX < 0.0f && maxX > Level.Loaded.Size.X)
|
||||||
|
{
|
||||||
|
//no walls found at either side, just use the initial spawnpos and hope for the best
|
||||||
|
}
|
||||||
|
else if (minX < 0)
|
||||||
|
{
|
||||||
|
//no wall found at the left side, spawn to the left from the right-side wall
|
||||||
|
spawnPos.X = maxX - minWidth - 100.0f + subDockingPortOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (minX < 0.0f && maxX > Level.Loaded.Size.X)
|
if (minX < 0.0f && maxX > Level.Loaded.Size.X)
|
||||||
|
|||||||
@@ -468,7 +468,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
var gaps = newHull?.ConnectedGaps ?? Gap.GapList.Where(g => g.Submarine == submarine);
|
var gaps = newHull?.ConnectedGaps ?? Gap.GapList.Where(g => g.Submarine == submarine);
|
||||||
targetPos = character.WorldPosition;
|
targetPos = character.WorldPosition;
|
||||||
Gap adjacentGap = Gap.FindAdjacent(gaps, targetPos, 500.0f);
|
Gap adjacentGap = Gap.FindAdjacent(gaps, targetPos, 200.0f);
|
||||||
if (adjacentGap == null) return true;
|
if (adjacentGap == null) return true;
|
||||||
|
|
||||||
if (newHull != null)
|
if (newHull != null)
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
string errorMsg = "Attempted to add a null item to entity spawn queue.\n" + Environment.StackTrace;
|
string errorMsg = "Attempted to add a null item to entity spawn queue.\n" + Environment.StackTrace;
|
||||||
DebugConsole.ThrowError(errorMsg);
|
DebugConsole.ThrowError(errorMsg);
|
||||||
GameAnalyticsManager.AddErrorEventOnce("EntitySpawner.AddToSpawnQueue1:ItemPrefabNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
GameAnalyticsManager.AddErrorEventOnce("EntitySpawner.AddToSpawnQueue3:ItemPrefabNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
spawnQueue.Enqueue(new ItemSpawnInfo(itemPrefab, worldPosition, condition));
|
spawnQueue.Enqueue(new ItemSpawnInfo(itemPrefab, worldPosition, condition));
|
||||||
@@ -115,7 +115,7 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
string errorMsg = "Attempted to add a null item to entity spawn queue.\n" + Environment.StackTrace;
|
string errorMsg = "Attempted to add a null item to entity spawn queue.\n" + Environment.StackTrace;
|
||||||
DebugConsole.ThrowError(errorMsg);
|
DebugConsole.ThrowError(errorMsg);
|
||||||
GameAnalyticsManager.AddErrorEventOnce("EntitySpawner.AddToSpawnQueue2:ItemPrefabNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
GameAnalyticsManager.AddErrorEventOnce("EntitySpawner.AddToSpawnQueue3:ItemPrefabNull", GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
spawnQueue.Enqueue(new ItemSpawnInfo(itemPrefab, position, sub, condition));
|
spawnQueue.Enqueue(new ItemSpawnInfo(itemPrefab, position, sub, condition));
|
||||||
|
|||||||
@@ -401,7 +401,7 @@ namespace Barotrauma.Networking
|
|||||||
public bool AllowRagdollButton
|
public bool AllowRagdollButton
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serialize(true, true)]
|
[Serialize(true, true)]
|
||||||
|
|||||||
@@ -46,15 +46,7 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (File.Exists(filePath))
|
if (File.Exists(filePath))
|
||||||
{
|
{
|
||||||
try
|
doc = XDocument.Load(filePath, LoadOptions.SetBaseUri);
|
||||||
{
|
|
||||||
doc = XDocument.Load(filePath, LoadOptions.SetBaseUri);
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (doc.Root == null) return null;
|
if (doc.Root == null) return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -118,14 +118,160 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string ParseInputTypes(string text)
|
public static string GetFormatted(string textTag, bool returnNull = false, params object[] args)
|
||||||
{
|
{
|
||||||
foreach (InputType inputType in Enum.GetValues(typeof(InputType)))
|
string text = Get(textTag, returnNull);
|
||||||
|
|
||||||
|
if (text == null || text.Length == 0)
|
||||||
{
|
{
|
||||||
text = text.Replace("[" + inputType.ToString().ToLowerInvariant() + "]", GameMain.Config.KeyBind(inputType).ToString());
|
if (returnNull)
|
||||||
text = text.Replace("[InputType." + inputType.ToString() + "]", GameMain.Config.KeyBind(inputType).ToString());
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("Text \"" + textTag + "\" not found.");
|
||||||
|
return textTag;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return text;
|
|
||||||
|
return string.Format(text, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Format: ServerMessage.Identifier1/ServerMessage.Indentifier2~[variable1]=value~[variable2]=value
|
||||||
|
public static string GetServerMessage(string serverMessage)
|
||||||
|
{
|
||||||
|
if (!textPacks.ContainsKey(Language))
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("No text packs available for the selected language (" + Language + ")! Switching to English...");
|
||||||
|
Language = "English";
|
||||||
|
if (!textPacks.ContainsKey(Language))
|
||||||
|
{
|
||||||
|
throw new Exception("No text packs available in English!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string[] messages = serverMessage.Split('/');
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
for (int i = 0; i < messages.Length; i++)
|
||||||
|
{
|
||||||
|
if (!IsServerMessageWithVariables(messages[i])) // No variables, try to translate
|
||||||
|
{
|
||||||
|
if (messages[i].Contains(" ")) continue; // Spaces found, do not translate
|
||||||
|
string msg = Get(messages[i], true);
|
||||||
|
if (msg != null) // If a translation was found, otherwise use the original
|
||||||
|
{
|
||||||
|
messages[i] = msg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
string[] messageWithVariables = messages[i].Split('~');
|
||||||
|
string msg = Get(messageWithVariables[0], true);
|
||||||
|
|
||||||
|
if (msg != null) // If a translation was found, otherwise use the original
|
||||||
|
{
|
||||||
|
messages[i] = msg;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
continue; // No translation found, probably caused by player input -> skip variable handling
|
||||||
|
}
|
||||||
|
|
||||||
|
// First index is always the message identifier -> start at 1
|
||||||
|
for (int j = 1; j < messageWithVariables.Length; j++)
|
||||||
|
{
|
||||||
|
string[] variableAndValue = messageWithVariables[j].Split('=');
|
||||||
|
messages[i] = messages[i].Replace(variableAndValue[0], variableAndValue[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string translatedServerMessage = string.Empty;
|
||||||
|
for (int i = 0; i < messages.Length; i++)
|
||||||
|
{
|
||||||
|
translatedServerMessage += messages[i];
|
||||||
|
}
|
||||||
|
return translatedServerMessage;
|
||||||
|
}
|
||||||
|
|
||||||
|
catch (IndexOutOfRangeException exception)
|
||||||
|
{
|
||||||
|
string errorMsg = "Failed to translate server message \"" + serverMessage + "\".";
|
||||||
|
#if DEBUG
|
||||||
|
DebugConsole.ThrowError(errorMsg, exception);
|
||||||
|
#endif
|
||||||
|
GameAnalyticsManager.AddErrorEventOnce("TextManager.GetServerMessage:" + serverMessage, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||||
|
return errorMsg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static bool IsServerMessageWithVariables(string message)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < serverMessageCharacters.Length; i++)
|
||||||
|
{
|
||||||
|
if (!message.Contains(serverMessageCharacters[i])) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<string> GetAll(string textTag)
|
||||||
|
{
|
||||||
|
if (!textPacks.ContainsKey(Language))
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("No text packs available for the selected language (" + Language + ")! Switching to English...");
|
||||||
|
Language = "English";
|
||||||
|
if (!textPacks.ContainsKey(Language))
|
||||||
|
{
|
||||||
|
throw new Exception("No text packs available in English!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<string> allText;
|
||||||
|
|
||||||
|
foreach (TextPack textPack in textPacks[Language])
|
||||||
|
{
|
||||||
|
allText = textPack.GetAll(textTag);
|
||||||
|
if (allText != null) return allText;
|
||||||
|
}
|
||||||
|
|
||||||
|
//if text was not found and we're using a language other than English, see if we can find an English version
|
||||||
|
//may happen, for example, if a user has selected another language and using mods that haven't been translated to that language
|
||||||
|
if (Language != "English" && textPacks.ContainsKey("English"))
|
||||||
|
{
|
||||||
|
foreach (TextPack textPack in textPacks["English"])
|
||||||
|
{
|
||||||
|
allText = textPack.GetAll(textTag);
|
||||||
|
if (allText != null) return allText;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<KeyValuePair<string, string>> GetAllTagTextPairs()
|
||||||
|
{
|
||||||
|
if (!textPacks.ContainsKey(Language))
|
||||||
|
{
|
||||||
|
DebugConsole.ThrowError("No text packs available for the selected language (" + Language + ")! Switching to English...");
|
||||||
|
Language = "English";
|
||||||
|
if (!textPacks.ContainsKey(Language))
|
||||||
|
{
|
||||||
|
throw new Exception("No text packs available in English!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<KeyValuePair<string, string>> allText = new List<KeyValuePair<string, string>>();
|
||||||
|
|
||||||
|
foreach (TextPack textPack in textPacks[Language])
|
||||||
|
{
|
||||||
|
allText.AddRange(textPack.GetAllTagTextPairs());
|
||||||
|
}
|
||||||
|
|
||||||
|
return allText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetFormatted(string textTag, bool returnNull = false, params object[] args)
|
public static string GetFormatted(string textTag, bool returnNull = false, params object[] args)
|
||||||
|
|||||||
@@ -795,6 +795,18 @@ namespace Barotrauma
|
|||||||
return new Vector2((float)x, (float)y);
|
return new Vector2((float)x, (float)y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Rotates a point in 2d space around the origin
|
||||||
|
/// </summary>
|
||||||
|
public static Vector2 RotatePoint(Vector2 point, float radians)
|
||||||
|
{
|
||||||
|
var sin = Math.Sin(radians);
|
||||||
|
var cos = Math.Cos(radians);
|
||||||
|
var x = (cos * point.X) - (sin * point.Y);
|
||||||
|
var y = (sin * point.X) + (cos * point.Y);
|
||||||
|
return new Vector2((float)x, (float)y);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the corners of an imaginary rectangle.
|
/// Returns the corners of an imaginary rectangle.
|
||||||
/// Unlike the XNA rectangle, this can be rotated with the up parameter.
|
/// Unlike the XNA rectangle, this can be rotated with the up parameter.
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,62 +1,3 @@
|
|||||||
---------------------------------------------------------------------------------------------------------
|
|
||||||
v0.8.10.0
|
|
||||||
---------------------------------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
Additions and changes:
|
|
||||||
- Completely remade tutorials (separate tutorial for each job).
|
|
||||||
- Added a door and hatch variants with integrated buttons.
|
|
||||||
- New outpost graphics.
|
|
||||||
- Added swarm behavior to crawlers.
|
|
||||||
- Added a new mission where you have to kill a swarm of crawlers.
|
|
||||||
- Numerous crew AI improvements.
|
|
||||||
- Balanced item deterioration values.
|
|
||||||
- Mineral sprites change when collected from the environment.
|
|
||||||
- Added an option to disable directional voice chat.
|
|
||||||
- Added automatic submarine repair option to the campaign.
|
|
||||||
- Added "all" tab to the entity list in the submarine editor.
|
|
||||||
- Hide the crew area, chat box and server buttons when operating a turret or searchlight.
|
|
||||||
- Doors can be repaired with a wrench.
|
|
||||||
- Some new lamp variants.
|
|
||||||
- Display a progress bar when welding doors shut.
|
|
||||||
- Items that don't give any materials when deconstructed cannot be deconstructed.
|
|
||||||
- Added a console command that resets selected items and structures to prefab values ("resetselected").
|
|
||||||
- Option to toggle structure drop shadows and edit the position of the shadow in the sub editor.
|
|
||||||
- Minor physics optimizations.
|
|
||||||
- Disable background music & ambience in the character editor.
|
|
||||||
- More pronounced limping animation when a character's legs are injured.
|
|
||||||
- The inventory slots next to the character portrait (ID card, uniform, etc) can be hidden.
|
|
||||||
- Some new sound effects and background music.
|
|
||||||
- All walls can be scaled in the submarine editor.
|
|
||||||
- Structure damage is visualized when using debugdraw.
|
|
||||||
- Improved font scaling on different resolutions.
|
|
||||||
- Added Steam overlay support to Workshop.
|
|
||||||
- Server list shows which servers have voice chat enabled.
|
|
||||||
- Show a message box notifying respawning traitors that they're no longer a traitor.
|
|
||||||
- Added a search bar to the store menu.
|
|
||||||
- Added search bars to sub lists in campaign setup UI and sub editor.
|
|
||||||
|
|
||||||
Bugfixes:
|
|
||||||
- Don't allow rewiring and deattaching an item at the same time (happened when interacting with an item
|
|
||||||
while holding both a screwdriver and a wrench).
|
|
||||||
- Fixed bots being unable to complete almost any task in the multiplayer due to a bug that caused
|
|
||||||
them to interpret the sub as another crew's submarine.
|
|
||||||
- When spawning multiple monsters at the same time, spread them around a bit to prevent the players
|
|
||||||
from getting attacked by a ball of overlapping crawlers.
|
|
||||||
- Fixed huge lag spikes when a character tries to escape from an enemy but can't find a path away from it.
|
|
||||||
- Fixed file transfer progress bars not being visible in the server lobby.
|
|
||||||
- Fixed crashing when attempting to start a mission round with mission type set to None.
|
|
||||||
- Fixed ElectricalDischarger electricity effect staying visible if the item breaks or the component
|
|
||||||
is deactivated from outside (e.g. via a StatusEffect or the parent component).
|
|
||||||
- Fixed specular maps being rendered on top of characters when outside the sub.
|
|
||||||
- Fixed excessively bright lights around sonar flora and lava vents.
|
|
||||||
- Fixes to item collider sizes.
|
|
||||||
- Fixed inability to scroll through long texts in the sub editor's textboxes.
|
|
||||||
- Fixed clients not being able to see other characters in spectator if they've died far away from the sub.
|
|
||||||
- Fixed non-latin characters not being displayed correctly in Workshop item texts.
|
|
||||||
- Don't prevent selecting items in the sub editor when the cursor is on a wire node, because it makes it
|
|
||||||
very difficult (or impossible) to select small items in the wiring mode.
|
|
||||||
- Fixed crashing when attempting to use the "spawnitem" command when a round is not running.
|
|
||||||
|
|
||||||
---------------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------------
|
||||||
v0.8.9.10
|
v0.8.9.10
|
||||||
---------------------------------------------------------------------------------------------------------
|
---------------------------------------------------------------------------------------------------------
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user