private void OnGUI() { GUILayout.Label(string.Format("KEngine Options"), _headerStyle); EditorGUILayout.LabelField("KEngine Version:", KEngineVersion.ToString()); EditorGUILayout.Space(); EditorGUILayout.LabelField("== Addon =="); var isNgui = KDefineSymbolsHelper.HasDefineSymbol("NGUI"); var newIsNgui = EditorGUILayout.Toggle("NGUI", isNgui); if (isNgui != newIsNgui) { if (newIsNgui) { KDefineSymbolsHelper.AddDefineSymbols("NGUI"); } else { KDefineSymbolsHelper.RemoveDefineSymbols("NGUI"); } } EditorGUILayout.LabelField("== AppConfigs.txt =="); //bool tabDirty = false; var configs = AppEngine.PreloadConfigs(); foreach (var sectionData in configs.GetSections()) { EditorGUILayout.Space(); EditorGUILayout.LabelField("[" + sectionData.SectionName + "]"); foreach (var key in sectionData.Keys) { string value = key.Value; EditorGUILayout.BeginHorizontal(); // EditorGUILayout.LabelField(key.KeyName); // EditorGUILayout.LabelField(value); string newValue = EditorGUILayout.TextField(key.KeyName, value); if (value != newValue) { // tabDirty = true; SetConfValue(sectionData.SectionName, key.KeyName, newValue); AppEngine.PreloadConfigs(true); } EditorGUILayout.EndHorizontal(); } } //if (tabDirty) //{ // AssetDatabase.Refresh(); //} }
public void DrawILRuntime() { #if ILRuntime GUILayout.BeginHorizontal("HelpBox"); EditorGUILayout.LabelField("== ILRuntime =="); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("生成Dll", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { ILRuntimeEditor.GenDll(); } if (GUILayout.Button("打包dll为ab", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { ILRuntimeEditor.BuildDllToAb(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("生成CLR绑定", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { ILRuntimeEditor.GenerateCLRBindingByAnalysis(); } if (GUILayout.Button("生成适配器", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { ILRuntimeEditor.GenerateCrossbindAdapter(); } if (GUILayout.Button("删除生成代码", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { ILRuntimeEditor.ClearGenCode(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); if (GUILayout.Button("开启调试", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { KDefineSymbolsHelper.AddDefineSymbols(new string[] { "ILRuntime", "DEBUG" }); } if (GUILayout.Button("默认设置", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { KDefineSymbolsHelper.AddDefineSymbols(new string[] { "ILRuntime" }); } if (GUILayout.Button("最佳性能", GUILayout.ExpandWidth(true), GUILayout.MaxHeight(30))) { KDefineSymbolsHelper.AddDefineSymbols(new string[] { "ILRuntime", "DISABLE_ILRUNTIME_DEBUG" }); } GUILayout.EndHorizontal(); #endif }
private void OnGUI() { GUILayout.Label(string.Format("KEngine Options"), _headerStyle); EditorGUILayout.LabelField("KEngine Version:", KEngineVersion.ToString()); EditorGUILayout.Space(); EditorGUILayout.LabelField("== Addon =="); var isNgui = KDefineSymbolsHelper.HasDefineSymbol("NGUI"); var newIsNgui = EditorGUILayout.Toggle("NGUI", isNgui); if (isNgui != newIsNgui) { if (newIsNgui) { KDefineSymbolsHelper.AddDefineSymbols("NGUI"); } else { KDefineSymbolsHelper.RemoveDefineSymbols("NGUI"); } } EditorGUILayout.LabelField("== KEngineConfig.txt =="); bool tabDirty = false; foreach (var item in AppEngine.ConfigsTable.GetAll()) { string value = item["Value"]; string newValue = EditorGUILayout.TextField(item["Key"], value); if (value != newValue) { AppEngine.SetConfig(item["Key"], newValue); tabDirty = true; } } if (tabDirty) { AssetDatabase.Refresh(); } }
private void OnGUI() { GUILayout.Label(string.Format("KEngine Options"), _headerStyle); EditorGUILayout.LabelField("KEngine Version:", KEngineVersion.ToString()); EditorGUILayout.Space(); EditorGUILayout.LabelField("== Addon =="); var isNgui = KDefineSymbolsHelper.HasDefineSymbol("NGUI"); var newIsNgui = EditorGUILayout.Toggle("NGUI", isNgui); if (isNgui != newIsNgui) { if (newIsNgui) { KDefineSymbolsHelper.AddDefineSymbols("NGUI"); } else { KDefineSymbolsHelper.RemoveDefineSymbols("NGUI"); } } EditorGUILayout.LabelField("== KEngineConfig.txt =="); bool tabDirty = false; foreach (KTabFile.RowInterator row in ConfFile) { string value = row.GetString("Value"); string newValue = EditorGUILayout.TextField(row.GetString("Key"), value); if (value != newValue) { ConfFile.SetValue <string>(row.Row, "Value", newValue); tabDirty = true; } } if (tabDirty) { SaveConfigFile(); } }
/// <summary> /// 选择目录,进行安装 /// </summary> public void DynamicInstall() { var gitPath = EditorUtility.OpenFolderPanel("Select KEngine Build Folder", "./", ""); Debug.Log("Using KEngine project: " + gitPath); var srcEngineLibCodePath = Path.Combine(gitPath, @"KEngine.UnityProject\Assets\KEngine.Lib"); var srcEngineLibDllPath = Path.Combine(gitPath, @"Build/Release/KEngine.Lib.dll"); var srcEngineCodePath = Path.Combine(gitPath, @"KEngine.UnityProject\Assets\KEngine"); var srcEngineDllPath = Path.Combine(gitPath, "Build/Release/KEngine.dll"); var srcEngineEditorDllPath = Path.Combine(gitPath, "Build/Release/KEngine.Editor.dll"); var srcEngineEditorCodePath = Path.Combine(gitPath, @"KEngine.UnityProject\Assets\KEngine.Editor\Editor"); var srcEngineEditorToolCodePath = Path.Combine(gitPath, @"KEngine.UnityProject\Assets\KEngine.EditorTools\Editor"); var dlls = new string[] { srcEngineLibDllPath, srcEngineDllPath, srcEngineEditorDllPath, }; foreach (var dllPath in dlls) { if (!File.Exists(dllPath)) { EditorUtility.DisplayDialog("Error Install", "Not found DLL: " + dllPath, "Ok"); return; } } // Start install! UnInstall(); // KEngineConfig.txt var selfEngineConfigPath = "Assets/Resources/KEngineConfig.txt"; if (!File.Exists(selfEngineConfigPath)) { var srcEngineConfig = Path.Combine(gitPath, @"KEngine.UnityProject\Assets\Resources\KEngineConfig.txt"); File.Copy(srcEngineCodePath, selfEngineConfigPath); Debug.Log(string.Format("Copy EngineConfig.txt from {0}, to {1}", srcEngineConfig, selfEngineConfigPath)); } if (InstallType == KEngineInstallType.Dll) { CopyDll(srcEngineLibDllPath, KEngineInstallDirPath); CopyDll(Path.Combine(gitPath, "Build/Release/ICSharpCode.SharpZipLib.dll"), KEngineInstallDirPath); // 3rd lib CopyDll(srcEngineDllPath, KEngineInstallDirPath); CopyDll(srcEngineEditorDllPath, KEngineEditorInstallDirPath); CopyEditorLib(gitPath, KEngineEditorInstallDirPath);// 3rd lib //CopyFolder(srcEngineEditorCodePath, KEngineEditorInstallDirPath + "/KEngine.Editor"); } else { CopyFolder(srcEngineLibCodePath, KEngineInstallDirPath + "/KEngine.Lib"); CopyFolder(srcEngineCodePath, KEngineInstallDirPath + "/KEngine"); CopyFolder(srcEngineEditorCodePath, KEngineEditorInstallDirPath + "/KEngine.Editor"); CopyFolder(srcEngineEditorToolCodePath, KEngineEditorInstallDirPath + "/KEngine.EditorTools"); CopyEditorLib(gitPath, KEngineEditorInstallDirPath);// 3rd lib } Debug.Log("Install KEngine Successed!"); // Asset Dep if (_addonAssetDep) { var srcAssetDepDirPath = Path.Combine(gitPath, @"KEngine.UnityProject\Assets\KEngine.AssetDep"); var srcAssetDepDllPath = Path.Combine(gitPath, "Build/Release/KEngine.AssetDep.dll"); var srcAssetDepEditorDllPath = Path.Combine(gitPath, "Build/Release/KEngine.AssetDep.Editor.dll"); var srcAssetDepEditorDirPath = Path.Combine(gitPath, @"KEngine.UnityProject\Assets\KEngine.AssetDep.Editor\Editor"); if (InstallType == KEngineInstallType.Dll) { CopyDll(srcAssetDepDllPath, KEngineInstallDirPath); CopyDll(srcAssetDepEditorDllPath, KEngineEditorInstallDirPath); //CopyFolder(srcAssetDepEditorDirPath, KEngineEditorInstallDirPath + "/KEngine.AssetDep"); } else { CopyFolder(srcAssetDepDirPath, KEngineInstallDirPath + "/KEngine.AssetDep"); CopyFolder(srcAssetDepEditorDirPath, KEngineEditorInstallDirPath + "/KEngine.AssetDep"); } Debug.Log("Install KEngine.AssetDep Successed!"); if (_addonNGUI) { var srcNGUIDirPath = Path.Combine(gitPath, @"KEngine.UnityProject\Assets\KEngine.NGUI"); var srcNGUEditorDirPath = Path.Combine(gitPath, @"KEngine.UnityProject\Assets\KEngine.NGUI.Editor\Editor"); var srcNGUIAssetDepDirPath = Path.Combine(gitPath, @"KEngine.UnityProject\Assets\KEngine.NGUI.AssetDep"); var srcNGUIAssetDepEditorDirPath = Path.Combine(gitPath, @"KEngine.UnityProject\Assets\KEngine.NGUI.AssetDep.Editor\Editor"); // NO Dll for NGUI CopyFolder(srcNGUIDirPath, KEngineInstallDirPath + "/KEngine.NGUI"); CopyFolder(srcNGUEditorDirPath, KEngineEditorInstallDirPath + "/KEngine.NGUI.Editor"); CopyFolder(srcNGUIAssetDepDirPath, KEngineInstallDirPath + "/KEngine.NGUI.AssetDep"); CopyFolder(srcNGUIAssetDepEditorDirPath, KEngineEditorInstallDirPath + "/KEngine.NGUI.AssetDep.Editor"); KDefineSymbolsHelper.AddDefineSymbols("NGUI"); } else { KDefineSymbolsHelper.RemoveDefineSymbols("NGUI"); } } AssetDatabase.Refresh(); }