v0.19.8.0

This commit is contained in:
Juan Pablo Arce
2022-09-28 21:30:52 -03:00
parent fec8131243
commit 3ca584f2fc
152 changed files with 1931 additions and 1071 deletions
@@ -92,11 +92,13 @@ namespace Barotrauma
}
}
float prevSize = conversationList.TotalSize;
List<GUIButton> extraButtons = CreateConversation(conversationList, text, speaker, options, string.IsNullOrWhiteSpace(spriteIdentifier));
AssignActionsToButtons(extraButtons, lastMessageBox);
RecalculateLastMessage(conversationList, true);
conversationList.ScrollToEnd(0.5f);
conversationList.BarScroll = (prevSize - conversationList.Content.Rect.Height) / (conversationList.TotalSize - conversationList.Content.Rect.Height);
conversationList.ScrollToEnd(duration: 0.5f);
lastMessageBox.SetBackgroundIcon(eventSprite);
return;
}
@@ -112,7 +114,7 @@ namespace Barotrauma
};
messageBox.OnAddedToGUIUpdateList += (GUIComponent component) =>
{
if (!(Screen.Selected is GameScreen)) { messageBox.Close(); }
if (Screen.Selected is not GameScreen) { messageBox.Close(); }
};
lastMessageBox = messageBox;
@@ -321,7 +323,7 @@ namespace Barotrauma
AlwaysOverrideCursor = true
};
LocalizedString translatedText = TextManager.Get(text).Fallback(text);
LocalizedString translatedText = TextManager.ParseInputTypes(TextManager.Get(text)).Fallback(text);
if (speaker?.Info != null && drawChathead)
{
@@ -0,0 +1,58 @@
using Microsoft.Xna.Framework;
using System.Linq;
namespace Barotrauma;
partial class InventoryHighlightAction : EventAction
{
private static readonly Color highlightColor = Color.Orange;
partial void UpdateProjSpecific()
{
foreach (var target in ParentEvent.GetTargets(TargetTag))
{
SetHighlight(target);
}
}
private void SetHighlight(Entity entity)
{
if (entity is Item item)
{
int i = 0;
foreach (var itemContainer in item.GetComponents<Items.Components.ItemContainer>())
{
if (ItemContainerIndex == -1 || i == ItemContainerIndex)
{
SetHighlight(itemContainer.Inventory);
}
i++;
}
}
else if (entity is Character c)
{
SetHighlight(c.Inventory);
}
}
private void SetHighlight(Inventory inventory)
{
if (inventory?.visualSlots == null) { return; }
for (int i = 0; i < inventory.visualSlots.Length; i++)
{
if (inventory.visualSlots[i].HighlightTimer > 0) { continue; }
Item item = inventory.GetItemAt(i);
if (IsSuitableItem(item) ||
(Recursive && item?.OwnInventory != null && item.OwnInventory.FindAllItems(it => IsSuitableItem(it), recursive: true).Any()))
{
inventory.visualSlots[i].ShowBorderHighlight(highlightColor, 0.5f, 0.5f, 0.1f);
}
}
}
private bool IsSuitableItem(Item item)
{
return (ItemIdentifier.IsEmpty && item == null) ||
(item != null && (item.Prefab.Identifier == ItemIdentifier || item.HasTag(ItemIdentifier)));
}
}
@@ -8,20 +8,24 @@ partial class MessageBoxAction : EventAction
{
partial void UpdateProjSpecific()
{
if (Type == ActionType.Create)
if (Type == ActionType.Create || Type == ActionType.ConnectObjective)
{
CreateMessageBox();
if (!ObjectiveTag.IsEmpty && GameMain.GameSession?.GameMode is TutorialMode tutorialMode)
{
Identifier id = Identifier.IsEmpty ? Text : Identifier;
Identifier id = Identifier.IfEmpty(Text);
var segment = Tutorial.Segment.CreateMessageBoxSegment(id, ObjectiveTag, CreateMessageBox);
tutorialMode.Tutorial?.TriggerTutorialSegment(segment);
tutorialMode.Tutorial?.TriggerTutorialSegment(segment, connectObjective: Type == ActionType.ConnectObjective);
}
}
else if (Type == ActionType.Close)
{
GUIMessageBox.Close(Tag);
}
else if (Type == ActionType.Clear)
{
GUIMessageBox.CloseAll();
}
}
public void CreateMessageBox()
@@ -4,7 +4,7 @@ namespace Barotrauma;
partial class TutorialHighlightAction : EventAction
{
private static readonly Color highlightColor = Color.OrangeRed;
private static readonly Color highlightColor = Color.Orange;
partial void UpdateProjSpecific()
{
@@ -19,32 +19,32 @@ partial class TutorialHighlightAction : EventAction
{
if (entity is Item i)
{
SetHighlight(i);
SetItemHighlight(i);
}
else if (entity is Structure s)
{
SetHighlight(s);
SetStructureHighlight(s);
}
else if (entity is Character c)
{
SetHighlight(c);
SetCharacterHighlight(c);
}
}
private void SetHighlight(Item item)
private void SetItemHighlight(Item item)
{
if (item.ExternalHighlight == State) { return; }
item.SpriteColor = (State) ? highlightColor : Color.White;
item.HighlightColor = State ? highlightColor : null;
item.ExternalHighlight = State;
}
private void SetHighlight(Structure structure)
private void SetStructureHighlight(Structure structure)
{
structure.SpriteColor = (State) ? highlightColor : Color.White;
structure.SpriteColor = State ? highlightColor : Color.White;
structure.ExternalHighlight = State;
}
private void SetHighlight(Character character)
private void SetCharacterHighlight(Character character)
{
character.ExternalHighlight = State;
}
@@ -11,13 +11,13 @@ partial class TutorialSegmentAction : EventAction
// Only need to create the segment when it's being triggered (otherwise the tutorial already has the segment instance)
if (Type == SegmentActionType.Trigger)
{
segment = Tutorial.Segment.CreateInfoBoxSegment(Id, ObjectiveTag, AutoPlayVideo ? Tutorials.AutoPlayVideo.Yes : Tutorials.AutoPlayVideo.No,
segment = Tutorial.Segment.CreateInfoBoxSegment(Identifier, ObjectiveTag, AutoPlayVideo ? Tutorials.AutoPlayVideo.Yes : Tutorials.AutoPlayVideo.No,
new Tutorial.Segment.Text(TextTag, Width, Height, Anchor.Center),
new Tutorial.Segment.Video(VideoFile, TextTag, Width, Height));
}
else if (Type == SegmentActionType.Add)
{
segment = Tutorial.Segment.CreateObjectiveSegment(Id, !ObjectiveTag.IsEmpty ? ObjectiveTag : Id);
segment = Tutorial.Segment.CreateObjectiveSegment(Identifier, !ObjectiveTag.IsEmpty ? ObjectiveTag : Identifier);
}
if (GameMain.GameSession?.GameMode is TutorialMode tutorialMode)
{
@@ -30,21 +30,21 @@ partial class TutorialSegmentAction : EventAction
tutorial.TriggerTutorialSegment(segment);
break;
case SegmentActionType.Complete:
tutorial.CompleteTutorialSegment(Id);
tutorial.CompleteTutorialSegment(Identifier);
break;
case SegmentActionType.Remove:
tutorial.RemoveTutorialSegment(Id);
tutorial.RemoveTutorialSegment(Identifier);
break;
case SegmentActionType.CompleteAndRemove:
tutorial.CompleteTutorialSegment(Id);
tutorial.RemoveTutorialSegment(Id);
tutorial.CompleteTutorialSegment(Identifier);
tutorial.RemoveTutorialSegment(Identifier);
break;
}
}
}
else
{
DebugConsole.ShowError($"Error in event \"{ParentEvent.Prefab.Identifier}\": attempting to use TutorialSegmentAction during a non-Tutorial game mode!");
DebugConsole.ThrowError($"Error in event \"{ParentEvent.Prefab.Identifier}\": attempting to use TutorialSegmentAction during a non-Tutorial game mode!");
}
}
}
@@ -0,0 +1,46 @@
using Microsoft.Xna.Framework;
using System.Linq;
namespace Barotrauma;
partial class UIHighlightAction : EventAction
{
private static readonly Color highlightColor = Color.Orange;
partial void UpdateProjSpecific()
{
bool useCircularFlash = false;
GUIComponent component = null;
if (Id != ElementId.None)
{
component = GUI.GetAdditions().FirstOrDefault(c => Equals(Id, c.UserData));
}
else if (!EntityIdentifier.IsEmpty)
{
component = GUI.GetAdditions().FirstOrDefault(c =>
c.UserData is MapEntityPrefab mep && mep.Identifier == EntityIdentifier || c.UserData is MapEntity me && me.Prefab.Identifier == EntityIdentifier);
}
else if (!OrderIdentifier.IsEmpty)
{
useCircularFlash = true;
if (!OrderTargetTag.IsEmpty)
{
component =
GUI.GetAdditions().FirstOrDefault(c =>
c.UserData is CrewManager.MinimapNodeData nodeData && nodeData.Order is Order order &&
order.Identifier == OrderIdentifier && order.Option == OrderOption && order.TargetEntity is Item item && item.HasTag(OrderTargetTag));
}
component ??=
GUI.GetAdditions().FirstOrDefault(c => c.UserData is Order order && order.Identifier == OrderIdentifier && order.Option == OrderOption) ??
GUI.GetAdditions().FirstOrDefault(c => c.UserData is Order order && order.Identifier == OrderIdentifier) ??
GUI.GetAdditions().FirstOrDefault(c => Equals(OrderCategory, c.UserData));
}
if (component != null && component.FlashTimer <= 0.0f)
{
component.Flash(highlightColor, useCircularFlash: useCircularFlash);
component.Bounce |= Bounce;
}
}
}