Explorar el Código

1,migrate to 3.4.4
2,add build folder
3,add hot man punching mode

yichael hace 5 años
padre
commit
873d97d0b1

+ 1 - 1
BirdClient/assets/Common/MatchPanel/MatchPanel.prefab.meta

@@ -1,5 +1,5 @@
 {
-  "ver": "1.2.7",
+  "ver": "1.2.9",
   "uuid": "5d04a3b6-992b-48e4-b5ec-834f3721463f",
   "optimizationPolicy": "AUTO",
   "asyncLoadAssets": false,

+ 1 - 1
BirdClient/assets/Prefab/Bird.prefab.meta

@@ -1,5 +1,5 @@
 {
-  "ver": "1.2.7",
+  "ver": "1.2.9",
   "uuid": "541924d4-0701-47f1-8a93-9869ae824f3d",
   "optimizationPolicy": "AUTO",
   "asyncLoadAssets": false,

+ 1 - 1
BirdClient/assets/Prefab/Bubble.prefab.meta

@@ -1,5 +1,5 @@
 {
-  "ver": "1.2.7",
+  "ver": "1.2.9",
   "uuid": "1b7ae948-ced2-4083-a0f0-5bf76d64f46c",
   "optimizationPolicy": "AUTO",
   "asyncLoadAssets": false,

+ 1 - 1
BirdClient/assets/Prefab/Cut.prefab.meta

@@ -1,5 +1,5 @@
 {
-  "ver": "1.2.7",
+  "ver": "1.2.9",
   "uuid": "737aca25-53f2-4a44-baf4-36ee84296b44",
   "optimizationPolicy": "AUTO",
   "asyncLoadAssets": false,

+ 1 - 1
BirdClient/assets/Prefab/CutFruit.prefab.meta

@@ -1,5 +1,5 @@
 {
-  "ver": "1.2.7",
+  "ver": "1.2.9",
   "uuid": "464ac955-4de5-4bcb-b0e6-3100d19f4b5f",
   "optimizationPolicy": "AUTO",
   "asyncLoadAssets": false,

+ 1 - 1
BirdClient/assets/Prefab/DestinationFlag.prefab.meta

@@ -1,5 +1,5 @@
 {
-  "ver": "1.2.7",
+  "ver": "1.2.9",
   "uuid": "dac16532-ab50-4075-a47a-608a6d950eb3",
   "optimizationPolicy": "AUTO",
   "asyncLoadAssets": false,

+ 1 - 1
BirdClient/assets/Prefab/Emission.prefab.meta

@@ -1,5 +1,5 @@
 {
-  "ver": "1.2.7",
+  "ver": "1.2.9",
   "uuid": "06539742-f4b5-4eed-8c00-2bd586ec07e8",
   "optimizationPolicy": "AUTO",
   "asyncLoadAssets": false,

+ 1 - 1
BirdClient/assets/Prefab/Fruit.prefab.meta

@@ -1,5 +1,5 @@
 {
-  "ver": "1.2.7",
+  "ver": "1.2.9",
   "uuid": "e22e8f69-e450-4f4c-8af9-e5dc0938cbe4",
   "optimizationPolicy": "AUTO",
   "asyncLoadAssets": false,

+ 1 - 1
BirdClient/assets/Prefab/Pipe.prefab.meta

@@ -1,5 +1,5 @@
 {
-  "ver": "1.2.7",
+  "ver": "1.2.9",
   "uuid": "0e89df6e-2635-4aa8-9dd8-b4e6caf06ed7",
   "optimizationPolicy": "AUTO",
   "asyncLoadAssets": false,

+ 0 - 12
BirdClient/assets/Scene/Game.fire

@@ -1703,7 +1703,6 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_useOriginalSize": false,
     "_string": "120",
     "_N$string": "120",
     "_fontSize": 32,
@@ -2951,7 +2950,6 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_useOriginalSize": true,
     "_string": "",
     "_N$string": "",
     "_fontSize": 32,
@@ -3244,7 +3242,6 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_useOriginalSize": true,
     "_string": "",
     "_N$string": "",
     "_fontSize": 32,
@@ -3537,7 +3534,6 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_useOriginalSize": true,
     "_string": "",
     "_N$string": "",
     "_fontSize": 32,
@@ -6767,7 +6763,6 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_useOriginalSize": true,
     "_string": "",
     "_N$string": "",
     "_fontSize": 24,
@@ -7122,7 +7117,6 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_useOriginalSize": true,
     "_string": "",
     "_N$string": "",
     "_fontSize": 24,
@@ -7477,7 +7471,6 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_useOriginalSize": true,
     "_string": "",
     "_N$string": "",
     "_fontSize": 24,
@@ -7822,7 +7815,6 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_useOriginalSize": true,
     "_string": "消耗卡路里",
     "_N$string": "消耗卡路里",
     "_fontSize": 40,
@@ -7920,7 +7912,6 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_useOriginalSize": true,
     "_string": "1300.54",
     "_N$string": "1300.54",
     "_fontSize": 32,
@@ -8238,7 +8229,6 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_useOriginalSize": true,
     "_string": "相当于消耗",
     "_N$string": "相当于消耗",
     "_fontSize": 40,
@@ -8336,7 +8326,6 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_useOriginalSize": true,
     "_string": "耗时",
     "_N$string": "耗时",
     "_fontSize": 40,
@@ -8437,7 +8426,6 @@
     ],
     "_srcBlendFactor": 770,
     "_dstBlendFactor": 771,
-    "_useOriginalSize": true,
     "_string": "01:30:00",
     "_N$string": "01:30:00",
     "_fontSize": 32,

+ 1 - 1
BirdClient/assets/Scene/Game.fire.meta

@@ -1,5 +1,5 @@
 {
-  "ver": "1.2.8",
+  "ver": "1.2.9",
   "uuid": "6ffc812e-35c4-4128-863c-c083b375cf38",
   "asyncLoadAssets": false,
   "autoReleaseAssets": false,

+ 22 - 1
BirdClient/assets/Script/AppGame.ts

@@ -114,9 +114,30 @@ export default class AppGame extends cc.Component {
     }
 
     onBoxingPostHit(gameData: any) {
+        console.log('data=',gameData);
         if (gameData.ename == "hit") {
             if (window.gm.isGameOver == false) {
-                window.gm.controlFlyUp(parseInt(gameData.hitPower));
+                window.gm.controlFlyUp(parseInt(gameData.value));
+            }
+        }
+
+        let name  = gameData.direction;
+
+        if(name == 'leftPunch') {
+            if (window.gm.isGameOver == false) {
+                window.gm.controlFlyUp(parseInt(gameData.value));
+            }
+        }
+
+        if(name == 'rightPunch') {
+            if (window.gm.isGameOver == false) {
+                window.gm.controlFlyUp(parseInt(gameData.value));
+            }
+        }
+       
+        if(name == 'straightPunch') {
+            if (window.gm.isGameOver == false) {
+                window.gm.controlFlyUp(parseInt(gameData.value));
             }
         }
     }

+ 31 - 0
BirdClient/assets/Script/WebView.ts

@@ -100,6 +100,37 @@ export default class WebView {
         });
     }
 
+    
+    static onModify(){
+        uni.postMessage({
+            data: {
+                funName: "setAngleRatio",
+                gameData: {
+                    angleRatio:0.5 //z / x 值越小,代表直拳的判断方位越大
+                }
+
+            }
+        })
+    }
+
+    static onBindHitBoxingPost(){
+        uni.postMessage({
+            data: {
+                funName: "bindHitBoxingPost",
+                gameData: {}
+            }
+        })
+    }
+
+    static onUnbindHitBoxingPost(){
+        uni.postMessage({
+            data: {
+                funName: "unbindHitBoxingPost",
+                gameData: {}
+            }
+        })
+    }
+
     static closeGame(){
         uni.postMessage({
             data: {

+ 0 - 12
BirdClient/assets/migration.meta

@@ -1,12 +0,0 @@
-{
-  "ver": "1.1.2",
-  "uuid": "bdf10607-775f-4074-95a0-b1aeb5d7eece",
-  "isBundle": false,
-  "bundleName": "",
-  "priority": 1,
-  "compressionType": {},
-  "optimizeHotUpdate": {},
-  "inlineSpriteFrames": {},
-  "isRemoteBundle": {},
-  "subMetas": {}
-}

+ 0 - 17
BirdClient/assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js

@@ -1,17 +0,0 @@
-/*
- * This script is automatically generated by Cocos Creator and is only used for projects compatible with the v2.1.0 ~ 2.2.1 version.
- * You do not need to manually add this script in any other project.
- * If you don't use cc.Toggle in your project, you can delete this script directly.
- * If your project is hosted in VCS such as git, submit this script together.
- *
- * 此脚本由 Cocos Creator 自动生成,仅用于兼容 v2.1.0 ~ 2.2.1 版本的工程,
- * 你无需在任何其它项目中手动添加此脚本。
- * 如果你的项目中没用到 Toggle,可直接删除该脚本。
- * 如果你的项目有托管于 git 等版本库,请将此脚本一并上传。
- */
-
-if (cc.Toggle) {
-    // Whether to trigger 'toggle' and 'checkEvents' events when modifying 'toggle.isChecked' in the code
-    // 在代码中修改 'toggle.isChecked' 时是否触发 'toggle' 与 'checkEvents' 事件
-    cc.Toggle._triggerEventInScript_isChecked = true;
-}

+ 0 - 9
BirdClient/assets/migration/use_v2.1-2.2.1_cc.Toggle_event.js.meta

@@ -1,9 +0,0 @@
-{
-  "ver": "1.0.8",
-  "uuid": "0084083f-2787-4d52-87f0-85f1631a7e9a",
-  "isPlugin": false,
-  "loadPluginInWeb": true,
-  "loadPluginInNative": true,
-  "loadPluginInEditor": false,
-  "subMetas": {}
-}

+ 2 - 0
BirdClient/build/package.bat

@@ -0,0 +1,2 @@
+@ECHO OFF
+start cmd /k node package.js

+ 250 - 0
BirdClient/build/package.js

@@ -0,0 +1,250 @@
+var fs = require('fs')
+
+let folderPath = 'web-mobile';
+
+let pathRequire = require('path');
+let pathArr = pathRequire.resolve(__dirname, '..').split("\\"); 
+let newfolderPath = pathArr[pathArr.length-1];//'FightingSports'
+
+let fullFilePath = folderPath+'/index.html'
+
+let Package = 
+{
+	init()
+	{
+		let self = this;
+
+		this.quoteScriptToIndexHtml(function()
+			{
+				console.log("1,引入Script到html成功");
+				self.copyImg(self,function(picName)
+					{
+						console.log("2,拷贝图片成功");
+						self.changeCssBGPercentageAndPngName(self,picName,function()
+						{
+							console.log("3,修改Css背景图片百分比成功");
+							self.changeFolderName(self,function()
+							{
+								console.log("4,修改文件夹名成功");
+								console.log("\n打包成功!");
+							})
+						})
+					});	
+			});
+	},
+	//引入Script到html
+	quoteScriptToIndexHtml(callback)
+	{
+		let self = this;
+		this.readFile(this,fullFilePath,function(str)
+		{
+			let regExp = /<script src="main(.+?)<\/script>/g;// '<script src="main.870be.js" charset="utf-8"></script>';
+			let targetStr = str.match(regExp);
+			// console.log(targetStr);
+
+			let addStr = '<script type="text/javascript" src="//js.cdn.aliyun.dcloud.net.cn/dev/uni-app/uni.webview.1.5.2.js"></script>';
+			let replaceStr = addStr+'\n'+targetStr;
+			let newNata = str.replace(targetStr,replaceStr);
+
+			self.writeFile(self,newNata,fullFilePath,callback);
+		});
+	},
+	//拷贝图片
+	copyImg(self,callback)
+	{
+		let reg = /splash.+?png/;// splash.85cfd.png
+		
+		let pngName = self.matchFileInFolder(folderPath,reg);
+		// console.log('png='+pngName);
+		if(pngName)
+		{
+			fs.unlinkSync(folderPath+'/'+pngName);
+	
+			let picReg = /splash.+?/;// splash.85cfd.png
+			let picName = self.matchFileInFolder('./',picReg);
+			// console.log('picName='+picName);
+			if(picName)
+			{
+				let aPath = folderPath+'/'+file;
+				fs.copyFile(picName,aPath,function(err)
+				{
+					if(err) {
+						console.log('something wrong was happened')
+					}
+					else 
+					{
+						let aName = self.getFileName(pngName);
+						// console.log('aName='+aName);
+						let aTail = self.getFileTail(picName);
+						// console.log('aTail='+aTail);
+						let newFileName = aName+'.'+aTail;
+						// console.log('newFileName='+newFileName);
+						// console.log('copy file succeed');
+
+						let oldPath = folderPath+'/'+picName;
+						let newPath = folderPath+'/'+newFileName;
+						self.rename(oldPath,newPath,function()
+						{
+							callback(newFileName);
+						});
+					}
+				});
+			}	
+		}
+	},
+	// 修改Css背景图片百分比
+	changeCssBGPercentageAndPngName(self,picName,callback){
+	
+		let reg = /style-mobile.+?css/;// style-mobile.6e9cd.css
+		let cssName = self.matchFileInFolder(folderPath,reg);
+
+		if(cssName)
+		{
+			let aPath = folderPath+'/'+file;
+			this.readFile(this,aPath,function(str)
+			{
+				//change percentate
+				let targetStr =  'background-size: 45%;';
+				let replaceStr =  'background-size: 100%;';
+				let newNata = str.replace(targetStr,replaceStr);
+				//change png link
+				let fileName = self.getFileName(picName);
+				// console.log('fileName='+fileName);
+				// console.log('picName='+picName);
+				let newNata2 = newNata.replace(fileName+'.png',picName);
+
+				// console.log(newNata)
+		    	self.writeFile(self,newNata2,aPath,callback);
+			});
+		}
+	},
+	//修改文件夹名
+	changeFolderName(self,callback)
+	{
+		let deleteall = function(path) 
+		{
+			var files = [];
+			if(fs.existsSync(path)) 
+			{
+				files = fs.readdirSync(path);
+				files.forEach(function(file, index) 
+				{
+					var curPath = path + "/" + file;
+					if(fs.statSync(curPath).isDirectory()) 
+					{ // recurse
+						deleteall(curPath);
+					} 
+					else 
+					{ // delete file
+						fs.unlinkSync(curPath);
+					}
+				});
+				fs.rmdirSync(path);
+			}
+			if(!fs.existsSync(newfolderPath))
+			{
+				self.rename(folderPath,newfolderPath,callback)
+			}
+		};
+		// delete FightingSports
+		deleteall(newfolderPath);
+	},
+	readFile(self,path,callback)
+	{
+		fs.readFile(path, function (error, data) 
+		{
+		  if (error) 
+		  {
+		     // 在这里就可以通过判断 error 来确认是否有错误发生
+		    console.log('读取文件失败了')
+		  } 
+		  else 
+		  {
+		      // <Buffer 68 65 6c 6c 6f 20 6e 6f 64 65 6a 73 0d 0a>
+		  	// 文件中存储的其实都是二进制数据 0 1
+		  	// 这里为什么看到的不是 0 和 1 呢?原因是二进制转为 16 进制了
+		  	// 但是无论是二进制01还是16进制,人类都不认识
+		  	// 所以我们可以通过 toString 方法把其转为我们能认识的字符
+		    // console.log(data.toString())
+			var str = data.toString();
+			callback(str);
+		  }
+		});
+	},
+	writeFile(self,newNata,path,callback)
+	{
+		// fs.wirteFile有三个参数
+		// 1,第一个参数是要写入的文件路径
+		// 2,第二个参数是要写入得内容
+		// 3,第三个参数是可选参数,表示要写入的文件编码格式,一般就不写,默认就行
+		// 4,第四个参数是个回调函数  只有一个参数error,来判断是否写入成功
+		fs.writeFile(path, newNata, error => 
+		{
+		 	if (error) return console.log("写入文件失败,原因是" + error.message);
+		 	// console.log("写入成功");
+			callback();	
+		}); 
+	},
+	rename(oldPath,newPath,callback)
+	{
+		//同以目录下的文件更名:
+		fs.rename(oldPath,newPath, function(err)
+		{
+			if(err)
+			{
+				throw err;
+			}
+			// console.log('rename done!');
+			callback();
+		});
+	},
+	matchFileInFolder(path,reg)
+	{
+		const files = fs.readdirSync(path);
+
+		for (file of files) {
+
+			let result = reg.test(file);
+			if(result)
+			{
+				return file;
+			}
+		}
+
+		return null;
+	},
+	getFileName(name)
+	{
+		let namePartArr = name.split('.');
+
+		return name.replace('.'+namePartArr[namePartArr.length-1],'');
+		// if(name.indexOf('.png')!=-1)
+		// {
+		// 	return name.split('.png')[0];
+		// }
+		// else if(name.indexOf('.jpg')!=-1)
+		// {
+		// 	return name.split('.jpg')[0];
+		// }
+	},
+	getFileTail(name)
+	{
+		let namePartArr = name.split('.');
+
+		return namePartArr[namePartArr.length-1];
+
+		// if(name.indexOf('.png')!=-1)
+		// {
+		// 	return 'png';
+		// }
+		// else if(name.indexOf('.jpg')!=-1)
+		// {
+		// 	return 'jpg';
+		// }
+
+		// return '';
+	}
+}
+
+let package =  Object.create(Package);
+package.init();

+ 13 - 0
BirdClient/build/readme.md

@@ -0,0 +1,13 @@
+用途
+-----------------
+>本脚本是用于:
+1,把打好的包项目下的index.html文件里加上uniapp的js库  
+2,替换loading图片
+3,修改让背景图片全屏
+4,重命名web-mobile文件夹为项目的文件夹名称  
+
+使用方法
+-----------------
+>将两个脚本同时放到Cocos项目的buil文件夹下面
+1,替换splash.png为想要的loading图片
+2,点击package.bat脚本即可

BIN
BirdClient/build/splash.jpg


+ 1 - 1
BirdClient/project.json

@@ -1,7 +1,7 @@
 {
   "engine": "cocos-creator-js",
   "packages": "packages",
-  "version": "2.4.2",
+  "version": "2.4.4",
   "id": "19e31144-041d-4864-a527-faa77ec74a72",
   "isNew": false
 }

+ 18 - 4
BirdClient/settings/builder.json

@@ -10,7 +10,7 @@
     "portrait": false,
     "upsideDown": false
   },
-  "webOrientation": "auto",
+  "webOrientation": "portrait",
   "inlineSpriteFrames": true,
   "inlineSpriteFrames_native": true,
   "mergeStartScene": false,
@@ -21,15 +21,25 @@
   "zipCompressJs": true,
   "fb-instant-games": {},
   "android": {
+    "REMOTE_SERVER_ROOT": "",
     "packageName": ""
   },
   "ios": {
+    "REMOTE_SERVER_ROOT": "",
+    "ios_enable_jit": true,
     "packageName": ""
   },
   "mac": {
-    "packageName": ""
+    "REMOTE_SERVER_ROOT": "",
+    "height": 720,
+    "packageName": "",
+    "width": 1280
+  },
+  "win32": {
+    "REMOTE_SERVER_ROOT": "",
+    "height": 720,
+    "width": 1280
   },
-  "win32": {},
   "android-instant": {
     "REMOTE_SERVER_ROOT": "",
     "host": "",
@@ -39,5 +49,9 @@
     "scheme": "https",
     "skipRecord": false
   },
-  "appBundle": false
+  "appBundle": false,
+  "mainCompressionType": "merge_all_json",
+  "mainIsRemote": false,
+  "nativeMd5Cache": true,
+  "agreements": {}
 }

+ 1 - 1
BirdClient/settings/project.json

@@ -33,7 +33,7 @@
     "3D Particle",
     "SafeArea"
   ],
-  "last-module-event-record-time": 1607055066446,
+  "last-module-event-record-time": 1615714661241,
   "design-resolution-width": 960,
   "design-resolution-height": 640,
   "fit-width": false,