Esempio n. 1
0
        public TreeNode(bool spread, string content, int indent = 0, bool autosaveSpreadState = false)
        {
            if (autosaveSpreadState)
            {
                spread = EditorPrefs.GetBool(content, spread);
            }

            Content = content;
            Spread  = new Property <bool>(spread);

            Style = new GUIStyleProperty(() => EditorStyles.foldout);

            mFirstLine.AddTo(this);
            mFirstLine.AddChild(EasyIMGUI.Space().Pixel(indent));

            if (autosaveSpreadState)
            {
                Spread.Bind(value => EditorPrefs.SetBool(content, value));
            }


            EasyIMGUI.Custom().OnGUI(() => { Spread.Value = EditorGUILayout.Foldout(Spread.Value, Content, true, Style.Value); })
            .AddTo(mFirstLine);

            EasyIMGUI.Custom().OnGUI(() =>
            {
                if (Spread.Value)
                {
                    mSpreadView.DrawGUI();
                }
            }).AddTo(this);
        }
        private void OnRefreshList(List <PackageRepository> packageRepositories)
        {
            mRepositoryList.Clear();
            mRepositoryList.AddChild(EasyIMGUI.Space().Pixel(2));

            var localPackageVersion = mControllerNode.GetModel <ILocalPackageVersionModel>();

            foreach (var packageRepository in packageRepositories.OrderByDescending(p =>
            {
                var installedVersion = localPackageVersion.GetByName(p.name);

                if (installedVersion == null)
                {
                    return(-1);
                }
                else if (installedVersion.VersionNumber < p.VersionNumber)
                {
                    return(2);
                }
                else if (installedVersion.VersionNumber == p.VersionNumber)
                {
                    return(1);
                }
                else
                {
                    return(0);
                }
            }).ThenBy(p => p.name))
            {
                mRepositoryList
                .AddChild(EasyIMGUI.Space().Pixel(2))
                .AddChild(new PackageRepositoryView(packageRepository));
            }
        }
Esempio n. 3
0
        private void OnRefreshList(List <PackageRepository> packageRepositories)
        {
            mRepositoryList.Clear();
            mRepositoryList.AddChild(EasyIMGUI.Space().Pixel(2));

            foreach (var packageRepository in packageRepositories)
            {
                mRepositoryList
                .AddChild(EasyIMGUI.Space().Pixel(2))
                .AddChild(new PackageRepositoryView(packageRepository));
            }
        }
Esempio n. 4
0
        public T Convert <T>(XmlNode node) where T : class
        {
            var space = EasyIMGUI.Space();

            foreach (XmlAttribute nodeAttribute in node.Attributes)
            {
                if (nodeAttribute.Name == "Id")
                {
                    space.Id = nodeAttribute.Value;
                }
                else if (nodeAttribute.Name == "Pixel")
                {
                    space.Pixel(int.Parse(nodeAttribute.Value));
                }
            }

            return(space as T);
        }
        public void Init(IQFrameworkContainer container)
        {
            mViewModel = new UIKitSettingViewModel();

            EasyIMGUI.Label().Text(LocaleText.UIKitSettings).FontSize(12).Parent(this);

            mRootLayout = EasyIMGUI.Vertical().Box().Parent(this);

            mRootLayout.AddChild(EasyIMGUI.Space().Pixel(6));

            // 命名空间
            var nameSpaceLayout = new HorizontalLayout()
                                  .Parent(mRootLayout);

            EasyIMGUI.Label().Text(LocaleText.Namespace)
            .FontSize(12)
            .FontBold()
            .Width(200)
            .Parent(nameSpaceLayout);

            EasyIMGUI.TextField().Text(mUiKitSettingData.Namespace)
            .Parent(nameSpaceLayout)
            .Content.Bind(content => mUiKitSettingData.Namespace = content);

            // UI 生成的目录
            EasyIMGUI.Space().Pixel(6)
            .Parent(mRootLayout);

            var uiScriptGenerateDirLayout = new HorizontalLayout()
                                            .Parent(mRootLayout);

            EasyIMGUI.Label().Text(LocaleText.UIScriptGenerateDir)
            .FontSize(12)
            .FontBold()
            .Width(200)
            .Parent(uiScriptGenerateDirLayout);

            EasyIMGUI.TextField().Text(mUiKitSettingData.UIScriptDir)
            .Parent(uiScriptGenerateDirLayout)
            .Content.Bind(content => mUiKitSettingData.UIScriptDir = content);

            mRootLayout.AddChild(EasyIMGUI.Space().Pixel(6));

            var uiPanelPrefabDir = new HorizontalLayout()
                                   .Parent(mRootLayout);

            EasyIMGUI.Label().Text(LocaleText.UIPanelPrefabDir)
            .FontSize(12)
            .FontBold()
            .Width(200)
            .Parent(uiPanelPrefabDir);

            EasyIMGUI.TextField().Text(mUiKitSettingData.UIPrefabDir)
            .Parent(uiPanelPrefabDir)
            .Content.Bind(content => mUiKitSettingData.UIPrefabDir = content);

            mRootLayout.AddChild(EasyIMGUI.Space().Pixel(6));

            // UI 生成的目录
            EasyIMGUI.Space().Pixel(6)
            .Parent(mRootLayout);

            var viewControllerScriptGenerateDirLayout = new HorizontalLayout()
                                                        .Parent(mRootLayout);

            EasyIMGUI.Label().Text(LocaleText.ViewControllerScriptGenerateDir)
            .FontSize(12)
            .FontBold()
            .Width(200)
            .Parent(viewControllerScriptGenerateDirLayout);

            EasyIMGUI.TextField().Text(mUiKitSettingData.DefaultViewControllerScriptDir)
            .Parent(viewControllerScriptGenerateDirLayout)
            .Content.Bind(content => mUiKitSettingData.DefaultViewControllerScriptDir = content);


            mRootLayout.AddChild(EasyIMGUI.Space().Pixel(6));

            var viewControllerPrefabDir = new HorizontalLayout()
                                          .Parent(mRootLayout);

            EasyIMGUI.Label().Text(LocaleText.ViewControllerPrefabGenerateDir)
            .FontSize(12)
            .FontBold()
            .Width(220)
            .Parent(viewControllerPrefabDir);

            EasyIMGUI.TextField().Text(mUiKitSettingData.DefaultViewControllerPrefabDir)
            .Parent(viewControllerPrefabDir)
            .Content.Bind(content => mUiKitSettingData.DefaultViewControllerPrefabDir = content);

            mRootLayout.AddChild(EasyIMGUI.Space().Pixel(6));

            // 保存数据
            EasyIMGUI.Button()
            .Text(LocaleText.Apply)
            .OnClick(() => { mUiKitSettingData.Save(); })
            .Parent(mRootLayout);

            EasyIMGUI.TextField().Text(mViewModel.PanelNameToCreate)
            .Parent(mRootLayout)
            .Self(text => { text.Content.Bind(txt => mViewModel.PanelNameToCreate = txt); });

            // 创建 UI 界面 按钮的绑定
            EasyIMGUI.Button()
            .Text(LocaleText.CreateUIPanel)
            .Parent(mRootLayout)
            .Self(btn => btn.OnClick(() => { mViewModel.OnCreateUIPanelClick(); }));
        }
Esempio n. 6
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();
            }
Esempio n. 7
0
        public void Init(IQFrameworkContainer container)
        {
            Container = container;
            var localPackageVersionModel = this.GetModel <ILocalPackageVersionModel>();

            // 左侧
            mLeftLayout = EasyIMGUI.Vertical()
                          .AddChild(EasyIMGUI.Area().WithRectGetter(() => mLeftRect)
                                    // 间距 20
                                    .AddChild(EasyIMGUI.Vertical()
                                              .AddChild(EasyIMGUI.Space().Pixel(20)))
                                    // 搜索
                                    .AddChild(EasyIMGUI.Horizontal()
                                              .AddChild(EasyIMGUI.Label().Text("搜索:")
                                                        .FontBold()
                                                        .FontSize(12)
                                                        .Width(40)
                                                        ).AddChild(EasyIMGUI.TextField()
                                                                   .Height(20)
                                                                   .Self(search =>
            {
                search.Content
                .Bind(key => { this.SendCommand(new SearchCommand(key)); })
                .AddToDisposeList(mDisposableList);
            })
                                                                   )
                                              )

                                    // 权限
                                    .AddChild(EasyIMGUI.Toolbar()
                                              .Menus(new List <string>()
            {
                "All", PackageAccessRight.Public.ToString(), PackageAccessRight.Private.ToString()
            })
                                              .Self(self =>
            {
                self.IndexProperty.Bind(value =>
                {
                    PackageManagerState.AccessRightIndex.Value = value;
                    this.SendCommand(new SearchCommand(PackageManagerState.SearchKey.Value));
                }).AddToDisposeList(mDisposableList);
            }))
                                    // 分类
                                    .AddChild(
                                        EasyIMGUI.Horizontal()
                                        .AddChild(PopupView.Create()
                                                  .ToolbarStyle()
                                                  .Self(self =>
            {
                self.IndexProperty.Bind(value =>
                {
                    PackageManagerState.CategoryIndex.Value = value;
                    this.SendCommand(new SearchCommand(PackageManagerState.SearchKey.Value));
                }).AddToDisposeList(mDisposableList);

                mCategoriesSelectorView = self;
            }))
                                        )
                                    // 是否是官方
                                    .AddChild(
                                        EasyIMGUI.Horizontal()
                                        .AddChild(EasyIMGUI.Toggle().IsOn(mIsOfficial)
                                                  .Self(t => t.ValueProperty.Bind(v => mIsOfficial = v)))
                                        .AddChild(EasyIMGUI.Label().Text("官方"))
                                        .AddChild(EasyIMGUI.FlexibleSpace())
                                        )
                                    .AddChild(EasyIMGUI.Scroll()
                                              .AddChild(EasyIMGUI.Custom().OnGUI(() =>
            {
                PackageManagerState.PackageRepositories.Value
                .Where(p => p.isOfficial == mIsOfficial)
                .OrderByDescending(p =>
                {
                    var installedVersion = localPackageVersionModel.GetByName(p.name);

                    if (installedVersion == null)
                    {
                        return(-1);
                    }
                    else if (installedVersion.VersionNumber < p.VersionNumber)
                    {
                        return(2);
                    }
                    else if (installedVersion.VersionNumber == p.VersionNumber)
                    {
                        return(1);
                    }
                    else
                    {
                        return(0);
                    }
                })
                .ThenBy(p => p.name)
                .ForEach(p =>
                {
                    GUILayout.BeginVertical("box");

                    GUILayout.BeginHorizontal();
                    {
                        GUILayout.Label(p.name);
                        GUILayout.FlexibleSpace();
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.BeginHorizontal();
                    {
                        EasyIMGUI.Box().Text(p.latestVersion)
                        .Self(self => self.BackgroundColor = Color.green)
                        .DrawGUI();

                        GUILayout.FlexibleSpace();

                        var installedVersion = localPackageVersionModel.GetByName(p.name);

                        if (installedVersion == null)
                        {
                            if (GUILayout.Button(LocaleText.Import))
                            {
                                RenderEndCommandExecutor.PushCommand(() =>
                                {
                                    this.SendCommand(new ImportPackageCommand(p));
                                });
                            }
                        }
                        else if (installedVersion.VersionNumber < p.VersionNumber)
                        {
                            if (GUILayout.Button(LocaleText.Update))
                            {
                                RenderEndCommandExecutor.PushCommand(() =>
                                {
                                    this.SendCommand(new UpdatePackageCommand(p));
                                });
                            }
                        }
                        else if (installedVersion.VersionNumber == p.VersionNumber)
                        {
                            if (GUILayout.Button(LocaleText.Reimport))
                            {
                                RenderEndCommandExecutor.PushCommand(() =>
                                {
                                    this.SendCommand(new ReimportPackageCommand(p));
                                });
                            }
                        }
                    }
                    GUILayout.EndHorizontal();

                    GUILayout.EndVertical();

                    var rect = GUILayoutUtility.GetLastRect();

                    if (mSelectedPackageRepository == p)
                    {
                        GUI.Box(rect, "", mSelectionRect);
                    }

                    if (rect.Contains(Event.current.mousePosition) &&
                        Event.current.type == EventType.MouseUp)
                    {
                        mSelectedPackageRepository = p;
                        Event.current.Use();
                    }
                });
            }))
                                              )
                                    );

            // var skin = AssetDatabase.LoadAssetAtPath<GUISkin>(
            var skin = AssetDatabase.LoadAssetAtPath <GUISkin>(
                "Assets/QFramework/Framework/Toolkits/Core/Editor/Markdown/Skin/MarkdownSkinQS.guiskin");


            mMarkdownViewer = new MarkdownViewer(skin, string.Empty, "");
            // 右侧
            mRightLayout = EasyIMGUI.Vertical()
                           .AddChild(EasyIMGUI.Area().WithRectGetter(() => mRightRect)
                                     // 间距 20
                                     .AddChild(EasyIMGUI.Vertical()
                                               .AddChild(EasyIMGUI.Space().Pixel(20))
                                               )
                                     // 详细信息
                                     .AddChild(EasyIMGUI.Vertical()
                                               .WithVisibleCondition(() => mSelectedPackageRepository != null)
                                               // 名字
                                               .AddChild(EasyIMGUI.Label()
                                                         .TextGetter(() => mSelectedPackageRepository.name)
                                                         .FontSize(30)
                                                         .FontBold())
                                               .AddChild(EasyIMGUI.Space())
                                               // 服务器版本
                                               .AddChild(EasyIMGUI.Label()
                                                         .TextGetter(() => "服务器版本: " + mSelectedPackageRepository.latestVersion)
                                                         .FontSize(15))
                                               // 本地版本
                                               .AddChild(EasyIMGUI.Label()
                                                         .WithVisibleCondition(() =>
                                                                               localPackageVersionModel.GetByName(mSelectedPackageRepository.name).IsNotNull())
                                                         .TextGetter(() =>
                                                                     "本地版本:" + localPackageVersionModel.GetByName(mSelectedPackageRepository.name).Version)
                                                         .FontSize(15))
                                               // 作者
                                               .AddChild(EasyIMGUI.Label()
                                                         .TextGetter(() => "作者:" + mSelectedPackageRepository.author)
                                                         .FontSize(15))
                                               // 权限
                                               .AddChild(EasyIMGUI.Label()
                                                         .TextGetter(() => "权限:" + mSelectedPackageRepository.accessRight)
                                                         .FontSize(15))
                                               // 主页
                                               .AddChild(
                                                   EasyIMGUI.Horizontal()
                                                   .AddChild(EasyIMGUI.Label()
                                                             .FontSize(15)
                                                             .Text("插件主页:"))
                                                   .AddChild(EasyIMGUI.Button()
                                                             .TextGetter(() => UrlHelper.PackageUrl(mSelectedPackageRepository))
                                                             .FontSize(15)
                                                             .OnClick(() =>
            {
                this.SendCommand(new OpenDetailCommand(mSelectedPackageRepository));
            })
                                                             )
                                                   .AddChild(EasyIMGUI.FlexibleSpace())
                                                   )
                                               // 描述
                                               .AddChild(EasyIMGUI.Label()
                                                         .TextGetter(() => "描述:")
                                                         .FontSize(15)
                                                         )
                                               .AddChild(EasyIMGUI.Space())
                                               // 描述内容
                                               .AddChild(EasyIMGUI.Custom().OnGUI(() =>
            {
                mMarkdownViewer.UpdateText(mSelectedPackageRepository.description);
                var lastRect = GUILayoutUtility.GetLastRect();
                mMarkdownViewer.DrawWithRect(new Rect(lastRect.x, lastRect.y + lastRect.height,
                                                      mRightRect.width - 210, mRightRect.height - lastRect.y - lastRect.height));
                // mMarkdownViewer.Draw();
            }))
                                               )
                                     );

            mPackageKitWindow = EditorWindow.GetWindow <PackageKitWindow>();

            this.SendCommand <PackageManagerInitCommand>();


            PackageManagerState.Categories.Bind(value =>
            {
                mCategoriesSelectorView.Menus(value);
                mPackageKitWindow.Repaint();
            }).AddToDisposeList(mDisposableList);


            // 创建双屏
            mSplitView = mSplitView = new VerticalSplitView
            {
                Split   = 240,
                fistPan = rect =>
                {
                    mLeftRect = rect;
                    mLeftLayout.DrawGUI();
                },
                secondPan = rect =>
                {
                    mRightRect = rect;
                    mRightLayout.DrawGUI();
                }
            };
        }
        private void OnEnable()
        {
            mRootLayout = new VerticalLayout("box");

            EasyIMGUI.Space()
            .Parent(mRootLayout);

            var markTypeLine = EasyIMGUI.Horizontal()
                               .Parent(mRootLayout);

            EasyIMGUI.Label().Text(LocaleText.MarkType)
            .FontSize(12)
            .Width(60)
            .Parent(markTypeLine);

            var enumPopupView = new EnumPopupView(mBindScript.MarkType)
                                .Parent(markTypeLine);

            enumPopupView.ValueProperty.Bind(newValue =>
            {
                mBindScript.MarkType = (BindType)newValue;

                OnRefresh();
            });


            EasyIMGUI.Space()
            .Parent(mRootLayout);

            EasyIMGUI.Custom().OnGUI(() =>
            {
                if (mBindScript.CustomComponentName == null ||
                    string.IsNullOrEmpty(mBindScript.CustomComponentName.Trim()))
                {
                    mBindScript.CustomComponentName = mBindScript.name;
                }
            }).Parent(mRootLayout);


            mComponentLine = EasyIMGUI.Horizontal();

            EasyIMGUI.Label().Text(LocaleText.Type)
            .Width(60)
            .FontSize(12)
            .Parent(mComponentLine);

            if (mBindScript.MarkType == BindType.DefaultUnityElement)
            {
                var components = mBindScript.GetComponents <Component>();

                var componentNames = components.Where(c => !(c is AbstractBind))
                                     .Select(c => c.GetType().FullName)
                                     .ToArray();

                var componentNameIndex = 0;

                componentNameIndex = componentNames.ToList()
                                     .FindIndex((componentName) => componentName.Contains(mBindScript.ComponentName));

                if (componentNameIndex == -1 || componentNameIndex >= componentNames.Length)
                {
                    componentNameIndex = 0;
                }

                mBindScript.ComponentName = componentNames[componentNameIndex];

                new PopupView(componentNameIndex, componentNames)
                .Parent(mComponentLine)
                .IndexProperty.Bind((index) => { mBindScript.ComponentName = componentNames[index]; });
            }

            mComponentLine.Parent(mRootLayout);

            EasyIMGUI.Space()
            .Parent(mRootLayout);

            var belongsTo = EasyIMGUI.Horizontal()
                            .Parent(mRootLayout);

            EasyIMGUI.Label().Text(LocaleText.BelongsTo)
            .Width(60)
            .FontSize(12)
            .Parent(belongsTo);

            EasyIMGUI.Label().Text(CodeGenUtil.GetBindBelongs2(target as AbstractBind))
            .Width(200)
            .FontSize(12)
            .Parent(belongsTo);


            EasyIMGUI.Button()
            .Text(LocaleText.Select)
            .OnClick(() =>
            {
                Selection.objects = new Object[]
                {
                    CodeGenUtil.GetBindBelongs2GameObject(target as AbstractBind)
                };
            })
            .Width(60)
            .Parent(belongsTo);

            mClassnameLine = new HorizontalLayout();

            EasyIMGUI.Label().Text(LocaleText.ClassName)
            .Width(60)
            .FontSize(12)
            .Parent(mClassnameLine);

            EasyIMGUI.TextField().Text(mBindScript.CustomComponentName)
            .Parent(mClassnameLine)
            .Content.Bind(newValue => { mBindScript.CustomComponentName = newValue; });

            mClassnameLine.Parent(mRootLayout);

            EasyIMGUI.Space()
            .Parent(mRootLayout);

            EasyIMGUI.Label().Text(LocaleText.Comment)
            .FontSize(12)
            .Parent(mRootLayout);

            EasyIMGUI.Space()
            .Parent(mRootLayout);

            EasyIMGUI.TextArea()
            .Text(mBindScript.Comment)
            .Height(100)
            .Parent(mRootLayout)
            .Content.Bind(newValue => mBindScript.CustomComment = newValue);

            var bind        = target as AbstractBind;
            var rootGameObj = CodeGenUtil.GetBindBelongs2GameObject(bind);


            if (rootGameObj.transform.GetComponent("ILKitBehaviour"))
            {
            }
            else if (rootGameObj.transform.IsUIPanel())
            {
                EasyIMGUI.Button()
                .Text(LocaleText.Generate + " " + CodeGenUtil.GetBindBelongs2(bind))
                .OnClick(() =>
                {
                    var rootPrefabObj = PrefabUtility.GetPrefabParent(rootGameObj);
                    UICodeGenerator.DoCreateCode(new[] { rootPrefabObj });
                })
                .Height(30)
                .Parent(mRootLayout);
            }
            else if (rootGameObj.transform.IsViewController())
            {
                EasyIMGUI.Button()
                .Text(LocaleText.Generate + " " + CodeGenUtil.GetBindBelongs2(bind))
                .OnClick(() => { CreateViewControllerCode.DoCreateCodeFromScene(bind.gameObject); })
                .Height(30)
                .Parent(mRootLayout);
            }


            OnRefresh();
        }
Esempio n. 9
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();
            }