Skip to content

UnityWeld.Binding.Internal

Rory Dungan edited this page Jun 1, 2018 · 1 revision

AdapterResolver

Helper class for creating adapters Will resolve with a class marked by WeldContainerAttribute, if there is none it will fall back to using DefaultWeldContainer If there are multiple classes marked with WeldContainerAttribute, its initial setup will throw an InvalidOperationException

public static class UnityWeld.Binding.Internal.AdapterResolver

Static Methods

Type Name Summary
IAdapter CreateAdapter(Type adapterType)

BindableEvent

Information needed to bind to a UnityEvent on a component.

public class UnityWeld.Binding.Internal.BindableEvent

Properties

Type Name Summary
Type ComponentType Type of the component we're binding to. This doesn't account for multiple components of the same type on the same GameObject, but there doesn't seem to be any other easy way of doing that since component instance IDs are re-generated frequently.
Type DeclaringType The type that the event belongs to.
String Name The name of the property or field contaning this event.
UnityEventBase UnityEvent UnityEvent to bind to.

BindableMember<TMemberType>

Data structure combining a bindable property or method with the view model it belongs to. This is needed because we can't always rely on MemberInfo.ReflectedType returning the type of the view model if the property or method was declared in an interface that the view model inherits from.

public class UnityWeld.Binding.Internal.BindableMember<TMemberType>

Fields

Type Name Summary
TMemberType Member The bindable member info (usually a PropertyInfo or MethodInfo)
Type ViewModelType View model that the property or method belongs to.

Properties

Type Name Summary
String MemberName Name of the member.
String ViewModelTypeName Name of the view model type.

Methods

Type Name Summary
String ToString()

PropertyEndPoint

Represents an attachment to a property via reflection.

public class UnityWeld.Binding.Internal.PropertyEndPoint

Methods

Type Name Summary
Object GetValue() Get the value of the property.
void SetValue(Object input) Set the value of the property.
String ToString()
PropertyWatcher Watch(Action changed) Watch the property for changes.

PropertyFinder

Helper to find bindable properties.

public static class UnityWeld.Binding.Internal.PropertyFinder

Static Methods

Type Name Summary
IEnumerable<BindableMember<PropertyInfo>> GetBindableProperties(GameObject gameObject) Use reflection to find all components with properties we can bind to.

PropertySync

Syncrhonises the value between two properties using reflection.

public class UnityWeld.Binding.Internal.PropertySync

Methods

Type Name Summary
void SyncFromDest() Syncrhonise the value from the destination to the source.
void SyncFromSource() Syncrhonise the value from the source to the destination.

PropertyWatcher

Watches an object for property changes and invokes an action when the property has changed.

public class UnityWeld.Binding.Internal.PropertyWatcher
    : IDisposable

Methods

Type Name Summary
void Dispose()
void Dispose(Boolean disposing)

TypeResolver

Helper class for setting up the factory for use in the editor.

public static class UnityWeld.Binding.Internal.TypeResolver

Static Properties

Type Name Summary
IEnumerable<Type> TypesWithAdapterAttribute
IEnumerable<Type> TypesWithBindingAttribute
IEnumerable<Type> TypesWithWeldContainerAttribute

Static Methods

Type Name Summary
AdapterAttribute FindAdapterAttribute(Type adapterType) Find the [Adapter] attribute for a particular type. Returns null if there is no such attribute.
Type FindAdapterType(String typeName) Find a particular type by its short name.
BindableMember1[]` FindBindableCollectionProperties(CollectionBinding target) Find collection properties that can be data-bound.
BindableMember1[]` FindBindableMethods(EventBinding targetScript) Get a list of methods in the view model that we can bind to.
BindableMember1[]` FindBindableProperties(AbstractMemberBinding target) Find bindable properties in available view models.

UnityEventWatcher

Watches an component for a Unity event and triggers an action when the event is raised.

public class UnityWeld.Binding.Internal.UnityEventWatcher
    : IDisposable

Methods

Type Name Summary
void Dispose()
void Dispose(Boolean disposing)

Static Methods

Type Name Summary
BindableEvent[] GetBindableEvents(GameObject gameObject) Get all bindable Unity events from a particular component.