Client LuaCsForBarotrauma
BarotraumaShared/SharedSource/Events/EventActions/MessageBoxAction.cs
1 namespace Barotrauma
2 {
6  partial class MessageBoxAction : EventAction
7  {
8  public enum ActionType { Create, ConnectObjective, Close, Clear }
9 
10  [Serialize(ActionType.Create, IsPropertySaveable.Yes, description: "What do you want to do with the message box (Create, ConnectObjective, Close, Clear)?")]
11  public ActionType Type { get; set; }
12 
13  [Serialize("", IsPropertySaveable.Yes, description: "Optional identifier of the tutorial \"segment\" that can be referenced by other event actions.")]
14  public Identifier Identifier { get; set; }
15 
16  [Serialize("", IsPropertySaveable.Yes, description: "An arbitrary tag given to the message box. Only required if you're intending to close or clear the box with another MessageBoxAction later.")]
17  public string Tag { get; set; }
18 
19  [Serialize("", IsPropertySaveable.Yes, description: "Text displayed in the header of the message box. Can be either the text as-is, or a tag referring to a line in a text file.")]
20  public Identifier Header { get; set; }
21 
22  [Serialize("", IsPropertySaveable.Yes, description: "Text displayed in the body of the message box. Can be either the text as-is, or a tag referring to a line in a text file.")]
23  public Identifier Text { get; set; }
24 
25  [Serialize("", IsPropertySaveable.Yes, description: "Style of the icon displayed in the corner of the message box (optional). The style must be defined in a UIStyle file.")]
26  public string IconStyle { get; set; }
27 
28  [Serialize(false, IsPropertySaveable.Yes, description: "Should the button that closes the box be hidden? If it is hidden, you must close the box manually using another MessageBoxAction.")]
29  public bool HideCloseButton { get; set; }
30 
31  [Serialize("", IsPropertySaveable.Yes, description: "Tag of the character(s) to show the message box to.")]
32  public Identifier TargetTag { get; set; }
33 
34  [Serialize("", IsPropertySaveable.Yes, description: "The message box is automatically closed on some input (e.g. Select, Use, CrewOrders).")]
35  public string CloseOnInput { get; set; }
36 
37  [Serialize("", IsPropertySaveable.Yes, description: "The message box is automatically closed when the user selects an item that has this tag.")]
38  public Identifier CloseOnSelectTag { get; set; }
39 
40  [Serialize("", IsPropertySaveable.Yes, description: "The message box is automatically closed when the user picks up an item that has this tag.")]
41  public Identifier CloseOnPickUpTag { get; set; }
42 
43  [Serialize("", IsPropertySaveable.Yes, description: "The message box is automatically closed when the user equips an item that has this tag.")]
44  public Identifier CloseOnEquipTag { get; set; }
45 
46  [Serialize("", IsPropertySaveable.Yes, description: "The message box is automatically closed when the user exits a room with this name.")]
47  public Identifier CloseOnExitRoomName { get; set; }
48 
49  [Serialize("", IsPropertySaveable.Yes, description: "The message box is automatically closed when the user is in a room with this name.")]
50  public Identifier CloseOnInRoomName { get; set; }
51 
52  [Serialize("", IsPropertySaveable.Yes, description: "Optional tag that will be used to get the text for the objective that is displayed on the screen.")]
53  public Identifier ObjectiveTag { get; set; }
54 
55  [Serialize(true, IsPropertySaveable.Yes)]
56  public bool ObjectiveCanBeCompleted { get; set; }
57 
58  [Serialize("", IsPropertySaveable.Yes)]
59  public Identifier ParentObjectiveId { get; set; }
60 
61  private bool isFinished = false;
62 
63  public MessageBoxAction(ScriptedEvent parentEvent, ContentXElement element) : base(parentEvent, element)
64  {
65  if (Identifier.IsEmpty)
66  {
67  Identifier = element.GetAttributeIdentifier("id", Identifier.Empty);
68  }
69  }
70 
71  public override void Update(float deltaTime)
72  {
73  if (isFinished) { return; }
74  UpdateProjSpecific();
75  isFinished = true;
76  }
77 
78  partial void UpdateProjSpecific();
79 
80  public override bool IsFinished(ref string goToLabel) => isFinished;
81 
82  public override void Reset() => isFinished = false;
83 
84  public override string ToDebugString() => $"{ToolBox.GetDebugSymbol(isFinished)} {nameof(MessageBoxAction)}";
85  }
86 }
Identifier GetAttributeIdentifier(string key, string def)
MessageBoxAction(ScriptedEvent parentEvent, ContentXElement element)
override string ToDebugString()
Rich test to display in debugdraw
override bool IsFinished(ref string goToLabel)
Has the action finished.
ActionType
ActionTypes define when a StatusEffect is executed.
Definition: Enums.cs:19