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); }
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(); }
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(); }
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(); }
public void Init(IQFrameworkContainer container) { SerializeHelper.SerializeContainer.RegisterInstance <IJsonSerializer>(new JsonDotnetSerializer()); mRootLayout = new VerticalLayout(); EasyIMGUI.Label().Text("ScriptKitILRuntime 的编辑器").FontSize(12).Parent(mRootLayout); //EditorStyles.popup.fixedHeight = 30; var verticalLayout = new VerticalLayout("box").Parent(mRootLayout); var versionText = "0"; verticalLayout.AddChild(new HorizontalLayout() .AddChild(EasyIMGUI.Label().Text("版本号(数字):")) .AddChild(EasyIMGUI.TextField() .Text(versionText) .Self(text => text.Content.Bind(t => versionText = t))) ); var versionBtn = EasyIMGUI.Button(); versionBtn.AddLayoutOption(GUILayout.Height(30)); verticalLayout.AddChild(versionBtn.Text("生成版本信息").OnClick(() => { var generatePath = Application.streamingAssetsPath + "/AssetBundles/" + AssetBundleSettings.GetPlatformForAssetBundles(Application.platform) + "/"; var filenames = Directory.GetFiles(generatePath); new DLLVersion() { Assets = filenames.Select(f => f.GetFileName()).ToList(), Version = versionText.ToInt() }.SaveJson(generatePath + "/hotfix.json"); AssetDatabase.Refresh(); })); EasyIMGUI.Custom().OnGUI(() => { GUILayout.BeginVertical(); { showGenDll = EditorGUILayout.BeginFoldoutHeaderGroup(showGenDll, "编译热更dll"); if (showGenDll) { GUILayout.BeginHorizontal(); if (GUILayout.Button("编译dll(Debug)", GUILayout.Height(30))) { var outpath_win = Application.streamingAssetsPath + "/AssetBundles/" + AssetBundleSettings.GetPlatformForAssetBundles(Application.platform); ScriptBuildTools.BuildDll(outpath_win, ScriptBuildTools.BuildMode.Debug); } if (GUILayout.Button("编译dll(Release)", GUILayout.Height(30))) { var outpath_win = Application.streamingAssetsPath + "/AssetBundles/" + AssetBundleSettings.GetPlatformForAssetBundles(Application.platform); ScriptBuildTools.BuildDll(outpath_win, ScriptBuildTools.BuildMode.Release); } GUILayout.EndHorizontal(); GUI.color = Color.green; GUILayout.Label( @"注意事项: 1.编译服务使用Roslyn,请放心使用 2.如编译出现报错,请仔细看报错信息,和报错的代码行列, 一般均为语法错 3.语法报错原因可能有:主工程访问hotfix中的类, 使用宏 编译时代码结构发生变化..等等,需要细心的你去发现" ); GUI.color = GUI.backgroundColor; } EditorGUILayout.EndFoldoutHeaderGroup(); showGenAdapter = EditorGUILayout.BeginFoldoutHeaderGroup(showGenAdapter, "生成跨域Adapter"); if (showGenAdapter) { GUILayout.BeginHorizontal(); GUILayout.Label("程序集名:"); assemblyName = GUILayout.TextField(assemblyName); GUILayout.EndHorizontal(); EditorGUILayout.HelpBox("类名如果有命名空间需要带上", MessageType.Info); GUILayout.BeginHorizontal(); GUILayout.Label("类名:"); adapterClassName = GUILayout.TextField(adapterClassName); GUILayout.EndHorizontal(); if (GUILayout.Button("生成", GUILayout.Height(30))) { GenCrossBindAdapter(); } } EditorGUILayout.EndFoldoutHeaderGroup(); showGenDllBind = EditorGUILayout.BeginFoldoutHeaderGroup(showGenDllBind, "Clr Binding And Link"); if (showGenDllBind) { GUILayout.BeginHorizontal(); if (GUILayout.Button("生成Clr绑定(不知道干嘛别点!)", GUILayout.Height(30))) { GenClrBindingByAnalysis(); } if (GUILayout.Button("生成Link.xml", GUILayout.Height(30))) { StripCode.GenLinkXml(); } GUILayout.EndHorizontal(); } EditorGUILayout.EndFoldoutHeaderGroup(); } GUILayout.EndVertical(); }).Parent(verticalLayout); var runModelPop = new EnumPopupView(ILRuntimeScriptSetting.Default.HotfixRunMode); runModelPop.Style.Value.fixedHeight = 30; runModelPop.AddLayoutOption(GUILayout.Height(30)); runModelPop.ValueProperty.Bind(v => ILRuntimeScriptSetting.Default.HotfixRunMode = (HotfixCodeRunMode)v); EasyIMGUI.Horizontal().AddChild(EasyIMGUI.Label().Text("运行模式")).AddChild(runModelPop).Parent(mRootLayout); }
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(); }