Esempio n. 1
0
        private void CopyToTarget(ResourceEditorPlatformData editorPlatformData)
        {
            var copyOptions = editorPlatformData.TargetCopyOptions;
            var result      = CopyToStreamingAssets(editorPlatformData.Platform, copyOptions, _configDataConfigurator, _assetBundleConfigurator);
            var message     = string.Format("Copy to streaming assets : [{0}].", result ? "Success" : "Failed");

            EditorUtility.DisplayDialog("Info", message, "OK");
        }
Esempio n. 2
0
        private void BuildAssetBundles(ResourceEditorPlatformData editorPlatformData)
        {
            var locationDatas = editorPlatformData.ConfigData.LocationDatas;
            var options       = editorPlatformData.AssetBundleBuildOptions;
            var result        = _assetBundleConfigurator.BuildAssetBundles(locationDatas, editorPlatformData.Platform, options);

            AssetDatabase.Refresh();

            var message = string.Format("Asset bundles build : [{0}].", result ? "Success" : "Failed");

            EditorUtility.DisplayDialog("Info", message, "OK");
        }
Esempio n. 3
0
        private void FillDefaultPlatformDatas(List <ResourceEditorPlatformData> platformDatas)
        {
            var platformData = new ResourceEditorPlatformData {
                Platform = ResourceSettings.PLATFORM_DIRECTORY_IOS,
                AssetBundleBuildOptions = { BuildTarget = BuildTarget.iOS }
            };

            platformDatas.Add(platformData);

            platformData = new ResourceEditorPlatformData {
                Platform = ResourceSettings.PLATFORM_DIRECTORY_GP,
                AssetBundleBuildOptions = { BuildTarget = BuildTarget.Android }
            };
            platformDatas.Add(platformData);
        }
Esempio n. 4
0
        private void UpdateConfigData(ResourceEditorPlatformData editorPlatformData)
        {
            if (editorPlatformData.EditorAssetBundleDatas == null)
            {
                return;
            }

            var locationDatas = new Dictionary <string, LocationData> ();

            if (editorPlatformData.EditorAssetBundleDatas != null)
            {
                foreach (var assetBundleEditorData in editorPlatformData.EditorAssetBundleDatas)
                {
                    var assetBundleData = _configDataConfigurator.GenerateAssetBundleData(assetBundleEditorData.Id, editorPlatformData.ConfigGenerateOptions);
                    if (assetBundleData == null)
                    {
                        continue;
                    }

                    // add in location data
                    var          locationId = _configDataConfigurator.GetLocationId(assetBundleEditorData.Location, assetBundleEditorData.OdrTag);
                    LocationData locationData;
                    if (locationDatas.ContainsKey(locationId))
                    {
                        locationData = locationDatas [locationId];
                    }
                    else
                    {
                        locationData = new LocationData {
                            Id = locationId, Location = assetBundleEditorData.Location
                        };
                        locationDatas.Add(locationId, locationData);
                    }

                    locationData.AssetBundleDatas.Add(assetBundleData);
                }
            }

            editorPlatformData.ConfigData.LocationDatas = new List <LocationData> (locationDatas.Values);
            editorPlatformData.ConfigData.Init();
            editorPlatformData.ConfigFoldout.Contents.Clear();
            SaveConfigData(editorPlatformData);

            EditorUtility.DisplayDialog("Info", "Update Config to Virtual Streaming: Finished.", "OK");
        }
Esempio n. 5
0
        private void DrawTargetCopy(ResourceEditorPlatformData editorPlatformData)
        {
            EditorGUILayout.BeginVertical(GUI.skin.box);

            ResourceEditorHelper.WideLabelField("Target Copy: ----", EditorStyles.boldLabel);

            EditorGUILayout.BeginVertical(GUI.skin.box);
            var copyOptions = editorPlatformData.TargetCopyOptions;

            copyOptions.ClearFolders        = EditorGUILayout.Toggle("Clear Folders:", copyOptions.ClearFolders);
            copyOptions.ClearOtherPlatforms = EditorGUILayout.Toggle("Clear Other Platforms:", copyOptions.ClearOtherPlatforms);
            if (GUILayout.Button("Copy to Streaming Assets"))
            {
                EditorApplication.delayCall += () => CopyToTarget(editorPlatformData);
            }
            EditorGUILayout.EndVertical();

            EditorGUILayout.EndVertical();
        }
Esempio n. 6
0
        private void DrawAssetBundleLocations(ResourceEditorPlatformData editorPlatformData)
        {
            EditorGUILayout.BeginVertical(GUI.skin.box);

            // location settings
            ResourceEditorHelper.WideLabelField("Locations Settings: ----", EditorStyles.boldLabel);
            _assetBundleScrollPosition = _assetBundleConfigurator.DrawAssetBundleDatas(editorPlatformData.EditorAssetBundleDatas, _assetBundleScrollPosition);


            // one-key set
            EditorGUILayout.BeginHorizontal(GUI.skin.box);
            _oneKeyLocation = (LocationType)EditorGUILayout.EnumPopup("One-key Location:", _oneKeyLocation);
            if (GUILayout.Button("One-key Switch"))
            {
                _assetBundleConfigurator.SwitchAllAssetBundleDataLocations(editorPlatformData.EditorAssetBundleDatas, _oneKeyLocation);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();
        }
Esempio n. 7
0
        private void DrawConfigPreview(ResourceEditorPlatformData editorPlatformData)
        {
            EditorGUILayout.BeginVertical(GUI.skin.box);

            // preview
            ResourceEditorHelper.WideLabelField("Config Preview: ----", EditorStyles.boldLabel);
            _configShowPosition = _configDataConfigurator.DrawConfigData(editorPlatformData.ConfigData, editorPlatformData.ConfigFoldout, _configShowPosition);

            // update
            EditorGUILayout.BeginHorizontal(GUI.skin.box);
            var generateOptions = editorPlatformData.ConfigGenerateOptions;

            generateOptions.CollectSprite = EditorGUILayout.Toggle("Collect Sprite:", generateOptions.CollectSprite);
            if (GUILayout.Button("Update Config Data (in virtual)"))
            {
                EditorApplication.delayCall += () => UpdateConfigData(editorPlatformData);
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.EndVertical();
        }
Esempio n. 8
0
        private void DrawPlatformData(ResourceEditorPlatformData editorPlatformData)
        {
            EditorGUILayout.BeginVertical();

            EditorGUILayout.BeginHorizontal();
            // asset bundle
            DrawAssetBundleLocations(editorPlatformData);
            EditorGUILayout.Separator();
            // config
            DrawConfigPreview(editorPlatformData);
            EditorGUILayout.EndHorizontal();

            //EditorGUILayout.BeginHorizontal ();
            // build
            DrawAssetBundleBuilds(editorPlatformData);
            // copy
            DrawTargetCopy(editorPlatformData);
            //EditorGUILayout.EndHorizontal ();

            EditorGUILayout.EndVertical();
        }
Esempio n. 9
0
        private void DrawAssetBundleBuilds(ResourceEditorPlatformData editorPlatformData)
        {
            EditorGUILayout.BeginVertical(GUI.skin.box);

            ResourceEditorHelper.WideLabelField("Asset Bundle Build: ----", EditorStyles.boldLabel);

            // options
            EditorGUILayout.BeginVertical(GUI.skin.box);
            var buildOptions = editorPlatformData.AssetBundleBuildOptions;

            buildOptions.ClearFolders = EditorGUILayout.Toggle("Clear Folders:", buildOptions.ClearFolders);
            EditorGUILayout.BeginHorizontal();
            buildOptions.CompressOption = (CompressOption)EditorGUILayout.EnumPopup("Compress Options:", buildOptions.CompressOption);
            buildOptions.BuildTarget    = (BuildTarget)EditorGUILayout.EnumPopup("Build Target:", buildOptions.BuildTarget);
            EditorGUILayout.EndHorizontal();
            EditorGUILayout.EndVertical();

            if (GUILayout.Button("Build Asset Bundles (in virtual)"))
            {
                EditorApplication.delayCall += () => BuildAssetBundles(editorPlatformData);
            }

            EditorGUILayout.EndVertical();
        }
Esempio n. 10
0
 private void SaveConfigData(ResourceEditorPlatformData editorPlatformData)
 {
     _configDataConfigurator.SaveConfigData(editorPlatformData.ConfigData, editorPlatformData.Platform);
 }
Esempio n. 11
0
 private void LoadConfigData(ResourceEditorPlatformData editorPlatformData)
 {
     editorPlatformData.ConfigData = _configDataConfigurator.LoadConfigData(editorPlatformData.Platform);
     editorPlatformData.ConfigFoldout.Contents.Clear();
 }
Esempio n. 12
0
 private void InitAssetBundleDatas(ResourceEditorPlatformData editorPlatformData, string[] assetBundleNames)
 {
     editorPlatformData.EditorAssetBundleDatas = _assetBundleConfigurator.InitAssetBundleDatas(assetBundleNames, editorPlatformData.ConfigData);
 }