示例#1
0
        public void CopyFrom(FMulticastScriptDelegate native)
        {
            Clear();
            int count = native.Count;

            for (int i = 0; i < count; ++i)
            {
                Add(native[i]);
            }
        }
示例#2
0
        public void ProcessMulticastDelegate(IntPtr parameters)
        {
            // Create an unmanaged version of this delegate and then destroy the underlying TArray once complete
            FMulticastScriptDelegate scriptDelegate = new FMulticastScriptDelegate();

            scriptDelegate.InvocationList.AddZeroed(Marshal.SizeOf(typeof(FScriptDelegate)), Count);
            for (int i = 0; i < Count; ++i)
            {
                BlittableTypeMarshaler <FScriptDelegate> .ToNative(scriptDelegate.InvocationList.Data, i, this[i]);
            }
            Native_FMulticastScriptDelegate.ProcessMulticastDelegate(ref scriptDelegate, parameters);
            // Something may have modified the delegate? Copy it back from the native array.
            CopyFrom(scriptDelegate);
            scriptDelegate.InvocationList.Destroy();
        }
示例#3
0
        public override void FromNative(IntPtr address)
        {
            Clear();
            FMulticastScriptDelegate del = *((FMulticastScriptDelegate *)address);

            for (int i = 0; i < del.Count; ++i)
            {
                if (IsNative)
                {
                    scriptDelegatePtr->Add(del[i]);
                }
                else
                {
                    managedScriptDelegate.Add(del[i]);
                }
            }
        }
示例#4
0
        public override void CopyFrom(FDelegateBase <TDelegate> other)
        {
            Clear();
            FMulticastDelegate <TDelegate> del = other as FMulticastDelegate <TDelegate>;

            if (del == null)
            {
                return;
            }

            if (del.IsNative)
            {
                FMulticastScriptDelegate otherScriptDelegate = *del.scriptDelegatePtr;
                int count = otherScriptDelegate.Count;
                for (int i = 0; i < count; ++i)
                {
                    if (IsNative)
                    {
                        scriptDelegatePtr->Add(otherScriptDelegate[i]);
                    }
                    else
                    {
                        managedScriptDelegate.Add(otherScriptDelegate[i]);
                    }
                }
            }
            else
            {
                FMulticastScriptDelegateWrapper otherScriptDelegate = del.managedScriptDelegate;
                int count = otherScriptDelegate.Count;
                for (int i = 0; i < count; ++i)
                {
                    if (IsNative)
                    {
                        scriptDelegatePtr->Add(otherScriptDelegate[i]);
                    }
                    else
                    {
                        managedScriptDelegate.Add(otherScriptDelegate[i]);
                    }
                }
            }
        }