(f417b026f) Fetched: Changes for playing video tutorial from local branch
This commit is contained in:
@@ -13,39 +13,13 @@ namespace Barotrauma
|
||||
var pos = new Vector2(WorldPosition.X, -WorldPosition.Y);
|
||||
if (soundRange > 0.0f)
|
||||
{
|
||||
Color color;
|
||||
if (Entity is Character)
|
||||
{
|
||||
color = Color.Yellow;
|
||||
}
|
||||
else if (Entity is Item)
|
||||
{
|
||||
color = Color.Orange;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = Color.OrangeRed;
|
||||
}
|
||||
Color color = Entity is Character ? Color.Yellow : Color.Orange;
|
||||
ShapeExtensions.DrawCircle(spriteBatch, pos, SoundRange, 100, color, thickness: 1 / Screen.Selected.Cam.Zoom);
|
||||
ShapeExtensions.DrawCircle(spriteBatch, pos, 3, 8, color, thickness: 2 / Screen.Selected.Cam.Zoom);
|
||||
}
|
||||
if (sightRange > 0.0f)
|
||||
{
|
||||
Color color;
|
||||
if (Entity is Character)
|
||||
{
|
||||
color = Color.CornflowerBlue;
|
||||
}
|
||||
else if (Entity is Item)
|
||||
{
|
||||
color = Color.CadetBlue;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = Color.WhiteSmoke;
|
||||
}
|
||||
Color color = Entity is Character ? Color.CornflowerBlue : Color.CadetBlue;
|
||||
ShapeExtensions.DrawCircle(spriteBatch, pos, SightRange, 100, color, thickness: 1 / Screen.Selected.Cam.Zoom);
|
||||
ShapeExtensions.DrawCircle(spriteBatch, pos, 6, 8, color, thickness: 2 / Screen.Selected.Cam.Zoom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,17 +16,18 @@ namespace Barotrauma
|
||||
|
||||
if (SelectedAiTarget?.Entity != null)
|
||||
{
|
||||
GUI.DrawLine(spriteBatch, pos, new Vector2(SelectedAiTarget.WorldPosition.X, -SelectedAiTarget.WorldPosition.Y), Color.Red * 0.5f, 0, 4);
|
||||
GUI.DrawLine(spriteBatch, pos, new Vector2(SelectedAiTarget.WorldPosition.X, -SelectedAiTarget.WorldPosition.Y), Color.Red * 0.3f, 0, 5);
|
||||
|
||||
if (wallTarget != null)
|
||||
{
|
||||
Vector2 wallTargetPos = wallTarget.Position;
|
||||
if (wallTarget.Structure.Submarine != null) { wallTargetPos += wallTarget.Structure.Submarine.Position; }
|
||||
if (wallTarget.Structure.Submarine != null) wallTargetPos += wallTarget.Structure.Submarine.Position;
|
||||
wallTargetPos.Y = -wallTargetPos.Y;
|
||||
GUI.DrawRectangle(spriteBatch, wallTargetPos - new Vector2(10.0f, 10.0f), new Vector2(20.0f, 20.0f), Color.Orange, false);
|
||||
GUI.DrawLine(spriteBatch, pos, wallTargetPos, Color.Orange * 0.5f, 0, 5);
|
||||
GUI.DrawRectangle(spriteBatch, wallTargetPos - new Vector2(10.0f, 10.0f), new Vector2(20.0f, 20.0f), Color.Red, false);
|
||||
GUI.DrawLine(spriteBatch, pos, wallTargetPos, Color.Orange * 0.5f, 0, 5);
|
||||
}
|
||||
GUI.DrawString(spriteBatch, pos - Vector2.UnitY * 60.0f, $"{SelectedAiTarget.Entity.ToString()} ({targetValue.FormatZeroDecimal()})", Color.Red, Color.Black);
|
||||
|
||||
GUI.Font.DrawString(spriteBatch, $"{SelectedAiTarget.Entity.ToString()} ({targetValue.ToString()})", pos - Vector2.UnitY * 20.0f, Color.Red);
|
||||
}
|
||||
|
||||
/*GUI.Font.DrawString(spriteBatch, targetValue.ToString(), pos - Vector2.UnitY * 80.0f, Color.Red);
|
||||
@@ -57,9 +58,18 @@ namespace Barotrauma
|
||||
{
|
||||
GUI.DrawLine(spriteBatch,
|
||||
ConvertUnits.ToDisplayUnits(new Vector2(attachJoint.WorldAnchorA.X, -attachJoint.WorldAnchorA.Y)),
|
||||
ConvertUnits.ToDisplayUnits(new Vector2(attachJoint.WorldAnchorB.X, -attachJoint.WorldAnchorB.Y)), Color.Green, 0, 4);
|
||||
ConvertUnits.ToDisplayUnits(new Vector2(attachJoint.WorldAnchorB.X, -attachJoint.WorldAnchorB.Y)), Color.Orange * 0.6f, 0, 5);
|
||||
}
|
||||
|
||||
if (latchOntoAI.WallAttachPos.HasValue)
|
||||
{
|
||||
GUI.DrawLine(spriteBatch, pos,
|
||||
ConvertUnits.ToDisplayUnits(new Vector2(latchOntoAI.WallAttachPos.Value.X, -latchOntoAI.WallAttachPos.Value.Y)), Color.Orange * 0.6f, 0, 3);
|
||||
}
|
||||
}
|
||||
|
||||
GUI.DrawLine(spriteBatch, pos, pos + ConvertUnits.ToDisplayUnits(new Vector2(Steering.X, -Steering.Y)), Color.Blue, width: 3);
|
||||
|
||||
if (latchOntoAI.WallAttachPos.HasValue)
|
||||
{
|
||||
GUI.DrawLine(spriteBatch, pos,
|
||||
@@ -67,34 +77,22 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (steeringManager is IndoorsSteeringManager pathSteering)
|
||||
GUI.DrawLine(spriteBatch,
|
||||
new Vector2(Character.DrawPosition.X, -Character.DrawPosition.Y),
|
||||
new Vector2(pathSteering.CurrentPath.CurrentNode.DrawPosition.X, -pathSteering.CurrentPath.CurrentNode.DrawPosition.Y),
|
||||
Color.Orange * 0.6f, 0, 3);
|
||||
|
||||
for (int i = 1; i < pathSteering.CurrentPath.Nodes.Count; i++)
|
||||
{
|
||||
var path = pathSteering.CurrentPath;
|
||||
if (path != null)
|
||||
{
|
||||
if (path.CurrentNode != null)
|
||||
{
|
||||
GUI.DrawLine(spriteBatch, pos,
|
||||
new Vector2(path.CurrentNode.DrawPosition.X, -path.CurrentNode.DrawPosition.Y),
|
||||
Color.DarkViolet, 0, 3);
|
||||
GUI.DrawLine(spriteBatch,
|
||||
new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y),
|
||||
new Vector2(pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i - 1].DrawPosition.Y),
|
||||
Color.Orange * 0.6f, 0, 3);
|
||||
|
||||
GUI.DrawString(spriteBatch, pos - new Vector2(0, 100), "Path cost: " + path.Cost.FormatZeroDecimal(), Color.White, Color.Black * 0.5f);
|
||||
}
|
||||
for (int i = 1; i < path.Nodes.Count; i++)
|
||||
{
|
||||
var previousNode = path.Nodes[i - 1];
|
||||
var currentNode = path.Nodes[i];
|
||||
GUI.DrawLine(spriteBatch,
|
||||
new Vector2(currentNode.DrawPosition.X, -currentNode.DrawPosition.Y),
|
||||
new Vector2(previousNode.DrawPosition.X, -previousNode.DrawPosition.Y),
|
||||
Color.Red * 0.5f, 0, 3);
|
||||
|
||||
GUI.SmallFont.DrawString(spriteBatch,
|
||||
currentNode.ID.ToString(),
|
||||
new Vector2(currentNode.DrawPosition.X + 20, -currentNode.DrawPosition.Y - 20),
|
||||
Color.Red);
|
||||
}
|
||||
}
|
||||
GUI.SmallFont.DrawString(spriteBatch,
|
||||
pathSteering.CurrentPath.Nodes[i].ID.ToString(),
|
||||
new Vector2(pathSteering.CurrentPath.Nodes[i].DrawPosition.X, -pathSteering.CurrentPath.Nodes[i].DrawPosition.Y - 10),
|
||||
Color.LightGreen);
|
||||
}
|
||||
GUI.DrawLine(spriteBatch, pos, pos + ConvertUnits.ToDisplayUnits(new Vector2(Character.AnimController.TargetMovement.X, -Character.AnimController.TargetMovement.Y)), Color.SteelBlue, width: 2);
|
||||
GUI.DrawLine(spriteBatch, pos, pos + ConvertUnits.ToDisplayUnits(new Vector2(Steering.X, -Steering.Y)), Color.Blue, width: 3);
|
||||
|
||||
@@ -75,12 +75,11 @@ namespace Barotrauma
|
||||
|
||||
GUI.SmallFont.DrawString(spriteBatch,
|
||||
currentNode.ID.ToString(),
|
||||
new Vector2(currentNode.DrawPosition.X + 20, -currentNode.DrawPosition.Y - 20),
|
||||
Color.SkyBlue);
|
||||
new Vector2(currentNode.DrawPosition.X, -currentNode.DrawPosition.Y - 10),
|
||||
Color.LightGreen);
|
||||
}
|
||||
}
|
||||
}
|
||||
GUI.DrawLine(spriteBatch, pos, pos + ConvertUnits.ToDisplayUnits(new Vector2(Character.AnimController.TargetMovement.X, -Character.AnimController.TargetMovement.Y)), Color.SteelBlue, width: 2);
|
||||
GUI.DrawLine(spriteBatch, pos, pos + ConvertUnits.ToDisplayUnits(new Vector2(Steering.X, -Steering.Y)), Color.Blue, width: 3);
|
||||
|
||||
//if (Character.IsKeyDown(InputType.Aim))
|
||||
|
||||
@@ -210,9 +210,7 @@ namespace Barotrauma
|
||||
else
|
||||
{
|
||||
Vector2 positionError = serverPos.Position - localPos.Position;
|
||||
float rotationError = serverPos.Rotation.HasValue && localPos.Rotation.HasValue ?
|
||||
serverPos.Rotation.Value - localPos.Rotation.Value :
|
||||
0.0f;
|
||||
float rotationError = serverPos.Rotation - localPos.Rotation;
|
||||
|
||||
for (int i = localPosIndex; i < character.MemLocalState.Count; i++)
|
||||
{
|
||||
|
||||
@@ -544,10 +544,7 @@ namespace Barotrauma
|
||||
{
|
||||
healthBar.Color = healthWindowHealthBar.Color = ToolBox.GradientLerp(Vitality / MaxVitality, Color.Red, Color.Orange, Color.Green);
|
||||
healthBar.HoverColor = healthWindowHealthBar.HoverColor = healthBar.Color * 2.0f;
|
||||
healthBar.BarSize = healthWindowHealthBar.BarSize =
|
||||
(Vitality > 0.0f) ?
|
||||
(MaxVitality > 0.0f ? Vitality / MaxVitality : 0.0f) :
|
||||
(Math.Abs(MinVitality) > 0.0f ? 1.0f - Vitality / MinVitality : 0.0f);
|
||||
healthBar.BarSize = healthWindowHealthBar.BarSize = (Vitality > 0.0f) ? Vitality / MaxVitality : 1.0f - Vitality / MinVitality;
|
||||
|
||||
if (healthBarPulsateTimer > 0.0f)
|
||||
{
|
||||
|
||||
@@ -214,8 +214,8 @@ namespace Barotrauma
|
||||
msg.ReadRangedSingle(-MaxVel, MaxVel, 12));
|
||||
|
||||
bool fixedRotation = msg.ReadBoolean();
|
||||
float? rotation = null;
|
||||
float? angularVelocity = null;
|
||||
float rotation = AnimController.Collider.Rotation;
|
||||
float angularVelocity = AnimController.Collider.AngularVelocity;
|
||||
if (!fixedRotation)
|
||||
{
|
||||
rotation = msg.ReadFloat();
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -403,11 +403,6 @@ namespace Barotrauma
|
||||
AssignRelayToServer("help", false);
|
||||
AssignRelayToServer("verboselogging", false);
|
||||
AssignRelayToServer("freecam", false);
|
||||
#if DEBUG
|
||||
AssignRelayToServer("simulatedlatency", false);
|
||||
AssignRelayToServer("simulatedloss", false);
|
||||
AssignRelayToServer("simulatedduplicateschance", false);
|
||||
#endif
|
||||
|
||||
commands.Add(new Command("clientlist", "", (string[] args) => { }));
|
||||
AssignRelayToServer("clientlist", true);
|
||||
@@ -444,7 +439,7 @@ namespace Barotrauma
|
||||
|
||||
AssignOnExecute("ambientlight", (string[] args) =>
|
||||
{
|
||||
Color color = XMLExtensions.ParseColor(string.Join(",", args));
|
||||
Color color = XMLExtensions.ParseColor(string.Join("", args));
|
||||
if (Level.Loaded != null)
|
||||
{
|
||||
Level.Loaded.GenerationParams.AmbientLightColor = color;
|
||||
@@ -533,27 +528,44 @@ namespace Barotrauma
|
||||
}
|
||||
}, isCheat: true));
|
||||
|
||||
commands.Add(new Command("resetall", "Reset all items and structures to prefabs. Only applicable in the subeditor.", args =>
|
||||
commands.Add(new Command("alpha", "Change the alpha (as bytes from 0 to 255) of the selected item/structure instances. Applied only in the subeditor.", (string[] args) =>
|
||||
{
|
||||
if (Screen.Selected == GameMain.SubEditorScreen)
|
||||
{
|
||||
Item.ItemList.ForEach(i => i.Reset());
|
||||
Structure.WallList.ForEach(s => s.Reset());
|
||||
foreach (MapEntity entity in MapEntity.SelectedList)
|
||||
if (!MapEntity.SelectedAny)
|
||||
{
|
||||
if (entity is Item item)
|
||||
ThrowError("You have to select item(s)/structure(s) first!");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (args.Length > 0)
|
||||
{
|
||||
item.CreateEditingHUD();
|
||||
break;
|
||||
if (!byte.TryParse(args[0], out byte a))
|
||||
{
|
||||
ThrowError($"Failed to parse value for ALPHA from {args[0]}");
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach (var mapEntity in MapEntity.SelectedList)
|
||||
{
|
||||
if (mapEntity is Structure s)
|
||||
{
|
||||
s.SpriteColor = new Color(s.SpriteColor.R, s.SpriteColor.G, s.SpriteColor.G, a);
|
||||
}
|
||||
else if (mapEntity is Item i)
|
||||
{
|
||||
i.SpriteColor = new Color(i.SpriteColor.R, i.SpriteColor.G, i.SpriteColor.G, a);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (entity is Structure structure)
|
||||
else
|
||||
{
|
||||
structure.CreateEditingHUD();
|
||||
break;
|
||||
ThrowError("Not enough arguments provided! One required!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
}, isCheat: true));
|
||||
|
||||
commands.Add(new Command("alpha", "Change the alpha (as bytes from 0 to 255) of the selected item/structure instances. Applied only in the subeditor.", (string[] args) =>
|
||||
{
|
||||
|
||||
@@ -0,0 +1,215 @@
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Xml.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Barotrauma.Media;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
class VideoPlayer
|
||||
{
|
||||
private Video currentVideo;
|
||||
private List<PreloadedContent> preloadedVideos;
|
||||
|
||||
private GUIFrame background, videoFrame;
|
||||
private GUITextBlock title;
|
||||
private GUICustomComponent videoView;
|
||||
|
||||
private Color backgroundColor = new Color(0f, 0f, 0f, 1f);
|
||||
private Action callbackOnStop;
|
||||
|
||||
private bool isPlaying;
|
||||
|
||||
public bool IsPlaying()
|
||||
{
|
||||
return isPlaying;
|
||||
/*if (currentVideo == null) return false;
|
||||
return currentVideo.IsPlaying;*/
|
||||
}
|
||||
|
||||
private readonly Point defaultResolution = new Point(520, 300);
|
||||
private readonly int borderSize = 20;
|
||||
|
||||
private class PreloadedContent
|
||||
{
|
||||
public string ContentName;
|
||||
public string ContentTag;
|
||||
public Video Video;
|
||||
public Point Resolution;
|
||||
|
||||
public PreloadedContent(string name, string tag, Video video, Point resolution)
|
||||
{
|
||||
ContentName = name;
|
||||
ContentTag = tag;
|
||||
Video = video;
|
||||
Resolution = resolution;
|
||||
}
|
||||
}
|
||||
|
||||
public VideoPlayer()
|
||||
{
|
||||
int width = defaultResolution.X;
|
||||
int height = defaultResolution.Y;
|
||||
|
||||
background = new GUIFrame(new RectTransform(new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight), GUI.Canvas, Anchor.Center), "InnerFrame", backgroundColor);
|
||||
videoFrame = new GUIFrame(new RectTransform(new Point(width + borderSize, height + borderSize), background.RectTransform, Anchor.Center), "SonarFrame");
|
||||
videoView = new GUICustomComponent(new RectTransform(new Point(width, height), videoFrame.RectTransform, Anchor.Center),
|
||||
(spriteBatch, guiCustomComponent) => { DrawVideo(spriteBatch, guiCustomComponent.Rect); });
|
||||
title = new GUITextBlock(new RectTransform(new Vector2(1f, 0f), videoFrame.RectTransform, Anchor.TopCenter, Pivot.BottomCenter), string.Empty, font: GUI.LargeFont, textAlignment: Alignment.Center);
|
||||
|
||||
preloadedVideos = new List<PreloadedContent>();
|
||||
}
|
||||
|
||||
public void PreloadContent(string contentPath, string contentTag, string contentId, XElement contentElement)
|
||||
{
|
||||
if (preloadedVideos.Find(s => s.ContentName == contentId) != null) return; // Already loaded
|
||||
Point resolution = new Point(contentElement.GetAttributeInt("width", 0), contentElement.GetAttributeInt("height", 0));
|
||||
|
||||
if (resolution.X == 0 || resolution.Y == 0)
|
||||
{
|
||||
resolution = defaultResolution;
|
||||
}
|
||||
|
||||
preloadedVideos.Add(new PreloadedContent(contentId, contentTag, CreateVideo(contentPath, resolution), resolution));
|
||||
}
|
||||
|
||||
public void RemoveAllPreloaded()
|
||||
{
|
||||
if (preloadedVideos == null || preloadedVideos.Count == 0) return;
|
||||
|
||||
for (int i = 0; i < preloadedVideos.Count; i++)
|
||||
{
|
||||
preloadedVideos[i] = null;
|
||||
}
|
||||
|
||||
preloadedVideos.Clear();
|
||||
}
|
||||
|
||||
public void RemovePreloadedByTag(string tag)
|
||||
{
|
||||
if (preloadedVideos == null || preloadedVideos.Count == 0) return;
|
||||
|
||||
for (int i = 0; i < preloadedVideos.Count; i++)
|
||||
{
|
||||
if (preloadedVideos[i].ContentTag != tag) continue;
|
||||
preloadedVideos[i] = null;
|
||||
preloadedVideos.RemoveAt(i);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
||||
public void Play()
|
||||
{
|
||||
isPlaying = true;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
{
|
||||
isPlaying = false;
|
||||
if (currentVideo == null) return;
|
||||
currentVideo.Dispose();
|
||||
currentVideo = null;
|
||||
}
|
||||
|
||||
private bool OKButtonClicked(GUIButton button, object userData)
|
||||
{
|
||||
Stop();
|
||||
callbackOnStop?.Invoke();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void AddToGUIUpdateList()
|
||||
{
|
||||
if (!IsPlaying()) return;
|
||||
background.AddToGUIUpdateList();
|
||||
}
|
||||
|
||||
public void LoadContent(string contentPath, XElement videoElement, string contentId, bool startPlayback, bool hasButton, Action callback = null)
|
||||
{
|
||||
if (currentVideo != null)
|
||||
{
|
||||
currentVideo.Dispose();
|
||||
currentVideo = null;
|
||||
}
|
||||
|
||||
PreloadedContent preloaded = null;
|
||||
Point resolution = new Point(0, 0);
|
||||
|
||||
if (preloadedVideos != null && preloadedVideos.Count > 0)
|
||||
{
|
||||
preloaded = preloadedVideos.Find(s => s.ContentName == contentId);
|
||||
|
||||
if (preloaded != null)
|
||||
{
|
||||
currentVideo = preloaded.Video;
|
||||
resolution = preloaded.Resolution;
|
||||
}
|
||||
}
|
||||
|
||||
if (currentVideo == null) // No preloaded sheets found, create sheets
|
||||
{
|
||||
resolution = new Point(videoElement.GetAttributeInt("width", 0), videoElement.GetAttributeInt("height", 0));
|
||||
|
||||
if (resolution.X == 0 || resolution.Y == 0)
|
||||
{
|
||||
resolution = defaultResolution;
|
||||
}
|
||||
|
||||
currentVideo = CreateVideo(contentPath, resolution);
|
||||
}
|
||||
|
||||
videoFrame.RectTransform.NonScaledSize = resolution + new Point(borderSize, borderSize);
|
||||
videoView.RectTransform.NonScaledSize = resolution;
|
||||
|
||||
title.Text = TextManager.Get(contentId);
|
||||
title.RectTransform.NonScaledSize = new Point(resolution.X, 30);
|
||||
|
||||
callbackOnStop = callback;
|
||||
|
||||
if (hasButton)
|
||||
{
|
||||
var okButton = new GUIButton(new RectTransform(new Point(160, 50), videoFrame.RectTransform, Anchor.BottomCenter, Pivot.TopCenter) { AbsoluteOffset = new Point(0, -10) },
|
||||
TextManager.Get("OK"))
|
||||
{
|
||||
OnClicked = OKButtonClicked
|
||||
};
|
||||
}
|
||||
|
||||
if (startPlayback) Play();
|
||||
}
|
||||
|
||||
private Video CreateVideo(string contentPath, Point resolution)
|
||||
{
|
||||
Video video = null;
|
||||
|
||||
try
|
||||
{
|
||||
video = new Video(GameMain.Instance.GraphicsDevice, GameMain.SoundManager, contentPath, (uint)resolution.X, (uint)resolution.Y);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugConsole.ThrowError("Error loading video content " + contentPath + "!", e);
|
||||
}
|
||||
|
||||
return video;
|
||||
}
|
||||
|
||||
private void DrawVideo(SpriteBatch spriteBatch, Rectangle rect)
|
||||
{
|
||||
if (!isPlaying) return;
|
||||
spriteBatch.Draw(currentVideo.GetTexture(), rect, Color.White);
|
||||
}
|
||||
|
||||
public void Remove()
|
||||
{
|
||||
if (currentVideo != null)
|
||||
{
|
||||
currentVideo.Dispose();
|
||||
currentVideo = null;
|
||||
}
|
||||
|
||||
RemoveAllPreloaded();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ namespace Barotrauma
|
||||
{
|
||||
private UInt16 startWatchmanID, endWatchmanID;
|
||||
|
||||
public static GUIComponent StartCampaignSetup( IEnumerable<Submarine> submarines, IEnumerable<string> saveFiles)
|
||||
public static GUIComponent StartCampaignSetup(IEnumerable<string> saveFiles)
|
||||
{
|
||||
GUIFrame background = new GUIFrame(new RectTransform(Vector2.One, GUI.Canvas), style: "GUIBackgroundBlocker");
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace Barotrauma
|
||||
var newCampaignContainer = new GUIFrame(new RectTransform(Vector2.One, campaignContainer.RectTransform, Anchor.BottomLeft), style: null);
|
||||
var loadCampaignContainer = new GUIFrame(new RectTransform(Vector2.One, campaignContainer.RectTransform, Anchor.BottomLeft), style: null);
|
||||
|
||||
var campaignSetupUI = new CampaignSetupUI(true, newCampaignContainer, loadCampaignContainer, submarines, saveFiles);
|
||||
var campaignSetupUI = new CampaignSetupUI(true, newCampaignContainer, loadCampaignContainer, saveFiles);
|
||||
|
||||
var newCampaignButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), buttonContainer.RectTransform),
|
||||
TextManager.Get("NewCampaign"))
|
||||
@@ -92,7 +92,8 @@ namespace Barotrauma
|
||||
if (endWatchman != null) { InitializeWatchman(endWatchman); }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
protected override void WatchmanInteract(Character watchman, Character interactor)
|
||||
{
|
||||
if ((watchman.Submarine == Level.Loaded.StartOutpost && !Submarine.MainSub.AtStartPosition) ||
|
||||
@@ -106,7 +107,8 @@ namespace Barotrauma
|
||||
return;
|
||||
}
|
||||
|
||||
if (GameMain.Client != null && interactor == Character.Controlled)
|
||||
if (GameMain.Client != null && interactor == Character.Controlled &&
|
||||
(GameMain.Client.HasPermission(ClientPermissions.ManageRound) || GameMain.Client.HasPermission(ClientPermissions.ManageCampaign)))
|
||||
{
|
||||
var msgBox = new GUIMessageBox("", TextManager.Get("CampaignEnterOutpostPrompt")
|
||||
.Replace("[locationname]", Submarine.MainSub.AtStartPosition ? Map.CurrentLocation.Name : Map.SelectedLocation.Name),
|
||||
@@ -120,7 +122,8 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
||||
msgBox.Buttons[1].OnClicked += msgBox.Close;
|
||||
msgBox.Buttons[1].OnClicked += msgBox.Close;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+21
-4
@@ -19,6 +19,8 @@ namespace Barotrauma.Tutorials
|
||||
private List<TutorialSegment> segments;
|
||||
|
||||
private SpriteSheetPlayer spriteSheetPlayer;
|
||||
private VideoPlayer videoPlayer;
|
||||
|
||||
private Steering navConsole;
|
||||
private Reactor reactor;
|
||||
private Sonar sonar;
|
||||
@@ -29,7 +31,7 @@ namespace Barotrauma.Tutorials
|
||||
|
||||
private bool started = false;
|
||||
private string playableContentPath;
|
||||
|
||||
|
||||
private float tutorialTimer;
|
||||
private float degrading2ActivationCountdown;
|
||||
|
||||
@@ -82,6 +84,7 @@ namespace Barotrauma.Tutorials
|
||||
|
||||
base.Initialize();
|
||||
spriteSheetPlayer = new SpriteSheetPlayer();
|
||||
videoPlayer = new VideoPlayer();
|
||||
characterTimeOnSonar = new List<Pair<Character, float>>();
|
||||
|
||||
for (int i = 0; i < segments.Count; i++)
|
||||
@@ -210,6 +213,8 @@ namespace Barotrauma.Tutorials
|
||||
started = ContentRunning = Initialized = false;
|
||||
spriteSheetPlayer.Remove();
|
||||
spriteSheetPlayer = null;
|
||||
videoPlayer.Remove();
|
||||
videoPlayer = null;
|
||||
characterTimeOnSonar = null;
|
||||
}
|
||||
|
||||
@@ -220,6 +225,10 @@ namespace Barotrauma.Tutorials
|
||||
{
|
||||
spriteSheetPlayer.AddToGUIUpdateList();
|
||||
}
|
||||
if (videoPlayer != null)
|
||||
{
|
||||
videoPlayer.AddToGUIUpdateList();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Update(float deltaTime)
|
||||
@@ -325,7 +334,7 @@ namespace Barotrauma.Tutorials
|
||||
|
||||
foreach (Item item in Item.ItemList)
|
||||
{
|
||||
if (!item.Repairables.Any() || item.ConditionPercentage > 50) continue;
|
||||
if (!item.Repairables.Any() || item.Condition > 50.0f) continue;
|
||||
degradedEquipmentFound = true;
|
||||
break;
|
||||
}
|
||||
@@ -461,10 +470,18 @@ namespace Barotrauma.Tutorials
|
||||
case ContentTypes.None:
|
||||
break;
|
||||
case ContentTypes.Video:
|
||||
spriteSheetPlayer.LoadContent(playableContentPath, activeSegment.Content, activeSegment.Name, true, true, CurrentSegmentStopCallback);
|
||||
string fileName = activeSegment.Content.GetAttributeString("file", "");
|
||||
if (fileName != "")
|
||||
{
|
||||
videoPlayer.LoadContent(playableContentPath + fileName, activeSegment.Content, activeSegment.Name, true, true, CurrentSegmentStopCallback);
|
||||
}
|
||||
else
|
||||
{
|
||||
spriteSheetPlayer.LoadContent(playableContentPath, activeSegment.Content, activeSegment.Name, true, true, CurrentSegmentStopCallback);
|
||||
}
|
||||
break;
|
||||
case ContentTypes.Text:
|
||||
infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Name), TextManager.GetFormatted(activeSegment.Content.GetAttributeString("tag", ""), false, args),
|
||||
infoBox = CreateInfoFrame(TextManager.Get(activeSegment.Name), TextManager.Get(activeSegment.Content.GetAttributeString("tag", ""), false, args),
|
||||
activeSegment.Content.GetAttributeInt("width", 300),
|
||||
activeSegment.Content.GetAttributeInt("height", 80),
|
||||
activeSegment.Content.GetAttributeString("anchor", "Center"), true, CurrentSegmentStopCallback);
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Barotrauma
|
||||
//if "%" is found
|
||||
if (index > 0)
|
||||
{
|
||||
while (index > 0)
|
||||
while (true)
|
||||
{
|
||||
//search for end of label
|
||||
index -= 1;
|
||||
@@ -439,6 +439,7 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
||||
var radioButtonFrame = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.6f), voiceSettings.RectTransform))
|
||||
{
|
||||
Stretch = true,
|
||||
@@ -457,24 +458,6 @@ namespace Barotrauma
|
||||
voiceMode.AddRadioButton((VoiceMode)i, tick);
|
||||
}
|
||||
|
||||
var micVolumeText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.18f), voiceSettings.RectTransform), TextManager.Get("MicrophoneVolume"));
|
||||
var micVolumeSlider = new GUIScrollBar(new RectTransform(new Vector2(1.0f, 0.18f), voiceSettings.RectTransform),
|
||||
barSize: 0.1f)
|
||||
{
|
||||
UserData = micVolumeText,
|
||||
BarScroll = (float)Math.Sqrt(MathUtils.InverseLerp(0.2f, 5.0f, MicrophoneVolume)),
|
||||
OnMoved = (scrollBar, scroll) =>
|
||||
{
|
||||
MicrophoneVolume = MathHelper.Lerp(0.2f, 5.0f, scroll * scroll);
|
||||
MicrophoneVolume = (float)Math.Round(MicrophoneVolume, 1);
|
||||
ChangeSliderText(scrollBar, MicrophoneVolume);
|
||||
scrollBar.Step = 0.05f;
|
||||
return true;
|
||||
},
|
||||
Step = 0.05f
|
||||
};
|
||||
micVolumeSlider.OnMoved(micVolumeSlider, micVolumeSlider.BarScroll);
|
||||
|
||||
var voiceInputContainer = new GUILayoutGroup(new RectTransform(new Vector2(0.5f, 0.2f), voiceSettings.RectTransform, Anchor.BottomCenter));
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.6f, 1.0f), voiceInputContainer.RectTransform), TextManager.Get("InputType.Voice") + ": ");
|
||||
var voiceKeyBox = new GUITextBox(new RectTransform(new Vector2(0.4f, 1.0f), voiceInputContainer.RectTransform, Anchor.TopRight),
|
||||
@@ -486,6 +469,7 @@ namespace Barotrauma
|
||||
voiceKeyBox.SelectedColor = Color.Gold * 0.3f;
|
||||
|
||||
var voiceActivityGroup = new GUILayoutGroup(new RectTransform(new Vector2(1.0f, 0.3f), voiceSettings.RectTransform));
|
||||
|
||||
GUITextBlock noiseGateText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.5f), voiceActivityGroup.RectTransform), TextManager.Get("NoiseGateThreshold"))
|
||||
{
|
||||
TextGetter = () =>
|
||||
@@ -525,13 +509,13 @@ namespace Barotrauma
|
||||
if (GameMain.Client == null && VoipCapture.Instance == null)
|
||||
{
|
||||
VoipCapture.Create(GameMain.Config.VoiceCaptureDevice);
|
||||
if (VoipCapture.Instance == null)
|
||||
{
|
||||
VoiceSetting = vMode = VoiceMode.Disabled;
|
||||
voiceInputContainer.Visible = false;
|
||||
voiceActivityGroup.Visible = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (VoipCapture.Instance == null)
|
||||
{
|
||||
VoiceSetting = vMode = VoiceMode.Disabled;
|
||||
voiceInputContainer.Visible = false;
|
||||
voiceActivityGroup.Visible = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch, bool editing)
|
||||
{
|
||||
Color color = item.SpriteColor;
|
||||
Color color = Color.White;
|
||||
if (brokenSprite == null)
|
||||
{
|
||||
//broken doors turn black if no broken sprite has been configured
|
||||
@@ -108,7 +108,7 @@ namespace Barotrauma.Items.Components
|
||||
weldSpritePos.Y = -weldSpritePos.Y;
|
||||
|
||||
weldedSprite.Draw(spriteBatch,
|
||||
weldSpritePos, item.SpriteColor * (stuck / 100.0f), scale: item.Scale);
|
||||
weldSpritePos, Color.White * (stuck / 100.0f), scale: item.Scale);
|
||||
}
|
||||
|
||||
if (openState == 1.0f)
|
||||
|
||||
@@ -313,7 +313,7 @@ namespace Barotrauma.Items.Components
|
||||
if (sound == null) { return 0.0f; }
|
||||
if (sound.VolumeProperty == "") { return sound.VolumeMultiplier; }
|
||||
|
||||
if (SerializableProperties.TryGetValue(sound.VolumeProperty, out SerializableProperty property))
|
||||
if (properties.TryGetValue(sound.VolumeProperty, out SerializableProperty property))
|
||||
{
|
||||
float newVolume = 0.0f;
|
||||
try
|
||||
|
||||
@@ -331,18 +331,8 @@ namespace Barotrauma.Items.Components
|
||||
spriteBatch.GraphicsDevice.ScissorRectangle = container.Rect;
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, rasterizerState: GameMain.ScissorTestEnable);
|
||||
|
||||
//make the pointer jitter a bit if it's at the upper limit of the fission rate
|
||||
float jitter = 0.0f;
|
||||
if (FissionRate > allowedFissionRate.Y - 5.0f)
|
||||
{
|
||||
float jitterAmount = Math.Min(targetFissionRate - allowedFissionRate.Y, 10.0f);
|
||||
float t = graphTimer / updateGraphInterval;
|
||||
|
||||
jitter = (PerlinNoise.GetPerlin(t * 0.5f, t * 0.1f) - 0.5f) * jitterAmount;
|
||||
}
|
||||
|
||||
DrawMeter(spriteBatch, container.Rect,
|
||||
fissionRateMeter, FissionRate + jitter, new Vector2(0.0f, 100.0f), optimalFissionRate, allowedFissionRate);
|
||||
fissionRateMeter, FissionRate, new Vector2(0.0f, 100.0f), optimalFissionRate, allowedFissionRate);
|
||||
|
||||
spriteBatch.End();
|
||||
spriteBatch.GraphicsDevice.ScissorRectangle = prevScissorRect;
|
||||
@@ -402,12 +392,12 @@ namespace Barotrauma.Items.Components
|
||||
Vector2 pos = new Vector2(rect.Center.X, rect.Y + meterSprite.Origin.Y * scale);
|
||||
|
||||
Vector2 optimalRangeNormalized = new Vector2(
|
||||
MathHelper.Clamp((optimalRange.X - range.X) / (range.Y - range.X), 0.0f, 0.95f),
|
||||
MathHelper.Clamp((optimalRange.Y - range.X) / (range.Y - range.X), 0.0f, 1.0f));
|
||||
(optimalRange.X - range.X) / (range.Y - range.X),
|
||||
(optimalRange.Y - range.X) / (range.Y - range.X));
|
||||
|
||||
Vector2 allowedRangeNormalized = new Vector2(
|
||||
MathHelper.Clamp((allowedRange.X - range.X) / (range.Y - range.X), 0.0f, 0.95f),
|
||||
MathHelper.Clamp((allowedRange.Y - range.X) / (range.Y - range.X), 0.0f, 1.0f));
|
||||
(allowedRange.X - range.X) / (range.Y - range.X),
|
||||
(allowedRange.Y - range.X) / (range.Y - range.X));
|
||||
|
||||
Vector2 sectorRad = new Vector2(-1.57f, 1.57f);
|
||||
|
||||
@@ -427,10 +417,10 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
spriteBatch.End();
|
||||
Rectangle prevScissorRect = spriteBatch.GraphicsDevice.ScissorRectangle;
|
||||
spriteBatch.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, GameMain.GraphicsWidth, (int)(pos.Y + (meterSprite.size.Y - meterSprite.Origin.Y) * scale) - 3);
|
||||
spriteBatch.GraphicsDevice.ScissorRectangle = new Rectangle(0,0,GameMain.GraphicsWidth, (int)(pos.Y + (meterSprite.size.Y - meterSprite.Origin.Y) * scale));
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, rasterizerState: GameMain.ScissorTestEnable);
|
||||
|
||||
sectorSprite.Draw(spriteBatch, pos, Color.LightGreen, MathHelper.PiOver2 + (allowedSectorRad.X + allowedSectorRad.Y) / 2.0f, scale);
|
||||
sectorSprite.Draw(spriteBatch, pos, Color.LightGreen, MathHelper.PiOver2, scale);
|
||||
|
||||
sectorSprite.Draw(spriteBatch, pos, Color.Orange, optimalSectorRad.X, scale);
|
||||
sectorSprite.Draw(spriteBatch, pos, Color.Red, allowedSectorRad.X, scale);
|
||||
|
||||
@@ -785,9 +785,8 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
foreach (Limb limb in c.AnimController.Limbs)
|
||||
{
|
||||
if (!limb.body.Enabled) { continue; }
|
||||
|
||||
float pointDist = ((limb.WorldPosition - pingSource) * displayScale).LengthSquared();
|
||||
|
||||
if (limb.SimPosition == Vector2.Zero || pointDist > DisplayRadius * DisplayRadius) continue;
|
||||
|
||||
if (pointDist > prevPingRadiusSqr && pointDist < pingRadiusSqr)
|
||||
|
||||
@@ -484,14 +484,26 @@ namespace Barotrauma.Items.Components
|
||||
user = Character.Controlled;
|
||||
}
|
||||
}
|
||||
if (!AutoPilot && Character.DisableControls && GUI.KeyboardDispatcher.Subscriber == null)
|
||||
if (!AutoPilot && Character.DisableControls)
|
||||
{
|
||||
steeringAdjustSpeed = character == null ? 0.2f : MathHelper.Lerp(0.2f, 1.0f, character.GetSkillLevel("helm") / 100.0f);
|
||||
Vector2 input = Vector2.Zero;
|
||||
if (PlayerInput.KeyDown(InputType.Left)) { input -= Vector2.UnitX; }
|
||||
if (PlayerInput.KeyDown(InputType.Right)) { input += Vector2.UnitX; }
|
||||
if (PlayerInput.KeyDown(InputType.Up)) { input += Vector2.UnitY; }
|
||||
if (PlayerInput.KeyDown(InputType.Down)) { input -= Vector2.UnitY; }
|
||||
if (PlayerInput.KeyDown(InputType.Left))
|
||||
{
|
||||
input -= Vector2.UnitX;
|
||||
}
|
||||
if (PlayerInput.KeyDown(InputType.Right))
|
||||
{
|
||||
input += Vector2.UnitX;
|
||||
}
|
||||
if (PlayerInput.KeyDown(InputType.Up))
|
||||
{
|
||||
input += Vector2.UnitY;
|
||||
}
|
||||
if (PlayerInput.KeyDown(InputType.Down))
|
||||
{
|
||||
input -= Vector2.UnitY;
|
||||
}
|
||||
if (PlayerInput.KeyDown(Keys.LeftShift))
|
||||
{
|
||||
SteeringInput += input * deltaTime * 200;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using Barotrauma.Networking;
|
||||
using Barotrauma.Particles;
|
||||
using Lidgren.Network;
|
||||
using Barotrauma.Particles;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System.Collections.Generic;
|
||||
@@ -114,7 +112,8 @@ namespace Barotrauma.Items.Components
|
||||
System.Diagnostics.Debug.Assert(GuiFrame.GetChild(0) is GUILayoutGroup, "Repair UI hierarchy has changed, could not find skill texts");
|
||||
foreach (GUIComponent c in GuiFrame.GetChild(0).Children)
|
||||
{
|
||||
if (!(c.UserData is Skill skill)) continue;
|
||||
Skill skill = c.UserData as Skill;
|
||||
if (skill == null) continue;
|
||||
|
||||
GUITextBlock textBlock = (GUITextBlock)c;
|
||||
if (character.GetSkillLevel(skill.Identifier) < skill.Level)
|
||||
@@ -127,15 +126,5 @@ namespace Barotrauma.Items.Components
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void ClientRead(ServerNetObject type, NetBuffer msg, float sendingTime)
|
||||
{
|
||||
deteriorationTimer = msg.ReadSingle();
|
||||
}
|
||||
|
||||
public void ClientWrite(NetBuffer msg, object[] extraData = null)
|
||||
{
|
||||
//no need to write anything, just letting the server know we started repairing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace Barotrauma.Items.Components
|
||||
Dictionary<AfflictionPrefab, float> combinedAfflictionStrengths = new Dictionary<AfflictionPrefab, float>();
|
||||
foreach (Affliction affliction in allAfflictions)
|
||||
{
|
||||
if (affliction.Strength < affliction.Prefab.ShowInHealthScannerThreshold || affliction.Strength <= 0.0f) continue;
|
||||
if (affliction.Strength < affliction.Prefab.ActivationThreshold || affliction.Strength <= 0.0f) continue;
|
||||
if (combinedAfflictionStrengths.ContainsKey(affliction.Prefab))
|
||||
{
|
||||
combinedAfflictionStrengths[affliction.Prefab] += affliction.Strength;
|
||||
|
||||
@@ -237,13 +237,13 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
railSprite?.Draw(spriteBatch,
|
||||
drawPos,
|
||||
item.SpriteColor,
|
||||
Color.White,
|
||||
rotation + MathHelper.PiOver2, item.Scale,
|
||||
SpriteEffects.None, item.SpriteDepth + (railSprite.Depth - item.Sprite.Depth));
|
||||
|
||||
barrelSprite?.Draw(spriteBatch,
|
||||
drawPos - new Vector2((float)Math.Cos(rotation), (float)Math.Sin(rotation)) * recoilOffset * item.Scale,
|
||||
item.SpriteColor,
|
||||
drawPos - new Vector2((float)Math.Cos(rotation), (float)Math.Sin(rotation)) * recoilOffset * item.Scale,
|
||||
Color.White,
|
||||
rotation + MathHelper.PiOver2, item.Scale,
|
||||
SpriteEffects.None, item.SpriteDepth + (barrelSprite.Depth - item.Sprite.Depth));
|
||||
|
||||
@@ -288,10 +288,7 @@ namespace Barotrauma.Items.Components
|
||||
availableAmmo.AddRange(itemContainer.Inventory.Items);
|
||||
}
|
||||
|
||||
float chargeRate =
|
||||
powerConsumption <= 0.0f ?
|
||||
1.0f :
|
||||
batteryCapacity > 0.0f ? batteryCharge / batteryCapacity : 0.0f;
|
||||
float chargeRate = powerConsumption <= 0.0f ? 1.0f : batteryCharge / batteryCapacity;
|
||||
bool charged = batteryCharge * 3600.0f > powerConsumption;
|
||||
bool readyToFire = reload <= 0.0f && charged && availableAmmo.Any(p => p != null);
|
||||
if (ShowChargeIndicator && PowerConsumption > 0.0f)
|
||||
|
||||
@@ -448,7 +448,7 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
public GUIComponent CreateEditingHUD(bool inGame = false)
|
||||
private GUIComponent CreateEditingHUD(bool inGame = false)
|
||||
{
|
||||
editingHUD = new GUIFrame(new RectTransform(new Vector2(0.3f, 0.25f), GUI.Canvas, Anchor.CenterRight) { MinSize = new Point(400, 0) }) { UserData = this };
|
||||
GUIListBox listBox = new GUIListBox(new RectTransform(new Vector2(0.95f, 0.8f), editingHUD.RectTransform, Anchor.Center), style: null)
|
||||
@@ -457,38 +457,40 @@ namespace Barotrauma
|
||||
};
|
||||
|
||||
var itemEditor = new SerializableEntityEditor(listBox.Content.RectTransform, this, inGame, showName: true);
|
||||
if (!inGame)
|
||||
|
||||
if (!inGame && Linkable)
|
||||
{
|
||||
if (Linkable)
|
||||
var linkText = new GUITextBlock(new RectTransform(new Point(editingHUD.Rect.Width, 20)), TextManager.Get("HoldToLink"), font: GUI.SmallFont);
|
||||
var itemsText = new GUITextBlock(new RectTransform(new Point(editingHUD.Rect.Width, 20)), TextManager.Get("AllowedLinks") + ": ", font: GUI.SmallFont);
|
||||
if (AllowedLinks.None())
|
||||
{
|
||||
var linkText = new GUITextBlock(new RectTransform(new Point(editingHUD.Rect.Width, 20)), TextManager.Get("HoldToLink"), font: GUI.SmallFont);
|
||||
var itemsText = new GUITextBlock(new RectTransform(new Point(editingHUD.Rect.Width, 20)), TextManager.Get("AllowedLinks") + ": ", font: GUI.SmallFont);
|
||||
if (AllowedLinks.None())
|
||||
itemsText.Text += TextManager.Get("None");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < AllowedLinks.Count; i++)
|
||||
{
|
||||
itemsText.Text += TextManager.Get("None");
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < AllowedLinks.Count; i++)
|
||||
itemsText.Text += AllowedLinks[i];
|
||||
if (i < AllowedLinks.Count - 1)
|
||||
{
|
||||
itemsText.Text += AllowedLinks[i];
|
||||
if (i < AllowedLinks.Count - 1)
|
||||
{
|
||||
itemsText.Text += ", ";
|
||||
}
|
||||
itemsText.Text += ", ";
|
||||
}
|
||||
}
|
||||
itemEditor.AddCustomContent(linkText, 1);
|
||||
itemEditor.AddCustomContent(itemsText, 2);
|
||||
linkText.TextColor = Color.Yellow;
|
||||
itemsText.TextColor = Color.Yellow;
|
||||
}
|
||||
itemEditor.AddCustomContent(linkText, 1);
|
||||
itemEditor.AddCustomContent(itemsText, 2);
|
||||
linkText.TextColor = Color.Yellow;
|
||||
itemsText.TextColor = Color.Yellow;
|
||||
}
|
||||
|
||||
if (!inGame)
|
||||
{
|
||||
var buttonContainer = new GUILayoutGroup(new RectTransform(new Point(listBox.Content.Rect.Width, 20)), isHorizontal: true)
|
||||
{
|
||||
Stretch = true,
|
||||
RelativeSpacing = 0.02f
|
||||
};
|
||||
new GUIButton(new RectTransform(new Vector2(0.23f, 1.0f), buttonContainer.RectTransform), TextManager.Get("MirrorEntityX"))
|
||||
new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), buttonContainer.RectTransform), TextManager.Get("MirrorEntityX"))
|
||||
{
|
||||
ToolTip = TextManager.Get("MirrorEntityXToolTip"),
|
||||
OnClicked = (button, data) =>
|
||||
@@ -497,7 +499,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
};
|
||||
new GUIButton(new RectTransform(new Vector2(0.23f, 1.0f), buttonContainer.RectTransform), TextManager.Get("MirrorEntityY"))
|
||||
new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), buttonContainer.RectTransform), TextManager.Get("MirrorEntityY"))
|
||||
{
|
||||
ToolTip = TextManager.Get("MirrorEntityYToolTip"),
|
||||
OnClicked = (button, data) =>
|
||||
@@ -508,7 +510,7 @@ namespace Barotrauma
|
||||
};
|
||||
if (Sprite != null)
|
||||
{
|
||||
var reloadTextureButton = new GUIButton(new RectTransform(new Vector2(0.23f, 1.0f), buttonContainer.RectTransform), TextManager.Get("ReloadSprite"));
|
||||
var reloadTextureButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), buttonContainer.RectTransform), TextManager.Get("ReloadSprite"));
|
||||
reloadTextureButton.OnClicked += (button, data) =>
|
||||
{
|
||||
Sprite.ReloadXML();
|
||||
@@ -516,15 +518,6 @@ namespace Barotrauma
|
||||
return true;
|
||||
};
|
||||
}
|
||||
new GUIButton(new RectTransform(new Vector2(0.23f, 1.0f), buttonContainer.RectTransform), TextManager.Get("ResetToPrefab"))
|
||||
{
|
||||
OnClicked = (button, data) =>
|
||||
{
|
||||
Reset();
|
||||
CreateEditingHUD();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
itemEditor.AddCustomContent(buttonContainer, itemEditor.ContentCount);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
using Barotrauma.Networking;
|
||||
using Barotrauma.Particles;
|
||||
using Barotrauma.Sounds;
|
||||
using Lidgren.Network;
|
||||
using Microsoft.Xna.Framework;
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Xna.Framework.Input;
|
||||
using System.Linq;
|
||||
using Lidgren.Network;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -18,8 +19,6 @@ namespace Barotrauma
|
||||
private List<Decal> decals = new List<Decal>();
|
||||
|
||||
private float serverUpdateDelay;
|
||||
private float remoteWaterVolume, remoteOxygenPercentage;
|
||||
private List<Vector3> remoteFireSources;
|
||||
|
||||
private bool networkUpdatePending;
|
||||
private float networkUpdateTimer;
|
||||
@@ -140,10 +139,6 @@ namespace Barotrauma
|
||||
partial void UpdateProjSpecific(float deltaTime, Camera cam)
|
||||
{
|
||||
serverUpdateDelay -= deltaTime;
|
||||
if (serverUpdateDelay <= 0.0f)
|
||||
{
|
||||
ApplyRemoteState();
|
||||
}
|
||||
|
||||
if (networkUpdatePending)
|
||||
{
|
||||
@@ -552,18 +547,18 @@ namespace Barotrauma
|
||||
|
||||
public void ClientRead(ServerNetObject type, NetBuffer message, float sendingTime)
|
||||
{
|
||||
remoteWaterVolume = message.ReadRangedSingle(0.0f, 1.5f, 8) * Volume;
|
||||
remoteOxygenPercentage = message.ReadRangedSingle(0.0f, 100.0f, 8);
|
||||
float newWaterVolume = message.ReadRangedSingle(0.0f, 1.5f, 8) * Volume;
|
||||
float newOxygenPercentage = message.ReadRangedSingle(0.0f, 100.0f, 8);
|
||||
|
||||
bool hasFireSources = message.ReadBoolean();
|
||||
int fireSourceCount = 0;
|
||||
remoteFireSources = new List<Vector3>();
|
||||
List<Vector3> newFireSources = new List<Vector3>();
|
||||
if (hasFireSources)
|
||||
{
|
||||
fireSourceCount = message.ReadRangedInteger(0, 16);
|
||||
for (int i = 0; i < fireSourceCount; i++)
|
||||
{
|
||||
remoteFireSources.Add(new Vector3(
|
||||
newFireSources.Add(new Vector3(
|
||||
MathHelper.Clamp(message.ReadRangedSingle(0.0f, 1.0f, 8), 0.05f, 0.95f),
|
||||
MathHelper.Clamp(message.ReadRangedSingle(0.0f, 1.0f, 8), 0.05f, 0.95f),
|
||||
message.ReadRangedSingle(0.0f, 1.0f, 8)));
|
||||
@@ -572,6 +567,41 @@ namespace Barotrauma
|
||||
|
||||
if (serverUpdateDelay > 0.0f) { return; }
|
||||
|
||||
WaterVolume = newWaterVolume;
|
||||
OxygenPercentage = newOxygenPercentage;
|
||||
|
||||
for (int i = 0; i < fireSourceCount; i++)
|
||||
{
|
||||
Vector2 pos = new Vector2(
|
||||
rect.X + rect.Width * newFireSources[i].X,
|
||||
rect.Y - rect.Height + (rect.Height * newFireSources[i].Y));
|
||||
float size = newFireSources[i].Z * rect.Width;
|
||||
|
||||
var newFire = i < FireSources.Count ?
|
||||
FireSources[i] :
|
||||
new FireSource(Submarine == null ? pos : pos + Submarine.Position, null, true);
|
||||
newFire.Position = pos;
|
||||
newFire.Size = new Vector2(size, newFire.Size.Y);
|
||||
|
||||
//ignore if the fire wasn't added to this room (invalid position)?
|
||||
if (!FireSources.Contains(newFire))
|
||||
{
|
||||
newFire.Remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = FireSources.Count - 1; i >= fireSourceCount; i--)
|
||||
{
|
||||
FireSources[i].Remove();
|
||||
if (i < FireSources.Count)
|
||||
{
|
||||
FireSources.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
if (serverUpdateDelay > 0.0f) { return; }
|
||||
|
||||
ApplyRemoteState();
|
||||
}
|
||||
|
||||
|
||||
@@ -404,15 +404,12 @@ namespace Barotrauma.Lights
|
||||
}
|
||||
}
|
||||
if (highlightedEntities.Count == 0) { return false; }
|
||||
|
||||
//draw characters in light blue first
|
||||
|
||||
//draw characters in solid white first
|
||||
graphics.SetRenderTarget(HighlightMap);
|
||||
SolidColorEffect.CurrentTechnique = SolidColorEffect.Techniques["SolidColor"];
|
||||
SolidColorEffect.Parameters["color"].SetValue(Color.LightBlue.ToVector4());
|
||||
SolidColorEffect.CurrentTechnique.Passes[0].Apply();
|
||||
DeformableSprite.Effect.CurrentTechnique = DeformableSprite.Effect.Techniques["DeformShaderSolidColor"];
|
||||
DeformableSprite.Effect.Parameters["solidColor"].SetValue(Color.LightBlue.ToVector4());
|
||||
DeformableSprite.Effect.CurrentTechnique.Passes[0].Apply();
|
||||
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, samplerState: SamplerState.LinearWrap, effect: SolidColorEffect, transformMatrix: spriteBatchTransform);
|
||||
foreach (Entity highlighted in highlightedEntities)
|
||||
{
|
||||
@@ -429,12 +426,9 @@ namespace Barotrauma.Lights
|
||||
|
||||
//draw characters in black with a bit of blur, leaving the white edges visible
|
||||
float phase = (float)(Math.Sin(Timing.TotalTime * 3.0f) + 1.0f) / 2.0f; //phase oscillates between 0 and 1
|
||||
Vector4 overlayColor = Color.Black.ToVector4() * MathHelper.Lerp(0.5f, 0.9f, phase);
|
||||
SolidColorEffect.Parameters["color"].SetValue(overlayColor);
|
||||
SolidColorEffect.Parameters["color"].SetValue(Color.Black.ToVector4() * MathHelper.Lerp(0.5f, 0.9f, phase));
|
||||
SolidColorEffect.CurrentTechnique = SolidColorEffect.Techniques["SolidColorBlur"];
|
||||
SolidColorEffect.CurrentTechnique.Passes[0].Apply();
|
||||
DeformableSprite.Effect.Parameters["solidColor"].SetValue(overlayColor);
|
||||
DeformableSprite.Effect.CurrentTechnique.Passes[0].Apply();
|
||||
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, samplerState: SamplerState.LinearWrap, effect: SolidColorEffect, transformMatrix: spriteBatchTransform);
|
||||
foreach (Entity highlighted in highlightedEntities)
|
||||
{
|
||||
@@ -456,8 +450,6 @@ namespace Barotrauma.Lights
|
||||
spriteBatch.Draw(highlightRaster, new Rectangle(0, 0, HighlightMap.Width, HighlightMap.Height), new Rectangle(0, 0, HighlightMap.Width, HighlightMap.Height), Color.White * 0.5f);
|
||||
spriteBatch.End();
|
||||
|
||||
DeformableSprite.Effect.CurrentTechnique = DeformableSprite.Effect.Techniques["DeformShader"];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -479,10 +471,6 @@ namespace Barotrauma.Lights
|
||||
|
||||
Level.Loaded?.Renderer?.RenderWalls(graphics, cam, specular: true);
|
||||
|
||||
DeformableSprite.Effect.CurrentTechnique = DeformableSprite.Effect.Techniques["DeformShaderSolidColor"];
|
||||
DeformableSprite.Effect.Parameters["solidColor"].SetValue(Color.Gray.ToVector4());
|
||||
DeformableSprite.Effect.CurrentTechnique.Passes[0].Apply();
|
||||
|
||||
//obstruct specular maps behind the sub and characters by drawing them on the map in solid gray
|
||||
SolidColorEffect.CurrentTechnique = SolidColorEffect.Techniques["SolidColor"];
|
||||
SolidColorEffect.Parameters["color"].SetValue(Color.Gray.ToVector4());
|
||||
@@ -499,9 +487,6 @@ namespace Barotrauma.Lights
|
||||
}
|
||||
spriteBatch.End();
|
||||
|
||||
|
||||
DeformableSprite.Effect.CurrentTechnique = DeformableSprite.Effect.Techniques["DeformShader"];
|
||||
|
||||
graphics.SetRenderTarget(null);
|
||||
graphics.BlendState = BlendState.AlphaBlend;
|
||||
}
|
||||
|
||||
@@ -364,23 +364,15 @@ namespace Barotrauma
|
||||
}
|
||||
}
|
||||
|
||||
if (GUI.KeyboardDispatcher.Subscriber == null)
|
||||
{
|
||||
float moveSpeed = 1000.0f;
|
||||
Vector2 moveAmount = Vector2.Zero;
|
||||
if (PlayerInput.KeyDown(InputType.Left)) { moveAmount += Vector2.UnitX; }
|
||||
if (PlayerInput.KeyDown(InputType.Right)) { moveAmount -= Vector2.UnitX; }
|
||||
if (PlayerInput.KeyDown(InputType.Up)) { moveAmount += Vector2.UnitY; }
|
||||
if (PlayerInput.KeyDown(InputType.Down)) { moveAmount -= Vector2.UnitY; }
|
||||
drawOffset += moveAmount * moveSpeed / zoom * deltaTime;
|
||||
}
|
||||
|
||||
if (GUI.MouseOn == mapContainer)
|
||||
{
|
||||
zoom += PlayerInput.ScrollWheelSpeed / 1000.0f;
|
||||
zoom = MathHelper.Clamp(zoom, 1.0f, 4.0f);
|
||||
|
||||
if (PlayerInput.MidButtonHeld()) { drawOffset += PlayerInput.MouseSpeed / zoom; }
|
||||
if (PlayerInput.MidButtonHeld())
|
||||
{
|
||||
drawOffset += PlayerInput.MouseSpeed / zoom;
|
||||
}
|
||||
#if DEBUG
|
||||
if (PlayerInput.DoubleClicked() && highlightedLocation != null)
|
||||
{
|
||||
@@ -559,6 +551,11 @@ namespace Barotrauma
|
||||
null, connectionColor * MathHelper.Clamp(a, 0.1f, 0.5f), MathUtils.VectorToAngle(end - start),
|
||||
new Vector2(0, 16), SpriteEffects.None, 0.01f);
|
||||
}
|
||||
}
|
||||
|
||||
rect.Inflate(8, 8);
|
||||
GUI.DrawRectangle(spriteBatch, rect, Color.Black, false, 0.0f, 8);
|
||||
GUI.DrawRectangle(spriteBatch, rect, Color.LightGray);
|
||||
|
||||
if (GameMain.DebugDraw && zoom > 1.0f && generationParams.ShowLevelTypeNames)
|
||||
{
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace Barotrauma
|
||||
Stretch = true,
|
||||
RelativeSpacing = 0.02f
|
||||
};
|
||||
new GUIButton(new RectTransform(new Vector2(0.23f, 1.0f), buttonContainer.RectTransform), TextManager.Get("MirrorEntityX"))
|
||||
new GUIButton(new RectTransform(new Vector2(0.25f, 1.0f), buttonContainer.RectTransform), TextManager.Get("MirrorEntityX"))
|
||||
{
|
||||
ToolTip = TextManager.Get("MirrorEntityXToolTip"),
|
||||
OnClicked = (button, data) =>
|
||||
@@ -107,7 +107,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
};
|
||||
new GUIButton(new RectTransform(new Vector2(0.23f, 1.0f), buttonContainer.RectTransform), TextManager.Get("MirrorEntityY"))
|
||||
new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), buttonContainer.RectTransform), TextManager.Get("MirrorEntityY"))
|
||||
{
|
||||
ToolTip = TextManager.Get("MirrorEntityYToolTip"),
|
||||
OnClicked = (button, data) =>
|
||||
@@ -116,7 +116,7 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
};
|
||||
var reloadTextureButton = new GUIButton(new RectTransform(new Vector2(0.23f, 1.0f), buttonContainer.RectTransform), TextManager.Get("ReloadSprite"))
|
||||
var reloadTextureButton = new GUIButton(new RectTransform(new Vector2(0.3f, 1.0f), buttonContainer.RectTransform), TextManager.Get("ReloadSprite"))
|
||||
{
|
||||
OnClicked = (button, data) =>
|
||||
{
|
||||
@@ -125,15 +125,6 @@ namespace Barotrauma
|
||||
return true;
|
||||
}
|
||||
};
|
||||
new GUIButton(new RectTransform(new Vector2(0.23f, 1.0f), buttonContainer.RectTransform), TextManager.Get("ResetToPrefab"))
|
||||
{
|
||||
OnClicked = (button, data) =>
|
||||
{
|
||||
Reset();
|
||||
CreateEditingHUD();
|
||||
return true;
|
||||
}
|
||||
};
|
||||
editor.AddCustomContent(buttonContainer, editor.ContentCount);
|
||||
|
||||
PositionEditingHUD();
|
||||
@@ -292,7 +283,8 @@ namespace Barotrauma
|
||||
{
|
||||
if (damageEffect != null)
|
||||
{
|
||||
float newCutoff = MathHelper.Lerp(0.0f, 0.65f, Sections[i].damage / Prefab.Health);
|
||||
float newCutoff = Sections[i].damage > 0 ?
|
||||
MathHelper.Lerp(0.2f, 0.65f, Sections[i].damage / Prefab.Health) : 0.0f;
|
||||
|
||||
if (Math.Abs(newCutoff - Submarine.DamageEffectCutoff) > 0.01f || color != Submarine.DamageEffectColor)
|
||||
{
|
||||
@@ -359,7 +351,6 @@ namespace Barotrauma
|
||||
-Bodies[i].Rotation, Color.White);
|
||||
}
|
||||
}
|
||||
AiTarget?.Draw(spriteBatch);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,6 @@ namespace Barotrauma.Networking
|
||||
var buttonContainer = new GUILayoutGroup(HUDLayoutSettings.ToRectTransform(HUDLayoutSettings.ButtonAreaTop, inGameHUD.RectTransform),
|
||||
isHorizontal: true, childAnchor: Anchor.CenterRight)
|
||||
{
|
||||
AbsoluteSpacing = 5,
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
@@ -141,32 +140,16 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
OnClicked = (btn, userdata) =>
|
||||
{
|
||||
if (!permissions.HasFlag(ClientPermissions.ManageRound)) { return false; }
|
||||
if (!Submarine.MainSub.AtStartPosition && !Submarine.MainSub.AtEndPosition)
|
||||
{
|
||||
var msgBox = new GUIMessageBox("", TextManager.Get("EndRoundSubNotAtLevelEnd"),
|
||||
new string[] { TextManager.Get("Yes"), TextManager.Get("No") });
|
||||
msgBox.Buttons[0].OnClicked = (_, __) =>
|
||||
{
|
||||
GameMain.Client.RequestRoundEnd();
|
||||
return true;
|
||||
};
|
||||
msgBox.Buttons[0].OnClicked += msgBox.Close;
|
||||
msgBox.Buttons[1].OnClicked += msgBox.Close;
|
||||
}
|
||||
else
|
||||
{
|
||||
RequestRoundEnd();
|
||||
}
|
||||
if (!permissions.HasFlag(ClientPermissions.ManageRound)) return false;
|
||||
RequestRoundEnd();
|
||||
return true;
|
||||
},
|
||||
Visible = false
|
||||
};
|
||||
|
||||
EndVoteTickBox = new GUITickBox(new RectTransform(new Vector2(0.1f, 0.4f), buttonContainer.RectTransform) { MinSize = new Point(150, 0) },
|
||||
EndVoteTickBox = new GUITickBox(new RectTransform(new Vector2(0.1f, 0.6f), buttonContainer.RectTransform) { MinSize = new Point(150, 0) },
|
||||
TextManager.Get("EndRound"))
|
||||
{
|
||||
UserData = TextManager.Get("EndRound"),
|
||||
OnSelected = ToggleEndRoundVote,
|
||||
Visible = false
|
||||
};
|
||||
@@ -340,17 +323,18 @@ namespace Barotrauma.Networking
|
||||
|
||||
// Loop until we are approved
|
||||
//TODO: show the name of the server instead of IP when connecting through the server list (more streamer-friendly)
|
||||
string connectingText = TextManager.Get("Connecting");
|
||||
string connectingText = TextManager.Get("ConnectingTo").Replace("[serverip]", serverIP);
|
||||
while (!CanStart && !connectCancelled)
|
||||
{
|
||||
if (reconnectBox == null)
|
||||
{
|
||||
reconnectBox = new GUIMessageBox(connectingText, TextManager.Get("ConnectingTo").Replace("[serverip]", serverIP), new string[] { TextManager.Get("Cancel") });
|
||||
reconnectBox = new GUIMessageBox(TextManager.Get("Connecting"), connectingText, new string[] { TextManager.Get("Cancel") });
|
||||
|
||||
reconnectBox.Buttons[0].OnClicked += CancelConnect;
|
||||
reconnectBox.Buttons[0].OnClicked += reconnectBox.Close;
|
||||
}
|
||||
|
||||
reconnectBox.Header.Text = connectingText + new string('.', ((int)Timing.TotalTime % 3 + 1));
|
||||
reconnectBox.Text.Text = connectingText + new string('.', ((int)Timing.TotalTime % 3 + 1));
|
||||
|
||||
if (DateTime.Now > reqAuthTime)
|
||||
{
|
||||
@@ -637,7 +621,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (gameStarted) SetRadioButtonColor();
|
||||
|
||||
if (ShowNetStats && client?.ServerConnection != null)
|
||||
if (ShowNetStats)
|
||||
{
|
||||
netStats.AddValue(NetStats.NetStatType.ReceivedBytes, client.ServerConnection.Statistics.ReceivedBytes);
|
||||
netStats.AddValue(NetStats.NetStatType.SentBytes, client.ServerConnection.Statistics.SentBytes);
|
||||
@@ -798,7 +782,7 @@ namespace Barotrauma.Networking
|
||||
saveFiles.Add(inc.ReadString());
|
||||
}
|
||||
|
||||
GameMain.NetLobbyScreen.CampaignSetupUI = MultiPlayerCampaign.StartCampaignSetup(serverSubmarines, saveFiles);
|
||||
GameMain.NetLobbyScreen.CampaignSetupUI = MultiPlayerCampaign.StartCampaignSetup(saveFiles);
|
||||
break;
|
||||
case ServerPacketHeader.PERMISSIONS:
|
||||
ReadPermissions(inc);
|
||||
@@ -851,8 +835,6 @@ namespace Barotrauma.Networking
|
||||
DisconnectReason disconnectReason = DisconnectReason.Unknown;
|
||||
if (splitMsg.Length > 0) Enum.TryParse(splitMsg[0], out disconnectReason);
|
||||
|
||||
DebugConsole.NewMessage("Received a disconnect message (" + disconnectMsg + ")");
|
||||
|
||||
if (disconnectReason == DisconnectReason.ServerFull)
|
||||
{
|
||||
//already waiting for a slot to free up, do nothing
|
||||
@@ -882,6 +864,14 @@ namespace Barotrauma.Networking
|
||||
waitInServerQueueBox = null;
|
||||
CoroutineManager.StopCoroutines("WaitInServerQueue");
|
||||
}
|
||||
else
|
||||
{
|
||||
//disconnected/denied for some other reason than the server being full
|
||||
// -> stop queuing and show a message box
|
||||
waitInServerQueueBox?.Close();
|
||||
waitInServerQueueBox = null;
|
||||
CoroutineManager.StopCoroutines("WaitInServerQueue");
|
||||
}
|
||||
|
||||
if (allowReconnect && disconnectReason == DisconnectReason.Unknown)
|
||||
{
|
||||
@@ -911,6 +901,25 @@ namespace Barotrauma.Networking
|
||||
DebugConsole.NewMessage("Do not attempt to reconnect (DisconnectReason doesn't allow reconnection).");
|
||||
msg = TextManager.Get("DisconnectReason." + disconnectReason.ToString());
|
||||
|
||||
if (allowReconnect && disconnectReason == DisconnectReason.Unknown)
|
||||
{
|
||||
reconnectBox = new GUIMessageBox(
|
||||
TextManager.Get("ConnectionLost"),
|
||||
TextManager.Get("ConnectionLostReconnecting"), new string[0]);
|
||||
connected = false;
|
||||
ConnectToServer(serverIP);
|
||||
}
|
||||
else
|
||||
{
|
||||
string msg = "";
|
||||
if (disconnectReason == DisconnectReason.Unknown)
|
||||
{
|
||||
msg = disconnectMsg;
|
||||
}
|
||||
else
|
||||
{
|
||||
msg = TextManager.Get("DisconnectReason." + disconnectReason.ToString());
|
||||
|
||||
for (int i = 1; i < splitMsg.Length; i++)
|
||||
{
|
||||
msg += TextManager.GetServerMessage(splitMsg[i]);
|
||||
@@ -1048,10 +1057,9 @@ namespace Barotrauma.Networking
|
||||
|
||||
EndVoteTickBox.Selected = false;
|
||||
|
||||
int seed = inc.ReadInt32();
|
||||
string levelSeed = inc.ReadString();
|
||||
int levelEqualityCheckVal = inc.ReadInt32();
|
||||
float levelDifficulty = inc.ReadFloat();
|
||||
int seed = inc.ReadInt32();
|
||||
string levelSeed = inc.ReadString();
|
||||
float levelDifficulty = inc.ReadFloat();
|
||||
|
||||
byte losMode = inc.ReadByte();
|
||||
|
||||
@@ -1120,15 +1128,6 @@ namespace Barotrauma.Networking
|
||||
mirrorLevel: campaign.Map.CurrentLocation != campaign.Map.SelectedConnection.Locations[0]);
|
||||
}
|
||||
|
||||
if (Level.Loaded.EqualityCheckVal != levelEqualityCheckVal)
|
||||
{
|
||||
string errorMsg = "Level equality check failed. The level generated at your end doesn't match the level generated by the server (seed " + Level.Loaded.Seed + ").";
|
||||
DebugConsole.ThrowError(errorMsg, createMessageBox: true);
|
||||
GameAnalyticsManager.AddErrorEventOnce("GameClient.StartGame:LevelsDontMatch" + levelSeed, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
CoroutineManager.StartCoroutine(EndGame(""));
|
||||
yield return CoroutineStatus.Failure;
|
||||
}
|
||||
|
||||
if (respawnAllowed) respawnManager = new RespawnManager(this, GameMain.NetLobbyScreen.UsingShuttle ? GameMain.NetLobbyScreen.SelectedShuttle : null);
|
||||
|
||||
gameStarted = true;
|
||||
@@ -1198,8 +1197,8 @@ namespace Barotrauma.Networking
|
||||
}
|
||||
}
|
||||
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.SubList, serverSubmarines);
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.ShuttleList.ListBox, serverSubmarines);
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.SubList, submarines);
|
||||
GameMain.NetLobbyScreen.UpdateSubList(GameMain.NetLobbyScreen.ShuttleList.ListBox, submarines);
|
||||
|
||||
gameStarted = inc.ReadBoolean();
|
||||
bool allowSpectating = inc.ReadBoolean();
|
||||
@@ -1392,6 +1391,9 @@ namespace Barotrauma.Networking
|
||||
case ServerNetObject.CLIENT_LIST:
|
||||
ReadClientList(inc);
|
||||
break;
|
||||
case ServerNetObject.CLIENT_LIST:
|
||||
ReadClientList(inc);
|
||||
break;
|
||||
case ServerNetObject.CHAT_MESSAGE:
|
||||
ChatMessage.ClientRead(inc);
|
||||
break;
|
||||
@@ -1715,8 +1717,6 @@ namespace Barotrauma.Networking
|
||||
|
||||
SaveUtil.LoadGame(GameMain.GameSession.SavePath, GameMain.GameSession);
|
||||
campaign.LastSaveID = campaign.PendingSaveID;
|
||||
|
||||
DebugConsole.Log("Campaign save received, save ID " + campaign.LastSaveID);
|
||||
//decrement campaign update ID so the server will send us the latest data
|
||||
//(as there may have been campaign updates after the save file was created)
|
||||
campaign.LastUpdateID--;
|
||||
@@ -1734,7 +1734,7 @@ namespace Barotrauma.Networking
|
||||
|
||||
public override void CreateEntityEvent(INetSerializable entity, object[] extraData)
|
||||
{
|
||||
if (!(entity is IClientSerializable)) throw new InvalidCastException("Entity is not IClientSerializable");
|
||||
if (!(entity is IClientSerializable)) throw new InvalidCastException("entity is not IClientSerializable");
|
||||
entityEventManager.CreateEvent(entity as IClientSerializable, extraData);
|
||||
}
|
||||
|
||||
@@ -2003,8 +2003,7 @@ namespace Barotrauma.Networking
|
||||
msg.Write(true); msg.WritePadBits();
|
||||
msg.Write(savePath);
|
||||
msg.Write(mapSeed);
|
||||
msg.Write(sub.Name);
|
||||
msg.Write(sub.MD5Hash.Hash);
|
||||
msg.Write(sub.FilePath);
|
||||
|
||||
client.SendMessage(msg, NetDeliveryMethod.ReliableUnordered);
|
||||
|
||||
@@ -2242,25 +2241,13 @@ namespace Barotrauma.Networking
|
||||
|
||||
if (EndVoteCount > 0)
|
||||
{
|
||||
if (EndVoteTickBox.Visible)
|
||||
{
|
||||
EndVoteTickBox.Text =
|
||||
(EndVoteTickBox.UserData as string) + " " + EndVoteCount + "/" + EndVoteMax;
|
||||
}
|
||||
else
|
||||
{
|
||||
string endVoteText = TextManager.Get("EndRoundVotes")
|
||||
.Replace("[votes]", EndVoteCount.ToString())
|
||||
.Replace("[max]", EndVoteMax.ToString());
|
||||
GUI.DrawString(spriteBatch, EndVoteTickBox.Rect.Center.ToVector2() - GUI.SmallFont.MeasureString(endVoteText) / 2,
|
||||
endVoteText,
|
||||
Color.White,
|
||||
font: GUI.SmallFont);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EndVoteTickBox.Text = EndVoteTickBox.UserData as string;
|
||||
string endVoteText = TextManager.Get("EndRoundVotes")
|
||||
.Replace("[y]", EndVoteCount.ToString())
|
||||
.Replace("[n]", (EndVoteMax - EndVoteCount).ToString());
|
||||
GUI.DrawString(spriteBatch, new Vector2(GameMain.GraphicsWidth - 10.0f - GUI.SmallFont.MeasureString(endVoteText).X, 40),
|
||||
endVoteText,
|
||||
Color.White,
|
||||
font: GUI.SmallFont);
|
||||
}
|
||||
|
||||
if (respawnManager != null)
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using Lidgren.Network;
|
||||
using Microsoft.Xna.Framework;
|
||||
using OpenTK.Audio.OpenAL;
|
||||
using System;
|
||||
using System.Linq;
|
||||
@@ -27,11 +26,6 @@ namespace Barotrauma.Networking
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public float Gain
|
||||
{
|
||||
get { return GameMain.Config?.MicrophoneVolume ?? 1.0f; }
|
||||
}
|
||||
|
||||
public DateTime LastEnqueueAudio;
|
||||
|
||||
@@ -75,7 +69,6 @@ namespace Barotrauma.Networking
|
||||
{
|
||||
if (!GUIMessageBox.MessageBoxes.Any(mb => mb.UserData as string == "capturedevicenotfound"))
|
||||
{
|
||||
GUI.SettingsMenuOpen = false;
|
||||
new GUIMessageBox(TextManager.Get("Error"), TextManager.Get("VoipCaptureDeviceNotFound"))
|
||||
{
|
||||
UserData = "capturedevicenotfound"
|
||||
@@ -167,9 +160,8 @@ namespace Barotrauma.Networking
|
||||
double maxAmplitude = 0.0f;
|
||||
for (int i = 0; i < VoipConfig.BUFFER_SIZE; i++)
|
||||
{
|
||||
uncompressedBuffer[i] = (short)MathHelper.Clamp((uncompressedBuffer[i] * Gain), -short.MaxValue, short.MaxValue);
|
||||
double sampleVal = uncompressedBuffer[i] / (double)short.MaxValue;
|
||||
maxAmplitude = Math.Max(maxAmplitude, Math.Abs(sampleVal));
|
||||
double sampleVal = (double)uncompressedBuffer[i] / (double)short.MaxValue;
|
||||
maxAmplitude = Math.Max(maxAmplitude, Math.Abs(sampleVal));
|
||||
}
|
||||
double dB = Math.Min(20 * Math.Log10(maxAmplitude), 0.0);
|
||||
|
||||
|
||||
@@ -150,10 +150,10 @@ namespace Barotrauma
|
||||
float MaxAngularVel = NetConfig.MaxPhysicsBodyAngularVelocity;
|
||||
|
||||
Vector2 newPosition = SimPosition;
|
||||
float? newRotation = null;
|
||||
float newRotation = Rotation;
|
||||
bool awake = body.Awake;
|
||||
Vector2 newVelocity = LinearVelocity;
|
||||
float? newAngularVelocity = null;
|
||||
float newAngularVelocity = AngularVelocity;
|
||||
|
||||
newPosition = new Vector2(
|
||||
msg.ReadFloat(),
|
||||
@@ -179,12 +179,12 @@ namespace Barotrauma
|
||||
msg.ReadPadBits();
|
||||
|
||||
if (!MathUtils.IsValid(newPosition) ||
|
||||
!MathUtils.IsValid(newRotation) ||
|
||||
!MathUtils.IsValid(newVelocity) ||
|
||||
(newRotation.HasValue && !MathUtils.IsValid(newRotation.Value)) ||
|
||||
(newAngularVelocity.HasValue && !MathUtils.IsValid(newAngularVelocity.Value)))
|
||||
!MathUtils.IsValid(newAngularVelocity))
|
||||
{
|
||||
string errorMsg = "Received invalid position data for \"" + parentDebugName
|
||||
+ "\" (position: " + newPosition + ", rotation: " + (newRotation ?? 0) + ", velocity: " + newVelocity + ", angular velocity: " + (newAngularVelocity ?? 0) + ")";
|
||||
+ "\" (position: " + newPosition + ", rotation: " + newRotation + ", velocity: " + newVelocity + ", angular velocity: " + newAngularVelocity + ")";
|
||||
#if DEBUG
|
||||
DebugConsole.ThrowError(errorMsg);
|
||||
#endif
|
||||
|
||||
@@ -33,12 +33,12 @@ namespace Barotrauma
|
||||
|
||||
private readonly bool isMultiplayer;
|
||||
|
||||
public CampaignSetupUI(bool isMultiplayer, GUIComponent newGameContainer, GUIComponent loadGameContainer, IEnumerable<Submarine> submarines, IEnumerable<string> saveFiles = null)
|
||||
public CampaignSetupUI(bool isMultiplayer, GUIComponent newGameContainer, GUIComponent loadGameContainer, IEnumerable<string> saveFiles=null)
|
||||
{
|
||||
this.isMultiplayer = isMultiplayer;
|
||||
this.newGameContainer = newGameContainer;
|
||||
this.loadGameContainer = loadGameContainer;
|
||||
|
||||
|
||||
var columnContainer = new GUILayoutGroup(new RectTransform(Vector2.One, newGameContainer.RectTransform), isHorizontal: true)
|
||||
{
|
||||
Stretch = true,
|
||||
@@ -60,7 +60,7 @@ namespace Barotrauma
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), leftColumn.RectTransform), TextManager.Get("SelectedSub") + ":", textAlignment: Alignment.BottomLeft);
|
||||
subList = new GUIListBox(new RectTransform(new Vector2(1.0f, 0.65f), leftColumn.RectTransform));
|
||||
|
||||
UpdateSubList(submarines);
|
||||
UpdateSubList();
|
||||
|
||||
// New game right side
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.1f), rightColumn.RectTransform), TextManager.Get("SaveName") + ":", textAlignment: Alignment.BottomLeft);
|
||||
@@ -87,8 +87,9 @@ namespace Barotrauma
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(subList.SelectedData is Submarine selectedSub)) { return false; }
|
||||
|
||||
Submarine selectedSub = subList.SelectedData as Submarine;
|
||||
if (selectedSub == null) return false;
|
||||
|
||||
if (string.IsNullOrEmpty(selectedSub.MD5Hash.Hash))
|
||||
{
|
||||
((GUITextBlock)subList.SelectedComponent).TextColor = Color.DarkRed * 0.8f;
|
||||
@@ -195,9 +196,9 @@ namespace Barotrauma
|
||||
public void UpdateSubList(IEnumerable<Submarine> submarines)
|
||||
{
|
||||
#if DEBUG
|
||||
var subsToShow = submarines.Where(s => !s.HasTag(SubmarineTag.HideInMenus));
|
||||
var subsToShow = Submarine.SavedSubmarines.Where(s => !s.HasTag(SubmarineTag.HideInMenus));
|
||||
#else
|
||||
var subsToShow = submarines;
|
||||
var subsToShow = Submarine.SavedSubmarines;
|
||||
#endif
|
||||
|
||||
subList.ClearChildren();
|
||||
@@ -262,6 +263,11 @@ namespace Barotrauma
|
||||
saveFiles = SaveUtil.GetSaveFiles(isMultiplayer ? SaveUtil.SaveType.Multiplayer : SaveUtil.SaveType.Singleplayer);
|
||||
}
|
||||
|
||||
saveList = new GUIListBox(new RectTransform(new Vector2(0.5f, 1.0f), loadGameContainer.RectTransform, Anchor.CenterLeft))
|
||||
{
|
||||
OnSelected = SelectSaveFile
|
||||
};
|
||||
|
||||
saveList = new GUIListBox(new RectTransform(new Vector2(0.5f, 1.0f), loadGameContainer.RectTransform, Anchor.CenterLeft))
|
||||
{
|
||||
OnSelected = SelectSaveFile
|
||||
@@ -269,9 +275,7 @@ namespace Barotrauma
|
||||
|
||||
foreach (string saveFile in saveFiles)
|
||||
{
|
||||
string fileName = saveFile;
|
||||
string subName = "";
|
||||
string saveTime = "";
|
||||
XDocument doc = SaveUtil.LoadGameSessionDoc(saveFile);
|
||||
var saveFrame = new GUIFrame(new RectTransform(new Vector2(1.0f, 0.1f), saveList.Content.RectTransform), style: "ListBoxElement")
|
||||
{
|
||||
UserData = saveFile
|
||||
@@ -279,38 +283,25 @@ namespace Barotrauma
|
||||
|
||||
var nameText = new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.5f), saveFrame.RectTransform),
|
||||
text: Path.GetFileNameWithoutExtension(saveFile));
|
||||
if (doc?.Root == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error loading save file \"" + saveFile + "\". The file may be corrupted.");
|
||||
nameText.Color = Color.Red;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!isMultiplayer)
|
||||
{
|
||||
XDocument doc = SaveUtil.LoadGameSessionDoc(saveFile);
|
||||
if (doc?.Root == null)
|
||||
{
|
||||
DebugConsole.ThrowError("Error loading save file \"" + saveFile + "\". The file may be corrupted.");
|
||||
nameText.Color = Color.Red;
|
||||
continue;
|
||||
}
|
||||
subName = doc.Root.GetAttributeString("submarine", "");
|
||||
saveTime = doc.Root.GetAttributeString("savetime", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] splitSaveFile = saveFile.Split(';');
|
||||
saveFrame.UserData = splitSaveFile[0];
|
||||
fileName = nameText.Text = Path.GetFileNameWithoutExtension(splitSaveFile[0]);
|
||||
if (splitSaveFile.Length > 1) { subName = splitSaveFile[1]; }
|
||||
if (splitSaveFile.Length > 2) { saveTime = splitSaveFile[2]; }
|
||||
}
|
||||
|
||||
string submarineName = doc.Root.GetAttributeString("submarine", "");
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 0.5f), saveFrame.RectTransform, Anchor.BottomLeft),
|
||||
text: subName, font: GUI.SmallFont)
|
||||
text: submarineName, font: GUI.SmallFont)
|
||||
{
|
||||
UserData = fileName
|
||||
UserData = saveFile
|
||||
};
|
||||
|
||||
string saveTime = doc.Root.GetAttributeString("savetime", "");
|
||||
new GUITextBlock(new RectTransform(new Vector2(1.0f, 1.0f), saveFrame.RectTransform),
|
||||
text: saveTime, textAlignment: Alignment.Right, font: GUI.SmallFont)
|
||||
{
|
||||
UserData = fileName
|
||||
UserData = saveFile
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -459,12 +459,6 @@ namespace Barotrauma
|
||||
OnClicked = (GUIButton btn, object obj) => { StartRound?.Invoke(); return true; },
|
||||
Enabled = true
|
||||
};
|
||||
if (GameMain.Client != null)
|
||||
{
|
||||
startButton.Visible = !GameMain.Client.GameStarted &&
|
||||
(GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) ||
|
||||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign));
|
||||
}
|
||||
}
|
||||
|
||||
OnLocationSelected?.Invoke(location, connection);
|
||||
@@ -508,13 +502,7 @@ namespace Barotrauma
|
||||
CanBeFocused = false
|
||||
};
|
||||
|
||||
if (startButton != null)
|
||||
{
|
||||
startButton.Enabled = true;
|
||||
startButton.Visible = GameMain.Client == null ||
|
||||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageRound) ||
|
||||
GameMain.Client.HasPermission(Networking.ClientPermissions.ManageCampaign);
|
||||
}
|
||||
if (startButton != null) { startButton.Enabled = true; }
|
||||
}
|
||||
|
||||
private void CreateItemFrame(PurchasedItem pi, PriceInfo priceInfo, GUIListBox listBox, int width)
|
||||
|
||||
@@ -118,19 +118,6 @@ namespace Barotrauma
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void Reset()
|
||||
{
|
||||
AnimParams.ForEach(a => a.Reset(true));
|
||||
RagdollParams.Reset(true);
|
||||
RagdollParams.ClearHistory();
|
||||
CurrentAnimation.ClearHistory();
|
||||
if (!character.Removed)
|
||||
{
|
||||
character.Remove();
|
||||
}
|
||||
character = null;
|
||||
}
|
||||
|
||||
public override void Deselect()
|
||||
{
|
||||
base.Deselect();
|
||||
@@ -141,7 +128,15 @@ namespace Barotrauma
|
||||
isEndlessRunner = false;
|
||||
if (character != null)
|
||||
{
|
||||
Reset();
|
||||
AnimParams.ForEach(a => a.Reset(true));
|
||||
RagdollParams.Reset(true);
|
||||
RagdollParams.ClearHistory();
|
||||
CurrentAnimation.ClearHistory();
|
||||
if (!character.Removed)
|
||||
{
|
||||
character.Remove();
|
||||
}
|
||||
character = null;
|
||||
}
|
||||
GameMain.World.ProcessChanges();
|
||||
}
|
||||
@@ -398,12 +393,6 @@ namespace Barotrauma
|
||||
}
|
||||
if (!isFreezed)
|
||||
{
|
||||
if (character.AnimController.Invalid)
|
||||
{
|
||||
Reset();
|
||||
SpawnCharacter(currentCharacterConfig);
|
||||
}
|
||||
|
||||
Submarine.MainSub.SetPrevTransform(Submarine.MainSub.Position);
|
||||
Submarine.MainSub.Update((float)deltaTime);
|
||||
|
||||
@@ -1226,7 +1215,7 @@ namespace Barotrauma
|
||||
Cam.Position = character.WorldPosition;
|
||||
}
|
||||
|
||||
private bool CreateCharacter(string name, string mainFolder, bool isHumanoid, params object[] ragdollConfig)
|
||||
private bool CreateCharacter(string name, bool isHumanoid, params object[] ragdollConfig)
|
||||
{
|
||||
var contentPackage = GameMain.Config.SelectedContentPackages.LastOrDefault();
|
||||
if (contentPackage == null)
|
||||
@@ -1245,16 +1234,17 @@ namespace Barotrauma
|
||||
#endif
|
||||
|
||||
string speciesName = name;
|
||||
string mainFolder = $"Content/Characters/{speciesName}";
|
||||
// Config file
|
||||
string configFilePath = Path.Combine(mainFolder, $"{speciesName}.xml").Replace(@"\", @"/");
|
||||
string configFilePath = $"{mainFolder}/{speciesName}.xml";
|
||||
if (ContentPackage.GetFilesOfType(GameMain.SelectedPackages, ContentType.Character).None(path => path.Contains(speciesName)))
|
||||
{
|
||||
// Create the config file
|
||||
XElement mainElement = new XElement("Character",
|
||||
new XAttribute("name", speciesName),
|
||||
new XAttribute("humanoid", isHumanoid),
|
||||
new XElement("ragdolls", new XAttribute("folder", Path.Combine(mainFolder, $"Ragdolls/").Replace(@"\", @"/"))),
|
||||
new XElement("animations", new XAttribute("folder", Path.Combine(mainFolder, $"Animations/").Replace(@"\", @"/"))),
|
||||
new XElement("ragdolls"),
|
||||
new XElement("animations"),
|
||||
new XElement("health"),
|
||||
new XElement("ai"));
|
||||
XDocument doc = new XDocument(mainElement);
|
||||
@@ -1269,13 +1259,13 @@ namespace Barotrauma
|
||||
DebugConsole.NewMessage(GetCharacterEditorTranslation("ContentPackageSaved").Replace("[path]", contentPackage.Path));
|
||||
}
|
||||
// Ragdoll
|
||||
string ragdollFolder = RagdollParams.GetFolder(speciesName);
|
||||
string ragdollFolder = RagdollParams.GetDefaultFolder(speciesName);
|
||||
string ragdollPath = RagdollParams.GetDefaultFile(speciesName);
|
||||
RagdollParams ragdollParams = isHumanoid
|
||||
? RagdollParams.CreateDefault<HumanRagdollParams>(ragdollPath, speciesName, ragdollConfig)
|
||||
: RagdollParams.CreateDefault<FishRagdollParams>(ragdollPath, speciesName, ragdollConfig) as RagdollParams;
|
||||
// Animations
|
||||
string animFolder = AnimationParams.GetFolder(speciesName);
|
||||
string animFolder = AnimationParams.GetDefaultFolder(speciesName);
|
||||
foreach (AnimationType animType in Enum.GetValues(typeof(AnimationType)))
|
||||
{
|
||||
if (animType != AnimationType.NotDefined)
|
||||
@@ -4662,7 +4652,7 @@ namespace Barotrauma
|
||||
LimbXElements.Values,
|
||||
JointXElements
|
||||
};
|
||||
if (CharacterEditorScreen.instance.CreateCharacter(Name, Path.GetDirectoryName(XMLPath), IsHumanoid, ragdollParams))
|
||||
if (CharacterEditorScreen.instance.CreateCharacter(Name, IsHumanoid, ragdollParams))
|
||||
{
|
||||
GUI.AddMessage(GetCharacterEditorTranslation("CharacterCreated").Replace("[name]", Name), Color.Green, font: GUI.Font);
|
||||
}
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace Barotrauma
|
||||
menuTabs[(int)Tab.LoadGame] = new GUIFrame(new RectTransform(relativeSize, GUI.Canvas, anchor, pivot, minSize, maxSize));
|
||||
var paddedLoadGame = new GUIFrame(new RectTransform(new Vector2(0.9f, 0.9f), menuTabs[(int)Tab.LoadGame].RectTransform, Anchor.Center), style: null);
|
||||
|
||||
campaignSetupUI = new CampaignSetupUI(false, paddedNewGame, paddedLoadGame, Submarine.SavedSubmarines)
|
||||
campaignSetupUI = new CampaignSetupUI(false, paddedNewGame, paddedLoadGame)
|
||||
{
|
||||
LoadGame = LoadGame,
|
||||
StartNewGame = StartGame
|
||||
@@ -336,7 +336,7 @@ namespace Barotrauma
|
||||
|
||||
UpdateTutorialList();
|
||||
|
||||
campaignSetupUI.UpdateSubList(Submarine.SavedSubmarines);
|
||||
campaignSetupUI.UpdateSubList();
|
||||
|
||||
ResetButtonStates(null);
|
||||
|
||||
|
||||
@@ -632,13 +632,6 @@ namespace Barotrauma
|
||||
Visible = false
|
||||
};
|
||||
|
||||
campaignViewButton = new GUIButton(new RectTransform(new Vector2(1.0f, 0.1f), rightInfoColumn.RectTransform),
|
||||
TextManager.Get("CampaignView"), style: "GUIButtonLarge")
|
||||
{
|
||||
OnClicked = (btn, obj) => { ToggleCampaignView(true); return true; },
|
||||
Visible = false
|
||||
};
|
||||
|
||||
StartButton = new GUIButton(new RectTransform(new Vector2(0.3f, 0.1f), infoFrameContent.RectTransform, Anchor.BottomRight),
|
||||
TextManager.Get("StartGameButton"), style: "GUIButtonLarge")
|
||||
{
|
||||
@@ -651,6 +644,13 @@ namespace Barotrauma
|
||||
};
|
||||
clientHiddenElements.Add(StartButton);
|
||||
|
||||
campaignViewButton = new GUIButton(new RectTransform(new Vector2(0.3f, 0.1f), infoFrameContent.RectTransform, Anchor.BottomRight) { RelativeOffset = new Vector2(0.0f, 0.06f) },
|
||||
TextManager.Get("CampaignView"), style: "GUIButtonLarge")
|
||||
{
|
||||
OnClicked = (btn, obj) => { ToggleCampaignView(true); return true; },
|
||||
Visible = false
|
||||
};
|
||||
|
||||
spectateButton = new GUIButton(new RectTransform(new Vector2(0.3f, 0.1f), infoFrameContent.RectTransform, Anchor.BottomRight),
|
||||
TextManager.Get("SpectateButton"), style: "GUIButtonLarge");
|
||||
}
|
||||
@@ -726,12 +726,6 @@ namespace Barotrauma
|
||||
spectateButton.Visible = GameMain.Client.GameStarted;
|
||||
ReadyToStartBox.Visible = !GameMain.Client.GameStarted;
|
||||
ReadyToStartBox.Selected = false;
|
||||
if (campaignUI?.StartButton != null)
|
||||
{
|
||||
campaignUI.StartButton.Visible = !GameMain.Client.GameStarted &&
|
||||
(GameMain.Client.HasPermission(ClientPermissions.ManageRound) ||
|
||||
GameMain.Client.HasPermission(ClientPermissions.ManageCampaign));
|
||||
}
|
||||
GameMain.Client.SetReadyToStart(ReadyToStartBox);
|
||||
}
|
||||
else
|
||||
@@ -850,13 +844,6 @@ namespace Barotrauma
|
||||
GameMain.Client.ShowLogButton.Visible = GameMain.Client.HasPermission(ClientPermissions.ServerLog);
|
||||
|
||||
GameMain.Client.EndRoundButton.Visible = GameMain.Client.HasPermission(ClientPermissions.ManageRound);
|
||||
|
||||
if (campaignUI?.StartButton != null)
|
||||
{
|
||||
campaignUI.StartButton.Visible = !GameMain.Client.GameStarted &&
|
||||
(GameMain.Client.HasPermission(ClientPermissions.ManageRound) ||
|
||||
GameMain.Client.HasPermission(ClientPermissions.ManageCampaign));
|
||||
}
|
||||
}
|
||||
|
||||
public void ShowSpectateButton()
|
||||
@@ -866,21 +853,18 @@ namespace Barotrauma
|
||||
spectateButton.Enabled = true;
|
||||
}
|
||||
|
||||
public void SetCampaignCharacterInfo(CharacterInfo newCampaignCharacterInfo)
|
||||
{
|
||||
if (newCampaignCharacterInfo != null)
|
||||
public void SetCampaignCharacterInfo(CharacterInfo characterInfo)
|
||||
{
|
||||
if (CampaignCharacterDiscarded) return;
|
||||
|
||||
campaignCharacterInfo = characterInfo;
|
||||
if (campaignCharacterInfo != null)
|
||||
{
|
||||
if (CampaignCharacterDiscarded) { return; }
|
||||
if (campaignCharacterInfo != newCampaignCharacterInfo)
|
||||
{
|
||||
campaignCharacterInfo = newCampaignCharacterInfo;
|
||||
UpdatePlayerFrame(campaignCharacterInfo, false);
|
||||
}
|
||||
UpdatePlayerFrame(campaignCharacterInfo, false);
|
||||
}
|
||||
else if (campaignCharacterInfo != null)
|
||||
else
|
||||
{
|
||||
campaignCharacterInfo = null;
|
||||
UpdatePlayerFrame(campaignCharacterInfo, false);
|
||||
UpdatePlayerFrame(null, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1207,7 +1191,7 @@ namespace Barotrauma
|
||||
|
||||
if (sub.HasTag(SubmarineTag.Shuttle))
|
||||
{
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), frame.RectTransform, Anchor.CenterRight) { RelativeOffset = new Vector2(0.1f, 0.0f) },
|
||||
new GUITextBlock(new RectTransform(new Vector2(0.5f, 1.0f), frame.RectTransform, Anchor.CenterRight),
|
||||
TextManager.Get("Shuttle"), textAlignment: Alignment.CenterRight, font: GUI.SmallFont)
|
||||
{
|
||||
TextColor = subTextBlock.TextColor * 0.8f,
|
||||
|
||||
@@ -716,7 +716,7 @@ namespace Barotrauma
|
||||
catch (PingException ex)
|
||||
{
|
||||
string errorMsg = "Failed to ping a server (" + serverInfo.ServerName + ", " + serverInfo.IP + ") - " + (ex?.InnerException?.Message ?? ex.Message);
|
||||
GameAnalyticsManager.AddErrorEventOnce("ServerListScreen.PingServer:PingException" + serverInfo.IP, GameAnalyticsSDK.Net.EGAErrorSeverity.Warning, errorMsg);
|
||||
GameAnalyticsManager.AddErrorEventOnce("ServerListScreen.PingServer:PingException" + serverInfo.IP, GameAnalyticsSDK.Net.EGAErrorSeverity.Error, errorMsg);
|
||||
#if DEBUG
|
||||
DebugConsole.NewMessage(errorMsg, Color.Red);
|
||||
#endif
|
||||
|
||||
@@ -564,9 +564,6 @@ namespace Barotrauma
|
||||
|
||||
MapEntityPrefab.Selected = null;
|
||||
|
||||
saveFrame = null;
|
||||
loadFrame = null;
|
||||
|
||||
MapEntity.DeselectAll();
|
||||
MapEntity.SelectionGroups.Clear();
|
||||
|
||||
@@ -2043,10 +2040,6 @@ namespace Barotrauma
|
||||
dummyCharacter.SelectedConstruction = null;
|
||||
}
|
||||
}
|
||||
else if (MapEntity.SelectedList.Count == 1)
|
||||
{
|
||||
(MapEntity.SelectedList[0] as Item)?.UpdateHUD(cam, dummyCharacter, (float)deltaTime);
|
||||
}
|
||||
|
||||
CharacterHUD.Update((float)deltaTime, dummyCharacter, cam);
|
||||
}
|
||||
|
||||
@@ -26,10 +26,6 @@ namespace Barotrauma
|
||||
private int subDivX, subDivY;
|
||||
|
||||
private static Effect effect;
|
||||
public static Effect Effect
|
||||
{
|
||||
get { return effect; }
|
||||
}
|
||||
|
||||
private Point spritePos;
|
||||
private Point spriteSize;
|
||||
|
||||
Reference in New Issue
Block a user