示例#1
0
        public void Remove(FScriptDelegate value)
        {
            int index = IndexOf(value);

            if (index >= 0)
            {
                RemoveAt(index);
            }
        }
示例#2
0
        public override void FromNative(IntPtr address)
        {
            Clear();
            FScriptDelegate del = *((FScriptDelegate *)address);

            if (IsNative)
            {
                *scriptDelegatePtr = del;
            }
            else
            {
                managedScriptDelegate = del;
            }
        }
示例#3
0
        public int IndexOf(IntPtr obj, FName functionName)
        {
            int count = Count;

            for (int i = 0; i < count; ++i)
            {
                FScriptDelegate scriptDelegate = this[i];
                if (scriptDelegate.Object.GetPtrEvenIfUnreachable() == obj && scriptDelegate.FunctionName == functionName)
                {
                    return(i);
                }
            }
            return(-1);
        }
示例#4
0
        public int IndexOf(FScriptDelegate value)
        {
            EqualityComparer <FScriptDelegate> comparer = EqualityComparer <FScriptDelegate> .Default;
            int count = Count;

            for (int i = 0; i < count; ++i)
            {
                if (comparer.Equals(this[i], value))
                {
                    return(i);
                }
            }
            return(-1);
        }
示例#5
0
        /// <summary>
        /// Checks to see if any functions are bound to the given user object.
        /// </summary>
        /// <param name="obj">The UObject derived object to check</param>
        /// <returns>True if any functions are bound to the given object, false otherwise.</returns>
        public bool IsBoundToObject(IntPtr obj)
        {
            if (obj == IntPtr.Zero)
            {
                return(false);
            }
            int count = Count;

            for (int i = 0; i < count; ++i)
            {
                FScriptDelegate scriptDelegate = this[i];
                if (scriptDelegate.Object.GetPtrEvenIfUnreachable() == obj)
                {
                    return(true);
                }
            }
            return(false);
        }
示例#6
0
 public FScriptDelegate[] GetFunctionInfos()
 {
     FScriptDelegate[] result = new FScriptDelegate[Count];
     if (IsNative)
     {
         for (int i = 0; i < result.Length; i++)
         {
             result[i] = (*scriptDelegatePtr)[i];
         }
     }
     else
     {
         for (int i = 0; i < result.Length; i++)
         {
             result[i] = managedScriptDelegate[i];
         }
     }
     return(result);
 }
示例#7
0
        public override void CopyFrom(FDelegateBase <TDelegate> other)
        {
            Clear();
            FDelegate <TDelegate> del = other as FDelegate <TDelegate>;

            if (del == null)
            {
                return;
            }

            FScriptDelegate otherScriptDelegate = del.IsNative ? *del.scriptDelegatePtr : managedScriptDelegate;

            if (IsNative)
            {
                scriptDelegatePtr->Bind(otherScriptDelegate.Object.GetPtr(), otherScriptDelegate.FunctionName);
            }
            else
            {
                managedScriptDelegate.Bind(otherScriptDelegate.Object.GetPtr(), otherScriptDelegate.FunctionName);
            }
        }
示例#8
0
 public bool Contains(FScriptDelegate value)
 {
     return(IndexOf(value) >= 0);
 }
示例#9
0
 public int IndexOf(FScriptDelegate value)
 {
     return(Delegates.IndexOf(value));
 }
示例#10
0
 public void Add(FScriptDelegate value)
 {
     Delegates.Add(value);
 }
示例#11
0
 public void Add(FScriptDelegate value)
 {
     this[InvocationList.AddZeroed(ElementSize)] = value;
 }
示例#12
0
 public void Set(int index, FScriptDelegate value)
 {
     this[index] = value;
 }