Beispiel #1
0
        /// <summary>
        /// 添加为首包下载文档
        /// </summary>
        public static void FirstLoadFiles(bool delete = false)
        {
            Object[] selection = EditorUtils.SelectObjects();
            string   abName    = "";
            string   apath     = "";

            foreach (Object s in selection)
            {
                abName = GetOriginalAssetBundleName(s, out apath);
                Debug.LogFormat("abname={0}", abName, apath);
                if (string.IsNullOrEmpty(abName))
                {
                    continue;
                }

                if (delete)
                {
                    HugulaExtensionFolderEditor.RemoveExtendsFile(abName);
                }
                else if (!string.IsNullOrEmpty(abName) && !HugulaExtensionFolderEditor.ContainsExtendsPath(apath))
                {
                    HugulaExtensionFolderEditor.AddFirstLoadFile(abName);
                }
                else
                {
                    Debug.LogFormat("assetPath({0}) can't add to extends file list  ", apath);
                }
            }

            HugulaExtensionFolderEditor.SaveSettingData();
        }
Beispiel #2
0
        public static void CheckSelectedAssetbundleSize()
        {
            //
            List <string> onlyInclusionFiles = new List <string>();
            var           floder             = Selection.objects[0];
            var           path = AssetDatabase.GetAssetPath(floder);

            Object[] selection = EditorUtils.SelectObjects();
            string   apath     = null;

            foreach (Object s in selection)
            {
                string suffix = string.Empty;
                apath = AssetDatabase.GetAssetPath(s);
                AssetImporter import = AssetImporter.GetAtPath(apath);

                if (string.IsNullOrEmpty(import.assetBundleName))
                {
                    // Debug.LogWarningFormat ("file:{0} has't set assetbundle name!", apath);
                    continue;
                }
                ;

                if (!string.IsNullOrEmpty(import.assetBundleVariant))
                {
                    suffix = "." + import.assetBundleVariant;
                }

                onlyInclusionFiles.Add(import.assetBundleName + suffix);
            }

            uint size  = 0;
            int  count = 0;

            foreach (var f in onlyInclusionFiles)
            {
                FileInfo finfo = new FileInfo(CUtils.PathCombine(CUtils.realStreamingAssetsPath, f));
                if (finfo.Exists)
                {
                    count++;
                    size += (uint)finfo.Length;
                }
                else
                {
                    Debug.LogWarningFormat("file not exits:{0}", f);
                }
            }

            Debug.LogFormat("total:{0} kb,count:{1},path={2}", (float)size / 1024.0f, count, path);
        }
Beispiel #3
0
        public static void ClearAssetBundlesName()
        {
            Object[] selection = EditorUtils.SelectObjects();

            AssetImporter
                import = null;

            foreach (Object s in selection)
            {
                import = AssetImporter.GetAtPath(AssetDatabase.GetAssetPath(s));
                import.assetBundleName = null;
                if (s is GameObject)
                {
                    GameObject tar = s as GameObject;
                    // ReferenceCount refe = tar.GetComponent<ReferenceCount> (); //LuaHelper.AddComponent(tar, typeof(ReferenceCount)) as ReferenceCount;
                    // Object.DestroyImmediate (refe, true);
                    EditorUtility.SetDirty(s);
                }
                Debug.Log(s.name + " clear");
            }
        }