public override void OnInspectorGUI() { if (GameEditorTools.DrawHeader("网络设置")) { GameEditorTools.BeginContents(); mConfig.net.httpApiUrl = EditorGUILayout.TextField("api地址", mConfig.net.httpApiUrl); GUILayout.BeginHorizontal(); GUI.color = Color.cyan; GUILayout.Label("api服务器地址"); var lastIpAdressType = mConfig.net.ipAdressType; mConfig.net.ipAdressType = (GameConfigNet.IPAdress)EditorGUILayout.Popup((int)mConfig.net.ipAdressType, mConfig.net.ipAdressTypeName); GUI.color = Color.white; GUILayout.EndHorizontal(); // if (mConfig.net.ipAdressType == GameConfigNet.IPAdress.Userdefined) { // mConfig.net.loginServerIp = EditorGUILayout.TextField("服务器IP", mConfig.net.loginServerIp); // mConfig.net.loginPort = EditorGUILayout.IntField("服务器Port", mConfig.net.loginPort); // } else { // GUI.enabled = false; // EditorGUILayout.TextField("服务器IP", mConfig.net.loginServerIp); // EditorGUILayout.IntField("服务器Port", mConfig.net.loginPort); // GUI.enabled = true; // } GameEditorTools.EndContents(); if (lastIpAdressType != mConfig.net.ipAdressType) { mConfig.SetIPAdress(mConfig.net.ipAdressType); } } if (GameEditorTools.DrawHeader("游戏设置")) { GameEditorTools.BeginContents(); GUI.color = Color.cyan; mConfig.showPackage = EditorGUILayout.TextField("显示Package", mConfig.showPackage); mConfig.developmentMode = EditorGUILayout.Toggle("开发者模式", mConfig.developmentMode); mConfig.testView = EditorGUILayout.Toggle("测试View(不运行游戏)", mConfig.testView); mConfig.isIosEnterprise = EditorGUILayout.Toggle("是否为iOS企业版本", mConfig.isIosEnterprise); GUI.color = Color.white; GUI.enabled = false; EditorGUILayout.TextField("应用版本号", Application.version); GUI.enabled = true; GameEditorTools.EndContents(); } if (GameEditorTools.DrawHeader("资源设置")) { GameEditorTools.BeginContents(); mConfig.assetBundleFilePathEncrypt = EditorGUILayout.Toggle("资源路径加密)", mConfig.assetBundleFilePathEncrypt); #if UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN mConfig.assetBundleFilePathEncrypt = false; #elif UNITY_STANDALONE_OSX || UNITY_STANDALONE_WIN #endif GameConfigProject.LoadType loadType = (GameConfigProject.LoadType)EditorGUILayout.EnumPopup("加载方式", (GameConfigProject.LoadType)mConfig.assetLoadType); if (mConfig.assetLoadType != (int)loadType) { mConfig.assetLoadType = (int)loadType; EditorPrefs.SetInt("SimulateAssetBundles", (int)loadType); } //GameConfigAssets.AssetBundleCompressType assetBundleCompressType = (GameConfigAssets.AssetBundleCompressType)EditorGUILayout.EnumPopup("AssetBundle压缩方式", mConfig.assets.assetBundleCompressType); //if (mConfig.assets.assetBundleCompressType != assetBundleCompressType) //{ // mConfig.assets.assetBundleCompressType = assetBundleCompressType; // EditorPrefs.SetInt("AssetBundleCompressType", (int)assetBundleCompressType); //} //EditorGUILayout.LabelField("资源地址", mConfig.assets.httpResourcesServerUrl); GameEditorTools.EndContents(); } if (GameEditorTools.DrawHeader("Log显示设置")) { GameEditorTools.BeginContents(); mConfig.netClientStateLogShow = EditorGUILayout.Toggle("C#网络连接log显示", mConfig.netClientStateLogShow); mConfig.netLogSendServerShow = EditorGUILayout.Toggle("C#收发包命令显示", mConfig.netLogSendServerShow); mConfig.netTransferDataShow = EditorGUILayout.Toggle("Lua收发包内容显示", mConfig.netTransferDataShow); mConfig.commonLogShow = EditorGUILayout.Toggle("普通Log显示", mConfig.commonLogShow); mConfig.warningLogShow = EditorGUILayout.Toggle("普通警告显示", mConfig.warningLogShow); mConfig.errorLogShow = EditorGUILayout.Toggle("普通错误显示", mConfig.errorLogShow); GameEditorTools.EndContents(); } }
public bool OnGUI() { if (GameConfigProject.instance == null) { return(true); } GUILayout.BeginVertical(); GUILayout.Width(200); if (GameEditorTools.DrawHeader("游戏设置", true)) { GameEditorTools.BeginContents(); GUI.color = Color.yellow; GameConfigProject.instance.assetBundleFilePathEncrypt = GUILayout.Toggle(GameConfigProject.instance.assetBundleFilePathEncrypt, "资源路径加密"); GameConfigProject.instance.luaScriptProcess = GUILayout.Toggle(GameConfigProject.instance.luaScriptProcess, "lua代码加密"); if (mConfig != null && mConfig.channel != "") { Channel channel = (Channel)Enum.Parse(typeof(Channel), mConfig.channel); channel = (Channel)EditorGUILayout.EnumPopup("渠道", channel); mConfig.channel = channel.ToString(); } EditorGUILayout.BeginHorizontal(); GameConfigProject.instance.developmentMode = GUILayout.Toggle(GameConfigProject.instance.developmentMode, "开启开发者模式"); #if UNITY_IPHONE GameConfigProject.instance.isIosEnterprise = GUILayout.Toggle(GameConfigProject.instance.isIosEnterprise, "iOS企业包"); #endif EditorGUILayout.EndHorizontal(); GUI.color = Color.cyan; EditorGUILayout.BeginHorizontal(); PlayerSettings.bundleVersion = EditorGUILayout.TextField("游戏版本号:", Application.version); if (EditorUserBuildSettings.activeBuildTarget == BuildTarget.iOS) { PlayerSettings.iOS.buildNumber = EditorGUILayout.TextField("BuildNumber", PlayerSettings.iOS.buildNumber); } else { PlayerSettings.Android.bundleVersionCode = EditorGUILayout.IntField("BuildNumber", PlayerSettings.Android.bundleVersionCode); } EditorGUILayout.EndHorizontal(); buildAppAutoIncreaseVersion = EditorGUILayout.Toggle("Build自增App版本号:", buildAppAutoIncreaseVersion); #if UNITY_ANDROID GUI.color = Color.yellow; ScriptingImplementation scriptingImplementation = PlayerSettings.GetScriptingBackend(BuildTargetGroup.Android); scriptingImplementation = (ScriptingImplementation)EditorGUILayout.EnumPopup("StripEngineCode", scriptingImplementation); PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, scriptingImplementation); #endif GUI.color = Color.cyan; PlayerSettings.stripEngineCode = EditorGUILayout.Toggle("StripEngineCode", PlayerSettings.stripEngineCode); //EditorGUILayout.TextField("AndroidDll生成时间:", File.GetLastWriteTime(Application.dataPath + "/Scripts/External/Runtime/Android/GameDll.dll.bytes").ToString("yy-MM-dd HH:mm:ss")); GUI.enabled = true; GUI.color = Color.white; GUILayout.BeginHorizontal(); GUILayout.Label("服务器地址"); mConfig.net.ipAdressType = (GameConfigNet.IPAdress)EditorGUILayout.Popup((int)mConfig.net.ipAdressType, mConfig.net.ipAdressTypeName); GUILayout.EndHorizontal(); // if (mConfig.net.ipAdressType == GameConfigNet.IPAdress.Userdefined) { // mConfig.net.loginServerIp = EditorGUILayout.TextField("服务器IP", mConfig.net.loginServerIp); // mConfig.net.loginPort = EditorGUILayout.IntField("服务器Port", mConfig.net.loginPort); // } else { // GUI.enabled = false; // EditorGUILayout.TextField("服务器IP", mConfig.net.loginServerIp); // EditorGUILayout.IntField("服务器Port", mConfig.net.loginPort); // GUI.enabled = true; // } GameEditorTools.EndContents(); } if (GameEditorTools.DrawHeader("Build设置", true)) { GUILayout.BeginHorizontal(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(); EditorGUILayout.TextField("App导出路径", Path.Combine(appExportPath, appbuildName)); if (GUILayout.Button("选择")) { string buildPath = EditorUtility.SaveFolderPanel("Build路径", mAppExportPath, ""); if (buildPath.Length != 0) { mAppExportPath = buildPath; EditorPrefs.SetString("GameAppbuildPath", buildPath); } } GUILayout.EndHorizontal(); EditorUserBuildSettings.development = EditorGUILayout.Toggle("Development Build", EditorUserBuildSettings.development); if (EditorUserBuildSettings.development) { EditorUserBuildSettings.connectProfiler = EditorGUILayout.Toggle("OpenProfiler", EditorUserBuildSettings.connectProfiler); EditorUserBuildSettings.allowDebugging = EditorGUILayout.Toggle("ScriptDebug", EditorUserBuildSettings.allowDebugging); } } if (GameEditorTools.DrawHeader("上传设置")) { GUI.color = Color.yellow; bool isMasterTmp = EditorGUILayout.Toggle("Master分支", isMaster); if (isMasterTmp != isMaster) { isMaster = isMasterTmp; EditorPrefs.SetString("GameBuildIsMaster", isMaster ? "true" : "false"); } GUI.color = Color.white; GUILayout.BeginHorizontal(); GUILayout.Label("上传资源服务器地址"); resourcesIpAdress = (GameConfigNet.IPAdress)EditorGUILayout.Popup((int)resourcesIpAdress, mConfig.net.ipAdressTypeName); assetVersionUploadServerName = mConfig.net.ipAdressTypeName[(int)resourcesIpAdress]; GUILayout.EndHorizontal(); if (GUI.changed) { string host; if (resourcesIpDatas.TryGetValue(resourcesIpAdress, out host)) { resourcesUploadServerHost = host; EditorPrefs.SetInt("ResourcesIpAdress", (int)resourcesIpAdress); } } if (resourcesIpAdress == GameConfigNet.IPAdress.Userdefined) { resourcesUploadServerHost = EditorGUILayout.TextField("服务器Host", resourcesUploadServerHost); } else { GUI.enabled = false; EditorGUILayout.TextField("服务器Host", resourcesUploadServerHost); GUI.enabled = true; } } GameEditorTools.DrawHeader("资源打包设置"); gameBuildPackageResTag = 0; EditorGUILayout.BeginHorizontal(); int allNum = Enum.GetNames(typeof(GameBuildPackageResTag)).ToDynList().Count; int tagNum = 0; int curNum = 0; foreach (GameBuildPackageResTag tag in Enum.GetValues(typeof(GameBuildPackageResTag))) { if (tagNum == 0) { EditorGUILayout.BeginVertical(); } if (tag != GameBuildPackageResTag.end) { ToggleGameBuildResTag(tag.ToString(), tag); } tagNum++; if (tagNum == 4) { EditorGUILayout.EndVertical(); } curNum++; if (curNum == allNum && tagNum != 4) { EditorGUILayout.EndVertical(); } if (tagNum == 4) { tagNum = 0; } } EditorGUILayout.EndHorizontal(); GUI.backgroundColor = Color.gray; if (GUILayout.Button("Player Settings")) { EditorApplication.ExecuteMenuItem("Edit/Project Settings/Player"); } GUI.backgroundColor = Color.white; GUILayout.EndVertical(); return(true); }