Esempio n. 1
0
        static void Init()
        {
            BundleHotFix window = (BundleHotFix)EditorWindow.GetWindow(typeof(BundleHotFix), false, "热更包界面", true);

            window.Show();

            Debug.Log(m_BunleTargetPath);
            Debug.Log(m_HotPath);
        }
            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();
            }