public static string CallScriptFunction(string pFunctionNamespace, string pFunctionName, object[] args, out bool found)
        {
            if (pFunctionNamespace != null)
            {
                Type      type;
                SimObject obj = SimDictionary.Find(pFunctionNamespace);

                string objectName = pFunctionNamespace;
                if (objectName != null && ClassTypeDictionary.ContainsKey(objectName))
                {
                    type = ClassTypeDictionary[objectName];
                }
                else if (obj != null)
                {
                    type = obj.GetType();
                }
                else
                {
                    //todo throw exception?
                    found = false;
                    return(null);
                }

                return(CallNamespaceMethod(type, obj, pFunctionName, args, out found));
            }
            if (!FunctionDictionary.ContainsKey(pFunctionName))
            {
                found = false;
                return(null);
            }
            found = true;
            MethodInfo methodInfo = FunctionDictionary[pFunctionName];

            return(InvokeMethod(methodInfo, null, args, out found));
        }
        public static string CallScriptMethod(string className, string classNamespace, SimObject objectWrapper, string methodName, object[] args, out bool found)
        {
            if (methodName.Equals("pushDialog"))
            {
                methodName = methodName;
            }
            Type   type;
            string objectName = objectWrapper.getName();

            if (objectName != null && ClassTypeDictionary.ContainsKey(objectName))
            {
                type = ClassTypeDictionary[objectName];
            }
            else if (classNamespace != null && ClassTypeDictionary.ContainsKey(classNamespace))
            {
                type = ClassTypeDictionary[classNamespace];
            }
            else if (ClassTypeDictionary.ContainsKey(className))
            {
                type = ClassTypeDictionary[className];
            }
            else if (SimDictionary.Find(objectWrapper.Name) != null)
            {
                type = SimDictionary.Find(objectWrapper.Name).GetType();
            }
            else if (SimDictionary.Find(objectWrapper.getId()) != null)
            {
                type = SimDictionary.Find(objectWrapper.getId()).GetType();
            }
            else
            {
                if (ClassTypeDictionary.ContainsKey(objectWrapper.GetType().Name))
                {
                    type = ClassTypeDictionary[objectWrapper.GetType().Name];
                }
                else
                {
                    found = false;
                    return(null);
                }
            }
            return(CallNamespaceMethod(type, objectWrapper, methodName, args, out found));
        }