FairyGUI.UIPackage.CreateObject C# (CSharp) Method

CreateObject() private method

private CreateObject ( PackageItem item, System userClass ) : GObject
item PackageItem
userClass System
return GObject
        GObject CreateObject(PackageItem item, System.Type userClass)
        {
            Stats.LatestObjectCreation = 0;
            Stats.LatestGraphicsCreation = 0;

            GetItemAsset(item);

            GObject g = null;
            if (item.type == PackageItemType.Component)
            {
                if (userClass != null)
                    g = (GComponent)userClass.Assembly.CreateInstance(userClass.FullName);
                else
                    g = UIObjectFactory.NewObject(item);
            }
            else
                g = UIObjectFactory.NewObject(item);

            if (g == null)
                return null;

            _constructing++;
            g.packageItem = item;
            g.ConstructFromResource();
            _constructing--;
            return g;
        }

Same methods

UIPackage::CreateObject ( string resName ) : GObject
UIPackage::CreateObject ( string resName, System userClass ) : GObject
UIPackage::CreateObject ( string pkgName, string resName ) : GObject
UIPackage::CreateObject ( string pkgName, string resName, System userClass ) : GObject

Usage Example

Example #1
0
 static public int CreateObject(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (argc == 2)
         {
             FairyGUI.UIPackage self = (FairyGUI.UIPackage)checkSelf(l);
             System.String      a1;
             checkType(l, 2, out a1);
             var ret = self.CreateObject(a1);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         else if (argc == 3)
         {
             FairyGUI.UIPackage self = (FairyGUI.UIPackage)checkSelf(l);
             System.String      a1;
             checkType(l, 2, out a1);
             System.Type a2;
             checkType(l, 3, out a2);
             var ret = self.CreateObject(a1, a2);
             pushValue(l, true);
             pushValue(l, ret);
             return(2);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
All Usage Examples Of FairyGUI.UIPackage::CreateObject