mirror of
				https://github.com/smallmain/cocos-enhance-kit.git
				synced 2025-10-31 01:55:22 +00:00 
			
		
		
		
	完善 docs
This commit is contained in:
		| @@ -55,9 +55,9 @@ | ||||
|  | ||||
| ## 功能演示 | ||||
|  | ||||
| [桌面版 Demo Web 项目](https://smallmain.github.io/cocos-service-pack/demo/web-desktop/index.html) | ||||
| [Web Desktop 演示项目](https://smallmain.github.io/cocos-service-pack/demo/web-desktop/index.html) | ||||
|  | ||||
| [手机版 Demo Web 项目](https://smallmain.github.io/cocos-service-pack/demo/web-mobile/index.html) | ||||
| [Web Mobile 演示项目](https://smallmain.github.io/cocos-service-pack/demo/web-mobile/index.html) | ||||
|  | ||||
| ## 使用方法 | ||||
|  | ||||
|   | ||||
| @@ -8,32 +8,12 @@ | ||||
|  | ||||
| 2. 重启编辑器后运行项目的 `main.fire` 场景。 | ||||
|  | ||||
|  | ||||
| // Cocos Creator SP v2.4.x | ||||
|  | ||||
| // 提供内置的多纹理材质(8、16 纹理插槽),并根据设备使用不同的材质 | ||||
| // 扩展 Sprite、Label、RichText、MotionSteak、Spine 组件原生支持多纹理材质 | ||||
| // 新增多纹理合批管理器:每个纹理都会对应一个材质,当纹理在渲染组件中使用时,会自动切换至对应的材质,支持控制全局默认是否自动切换,单个组件是否自动切换 | ||||
| // 重构动态合图:在原有功能的基础上,支持:1.完全开放所有接口以手动规划图集 2.增加全局默认是否参与动态合图的开关,单个组件是否参与的开关 3.增加在场景切换时是否清空所有图集的开关(原来是必定清空) 4.支持自动加入多纹理合批 5.自动根据设备支持的最大多纹理数量调整最大图集数量 6.优化装箱算法(Guillotine)7.支持复用被删除的空间 8.所有子图集作为一个整体进行管理(不会出现一张纹理被加入到两张图集的问题)9.修复动态图集一个内存泄漏问题 | ||||
| // 扩展 RichText:支持自定义材质 | ||||
| // 扩展 Spine:支持使用 SpriteFrame 换装 | ||||
| // 扩展 Label:支持高 DPI 文本渲染 | ||||
| // 扩展 Label:BITMAP 模式会复用同样式同文本的纹理,CHAR 模式改为使用多个图集,但是支持自动加入多纹理合批,这样就能与动态图集一起合批(增加配置,默认情况下动态图集最高8-1张,Char 图集为 1 张(无论如何设置,在装不完的情况下,因为需要正常渲染,都会最高使用 8 张图集,但是只有设置的数量才会加入多纹理合批,并且会创建一个专属材质,如果该材质无法完成渲染,会使用专属材质,或者可以仿照 spine flush buffer) | ||||
| // 扩展 Spine:支持自动切换材质与动态图集 | ||||
|  | ||||
| // Spine 需要更多测试!!!SkeletonData 克隆会有 ref 问题吗? | ||||
|  | ||||
| // 注意:序列帧动画的性能下降(具体多少待测试) | ||||
| // 注意:使用多纹理材质并且使用 Spine 缓存模式时,useTint 会强制关闭。 | ||||
|  | ||||
| // 之后: | ||||
| // CHAR 模式有时候空格(字符也可能)会有额外的纹理,可能是复用没考虑 space | ||||
| // 演示项目比较慢,加上加载中 | ||||
| https://smallmain.github.io/cocos-service-pack/demo/web-desktop/index.html | ||||
| // Char 模式只能复用完全相同宽高的 Char,试一下加一个开关,能先用空纹理写一遍,覆盖掉旧的避免 bleed 问题 | ||||
| // 查找所有 TODO | ||||
| // 插件适配 Windows | ||||
| // 演示项目 | ||||
| // 插件适配两个版本:最新版与 2.4.6 版本 | ||||
| // 适配原生平台 | ||||
| // 适配 Spine 缓存模式 | ||||
| // 适配 Spine useTint 模式 | ||||
| // 新增静态合批:在一个节点树的根节点挂上一个组件,该组件会快照这个节点树并显示为一张图片,然后只接管渲染,不影响其它逻辑 | ||||
|   | ||||
| @@ -3,7 +3,7 @@ | ||||
|   "uuid": "db4cffdc-d84c-4572-9dda-3d00e0d6302c", | ||||
|   "isBundle": true, | ||||
|   "bundleName": "", | ||||
|   "priority": 1, | ||||
|   "priority": "2", | ||||
|   "compressionType": { | ||||
|     "web-mobile": "merge_all_json", | ||||
|     "web-desktop": "merge_all_json" | ||||
|   | ||||
| @@ -74,6 +74,9 @@ | ||||
|       { | ||||
|         "__id__": 5 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 131 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 127 | ||||
|       } | ||||
| @@ -81,13 +84,13 @@ | ||||
|     "_active": true, | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 131 | ||||
|         "__id__": 134 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 132 | ||||
|         "__id__": 135 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 133 | ||||
|         "__id__": 136 | ||||
|       } | ||||
|     ], | ||||
|     "_prefab": null, | ||||
| @@ -5914,6 +5917,132 @@ | ||||
|     "_originalHeight": 0, | ||||
|     "_id": "07eIhJLF1JbZBAxWQGYnEA" | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Node", | ||||
|     "_name": "loading", | ||||
|     "_objFlags": 0, | ||||
|     "_parent": { | ||||
|       "__id__": 2 | ||||
|     }, | ||||
|     "_children": [], | ||||
|     "_active": true, | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 132 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 133 | ||||
|       } | ||||
|     ], | ||||
|     "_prefab": null, | ||||
|     "_opacity": 255, | ||||
|     "_color": { | ||||
|       "__type__": "cc.Color", | ||||
|       "r": 255, | ||||
|       "g": 255, | ||||
|       "b": 255, | ||||
|       "a": 255 | ||||
|     }, | ||||
|     "_contentSize": { | ||||
|       "__type__": "cc.Size", | ||||
|       "width": 720, | ||||
|       "height": 50.4 | ||||
|     }, | ||||
|     "_anchorPoint": { | ||||
|       "__type__": "cc.Vec2", | ||||
|       "x": 0.5, | ||||
|       "y": 0.5 | ||||
|     }, | ||||
|     "_trs": { | ||||
|       "__type__": "TypedArray", | ||||
|       "ctor": "Float64Array", | ||||
|       "array": [ | ||||
|         120, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
|         1, | ||||
|         1, | ||||
|         1, | ||||
|         1 | ||||
|       ] | ||||
|     }, | ||||
|     "_eulerAngles": { | ||||
|       "__type__": "cc.Vec3", | ||||
|       "x": 0, | ||||
|       "y": 0, | ||||
|       "z": 0 | ||||
|     }, | ||||
|     "_skewX": 0, | ||||
|     "_skewY": 0, | ||||
|     "_is3DNode": false, | ||||
|     "_groupIndex": 0, | ||||
|     "groupIndex": 0, | ||||
|     "_id": "74o/4WrVRJ7ph3NZbxASb1" | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Label", | ||||
|     "_name": "", | ||||
|     "_objFlags": 0, | ||||
|     "node": { | ||||
|       "__id__": 131 | ||||
|     }, | ||||
|     "_enabled": true, | ||||
|     "_materials": [ | ||||
|       null | ||||
|     ], | ||||
|     "_srcBlendFactor": 770, | ||||
|     "_dstBlendFactor": 771, | ||||
|     "_string": "载入中,请耐心等待...", | ||||
|     "_N$string": "载入中,请耐心等待...", | ||||
|     "_fontSize": 14, | ||||
|     "_lineHeight": 40, | ||||
|     "_enableWrapText": true, | ||||
|     "_N$file": null, | ||||
|     "_isSystemFontUsed": true, | ||||
|     "_spacingX": 0, | ||||
|     "_batchAsBitmap": false, | ||||
|     "_styleFlags": 0, | ||||
|     "_underlineHeight": 0, | ||||
|     "_N$horizontalAlign": 1, | ||||
|     "_N$verticalAlign": 1, | ||||
|     "_N$fontFamily": "Arial", | ||||
|     "_N$overflow": 1, | ||||
|     "_N$cacheMode": 2, | ||||
|     "_N$autoSwitchMaterial": 0, | ||||
|     "_N$allowDynamicAtlas": 0, | ||||
|     "_N$enableRetina": 0, | ||||
|     "_id": "fbn1E/3btMTITAC5skTshq" | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Widget", | ||||
|     "_name": "", | ||||
|     "_objFlags": 0, | ||||
|     "node": { | ||||
|       "__id__": 131 | ||||
|     }, | ||||
|     "_enabled": true, | ||||
|     "alignMode": 1, | ||||
|     "_target": null, | ||||
|     "_alignFlags": 42, | ||||
|     "_left": 240, | ||||
|     "_right": 0, | ||||
|     "_top": 0, | ||||
|     "_bottom": 0, | ||||
|     "_verticalCenter": 0, | ||||
|     "_horizontalCenter": 0, | ||||
|     "_isAbsLeft": true, | ||||
|     "_isAbsRight": true, | ||||
|     "_isAbsTop": true, | ||||
|     "_isAbsBottom": true, | ||||
|     "_isAbsHorizontalCenter": true, | ||||
|     "_isAbsVerticalCenter": true, | ||||
|     "_originalWidth": 393.34, | ||||
|     "_originalHeight": 0, | ||||
|     "_id": "ae56CfYxdB2ph1hpJP6MOn" | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Canvas", | ||||
|     "_name": "", | ||||
|   | ||||
| @@ -24,14 +24,14 @@ | ||||
|     "_active": true, | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 49 | ||||
|         "__id__": 55 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 50 | ||||
|         "__id__": 56 | ||||
|       } | ||||
|     ], | ||||
|     "_prefab": { | ||||
|       "__id__": 51 | ||||
|       "__id__": 57 | ||||
|     }, | ||||
|     "_opacity": 255, | ||||
|     "_color": { | ||||
| @@ -92,23 +92,23 @@ | ||||
|         "__id__": 3 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 37 | ||||
|         "__id__": 43 | ||||
|       } | ||||
|     ], | ||||
|     "_active": true, | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 42 | ||||
|         "__id__": 48 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 46 | ||||
|         "__id__": 52 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 47 | ||||
|         "__id__": 53 | ||||
|       } | ||||
|     ], | ||||
|     "_prefab": { | ||||
|       "__id__": 48 | ||||
|       "__id__": 54 | ||||
|     }, | ||||
|     "_opacity": 255, | ||||
|     "_color": { | ||||
| @@ -172,11 +172,11 @@ | ||||
|     "_active": true, | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 35 | ||||
|         "__id__": 41 | ||||
|       } | ||||
|     ], | ||||
|     "_prefab": { | ||||
|       "__id__": 36 | ||||
|       "__id__": 42 | ||||
|     }, | ||||
|     "_opacity": 255, | ||||
|     "_color": { | ||||
| @@ -249,29 +249,35 @@ | ||||
|         "__id__": 18 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 22 | ||||
|         "__id__": 21 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 25 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 28 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 31 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 34 | ||||
|       } | ||||
|     ], | ||||
|     "_active": true, | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 31 | ||||
|         "__id__": 37 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 32 | ||||
|         "__id__": 38 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 33 | ||||
|         "__id__": 39 | ||||
|       } | ||||
|     ], | ||||
|     "_prefab": { | ||||
|       "__id__": 34 | ||||
|       "__id__": 40 | ||||
|     }, | ||||
|     "_opacity": 255, | ||||
|     "_color": { | ||||
| @@ -284,7 +290,7 @@ | ||||
|     "_contentSize": { | ||||
|       "__type__": "cc.Size", | ||||
|       "width": 785.815, | ||||
|       "height": 503.4 | ||||
|       "height": 548.04 | ||||
|     }, | ||||
|     "_anchorPoint": { | ||||
|       "__type__": "cc.Vec2", | ||||
| @@ -363,7 +369,7 @@ | ||||
|       "ctor": "Float64Array", | ||||
|       "array": [ | ||||
|         0, | ||||
|         -50, | ||||
|         -70, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
| @@ -434,7 +440,7 @@ | ||||
|     "_alignFlags": 17, | ||||
|     "_left": 95.11500000000001, | ||||
|     "_right": 0, | ||||
|     "_top": 30, | ||||
|     "_top": 50, | ||||
|     "_bottom": 0, | ||||
|     "_verticalCenter": 0, | ||||
|     "_horizontalCenter": 0, | ||||
| @@ -487,7 +493,7 @@ | ||||
|     "_contentSize": { | ||||
|       "__type__": "cc.Size", | ||||
|       "width": 58.725, | ||||
|       "height": 37.8 | ||||
|       "height": 32.76 | ||||
|     }, | ||||
|     "_anchorPoint": { | ||||
|       "__type__": "cc.Vec2", | ||||
| @@ -499,7 +505,7 @@ | ||||
|       "ctor": "Float64Array", | ||||
|       "array": [ | ||||
|         0, | ||||
|         -108.9, | ||||
|         -119.38, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
| @@ -541,7 +547,7 @@ | ||||
|     "_string": "Label", | ||||
|     "_N$string": "Label", | ||||
|     "_fontSize": 24, | ||||
|     "_lineHeight": 30, | ||||
|     "_lineHeight": 26, | ||||
|     "_enableWrapText": true, | ||||
|     "_N$file": null, | ||||
|     "_isSystemFontUsed": true, | ||||
| @@ -598,7 +604,7 @@ | ||||
|     "_contentSize": { | ||||
|       "__type__": "cc.Size", | ||||
|       "width": 58.725, | ||||
|       "height": 37.8 | ||||
|       "height": 32.76 | ||||
|     }, | ||||
|     "_anchorPoint": { | ||||
|       "__type__": "cc.Vec2", | ||||
| @@ -610,7 +616,7 @@ | ||||
|       "ctor": "Float64Array", | ||||
|       "array": [ | ||||
|         0, | ||||
|         -166.70000000000002, | ||||
|         -165.14, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
| @@ -652,7 +658,7 @@ | ||||
|     "_string": "Label", | ||||
|     "_N$string": "Label", | ||||
|     "_fontSize": 24, | ||||
|     "_lineHeight": 30, | ||||
|     "_lineHeight": 26, | ||||
|     "_enableWrapText": true, | ||||
|     "_N$file": null, | ||||
|     "_isSystemFontUsed": true, | ||||
| @@ -709,7 +715,7 @@ | ||||
|     "_contentSize": { | ||||
|       "__type__": "cc.Size", | ||||
|       "width": 58.725, | ||||
|       "height": 37.8 | ||||
|       "height": 32.76 | ||||
|     }, | ||||
|     "_anchorPoint": { | ||||
|       "__type__": "cc.Vec2", | ||||
| @@ -721,7 +727,7 @@ | ||||
|       "ctor": "Float64Array", | ||||
|       "array": [ | ||||
|         0, | ||||
|         -224.50000000000003, | ||||
|         -210.89999999999998, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
| @@ -763,7 +769,7 @@ | ||||
|     "_string": "Label", | ||||
|     "_N$string": "Label", | ||||
|     "_fontSize": 24, | ||||
|     "_lineHeight": 30, | ||||
|     "_lineHeight": 26, | ||||
|     "_enableWrapText": true, | ||||
|     "_N$file": null, | ||||
|     "_isSystemFontUsed": true, | ||||
| @@ -794,7 +800,7 @@ | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Node", | ||||
|     "_name": "tips", | ||||
|     "_name": "label4", | ||||
|     "_objFlags": 0, | ||||
|     "_parent": { | ||||
|       "__id__": 4 | ||||
| @@ -804,13 +810,10 @@ | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 19 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 20 | ||||
|       } | ||||
|     ], | ||||
|     "_prefab": { | ||||
|       "__id__": 21 | ||||
|       "__id__": 20 | ||||
|     }, | ||||
|     "_opacity": 255, | ||||
|     "_color": { | ||||
| @@ -822,8 +825,8 @@ | ||||
|     }, | ||||
|     "_contentSize": { | ||||
|       "__type__": "cc.Size", | ||||
|       "width": 375.18, | ||||
|       "height": 90 | ||||
|       "width": 58.725, | ||||
|       "height": 32.76 | ||||
|     }, | ||||
|     "_anchorPoint": { | ||||
|       "__type__": "cc.Vec2", | ||||
| @@ -835,7 +838,7 @@ | ||||
|       "ctor": "Float64Array", | ||||
|       "array": [ | ||||
|         0, | ||||
|         -308.40000000000003, | ||||
|         -256.65999999999997, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
| @@ -867,6 +870,120 @@ | ||||
|       "__id__": 18 | ||||
|     }, | ||||
|     "_enabled": true, | ||||
|     "_materials": [ | ||||
|       { | ||||
|         "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" | ||||
|       } | ||||
|     ], | ||||
|     "_srcBlendFactor": 770, | ||||
|     "_dstBlendFactor": 771, | ||||
|     "_string": "Label", | ||||
|     "_N$string": "Label", | ||||
|     "_fontSize": 24, | ||||
|     "_lineHeight": 26, | ||||
|     "_enableWrapText": true, | ||||
|     "_N$file": null, | ||||
|     "_isSystemFontUsed": true, | ||||
|     "_spacingX": 0, | ||||
|     "_batchAsBitmap": false, | ||||
|     "_styleFlags": 0, | ||||
|     "_underlineHeight": 0, | ||||
|     "_N$horizontalAlign": 1, | ||||
|     "_N$verticalAlign": 1, | ||||
|     "_N$fontFamily": "Arial", | ||||
|     "_N$overflow": 0, | ||||
|     "_N$cacheMode": 1, | ||||
|     "_N$autoSwitchMaterial": 0, | ||||
|     "_N$allowDynamicAtlas": 0, | ||||
|     "_N$enableRetina": 0, | ||||
|     "_id": "" | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.PrefabInfo", | ||||
|     "root": { | ||||
|       "__id__": 1 | ||||
|     }, | ||||
|     "asset": { | ||||
|       "__uuid__": "f48ef4d1-7483-4868-8096-115ae0431c76" | ||||
|     }, | ||||
|     "fileId": "a0j7wReqhLWIiL84nlII3F", | ||||
|     "sync": false | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Node", | ||||
|     "_name": "tips", | ||||
|     "_objFlags": 0, | ||||
|     "_parent": { | ||||
|       "__id__": 4 | ||||
|     }, | ||||
|     "_children": [], | ||||
|     "_active": true, | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 22 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 23 | ||||
|       } | ||||
|     ], | ||||
|     "_prefab": { | ||||
|       "__id__": 24 | ||||
|     }, | ||||
|     "_opacity": 255, | ||||
|     "_color": { | ||||
|       "__type__": "cc.Color", | ||||
|       "r": 255, | ||||
|       "g": 255, | ||||
|       "b": 255, | ||||
|       "a": 255 | ||||
|     }, | ||||
|     "_contentSize": { | ||||
|       "__type__": "cc.Size", | ||||
|       "width": 375.18, | ||||
|       "height": 90 | ||||
|     }, | ||||
|     "_anchorPoint": { | ||||
|       "__type__": "cc.Vec2", | ||||
|       "x": 0.5, | ||||
|       "y": 0.5 | ||||
|     }, | ||||
|     "_trs": { | ||||
|       "__type__": "TypedArray", | ||||
|       "ctor": "Float64Array", | ||||
|       "array": [ | ||||
|         0, | ||||
|         -331.03999999999996, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
|         1, | ||||
|         1, | ||||
|         1, | ||||
|         1 | ||||
|       ] | ||||
|     }, | ||||
|     "_eulerAngles": { | ||||
|       "__type__": "cc.Vec3", | ||||
|       "x": 0, | ||||
|       "y": 0, | ||||
|       "z": 0 | ||||
|     }, | ||||
|     "_skewX": 0, | ||||
|     "_skewY": 0, | ||||
|     "_is3DNode": false, | ||||
|     "_groupIndex": 0, | ||||
|     "groupIndex": 0, | ||||
|     "_id": "" | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Label", | ||||
|     "_name": "", | ||||
|     "_objFlags": 0, | ||||
|     "node": { | ||||
|       "__id__": 21 | ||||
|     }, | ||||
|     "_enabled": true, | ||||
|     "_materials": [ | ||||
|       null | ||||
|     ], | ||||
| @@ -898,7 +1015,7 @@ | ||||
|     "_name": "", | ||||
|     "_objFlags": 0, | ||||
|     "node": { | ||||
|       "__id__": 18 | ||||
|       "__id__": 21 | ||||
|     }, | ||||
|     "_enabled": true, | ||||
|     "alignMode": 1, | ||||
| @@ -906,7 +1023,7 @@ | ||||
|     "_alignFlags": 17, | ||||
|     "_left": 95.11500000000001, | ||||
|     "_right": 0, | ||||
|     "_top": 263.40000000000003, | ||||
|     "_top": 286.03999999999996, | ||||
|     "_bottom": 0, | ||||
|     "_verticalCenter": 0, | ||||
|     "_horizontalCenter": 0, | ||||
| @@ -940,115 +1057,6 @@ | ||||
|     }, | ||||
|     "_children": [], | ||||
|     "_active": true, | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 23 | ||||
|       } | ||||
|     ], | ||||
|     "_prefab": { | ||||
|       "__id__": 24 | ||||
|     }, | ||||
|     "_opacity": 255, | ||||
|     "_color": { | ||||
|       "__type__": "cc.Color", | ||||
|       "r": 255, | ||||
|       "g": 255, | ||||
|       "b": 255, | ||||
|       "a": 255 | ||||
|     }, | ||||
|     "_contentSize": { | ||||
|       "__type__": "cc.Size", | ||||
|       "width": 58.73, | ||||
|       "height": 30 | ||||
|     }, | ||||
|     "_anchorPoint": { | ||||
|       "__type__": "cc.Vec2", | ||||
|       "x": 0.5, | ||||
|       "y": 0.5 | ||||
|     }, | ||||
|     "_trs": { | ||||
|       "__type__": "TypedArray", | ||||
|       "ctor": "Float64Array", | ||||
|       "array": [ | ||||
|         0, | ||||
|         -388.40000000000003, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
|         1, | ||||
|         1, | ||||
|         1, | ||||
|         1 | ||||
|       ] | ||||
|     }, | ||||
|     "_eulerAngles": { | ||||
|       "__type__": "cc.Vec3", | ||||
|       "x": 0, | ||||
|       "y": 0, | ||||
|       "z": 0 | ||||
|     }, | ||||
|     "_skewX": 0, | ||||
|     "_skewY": 0, | ||||
|     "_is3DNode": false, | ||||
|     "_groupIndex": 0, | ||||
|     "groupIndex": 0, | ||||
|     "_id": "" | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Label", | ||||
|     "_name": "", | ||||
|     "_objFlags": 0, | ||||
|     "node": { | ||||
|       "__id__": 22 | ||||
|     }, | ||||
|     "_enabled": true, | ||||
|     "_materials": [ | ||||
|       null | ||||
|     ], | ||||
|     "_srcBlendFactor": 770, | ||||
|     "_dstBlendFactor": 771, | ||||
|     "_string": "Label", | ||||
|     "_N$string": "Label", | ||||
|     "_fontSize": 24, | ||||
|     "_lineHeight": 30, | ||||
|     "_enableWrapText": true, | ||||
|     "_N$file": null, | ||||
|     "_isSystemFontUsed": true, | ||||
|     "_spacingX": 0, | ||||
|     "_batchAsBitmap": false, | ||||
|     "_styleFlags": 0, | ||||
|     "_underlineHeight": 0, | ||||
|     "_N$horizontalAlign": 1, | ||||
|     "_N$verticalAlign": 1, | ||||
|     "_N$fontFamily": "Arial", | ||||
|     "_N$overflow": 0, | ||||
|     "_N$cacheMode": 2, | ||||
|     "_N$autoSwitchMaterial": 0, | ||||
|     "_N$allowDynamicAtlas": 0, | ||||
|     "_N$enableRetina": 0, | ||||
|     "_id": "" | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.PrefabInfo", | ||||
|     "root": { | ||||
|       "__id__": 1 | ||||
|     }, | ||||
|     "asset": { | ||||
|       "__uuid__": "f48ef4d1-7483-4868-8096-115ae0431c76" | ||||
|     }, | ||||
|     "fileId": "53ohPrY4VPPaTL8Y+GWL2b", | ||||
|     "sync": false | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Node", | ||||
|     "_name": "label2", | ||||
|     "_objFlags": 0, | ||||
|     "_parent": { | ||||
|       "__id__": 4 | ||||
|     }, | ||||
|     "_children": [], | ||||
|     "_active": true, | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 26 | ||||
| @@ -1080,7 +1088,7 @@ | ||||
|       "ctor": "Float64Array", | ||||
|       "array": [ | ||||
|         0, | ||||
|         -438.40000000000003, | ||||
|         -404.03999999999996, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
| @@ -1146,12 +1154,12 @@ | ||||
|     "asset": { | ||||
|       "__uuid__": "f48ef4d1-7483-4868-8096-115ae0431c76" | ||||
|     }, | ||||
|     "fileId": "ecP5qke91J8JmKY2vRuQZb", | ||||
|     "fileId": "53ohPrY4VPPaTL8Y+GWL2b", | ||||
|     "sync": false | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Node", | ||||
|     "_name": "label3", | ||||
|     "_name": "label2", | ||||
|     "_objFlags": 0, | ||||
|     "_parent": { | ||||
|       "__id__": 4 | ||||
| @@ -1189,7 +1197,7 @@ | ||||
|       "ctor": "Float64Array", | ||||
|       "array": [ | ||||
|         0, | ||||
|         -488.40000000000003, | ||||
|         -447.03999999999996, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
| @@ -1247,6 +1255,115 @@ | ||||
|     "_N$enableRetina": 0, | ||||
|     "_id": "" | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.PrefabInfo", | ||||
|     "root": { | ||||
|       "__id__": 1 | ||||
|     }, | ||||
|     "asset": { | ||||
|       "__uuid__": "f48ef4d1-7483-4868-8096-115ae0431c76" | ||||
|     }, | ||||
|     "fileId": "ecP5qke91J8JmKY2vRuQZb", | ||||
|     "sync": false | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Node", | ||||
|     "_name": "label3", | ||||
|     "_objFlags": 0, | ||||
|     "_parent": { | ||||
|       "__id__": 4 | ||||
|     }, | ||||
|     "_children": [], | ||||
|     "_active": true, | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 32 | ||||
|       } | ||||
|     ], | ||||
|     "_prefab": { | ||||
|       "__id__": 33 | ||||
|     }, | ||||
|     "_opacity": 255, | ||||
|     "_color": { | ||||
|       "__type__": "cc.Color", | ||||
|       "r": 255, | ||||
|       "g": 255, | ||||
|       "b": 255, | ||||
|       "a": 255 | ||||
|     }, | ||||
|     "_contentSize": { | ||||
|       "__type__": "cc.Size", | ||||
|       "width": 58.73, | ||||
|       "height": 30 | ||||
|     }, | ||||
|     "_anchorPoint": { | ||||
|       "__type__": "cc.Vec2", | ||||
|       "x": 0.5, | ||||
|       "y": 0.5 | ||||
|     }, | ||||
|     "_trs": { | ||||
|       "__type__": "TypedArray", | ||||
|       "ctor": "Float64Array", | ||||
|       "array": [ | ||||
|         0, | ||||
|         -490.03999999999996, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
|         1, | ||||
|         1, | ||||
|         1, | ||||
|         1 | ||||
|       ] | ||||
|     }, | ||||
|     "_eulerAngles": { | ||||
|       "__type__": "cc.Vec3", | ||||
|       "x": 0, | ||||
|       "y": 0, | ||||
|       "z": 0 | ||||
|     }, | ||||
|     "_skewX": 0, | ||||
|     "_skewY": 0, | ||||
|     "_is3DNode": false, | ||||
|     "_groupIndex": 0, | ||||
|     "groupIndex": 0, | ||||
|     "_id": "" | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Label", | ||||
|     "_name": "", | ||||
|     "_objFlags": 0, | ||||
|     "node": { | ||||
|       "__id__": 31 | ||||
|     }, | ||||
|     "_enabled": true, | ||||
|     "_materials": [ | ||||
|       null | ||||
|     ], | ||||
|     "_srcBlendFactor": 770, | ||||
|     "_dstBlendFactor": 771, | ||||
|     "_string": "Label", | ||||
|     "_N$string": "Label", | ||||
|     "_fontSize": 24, | ||||
|     "_lineHeight": 30, | ||||
|     "_enableWrapText": true, | ||||
|     "_N$file": null, | ||||
|     "_isSystemFontUsed": true, | ||||
|     "_spacingX": 0, | ||||
|     "_batchAsBitmap": false, | ||||
|     "_styleFlags": 0, | ||||
|     "_underlineHeight": 0, | ||||
|     "_N$horizontalAlign": 1, | ||||
|     "_N$verticalAlign": 1, | ||||
|     "_N$fontFamily": "Arial", | ||||
|     "_N$overflow": 0, | ||||
|     "_N$cacheMode": 2, | ||||
|     "_N$autoSwitchMaterial": 0, | ||||
|     "_N$allowDynamicAtlas": 0, | ||||
|     "_N$enableRetina": 0, | ||||
|     "_id": "" | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.PrefabInfo", | ||||
|     "root": { | ||||
| @@ -1258,6 +1375,115 @@ | ||||
|     "fileId": "f0KGVrovlF0qoYJg33NKVZ", | ||||
|     "sync": false | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Node", | ||||
|     "_name": "label4", | ||||
|     "_objFlags": 0, | ||||
|     "_parent": { | ||||
|       "__id__": 4 | ||||
|     }, | ||||
|     "_children": [], | ||||
|     "_active": true, | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 35 | ||||
|       } | ||||
|     ], | ||||
|     "_prefab": { | ||||
|       "__id__": 36 | ||||
|     }, | ||||
|     "_opacity": 255, | ||||
|     "_color": { | ||||
|       "__type__": "cc.Color", | ||||
|       "r": 255, | ||||
|       "g": 255, | ||||
|       "b": 255, | ||||
|       "a": 255 | ||||
|     }, | ||||
|     "_contentSize": { | ||||
|       "__type__": "cc.Size", | ||||
|       "width": 58.73, | ||||
|       "height": 30 | ||||
|     }, | ||||
|     "_anchorPoint": { | ||||
|       "__type__": "cc.Vec2", | ||||
|       "x": 0.5, | ||||
|       "y": 0.5 | ||||
|     }, | ||||
|     "_trs": { | ||||
|       "__type__": "TypedArray", | ||||
|       "ctor": "Float64Array", | ||||
|       "array": [ | ||||
|         0, | ||||
|         -533.04, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
|         0, | ||||
|         1, | ||||
|         1, | ||||
|         1, | ||||
|         1 | ||||
|       ] | ||||
|     }, | ||||
|     "_eulerAngles": { | ||||
|       "__type__": "cc.Vec3", | ||||
|       "x": 0, | ||||
|       "y": 0, | ||||
|       "z": 0 | ||||
|     }, | ||||
|     "_skewX": 0, | ||||
|     "_skewY": 0, | ||||
|     "_is3DNode": false, | ||||
|     "_groupIndex": 0, | ||||
|     "groupIndex": 0, | ||||
|     "_id": "" | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.Label", | ||||
|     "_name": "", | ||||
|     "_objFlags": 0, | ||||
|     "node": { | ||||
|       "__id__": 34 | ||||
|     }, | ||||
|     "_enabled": true, | ||||
|     "_materials": [ | ||||
|       null | ||||
|     ], | ||||
|     "_srcBlendFactor": 770, | ||||
|     "_dstBlendFactor": 771, | ||||
|     "_string": "Label", | ||||
|     "_N$string": "Label", | ||||
|     "_fontSize": 24, | ||||
|     "_lineHeight": 30, | ||||
|     "_enableWrapText": true, | ||||
|     "_N$file": null, | ||||
|     "_isSystemFontUsed": true, | ||||
|     "_spacingX": 0, | ||||
|     "_batchAsBitmap": false, | ||||
|     "_styleFlags": 0, | ||||
|     "_underlineHeight": 0, | ||||
|     "_N$horizontalAlign": 1, | ||||
|     "_N$verticalAlign": 1, | ||||
|     "_N$fontFamily": "Arial", | ||||
|     "_N$overflow": 0, | ||||
|     "_N$cacheMode": 2, | ||||
|     "_N$autoSwitchMaterial": 0, | ||||
|     "_N$allowDynamicAtlas": 0, | ||||
|     "_N$enableRetina": 0, | ||||
|     "_id": "" | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.PrefabInfo", | ||||
|     "root": { | ||||
|       "__id__": 1 | ||||
|     }, | ||||
|     "asset": { | ||||
|       "__uuid__": "f48ef4d1-7483-4868-8096-115ae0431c76" | ||||
|     }, | ||||
|     "fileId": "06LxFIAa9PdaJ2pzqvz75W", | ||||
|     "sync": false | ||||
|   }, | ||||
|   { | ||||
|     "__type__": "cc.ToggleContainer", | ||||
|     "_name": "", | ||||
| @@ -1281,7 +1507,7 @@ | ||||
|     "_layoutSize": { | ||||
|       "__type__": "cc.Size", | ||||
|       "width": 785.815, | ||||
|       "height": 503.4 | ||||
|       "height": 548.04 | ||||
|     }, | ||||
|     "_resize": 1, | ||||
|     "_N$layoutType": 2, | ||||
| @@ -1293,10 +1519,10 @@ | ||||
|     "_N$startAxis": 1, | ||||
|     "_N$paddingLeft": 0, | ||||
|     "_N$paddingRight": 0, | ||||
|     "_N$paddingTop": 30, | ||||
|     "_N$paddingTop": 50, | ||||
|     "_N$paddingBottom": 0, | ||||
|     "_N$spacingX": 0, | ||||
|     "_N$spacingY": 20, | ||||
|     "_N$spacingY": 13, | ||||
|     "_N$verticalDirection": 1, | ||||
|     "_N$horizontalDirection": 0, | ||||
|     "_N$affectedByScale": false, | ||||
| @@ -1387,23 +1613,23 @@ | ||||
|     }, | ||||
|     "_children": [ | ||||
|       { | ||||
|         "__id__": 38 | ||||
|         "__id__": 44 | ||||
|       } | ||||
|     ], | ||||
|     "_active": true, | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 41 | ||||
|         "__id__": 47 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 43 | ||||
|         "__id__": 49 | ||||
|       }, | ||||
|       { | ||||
|         "__id__": 44 | ||||
|         "__id__": 50 | ||||
|       } | ||||
|     ], | ||||
|     "_prefab": { | ||||
|       "__id__": 45 | ||||
|       "__id__": 51 | ||||
|     }, | ||||
|     "_opacity": 255, | ||||
|     "_color": { | ||||
| @@ -1457,17 +1683,17 @@ | ||||
|     "_name": "bar", | ||||
|     "_objFlags": 0, | ||||
|     "_parent": { | ||||
|       "__id__": 37 | ||||
|       "__id__": 43 | ||||
|     }, | ||||
|     "_children": [], | ||||
|     "_active": true, | ||||
|     "_components": [ | ||||
|       { | ||||
|         "__id__": 39 | ||||
|         "__id__": 45 | ||||
|       } | ||||
|     ], | ||||
|     "_prefab": { | ||||
|       "__id__": 40 | ||||
|       "__id__": 46 | ||||
|     }, | ||||
|     "_opacity": 255, | ||||
|     "_color": { | ||||
| @@ -1521,7 +1747,7 @@ | ||||
|     "_name": "", | ||||
|     "_objFlags": 0, | ||||
|     "node": { | ||||
|       "__id__": 38 | ||||
|       "__id__": 44 | ||||
|     }, | ||||
|     "_enabled": true, | ||||
|     "_materials": [ | ||||
| @@ -1566,18 +1792,18 @@ | ||||
|     "_name": "", | ||||
|     "_objFlags": 0, | ||||
|     "node": { | ||||
|       "__id__": 37 | ||||
|       "__id__": 43 | ||||
|     }, | ||||
|     "_enabled": true, | ||||
|     "_scrollView": { | ||||
|       "__id__": 42 | ||||
|       "__id__": 48 | ||||
|     }, | ||||
|     "_touching": false, | ||||
|     "_opacity": 255, | ||||
|     "enableAutoHide": false, | ||||
|     "autoHideTime": 1, | ||||
|     "_N$handle": { | ||||
|       "__id__": 39 | ||||
|       "__id__": 45 | ||||
|     }, | ||||
|     "_N$direction": 1, | ||||
|     "_id": "" | ||||
| @@ -1606,7 +1832,7 @@ | ||||
|     }, | ||||
|     "_N$horizontalScrollBar": null, | ||||
|     "_N$verticalScrollBar": { | ||||
|       "__id__": 41 | ||||
|       "__id__": 47 | ||||
|     }, | ||||
|     "_id": "" | ||||
|   }, | ||||
| @@ -1615,7 +1841,7 @@ | ||||
|     "_name": "", | ||||
|     "_objFlags": 0, | ||||
|     "node": { | ||||
|       "__id__": 37 | ||||
|       "__id__": 43 | ||||
|     }, | ||||
|     "_enabled": true, | ||||
|     "alignMode": 0, | ||||
| @@ -1642,7 +1868,7 @@ | ||||
|     "_name": "", | ||||
|     "_objFlags": 0, | ||||
|     "node": { | ||||
|       "__id__": 37 | ||||
|       "__id__": 43 | ||||
|     }, | ||||
|     "_enabled": true, | ||||
|     "_materials": [ | ||||
| @@ -1798,15 +2024,21 @@ | ||||
|     "bitmapFont3": { | ||||
|       "__id__": 16 | ||||
|     }, | ||||
|     "charFont1": { | ||||
|       "__id__": 23 | ||||
|     "bitmapFont4": { | ||||
|       "__id__": 19 | ||||
|     }, | ||||
|     "charFont2": { | ||||
|     "charFont1": { | ||||
|       "__id__": 26 | ||||
|     }, | ||||
|     "charFont3": { | ||||
|     "charFont2": { | ||||
|       "__id__": 29 | ||||
|     }, | ||||
|     "charFont3": { | ||||
|       "__id__": 32 | ||||
|     }, | ||||
|     "charFont4": { | ||||
|       "__id__": 35 | ||||
|     }, | ||||
|     "_id": "" | ||||
|   }, | ||||
|   { | ||||
|   | ||||
| @@ -14,6 +14,9 @@ export default class CharMode extends cc.Component { | ||||
|     @property(cc.Label) | ||||
|     bitmapFont3: cc.Label = null; | ||||
|  | ||||
|     @property(cc.Label) | ||||
|     bitmapFont4: cc.Label = null; | ||||
|  | ||||
|     @property(cc.Label) | ||||
|     charFont1: cc.Label = null; | ||||
|  | ||||
| @@ -23,22 +26,28 @@ export default class CharMode extends cc.Component { | ||||
|     @property(cc.Label) | ||||
|     charFont3: cc.Label = null; | ||||
|  | ||||
|     @property(cc.Label) | ||||
|     charFont4: cc.Label = null; | ||||
|  | ||||
|     protected onLoad(): void { | ||||
|         this.bitmapFont1.string = this.getRandomText(15); | ||||
|         this.bitmapFont2.string = this.getRandomText(15); | ||||
|         this.bitmapFont3.string = this.getRandomText(15); | ||||
|         this.bitmapFont4.string = this.getRandomTextEnglish(30); | ||||
|         this.charFont1.string = this.getRandomText(15); | ||||
|         this.charFont2.string = this.getRandomText(15); | ||||
|         this.charFont3.string = this.getRandomText(15); | ||||
|         this.charFont4.string = this.getRandomTextEnglish(30); | ||||
|  | ||||
|         this.schedule(() => { | ||||
|             this.bitmapFont1.string = this.getRandomText(15); | ||||
|             this.bitmapFont2.string = this.getRandomText(15); | ||||
|             this.bitmapFont3.string = this.getRandomText(15); | ||||
|             this.bitmapFont4.string = this.getRandomTextEnglish(30); | ||||
|             this.charFont1.string = this.getRandomText(15); | ||||
|             this.charFont2.string = this.getRandomText(15); | ||||
|             this.charFont3.string = this.getRandomText(15); | ||||
|             this.charFont4.string = this.getRandomTextEnglish(30); | ||||
|         }, 0.1); | ||||
|     } | ||||
|  | ||||
| @@ -51,4 +60,15 @@ export default class CharMode extends cc.Component { | ||||
|         return str; | ||||
|     } | ||||
|  | ||||
|     enChars = "abcdefghijklmnopqrstuvwxyz.,/ 1234567890!@#$%^&*()-=_+`~,./;'<>?;[]{}|"; | ||||
|  | ||||
|  | ||||
|     getRandomTextEnglish(length: number) { | ||||
|         let str = ''; | ||||
|         while (str.length < length) { | ||||
|             str += this.enChars[Math.floor(Math.random() * this.enChars.length)]; | ||||
|         } | ||||
|         return str; | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -10,10 +10,8 @@ | ||||
|     "Collider", | ||||
|     "DragonBones", | ||||
|     "EditBox", | ||||
|     "Graphics", | ||||
|     "Geom Utils", | ||||
|     "Intersection", | ||||
|     "Mask", | ||||
|     "Mesh", | ||||
|     "NodePool", | ||||
|     "Physics", | ||||
| @@ -22,7 +20,6 @@ | ||||
|     "ProgressBar", | ||||
|     "ParticleSystem", | ||||
|     "Slider", | ||||
|     "ScrollView", | ||||
|     "StudioComponent", | ||||
|     "TiledMap", | ||||
|     "VideoPlayer", | ||||
|   | ||||
| @@ -40,9 +40,9 @@ Service Pack 暂时只适配 Cocos Creator 2.x 版本,Cocos Creator 3.x 正在 | ||||
|  | ||||
| ## 功能演示 | ||||
|  | ||||
| [桌面版 Demo Web 项目](https://smallmain.github.io/cocos-service-pack/demo/web-desktop/index.html) | ||||
| [Web Desktop 演示项目](https://smallmain.github.io/cocos-service-pack/demo/web-desktop/index.html) | ||||
|  | ||||
| [手机版 Demo Web 项目](https://smallmain.github.io/cocos-service-pack/demo/web-mobile/index.html) | ||||
| [Web Mobile 演示项目](https://smallmain.github.io/cocos-service-pack/demo/web-mobile/index.html) | ||||
|  | ||||
| ## 使用方法 | ||||
|  | ||||
|   | ||||
| @@ -42,7 +42,9 @@ toc_max_heading_level: 5 | ||||
|  | ||||
| :::caution 特别注意 | ||||
|  | ||||
| Spine 组件使用多纹理材质时会强制勾选 `enableBatch` 并强制关闭 `useTint`。 | ||||
| Spine 组件使用多纹理材质时会强制勾选 `enableBatch`,因为不开启就不能合批,那也就没必要使用多纹理材质。 | ||||
|  | ||||
| 并且暂时不支持染色效果,会强制关闭 `useTint` 选项。 | ||||
|  | ||||
| ::: | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user