(ce8e185aa) Merge branch 'dev' of https://github.com/Regalis11/Barotrauma-development into dev
This commit is contained in:
@@ -41,7 +41,10 @@ namespace Barotrauma
|
||||
private bool toggleCrewAreaOpen = true;
|
||||
private int characterInfoWidth;
|
||||
|
||||
private ChatBox chatBox;
|
||||
/// <summary>
|
||||
/// Present only in single player games. In multiplayer. The chatbox is found from GameSession.Client.
|
||||
/// </summary>
|
||||
public ChatBox ChatBox { get; private set; }
|
||||
|
||||
private float prevUIScale;
|
||||
|
||||
@@ -50,7 +53,15 @@ namespace Barotrauma
|
||||
public bool ToggleCrewAreaOpen
|
||||
{
|
||||
get { return toggleCrewAreaOpen; }
|
||||
set { toggleCrewAreaOpen = value; }
|
||||
set
|
||||
{
|
||||
if (toggleCrewAreaOpen == value) { return; }
|
||||
toggleCrewAreaOpen = GameMain.Config.CrewMenuOpen = value;
|
||||
foreach (GUIComponent child in toggleCrewButton.Children)
|
||||
{
|
||||
child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -93,11 +104,7 @@ namespace Barotrauma
|
||||
"", style: "UIToggleButton");
|
||||
toggleCrewButton.OnClicked += (GUIButton btn, object userdata) =>
|
||||
{
|
||||
toggleCrewAreaOpen = !toggleCrewAreaOpen;
|
||||
foreach (GUIComponent child in btn.Children)
|
||||
{
|
||||
child.SpriteEffects = toggleCrewAreaOpen ? SpriteEffects.None : SpriteEffects.FlipHorizontally;
|
||||
}
|
||||
ToggleCrewAreaOpen = !ToggleCrewAreaOpen;
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -125,7 +132,7 @@ namespace Barotrauma
|
||||
|
||||
if (isSinglePlayer)
|
||||
{
|
||||
chatBox = new ChatBox(guiFrame, isSinglePlayer: true)
|
||||
ChatBox = new ChatBox(guiFrame, isSinglePlayer: true)
|
||||
{
|
||||
OnEnterMessage = (textbox, text) =>
|
||||
{
|
||||
@@ -158,7 +165,7 @@ namespace Barotrauma
|
||||
}
|
||||
};
|
||||
|
||||
chatBox.InputBox.OnTextChanged += chatBox.TypingChatMessage;
|
||||
ChatBox.InputBox.OnTextChanged += ChatBox.TypingChatMessage;
|
||||
}
|
||||
|
||||
var reports = Order.PrefabList.FindAll(o => o.TargetAllCharacters && o.SymbolSprite != null);
|
||||
@@ -208,6 +215,8 @@ namespace Barotrauma
|
||||
screenResolution = new Point(GameMain.GraphicsWidth, GameMain.GraphicsHeight);
|
||||
|
||||
prevUIScale = GUI.Scale;
|
||||
|
||||
ToggleCrewAreaOpen = GameMain.Config.CrewMenuOpen;
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +280,6 @@ namespace Barotrauma
|
||||
DebugConsole.ThrowError("Tried to add the same character info to CrewManager twice.\n" + Environment.StackTrace);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
characterInfos.Add(characterInfo);
|
||||
}
|
||||
@@ -599,7 +607,20 @@ namespace Barotrauma
|
||||
characterListBox.BarScroll = roundedPos;
|
||||
}
|
||||
|
||||
return false;
|
||||
#region Dialog
|
||||
/// <summary>
|
||||
/// Adds the message to the single player chatbox.
|
||||
/// </summary>
|
||||
public void AddSinglePlayerChatMessage(string senderName, string text, ChatMessageType messageType, Character sender)
|
||||
{
|
||||
if (!isSinglePlayer)
|
||||
{
|
||||
DebugConsole.ThrowError("Cannot add messages to single player chat box in multiplayer mode!\n" + Environment.StackTrace);
|
||||
return;
|
||||
}
|
||||
if (string.IsNullOrEmpty(text)) { return; }
|
||||
|
||||
chatBox.AddMessage(ChatMessage.Create(senderName, text, messageType, sender));
|
||||
}
|
||||
|
||||
private IEnumerable<object> KillCharacterAnim(GUIComponent component)
|
||||
@@ -612,6 +633,12 @@ namespace Barotrauma
|
||||
{
|
||||
comp.Color = Color.DarkRed;
|
||||
}
|
||||
List<Character> availableSpeakers = Character.CharacterList.FindAll(c =>
|
||||
c.AIController is HumanAIController &&
|
||||
!c.IsDead &&
|
||||
c.SpeechImpediment <= 100.0f);
|
||||
pendingConversationLines.AddRange(NPCConversation.CreateRandom(availableSpeakers));
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(1.0f);
|
||||
|
||||
@@ -647,7 +674,7 @@ namespace Barotrauma
|
||||
}
|
||||
if (string.IsNullOrEmpty(text)) { return; }
|
||||
|
||||
chatBox.AddMessage(ChatMessage.Create(senderName, text, messageType, sender));
|
||||
ChatBox.AddMessage(ChatMessage.Create(senderName, text, messageType, sender));
|
||||
}
|
||||
|
||||
private WifiComponent GetHeadset(Character character, bool requireEquipped)
|
||||
@@ -723,7 +750,7 @@ namespace Barotrauma
|
||||
if (IsSinglePlayer)
|
||||
{
|
||||
orderGiver.Speak(
|
||||
order.GetChatMessage("", orderGiver.CurrentHull?.RoomName, givingOrderToSelf: character == orderGiver), ChatMessageType.Order);
|
||||
order.GetChatMessage("", orderGiver.CurrentHull?.DisplayName, givingOrderToSelf: character == orderGiver), ChatMessageType.Order);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -740,7 +767,7 @@ namespace Barotrauma
|
||||
if (IsSinglePlayer)
|
||||
{
|
||||
orderGiver?.Speak(
|
||||
order.GetChatMessage(character.Name, orderGiver.CurrentHull?.RoomName, givingOrderToSelf: character == orderGiver, orderOption: option), null);
|
||||
order.GetChatMessage(character.Name, orderGiver.CurrentHull?.DisplayName, givingOrderToSelf: character == orderGiver, orderOption: option), null);
|
||||
}
|
||||
else if (orderGiver != null)
|
||||
{
|
||||
@@ -1057,24 +1084,24 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
if (GUI.DisableHUD || GUI.DisableUpperHUD) return;
|
||||
if (chatBox != null)
|
||||
if (ChatBox != null)
|
||||
{
|
||||
chatBox.Update(deltaTime);
|
||||
chatBox.InputBox.Visible = Character.Controlled != null;
|
||||
ChatBox.Update(deltaTime);
|
||||
ChatBox.InputBox.Visible = Character.Controlled != null;
|
||||
|
||||
if (!DebugConsole.IsOpen && chatBox.InputBox.Visible)
|
||||
if (!DebugConsole.IsOpen && ChatBox.InputBox.Visible)
|
||||
{
|
||||
if (PlayerInput.KeyHit(InputType.Chat) && !chatBox.InputBox.Selected)
|
||||
if (PlayerInput.KeyHit(InputType.Chat) && !ChatBox.InputBox.Selected)
|
||||
{
|
||||
chatBox.GUIFrame.Flash(Color.DarkGreen, 0.5f);
|
||||
chatBox.InputBox.Select();
|
||||
ChatBox.GUIFrame.Flash(Color.DarkGreen, 0.5f);
|
||||
ChatBox.InputBox.Select();
|
||||
}
|
||||
|
||||
if (PlayerInput.KeyHit(InputType.RadioChat) && !chatBox.InputBox.Selected)
|
||||
if (PlayerInput.KeyHit(InputType.RadioChat) && !ChatBox.InputBox.Selected)
|
||||
{
|
||||
chatBox.GUIFrame.Flash(Color.YellowGreen, 0.5f);
|
||||
chatBox.InputBox.Select();
|
||||
chatBox.InputBox.Text = "r; ";
|
||||
ChatBox.GUIFrame.Flash(Color.YellowGreen, 0.5f);
|
||||
ChatBox.InputBox.Select();
|
||||
ChatBox.InputBox.Text = "r; ";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1144,7 +1171,7 @@ namespace Barotrauma
|
||||
|
||||
crewArea.RectTransform.AbsoluteOffset =
|
||||
Vector2.SmoothStep(new Vector2(-crewArea.Rect.Width, 0), new Vector2(toggleCrewButton.Rect.Width, 0), crewAreaOpenState).ToPoint();
|
||||
crewAreaOpenState = toggleCrewAreaOpen ?
|
||||
crewAreaOpenState = ToggleCrewAreaOpen ?
|
||||
Math.Min(crewAreaOpenState + deltaTime * 2.0f, 1.0f) :
|
||||
Math.Max(crewAreaOpenState - deltaTime * 2.0f, 0.0f);
|
||||
|
||||
@@ -1157,7 +1184,7 @@ namespace Barotrauma
|
||||
{
|
||||
Character.Controlled.SelectedConstruction = null;
|
||||
}
|
||||
toggleCrewAreaOpen = !toggleCrewAreaOpen;
|
||||
ToggleCrewAreaOpen = !ToggleCrewAreaOpen;
|
||||
}
|
||||
|
||||
UpdateReports(deltaTime);
|
||||
@@ -1285,7 +1312,7 @@ namespace Barotrauma
|
||||
{
|
||||
reportButtonFrame.Visible = true;
|
||||
|
||||
var reportButtonParent = chatBox ?? GameMain.Client.ChatBox;
|
||||
var reportButtonParent = ChatBox ?? GameMain.Client.ChatBox;
|
||||
reportButtonFrame.RectTransform.AbsoluteOffset = new Point(
|
||||
Math.Min(reportButtonParent.GUIFrame.Rect.X, reportButtonParent.ToggleButton.Rect.X) - reportButtonFrame.Rect.Width - (int)(10 * GUI.Scale),
|
||||
reportButtonParent.GUIFrame.Rect.Y);
|
||||
|
||||
@@ -135,6 +135,8 @@ namespace Barotrauma
|
||||
|
||||
msg.Write(map.SelectedLocationIndex == -1 ? UInt16.MaxValue : (UInt16)map.SelectedLocationIndex);
|
||||
msg.Write(map.SelectedMissionIndex == -1 ? byte.MaxValue : (byte)map.SelectedMissionIndex);
|
||||
msg.Write(PurchasedHullRepairs);
|
||||
msg.Write(PurchasedItemRepairs);
|
||||
|
||||
msg.Write((UInt16)CargoManager.PurchasedItems.Count);
|
||||
foreach (PurchasedItem pi in CargoManager.PurchasedItems)
|
||||
|
||||
Reference in New Issue
Block a user