Ejemplo n.º 1
0
        public static void ShowWindow()
        {
            AssetBundleWindow thisWindow = (AssetBundleWindow)EditorWindow.GetWindow(typeof(AssetBundleWindow));

            thisWindow.title = "Bundle Creator";

            ReadEditorPrefs(thisWindow);
            CreateAssetBundles.ReadBundleControlFile(Application.dataPath + thisWindow.exportLocation + CreateAssetBundles.bundleControlFileName, thisWindow.bundleVersions);
            CreateAssetBundles.ReadBundleContentsFile(Application.dataPath + thisWindow.exportLocation + CreateAssetBundles.bundleContentsFileName, thisWindow.bundleContents);
            thisWindow.ReadBundleFileSizes();
        }
Ejemplo n.º 2
0
        void OnGUI()
        {
            undoManager.CheckUndo();

            GUILayout.Label("Export Settings", EditorStyles.boldLabel);
            assetBundleFolderLocation = EditorGUILayout.TextField("AssetBundles folder", assetBundleFolderLocation);
            GUILayout.Label("Application.dataPath			 "+ Application.dataPath, EditorStyles.label);
            exportLocation      = EditorGUILayout.TextField("Export folder", exportLocation);
            bundleFileExtension = EditorGUILayout.TextField("Bundle file ext.", bundleFileExtension);
            setLowerCaseName    = EditorGUILayout.Toggle("Names to lower case", setLowerCaseName);

            buildAssetBundleOptions  = EditorGUILayout.BeginToggleGroup("BuildAssetBundleOptions", buildAssetBundleOptions);
            collectDependencies      = EditorGUILayout.Toggle("CollectDependencies", collectDependencies);
            completeAssets           = EditorGUILayout.Toggle("CompleteAssets", completeAssets);
            disableWriteTypeTree     = EditorGUILayout.Toggle("DisableWriteTypeTree", disableWriteTypeTree);
            deterministicAssetBundle = EditorGUILayout.Toggle("DeterministicAssetBundle", deterministicAssetBundle);
            uncompressedAssetBundle  = EditorGUILayout.Toggle("UncompressedAssetBundle", uncompressedAssetBundle);
            EditorGUILayout.EndToggleGroup();

            optionalSettings = EditorGUILayout.BeginToggleGroup("Optional Settings", optionalSettings);
            buildTarget      = (BuildTarget)EditorGUILayout.EnumPopup("Build Target", buildTarget);
            EditorGUILayout.EndToggleGroup();

            undoManager.CheckDirty();

            GUILayout.Label("Reset Settings", EditorStyles.boldLabel);
            if (GUILayout.Button("Reset"))
            {
                ClearPreferences(this);
                WriteEditorPrefs(this);
                CreateAssetBundles.ReadBundleControlFile(Application.dataPath + exportLocation + CreateAssetBundles.bundleControlFileName, bundleVersions);
                CreateAssetBundles.ReadBundleContentsFile(Application.dataPath + exportLocation + CreateAssetBundles.bundleContentsFileName, bundleContents);
                ReadBundleFileSizes();
            }

            GUILayout.Label("Build", EditorStyles.boldLabel);
            if (GUILayout.Button("Build Asset Bundles"))
            {
                if (!CreateAssetBundles.ExportAssetBundleFolders(this))
                {
                    Debug.LogError("AssetBundle Build Failed! - Please check your settings in the Bundle Creator at Assets->Bundle Creator-> Asset Bundle Creator.");
                }
                else
                {
                    //It worked, save the preferences and reload the control file
                    WriteEditorPrefs(this);
                    bundleVersions.Clear();
                    bundleContents.Clear();
                    bundleFileSizes.Clear();
                    CreateAssetBundles.ReadBundleControlFile(Application.dataPath + exportLocation + CreateAssetBundles.bundleControlFileName, bundleVersions);
                    CreateAssetBundles.ReadBundleContentsFile(Application.dataPath + exportLocation + CreateAssetBundles.bundleContentsFileName, bundleContents);
                    ReadBundleFileSizes();
                }
            }

            GUILayout.Label("Bundle Versions", EditorStyles.boldLabel);
            scrollPosition = EditorGUILayout.BeginScrollView(scrollPosition);
            foreach (KeyValuePair <string, int> bundleVersion in bundleVersions)
            {
                float bundleFileSize = 0;
                bundleFileSizes.TryGetValue(bundleVersion.Key, out bundleFileSize);
                if (GUILayout.Button(bundleVersion.Key + ", Version:" + bundleVersion.Value + ", Size: " + bundleFileSize + "kb"))
                {
                    List <string> assetsInBundle = null;
                    bundleContents.TryGetValue(bundleVersion.Key, out assetsInBundle);
                    if (assetsInBundle != null)
                    {
                        CreateContentWindow();
                        contentWindow.SelectAssetBundle(bundleVersion.Key, assetsInBundle, Application.dataPath + exportLocation, bundleFileSize);
                        contentWindow.ShowTab();
                    }
                }
            }


#if !UNITY_WEBPLAYER
            GUILayout.Label("FTP Upload Settings", EditorStyles.boldLabel);
            string strRemoteHostName = "ftp://bubblemon-l.upload.llnw.net";
            strRemoteHostName = EditorGUILayout.TextField("Remote Host Name", strRemoteHostName);
            string strRemoteUserName = "******";
            strRemoteUserName = EditorGUILayout.TextField("Remote User Name", strRemoteUserName);
            string strPassword = "******";
            strPassword = EditorGUILayout.PasswordField("Password", strPassword);
            string strDesirePath = "/content/bubblemon/qa1/AssetBundles/";
            strDesirePath = EditorGUILayout.TextField("Desire Path", strDesirePath);
            if (GUILayout.Button("Upload AssetBundle"))
            {
                FrameWork.Util.Uploader.FTPClient ftpClient = new FrameWork.Util.Uploader.FTPClient(strRemoteHostName, strRemoteUserName, strPassword, strDesirePath);

                DirectoryInfo info      = new DirectoryInfo(Application.dataPath + exportLocation);
                FileInfo[]    filesInfo = info.GetFiles();

                foreach (FileInfo fileInfo in filesInfo)
                {
                    ftpClient.UploadFile(fileInfo.FullName);
                }
            }
#else
            GUILayout.Label("FTP Upload Settings is available without webplayer platform. please swith build setting.");
#endif

            EditorGUILayout.EndScrollView();
        }