public void SetDelegate(Delegate listener, QuickSupportedTypes type) { switch (type) { case QuickSupportedTypes.String: QuickStringDelegate = (QuickAction <string>)listener; break; case QuickSupportedTypes.Int: QuickIntDelegate = (QuickAction <int>)listener; break; case QuickSupportedTypes.Float: QuickFloatDelegate = (QuickAction <float>)listener; break; case QuickSupportedTypes.Bool: QuickBoolDelegate = (QuickAction <bool>)listener; break; case QuickSupportedTypes.Color: QuickColorDelegate = (QuickAction <Color>)listener; break; case QuickSupportedTypes.Vector2: QuickVector2Delegate = (QuickAction <Vector2>)listener; break; case QuickSupportedTypes.Vector3: QuickVector3Delegate = (QuickAction <Vector3>)listener; break; case QuickSupportedTypes.Object: QuickObjectDelegate = (QuickAction <Object>)listener; break; case QuickSupportedTypes.GameObject: QuickGameObjectDelegate = (QuickAction <GameObject>)listener; break; case QuickSupportedTypes.Transform: QuickTransformDelegate = (QuickAction <Transform>)listener; break; default: QuickDelegate = (QuickAction)listener; break; } }
protected Type GetActionType(QuickSupportedTypes type) { switch (type) { case QuickSupportedTypes.String: return(typeof(QuickAction <string>)); case QuickSupportedTypes.Int: return(typeof(QuickAction <int>)); case QuickSupportedTypes.Float: return(typeof(QuickAction <float>)); case QuickSupportedTypes.Bool: return(typeof(QuickAction <bool>)); case QuickSupportedTypes.Color: return(typeof(QuickAction <Color>)); case QuickSupportedTypes.Vector2: return(typeof(QuickAction <Vector2>)); case QuickSupportedTypes.Vector3: return(typeof(QuickAction <Vector3>)); case QuickSupportedTypes.Object: return(typeof(QuickAction <Object>)); case QuickSupportedTypes.GameObject: return(typeof(QuickAction <GameObject>)); case QuickSupportedTypes.Transform: return(typeof(QuickAction <Transform>)); default: return(typeof(QuickAction)); } }
public void Invoke(object argument, QuickSupportedTypes type) { switch (type) { case QuickSupportedTypes.String: if (QuickStringDelegate != null) { QuickStringDelegate(argument as string); } break; case QuickSupportedTypes.Int: if (QuickIntDelegate != null) { QuickIntDelegate((int)argument); } break; case QuickSupportedTypes.Float: if (QuickFloatDelegate != null) { QuickFloatDelegate((float)argument); } break; case QuickSupportedTypes.Bool: if (QuickBoolDelegate != null) { QuickBoolDelegate((bool)argument); } break; case QuickSupportedTypes.Color: if (QuickColorDelegate != null) { QuickColorDelegate((Color)argument); } break; case QuickSupportedTypes.Vector2: if (QuickVector2Delegate != null) { QuickVector2Delegate((Vector2)argument); } break; case QuickSupportedTypes.Vector3: if (QuickVector3Delegate != null) { QuickVector3Delegate((Vector3)argument); } break; case QuickSupportedTypes.Object: if (QuickObjectDelegate != null) { QuickObjectDelegate(argument as Object); } break; case QuickSupportedTypes.GameObject: if (QuickGameObjectDelegate != null) { QuickGameObjectDelegate(argument as GameObject); } break; case QuickSupportedTypes.Transform: if (QuickTransformDelegate != null) { QuickTransformDelegate(argument as Transform); } break; default: if (QuickDelegate != null) { QuickDelegate(); } break; } }