SpaceRTS - Starter Pack  1.3
GameBase.ComponentProxy Class Reference

Component class that does all the magic to store, index and return the important components from child GameObjects. More...

Inheritance diagram for GameBase.ComponentProxy:

Classes

class  ProxyData
 Contains all the data for each property More...
 

Public Member Functions

int AddEmptyElement ()
 Adds a new item at the end of the list with empty data in it. More...
 
void SetPropertyData (string propName, Component comp)
 Changes the Component reference for the requested property. if the name of the property doesn't exist then we add it. More...
 
void SetPropertyData (string propName, GameObject go)
 Changes the GameObject Reference for the requested property. also sets null in the component reference data. If the name of the property doesn't exist then we add it. More...
 
void ChangePropertyName (int index, string newName)
 Changes the name of the property at the requested index. More...
 
void RemoveAt (int index)
 Remove a property by index position. More...
 
void Remove (string propName)
 Remove a property by it name. More...
 
void ElementAt (int index, out ProxyData dataOut)
 Returns the property data located at index . More...
 
bool HasProperty (string propName)
 Returns true if there is a property registered with the name propName . More...
 
GetPropertyValue< T > (string propName)
 Return an already casted component registered by the propName More...
 
IEnumerable< T > GetAllPropertyValues< T > (string startsWith)
 Similar to GetPropertyValue() but returns a IEnumerable of type T of all properties that match the start of its name with startsWith and are casteable to T type. More...
 
Component GetPropertyValue (string propName)
 Returns a component registered by the propName More...
 
GameObject GetPropertyGameObject (string propName)
 Returns the GameObject that belongs to the property propName . More...
 
GetPropertyValueAt< T > (int index)
 Return an already casted component at the index position. More...
 
GameObject GetPropertyGameObjectAt (int index)
 Returns the GameObject that belongs to the property index . More...
 
void OnBeforeSerialize ()
 Implementation of the method in ISerializationCallbackReceiver. We don't need to do anything here but we can't remove this method. More...
 
void OnAfterDeserialize ()
 Implementation of the method in ISerializationCallbackReceiver that allows us to rebuild the property names dictionary after scripts reloading. More...
 

Properties

int ElementsCount [get]
 Returns the quantity of registered elements. More...
 

Detailed Description

Component class that does all the magic to store, index and return the important components from child GameObjects.

Member Function Documentation

◆ AddEmptyElement()

int GameBase.ComponentProxy.AddEmptyElement ( )

Adds a new item at the end of the list with empty data in it.

Returns
The index of the last property added.

◆ ChangePropertyName()

void GameBase.ComponentProxy.ChangePropertyName ( int  index,
string  newName 
)

Changes the name of the property at the requested index.

Parameters
indexIndex of the property to change
newNameThe new name of the property

◆ ElementAt()

void GameBase.ComponentProxy.ElementAt ( int  index,
out ProxyData  dataOut 
)

Returns the property data located at index .

Parameters
indexIndex of the property to return its data.
dataOutData structure that will be filled with the property requested.

◆ GetAllPropertyValues< T >()

IEnumerable<T> GameBase.ComponentProxy.GetAllPropertyValues< T > ( string  startsWith)

Similar to GetPropertyValue() but returns a IEnumerable of type T of all properties that match the start of its name with startsWith and are casteable to T type.

Template Parameters
T
Parameters
startsWith
Returns
A IEnumerable interface of type T with all the matched results.
Type Constraints
T :Component 

◆ GetPropertyGameObject()

GameObject GameBase.ComponentProxy.GetPropertyGameObject ( string  propName)

Returns the GameObject that belongs to the property propName .

Parameters
propNameName of the property to find.
Returns
The reference to the GameObject found, or null on fail.

◆ GetPropertyGameObjectAt()

GameObject GameBase.ComponentProxy.GetPropertyGameObjectAt ( int  index)

Returns the GameObject that belongs to the property index .

Parameters
indexindex of the property to find.
Returns
The reference to the GameObject found, or null on fail.

◆ GetPropertyValue()

Component GameBase.ComponentProxy.GetPropertyValue ( string  propName)

Returns a component registered by the propName

Parameters
propNameName of requested property.
Returns
The Component requested by propName or null if not found.

◆ GetPropertyValue< T >()

T GameBase.ComponentProxy.GetPropertyValue< T > ( string  propName)

Return an already casted component registered by the propName

Template Parameters
TObject type to return. T must inherit from Component.
Parameters
propNameName of requested property.
Returns
The Cast of the component requested by propName or null if not found.
Type Constraints
T :Component 

◆ GetPropertyValueAt< T >()

T GameBase.ComponentProxy.GetPropertyValueAt< T > ( int  index)

Return an already casted component at the index position.

Template Parameters
TObject type to return. T must inherit from Component.
Parameters
indexIndex position of requested property.
Returns
The Cast of the component requested by index or null if not found.
Type Constraints
T :Component 

◆ HasProperty()

bool GameBase.ComponentProxy.HasProperty ( string  propName)

Returns true if there is a property registered with the name propName .

Parameters
propName
Returns

◆ OnAfterDeserialize()

void GameBase.ComponentProxy.OnAfterDeserialize ( )

Implementation of the method in ISerializationCallbackReceiver that allows us to rebuild the property names dictionary after scripts reloading.

◆ OnBeforeSerialize()

void GameBase.ComponentProxy.OnBeforeSerialize ( )

Implementation of the method in ISerializationCallbackReceiver. We don't need to do anything here but we can't remove this method.

◆ Remove()

void GameBase.ComponentProxy.Remove ( string  propName)

Remove a property by it name.

Parameters
propNameName of the property to remove.

◆ RemoveAt()

void GameBase.ComponentProxy.RemoveAt ( int  index)

Remove a property by index position.

Parameters
indexThe index position of the property to remove.

◆ SetPropertyData() [1/2]

void GameBase.ComponentProxy.SetPropertyData ( string  propName,
Component  comp 
)

Changes the Component reference for the requested property. if the name of the property doesn't exist then we add it.

Parameters
propNameName of the property to change
compComponent reference to setup

◆ SetPropertyData() [2/2]

void GameBase.ComponentProxy.SetPropertyData ( string  propName,
GameObject  go 
)

Changes the GameObject Reference for the requested property. also sets null in the component reference data. If the name of the property doesn't exist then we add it.

Parameters
propNameName of the property to change
goGameObject reference to setup

Property Documentation

◆ ElementsCount

int GameBase.ComponentProxy.ElementsCount
get

Returns the quantity of registered elements.