コード例 #1
0
    static Texture2D GetSharedIconOfInlucde(string assetPath)
    {
        var bundleList = BundleManager.GetRelatedBundles(assetPath);

        if (bundleList != null && bundleList.Count > 0)
        {
            foreach (BundleData bundle in bundleList)
            {
                if (bundle.name == currentBundle.name)
                {
                    continue;
                }
                if (BundleManager.IsBundleDependOn(bundle.name, currentBundle.name))
                {
                    return(BMGUIStyles.GetIcon("dependedAsset"));
                }
                else if (BundleManager.IsBundleDependOn(currentBundle.name, bundle.name))
                {
                    return(BMGUIStyles.GetIcon("sharedAsset"));
                }
            }
        }

        bundleList = BundleManager.GetIncludeBundles(assetPath);
        if (bundleList != null && bundleList.Count > 1)
        {
            return(BMGUIStyles.GetIcon("duplicatedInclude"));
        }

        return(null);
    }
コード例 #2
0
    void GUIDrawItemDesc(GM.BundleInfo itemDesc)
    {
        bool     isReceiving       = mCurrentRecieving == itemDesc;
        bool     isSelecting       = mSelections.Contains(itemDesc);
        GUIStyle currentLabelStyle = BMGUIStyles.GetStyle("TreeItemUnSelect");

        if (isReceiving)
        {
            currentLabelStyle = BMGUIStyles.GetStyle("receivingLable");
        }
        else if (isSelecting)
        {
            currentLabelStyle = HasFocus() ? BMGUIStyles.GetStyle("TreeItemSelectBlue") : BMGUIStyles.GetStyle("TreeItemSelectGray");
        }

        Rect itemRect = EditorGUILayout.BeginHorizontal(currentLabelStyle);

        GUILayout.Label(BMGUIStyles.GetIcon("assetBundleIcon"), BMGUIStyles.GetStyle("BItemLabelNormal"), GUILayout.ExpandWidth(false));

        GUILayout.Label(new GUIContent(itemDesc.BundleName), isSelecting ? BMGUIStyles.GetStyle("BItemLabelActive") : BMGUIStyles.GetStyle("BItemLabelNormal"), GUILayout.ExpandWidth(true));

        EditorGUILayout.EndHorizontal();

        if (DragProcess(itemRect, itemDesc))
        {
            return;
        }

        SelectProcess(itemRect, itemDesc);
    }
コード例 #3
0
    static Texture2D GetSharedIconOfDepend(string guid)
    {
        var bundleList = BundleManager.GetIncludeBundles(guid);

        if (bundleList != null && bundleList.Count > 0)
        {
            foreach (BundleData bundle in bundleList)
            {
                if (bundle.name == currentBundle.name)
                {
                    continue;
                }

                if (BundleManager.IsBundleDependOn(currentBundle.name, bundle.name))
                {
                    return(BMGUIStyles.GetIcon("sharedAsset"));
                }
            }
        }

        bundleList = BundleManager.GetExIncludeBundles(guid);
        if (bundleList != null && bundleList.Count > 0)
        {
            foreach (BundleData bundle in bundleList)
            {
                if (bundle.name == currentBundle.name)
                {
                    continue;
                }

                if (BundleManager.IsBundleDependOn(currentBundle.name, bundle.name))
                {
                    return(BMGUIStyles.GetIcon("sharedAsset"));
                }
            }
        }

        bundleList = BundleManager.GetRelatedBundles(guid);
        if (bundleList != null && bundleList.Count > 1)
        {
            foreach (BundleData bundle in bundleList)
            {
                if (bundle.name == currentBundle.name)
                {
                    continue;
                }

                if (!BundleManager.IsBundleDependOn(bundle.name, currentBundle.name) &&
                    !BundleManager.IsBundleDependOn(currentBundle.name, bundle.name))
                {
                    return(BMGUIStyles.GetIcon("duplicatedDepend"));
                }
            }
        }

        return(null);
    }
コード例 #4
0
    Rect GUI_DrawItem(BundleData bundle, int indent)
    {
        bool isEditing   = m_CurrentEditing == bundle.name;
        bool isRecieving = m_CurrentRecieving == bundle.name;
        bool isSelected  = m_Selections.Contains(bundle.name);

        GUIStyle currentLableStyle = BMGUIStyles.GetStyle("TreeItemUnSelect");

        if (isRecieving)
        {
            currentLableStyle = BMGUIStyles.GetStyle("receivingLable");
        }
        else if (isSelected && !isEditing)
        {
            currentLableStyle = HasFocuse() ? BMGUIStyles.GetStyle("TreeItemSelectBlue") : BMGUIStyles.GetStyle("TreeItemSelectGray");
        }

        Rect itemRect = EditorGUILayout.BeginHorizontal(currentLableStyle);

        if (bundle.children.Count == 0)
        {
            GUILayout.Space(m_IndentWidth * indent + m_NoToggleIndent);
        }
        else
        {
            GUILayout.Space(m_IndentWidth * indent);
            bool fold = !GUILayout.Toggle(!IsFold(bundle.name), "", BMGUIStyles.GetStyle("Foldout"));
            SetFold(bundle.name, fold);
        }

        GUILayout.Label(bundle.sceneBundle ? BMGUIStyles.GetIcon("sceneBundleIcon") : BMGUIStyles.GetIcon("assetBundleIcon"), BMGUIStyles.GetStyle("BItemLabelNormal"), GUILayout.ExpandWidth(false));

        if (!isEditing)
        {
            GUILayout.Label(bundle.name, isSelected ? BMGUIStyles.GetStyle("BItemLabelActive") : BMGUIStyles.GetStyle("BItemLabelNormal"));
        }
        else
        {
            GUI.SetNextControlName(m_EditTextFeildName);
            m_EditString = EditorGUILayout.TextField(m_EditString, BMGUIStyles.GetStyle("TreeEditField"));
        }

        EditorGUILayout.EndHorizontal();

        return(itemRect);
    }
コード例 #5
0
    static Texture2D GetSharedIconOfInlucde(string guid)
    {
        var includeBundleList = BundleManager.GetIncludeBundles(guid);

        if (includeBundleList != null && includeBundleList.Count > 1)
        {
            foreach (BundleData bundle in includeBundleList)
            {
                if (bundle.name == currentBundle.name)
                {
                    continue;
                }

                if (BundleManager.IsBundleDependOn(currentBundle.name, bundle.name))
                {
                    return(BMGUIStyles.GetIcon("sharedAsset"));
                }
                else if (!BundleManager.IsBundleDependOn(bundle.name, currentBundle.name))
                {
                    return(BMGUIStyles.GetIcon("duplicatedInclude"));
                }
            }
        }

        var exIncludeBundleList = BundleManager.GetExIncludeBundles(guid);

        if (exIncludeBundleList != null && exIncludeBundleList.Count > 1)
        {
            foreach (BundleData bundle in exIncludeBundleList)
            {
                if (bundle.name == currentBundle.name)
                {
                    continue;
                }

                if (BundleManager.IsBundleDependOn(currentBundle.name, bundle.name))
                {
                    return(BMGUIStyles.GetIcon("sharedAsset"));
                }
                else if (!BundleManager.IsBundleDependOn(bundle.name, currentBundle.name))
                {
                    return(BMGUIStyles.GetIcon("duplicatedInclude"));
                }
            }
        }

        var dependBundleList = BundleManager.GetRelatedBundles(guid);

        if (dependBundleList != null && dependBundleList.Count > 0)
        {
            foreach (BundleData bundle in dependBundleList)
            {
                if (bundle.name == currentBundle.name)
                {
                    continue;
                }

                if (BundleManager.IsBundleDependOn(bundle.name, currentBundle.name))
                {
                    return(BMGUIStyles.GetIcon("dependedAsset"));
                }
            }
        }

        return(null);
    }
コード例 #6
0
        public void OnGUI()
        {
            Color Backup = GUI.color;

            if (Setting != null)
            {
                List <string> Platforms = new List <string>();
                Platforms.AddRange(new string[] { "Android", "Standalones", "IOS" });

                List <string> BundleNames = new List <string>();
                foreach (var OneOf in Setting.ListOfBundles)
                {
                    BundleNames.Add(OneOf.Name);
                }

                if (tipString.Count == 0)
                {
                    tipString.Add("Platform: 当前支持的平台");
                    tipString.Add("Game(Common): Game表明当前配置为游戏bundle配置, Common表明是通用bundle配置");
                    tipString.Add("Amount: 当前配置含有的bundle数量");
                    tipString.Add("是否拷贝:是否需要拷贝到StreamingAsset目录");
                }

                GUILayout.BeginHorizontal();
                {
                    GUILayout.BeginVertical();
                    {
                        GUI.color = Color.cyan;
                        foreach (string str in tipString)
                        {
                            GUI.color = Color.white;
                            GUILayout.Label(str, BMGUIStyles.GetStyle("BoldLabel"));
                            //GUILayout.Space(2);
                        }
                    }
                    GUILayout.EndVertical();
                }
                GUILayout.EndHorizontal();

                GUILayout.Space(10);
                GUI.color = Color.white;
                GUILayout.BeginVertical();
                {
                    GUILayout.BeginHorizontal();
                    {
                        //platform
                        GUI.color = Color.white;
                        GUILayout.Label("Platform:", BMGUIStyles.GetStyle("BoldLabel"));
                        GUI.color   = Color.cyan;
                        SelPlatform = EditorGUILayout.Popup(SelPlatform, Platforms.ToArray(), GUILayout.MaxWidth(80));
                        GUILayout.FlexibleSpace();

                        //cook for
                        GUI.color = Color.white;
                        GUILayout.Label("Game(Common):", BMGUIStyles.GetStyle("BoldLabel"));
                        GUI.color = Color.cyan;
                        int section = EditorGUILayout.Popup(focusGame, gameNames.ToArray(), GUILayout.MaxWidth(80));
                        if (section != focusGame)
                        {
                            focusGame = section;
                            UpdateFocusGame(focusGame);
                        }
                        GUILayout.FlexibleSpace();


                        //bundle amount
                        GUI.color = Color.white;
                        GUILayout.Label("Amount:", BMGUIStyles.GetStyle("BoldLabel"));
                        GUI.color = Color.cyan;
                        GUILayout.Label("" + Setting.ListOfBundles.Count + " 个", BMGUIStyles.GetStyle("BoldLabel"));
                        GUILayout.FlexibleSpace();

                        if ((EGameBundle)focusGame != EGameBundle.EGB_ALL)
                        {
                            GUI.color = Color.white;
                            GUILayout.Label("是否拷贝:", BMGUIStyles.GetStyle("BoldLabel"));
                            GUI.color = Color.cyan;
                            section   = Setting.bToStreamingAsset == true ? 1 : 0;
                            int  result = EditorGUILayout.Popup(section, new string[] { "false", "true" }, new GUILayoutOption[] { GUILayout.MaxWidth(100) });
                            bool bCopy  = result == 0 ? false : true;
                            if (bCopy != Setting.bToStreamingAsset)
                            {
                                foreach (var obj in Setting.ListOfBundles)
                                {
                                    obj.bCopy = bCopy;
                                }

                                Setting.bToStreamingAsset = bCopy;
                            }
                            GUI.color = Color.white;
                        }
                    }
                    GUILayout.EndHorizontal();
                }

                GUILayout.Space(10);
                GUI.color = Color.white;
                ScrollPos = GUILayout.BeginScrollView(ScrollPos, new GUILayoutOption[] { GUILayout.ExpandHeight(true) });
                {
                    GUILayout.MinHeight(600);
                    GUILayout.BeginVertical(BMGUIStyles.GetStyle("Wizard Box"));
                    {
                        for (int Index = 0; Index < Setting.ListOfBundles.Count; ++Index)
                        {
                            BundleInfo.Element OneOf = Setting.ListOfBundles[Index];

                            if (SelBundle.Equals(OneOf.GetHashCode()))
                            {
                                GUI.color = Color.yellow;
                            }
                            else
                            {
                                GUI.color = new Color(2, 2, 2, 1);
                            }

                            GUILayout.BeginVertical("box");
                            {
                                GUILayout.BeginHorizontal();
                                GUILayout.Label("名    称 : ");
                                OneOf.Name = GUILayout.TextArea(OneOf.Name);
                                GUILayout.EndHorizontal();

                                GUILayout.BeginHorizontal();
                                GUILayout.Label("路    径 : ");
                                GUILayout.FlexibleSpace();
                                GUI.color = Color.yellow;
                                GUILayout.Label(OneOf.Path);
                                GUI.color = Color.white;
                                if (GUILayout.Button(BMGUIStyles.GetIcon("assetBundleIcon"), new GUILayoutOption[] { GUILayout.MaxWidth(16), GUILayout.MaxHeight(16) }))
                                {
                                    if (Selection.activeObject == null)
                                    {
                                        EditorUtility.DisplayDialog("提示", "请在Project视图中选择路径!", "OK");
                                    }
                                    else
                                    {
                                        OneOf.Path = AssetDatabase.GetAssetPath(Selection.activeObject).Replace("\\", "/");
                                    }
                                }
                                GUILayout.EndHorizontal();

                                GUILayout.BeginHorizontal();
                                GUILayout.Label("模    式 : ");
                                OneOf.Mode = (BundleInfo.BundleMode)EditorGUILayout.Popup((int)OneOf.Mode, new string[] { "Separate By SubFiles", "Separate By SubFolders", "All In One Package", "Single File", "Scene Bundle" }, new GUILayoutOption[] { GUILayout.MaxWidth(140) });
                                GUILayout.EndHorizontal();

                                GUILayout.BeginHorizontal();
                                GUILayout.Label("是否加密 :");
                                int section = 0;
                                if (OneOf.bEncrypt)
                                {
                                    section = 1;
                                }

                                int result = EditorGUILayout.Popup(section, new string[] { "false", "true" }, new GUILayoutOption[] { GUILayout.MaxWidth(140) });
                                OneOf.bEncrypt = result == 1;
                                GUILayout.EndHorizontal();
                            }

                            GUILayout.EndVertical();

                            bool IsRClicked = Event.current.type == EventType.MouseUp && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition);
                            if (IsRClicked)
                            {
#if UNITY_EDITOR_OSX
                                if ((Event.current.button == 0 && Event.current.control == true) ||
                                    Event.current.button == 1)
                                {
                                    SelBundle = OneOf.GetHashCode();
                                }
#else
                                if (Event.current.button == 1)
                                {
                                    SelBundle = OneOf.GetHashCode();
                                }
#endif

                                Repaint();
                            }
                        }
                    }
                    GUILayout.EndVertical();
                }
                GUILayout.EndScrollView();
            }


            GUILayout.Space(5);
            GUI.color = Color.green;
            GUILayout.BeginHorizontal();
            {
                if (GUILayout.Button("保存配置"))
                {
                    SaveBundleCondfig();
                }
                if (GUILayout.Button("新建"))
                {
                    Create();
                }
                if (GUILayout.Button("删除"))
                {
                    Delete();
                }
                if (GUILayout.Button("打包"))
                {
                    Publish();
                }

                // if (GUILayout.Button("快速打包")) DoMakeBundle(BuildOutPath_, BuildTarget.Android);
                //if (GUILayout.Button("复制")) CopyResult();
                //if (GUILayout.Button("资源复制到res")) CopyRes();
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(10);

            GUI.color = Backup;
        }
コード例 #7
0
    Rect GUI_DrawItem(BundleData bundle, int indent)
    {
        var extra = bundle.GetExtraData();
        var state = BundleManager.GetBuildStateOfBundle(bundle.name);

        bool isEditing   = m_CurrentEditing == bundle.name;
        bool isRecieving = m_CurrentRecieving == bundle.name;
        bool isSelected  = m_Selections.Contains(bundle.name);

        GUIStyle currentLableStyle = BMGUIStyles.GetStyle("TreeItemUnSelect");

        if (isRecieving)
        {
            currentLableStyle = BMGUIStyles.GetStyle("receivingLable");
        }
        else if (isSelected && !isEditing)
        {
            currentLableStyle = HasFocuse() ? BMGUIStyles.GetStyle("TreeItemSelectBlue") : BMGUIStyles.GetStyle("TreeItemSelectGray");
        }

        Rect itemRect = EditorGUILayout.BeginHorizontal(currentLableStyle);

        if (bundle.GetChildren().Count == 0)
        {
            GUILayout.Space(m_IndentWidth * indent + m_NoToggleIndent);
        }
        else
        {
            GUILayout.Space(m_IndentWidth * indent);
            bool fold = !GUILayout.Toggle(!IsFold(bundle.name), "", BMGUIStyles.GetStyle("Foldout"));
            SetFold(bundle.name, fold);
        }

        Texture2D bundleIcon = null;

        switch (bundle.bundleType)
        {
        case BundleType.Scene:
            bundleIcon = BMGUIStyles.GetIcon("sceneBundleIcon");
            break;

        case BundleType.Text:
            bundleIcon = BMGUIStyles.GetIcon("textBundleIcon");
            break;

        default:
            bundleIcon = BMGUIStyles.GetIcon("assetBundleIcon");
            break;
        }
        GUILayout.Label(bundleIcon, BMGUIStyles.GetStyle("BItemLabelNormal"), GUILayout.ExpandWidth(false));
        //GUILayout.Label(bundle.sceneBundle ? BMGUIStyles.GetIcon("sceneBundleIcon") : BMGUIStyles.GetIcon("assetBundleIcon"), BMGUIStyles.GetStyle("BItemLabelNormal"), GUILayout.ExpandWidth(false));

        if (!isEditing)
        {
            GUILayout.Label(bundle.name, isSelected ? BMGUIStyles.GetStyle("BItemLabelActive") : BMGUIStyles.GetStyle("BItemLabelNormal"));
        }
        else
        {
            GUI.SetNextControlName(m_EditTextFeildName);
            m_EditString = GUILayout.TextField(m_EditString, BMGUIStyles.GetStyle("TreeEditField"));
        }

        var r = GUILayoutUtility.GetLastRect();

        r.x      = r.xMax - 20;
        r.height = 20;
        if (state.changed)
        {
            GUI.Label(r, m_WarnIcon);
        }
        else if (extra.needBuild)
        {
            GUI.Label(r, m_InfoIcon);
        }

        EditorGUILayout.EndHorizontal();

        return(itemRect);
    }