Пример #1
0
        void Unload()
        {
            Caching.CleanCache();

            if (listDatas != null) { listDatas.Clear(); listDatas = null; }
            if (_abmgr != null) { _abmgr.Close(); _abmgr = null; }

            thisSceneData = new SceneData();

            objScene = null;
        }
Пример #2
0
        public string CreateAssetBundlesScene(SceneData thisSceneData)
        {
            Caching.CleanCache();

            // AssetBundle 存储路径
#if UNITY_IPHONE || UNITY_STANDALONE_OSX
            string targetPath = ABConfig.OutputFolderSceneIOS +  thisSceneData.scene.name + ABConfig.extensionName;
#elif UNITY_STANDALONE_WIN
            string targetPath = ABConfig.OutputFolderSceneWindows + thisSceneData.scene.name + ABConfig.extensionName;
#endif	//	UNITY_STANDALONE_WIN

            AssetDatabase.Refresh();

            AssetDatabase.GetAssetPath((Object)thisSceneData.scene);
            AssetDatabase.GetAssetPath((Object)thisSceneData.scene_nav);
            AssetDatabase.GetAssetPath((Object)thisSceneData.scene_Lightmap_high);
            AssetDatabase.GetAssetPath((Object)thisSceneData.scene_Lightmap_low);

            Object[] SelectedAsset = new Object[4];
            SelectedAsset[0] = (Object)thisSceneData.scene;
            SelectedAsset[1] = (Object)thisSceneData.scene_nav;
            SelectedAsset[2] = (Object)thisSceneData.scene_Lightmap_high;
            SelectedAsset[3] = (Object)thisSceneData.scene_Lightmap_low;

            //Object[] SelectedAsset = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);

            CreateAssetBunldesALL(SelectedAsset, targetPath);

            return targetPath;
        }
Пример #3
0
        //void PackageAdd(string SrcFolder, string DestFolder, BuildTarget target)
        //{
        //    DirectoryInfo di = new DirectoryInfo(SrcFolder);

        //    foreach (DirectoryInfo child in di.GetDirectories())
        //    {
        //        string childFolder = child.FullName;

        //        //  场景名
        //        string scenename = Path.GetFileName(childFolder);

        //        //  场景prefab
        //        string sceneprefabpath = childFolder + "/" + scenename + ".prefab";
        //        if (!File.Exists(sceneprefabpath))
        //        {
        //            Debug.LogError("File is not Exist" + sceneprefabpath);
        //            continue;

        //        }
        //        string scenenavprefabpath = childFolder + "/" + scenename + "_nav.prefab";
        //        if (!File.Exists(scenenavprefabpath))
        //        {
        //            Debug.LogError("File is not Exist" + scenenavprefabpath);
        //            continue;

        //        }
        //        string scenelightmap = childFolder + "/LightmapFar-0.exr";
        //        if (!File.Exists(scenelightmap))
        //        {
        //            Debug.LogError("File is not Exist" + scenelightmap);
        //            continue;

        //        }

        //        bool a = IsPackage(sceneprefabpath, DestFolder, Path.GetFileName(sceneprefabpath));
        //        bool b = IsPackage(scenenavprefabpath, DestFolder, Path.GetFileName(scenenavprefabpath));
        //        bool c = IsPackage(scenelightmap, DestFolder, scenename + "_" + Path.GetFileName(scenelightmap));
				
				
        //        if ( !a && !b && !c	)
        //        {
        //            Debug.Log(" MD5 Not Need Update ");

        //            continue;
        //        }

        //        sceneprefabpath = sceneprefabpath.Substring(sceneprefabpath.IndexOf("Assets"));
        //        scenenavprefabpath = scenenavprefabpath.Substring(scenenavprefabpath.IndexOf("Assets"));
        //        scenelightmap = scenelightmap.Substring(scenelightmap.IndexOf("Assets"));

        //        SceneData sd = new SceneData();
        //        sd.scene = (GameObject)AssetDatabase.LoadAssetAtPath(sceneprefabpath, typeof(UnityEngine.Object));
        //        Decompose(sd.scene, ref sd, DestFolder);
        //        sd.scene_nav = (GameObject)AssetDatabase.LoadAssetAtPath(scenenavprefabpath, typeof(UnityEngine.Object));
        //        sd.scene_Lightmap = (Texture2D)AssetDatabase.LoadAssetAtPath(scenelightmap, typeof(UnityEngine.Object));

        //        mgr.CreateAssetBundlesScene(sd, DestFolder, target);

        //    }

        //}



#endregion

#region chai
        void Decompose(Object go, ref SceneData sd, string DestFolder, string MaterialFolder)
        {
            ABMgr mgr = new ABMgr();

            mgr.DecomposePre(go, DestFolder, MaterialFolder);

            sd.scene_nomaterial = mgr.nomaterialscene;
            sd.scene_material_asset = mgr.materialasset;

            mgr.DecomposeEnd();
        }
Пример #4
0
        void PackageAdd(string SrcFolder, string DestFolder, BuildTarget target)
        {
            DirectoryInfo di = new DirectoryInfo(SrcFolder);

            //  场景名
            string scenename = di.Name;

            //  场景prefab
            string sceneprefabpath = SrcFolder.Replace(scenename, "Prefabs") + "/" + scenename + ".prefab";
            if (!File.Exists(sceneprefabpath))
            {
                Debug.LogError("File is not Exist" + sceneprefabpath);
                return;
            }
            string scenenavprefabpath = SrcFolder.Replace(scenename, "Prefabs") + "/" + scenename + "_nav.prefab";
            if (!File.Exists(scenenavprefabpath))
            {
                Debug.LogError("File is not Exist" + scenenavprefabpath);
                return;
            }
            string scenelightmap = SrcFolder + "/LightmapFar-0.exr";
            if (!File.Exists(scenelightmap))
            {
                Debug.LogError("File is not Exist" + scenelightmap);
                return;
            }

            bool a = IsPackage(sceneprefabpath, DestFolder, Path.GetFileName(sceneprefabpath));
            bool b = IsPackage(scenenavprefabpath, DestFolder, Path.GetFileName(scenenavprefabpath));
            bool c = IsPackage(scenelightmap, DestFolder, scenename + "_" + Path.GetFileName(scenelightmap));


            if (!a && !b && !c)
            {
                Debug.Log(" MD5 Not Need Update ");
                return;
            }

            sceneprefabpath = sceneprefabpath.Substring(sceneprefabpath.IndexOf("Assets"));
            scenenavprefabpath = scenenavprefabpath.Substring(scenenavprefabpath.IndexOf("Assets"));
            scenelightmap = scenelightmap.Substring(scenelightmap.IndexOf("Assets"));

            SceneData sd = new SceneData();
            sd.scene = (GameObject)AssetDatabase.LoadAssetAtPath(sceneprefabpath, typeof(UnityEngine.Object));
            Decompose(sd.scene, ref sd, DestFolder, di.Parent.Name);
            sd.scene_nav = (GameObject)AssetDatabase.LoadAssetAtPath(scenenavprefabpath, typeof(UnityEngine.Object));
            sd.scene_Lightmap = (Texture2D)AssetDatabase.LoadAssetAtPath(scenelightmap, typeof(UnityEngine.Object));

            mgr.CreateAssetBundlesScene(sd, DestFolder, target);

            return;

        }
Пример #5
0
        public string CreateAssetBundlesScene(SceneData thisSceneData, string path, BuildTarget target)
        {
            if (!Directory.Exists(path))
                Directory.CreateDirectory(path);

            Caching.CleanCache();


            AssetDatabase.Refresh();

            AssetDatabase.GetAssetPath((Object)thisSceneData.scene);
            AssetDatabase.GetAssetPath((Object)thisSceneData.scene_nav);
            AssetDatabase.GetAssetPath((Object)thisSceneData.scene_Camera_custom);
            AssetDatabase.GetAssetPath((Object)thisSceneData.scene_Lightmap);

//			string targetPathOld = path + "/" + thisSceneData.scene.name + "_old" + ABConfig.extensionName;
//                
//            {
//                Object[] SelectedAsset = new Object[4];
//                SelectedAsset[0] = (Object)thisSceneData.scene;
//                SelectedAsset[1] = (Object)thisSceneData.scene_nav;
//                SelectedAsset[2] = (Object)thisSceneData.scene_Lightmap;
//                SelectedAsset[3] = (Object)thisSceneData.scene_Camera_custom;
//
//				CreateAssetBunldesALL(SelectedAsset, targetPathOld, target);
//            }

			string targetPath = path + "/" + thisSceneData.scene.name + ABConfig.extensionName;
			{
                
                Object[] SelectedAsset = new Object[5];
                SelectedAsset[0] = (Object)thisSceneData.scene_nomaterial;
                SelectedAsset[1] = (Object)thisSceneData.scene_material_asset;
                SelectedAsset[2] = (Object)thisSceneData.scene_nav;
                SelectedAsset[3] = (Object)thisSceneData.scene_Lightmap;
                SelectedAsset[4] = (Object)thisSceneData.scene_Camera_custom;

				CreateAssetBunldesALL(SelectedAsset, targetPath, target);
            }

            return targetPath;
        }