(01452b66f) Fixed "maintain position" indicators & inputs being relative to the center of the screen, not the center of the sub. Flash the docking button when ready to dock.
This commit is contained in:
@@ -175,6 +175,14 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
partial void UpdateLimbLightSource(Limb limb)
|
||||||
|
{
|
||||||
|
if (limb.LightSource != null)
|
||||||
|
{
|
||||||
|
limb.LightSource.Enabled = enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private bool wasFiring;
|
private bool wasFiring;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -105,6 +105,12 @@ namespace Barotrauma
|
|||||||
set { textBlock.TextColor = value; }
|
set { textBlock.TextColor = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override float FlashTimer
|
||||||
|
{
|
||||||
|
get { return Frame.FlashTimer; }
|
||||||
|
}
|
||||||
|
|
||||||
public override ScalableFont Font
|
public override ScalableFont Font
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ namespace Barotrauma
|
|||||||
protected Color flashColor;
|
protected Color flashColor;
|
||||||
protected float flashDuration = 1.5f;
|
protected float flashDuration = 1.5f;
|
||||||
private bool useRectangleFlash;
|
private bool useRectangleFlash;
|
||||||
public float FlashTimer
|
public virtual float FlashTimer
|
||||||
{
|
{
|
||||||
get { return flashTimer; }
|
get { return flashTimer; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,12 @@ namespace Barotrauma
|
|||||||
Content = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.85f), InnerFrame.RectTransform, Anchor.Center)) { AbsoluteSpacing = 5 };
|
Content = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.85f), InnerFrame.RectTransform, Anchor.Center)) { AbsoluteSpacing = 5 };
|
||||||
Tag = tag;
|
Tag = tag;
|
||||||
|
|
||||||
|
InnerFrame = new GUIFrame(new RectTransform(new Point(width, height), RectTransform, Anchor.Center) { IsFixedSize = false }, style: null);
|
||||||
|
GUI.Style.Apply(InnerFrame, "", this);
|
||||||
|
|
||||||
|
Content = new GUILayoutGroup(new RectTransform(new Vector2(0.9f, 0.85f), InnerFrame.RectTransform, Anchor.Center)) { AbsoluteSpacing = 5 };
|
||||||
|
Tag = tag;
|
||||||
|
|
||||||
if (height == 0)
|
if (height == 0)
|
||||||
{
|
{
|
||||||
string wrappedText = ToolBox.WrapText(text, Content.Rect.Width, GUI.Font);
|
string wrappedText = ToolBox.WrapText(text, Content.Rect.Width, GUI.Font);
|
||||||
|
|||||||
@@ -186,6 +186,10 @@ namespace Barotrauma
|
|||||||
|
|
||||||
GUI.KeyboardDispatcher = new EventInput.KeyboardDispatcher(Window);
|
GUI.KeyboardDispatcher = new EventInput.KeyboardDispatcher(Window);
|
||||||
|
|
||||||
|
GUI.KeyboardDispatcher = new EventInput.KeyboardDispatcher(Window);
|
||||||
|
|
||||||
|
|
||||||
|
PerformanceCounter = new PerformanceCounter();
|
||||||
|
|
||||||
PerformanceCounter = new PerformanceCounter();
|
PerformanceCounter = new PerformanceCounter();
|
||||||
|
|
||||||
@@ -794,13 +798,6 @@ namespace Barotrauma
|
|||||||
Config.SaveNewPlayerConfig();
|
Config.SaveNewPlayerConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
msgBox.Text.RectTransform.MaxSize = new Point(int.MaxValue, msgBox.Text.Rect.Height);
|
|
||||||
linkHolder.RectTransform.MaxSize = new Point(int.MaxValue, linkHolder.Rect.Height);
|
|
||||||
msgBox.RectTransform.MinSize = new Point(0, msgBox.Rect.Height + linkHolder.Rect.Height + msgBox.Buttons.First().Rect.Height * 8);
|
|
||||||
Config.EditorDisclaimerShown = true;
|
|
||||||
Config.SaveNewPlayerConfig();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ToDo: Move texts/links to localization, when possible.
|
// ToDo: Move texts/links to localization, when possible.
|
||||||
public void ShowBugReporter()
|
public void ShowBugReporter()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -114,41 +114,6 @@ namespace Barotrauma
|
|||||||
};
|
};
|
||||||
scrollButtonDown.Children.ForEach(c => c.SpriteEffects = SpriteEffects.FlipVertically);
|
scrollButtonDown.Children.ForEach(c => c.SpriteEffects = SpriteEffects.FlipVertically);
|
||||||
|
|
||||||
if (isSinglePlayer)
|
|
||||||
{
|
|
||||||
ChatBox = new ChatBox(guiFrame, isSinglePlayer: true)
|
|
||||||
{
|
|
||||||
OnEnterMessage = (textbox, text) =>
|
|
||||||
{
|
|
||||||
if (Character.Controlled?.Info == null)
|
|
||||||
{
|
|
||||||
textbox.Deselect();
|
|
||||||
textbox.Text = "";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
textbox.TextColor = ChatMessage.MessageColor[(int)ChatMessageType.Default];
|
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(text))
|
|
||||||
{
|
|
||||||
string msgCommand = ChatMessage.GetChatMessageCommand(text, out string msg);
|
|
||||||
AddSinglePlayerChatMessage(
|
|
||||||
Character.Controlled.Info.Name,
|
|
||||||
msg,
|
|
||||||
((msgCommand == "r" || msgCommand == "radio") && ChatMessage.CanUseRadio(Character.Controlled)) ? ChatMessageType.Radio : ChatMessageType.Default,
|
|
||||||
Character.Controlled);
|
|
||||||
var headset = GetHeadset(Character.Controlled, true);
|
|
||||||
if (headset != null && headset.CanTransmit())
|
|
||||||
{
|
|
||||||
headset.TransmitSignal(stepsTaken: 0, signal: msg, source: headset.Item, sender: Character.Controlled, sendToChat: false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
textbox.Deselect();
|
|
||||||
textbox.Text = "";
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var characterInfo = new CharacterInfo(subElement);
|
var characterInfo = new CharacterInfo(subElement);
|
||||||
characterInfos.Add(characterInfo);
|
characterInfos.Add(characterInfo);
|
||||||
foreach (XElement invElement in subElement.Elements())
|
foreach (XElement invElement in subElement.Elements())
|
||||||
@@ -159,50 +124,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var reports = Order.PrefabList.FindAll(o => o.TargetAllCharacters && o.SymbolSprite != null);
|
|
||||||
reportButtonFrame = new GUILayoutGroup(new RectTransform(
|
|
||||||
new Point((HUDLayoutSettings.CrewArea.Height - (int)((reports.Count - 1) * 5 * GUI.Scale)) / reports.Count, HUDLayoutSettings.CrewArea.Height), guiFrame.RectTransform))
|
|
||||||
{
|
|
||||||
AbsoluteSpacing = (int)(5 * GUI.Scale),
|
|
||||||
UserData = "reportbuttons",
|
|
||||||
CanBeFocused = false
|
|
||||||
};
|
|
||||||
|
|
||||||
//report buttons
|
|
||||||
foreach (Order order in reports)
|
|
||||||
{
|
|
||||||
if (!order.TargetAllCharacters || order.SymbolSprite == null) continue;
|
|
||||||
var btn = new GUIButton(new RectTransform(new Point(reportButtonFrame.Rect.Width), reportButtonFrame.RectTransform), style: null)
|
|
||||||
{
|
|
||||||
OnClicked = (GUIButton button, object userData) =>
|
|
||||||
{
|
|
||||||
if (Character.Controlled == null || Character.Controlled.SpeechImpediment >= 100.0f) return false;
|
|
||||||
SetCharacterOrder(null, order, null, Character.Controlled);
|
|
||||||
HumanAIController.PropagateHullSafety(Character.Controlled, Character.Controlled.CurrentHull);
|
|
||||||
return true;
|
|
||||||
},
|
|
||||||
UserData = order,
|
|
||||||
ToolTip = order.Name
|
|
||||||
};
|
|
||||||
|
|
||||||
new GUIFrame(new RectTransform(new Vector2(1.5f), btn.RectTransform, Anchor.Center), "OuterGlow")
|
|
||||||
{
|
|
||||||
Color = Color.Red * 0.8f,
|
|
||||||
HoverColor = Color.Red * 1.0f,
|
|
||||||
PressedColor = Color.Red * 0.6f,
|
|
||||||
UserData = "highlighted",
|
|
||||||
CanBeFocused = false,
|
|
||||||
Visible = false
|
|
||||||
};
|
|
||||||
|
|
||||||
var img = new GUIImage(new RectTransform(Vector2.One, btn.RectTransform), order.Prefab.SymbolSprite, scaleToFit: true)
|
|
||||||
{
|
|
||||||
Color = order.Color,
|
|
||||||
HoverColor = Color.Lerp(order.Color, Color.White, 0.5f),
|
|
||||||
ToolTip = order.Name
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||||
|
|
||||||
prevUIScale = GUI.Scale;
|
prevUIScale = GUI.Scale;
|
||||||
@@ -210,6 +131,16 @@ namespace Barotrauma
|
|||||||
ToggleCrewAreaOpen = GameMain.Config.CrewMenuOpen;
|
ToggleCrewAreaOpen = GameMain.Config.CrewMenuOpen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Character list management
|
||||||
|
|
||||||
|
public Rectangle GetCharacterListArea()
|
||||||
|
{
|
||||||
|
return characterListBox.Rect;
|
||||||
|
}
|
||||||
|
|
||||||
partial void InitProjectSpecific()
|
partial void InitProjectSpecific()
|
||||||
{
|
{
|
||||||
guiFrame = new GUIFrame(new RectTransform(Vector2.One, GUICanvas.Instance), null, Color.Transparent)
|
guiFrame = new GUIFrame(new RectTransform(Vector2.One, GUICanvas.Instance), null, Color.Transparent)
|
||||||
@@ -888,6 +819,12 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
List<Character> availableSpeakers = Character.CharacterList.FindAll(c =>
|
||||||
|
c.AIController is HumanAIController &&
|
||||||
|
!c.IsDead &&
|
||||||
|
c.SpeechImpediment <= 100.0f);
|
||||||
|
pendingConversationLines.AddRange(NPCConversation.CreateRandom(availableSpeakers));
|
||||||
|
}
|
||||||
|
|
||||||
character.SetOrder(order, option, orderGiver, speak: orderGiver != character);
|
character.SetOrder(order, option, orderGiver, speak: orderGiver != character);
|
||||||
if (IsSinglePlayer)
|
if (IsSinglePlayer)
|
||||||
@@ -945,21 +882,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
character.SetOrder(order, option, orderGiver, speak: orderGiver != character);
|
|
||||||
if (IsSinglePlayer)
|
|
||||||
{
|
|
||||||
orderGiver?.Speak(
|
|
||||||
order.GetChatMessage(character.Name, orderGiver.CurrentHull?.DisplayName, givingOrderToSelf: character == orderGiver, orderOption: option), null);
|
|
||||||
}
|
|
||||||
else if (orderGiver != null)
|
|
||||||
{
|
|
||||||
OrderChatMessage msg = new OrderChatMessage(order, option, order.TargetItemComponent?.Item, character, orderGiver);
|
|
||||||
if (GameMain.Client != null)
|
|
||||||
{
|
|
||||||
GameMain.Client.SendChatMessage(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
DisplayCharacterOrder(character, order);
|
DisplayCharacterOrder(character, order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -366,7 +366,7 @@ namespace Barotrauma.Items.Components
|
|||||||
Vector2 displayPosToMaintain = ((posToMaintain.Value - sonar.DisplayOffset * sonar.Zoom - controlledSub.WorldPosition)) / sonar.Range * sonar.DisplayRadius * sonar.Zoom;
|
Vector2 displayPosToMaintain = ((posToMaintain.Value - sonar.DisplayOffset * sonar.Zoom - controlledSub.WorldPosition)) / sonar.Range * sonar.DisplayRadius * sonar.Zoom;
|
||||||
displayPosToMaintain.Y = -displayPosToMaintain.Y;
|
displayPosToMaintain.Y = -displayPosToMaintain.Y;
|
||||||
displayPosToMaintain = displayPosToMaintain.ClampLength(velRect.Width / 2);
|
displayPosToMaintain = displayPosToMaintain.ClampLength(velRect.Width / 2);
|
||||||
displayPosToMaintain = velRect.Center.ToVector2() + displayPosToMaintain;
|
displayPosToMaintain = steerArea.Rect.Center.ToVector2() + displayPosToMaintain;
|
||||||
|
|
||||||
float crossHairSize = 8.0f;
|
float crossHairSize = 8.0f;
|
||||||
Color crosshairColor = Color.Orange * (0.5f + ((float)Math.Sin(Timing.TotalTime * 5.0f) + 1.0f) / 4.0f);
|
Color crosshairColor = Color.Orange * (0.5f + ((float)Math.Sin(Timing.TotalTime * 5.0f) + 1.0f) / 4.0f);
|
||||||
@@ -374,11 +374,7 @@ namespace Barotrauma.Items.Components
|
|||||||
GUI.DrawLine(spriteBatch, displayPosToMaintain + Vector2.UnitY * crossHairSize, displayPosToMaintain - Vector2.UnitY * crossHairSize, crosshairColor, width: 3);
|
GUI.DrawLine(spriteBatch, displayPosToMaintain + Vector2.UnitY * crossHairSize, displayPosToMaintain - Vector2.UnitY * crossHairSize, crosshairColor, width: 3);
|
||||||
GUI.DrawLine(spriteBatch, displayPosToMaintain + Vector2.UnitX * crossHairSize, displayPosToMaintain - Vector2.UnitX * crossHairSize, crosshairColor, width: 3);
|
GUI.DrawLine(spriteBatch, displayPosToMaintain + Vector2.UnitX * crossHairSize, displayPosToMaintain - Vector2.UnitX * crossHairSize, crosshairColor, width: 3);
|
||||||
|
|
||||||
Vector2 neutralPos = ((controlledSub.WorldPosition - sonar.DisplayOffset * sonar.Zoom - controlledSub.WorldPosition)) / sonar.Range * sonar.DisplayRadius * sonar.Zoom;
|
Vector2 neutralPos = displaySubPos;
|
||||||
|
|
||||||
neutralPos.Y = -neutralPos.Y;
|
|
||||||
neutralPos = neutralPos.ClampLength(velRect.Width / 2);
|
|
||||||
neutralPos = velRect.Center.ToVector2() + neutralPos;
|
|
||||||
GUI.DrawRectangle(spriteBatch, new Rectangle((int)neutralPos.X - 5, (int)neutralPos.Y - 5, 10, 10), Color.Orange);
|
GUI.DrawRectangle(spriteBatch, new Rectangle((int)neutralPos.X - 5, (int)neutralPos.Y - 5, 10, 10), Color.Orange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -469,7 +465,11 @@ namespace Barotrauma.Items.Components
|
|||||||
if (Math.Abs(DockingSource.Item.WorldPosition.X - DockingTarget.Item.WorldPosition.X) < DockingSource.DistanceTolerance.X &&
|
if (Math.Abs(DockingSource.Item.WorldPosition.X - DockingTarget.Item.WorldPosition.X) < DockingSource.DistanceTolerance.X &&
|
||||||
Math.Abs(DockingSource.Item.WorldPosition.X - DockingTarget.Item.WorldPosition.X) < DockingSource.DistanceTolerance.X)
|
Math.Abs(DockingSource.Item.WorldPosition.X - DockingTarget.Item.WorldPosition.X) < DockingSource.DistanceTolerance.X)
|
||||||
{
|
{
|
||||||
//TODO: flash docking button
|
if (dockingButton.FlashTimer <= 0.0f)
|
||||||
|
{
|
||||||
|
dockingButton.Flash(Color.LightGreen);
|
||||||
|
dockingButton.Pulsate(Vector2.One, Vector2.One * 1.2f, dockingButton.FlashTimer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -519,7 +519,7 @@ namespace Barotrauma.Items.Components
|
|||||||
if (AutoPilot && !LevelStartSelected && !LevelEndSelected)
|
if (AutoPilot && !LevelStartSelected && !LevelEndSelected)
|
||||||
{
|
{
|
||||||
posToMaintain = controlledSub != null ?
|
posToMaintain = controlledSub != null ?
|
||||||
controlledSub.WorldPosition + (sonar.DisplayOffset * sonar.Zoom) + inputPos / sonar.DisplayRadius * sonar.Range / sonar.Zoom :
|
controlledSub.WorldPosition + inputPos / sonar.DisplayRadius * sonar.Range / sonar.Zoom :
|
||||||
item.Submarine == null ? item.WorldPosition : item.Submarine.WorldPosition;
|
item.Submarine == null ? item.WorldPosition : item.Submarine.WorldPosition;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private GUILayoutGroup subPreviewContainer;
|
private GUILayoutGroup subPreviewContainer;
|
||||||
|
|
||||||
|
private GUILayoutGroup subPreviewContainer;
|
||||||
|
|
||||||
private GUIButton loadGameButton;
|
private GUIButton loadGameButton;
|
||||||
|
|
||||||
public Action<Submarine, string, string> StartNewGame;
|
public Action<Submarine, string, string> StartNewGame;
|
||||||
|
|||||||
@@ -1059,6 +1059,8 @@ namespace Barotrauma
|
|||||||
|
|
||||||
private bool IsProperlyLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub && SelectedAiTarget?.Entity == wallTarget?.Structure;
|
private bool IsProperlyLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub && SelectedAiTarget?.Entity == wallTarget?.Structure;
|
||||||
|
|
||||||
|
private bool IsProperlyLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub && SelectedAiTarget?.Entity == wallTarget?.Structure;
|
||||||
|
|
||||||
//goes through all the AItargets, evaluates how preferable it is to attack the target,
|
//goes through all the AItargets, evaluates how preferable it is to attack the target,
|
||||||
//whether the Character can see/hear the target and chooses the most preferable target within
|
//whether the Character can see/hear the target and chooses the most preferable target within
|
||||||
//sight/hearing range
|
//sight/hearing range
|
||||||
|
|||||||
@@ -2575,6 +2575,10 @@ namespace Barotrauma
|
|||||||
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
|
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if CLIENT
|
||||||
|
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
|
||||||
|
#endif
|
||||||
|
|
||||||
#if CLIENT
|
#if CLIENT
|
||||||
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
|
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -79,40 +79,6 @@ namespace Barotrauma
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static string Get(string textTag, bool returnNull = false)
|
public static string Get(string textTag, bool returnNull = false)
|
||||||
{
|
|
||||||
if (!textPacks.ContainsKey(Language))
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError("No text packs available for the selected language (" + Language + ")! Switching to English...");
|
|
||||||
Language = "English";
|
|
||||||
if (!textPacks.ContainsKey(Language))
|
|
||||||
{
|
|
||||||
throw new Exception("No text packs available in English!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string GetFormatted(string textTag, bool returnNull = false, params object[] args)
|
|
||||||
{
|
|
||||||
string text = Get(textTag, returnNull);
|
|
||||||
|
|
||||||
if (text == null || text.Length == 0)
|
|
||||||
{
|
|
||||||
if (returnNull)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
DebugConsole.ThrowError("Text \"" + textTag + "\" not found.");
|
|
||||||
return textTag;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return string.Format(text, args);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Format: ServerMessage.Identifier1/ServerMessage.Indentifier2~[variable1]=value~[variable2]=value
|
|
||||||
public static string GetServerMessage(string serverMessage)
|
|
||||||
{
|
{
|
||||||
if (!textPacks.ContainsKey(Language))
|
if (!textPacks.ContainsKey(Language))
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user