Show / Hide Table of Contents

Class Element

The main Element class representing an OO version of MTA elements

Inheritance
Object
Element
PhysicalElement
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Slipe.Shared.Elements
Assembly: SlipeShared.dll
Syntax
[DefaultElementClass(ElementType.Element)]
public class Element

Constructors

| Improve this Doc View Source

Element()

Declaration
public Element()
| 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
Type Name Description
String elementType
String elementID

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
Type Description
Boolean
| 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
Type Description
Int32
| Improve this Doc View Source

Exists

Returns whether or not the element still exists.

Declaration
public bool Exists { get; }
Property Value
Type Description
Boolean
| 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
Type Description
String
| 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
Type Description
Element
| Improve this Doc View Source

Root

Get the root element

Declaration
public static Element Root { get; }
Property Value
Type Description
Element
| Improve this Doc View Source

Type

Get the type of the element

Declaration
public string Type { get; }
Property Value
Type Description
String

Methods

| Improve this Doc View Source

Destroy()

Destroys the element

Declaration
public virtual bool Destroy()
Returns
Type Description
Boolean
| 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
Type Name Description
String id
Int32 index
Returns
Type Description
Element
| 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
Type Description
Element
| 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
Type Description
Element[]
| Improve this Doc View Source

GetData(String, Boolean)

Gets element data

Declaration
public dynamic GetData(string key, bool inherit = false)
Parameters
Type Name Description
String key
Boolean inherit
Returns
Type Description
Object
| Improve this Doc View Source

GetData<T>(String, Boolean)

Gets element data

Declaration
public T GetData<T>(string key, bool inherit = false)
Parameters
Type Name Description
String key
Boolean inherit
Returns
Type Description
T
Type Parameters
Name Description
T
| 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
Type Name Description
String eventName
Slipe.MtaDefinitions.MtaElement source
Object p1
Object p2
Object p3
Object p4
Object p5
Object p6
Object p7
Object p8
| 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
Type Name Description
String eventName
Boolean propagated
String priorty
| Improve this Doc View Source

SetData(String, Object, Boolean)

Sets element data

Declaration
public void SetData(string key, dynamic value, bool synchronize = false)
Parameters
Type Name Description
String key
Object value
Boolean synchronize
| 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
Name Description
T

Events

| Improve this Doc View Source

OnDestroy

Declaration
public event Element.OnDestroyHandler OnDestroy
Event Type
Type Description
Element.OnDestroyHandler

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
Type Description
Element
  • Improve this Doc
  • View Source
Back to top Generated by DocFX