예제 #1
0
        private static bool TryHandleElementRuntimeSpecialCases(List <object> argumentValues, Type[] argumentTypes, ElementRuntime caller, ref object result, MemberReferenceExpression mre)
        {
            bool handled = false;

            if (argumentValues.Count == 5 && mre.MemberName == "InterpolateToState")
            {
                // using advanced interpolation
                StateViewPlugin.Self.ApplyInterpolateToState(
                    argumentValues[0],
                    argumentValues[1],
                    (float)argumentValues[2],
                    (FlatRedBall.Glue.StateInterpolation.InterpolationType)argumentValues[3],
                    (FlatRedBall.Glue.StateInterpolation.Easing)argumentValues[4]);
                result  = null;
                handled = true;
            }

            if (!handled && caller.DirectObjectReference != null)
            {
                Type directObjectType = caller.DirectObjectReference.GetType();

                MethodInfo methodInfo = directObjectType.GetMethod(mre.MemberName, argumentTypes);
                if (methodInfo != null)
                {
                    result  = methodInfo.Invoke(caller, argumentValues.ToArray());
                    handled = true;
                }
            }

            if (!handled && argumentValues.Count == 1 && mre.MemberName == "Set" && argumentTypes[0] == typeof(string))
            {
                result  = caller.Set(argumentValues[0] as string);
                handled = true;
            }
            return(handled);
        }