Example #1
0
    public static void ApplyStrategyGroup(InspectorElementPrefab prefab, int strategyIndex)
    {
        if (prefab == null || strategyIndex >= BundleDataManager.Instance.BuildStrategies.Count)
        {
            return;
        }

        if (prefab.Depends == null)
        {
            return;
        }

        BuildStrategy strategy = BundleDataManager.Instance.BuildStrategies[strategyIndex];

        if (strategy.Name == "None")
        {
            prefab.StrategieIndex = strategyIndex;
            for (int i = 0; i < prefab.Depends.Length; i++)
            {
                prefab.Depends[i].groupNumber = 0;
            }
        }
        else
        {
            if (strategy.IsMatching(ref prefab.AssetFilePath))
            {
                prefab.StrategieIndex = strategyIndex;
                for (int i = 0; i < prefab.Depends.Length; i++)
                {
                    prefab.Depends[i].groupNumber = strategy.GroupNumber(ref prefab.Depends[i].assetsFilePath);
                }
            }
        }
    }
Example #2
0
    private void LoadAsset(InspectorElementPrefab.InspectorElementPrefabDepend[] filePath)
    {
        cacheObjects.Clear();

        if (filePath == null)
            return;

        for (int i = 0; i < filePath.Length; i++)
        {
            cacheObjects.Add(AssetDatabase.LoadAssetAtPath<Object>(filePath[i].assetsFilePath));
        }
    }
Example #3
0
    public void Refresh(InspectorElement element)
    {
        mSelectNodel      = ((BundleListWindow)mOwnerWindow).SelectNodel;
        cacheBundleObject = element;
        scrollVector2     = Vector2.zero;

        cacheFolderObject = cacheBundleObject as InspectorElementFolder;
        cachePrefabObject = cacheBundleObject as InspectorElementPrefab;
        if (cachePrefabObject != null)
        {
            LoadAsset(cachePrefabObject.Depends);
        }
    }
Example #4
0
    public void Refresh(InspectorElement element)
    {
        mSelectNodel = ((BundleListWindow)mOwnerWindow).SelectNodel;
        cacheBundleObject = element;
        scrollVector2 = Vector2.zero;

        cacheFolderObject = cacheBundleObject as InspectorElementFolder;
        cachePrefabObject = cacheBundleObject as InspectorElementPrefab;
        if (cachePrefabObject != null)
        {
            LoadAsset(cachePrefabObject.Depends);
        }
    }
Example #5
0
    public InspectorElement CreateInspectorElement(ref string assetFilePath, bool isFolder)
    {
        InspectorElement element = null;

        if (isFolder)
        {
            element = new InspectorElementFolder(assetFilePath);
        }
        else if (Path.GetExtension(assetFilePath) == ".prefab")
        {
            element = new InspectorElementPrefab(assetFilePath);
        }
        else
        {
            element = new InspectorElement(assetFilePath);
        }

        return(element);
    }
Example #6
0
    public static void BuildByElementPrefab(InspectorElementPrefab elementPrefab)
    {
        //ClearBundleName();

        var guildCommon = GetCommonBuilds();
        List <AssetBundleBuild> allListBuild = new List <AssetBundleBuild>(guildCommon);

        //allListBuild.Add(CreateBundleBuild(elementPrefab.AssetFilePath, elementPrefab.AssetName));
        allListBuild.AddRange(GetBundleBuildByElementPrefab(elementPrefab));

        BuildAssetBundles(Application.dataPath + "/../../Resources/TestBuildNew", ref allListBuild);
        //string outputFile = Application.dataPath + "/../../Resources/TestBuildNew";
        //if (Directory.Exists(outputFile) == false)
        //    Directory.CreateDirectory(outputFile);

        //var beforManifest = TryLoadBeforBundleManifest(outputFile);
        //var nowManigest = BuildPipeline.BuildAssetBundles(outputFile, allListBuild.ToArray(), BuildAssetBundleOptions.None, BundleSetting.UnityBuildTarget);
        //if (nowManigest != null && beforManifest != null)
        //{
        //    var finalManifest = BundleManifest.CombineBundleManifest(outputFile,beforManifest, nowManigest);
        //    if (finalManifest != null)
        //    {
        //        finalManifest.SaveToFile(outputFile + "/ReleaseManifest");
        //    }
        //    else
        //    {
        //        Logged.LogColor("ff0000", string.Format("BundleManifest.CombineBundleManifest result is null!"));
        //    }
        //}
        //else
        //{
        //    var finalManifest = new BundleManifest(nowManigest);
        //    finalManifest.SaveToFile(outputFile + "/ReleaseManifest");
        //}
        //Debug.Log(outputFile);
    }
Example #7
0
    //public static void FilterChildElements(ref List<ListElement> ownerElements, InspectorElementFolder folder)
    //{
    //    int state = folder.isIgnore ? 0 : 1;
    //    state = folder.IsIgnoreAll ? 3 : state;
    //    if (state == 0)
    //        return;



    //    for (int i = 0; i < ownerElements.Count; i++)
    //    {

    //    }
    //}



    static List <AssetBundleBuild> GetBundleBuildByElementPrefab(InspectorElementPrefab elementPrefab)
    {
        List <AssetBundleBuild> result = new List <AssetBundleBuild>();

        if (elementPrefab.Depends == null)
        {
            return(result);
        }

        //  main
        tempDictionary.Clear();

        InspectorElementPrefab.InspectorElementPrefabDepend depend;

        AssetBundleBuild mainBuild = new AssetBundleBuild();

        mainBuild.assetBundleName = elementPrefab.AssetName;
        mainBuild.assetNames      = new string[elementPrefab.Depends.Length];


        for (int i = 0; i < elementPrefab.Depends.Length; i++)
        {
            depend = elementPrefab.Depends[i];
            mainBuild.assetNames[i] = depend.assetsFilePath;
            if (depend.groupNumber == -1)
            {
                tempDictionary.Add((short)(1000 + i), new List <InspectorElementPrefab.InspectorElementPrefabDepend>()
                {
                    depend
                });
            }
            else
            {
                if (tempDictionary.ContainsKey(depend.groupNumber))
                {
                    tempDictionary[depend.groupNumber].Add(depend);
                }
                else
                {
                    tempDictionary.Add(depend.groupNumber, new List <InspectorElementPrefab.InspectorElementPrefabDepend>()
                    {
                        depend
                    });
                }
            }
        }

        result.Add(CreateBundleBuild(elementPrefab.AssetFilePath, elementPrefab.AssetName));

        //  grounp
        foreach (var iter in tempDictionary)
        {
            if (iter.Key > 0)
            {
                AssetBundleBuild subBuild = new AssetBundleBuild();
                if (iter.Key >= 1000)
                {
                    //  single
                    subBuild.assetBundleName = Path.GetFileNameWithoutExtension(iter.Value[0].assetsFilePath);
                }
                else
                {
                    subBuild.assetBundleName = elementPrefab.AssetName + iter.Key.ToString();
                }
                subBuild.assetNames = new string[iter.Value.Count];
                for (int i = 0; i < iter.Value.Count; i++)
                {
                    subBuild.assetNames[i] = iter.Value[i].assetsFilePath;
                    SetBundleName(subBuild.assetNames[i], Path.GetFileNameWithoutExtension(subBuild.assetNames[i]));
                }
                result.Add(subBuild);
            }
        }


        //for (int i = 0; i < UPPER; i++)
        //{

        //}



        return(result);
    }
Example #8
0
 private void DrawDepend(InspectorElementPrefab.InspectorElementPrefabDepend depend, int index )
 {
     EditorGUILayout.BeginHorizontal();
     depend.groupNumber = (short)EditorGUILayout.IntField(depend.groupNumber, GUILayout.MaxWidth(50f));
     EditorGUILayout.ObjectField(string.Empty, cacheObjects[index], typeof (Object), false, GUILayout.MaxWidth(200f));
     //lastRect.width = start[0].y;
     //depend.groupNumber = (byte)EditorGUI.IntField(lastRect, depend.groupNumber);
     //lastRect.x += start[1].x;
     //lastRect.width = start[1].y;
     //EditorGUI.ObjectField(lastRect, cacheObjects[index], typeof (Object));
     EditorGUILayout.EndHorizontal();
 }
Example #9
0
    //public static void FilterChildElements(ref List<ListElement> ownerElements, InspectorElementFolder folder)
    //{
    //    int state = folder.isIgnore ? 0 : 1;
    //    state = folder.IsIgnoreAll ? 3 : state;
    //    if (state == 0)
    //        return;

        

    //    for (int i = 0; i < ownerElements.Count; i++)
    //    {
            
    //    }
    //}



    static List<AssetBundleBuild> GetBundleBuildByElementPrefab(InspectorElementPrefab elementPrefab)
    {
        List<AssetBundleBuild> result = new List<AssetBundleBuild>();

        if (elementPrefab.Depends == null)
            return result;

        //  main
        tempDictionary.Clear();

        InspectorElementPrefab.InspectorElementPrefabDepend depend;

        AssetBundleBuild mainBuild = new AssetBundleBuild();
        mainBuild.assetBundleName = elementPrefab.AssetName;
        mainBuild.assetNames = new string[elementPrefab.Depends.Length];


        for (int i = 0; i < elementPrefab.Depends.Length; i++)
        {
            depend = elementPrefab.Depends[i];
            mainBuild.assetNames[i] = depend.assetsFilePath;
            if (depend.groupNumber == -1)
            {
                tempDictionary.Add((short)(1000 + i),new List<InspectorElementPrefab.InspectorElementPrefabDepend>() {depend});
            }
            else
            {
                if (tempDictionary.ContainsKey(depend.groupNumber))
                {
                    tempDictionary[depend.groupNumber].Add(depend);
                }
                else
                {
                    tempDictionary.Add(depend.groupNumber, new List<InspectorElementPrefab.InspectorElementPrefabDepend>() { depend });
                }
            }
            
        }

        result.Add(CreateBundleBuild(elementPrefab.AssetFilePath, elementPrefab.AssetName));

        //  grounp
        foreach (var iter in tempDictionary)
        {
            if (iter.Key > 0)
            {
                AssetBundleBuild subBuild = new AssetBundleBuild();
                if (iter.Key >= 1000)
                {
                    //  single
                    subBuild.assetBundleName = Path.GetFileNameWithoutExtension(iter.Value[0].assetsFilePath);
                }
                else
                {
                    subBuild.assetBundleName = elementPrefab.AssetName + iter.Key.ToString();
                }
                subBuild.assetNames = new string[iter.Value.Count];
                for (int i = 0; i < iter.Value.Count; i++)
                {
                    subBuild.assetNames[i] = iter.Value[i].assetsFilePath;
                    SetBundleName(subBuild.assetNames[i], Path.GetFileNameWithoutExtension(subBuild.assetNames[i]));
                }
                result.Add(subBuild);
            }
        }


        //for (int i = 0; i < UPPER; i++)
        //{
            
        //}

        

        return result;
    }
Example #10
0
    public static void ApplyStrategyGroup(InspectorElementPrefab prefab, int strategyIndex)
    {
        if (prefab == null || strategyIndex >= BundleDataManager.Instance.BuildStrategies.Count)
            return;

        if (prefab.Depends == null)
            return;

        BuildStrategy strategy = BundleDataManager.Instance.BuildStrategies[strategyIndex];
        if (strategy.Name == "None" )
        {
            prefab.StrategieIndex = strategyIndex;
            for (int i = 0; i < prefab.Depends.Length; i++)
            {
                prefab.Depends[i].groupNumber = 0;
            }
        }
        else
        {

            if (strategy.IsMatching(ref prefab.AssetFilePath) )
            {
                prefab.StrategieIndex = strategyIndex;
                for (int i = 0; i < prefab.Depends.Length; i++)
                {
                    prefab.Depends[i].groupNumber = strategy.GroupNumber(ref prefab.Depends[i].assetsFilePath);
                }
            }
        }
    }
Example #11
0
    public static void BuildByElementPrefab(InspectorElementPrefab elementPrefab)
    {
        //ClearBundleName();

        var guildCommon = GetCommonBuilds();
        List<AssetBundleBuild> allListBuild = new List<AssetBundleBuild>(guildCommon);
        //allListBuild.Add(CreateBundleBuild(elementPrefab.AssetFilePath, elementPrefab.AssetName));
        allListBuild.AddRange(GetBundleBuildByElementPrefab(elementPrefab));

        BuildAssetBundles(Application.dataPath + "/../../Resources/TestBuildNew", ref allListBuild);
        //string outputFile = Application.dataPath + "/../../Resources/TestBuildNew";
        //if (Directory.Exists(outputFile) == false)
        //    Directory.CreateDirectory(outputFile);

        //var beforManifest = TryLoadBeforBundleManifest(outputFile);
        //var nowManigest = BuildPipeline.BuildAssetBundles(outputFile, allListBuild.ToArray(), BuildAssetBundleOptions.None, BundleSetting.UnityBuildTarget);
        //if (nowManigest != null && beforManifest != null)
        //{
        //    var finalManifest = BundleManifest.CombineBundleManifest(outputFile,beforManifest, nowManigest);
        //    if (finalManifest != null)
        //    {
        //        finalManifest.SaveToFile(outputFile + "/ReleaseManifest");
        //    }
        //    else
        //    {
        //        Logged.LogColor("ff0000", string.Format("BundleManifest.CombineBundleManifest result is null!"));
        //    }
        //}
        //else
        //{
        //    var finalManifest = new BundleManifest(nowManigest);
        //    finalManifest.SaveToFile(outputFile + "/ReleaseManifest");
        //}
        //Debug.Log(outputFile);
    }