tModLoader v2024.03
A mod to make and play Terraria mods
UIAsyncList< TResource, TUIElement > Class Template Referenceabstract

Inherits UIList.

Public Member Functions

void Cancel ()
 
virtual string GetEndItemText ()
 
override void OnInitialize ()
 
void SetEnumerable (IAsyncEnumerable< TResource > enumerable=null)
 
void SetProvider (AsyncProvider< TResource > provider=null)
 
delegate void StateDelegate (AsyncProviderState state)
 
delegate void StateDelegateWithException (AsyncProviderState state, Exception e)
 
override void Update (GameTime gameTime)
 
- Public Member Functions inherited from UIList
virtual void Add (UIElement item)
 
virtual void AddRange (IEnumerable< UIElement > items)
 
virtual void Clear ()
 
delegate bool ElementSearchMethod (UIElement element)
 
IEnumerator< UIElementGetEnumerator ()
 
override List< SnapPointGetSnapPoints ()
 
float GetTotalHeight ()
 
void Goto (ElementSearchMethod searchMethod)
 
override void MouseOver (UIMouseEvent evt)
 
override void Recalculate ()
 
override void RecalculateChildren ()
 
virtual bool Remove (UIElement item)
 
override void ScrollWheel (UIScrollWheelEvent evt)
 
void SetScrollbar (UIScrollbar scrollbar)
 
int SortMethod (UIElement item1, UIElement item2)
 
void UpdateOrder ()
 
- Public Member Functions inherited from UIElement
void Activate ()
 
void Append (UIElement element)
 
virtual int CompareTo (object obj)
 
virtual bool ContainsPoint (Vector2 point)
 
void CopyStyle (UIElement element)
 
void Deactivate ()
 
virtual void Draw (SpriteBatch spriteBatch)
 
void DrawDebugHitbox (BasicDebugDrawer drawer, float colorIntensity=0f)
 
delegate void ElementEvent (UIElement affectedElement)
 
virtual void ExecuteRecursively (UIElementAction action)
 
Rectangle GetClippingRectangle (SpriteBatch spriteBatch)
 
CalculatedStyle GetDimensions ()
 
UIElement GetElementAt (Vector2 point)
 
CalculatedStyle GetInnerDimensions ()
 
CalculatedStyle GetOuterDimensions ()
 
bool GetSnapPoint (out SnapPoint point)
 
virtual List< SnapPointGetSnapPoints ()
 
virtual Rectangle GetViewCullingArea ()
 
bool HasChild (UIElement child)
 
void Initialize ()
 
virtual void LeftClick (UIMouseEvent evt)
 
virtual void LeftDoubleClick (UIMouseEvent evt)
 
virtual void LeftMouseDown (UIMouseEvent evt)
 
virtual void LeftMouseUp (UIMouseEvent evt)
 
virtual void MiddleClick (UIMouseEvent evt)
 
virtual void MiddleDoubleClick (UIMouseEvent evt)
 
virtual void MiddleMouseDown (UIMouseEvent evt)
 
virtual void MiddleMouseUp (UIMouseEvent evt)
 
delegate void MouseEvent (UIMouseEvent evt, UIElement listeningElement)
 
virtual void MouseOut (UIMouseEvent evt)
 
virtual void MouseOver (UIMouseEvent evt)
 
virtual void OnActivate ()
 
virtual void OnDeactivate ()
 
virtual void OnInitialize ()
 
virtual void Recalculate ()
 
virtual void RecalculateChildren ()
 
void Remove ()
 
void RemoveAllChildren ()
 
void RemoveChild (UIElement child)
 
virtual void RightClick (UIMouseEvent evt)
 
virtual void RightDoubleClick (UIMouseEvent evt)
 
virtual void RightMouseDown (UIMouseEvent evt)
 
virtual void RightMouseUp (UIMouseEvent evt)
 
virtual void ScrollWheel (UIScrollWheelEvent evt)
 
delegate void ScrollWheelEvent (UIScrollWheelEvent evt, UIElement listeningElement)
 
void SetPadding (float pixels)
 
void SetSnapPoint (string name, int id, Vector2? anchor=null, Vector2? offset=null)
 
delegate void UIElementAction (UIElement element)
 
virtual void Update (GameTime gameTime)
 
virtual void XButton1Click (UIMouseEvent evt)
 
virtual void XButton1DoubleClick (UIMouseEvent evt)
 
virtual void XButton1MouseDown (UIMouseEvent evt)
 
virtual void XButton1MouseUp (UIMouseEvent evt)
 
virtual void XButton2Click (UIMouseEvent evt)
 
virtual void XButton2DoubleClick (UIMouseEvent evt)
 
virtual void XButton2MouseDown (UIMouseEvent evt)
 
virtual void XButton2MouseUp (UIMouseEvent evt)
 

Protected Member Functions

abstract TUIElement GenElement (TResource resource)
 
- Protected Member Functions inherited from UIList
override void DrawSelf (SpriteBatch spriteBatch)
 
- Protected Member Functions inherited from UIElement
virtual void DrawChildren (SpriteBatch spriteBatch)
 
virtual void DrawSelf (SpriteBatch spriteBatch)
 

Properties

IEnumerable< TUIElement > ReceivedItems [get]
 
AsyncProviderState State = AsyncProviderState.Completed [get]
 
- Properties inherited from UIList
int Count [get]
 
float ViewPosition [get, set]
 
- Properties inherited from UIElement
IEnumerable< UIElementChildren [get]
 
bool IsMouseHovering [get]
 
UIElement Parent [get]
 
int UniqueId [get]
 

Events

StateDelegateWithException OnFinished
 
StateDelegate OnStartLoading
 
- Events inherited from UIElement
MouseEvent OnLeftClick
 
MouseEvent OnLeftDoubleClick
 
MouseEvent OnLeftMouseDown
 
MouseEvent OnLeftMouseUp
 
MouseEvent OnMiddleClick
 
MouseEvent OnMiddleDoubleClick
 
MouseEvent OnMiddleMouseDown
 
MouseEvent OnMiddleMouseUp
 
MouseEvent OnMouseOut
 
MouseEvent OnMouseOver
 
MouseEvent OnRightClick
 
MouseEvent OnRightDoubleClick
 
MouseEvent OnRightMouseDown
 
MouseEvent OnRightMouseUp
 
ScrollWheelEvent OnScrollWheel
 
ElementEvent OnUpdate
 
MouseEvent OnXButton1Click
 
MouseEvent OnXButton1DoubleClick
 
MouseEvent OnXButton1MouseDown
 
MouseEvent OnXButton1MouseUp
 
MouseEvent OnXButton2Click
 
MouseEvent OnXButton2DoubleClick
 
MouseEvent OnXButton2MouseDown
 
MouseEvent OnXButton2MouseUp
 

Additional Inherited Members

- Public Attributes inherited from UIList
List< UIElement_items = new List<UIElement>()
 
float ListPadding = 5f
 
Action< List< UIElement > > ManualSortMethod
 
- Public Attributes inherited from UIElement
float HAlign
 
StyleDimension Height
 
bool IgnoresMouseInteraction
 
StyleDimension Left
 
float MarginBottom
 
float MarginLeft
 
float MarginRight
 
float MarginTop
 
StyleDimension MaxHeight = StyleDimension.Fill
 
StyleDimension MaxWidth = StyleDimension.Fill
 
StyleDimension MinHeight = StyleDimension.Empty
 
StyleDimension MinWidth = StyleDimension.Empty
 
bool OverflowHidden
 
SamplerState OverrideSamplerState
 
float PaddingBottom
 
float PaddingLeft
 
float PaddingRight
 
float PaddingTop
 
StyleDimension Top
 
bool UseImmediateMode
 
float VAlign
 
StyleDimension Width
 
- Protected Attributes inherited from UIList
UIScrollbar _scrollbar
 
- Protected Attributes inherited from UIElement
readonly List< UIElementElements = new List<UIElement>()
 

Detailed Description

Remember to set GenElement is not provided in the constructor and TResource is not a TUIElement. DO NOT USE Add/AddRange directly, always use the provider methods.

Type Constraints
TUIElement :UIElement 

Member Function Documentation

◆ OnInitialize()

override void UIAsyncList< TResource, TUIElement >.OnInitialize ( )
virtual

Reimplemented from UIElement.

◆ SetProvider()

void UIAsyncList< TResource, TUIElement >.SetProvider ( AsyncProvider< TResource >  provider = null)

SetProvider will delegate all UI actions to next Update, so it NOT SAFE to be called out of the main thread, because having an assignment to ProviderChanged it CAN cause problems in case the list is cleared before the provider is swapped and the old provider is partially read giving unwanted elements, same if you do the other way around (the provider can be partially consumed before the clear)

◆ Update()

override void UIAsyncList< TResource, TUIElement >.Update ( GameTime  gameTime)
virtual

Reimplemented from UIElement.