GetItemByName() public method

public GetItemByName ( string itemName ) : PackageItem
itemName string
return PackageItem
コード例 #1
0
 static public int GetItemByName(IntPtr l)
 {
     try {
         FairyGUI.UIPackage self = (FairyGUI.UIPackage)checkSelf(l);
         System.String      a1;
         checkType(l, 2, out a1);
         var ret = self.GetItemByName(a1);
         pushValue(l, true);
         pushValue(l, ret);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
コード例 #2
0
 static int GetItemByName(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 2);
         FairyGUI.UIPackage   obj  = (FairyGUI.UIPackage)ToLua.CheckObject <FairyGUI.UIPackage>(L, 1);
         string               arg0 = ToLua.CheckString(L, 2);
         FairyGUI.PackageItem o    = obj.GetItemByName(arg0);
         ToLua.PushObject(L, o);
         return(1);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
コード例 #3
0
        public static PackageItem GetItemByURL(string url)
        {
            if (url == null)
            {
                return(null);
            }

            int pos1 = url.IndexOf("//");

            if (pos1 == -1)
            {
                return(null);
            }

            int pos2 = url.IndexOf('/', pos1 + 2);

            if (pos2 == -1)
            {
                if (url.Length > 13)
                {
                    string    pkgId = url.Substring(5, 8);
                    UIPackage pkg   = GetById(pkgId);
                    if (pkg != null)
                    {
                        string srcId = url.Substring(13);
                        return(pkg.GetItem(srcId));
                    }
                }
            }
            else
            {
                string    pkgName = url.Substring(pos1 + 2, pos2 - pos1 - 2);
                UIPackage pkg     = GetByName(pkgName);
                if (pkg != null)
                {
                    string srcName = url.Substring(pos2 + 1);
                    return(pkg.GetItemByName(srcName));
                }
            }

            return(null);
        }