示例#1
0
        public InstanceFunctionBase GetInstanceFunction(string name)
        {
            InstanceFunctionBase function = null;

            if (!mInstanceFunctions.TryGetValue(name, out function))
            {
                if (null != this.ParentClass)
                {
                    function = this.ParentClass.GetInstanceFunction(name);
                }
            }
            return(function);
        }
示例#2
0
        static protected IntPtr CallInstanceFunction(IntPtr caller, IntPtr handle, string name, IntPtr parameters, int count)
        {
            IntPtr result = IntPtr.Zero;

            Entry.BeginCallFunction();
            object target = Entry.Object.GetInstance(caller);

            do
            {
                if (null == target)
                {
                    Entry.LogWarning("No instance for index {0}", caller.ToString());
                    break;
                }

                Type  type = target.GetType();
                Class c    = Class.FindClass(type.GetSafeFullName());
                if (null == c)
                {
                    Entry.LogWarning("No class registered with name {0}", type.FullName);
                    break;
                }
                InstanceFunctionBase function = Base.FindInstance <InstanceFunctionBase>(handle);
                if (null == function)
                {
                    function = c.GetInstanceFunction(name);
                }
                if (null == function)
                {
                    Entry.LogWarning("No function registered in {0} with name {1}", type.FullName, name);
                    break;
                }
                result = function.Invoke(target, parameters, count);
            } while (false);
            Entry.EndCallFunction();
            return(result);
        }