示例#1
0
        public static IRes Create(ResSearchRule resSearchRule, short assetType)
        {
            switch (assetType)
            {
            case ResType.AssetBundle:
                return(AssetBundleRes.Allocate(resSearchRule.AssetName));

            case ResType.ABAsset:
                return(AssetRes.Allocate(resSearchRule.AssetName, resSearchRule.OwnerBundle));

            case ResType.ABScene:
                return(SceneRes.Allocate(resSearchRule.AssetName));

            case ResType.Internal:
                return(ResourcesRes.Allocate(resSearchRule.AssetName,
                                             resSearchRule.AssetName.StartsWith("resources://")
                            ? InternalResNamePrefixType.Url
                            : InternalResNamePrefixType.Folder));

            case ResType.NetImageRes:
                return(NetImageRes.Allocate(resSearchRule.AssetName));

            case ResType.LocalImageRes:
                return(LocalImageRes.Allocate(resSearchRule.AssetName));

            default:
                Log.E("Invalid assetType :" + assetType);
                return(null);
            }
        }
示例#2
0
        public static IRes Create(ResSearchRule resSearchRule)
        {
            short assetType = 0;

            if (resSearchRule.AssetName.StartsWith("Resources/") || resSearchRule.AssetName.StartsWith("resources://"))
            {
                assetType = ResType.Internal;
            }
            else if (resSearchRule.AssetName.StartsWith("NetImage:"))
            {
                assetType = ResType.NetImageRes;
            }
            else
            {
                var data = ResDatas.Instance.GetAssetData(resSearchRule);

                if (data == null)
                {
                    Log.E("Failed to Create Res. Not Find AssetData:" + resSearchRule);
                    return(null);
                }

                assetType = data.AssetType;
            }

            return(Create(resSearchRule, assetType));
        }