Barotrauma Client Doc
Barotrauma.GUIMessageBox Class Reference
Inheritance diagram for Barotrauma.GUIMessageBox:
Barotrauma.GUIFrame Barotrauma.GUIComponent

Public Types

enum class  Type {
  Default , InGame , Vote , Hint ,
  Tutorial , Warning
}
 
- Public Types inherited from Barotrauma.GUIComponent
enum class  ComponentState {
  None , Hover , Pressed , Selected ,
  HoverSelected
}
 

Public Member Functions

 GUIMessageBox (LocalizedString headerText, LocalizedString text, Vector2? relativeSize=null, Point? minSize=null, Type type=Type.Default)
 
 GUIMessageBox (RichString headerText, RichString text, LocalizedString[] buttons, Vector2? relativeSize=null, Point? minSize=null, Alignment textAlignment=Alignment.TopLeft, Type type=Type.Default, string tag="", Sprite icon=null, string iconStyle="", Sprite backgroundIcon=null, Func< bool > autoCloseCondition=null, bool hideCloseButton=false)
 
 GUIMessageBox (Identifier hintIdentifier, LocalizedString text, Sprite icon)
 Use to create a message box of Hint type More...
 
void SetBackgroundIcon (Sprite icon)
 
void Close ()
 
bool Close (GUIButton button, object obj)
 
void AddButton (RectTransform rectT, string text, GUIButton.OnClickedHandler onClick)
 Parent does not matter. It's overridden. More...
 
- Public Member Functions inherited from Barotrauma.GUIFrame
 GUIFrame (RectTransform rectT, string style="", Color? color=null)
 
- Public Member Functions inherited from Barotrauma.GUIComponent
delegate bool SecondaryButtonDownHandler (GUIComponent component, object userData)
 
GetChild< T > ()
 
GetAnyChild< T > ()
 
IEnumerable< T > GetAllChildren< T > ()
 
IEnumerable< GUIComponentGetAllChildren ()
 Returns all child elements in the hierarchy. More...
 
GUIComponent GetChild (int index)
 
int GetChildIndex (GUIComponent child)
 
GUIComponent GetChildByUserData (object obj)
 
bool IsParentOf (GUIComponent component, bool recursive=true)
 
bool IsChildOf (GUIComponent component, bool recursive=true)
 
virtual void RemoveChild (GUIComponent child)
 
GUIComponent FindChild (Func< GUIComponent, bool > predicate, bool recursive=false)
 
GUIComponent FindChild (object userData, bool recursive=false)
 
IEnumerable< GUIComponentFindChildren (object userData)
 
IEnumerable< GUIComponentFindChildren (Func< GUIComponent, bool > predicate)
 
virtual void ClearChildren ()
 
void SetAsFirstChild ()
 
void SetAsLastChild ()
 
virtual void AddToGUIUpdateList (bool ignoreChildren=false, int order=0)
 
void RemoveFromGUIUpdateList (bool alsoChildren=true)
 
void UpdateAuto (float deltaTime)
 Only GUI should call this method. Auto updating follows the order of GUI update list. This order can be tweaked by changing the UpdateOrder property. More...
 
void UpdateManually (float deltaTime, bool alsoChildren=false, bool recursive=true)
 By default, all the gui elements are updated automatically in the same order they appear on the update list. More...
 
virtual void ForceLayoutRecalculation ()
 
void ForceUpdate ()
 
void UpdateChildren (float deltaTime, bool recursive)
 Updates all the children manually. More...
 
void DrawAuto (SpriteBatch spriteBatch)
 Only GUI should call this method. Auto drawing follows the order of GUI update list. This order can be tweaked by changing the UpdateOrder property. More...
 
virtual void DrawManually (SpriteBatch spriteBatch, bool alsoChildren=false, bool recursive=true)
 By default, all the gui elements are drawn automatically in the same order they appear on the update list. More...
 
virtual void DrawChildren (SpriteBatch spriteBatch, bool recursive)
 Draws all the children manually. More...
 
void DrawToolTip (SpriteBatch spriteBatch)
 Creates and draws a tooltip. More...
 
virtual void Flash (Color? color=null, float flashDuration=1.5f, bool useRectangleFlash=false, bool useCircularFlash=false, Vector2? flashRectInflate=null)
 
void ImmediateFlash (Color? color=null)
 
void FadeOut (float duration, bool removeAfter, float wait=0.0f, Action onRemove=null)
 
void FadeIn (float wait, float duration)
 
void SlideIn (float wait, float duration, int amount, SlideDirection direction)
 
void SlideOut (float duration, int amount, SlideDirection direction)
 
void Pulsate (Vector2 startScale, Vector2 endScale, float duration)
 
virtual void ApplyStyle (GUIComponentStyle style)
 
void ApplySizeRestrictions (GUIComponentStyle style)
 

Static Public Member Functions

static void AddActiveToGUIUpdateList ()
 
static void CloseAll ()
 
static void Close (Identifier tag)
 
static void Close (string tag)
 
static GUIMessageBox CreateLoadingBox (LocalizedString text,(LocalizedString Label, Action< GUIMessageBox > Action)[] buttons=null, Vector2? relativeSize=null)
 
- Static Public Member Functions inherited from Barotrauma.GUIComponent
static void DrawToolTip (SpriteBatch spriteBatch, RichString toolTip, Vector2 pos)
 
static void DrawToolTip (SpriteBatch spriteBatch, RichString toolTip, Rectangle targetElement, Anchor anchor=Anchor.BottomCenter, Pivot pivot=Pivot.TopLeft)
 
static GUIComponent FromXML (ContentXElement element, RectTransform parent)
 

Public Attributes

bool DisplayInLoadingScreens
 
Vector2 DraggingPosition = Vector2.Zero
 
bool AutoClose
 Close the message box automatically after enough time has passed (inGameCloseTime) More...
 
- Public Attributes inherited from Barotrauma.GUIComponent
CursorState HoverCursor = CursorState.Default
 
bool AlwaysOverrideCursor = false
 
SecondaryButtonDownHandler OnSecondaryClicked
 
Action< GUIComponentOnAddedToGUIUpdateList
 
bool CanBeFocused
 
Dictionary< ComponentState, List< UISprite > > sprites
 
SpriteEffects SpriteEffects
 
object UserData
 
bool ExternalHighlight = false
 

Static Public Attributes

static readonly List< GUIComponentMessageBoxes = new List<GUIComponent>()
 

Protected Member Functions

override void Update (float deltaTime)
 
- Protected Member Functions inherited from Barotrauma.GUIFrame
override void Draw (SpriteBatch spriteBatch)
 
- Protected Member Functions inherited from Barotrauma.GUIComponent
Rectangle ClampRect (Rectangle r)
 
 GUIComponent (string style, RectTransform rectT)
 This is the new constructor. More...
 
 GUIComponent (string style)
 
virtual Color GetColor (ComponentState state)
 
Color GetBlendedColor (Color targetColor, ref Color blendedColor)
 
virtual void SetAlpha (float a)
 

Properties

List< GUIButtonButtons = new List<GUIButton>() [get]
 
GUILayoutGroup Content [get]
 
GUIFrame InnerFrame [get]
 
GUITextBlock Header [get]
 
GUITextBlock Text [get]
 
Identifier Tag [get]
 
bool Closed [get]
 
GUIImage Icon [get]
 
ColorIconColor [get, set]
 
bool Draggable [get, set]
 
GUIImage BackgroundIcon [get]
 
bool FlashOnAutoCloseCondition [get, set]
 
Action OnEnterPressed [get, set]
 
Type MessageBoxType [get]
 
static GUIComponent VisibleBox [get]
 
- Properties inherited from Barotrauma.GUIFrame
float OutlineThickness [get, set]
 
- Properties inherited from Barotrauma.GUIComponent
GUIComponent Parent [get]
 
IEnumerable< GUIComponentChildren [get]
 
bool AutoUpdate = true [get, set]
 
bool AutoDraw = true [get, set]
 
int UpdateOrder [get, set]
 
bool Bounce [get, set]
 
bool GlowOnSelect [get, set]
 
Vector2 UVOffset [get, set]
 
virtual float FlashTimer [get]
 
bool IgnoreLayoutGroups [get, set]
 
virtual GUIFont Font [get, set]
 
virtual RichString ToolTip [get, set]
 
GUIComponentStyle Style [get]
 
bool Visible [get, set]
 
virtual bool Enabled [get, set]
 
Vector2 Center [get]
 
virtual Rectangle Rect [get]
 
bool ClampMouseRectToParent = false [get, set]
 
virtual Rectangle? MouseRect [get]
 
virtual Color OutlineColor [get, set]
 
virtual bool Selected [get, set]
 
virtual ComponentState State [get, set]
 
int CountChildren [get]
 
Color DefaultColor [get, set]
 Currently only used for the fade effect in GUIListBox, should be set to the same value as Color but only assigned once More...
 
virtual Color Color [get, set]
 
virtual Color HoverColor [get, set]
 
virtual Color SelectedColor [get, set]
 
virtual Color DisabledColor [get, set]
 
virtual Color PressedColor [get, set]
 
TransitionMode ColorTransition [get]
 
SpriteFallBackState FallBackState [get]
 
float SpriteCrossFadeTime [get]
 
float ColorCrossFadeTime [get]
 
virtual bool PlaySoundOnSelect = false [get, set]
 
RectTransform RectTransform [get]
 

Additional Inherited Members

- Protected Attributes inherited from Barotrauma.GUIComponent
Alignment alignment
 
Identifier[] styleHierarchy
 
Color color
 
Color hoverColor
 
Color selectedColor
 
Color disabledColor
 
Color pressedColor
 
Color flashColor
 
float flashDuration = 1.5f
 
float flashTimer
 
bool enabled
 
ComponentState _state
 
ComponentState _previousState
 
bool isSelected
 
Color _currentColor
 

Detailed Description

Definition at line 10 of file GUIMessageBox.cs.

Member Enumeration Documentation

◆ Type

Enumerator
Default 
InGame 
Vote 
Hint 
Tutorial 
Warning 

Definition at line 22 of file GUIMessageBox.cs.

Constructor & Destructor Documentation

◆ GUIMessageBox() [1/3]

Barotrauma.GUIMessageBox.GUIMessageBox ( LocalizedString  headerText,
LocalizedString  text,
Vector2?  relativeSize = null,
Point?  minSize = null,
Type  type = Type.Default 
)

Definition at line 91 of file GUIMessageBox.cs.

◆ GUIMessageBox() [2/3]

Barotrauma.GUIMessageBox.GUIMessageBox ( RichString  headerText,
RichString  text,
LocalizedString[]  buttons,
Vector2?  relativeSize = null,
Point?  minSize = null,
Alignment  textAlignment = Alignment.TopLeft,
Type  type = Type.Default,
string  tag = "",
Sprite  icon = null,
string  iconStyle = "",
Sprite  backgroundIcon = null,
Func< bool >  autoCloseCondition = null,
bool  hideCloseButton = false 
)

Definition at line 101 of file GUIMessageBox.cs.

◆ GUIMessageBox() [3/3]

Barotrauma.GUIMessageBox.GUIMessageBox ( Identifier  hintIdentifier,
LocalizedString  text,
Sprite  icon 
)

Use to create a message box of Hint type

Definition at line 452 of file GUIMessageBox.cs.

Member Function Documentation

◆ AddActiveToGUIUpdateList()

static void Barotrauma.GUIMessageBox.AddActiveToGUIUpdateList ( )
static

Definition at line 468 of file GUIMessageBox.cs.

◆ AddButton()

void Barotrauma.GUIMessageBox.AddButton ( RectTransform  rectT,
string  text,
GUIButton.OnClickedHandler  onClick 
)

Parent does not matter. It's overridden.

Definition at line 703 of file GUIMessageBox.cs.

◆ Close() [1/4]

void Barotrauma.GUIMessageBox.Close ( )

Definition at line 660 of file GUIMessageBox.cs.

◆ Close() [2/4]

bool Barotrauma.GUIMessageBox.Close ( GUIButton  button,
object  obj 
)

Definition at line 675 of file GUIMessageBox.cs.

◆ Close() [3/4]

static void Barotrauma.GUIMessageBox.Close ( Identifier  tag)
static

Definition at line 687 of file GUIMessageBox.cs.

◆ Close() [4/4]

static void Barotrauma.GUIMessageBox.Close ( string  tag)
static

◆ CloseAll()

static void Barotrauma.GUIMessageBox.CloseAll ( )
static

Definition at line 682 of file GUIMessageBox.cs.

◆ CreateLoadingBox()

static GUIMessageBox Barotrauma.GUIMessageBox.CreateLoadingBox ( LocalizedString  text,
(LocalizedString Label, Action< GUIMessageBox > Action)[]  buttons = null,
Vector2?  relativeSize = null 
)
static

Definition at line 709 of file GUIMessageBox.cs.

◆ SetBackgroundIcon()

void Barotrauma.GUIMessageBox.SetBackgroundIcon ( Sprite  icon)

Definition at line 506 of file GUIMessageBox.cs.

◆ Update()

override void Barotrauma.GUIMessageBox.Update ( float  deltaTime)
protectedvirtual

Reimplemented from Barotrauma.GUIComponent.

Definition at line 524 of file GUIMessageBox.cs.

Member Data Documentation

◆ AutoClose

bool Barotrauma.GUIMessageBox.AutoClose

Close the message box automatically after enough time has passed (inGameCloseTime)

Definition at line 69 of file GUIMessageBox.cs.

◆ DisplayInLoadingScreens

bool Barotrauma.GUIMessageBox.DisplayInLoadingScreens

Definition at line 42 of file GUIMessageBox.cs.

◆ DraggingPosition

Vector2 Barotrauma.GUIMessageBox.DraggingPosition = Vector2.Zero

Definition at line 61 of file GUIMessageBox.cs.

◆ MessageBoxes

readonly List<GUIComponent> Barotrauma.GUIMessageBox.MessageBoxes = new List<GUIComponent>()
static

Definition at line 13 of file GUIMessageBox.cs.

Property Documentation

◆ BackgroundIcon

GUIImage Barotrauma.GUIMessageBox.BackgroundIcon
get

Definition at line 63 of file GUIMessageBox.cs.

◆ Buttons

List<GUIButton> Barotrauma.GUIMessageBox.Buttons = new List<GUIButton>()
get

Definition at line 34 of file GUIMessageBox.cs.

◆ Closed

bool Barotrauma.GUIMessageBox.Closed
get

Definition at line 40 of file GUIMessageBox.cs.

◆ Content

GUILayoutGroup Barotrauma.GUIMessageBox.Content
get

Definition at line 35 of file GUIMessageBox.cs.

◆ Draggable

bool Barotrauma.GUIMessageBox.Draggable
getset

Definition at line 60 of file GUIMessageBox.cs.

◆ FlashOnAutoCloseCondition

bool Barotrauma.GUIMessageBox.FlashOnAutoCloseCondition
getset

Definition at line 83 of file GUIMessageBox.cs.

◆ Header

GUITextBlock Barotrauma.GUIMessageBox.Header
get

Definition at line 37 of file GUIMessageBox.cs.

◆ Icon

GUIImage Barotrauma.GUIMessageBox.Icon
get

Definition at line 44 of file GUIMessageBox.cs.

◆ IconColor

Color? Barotrauma.GUIMessageBox.IconColor
getset

Definition at line 50 of file GUIMessageBox.cs.

◆ InnerFrame

GUIFrame Barotrauma.GUIMessageBox.InnerFrame
get

Definition at line 36 of file GUIMessageBox.cs.

◆ MessageBoxType

Type Barotrauma.GUIMessageBox.MessageBoxType
get

Definition at line 87 of file GUIMessageBox.cs.

◆ OnEnterPressed

Action Barotrauma.GUIMessageBox.OnEnterPressed
getset

Definition at line 85 of file GUIMessageBox.cs.

◆ Tag

Identifier Barotrauma.GUIMessageBox.Tag
get

Definition at line 39 of file GUIMessageBox.cs.

◆ Text

GUITextBlock Barotrauma.GUIMessageBox.Text
get

Definition at line 38 of file GUIMessageBox.cs.

◆ VisibleBox

GUIComponent Barotrauma.GUIMessageBox.VisibleBox
staticget

Definition at line 89 of file GUIMessageBox.cs.