diff --git a/README.md b/README.md index 750cdf2f9b942ecf84bb07437041e5913176e6f3..62fbd90ad0cd0c9c3a903eeea6c2ce5dc72c1377 100644 --- a/README.md +++ b/README.md @@ -81,4 +81,4 @@ npm start * 手机和电脑连接åŒä¸€ä¸ªWifi * 打开调试appï¼Œæ ¹æ®æç¤ºè¾“å…¥IP地å€ï¼Œç‚¹å‡»å¼€å§‹å°±å¯ä»¥åœ¨æ‰‹æœºä¸Šé¢„览模æ¿äº† -* \ No newline at end of file +* 使用 this.log("==调试信æ¯=="); å¯ä»¥æ‰“å°æ—¥å¿—进行必è¦çš„调试 \ No newline at end of file diff --git a/assets/cocos_generator.meta b/assets/cocos_generator.meta index 0b430b310f5a71fedfa2d25b5dbee6e0e0b9f9eb..35bb68593c029efbca2ed91581853fdff5e10047 100644 --- a/assets/cocos_generator.meta +++ b/assets/cocos_generator.meta @@ -1,15 +1 @@ -{ - "ver": "1.1.2", - "uuid": "c35bb2f6-f24a-4850-ae44-643f2fdc7541", - "isBundle": false, - "bundleName": "", - "priority": 1, - "compressionType": {}, - "optimizeHotUpdate": {}, - "inlineSpriteFrames": {}, - "isRemoteBundle": { - "ios": false, - "android": false - }, - "subMetas": {} -} \ No newline at end of file +{"ver":"1.1.2","uuid":"c35bb2f6-f24a-4850-ae44-643f2fdc7541","isBundle":false,"bundleName":"","priority":1,"compressionType":{},"optimizeHotUpdate":{},"inlineSpriteFrames":{},"isRemoteBundle":{"ios":false,"android":false},"subMetas":{}} \ No newline at end of file diff --git a/assets/cocos_generator/script/MyCocosSceneComponent.ts b/assets/cocos_generator/script/MyCocosSceneComponent.ts index 69bd3c43d049edb0fd832a5f08ec85cda4d1d93a..85b380d3675c53ea1dad00d54a833cd17c9a8f3e 100644 --- a/assets/cocos_generator/script/MyCocosSceneComponent.ts +++ b/assets/cocos_generator/script/MyCocosSceneComponent.ts @@ -126,7 +126,7 @@ export class MyCocosSceneComponent extends cc.Component { log (str) { const node = cc.find('middleLayer'); if(node){ - node.getComponent('middleLayer').showLog(str); + node.getComponent('middleLayer').log(str); }else{ cc.log(str); } diff --git a/bin/buildCocos.js b/bin/buildCocos.js index 7ae80bc938ec3a4a2f46471db373cf52d31546d6..1eb56fcdb3417ffb09c776aebe9350e5ddcaa981 100644 --- a/bin/buildCocos.js +++ b/bin/buildCocos.js @@ -128,15 +128,28 @@ async function buildWebBundle() { await buildCocos(args); } -function createConfigFile (projectName) { - const androidPaths = fs.readdirSync(`dist/android/${projectName}`); - const androidConfigFileName = androidPaths.find(path => path.indexOf('config') == 0); - const androidVersion = androidConfigFileName.split('.')[1]; - - const iosPaths = fs.readdirSync(`dist/ios/${projectName}`); - const iosConfigFileName = iosPaths.find(path => path.indexOf('config') == 0); - const iosVersion = iosConfigFileName.split('.')[1]; - +function createConfigFile (projectName, type) { + let iosVersion = ""; + let androidVersion = ""; + if(!type){ + const androidPaths = fs.readdirSync(`dist/android/${projectName}`); + const androidConfigFileName = androidPaths.find(path => path.indexOf('config') == 0); + androidVersion = androidConfigFileName.split('.')[1]; + const iosPaths = fs.readdirSync(`dist/ios/${projectName}`); + const iosConfigFileName = iosPaths.find(path => path.indexOf('config') == 0); + iosVersion = iosConfigFileName.split('.')[1]; + } else { + if(type=="android"){ + const androidPaths = fs.readdirSync(`dist/android/${projectName}`); + const androidConfigFileName = androidPaths.find(path => path.indexOf('config') == 0); + androidVersion = androidConfigFileName.split('.')[1]; + }else{ + const iosPaths = fs.readdirSync(`dist/ios/${projectName}`); + const iosConfigFileName = iosPaths.find(path => path.indexOf('config') == 0); + iosVersion = iosConfigFileName.split('.')[1]; + } + } + const config = { "ios": { "sceneName": projectName, @@ -342,32 +355,38 @@ module.exports = { }, buildAndroid: async function () { + + // æž„å»ºå‰æ£€æŸ¥ + const projectName = build_check(); // 改设置为bundle changeSettingsToBundle(); await removeDir('dist/android'); await buildAndroidBundle(); await copyDir('build_android/jsb-link/remote', 'dist/android'); - console.log('构建 android bundle æˆåŠŸï¼'); - + // 改设置为éžbundle changeSettingToWebDesktop(); - + createConfigFile(projectName, "android"); await removeDir('build_android'); + console.log('构建 android bundle æˆåŠŸï¼'); }, buildIos: async function () { + // æž„å»ºå‰æ£€æŸ¥ + const projectName = build_check(); // 改设置为bundle changeSettingsToBundle(); await removeDir('dist/ios'); await buildIosBundle(); await copyDir('build_ios/jsb-link/remote', 'dist/ios'); - console.log('构建 ios bundle æˆåŠŸï¼'); // 改设置为éžbundle changeSettingToWebDesktop(); + createConfigFile(projectName, "ios"); await removeDir('build_ios'); + console.log('构建 ios bundle æˆåŠŸï¼'); } };