- Changes in UpdateNetPlayerPosition
- Holdable items don't try to change the pose if hand anim is disabled (e.g. when dragging someone or using a railgun controller) - Indicator which shows the position of the sub when spectating - Bugfix in controller selection logic - Saving attributes on separate lines in serversettings.xml - Safer validation of received sub files
This commit is contained in:
@@ -692,9 +692,6 @@
|
|||||||
<Content Include="Content\UI\inventoryIcons.png">
|
<Content Include="Content\UI\inventoryIcons.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
<Content Include="Content\UI\orderSymbols.png">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</Content>
|
|
||||||
<Content Include="Content\UI\statusIcons.png">
|
<Content Include="Content\UI\statusIcons.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -873,6 +870,9 @@
|
|||||||
<Content Include="Content\Missions.xml">
|
<Content Include="Content\Missions.xml">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<Content Include="Content\UI\uiIcons.png">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="Content\waterbump.png">
|
<Content Include="Content\waterbump.png">
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
<ErrorReportUrlHistory />
|
<ErrorReportUrlHistory />
|
||||||
<FallbackCulture>en-US</FallbackCulture>
|
<FallbackCulture>en-US</FallbackCulture>
|
||||||
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
<VerifyUploadedFiles>false</VerifyUploadedFiles>
|
||||||
<ProjectView>ProjectFiles</ProjectView>
|
<ProjectView>ShowAllFiles</ProjectView>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ReferencePath>
|
<ReferencePath>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<Character name ="mantis" humanoid="false">
|
<Character name ="mantis" humanoid="false" health="200">
|
||||||
|
|
||||||
<sound file="Content/Characters/Crawler/attack1.ogg" state="Attack" range="500"/>
|
<sound file="Content/Characters/Crawler/attack1.ogg" state="Attack" range="500"/>
|
||||||
<sound file="Content/Characters/Crawler/attack2.ogg" state="Attack" range="500"/>
|
<sound file="Content/Characters/Crawler/attack2.ogg" state="Attack" range="500"/>
|
||||||
|
|||||||
@@ -1,27 +1,27 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<Orders>
|
<Orders>
|
||||||
<Order name="Follow" doingtext="Following" color="1.0,0.5,0.1,1.0">
|
<Order name="Follow" doingtext="Following" color="1.0,0.5,0.1,1.0">
|
||||||
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="0,0,64,64"/>
|
<Sprite texture="Content/UI/uiIcons.png" sourcerect="0,0,64,64"/>
|
||||||
</Order>
|
</Order>
|
||||||
|
|
||||||
<Order name="Wait" doingtext="Waiting" color="1.0,0.0,0.0,1.0">
|
<Order name="Wait" doingtext="Waiting" color="1.0,0.0,0.0,1.0">
|
||||||
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="128,0,64,64"/>
|
<Sprite texture="Content/UI/uiIcons.png" sourcerect="128,0,64,64"/>
|
||||||
</Order>
|
</Order>
|
||||||
|
|
||||||
<Order name="Dismissed" doingtext="Dismissed" color="0.0,1.0,0.0,1.0">
|
<Order name="Dismissed" doingtext="Dismissed" color="0.0,1.0,0.0,1.0">
|
||||||
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="64,0,64,64"/>
|
<Sprite texture="Content/UI/uiIcons.png" sourcerect="64,0,64,64"/>
|
||||||
</Order>
|
</Order>
|
||||||
|
|
||||||
|
|
||||||
<Order name="Operate Reactor" doingtext="Operating Reactor" targetitemtype="Reactor" options="Power up, Shutdown" color="1.0,0.78,0.05,1.0">
|
<Order name="Operate Reactor" doingtext="Operating Reactor" targetitemtype="Reactor" options="Power up, Shutdown" color="1.0,0.78,0.05,1.0">
|
||||||
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="192,0,64,64"/>
|
<Sprite texture="Content/UI/uiIcons.png" sourcerect="192,0,64,64"/>
|
||||||
</Order>
|
</Order>
|
||||||
|
|
||||||
<Order name="Operate Railgun" doingtext="Operating Railgun" targetitemtype="Turret" usecontroller="true" options="Fire at will, Hold fire" color="0.12,0.3,0.5,1.0">
|
<Order name="Operate Railgun" doingtext="Operating Railgun" targetitemtype="Turret" usecontroller="true" options="Fire at will, Hold fire" color="0.12,0.3,0.5,1.0">
|
||||||
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="0,64,64,64"/>
|
<Sprite texture="Content/UI/uiIcons.png" sourcerect="0,64,64,64"/>
|
||||||
</Order>
|
</Order>
|
||||||
|
|
||||||
<Order name="Fix Leaks" doingtext="Fixing Leaks" color="0.6,0.85,1.0,1.0">
|
<Order name="Fix Leaks" doingtext="Fixing Leaks" color="0.6,0.85,1.0,1.0">
|
||||||
<Sprite texture="Content/UI/orderSymbols.png" sourcerect="64,64,64,64"/>
|
<Sprite texture="Content/UI/uiIcons.png" sourcerect="64,64,64,64"/>
|
||||||
</Order>
|
</Order>
|
||||||
</Orders>
|
</Orders>
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 8.9 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
@@ -909,9 +909,8 @@ namespace Barotrauma
|
|||||||
Vector2 shoulderPos = limbJoints[2].WorldAnchorA;
|
Vector2 shoulderPos = limbJoints[2].WorldAnchorA;
|
||||||
Vector2 transformedHoldPos = shoulderPos;
|
Vector2 transformedHoldPos = shoulderPos;
|
||||||
|
|
||||||
if (itemPos == Vector2.Zero || Anim == Animation.Climbing)
|
if (itemPos == Vector2.Zero || Anim == Animation.Climbing || (leftHand.Disabled && rightHand.Disabled))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (character.SelectedItems[1] == item)
|
if (character.SelectedItems[1] == item)
|
||||||
{
|
{
|
||||||
transformedHoldPos = leftHand.pullJoint.WorldAnchorA - transformedHandlePos[1];
|
transformedHoldPos = leftHand.pullJoint.WorldAnchorA - transformedHandlePos[1];
|
||||||
|
|||||||
@@ -815,25 +815,35 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
if (inWater)
|
if (inWater)
|
||||||
{
|
{
|
||||||
if (character is AICharacter)
|
if (targetMovement.LengthSquared() > 0.01f)
|
||||||
{
|
{
|
||||||
correctionMovement =
|
correctionMovement =
|
||||||
Vector2.Lerp(targetMovement, Vector2.Normalize(diff) * MathHelper.Clamp(dist * 8.0f, 0.1f, 8.0f), 0.5f);
|
Vector2.Lerp(targetMovement, Vector2.Normalize(diff) * MathHelper.Clamp(dist * 5.0f, 0.1f, 5.0f), 0.2f);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
foreach (Limb limb in Limbs)
|
refLimb.body.LinearVelocity = Vector2.Lerp(
|
||||||
{
|
refLimb.LinearVelocity,
|
||||||
//if (limb.body.TargetPosition == Vector2.Zero) continue;
|
Vector2.Normalize(diff) * MathHelper.Clamp(dist, 0.0f, 5.0f),
|
||||||
|
0.2f);
|
||||||
|
|
||||||
limb.body.SetTransform(limb.SimPosition + Vector2.Normalize(diff) * 0.1f, limb.Rotation);
|
//foreach (Limb limb in Limbs)
|
||||||
}
|
//{
|
||||||
|
// //if (limb.body.TargetPosition == Vector2.Zero) continue;
|
||||||
|
// // Vector2.Lerp(limb.LinearVelocity, Vector2.Normalize(diff) * MathHelper.Clamp(dist, 0.0f, 1.0f))
|
||||||
|
// limb.body.LinearVelocity = Vector2.Lerp(
|
||||||
|
// limb.LinearVelocity,
|
||||||
|
// Vector2.Normalize(diff) * MathHelper.Clamp(dist, 0.0f, 5.0f),
|
||||||
|
// 0.2f);
|
||||||
|
|
||||||
|
// //limb.body.TargetVelocity .SetTransform(limb.SimPosition + Vector2.Normalize(diff) * 0.1f, limb.Rotation);
|
||||||
|
//}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//clamp the magnitude of the correction movement between 0.5f - 5.0f
|
//clamp the magnitude of the correction movement between 0.5f - 5.0f
|
||||||
Vector2 newCorrectionMovement = Vector2.Normalize(diff) * MathHelper.Clamp(dist * 5.0f, 0.5f, 5.0f);
|
Vector2 newCorrectionMovement = Vector2.Normalize(diff) * MathHelper.Clamp(dist*2.0f, 0.5f, 5.0f);
|
||||||
|
|
||||||
//heading in the right direction -> use the ''normal'' movement if it's faster than correctionMovement
|
//heading in the right direction -> use the ''normal'' movement if it's faster than correctionMovement
|
||||||
//i.e. the character is close to the targetposition but the character is still running
|
//i.e. the character is close to the targetposition but the character is still running
|
||||||
|
|||||||
@@ -965,7 +965,7 @@ namespace Barotrauma
|
|||||||
key.DequeueHeld();
|
key.DequeueHeld();
|
||||||
}
|
}
|
||||||
|
|
||||||
networkUpdateSent = true;
|
networkUpdateSent = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (needsAir)
|
if (needsAir)
|
||||||
|
|||||||
@@ -43,6 +43,18 @@ namespace Barotrauma
|
|||||||
|
|
||||||
public static Color ScreenOverlayColor;
|
public static Color ScreenOverlayColor;
|
||||||
|
|
||||||
|
private static Sprite submarineIcon, arrow;
|
||||||
|
|
||||||
|
public static Sprite SubmarineIcon
|
||||||
|
{
|
||||||
|
get { return submarineIcon; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Sprite Arrow
|
||||||
|
{
|
||||||
|
get { return arrow; }
|
||||||
|
}
|
||||||
|
|
||||||
public static void Init(ContentManager content)
|
public static void Init(ContentManager content)
|
||||||
{
|
{
|
||||||
GUI.Font = ToolBox.TryLoadFont("SpriteFont1", content);
|
GUI.Font = ToolBox.TryLoadFont("SpriteFont1", content);
|
||||||
@@ -72,6 +84,12 @@ namespace Barotrauma
|
|||||||
t = new Texture2D(graphicsDevice, 1, 1);
|
t = new Texture2D(graphicsDevice, 1, 1);
|
||||||
t.SetData(new Color[] { Color.White });// fill the texture with white
|
t.SetData(new Color[] { Color.White });// fill the texture with white
|
||||||
|
|
||||||
|
submarineIcon = new Sprite("Content/UI/uiIcons.png", new Rectangle(0, 192, 64, 64), null);
|
||||||
|
submarineIcon.Origin = submarineIcon.size / 2;
|
||||||
|
|
||||||
|
arrow = new Sprite("Content/UI/uiIcons.png", new Rectangle(80, 240, 16, 16), null);
|
||||||
|
arrow.Origin = arrow.size / 2;
|
||||||
|
|
||||||
Style = new GUIStyle("Content/UI/style.xml");
|
Style = new GUIStyle("Content/UI/style.xml");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
item.Submarine = picker.Submarine;
|
item.Submarine = picker.Submarine;
|
||||||
|
|
||||||
if (picker.SelectedConstruction != null && picker.SelectedConstruction.GetComponent<Controller>() != null) return;
|
//if (picker.SelectedConstruction != null && picker.SelectedConstruction.GetComponent<Controller>() != null) return;
|
||||||
|
|
||||||
//item.sprite.Depth = picker.AnimController.GetLimb(LimbType.RightHand).sprite.Depth + 0.01f;
|
//item.sprite.Depth = picker.AnimController.GetLimb(LimbType.RightHand).sprite.Depth + 0.01f;
|
||||||
|
|
||||||
|
|||||||
@@ -210,6 +210,8 @@ namespace Barotrauma.Items.Components
|
|||||||
limb.pullJoint.Enabled = false;
|
limb.pullJoint.Enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (character.SelectedConstruction == this.item) character.SelectedConstruction = null;
|
||||||
|
|
||||||
character.AnimController.Anim = AnimController.Animation.None;
|
character.AnimController.Anim = AnimController.Animation.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,9 +227,6 @@ namespace Barotrauma.Items.Components
|
|||||||
IsActive = false;
|
IsActive = false;
|
||||||
CancelUsing(character);
|
CancelUsing(character);
|
||||||
character = null;
|
character = null;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
using System.Xml;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace Barotrauma.Networking
|
namespace Barotrauma.Networking
|
||||||
@@ -259,15 +260,26 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
stream.Position = 0;
|
stream.Position = 0;
|
||||||
var doc = XDocument.Load(stream);
|
|
||||||
|
XmlReaderSettings settings = new XmlReaderSettings();
|
||||||
|
settings.DtdProcessing = DtdProcessing.Prohibit;
|
||||||
|
settings.IgnoreProcessingInstructions = true;
|
||||||
|
|
||||||
|
using (var reader = XmlReader.Create(stream, settings))
|
||||||
|
{
|
||||||
|
while (reader.Read())
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
stream.Close();
|
stream.Close();
|
||||||
stream.Dispose();
|
stream.Dispose();
|
||||||
|
|
||||||
ErrorMessage = "Failed to parse submarine file ''"+file+"''!";
|
ErrorMessage = "Parsing file ''"+file+"'' failed! The file may not be a valid submarine file.";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -846,6 +846,14 @@ namespace Barotrauma.Networking
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (ConnectedClients.Any(c => c.FileStreamSender != null && c.FileStreamSender.FilePath == selectedSub.FilePath))
|
||||||
|
{
|
||||||
|
new GUIMessageBox("Couldn't start a round",
|
||||||
|
"Can't start a round while sending the selected submarine to clients. Cancel the transfers or wait for them to finish before starting.", 400, 400);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
GameMain.ShowLoading(StartGame(selectedSub, selectedMode), false);
|
GameMain.ShowLoading(StartGame(selectedSub, selectedMode), false);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -855,13 +863,6 @@ namespace Barotrauma.Networking
|
|||||||
{
|
{
|
||||||
GUIMessageBox.CloseAll();
|
GUIMessageBox.CloseAll();
|
||||||
|
|
||||||
if (ConnectedClients.Any(c => c.FileStreamSender != null && c.FileStreamSender.FilePath == selectedSub.FilePath))
|
|
||||||
{
|
|
||||||
new GUIMessageBox("Couldn't start a round",
|
|
||||||
"Can't start a round while sending the selected submarine to clients. Cancel the transfers or wait for them to finish before starting.", 400, 400);
|
|
||||||
yield return CoroutineStatus.Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
AssignJobs();
|
AssignJobs();
|
||||||
|
|
||||||
roundStartSeed = DateTime.Now.Millisecond;
|
roundStartSeed = DateTime.Now.Millisecond;
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using System.Xml;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
|
||||||
namespace Barotrauma.Networking
|
namespace Barotrauma.Networking
|
||||||
@@ -96,29 +97,25 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
private void SaveSettings()
|
private void SaveSettings()
|
||||||
{
|
{
|
||||||
XDocument doc = new XDocument(new XElement("serversettings"));
|
XmlWriterSettings settings = new XmlWriterSettings();
|
||||||
|
settings.Indent = true;
|
||||||
doc.Root.Add
|
settings.NewLineOnAttributes = true;
|
||||||
(
|
|
||||||
new XAttribute("AllowSpectating", allowSpectating),
|
|
||||||
new XAttribute("RandomizeSeed", randomizeSeed),
|
|
||||||
new XAttribute("EndRoundAtLevelEnd", endRoundAtLevelEnd),
|
|
||||||
new XAttribute("AllowFileTransfers", allowFileTransfers),
|
|
||||||
|
|
||||||
new XAttribute("SaveServerLogs", saveServerLogs),
|
using (var writer = XmlWriter.Create(SettingsFile, settings))
|
||||||
new XAttribute("LinesPerLogFile", log.LinesPerFile),
|
|
||||||
|
|
||||||
new XAttribute("SubSelection", subSelectionMode),
|
|
||||||
new XAttribute("ModeSelection", modeSelectionMode)
|
|
||||||
);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
doc.Save(SettingsFile);
|
writer.WriteStartElement("serversettings");
|
||||||
}
|
writer.WriteAttributeString("AllowSpectating", allowSpectating.ToString());
|
||||||
catch (Exception e)
|
writer.WriteAttributeString("RandomizeSeed", randomizeSeed.ToString());
|
||||||
{
|
|
||||||
DebugConsole.ThrowError("Saving server settings failed", e);
|
writer.WriteAttributeString("EndRoundAtLevelEnd", endRoundAtLevelEnd.ToString());
|
||||||
|
writer.WriteAttributeString("AllowFileTransfers", allowFileTransfers.ToString());
|
||||||
|
writer.WriteAttributeString("MaxFileTransferDuration", ((int)FileStreamSender.MaxTransferDuration.TotalSeconds).ToString());
|
||||||
|
writer.WriteAttributeString("SaveServerLogs", saveServerLogs.ToString());
|
||||||
|
writer.WriteAttributeString("LinesPerLogFile", log.LinesPerFile.ToString());
|
||||||
|
writer.WriteAttributeString("SubSelection", subSelectionMode.ToString());
|
||||||
|
writer.WriteAttributeString("ModeSelection", modeSelectionMode.ToString());
|
||||||
|
|
||||||
|
writer.Flush();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,17 +149,58 @@ namespace Barotrauma.Networking
|
|||||||
|
|
||||||
modeSelectionMode = SelectionMode.Manual;
|
modeSelectionMode = SelectionMode.Manual;
|
||||||
Enum.TryParse<SelectionMode>(ToolBox.GetAttributeString(doc.Root, "ModeSelection", "Manual"), out modeSelectionMode);
|
Enum.TryParse<SelectionMode>(ToolBox.GetAttributeString(doc.Root, "ModeSelection", "Manual"), out modeSelectionMode);
|
||||||
|
|
||||||
|
FileStreamSender.MaxTransferDuration = new TimeSpan(0,0,ToolBox.GetAttributeInt(doc.Root, "MaxFileTransferDuration", 150));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreateSettingsFrame()
|
private void CreateSettingsFrame()
|
||||||
{
|
{
|
||||||
settingsFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f);
|
settingsFrame = new GUIFrame(new Rectangle(0, 0, GameMain.GraphicsWidth, GameMain.GraphicsHeight), Color.Black * 0.5f);
|
||||||
|
|
||||||
|
|
||||||
GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, 400, 400), null, Alignment.Center, GUI.Style, settingsFrame);
|
GUIFrame innerFrame = new GUIFrame(new Rectangle(0, 0, 400, 400), null, Alignment.Center, GUI.Style, settingsFrame);
|
||||||
|
innerFrame.Padding = new Vector4(20.0f, 20.0f, 20.0f, 20.0f);
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, -15, 0, 20), "Server settings", GUI.Style, innerFrame, GUI.LargeFont);
|
new GUITextBlock(new Rectangle(0, -5, 0, 20), "Server settings", GUI.Style, innerFrame, GUI.LargeFont);
|
||||||
|
|
||||||
var randomizeLevelBox = new GUITickBox(new Rectangle(0, 30, 20, 20), "Randomize level seed between rounds", Alignment.Left, innerFrame);
|
int y = 40;
|
||||||
|
|
||||||
|
var endBox = new GUITickBox(new Rectangle(0, y, 20, 20), "End round when destination reached", Alignment.Left, innerFrame);
|
||||||
|
endBox.Selected = endRoundAtLevelEnd;
|
||||||
|
endBox.OnSelected = (GUITickBox) => { endRoundAtLevelEnd = GUITickBox.Selected; return true; };
|
||||||
|
|
||||||
|
|
||||||
|
y += 30;
|
||||||
|
var endVoteBox = new GUITickBox(new Rectangle(0, y, 20, 20), "End round by voting", Alignment.Left, innerFrame);
|
||||||
|
endVoteBox.Selected = Voting.AllowEndVoting;
|
||||||
|
endVoteBox.OnSelected = (GUITickBox) =>
|
||||||
|
{
|
||||||
|
Voting.AllowEndVoting = !Voting.AllowEndVoting;
|
||||||
|
GameMain.Server.UpdateVoteStatus();
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
|
var votesRequiredText = new GUITextBlock(new Rectangle(20, y+20, 20, 20), "Votes required: 50 %", GUI.Style, innerFrame, GUI.SmallFont);
|
||||||
|
|
||||||
|
var votesRequiredSlider = new GUIScrollBar(new Rectangle(150, y+22, 100, 10), GUI.Style, 0.1f, innerFrame);
|
||||||
|
votesRequiredSlider.UserData = votesRequiredText;
|
||||||
|
votesRequiredSlider.BarScroll = (EndVoteRequiredRatio - 0.5f) * 2.0f;
|
||||||
|
votesRequiredSlider.OnMoved = (GUIScrollBar scrollBar, float barScroll) =>
|
||||||
|
{
|
||||||
|
GUITextBlock voteText = scrollBar.UserData as GUITextBlock;
|
||||||
|
|
||||||
|
scrollBar.BarScroll = MathUtils.Round(barScroll, 0.2f);
|
||||||
|
EndVoteRequiredRatio = barScroll / 2.0f + 0.5f;
|
||||||
|
voteText.Text = "Votes required: " + (int)MathUtils.Round(EndVoteRequiredRatio * 100.0f, 10.0f) + " %";
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
votesRequiredSlider.OnMoved(votesRequiredSlider, votesRequiredSlider.BarScroll);
|
||||||
|
|
||||||
|
y += 40;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var randomizeLevelBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Randomize level seed between rounds", Alignment.Left, innerFrame);
|
||||||
randomizeLevelBox.Selected = randomizeSeed;
|
randomizeLevelBox.Selected = randomizeSeed;
|
||||||
randomizeLevelBox.OnSelected = (GUITickBox) =>
|
randomizeLevelBox.OnSelected = (GUITickBox) =>
|
||||||
{
|
{
|
||||||
@@ -170,37 +208,23 @@ namespace Barotrauma.Networking
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
var endBox = new GUITickBox(new Rectangle(0, 60, 20, 20), "End round when destination reached", Alignment.Left, innerFrame);
|
|
||||||
endBox.Selected = endRoundAtLevelEnd;
|
|
||||||
endBox.OnSelected = (GUITickBox) => { endRoundAtLevelEnd = GUITickBox.Selected; return true; };
|
|
||||||
|
|
||||||
var endVoteBox = new GUITickBox(new Rectangle(0, 90, 20, 20), "End round by voting", Alignment.Left, innerFrame);
|
y += 40;
|
||||||
endVoteBox.Selected = Voting.AllowEndVoting;
|
|
||||||
endVoteBox.OnSelected = (GUITickBox) =>
|
var shareSubsBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Share submarine files with players", Alignment.Left, innerFrame);
|
||||||
|
shareSubsBox.Selected = allowFileTransfers;
|
||||||
|
shareSubsBox.OnSelected = (GUITickBox) =>
|
||||||
{
|
{
|
||||||
Voting.AllowEndVoting = !Voting.AllowEndVoting;
|
allowFileTransfers = GUITickBox.Selected;
|
||||||
GameMain.Server.UpdateVoteStatus();
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
var votesRequiredText = new GUITextBlock(new Rectangle(20, 110, 20, 20), "Votes required: 50 %", GUI.Style, innerFrame, GUI.SmallFont);
|
|
||||||
|
|
||||||
var votesRequiredSlider = new GUIScrollBar(new Rectangle(150,115, 100, 10), GUI.Style, 0.1f, innerFrame);
|
|
||||||
votesRequiredSlider.UserData = votesRequiredText;
|
|
||||||
votesRequiredSlider.BarScroll = (EndVoteRequiredRatio - 0.5f) * 2.0f;
|
|
||||||
votesRequiredSlider.OnMoved = (GUIScrollBar scrollBar, float barScroll) =>
|
|
||||||
{
|
|
||||||
GUITextBlock voteText = scrollBar.UserData as GUITextBlock;
|
|
||||||
|
|
||||||
scrollBar.BarScroll = MathUtils.Round(barScroll, 0.2f);
|
|
||||||
EndVoteRequiredRatio = barScroll/2.0f + 0.5f;
|
|
||||||
voteText.Text = "Votes required: " + (int)MathUtils.Round(EndVoteRequiredRatio * 100.0f, 10.0f) + " %";
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
votesRequiredSlider.OnMoved(votesRequiredSlider, votesRequiredSlider.BarScroll);
|
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 95+50, 100, 20), "Submarine selection:", GUI.Style, innerFrame);
|
|
||||||
var selectionFrame = new GUIFrame(new Rectangle(0, 120 + 50, 300, 20), null, innerFrame);
|
y += 40;
|
||||||
|
|
||||||
|
|
||||||
|
new GUITextBlock(new Rectangle(0, y, 100, 20), "Submarine selection:", GUI.Style, innerFrame);
|
||||||
|
var selectionFrame = new GUIFrame(new Rectangle(0, y+20, 300, 20), null, innerFrame);
|
||||||
for (int i = 0; i<3; i++)
|
for (int i = 0; i<3; i++)
|
||||||
{
|
{
|
||||||
var selectionTick = new GUITickBox(new Rectangle(i * 100, 0, 20, 20), ((SelectionMode)i).ToString(), Alignment.Left, selectionFrame);
|
var selectionTick = new GUITickBox(new Rectangle(i * 100, 0, 20, 20), ((SelectionMode)i).ToString(), Alignment.Left, selectionFrame);
|
||||||
@@ -209,8 +233,10 @@ namespace Barotrauma.Networking
|
|||||||
selectionTick.UserData = (SelectionMode)i;
|
selectionTick.UserData = (SelectionMode)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
new GUITextBlock(new Rectangle(0, 145 + 50, 100, 20), "Mode selection:", GUI.Style, innerFrame);
|
y += 45;
|
||||||
selectionFrame = new GUIFrame(new Rectangle(0, 170 + 50, 300, 20), null, innerFrame);
|
|
||||||
|
new GUITextBlock(new Rectangle(0, y, 100, 20), "Mode selection:", GUI.Style, innerFrame);
|
||||||
|
selectionFrame = new GUIFrame(new Rectangle(0, y+20, 300, 20), null, innerFrame);
|
||||||
for (int i = 0; i<3; i++)
|
for (int i = 0; i<3; i++)
|
||||||
{
|
{
|
||||||
var selectionTick = new GUITickBox(new Rectangle(i*100, 0, 20, 20), ((SelectionMode)i).ToString(), Alignment.Left, selectionFrame);
|
var selectionTick = new GUITickBox(new Rectangle(i*100, 0, 20, 20), ((SelectionMode)i).ToString(), Alignment.Left, selectionFrame);
|
||||||
@@ -219,7 +245,9 @@ namespace Barotrauma.Networking
|
|||||||
selectionTick.UserData = (SelectionMode)i;
|
selectionTick.UserData = (SelectionMode)i;
|
||||||
}
|
}
|
||||||
|
|
||||||
var allowSpecBox = new GUITickBox(new Rectangle(0, 210 + 50, 20, 20), "Allow spectating", Alignment.Left, innerFrame);
|
y += 60;
|
||||||
|
|
||||||
|
var allowSpecBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Allow spectating", Alignment.Left, innerFrame);
|
||||||
allowSpecBox.Selected = allowSpectating;
|
allowSpecBox.Selected = allowSpectating;
|
||||||
allowSpecBox.OnSelected = (GUITickBox) =>
|
allowSpecBox.OnSelected = (GUITickBox) =>
|
||||||
{
|
{
|
||||||
@@ -227,7 +255,9 @@ namespace Barotrauma.Networking
|
|||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
var saveLogsBox = new GUITickBox(new Rectangle(0, 240 + 50, 20, 20), "Save server logs", Alignment.Left, innerFrame);
|
y += 30;
|
||||||
|
|
||||||
|
var saveLogsBox = new GUITickBox(new Rectangle(0, y, 20, 20), "Save server logs", Alignment.Left, innerFrame);
|
||||||
saveLogsBox.Selected = saveServerLogs;
|
saveLogsBox.Selected = saveServerLogs;
|
||||||
saveLogsBox.OnSelected = (GUITickBox) =>
|
saveLogsBox.OnSelected = (GUITickBox) =>
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -177,7 +177,7 @@ namespace Barotrauma
|
|||||||
//{
|
//{
|
||||||
// cam.TargetPos = Character.Controlled.WorldPosition;
|
// cam.TargetPos = Character.Controlled.WorldPosition;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
cam.UpdateTransform();
|
cam.UpdateTransform();
|
||||||
|
|
||||||
DrawMap(graphics, spriteBatch);
|
DrawMap(graphics, spriteBatch);
|
||||||
@@ -200,6 +200,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
if (GameMain.GameSession != null) GameMain.GameSession.Draw(spriteBatch);
|
if (GameMain.GameSession != null) GameMain.GameSession.Draw(spriteBatch);
|
||||||
|
|
||||||
|
if (Character.Controlled == null && Submarine.Loaded != null) DrawSubmarineIndicator(spriteBatch, Submarine.Loaded);
|
||||||
|
|
||||||
GUI.Draw((float)deltaTime, spriteBatch, cam);
|
GUI.Draw((float)deltaTime, spriteBatch, cam);
|
||||||
|
|
||||||
if (!PlayerInput.LeftButtonHeld()) Inventory.draggingItem = null;
|
if (!PlayerInput.LeftButtonHeld()) Inventory.draggingItem = null;
|
||||||
@@ -348,5 +350,25 @@ namespace Barotrauma
|
|||||||
|
|
||||||
GameMain.LightManager.DrawLOS(graphics, spriteBatch, cam);
|
GameMain.LightManager.DrawLOS(graphics, spriteBatch, cam);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DrawSubmarineIndicator(SpriteBatch spriteBatch, Submarine submarine)
|
||||||
|
{
|
||||||
|
Vector2 subDiff = submarine.WorldPosition - cam.Position;
|
||||||
|
|
||||||
|
if (Math.Abs(subDiff.X) > cam.WorldView.Width || Math.Abs(subDiff.Y) > cam.WorldView.Height)
|
||||||
|
{
|
||||||
|
Vector2 normalizedSubDiff = Vector2.Normalize(subDiff);
|
||||||
|
|
||||||
|
Vector2 iconPos =
|
||||||
|
cam.WorldToScreen(cam.Position) +
|
||||||
|
new Vector2(normalizedSubDiff.X * GameMain.GraphicsWidth * 0.4f, -normalizedSubDiff.Y * GameMain.GraphicsHeight * 0.4f);
|
||||||
|
|
||||||
|
GUI.SubmarineIcon.Draw(spriteBatch, iconPos, Color.LightBlue * 0.5f);
|
||||||
|
|
||||||
|
Vector2 arrowOffset = normalizedSubDiff * GUI.SubmarineIcon.size.X * 0.7f;
|
||||||
|
arrowOffset.Y = -arrowOffset.Y;
|
||||||
|
GUI.Arrow.Draw(spriteBatch, iconPos + arrowOffset, Color.LightBlue * 0.5f, MathUtils.VectorToAngle(arrowOffset) + MathHelper.PiOver2);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -440,8 +440,6 @@ namespace Barotrauma
|
|||||||
|
|
||||||
UpdateJobPreferences(jobList);
|
UpdateJobPreferences(jobList);
|
||||||
|
|
||||||
//UpdatePreviewPlayer(Game1.Client.CharacterInfo);
|
|
||||||
|
|
||||||
UpdatePreviewPlayer(characterInfo);
|
UpdatePreviewPlayer(characterInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -510,7 +508,6 @@ namespace Barotrauma
|
|||||||
{
|
{
|
||||||
valueChanged = true;
|
valueChanged = true;
|
||||||
|
|
||||||
|
|
||||||
var hash = (obj as Submarine).MD5Hash;
|
var hash = (obj as Submarine).MD5Hash;
|
||||||
|
|
||||||
//hash will be null if opening the sub file failed -> don't select the sub
|
//hash will be null if opening the sub file failed -> don't select the sub
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user