示例#1
0
        /// <summary>
        /// Check if this object is of the specified UE type.
        /// </summary>
        /// <param name="baseClass">Expected UE type of this UObject instance.</param>
        /// <returns>true if the instance is of the specified UE type, false otherwise</returns>
        public bool IsA(UClass baseClass)
        {
            var thisClass = (UClass)this.GetType();

            if (thisClass == baseClass)
            {
                return(true);
            }
            return(thisClass.IsChildOf(baseClass));
        }
示例#2
0
文件: Class.cs 项目: raaffc/klawr
 /// <summary>
 ///     Construct a TSubclassOf instance encapsulating the given UClass instance.
 /// </summary>
 /// <param name="clazz">UClass instance to assign to this TSubclassOf instance, or null.</param>
 public TSubclassOf(UClass clazz)
 {
     if (clazz != null)
     {
         if (!clazz.IsChildOf((UClass)typeof(TBaseClass)))
         {
             throw new ArgumentException($"{clazz.Name} is not a subclass of {typeof(TBaseClass).Name}!", nameof(clazz));
         }
     }
     Class = clazz;
 }
示例#3
0
文件: Class.cs 项目: winslylord/klawr
 /// <summary>
 /// Construct a TSubclassOf instance encapsulating the given UClass instance.
 /// </summary>
 /// <param name="clazz">UClass instance to assign to this TSubclassOf instance, or null.</param>
 public TSubclassOf(UClass clazz)
 {
     if (clazz != null)
     {
         if (!clazz.IsChildOf((UClass)typeof(TBaseClass)))
         {
             throw new ArgumentException(
                       String.Format(
                           "{0} is not a subclass of {1}!",
                           clazz.Name, typeof(TBaseClass).Name
                           ),
                       "clazz"
                       );
         }
     }
     Class = clazz;
 }
示例#4
0
文件: Class.cs 项目: raaffc/klawr
 /// <summary>
 ///     Check if this UE type is derived from the specified UE type.
 /// </summary>
 /// <param name="baseClass">A base class.</param>
 /// <returns>true is this class is derived from baseClass, false otherwise</returns>
 public bool IsChildOf(UClass baseClass)
 {
     return(ObjectUtils.IsClassChildOf(NativeObject, baseClass.NativeObject));
 }
示例#5
0
文件: Class.cs 项目: raaffc/klawr
 // Hide UObject.IsA(), IsChildOf() should be used instead when dealing with UClass instances.
 private new bool IsA(UClass baseClass)
 {
     return(base.IsA(baseClass));
 }