Пример #1
0
            void ReloadMarkedList()
            {
                mMarkedPathList.Clear();

                AssetDatabase.GetAllAssetBundleNames()
                .SelectMany(n =>
                {
                    var result = AssetDatabase.GetAssetPathsFromAssetBundle(n);

                    return(result.Select(r =>
                    {
                        if (ResKitAssetsMenu.Marked(r))
                        {
                            return r;
                        }

                        if (ResKitAssetsMenu.Marked(r.GetPathParentFolder()))
                        {
                            return r.GetPathParentFolder();
                        }

                        return null;
                    }).Where(r => r != null)
                           .Distinct());
                })
                .ForEach(n => new HorizontalLayout()
                         .AddChild(EasyIMGUI.Label().Text(n))
                         .AddChild(EasyIMGUI.Button()
                                   .Text(LocaleText.Select)
                                   .OnClick(() =>
                {
                    Selection.objects = new[]
                    {
                        AssetDatabase.LoadAssetAtPath <Object>(n)
                    };
                }).Width(50))
                         .AddChild(EasyIMGUI.Button()
                                   .Text(LocaleText.CancelMark)
                                   .OnClick(() =>
                {
                    ResKitAssetsMenu.MarkAB(n);

                    EditorLifecycle.PushCommand(() => { ReloadMarkedList(); });
                }).Width(75))
                         .Parent(mMarkedPathList)
                         );
            }
Пример #2
0
            void ReloadMarkedList()
            {
                mMarkedPathList.Clear();

                AssetDatabase.GetAllAssetBundleNames()
                .SelectMany(n =>
                {
                    var result = AssetDatabase.GetAssetPathsFromAssetBundle(n);

                    return(result.Select(r =>
                    {
                        if (ResKitAssetsMenu.Marked(r))
                        {
                            return r;
                        }

                        if (ResKitAssetsMenu.Marked(r.GetPathParentFolder()))
                        {
                            return r.GetPathParentFolder();
                        }

                        return null;
                    }).Where(r => r != null)
                           .Distinct());
                })
                .ForEach(n => new HorizontalLayout()
                         .AddChild(new LabelView(n))
                         .AddChild(new ButtonView("选择", () =>
                {
                    Selection.objects = new[]
                    {
                        AssetDatabase.LoadAssetAtPath <Object>(n)
                    };
                }).Width(50))
                         .AddChild(new ButtonView("取消标记", () =>
                {
                    ResKitAssetsMenu.MarkAB(n);

                    EditorLifecycle.PushCommand(() => { ReloadMarkedList(); });
                }).Width(75))
                         .AddTo(mMarkedPathList)
                         );
            }
Пример #3
0
            public void Init(IQFrameworkContainer container)
            {
                EasyIMGUI.Label().Text(LocaleText.ResKit).FontSize(12).Parent(this);

                var verticalLayout = new VerticalLayout("box").Parent(this);

                var persistLine = EasyIMGUI.Horizontal();

                EasyIMGUI.Label().Text("PersistantPath:").Parent(persistLine).Width(100);
                EasyIMGUI.TextField().Text(Application.persistentDataPath).Parent(persistLine);
                persistLine.Parent(verticalLayout);

                EasyIMGUI.Button()
                .Text(LocaleText.GoToPersistent)
                .OnClick(() => { EditorUtility.RevealInFinder(Application.persistentDataPath); })
                .Parent(verticalLayout);

                mResVersion          = EditorPrefs.GetString(KEY_QAssetBundleBuilder_RESVERSION, "100");
                mEnableGenerateClass = EditorPrefs.GetBool(KEY_AUTOGENERATE_CLASS, true);

                switch (EditorUserBuildSettings.activeBuildTarget)
                {
                case BuildTarget.WSAPlayer:
                    mBuildTargetIndex = 4;
                    break;

                case BuildTarget.WebGL:
                    mBuildTargetIndex = 3;
                    break;

                case BuildTarget.Android:
                    mBuildTargetIndex = 2;
                    break;

                case BuildTarget.iOS:
                    mBuildTargetIndex = 1;
                    break;

                default:
                    mBuildTargetIndex = 0;
                    break;
                }

                EasyIMGUI.Toolbar()
                .AddMenu("Windows/MacOS")
                .AddMenu("iOS")
                .AddMenu("Android")
                .AddMenu("WebGL")
                .AddMenu("WSAPlayer")
                .Index(mBuildTargetIndex)
                .Parent(verticalLayout);

                EasyIMGUI.Toggle()
                .Text(LocaleText.AutoGenerateClass)
                .IsOn(mEnableGenerateClass)
                .Parent(verticalLayout)
                .ValueProperty.Bind(v => mEnableGenerateClass = v);

                EasyIMGUI.Toggle()
                .Text(LocaleText.SimulationMode)
                .IsOn(ResKitEditorAPI.SimulationMode)
                .Parent(verticalLayout)
                .ValueProperty.Bind(v => ResKitEditorAPI.SimulationMode = v);

                // EasyIMGUI.Toggle()
                //    .Text(LocaleText.EncryptAB)
                //    .IsOn(GetConfig().EncryptAB)
                //    .Parent(verticalLayout)
                //    .ValueProperty.Bind(v => GetConfig().EncryptAB = v);


                // var aesLine = EasyIMGUI.Horizontal();
                // EasyIMGUI.Label().Text("AES秘钥:").Parent(aesLine).Width(100);
                // EasyIMGUI.TextField().Text(GetConfig().AESKey).Parent(aesLine).Content.OnValueChanged.AddListener(_=>GetConfig().AESKey=_);
                // aesLine.Parent(verticalLayout);

                // EasyIMGUI.Toggle()
                //    .Text(LocaleText.EncryptKey)
                //    .IsOn(GetConfig().EncryptKey)
                //    .Parent(verticalLayout)
                //    .ValueProperty.Bind(v => GetConfig().EncryptKey = v);

                var resVersionLine = new HorizontalLayout()
                                     .Parent(verticalLayout);

                // EasyIMGUI.Label().Text("ResVesion:").Parent(resVersionLine).Width(100);

                EasyIMGUI.TextField().Text(mResVersion).Parent(resVersionLine)
                .Content.Bind(v => mResVersion = v);

                EasyIMGUI.Button()
                .Text(LocaleText.GenerateClass)
                .OnClick(() =>
                {
                    BuildScript.WriteClass();
                    AssetDatabase.Refresh();
                }).Parent(verticalLayout);

                EasyIMGUI.Button()
                .Text(LocaleText.Build)
                .OnClick(() =>
                {
                    EditorLifecycle.PushCommand(() =>
                    {
                        var window = container.Resolve <EditorWindow>();

                        if (window)
                        {
                            window.Close();
                        }

                        ResKitEditorAPI.BuildAssetBundles();
                        //if (GetConfig().EncryptAB)
                        //{
                        //    string key = GetConfig().EncryptKey ? RSA.RSAEncrypt("", GetConfig().AESKey): GetConfig().AESKey;
                        //    BundleHotFix.EncryptAB(key);
                        //}
                    });
                }).Parent(verticalLayout);

                EasyIMGUI.Button()
                .Text(LocaleText.ForceClear)
                .OnClick(ResKitEditorAPI.ForceClearAssetBundles)
                .Parent(verticalLayout);

                verticalLayout.AddChild(EasyIMGUI.Space().Pixel(10));
                verticalLayout.AddChild(EasyIMGUI.Label().Text(LocaleText.MarkedAB).FontBold().FontSize(15));



                var scrollView = EasyIMGUI.Scroll().Parent(verticalLayout);

                mMarkedPathList = new VerticalLayout("box")
                                  .Parent(scrollView);

                ReloadMarkedList();
            }
Пример #4
0
            public void Init(IQFrameworkContainer container)
            {
                var expendLayout = new TreeNode(true, LocaleText.ResKit)
                                   .AddTo(this);

                var verticalLayout = new VerticalLayout("box");

                expendLayout.Add2Spread(verticalLayout);

                var persistLine = new HorizontalLayout();

                new LabelView("PersistantPath:").AddTo(persistLine).Width(100);
                new TextView(Application.persistentDataPath).AddTo(persistLine);
                persistLine.AddTo(verticalLayout);

                new ButtonView(LocaleText.GoToPersistent,
                               () => { EditorUtility.RevealInFinder(Application.persistentDataPath); }).AddTo(verticalLayout);

                mResVersion          = EditorPrefs.GetString(KEY_QAssetBundleBuilder_RESVERSION, "100");
                mEnableGenerateClass = EditorPrefs.GetBool(KEY_AUTOGENERATE_CLASS, true);

                switch (EditorUserBuildSettings.activeBuildTarget)
                {
                case BuildTarget.WebGL:
                    mBuildTargetIndex = 3;
                    break;

                case BuildTarget.Android:
                    mBuildTargetIndex = 2;
                    break;

                case BuildTarget.iOS:
                    mBuildTargetIndex = 1;
                    break;

                default:
                    mBuildTargetIndex = 0;
                    break;
                }

                new ToolbarView(mBuildTargetIndex)
                .AddMenu("win/osx", (_) => { })
                .AddMenu("iOS", (_) => { })
                .AddMenu("Android", (_) => { })
                .AddMenu("WebGL", (_) => { })
                .AddTo(verticalLayout);

                new ToggleView(LocaleText.AutoGenerateClass, mEnableGenerateClass)
                .AddTo(verticalLayout)
                .Toggle.Bind(v => mEnableGenerateClass = v);

                new ToggleView(LocaleText.SimulationMode, ResKitAssetsMenu.SimulateAssetBundleInEditor)
                .AddTo(verticalLayout)
                .Toggle.Bind(v => ResKitAssetsMenu.SimulateAssetBundleInEditor = v);

                var resVersionLine = new HorizontalLayout()
                                     .AddTo(verticalLayout);

                new LabelView("ResVesion:").AddTo(resVersionLine).Width(100);

                new TextView(mResVersion).AddTo(resVersionLine)
                .Content.Bind(v => mResVersion = v);

                new ButtonView(LocaleText.GenerateClass, () =>
                {
                    BuildScript.WriteClass();
                    AssetDatabase.Refresh();
                }).AddTo(verticalLayout);

                new ButtonView(LocaleText.Build, () =>
                {
                    EditorLifecycle.PushCommand(() =>
                    {
                        var window = container.Resolve <EditorWindow>();

                        if (window)
                        {
                            window.Close();
                        }

                        BuildWithTarget(EditorUserBuildSettings.activeBuildTarget);
                    });
                }).AddTo(verticalLayout);

                new ButtonView(LocaleText.ForceClear, () => { ForceClear(); }).AddTo(verticalLayout);

                verticalLayout.AddChild(new SpaceView(10));
                verticalLayout.AddChild(new LabelView("已标记 AB 列表:").FontBold().FontSize(15));


                var scrollView = new ScrollLayout().AddTo(verticalLayout);

                mMarkedPathList = new VerticalLayout("box")
                                  .AddTo(scrollView);

                ReloadMarkedList();
            }
Пример #5
0
            public void Init(IQFrameworkContainer container)
            {
                EasyIMGUI.Label().Text(LocaleText.ResKit).FontSize(12).AddTo(this);

                var verticalLayout = new VerticalLayout("box").AddTo(this);

                var persistLine = new HorizontalLayout();

                EasyIMGUI.Label().Text("PersistantPath:").AddTo(persistLine).Width(100);
                EasyIMGUI.TextField().Text(Application.persistentDataPath).AddTo(persistLine);
                persistLine.AddTo(verticalLayout);

                EasyIMGUI.Button()
                .Text(LocaleText.GoToPersistent)
                .OnClick(() => { EditorUtility.RevealInFinder(Application.persistentDataPath); })
                .AddTo(verticalLayout);

                mResVersion          = EditorPrefs.GetString(KEY_QAssetBundleBuilder_RESVERSION, "100");
                mEnableGenerateClass = EditorPrefs.GetBool(KEY_AUTOGENERATE_CLASS, true);

                switch (EditorUserBuildSettings.activeBuildTarget)
                {
                case BuildTarget.WebGL:
                    mBuildTargetIndex = 3;
                    break;

                case BuildTarget.Android:
                    mBuildTargetIndex = 2;
                    break;

                case BuildTarget.iOS:
                    mBuildTargetIndex = 1;
                    break;

                default:
                    mBuildTargetIndex = 0;
                    break;
                }

                EasyIMGUI.Toolbar()
                .AddMenu("win/osx")
                .AddMenu("iOS")
                .AddMenu("Android")
                .AddMenu("WebGL")
                .Index(mBuildTargetIndex)
                .AddTo(verticalLayout);

                EasyIMGUI.Toggle()
                .Text(LocaleText.AutoGenerateClass)
                .IsOn(mEnableGenerateClass)
                .AddTo(verticalLayout)
                .ValueProperty.Bind(v => mEnableGenerateClass = v);

                EasyIMGUI.Toggle()
                .Text(LocaleText.SimulationMode)
                .IsOn(AssetBundleSettings.SimulateAssetBundleInEditor)
                .AddTo(verticalLayout)
                .ValueProperty.Bind(v => AssetBundleSettings.SimulateAssetBundleInEditor = v);

                var resVersionLine = new HorizontalLayout()
                                     .AddTo(verticalLayout);

                EasyIMGUI.Label().Text("ResVesion:").AddTo(resVersionLine).Width(100);

                EasyIMGUI.TextField().Text(mResVersion).AddTo(resVersionLine)
                .Content.Bind(v => mResVersion = v);

                EasyIMGUI.Button()
                .Text(LocaleText.GenerateClass)
                .OnClick(() =>
                {
                    BuildScript.WriteClass();
                    AssetDatabase.Refresh();
                }).AddTo(verticalLayout);

                EasyIMGUI.Button()
                .Text(LocaleText.Build)
                .OnClick(() =>
                {
                    EditorLifecycle.PushCommand(() =>
                    {
                        var window = container.Resolve <EditorWindow>();

                        if (window)
                        {
                            window.Close();
                        }

                        BuildWithTarget(EditorUserBuildSettings.activeBuildTarget);
                    });
                }).AddTo(verticalLayout);

                EasyIMGUI.Button()
                .Text(LocaleText.ForceClear)
                .OnClick(() => { ForceClear(); })
                .AddTo(verticalLayout);

                verticalLayout.AddChild(EasyIMGUI.Space().Pixel(10));
                verticalLayout.AddChild(EasyIMGUI.Label().Text("已标记 AB 列表:").FontBold().FontSize(15));


                var scrollView = EasyIMGUI.Scroll().AddTo(verticalLayout);

                mMarkedPathList = new VerticalLayout("box")
                                  .AddTo(scrollView);

                ReloadMarkedList();
            }