Class Element
The main Element class representing an OO version of MTA elements
Assembly: SlipeShared.dll
Syntax
[DefaultElementClass(ElementType.Element)]
public class Element
Constructors
|
Improve this Doc
View Source
Element()
Declaration
|
Improve this Doc
View Source
Element(String, String)
Create a dummy element in the element tree
Declaration
public Element(string elementType, string elementID = null)
Parameters
Fields
|
Improve this Doc
View Source
element
Declaration
protected MtaElement element
Field Value
Type |
Description |
Slipe.MtaDefinitions.MtaElement |
|
Properties
|
Improve this Doc
View Source
CallPropagationEnabled
This function enables/disables call propagation on a certain element down to its children
Declaration
public bool CallPropagationEnabled { get; set; }
Property Value
|
Improve this Doc
View Source
ChildCount
Get the number of children an element has. Note that only the direct children are counted and not elements that are further down the element tree.
Declaration
public int ChildCount { get; }
Property Value
|
Improve this Doc
View Source
Exists
Returns whether or not the element still exists.
Declaration
public bool Exists { get; }
Property Value
|
Improve this Doc
View Source
ID
This function gets the ID of an element. This is the "id" attribute of the element and is a string, NOT a number like a model ID, weapons ID or similar.
Declaration
public string ID { get; set; }
Property Value
|
Improve this Doc
View Source
MTAElement
Get the MTAElement instance of this class instance
Declaration
public MtaElement MTAElement { get; }
Property Value
Type |
Description |
Slipe.MtaDefinitions.MtaElement |
|
|
Improve this Doc
View Source
Parent
Get and set the parent of this element
Declaration
public Element Parent { get; set; }
Property Value
|
Improve this Doc
View Source
Root
Declaration
public static Element Root { get; }
Property Value
|
Improve this Doc
View Source
Type
Get the type of the element
Declaration
public string Type { get; }
Property Value
Methods
|
Improve this Doc
View Source
Destroy()
Declaration
public virtual bool Destroy()
Returns
|
Improve this Doc
View Source
GetByID(String, Int32)
This function returns an element from the specified ID. If more than one element with the same ID exists, only the first one in the order it appears in the XML tree will be returned by this function.
Declaration
public static Element GetByID(string id, int index = 0)
Parameters
Returns
|
Improve this Doc
View Source
GetChild(Int32)
This function returns one of the child elements of a given parent element. The child element is selected by its index (0 for the first child, 1 for the second and so on).
Declaration
public Element GetChild(int index = 0)
Parameters
Type |
Name |
Description |
Int32 |
index |
|
Returns
|
Improve this Doc
View Source
GetChildren(String)
This function is used to retrieve a list of the child elements of a given parent element. Note that it will only return direct children and not elements that are further down the element tree.
Declaration
public Element[] GetChildren(string ofType = null)
Parameters
Type |
Name |
Description |
String |
ofType |
|
Returns
|
Improve this Doc
View Source
GetData(String, Boolean)
Declaration
public dynamic GetData(string key, bool inherit = false)
Parameters
Returns
|
Improve this Doc
View Source
GetData<T>(String, Boolean)
Declaration
public T GetData<T>(string key, bool inherit = false)
Parameters
Returns
Type Parameters
|
Improve this Doc
View Source
HandleEvent(String, MtaElement, Object, Object, Object, Object, Object, Object, Object, Object)
Declaration
public virtual void HandleEvent(string eventName, MtaElement source, object p1, object p2, object p3, object p4, object p5, object p6, object p7, object p8)
Parameters
|
Improve this Doc
View Source
ListenForEvent(String, Boolean, String)
Adds an eventhandler to this element
Declaration
public void ListenForEvent(string eventName, bool propagated = true, string priorty = "normal")
Parameters
|
Improve this Doc
View Source
SetData(String, Object, Boolean)
Declaration
public void SetData(string key, dynamic value, bool synchronize = false)
Parameters
|
Improve this Doc
View Source
TryGetData(String, out Object, Boolean)
This function tries to retrieve the data value and returns true if this was succesful
Declaration
public bool TryGetData(string key, out dynamic data, bool inherit = false)
Parameters
Type |
Name |
Description |
String |
key |
The key at which data is stored
|
Object |
data |
The string to which to write the data to
|
Boolean |
inherit |
|
Returns
Type |
Description |
Boolean |
True if the data was succesfully retrieved, false otherwise
|
|
Improve this Doc
View Source
TryGetData<T>(String, out T, Boolean)
This function tries to retrieve the data value and returns true if this was succesful
Declaration
public bool TryGetData<T>(string key, out T data, bool inherit = false)
Parameters
Type |
Name |
Description |
String |
key |
The key at which data is stored
|
T |
data |
The string to which to write the data to
|
Boolean |
inherit |
|
Returns
Type |
Description |
Boolean |
True if the data was succesfully retrieved, false otherwise
|
Type Parameters
Events
|
Improve this Doc
View Source
OnDestroy
Declaration
public event Element.OnDestroyHandler OnDestroy
Event Type
Operators
|
Improve this Doc
View Source
Explicit(MtaElement to Element)
gets Slipe Element from Mta element
Declaration
public static explicit operator Element(MtaElement mtaElement)
Parameters
Type |
Name |
Description |
Slipe.MtaDefinitions.MtaElement |
mtaElement |
|
Returns