Class DynamicVariableExtensions
- Namespace
- MonkeyLoader.Resonite
- Assembly
- MonkeyLoader.Resonite.Integration.dll
Contains extension methods related to FrooxEngine.DynamicVariableSpaces and their variables.
public static class DynamicVariableExtensions
- Inheritance
-
DynamicVariableExtensions
- Inherited Members
Methods
CreateSpace(Slot, string?, bool)
Attaches a FrooxEngine.DynamicVariableSpace component to this slot with
the given spaceName and optionally enables
OnlyDirectBinding.
public static DynamicVariableSpace CreateSpace(this Slot slot, string? spaceName, bool onlyDirectBinding = false)
Parameters
slotSlotThe slot to create the component on.
spaceNamestringThe name for the created space.
onlyDirectBindingboolWhether only variables with a matching space name should bind to the created space.
Returns
- DynamicVariableSpace
The created FrooxEngine.DynamicVariableSpace component.
FindOrCreateSpace(Slot, string?, bool)
Searches for
a FrooxEngine.DynamicVariableSpace with the given spaceName
that covers this slot, or attaches one to it with the given parameters.
public static DynamicVariableSpace FindOrCreateSpace(this Slot slot, string? spaceName, bool onlyDirectBinding = false)
Parameters
slotSlotThe slot to create the component on.
spaceNamestringThe name for the created space.
onlyDirectBindingboolWhether only variables with a matching space name should bind to the created space.
Returns
- DynamicVariableSpace
The found or attached FrooxEngine.DynamicVariableSpace.
Remarks
The found FrooxEngine.DynamicVariableSpace's OnlyDirectBinding option may differ from the supplied value.
GetAvailableSpaces(Slot, Predicate<DynamicVariableSpace>?)
Gets all FrooxEngine.DynamicVariableSpaces that apply to this FrooxEngine.Slot.
Optionally includes only those that pass through the filter.
public static IEnumerable<DynamicVariableSpace> GetAvailableSpaces(this Slot slot, Predicate<DynamicVariableSpace>? filter = null)
Parameters
slotSlotThe FrooxEngine.Slot to find all applicable FrooxEngine.DynamicVariableSpaces for.
filterPredicate<DynamicVariableSpace>The optional predicate to apply to the returned
Returns
- IEnumerable<DynamicVariableSpace>
All FrooxEngine.DynamicVariableSpace that apply to this FrooxEngine.Slot and optionally pass the
filter.
Remarks
This function is different from a regular
FrooxEngine.Slot.GetComponentsInParents<FrooxEngine.DynamicVariableSpace>()
call,
as it considers that FrooxEngine.DynamicVariableSpaces deeper in the hierarchy
hide ones higher up with the same name.
If a FrooxEngine.DynamicVariableSpace deeper in the hierarchy doesn't pass the filter,
it will still hide any higher up ones with the same name
that might pass it, because they don't apply to this FrooxEngine.Slot.
GetAvailableVariableIdentities(Slot)
Gets all full Dynamic Variable identities that apply to this FrooxEngine.Slot
public static IEnumerable<DynamicVariableIdentity> GetAvailableVariableIdentities(this Slot slot)
Parameters
slotSlotThe FrooxEngine.Slot to find all applicable full Dynamic Variable identities for.
Returns
- IEnumerable<DynamicVariableIdentity>
All full Dynamic Variable identities that apply to this FrooxEngine.Slot.
Remarks
This function uses
FrooxEngine.DynamicVariableSpace.GetAvailableSpaces(),
which is different from a regular
FrooxEngine.Slot.GetComponentsInParents<FrooxEngine.DynamicVariableSpace>()
call,
as it considers that FrooxEngine.DynamicVariableSpaces deeper in the hierarchy
hide ones higher up with the same name.
GetAvailableVariableIdentities(Slot, string)
Gets all full Dynamic Variable
identities that apply to this FrooxEngine.Slot,
which match the given name.
public static IEnumerable<DynamicVariableIdentity> GetAvailableVariableIdentities(this Slot slot, string name)
Parameters
slotSlotThe FrooxEngine.Slot to find all applicable full Dynamic Variable identities for.
namestringThe name that the variable identities must have.
Returns
- IEnumerable<DynamicVariableIdentity>
All full Dynamic Variable identities that apply to this FrooxEngine.Slot that have the given
name.
Remarks
This function uses
FrooxEngine.DynamicVariableSpace.GetAvailableSpaces(),
which is different from a regular
FrooxEngine.Slot.GetComponentsInParents<FrooxEngine.DynamicVariableSpace>()
call,
as it considers that FrooxEngine.DynamicVariableSpaces deeper in the hierarchy
hide ones higher up with the same name.
GetAvailableVariableIdentities(Slot, Type)
Gets all full Dynamic Variable identities that apply to this FrooxEngine.Slot, which can be assigned a value of the given Type.
public static IEnumerable<DynamicVariableIdentity> GetAvailableVariableIdentities(this Slot slot, Type type)
Parameters
slotSlotThe FrooxEngine.Slot to find all applicable full Dynamic Variable identities for.
typeTypeThe type that must be assignable to the variables.
Returns
- IEnumerable<DynamicVariableIdentity>
All full Dynamic Variable identities that apply to this FrooxEngine.Slot that the given Type can be assigned to.
Remarks
This function uses
FrooxEngine.DynamicVariableSpace.GetAvailableSpaces(),
which is different from a regular
FrooxEngine.Slot.GetComponentsInParents<FrooxEngine.DynamicVariableSpace>()
call,
as it considers that FrooxEngine.DynamicVariableSpaces deeper in the hierarchy
hide ones higher up with the same name.
GetAvailableVariableIdentities<T>(Slot)
Gets all full Dynamic Variable
identities that apply to this FrooxEngine.Slot,
which can be assigned a value of type T.
public static IEnumerable<DynamicVariableIdentity> GetAvailableVariableIdentities<T>(this Slot slot)
Parameters
slotSlotThe FrooxEngine.Slot to find all applicable full Dynamic Variable identities for.
Returns
- IEnumerable<DynamicVariableIdentity>
All full Dynamic Variable identities that apply to this FrooxEngine.Slot that
Tcan be assigned to.
Type Parameters
TThe type that must be assignable to the variables.
Remarks
This function uses
FrooxEngine.DynamicVariableSpace.GetAvailableSpaces(),
which is different from a regular
FrooxEngine.Slot.GetComponentsInParents<FrooxEngine.DynamicVariableSpace>()
call,
as it considers that FrooxEngine.DynamicVariableSpaces deeper in the hierarchy
hide ones higher up with the same name.
GetHandler<T>(IDynamicVariable<T>)
Gets the FrooxEngine.DynamicVariableHandler<T> of this dynamic variable.
public static DynamicVariableHandler<T> GetHandler<T>(this IDynamicVariable<T> dynamicVariable)
Parameters
dynamicVariableIDynamicVariable<T>The dynamic variable of which to get the FrooxEngine.DynamicVariableHandler<T>.
Returns
- DynamicVariableHandler<T>
The FrooxEngine.DynamicVariableHandler<T> of this dynamic variable.
Type Parameters
T
Exceptions
- NullReferenceException
When the FrooxEngine.DynamicVariableHandler<T> of this dynamic variable could not be found.
GetLinkedSpace(IDynamicVariable)
Gets the FrooxEngine.DynamicVariableSpace that this dynamic variable is linked to.
public static DynamicVariableSpace GetLinkedSpace(this IDynamicVariable dynamicVariable)
Parameters
dynamicVariableIDynamicVariableThe dynamic variable of which to get the linked FrooxEngine.DynamicVariableSpace.
Returns
- DynamicVariableSpace
The FrooxEngine.DynamicVariableSpace that this dynamic variable is linked to.
Exceptions
- NullReferenceException
When this dynamic variable is not linked to a FrooxEngine.DynamicVariableSpace or it could not be found.
GetLinkedVariables(DynamicVariableSpace, Predicate<IDynamicVariable>?, bool, bool, Predicate<Slot>?)
Gets all dynamic variable components linked to this FrooxEngine.DynamicVariableSpace that fulfill the given conditions.
public static IEnumerable<IDynamicVariable> GetLinkedVariables(this DynamicVariableSpace space, Predicate<IDynamicVariable>? filter = null, bool includeLocal = false, bool excludeDisabled = false, Predicate<Slot>? slotFilter = null)
Parameters
spaceDynamicVariableSpaceThe dynamic variable space to get the linked variables of.
filterPredicate<IDynamicVariable>A predicate to filter the linked variables returned; or
nullfor all.includeLocalboolWhether to include local FrooxEngine.Slots in the search.
excludeDisabledboolWhether to exclude disabled components from the results.
slotFilterPredicate<Slot>A predicate to filter the FrooxEngine.Slots included in the search; or
nullfor all.
The children of excluded FrooxEngine.Slots are excluded as well.
Returns
- IEnumerable<IDynamicVariable>
The dynamic variable components linked to this FrooxEngine.DynamicVariableSpace that fulfill the given conditions.
GetLinkedVariables<T>(DynamicVariableSpace, Predicate<IDynamicVariable<T>>?, bool, bool, Predicate<Slot>?)
Gets all dynamic variable components linked to this FrooxEngine.DynamicVariableSpace that fulfill the given conditions.
public static IEnumerable<IDynamicVariable<T>> GetLinkedVariables<T>(this DynamicVariableSpace space, Predicate<IDynamicVariable<T>>? filter = null, bool includeLocal = false, bool excludeDisabled = false, Predicate<Slot>? slotFilter = null)
Parameters
spaceDynamicVariableSpaceThe dynamic variable space to get the linked variables of.
filterPredicate<IDynamicVariable<T>>A predicate to filter the linked variables returned; or
nullfor all.includeLocalboolWhether to include local FrooxEngine.Slots in the search.
excludeDisabledboolWhether to exclude disabled components from the results.
slotFilterPredicate<Slot>A predicate to filter the FrooxEngine.Slots included in the search; or
nullfor all.
The children of excluded FrooxEngine.Slots are excluded as well.
Returns
- IEnumerable<IDynamicVariable<T>>
The dynamic variable components linked to this FrooxEngine.DynamicVariableSpace that fulfill the given conditions.
Type Parameters
TThe type of the values of the dynamic variables.
GetSyncWithVariable(SyncType, string, bool, bool)
Searches for a FrooxEngine.DynamicTypeField targetting this Type field
and exposing it with the given variable name on the nearest Slot,
or attaches one with the given parameters to it.
public static DynamicTypeField GetSyncWithVariable(this SyncType typeField, string variable, bool setupReset = false, bool forceCurrentValue = false)
Parameters
typeFieldSyncTypeThe Type field targetted by the FrooxEngine.DynamicTypeField.
variablestringThe VariableName of the FrooxEngine.DynamicTypeField.
setupResetboolWhether to also attach a FrooxEngine.DynamicValueVariableReset<T> with the current Type for load, paste, and duplicate.
forceCurrentValueboolWhether to force the FrooxEngine.DynamicVariableSpace's Type for the variable to the references's current Type when attaching a FrooxEngine.DynamicTypeField.
Returns
- DynamicTypeField
The found or attached FrooxEngine.DynamicTypeField.
GetSyncWithVariable<T>(IField<T>, string, bool, bool)
Searches for a FrooxEngine.DynamicField<T> targetting this field
and exposing it with the given variable name on the nearest Slot,
or attaches one with the given parameters to it.
public static DynamicField<T> GetSyncWithVariable<T>(this IField<T> field, string variable, bool setupReset = false, bool forceCurrentValue = false)
Parameters
fieldIField<T>The field targetted by the FrooxEngine.DynamicField<T>.
variablestringThe VariableName of the FrooxEngine.DynamicField<T>.
setupResetboolWhether to also attach a FrooxEngine.DynamicValueVariableReset<T> with the current value for load, paste, and duplicate.
forceCurrentValueboolWhether to force the FrooxEngine.DynamicVariableSpace's value for the variable to the field's current value when attaching a FrooxEngine.DynamicField<T>.
Returns
- DynamicField<T>
The found or attached FrooxEngine.DynamicField<T>.
Type Parameters
TThe type of the field's value.
GetSyncWithVariable<T>(SyncRef<T>, string, bool, bool)
Searches for a FrooxEngine.DynamicReference<T> targetting this reference
and exposing it with the given variable name on the nearest Slot,
or attaches one with the given parameters to it.
public static DynamicReference<T> GetSyncWithVariable<T>(this SyncRef<T> reference, string variable, bool setupReset = false, bool forceCurrentValue = false) where T : class, IWorldElement
Parameters
referenceSyncRef<T>The reference targetted by the FrooxEngine.DynamicReference<T>.
variablestringThe VariableName of the FrooxEngine.DynamicReference<T>.
setupResetboolWhether to also attach a FrooxEngine.DynamicValueVariableReset<T> with the current target for load, paste, and duplicate.
forceCurrentValueboolWhether to force the FrooxEngine.DynamicVariableSpace's target for the variable to the references's current target when attaching a FrooxEngine.DynamicReference<T>.
Returns
- DynamicReference<T>
The found or attached FrooxEngine.DynamicReference<T>.
Type Parameters
TThe type of the reference's target.
GetVariableIdentities(DynamicVariableSpace)
Gets all full Dynamic Variable identities that are associated with this FrooxEngine.DynamicVariableSpace.
public static IEnumerable<DynamicVariableIdentity> GetVariableIdentities(this DynamicVariableSpace space)
Parameters
spaceDynamicVariableSpaceThe FrooxEngine.DynamicVariableSpace to get all the variable identities of.
Returns
- IEnumerable<DynamicVariableIdentity>
All full Dynamic Variable identities associated with this
space.
GetVariableIdentities(DynamicVariableSpace, string)
Gets all full Dynamic Variable identities
that are associated with this FrooxEngine.DynamicVariableSpace,
which match the given name.
public static IEnumerable<DynamicVariableIdentity> GetVariableIdentities(this DynamicVariableSpace space, string name)
Parameters
spaceDynamicVariableSpaceThe FrooxEngine.DynamicVariableSpace to get all the variable identities of.
namestringThe name that the variable identities must have.
Returns
- IEnumerable<DynamicVariableIdentity>
All full Dynamic Variable identities associated with this
spacethat have the givenname.
GetVariableIdentities(DynamicVariableSpace, Type)
Gets all full Dynamic Variable identities that are associated with this FrooxEngine.DynamicVariableSpace, which can be assigned a value of the given Type.
public static IEnumerable<DynamicVariableIdentity> GetVariableIdentities(this DynamicVariableSpace space, Type type)
Parameters
spaceDynamicVariableSpaceThe FrooxEngine.DynamicVariableSpace to get all the variable identities of.
typeTypeThe type that must be assignable to the variables.
Returns
- IEnumerable<DynamicVariableIdentity>
All full Dynamic Variable identities associated with this
spacethat the given Type can be assigned to.
GetVariableIdentities<T>(DynamicVariableSpace)
Gets all full Dynamic Variable identities
that are associated with this FrooxEngine.DynamicVariableSpace,
which can be assigned a value of type T.
public static IEnumerable<DynamicVariableIdentity> GetVariableIdentities<T>(this DynamicVariableSpace space)
Parameters
spaceDynamicVariableSpaceThe FrooxEngine.DynamicVariableSpace to get all the variable identities of.
Returns
- IEnumerable<DynamicVariableIdentity>
All full Dynamic Variable identities associated with this
spacethatTcan be assigned to.
Type Parameters
TThe type that must be assignable to the variables.
IsLinkedToSpace(IDynamicVariable)
Determines whether this dynamic variable is linked against a FrooxEngine.DynamicVariableSpace.
public static bool IsLinkedToSpace(this IDynamicVariable dynamicVariable)
Parameters
dynamicVariableIDynamicVariableThe dynamic variable for which to check for a linked FrooxEngine.DynamicVariableSpace.
Returns
- bool
trueif this dynamic variable is linked to a FrooxEngine.DynamicVariableSpace; otherwise,false.
IsLinkedToSpace(IDynamicVariable, DynamicVariableSpace)
Determines whether this dynamic variable is linked against the given FrooxEngine.DynamicVariableSpace.
public static bool IsLinkedToSpace(this IDynamicVariable dynamicVariable, DynamicVariableSpace space)
Parameters
dynamicVariableIDynamicVariableThe dynamic variable for which to check the linked FrooxEngine.DynamicVariableSpace.
spaceDynamicVariableSpaceThe dynamic variable space to compare to the linked one.
Returns
- bool
trueif this dynamic variable is linked to the given FrooxEngine.DynamicVariableSpace; otherwise,false.
IsValidName(string?)
Tests whether this string is a valid dynamic variable name.
public static bool IsValidName(this string? variableName)
Parameters
variableNamestringThe string to test.
Returns
- bool
trueif this string is a valid name; otherwise,false.
ParseAsPath(string?, out string?, out string?)
public static void ParseAsPath(this string? path, out string? spaceName, out string? variableName)
Parameters
pathstringThe string to parse.
spaceNamestringThe parsed space name, or
nullif not applicable.variableNamestringThe parsed variable name, or
nullif not applicable.
ProcessName(string?)
public static string? ProcessName(this string? variableName)
Parameters
variableNamestringThe string to process.
Returns
TryGetHandler<T>(IDynamicVariable<T>, out DynamicVariableHandler<T>?)
Tries to get the FrooxEngine.DynamicVariableHandler<T> of this dynamic variable.
public static bool TryGetHandler<T>(this IDynamicVariable<T> dynamicVariable, out DynamicVariableHandler<T>? handler)
Parameters
dynamicVariableIDynamicVariable<T>The dynamic variable of which to get the FrooxEngine.DynamicVariableHandler<T>.
handlerDynamicVariableHandler<T>The FrooxEngine.DynamicVariableHandler<T> of this dynamic variable; otherwise,
null.
Returns
- bool
trueif the FrooxEngine.DynamicVariableHandler<T> of this dynamic variable was found; otherwise,false.
Type Parameters
T
TryGetLinkedSpace(IDynamicVariable, out DynamicVariableSpace?)
Tries to get the FrooxEngine.DynamicVariableSpace that this dynamic variable is linked to.
public static bool TryGetLinkedSpace(this IDynamicVariable dynamicVariable, out DynamicVariableSpace? linkedSpace)
Parameters
dynamicVariableIDynamicVariableThe dynamic variable of which to get the linked FrooxEngine.DynamicVariableSpace.
linkedSpaceDynamicVariableSpaceThe FrooxEngine.DynamicVariableSpace that this dynamic variable is linked to was found; otherwise,
null.
Returns
- bool
trueif this dynamic variable is linked to a FrooxEngine.DynamicVariableSpace; otherwise,false.