public void Init(IQFrameworkContainer container) { mRootLayout = new VerticalLayout("box"); new EGO.Framework.SpaceView(6).AddTo(mRootLayout); // 命名空间 var nameSpaceLayout = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.Namespace) .FontSize(12) .FontBold() .Width(200) .AddTo(nameSpaceLayout); new TextView(mUiKitSettingData.Namespace) .AddTo(nameSpaceLayout) .Content.Bind(content => mUiKitSettingData.Namespace = content); // UI 生成的目录 new EGO.Framework.SpaceView(6).AddTo(mRootLayout); var uiScriptGenerateDirLayout = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.UIScriptGenerateDir) .FontSize(12) .FontBold() .Width(200) .AddTo(uiScriptGenerateDirLayout); new TextView(mUiKitSettingData.UIScriptDir) .AddTo(uiScriptGenerateDirLayout) .Content.Bind(content => mUiKitSettingData.UIScriptDir = content); new EGO.Framework.SpaceView(6).AddTo(mRootLayout); var uiPanelPrefabDir = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.UIPanelPrefabDir) .FontSize(12) .FontBold() .Width(200) .AddTo(uiPanelPrefabDir); new TextView(mUiKitSettingData.UIPrefabDir) .AddTo(uiPanelPrefabDir) .Content.Bind(content => mUiKitSettingData.UIPrefabDir = content); new EGO.Framework.SpaceView(6).AddTo(mRootLayout); new ButtonView(LocaleText.Apply, () => { mUiKitSettingData.Save(); }) .AddTo(mRootLayout); }
protected override void Init() { PackageMakerState.InitState(); var hashSet = new HashSet <string>(); if (mPackageVersion.IncludeFileOrFolders.Count == 0 && mPackageVersion.InstallPath.EndsWith("/")) { hashSet.Add(mPackageVersion.InstallPath.Remove(mPackageVersion.InstallPath.Length - 1)); } foreach (var packageIncludeFileOrFolder in mPackageVersion.IncludeFileOrFolders) { hashSet.Add(packageIncludeFileOrFolder); } _assetTree = new AssetTree(); _assetTreeGUI = new AssetTreeIMGUI(_assetTree.Root); var guids = AssetDatabase.FindAssets(string.Empty); int i = 0, l = guids.Length; for (; i < l; ++i) { _assetTree.AddAsset(guids[i], hashSet); } RootLayout = new VerticalLayout("box"); var editorView = EasyIMGUI.Vertical().Parent(RootLayout); var uploadingView = new VerticalLayout().Parent(RootLayout); // 当前版本号 var versionLine = EasyIMGUI.Horizontal().Parent(editorView); EasyIMGUI.Label().Text("当前版本号").Width(100).Parent(versionLine); EasyIMGUI.Label().Text(mPackageVersion.Version).Width(100).Parent(versionLine); // 发布版本号 var publishedVersionLine = new HorizontalLayout().Parent(editorView); EasyIMGUI.Label().Text("发布版本号") .Width(100) .Parent(publishedVersionLine); EasyIMGUI.TextField() .Text(mPublishVersion) .Width(100) .Parent(publishedVersionLine) .Content.Bind(v => mPublishVersion = v); // 类型 var typeLine = EasyIMGUI.Horizontal().Parent(editorView); EasyIMGUI.Label().Text("类型").Width(100).Parent(typeLine); var packageType = new EnumPopupView(mPackageVersion.Type).Parent(typeLine); var accessRightLine = EasyIMGUI.Horizontal().Parent(editorView); EasyIMGUI.Label().Text("权限").Width(100).Parent(accessRightLine); var accessRight = new EnumPopupView(mPackageVersion.AccessRight).Parent(accessRightLine); EasyIMGUI.Label().Text("发布说明:").Width(150).Parent(editorView); var releaseNote = EasyIMGUI.TextArea().Width(245) .Parent(editorView); // 文件选择部分 EasyIMGUI.Label().Text("插件目录: " + mPackageVersion.InstallPath) .Parent(editorView); EasyIMGUI.Custom().OnGUI(() => { _scrollPosition = EditorGUILayout.BeginScrollView(_scrollPosition); _assetTreeGUI.DrawTreeLayout(); EditorGUILayout.EndScrollView(); }).Parent(editorView); PackageMakerState.InEditorView.BindWithInitialValue(value => { editorView.Visible = value; }) .AddTo(mDisposableList); if (User.Logined) { EasyIMGUI.Button() .Text("发布") .OnClick(() => { var includedPaths = new List <string>(); _assetTree.Root.Traverse(data => { if (data != null && data.isSelected) { includedPaths.Add(data.fullPath); return(false); } return(true); }); mPackageVersion.IncludeFileOrFolders = includedPaths; mPackageVersion.Readme.content = releaseNote.Content.Value; mPackageVersion.AccessRight = (PackageAccessRight)accessRight.ValueProperty.Value; mPackageVersion.Type = (PackageType)packageType.ValueProperty.Value; mPackageVersion.Version = mPublishVersion; mControllerNode.SendCommand(new PublishPackageCommand(mPackageVersion)); }).Parent(editorView); } var notice = new LabelViewWithRect("", 100, 200, 200, 200).Parent(uploadingView); PackageMakerState.NoticeMessage .BindWithInitialValue(value => { notice.Content.Value = value; }).AddTo(mDisposableList); PackageMakerState.InUploadingView.BindWithInitialValue(value => { uploadingView.Visible = value; }) .AddTo(mDisposableList); }
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(); })); }
private void OnEnable() { mRootLayout = new VerticalLayout("box"); new SpaceView() .AddTo(mRootLayout); var markTypeLine = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.MarkType) .FontSize(12) .Width(60) .AddTo(markTypeLine); var enumPopupView = new EnumPopupView(mBindScript.MarkType) .AddTo(markTypeLine); enumPopupView.ValueProperty.Bind(newValue => { mBindScript.MarkType = (BindType)newValue; OnRefresh(); }); new SpaceView() .AddTo(mRootLayout); new CustomView(() => { if (mBindScript.CustomComponentName == null || string.IsNullOrEmpty(mBindScript.CustomComponentName.Trim())) { mBindScript.CustomComponentName = mBindScript.name; } }).AddTo(mRootLayout); mComponentLine = new HorizontalLayout(); new LabelView(LocaleText.Type) .Width(60) .FontSize(12) .AddTo(mComponentLine); if (mBindScript.MarkType == BindType.DefaultUnityElement) { var components = mBindScript.GetComponents <Component>(); var componentNames = components.Where(c => c.GetType() != typeof(Bind)) .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) .AddTo(mComponentLine) .IndexProperty.Bind((index) => { mBindScript.ComponentName = componentNames[index]; }); } mComponentLine.AddTo(mRootLayout); new SpaceView() .AddTo(mRootLayout); var belongsTo = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.BelongsTo) .Width(60) .FontSize(12) .AddTo(belongsTo); new LabelView(CodeGenUtil.GetBindBelongs2(target as Bind)) .Width(200) .FontSize(12) .AddTo(belongsTo); new ButtonView(LocaleText.Select, () => { Selection.objects = new[] { CodeGenUtil.GetBindBelongs2GameObject(target as Bind) }; }) .Width(60) .AddTo(belongsTo); mClassnameLine = new HorizontalLayout(); new LabelView(LocaleText.ClassName) .Width(60) .FontSize(12) .AddTo(mClassnameLine); new TextView(mBindScript.CustomComponentName) .AddTo(mClassnameLine) .Content.Bind(newValue => { mBindScript.CustomComponentName = newValue; }); mClassnameLine.AddTo(mRootLayout); new SpaceView() .AddTo(mRootLayout); new LabelView(LocaleText.Comment) .FontSize(12) .AddTo(mRootLayout); new SpaceView() .AddTo(mRootLayout); new TextAreaView(mBindScript.Comment) .Height(100) .AddTo(mRootLayout) .Content.Bind(newValue => mBindScript.CustomComment = newValue); var bind = target as Bind; var rootGameObj = CodeGenUtil.GetBindBelongs2GameObject(bind); if (rootGameObj.transform.GetComponent("ILKitBehaviour")) { } else if (rootGameObj.transform.IsUIPanel()) { new ButtonView(LocaleText.Generate + " " + CodeGenUtil.GetBindBelongs2(bind), () => { var rootPrefabObj = PrefabUtility.GetPrefabParent(rootGameObj); UICodeGenerator.DoCreateCode(new[] { rootPrefabObj }); }) .Height(30) .AddTo(mRootLayout); } else if (rootGameObj.transform.IsViewController()) { new ButtonView(LocaleText.Generate + " " + CodeGenUtil.GetBindBelongs2(bind), () => { CreateViewControllerCode.DoCreateCodeFromScene(bind.gameObject); }) .Height(30) .AddTo(mRootLayout); } OnRefresh(); }
public void Init(IQFrameworkContainer container) { mViewModel = new UIKitSettingViewModel(); new LabelView(LocaleText.UIKitSettings).FontSize(12).AddTo(this); mRootLayout = new VerticalLayout("box").AddTo(this); mRootLayout.AddChild(new SpaceView(6)); // 命名空间 var nameSpaceLayout = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.Namespace) .FontSize(12) .FontBold() .Width(200) .AddTo(nameSpaceLayout); new TextView(mUiKitSettingData.Namespace) .AddTo(nameSpaceLayout) .Content.Bind(content => mUiKitSettingData.Namespace = content); // UI 生成的目录 new SpaceView(6) .AddTo(mRootLayout); var uiScriptGenerateDirLayout = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.UIScriptGenerateDir) .FontSize(12) .FontBold() .Width(200) .AddTo(uiScriptGenerateDirLayout); new TextView(mUiKitSettingData.UIScriptDir) .AddTo(uiScriptGenerateDirLayout) .Content.Bind(content => mUiKitSettingData.UIScriptDir = content); mRootLayout.AddChild(new SpaceView(6)); var uiPanelPrefabDir = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.UIPanelPrefabDir) .FontSize(12) .FontBold() .Width(200) .AddTo(uiPanelPrefabDir); new TextView(mUiKitSettingData.UIPrefabDir) .AddTo(uiPanelPrefabDir) .Content.Bind(content => mUiKitSettingData.UIPrefabDir = content); mRootLayout.AddChild(new SpaceView(6)); // UI 生成的目录 new SpaceView(6) .AddTo(mRootLayout); var viewControllerScriptGenerateDirLayout = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.ViewControllerScriptGenerateDir) .FontSize(12) .FontBold() .Width(200) .AddTo(viewControllerScriptGenerateDirLayout); new TextView(mUiKitSettingData.DefaultViewControllerScriptDir) .AddTo(viewControllerScriptGenerateDirLayout) .Content.Bind(content => mUiKitSettingData.DefaultViewControllerScriptDir = content); mRootLayout.AddChild(new SpaceView(6)); var viewControllerPrefabDir = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.ViewControllerPrefabGenerateDir) .FontSize(12) .FontBold() .Width(220) .AddTo(viewControllerPrefabDir); new TextView(mUiKitSettingData.DefaultViewControllerPrefabDir) .AddTo(viewControllerPrefabDir) .Content.Bind(content => mUiKitSettingData.DefaultViewControllerPrefabDir = content); mRootLayout.AddChild(new SpaceView(6)); // 保存数据 new ButtonView(LocaleText.Apply, () => { mUiKitSettingData.Save(); }) .AddTo(mRootLayout); new TextView(mViewModel.PanelNameToCreate) .AddTo(mRootLayout) .Do(text => { text.Content.Bind(txt => mViewModel.PanelNameToCreate = txt); }); // 创建 UI 界面 按钮的绑定 new ButtonView(LocaleText.CreateUIPanel) .AddTo(mRootLayout) .Do(btn => btn.OnClick.AddListener(() => { mViewModel.OnCreateUIPanelClick(); })); }
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(); }
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(); }
public void Init(IQFrameworkContainer container) { var bindingSet = BindKit.CreateBindingSet(this, new UIKitSettingViewModel()); var treeNode = new TreeNode(false, LocaleText.UIKitSettings) .AddTo(this); mRootLayout = new VerticalLayout("box"); treeNode.Add2Spread(mRootLayout); mRootLayout.AddChild(new SpaceView(6)); // 命名空间 var nameSpaceLayout = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.Namespace) .FontSize(12) .FontBold() .Width(200) .AddTo(nameSpaceLayout); new TextView(mUiKitSettingData.Namespace) .AddTo(nameSpaceLayout) .Content.Bind(content => mUiKitSettingData.Namespace = content); // UI 生成的目录 new SpaceView(6) .AddTo(mRootLayout); var uiScriptGenerateDirLayout = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.UIScriptGenerateDir) .FontSize(12) .FontBold() .Width(200) .AddTo(uiScriptGenerateDirLayout); new TextView(mUiKitSettingData.UIScriptDir) .AddTo(uiScriptGenerateDirLayout) .Content.Bind(content => mUiKitSettingData.UIScriptDir = content); new SpaceView(6).AddTo(mRootLayout); var uiPanelPrefabDir = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.UIPanelPrefabDir) .FontSize(12) .FontBold() .Width(200) .AddTo(uiPanelPrefabDir); new TextView(mUiKitSettingData.UIPrefabDir) .AddTo(uiPanelPrefabDir) .Content.Bind(content => mUiKitSettingData.UIPrefabDir = content); mRootLayout.AddChild(new SpaceView(6)); // 保存数据 new ButtonView(LocaleText.Apply, () => { mUiKitSettingData.Save(); }) .AddTo(mRootLayout); new TextView() .AddTo(mRootLayout) .Do(text => { bindingSet .Bind(text.Content) .For(v => v.Value, v => v.OnValueChanged) .To(vm => vm.PanelNameToCreate); }); // 创建 UI 界面 按钮的绑定 new ButtonView(LocaleText.CreateUIPanel) .AddTo(mRootLayout) .Do(btn => { bindingSet.Bind(btn).For(v => v.OnClick).To(vm => vm.OnCreateUIPanelClick); }); bindingSet.Build(); }
private void OnEnable() { mRootLayout = new VerticalLayout("box"); new SpaceView() .AddTo(mRootLayout); var markTypeLine = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.MarkType) .FontSize(12) .Width(60) .AddTo(markTypeLine); var enumPopupView = new EnumPopupView(mBindScript.MarkType) .AddTo(markTypeLine); enumPopupView.ValueProperty.Bind(newValue => { mBindScript.MarkType = (BindType)newValue; OnRefresh(); }); new SpaceView() .AddTo(mRootLayout); new CustomView(() => { if (mBindScript.CustomComponentName == null || string.IsNullOrEmpty(mBindScript.CustomComponentName.Trim())) { mBindScript.CustomComponentName = mBindScript.name; } }).AddTo(mRootLayout); mComponentLine = new HorizontalLayout(); new LabelView(LocaleText.Type) .Width(60) .FontSize(12) .AddTo(mComponentLine); new LabelView(mBindScript.ComponentName) .FontSize(12) .AddTo(mComponentLine); mComponentLine.AddTo(mRootLayout); new SpaceView() .AddTo(mRootLayout); var belongsTo = new HorizontalLayout() .AddTo(mRootLayout); new LabelView(LocaleText.BelongsTo) .Width(60) .FontSize(12) .AddTo(belongsTo); new LabelView(CodeGenUtil.GetBindBelongs2(target as Bind)) .Width(200) .FontSize(12) .AddTo(belongsTo); new ButtonView(LocaleText.Select, () => { Selection.objects = new[] { CodeGenUtil.GetBindBelongs2GameObject(target as Bind) }; }) .Width(60) .AddTo(belongsTo); mClassnameLine = new HorizontalLayout(); new LabelView(LocaleText.ClassName) .Width(60) .FontSize(12) .AddTo(mClassnameLine); new TextView(mBindScript.CustomComponentName) .AddTo(mClassnameLine) .Content.Bind(newValue => { mBindScript.CustomComponentName = newValue; }); mClassnameLine.AddTo(mRootLayout); new SpaceView() .AddTo(mRootLayout); new LabelView(LocaleText.Comment) .FontSize(12) .AddTo(mRootLayout); new SpaceView() .AddTo(mRootLayout); new TextAreaView(mBindScript.Comment) .Height(100) .AddTo(mRootLayout) .Content.Bind(newValue => mBindScript.CustomComment = newValue); new ButtonView(LocaleText.Generate + " " + CodeGenUtil.GetBindBelongs2(target as Bind), () => { CreateViewControllerCode.DoCreateCodeFromScene((target as Bind).gameObject); }) .Height(30) .AddTo(mRootLayout); OnRefresh(); }
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(); }
private void OnEnable() { mRootLayout = new VerticalLayout("box"); new EGO.Framework.SpaceView() .AddTo(mRootLayout); var markTypeLine = new HorizontalLayout() .AddTo(mRootLayout); new EGO.Framework.LabelView(LocaleText.MarkType) .FontBold() .FontSize(12) .Width(100) .AddTo(markTypeLine); var enumPopupView = new EnumPopupView(mBindScript.MarkType) .AddTo(markTypeLine); enumPopupView.ValueProperty.Bind(newValue => { mBindScript.MarkType = (BindType)newValue; OnRefresh(); }); new EGO.Framework.SpaceView() .AddTo(mRootLayout); new CustomView(() => { if (mBindScript.CustomComponentName == null || string.IsNullOrEmpty(mBindScript.CustomComponentName.Trim())) { mBindScript.CustomComponentName = mBindScript.name; } }).AddTo(mRootLayout); mComponentLine = new HorizontalLayout(); new EGO.Framework.LabelView(LocaleText.Type) .Width(100) .FontBold() .FontSize(12) .AddTo(mComponentLine); new EGO.Framework.LabelView(mBindScript.ComponentName) .FontBold() .FontSize(12) .AddTo(mComponentLine); mComponentLine.AddTo(mRootLayout); mClassnameLine = new HorizontalLayout(); new EGO.Framework.LabelView(LocaleText.ClassName) .Width(100) .FontBold() .FontSize(12) .AddTo(mClassnameLine); new TextView(mBindScript.CustomComponentName) .AddTo(mClassnameLine) .Content.Bind(newValue => { mBindScript.CustomComponentName = newValue; }); mClassnameLine.AddTo(mRootLayout); new EGO.Framework.SpaceView() .AddTo(mRootLayout); new EGO.Framework.LabelView(LocaleText.Comment) .FontSize(12) .FontBold() .AddTo(mRootLayout); new EGO.Framework.SpaceView() .AddTo(mRootLayout); new TextAreaView(mBindScript.Comment) .Height(100) .AddTo(mRootLayout) .Content.Bind(newValue => mBindScript.CustomComment = newValue); OnRefresh(); }
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]; PopupView.Create() .WithIndexAndMenus(componentNameIndex, componentNames) .OnIndexChanged(index => { mBindScript.ComponentName = componentNames[index]; }) .Parent(mComponentLine); } 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.GetCorrespondingObjectFromSource <Object>(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(); }