├── .gitignore ├── README.md ├── plugin-code ├── assets │ ├── MainScene.fire │ ├── MainScene.fire.meta │ ├── MainScene.js │ ├── MainScene.js.meta │ ├── property.meta │ └── property │ │ ├── 01-CaseVisibleProperty.fire │ │ ├── 01-CaseVisibleProperty.fire.meta │ │ ├── 02-CaseChangeProperty.fire │ │ ├── 02-CaseChangeProperty.fire.meta │ │ ├── 03-CaseCustomPropertyUI.fire │ │ ├── 03-CaseCustomPropertyUI.fire.meta │ │ ├── 04-CaseDialogShowEffect.fire │ │ ├── 04-CaseDialogShowEffect.fire.meta │ │ ├── CaseChangeProperty.js │ │ ├── CaseChangeProperty.js.meta │ │ ├── CaseCustomPropertyUI.js │ │ ├── CaseCustomPropertyUI.js.meta │ │ ├── CaseDialogShowEffect.js │ │ ├── CaseDialogShowEffect.js.meta │ │ ├── CaseVisibleProperty.js │ │ ├── CaseVisibleProperty.js.meta │ │ ├── Widget.fire │ │ ├── Widget.fire.meta │ │ ├── fun.png │ │ └── fun.png.meta ├── auto │ ├── ccwidget.html │ └── gulpfile.js ├── creator.d.ts ├── jsconfig.json ├── packages │ └── hello-world │ │ ├── inspector │ │ ├── dialog │ │ │ ├── dialog.html │ │ │ └── dialog.js │ │ └── test │ │ │ ├── test.html │ │ │ └── test.js │ │ ├── layout.json │ │ ├── main.js │ │ ├── package-lock.json │ │ ├── package.json │ │ ├── panel │ │ ├── index.css │ │ ├── index.html │ │ ├── index.js │ │ ├── page1.js │ │ ├── page2.js │ │ └── page3.js │ │ ├── plugin │ │ ├── PluginModule.js │ │ ├── PluginModule.js.meta │ │ ├── PluginScript.js │ │ └── PluginScript.js.meta │ │ └── scene-walker.js └── project.json └── 插件课程文档 ├── readme.md └── 插件网络课程.pptx /.gitignore: -------------------------------------------------------------------------------- 1 | plugin-code/.idea 2 | .DS_Store 3 | plugin-code/library 4 | plugin-code/local 5 | plugin-code/packages/hello-world/node_modules 6 | *.mov 7 | 8 | plugin-code/settings 9 | plugin-code/temp 10 | ~$插件网络课程.pptx 11 | plugin-code/out 12 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cc-plugin-train 2 | cocos creator 插件开发系列教程配置代码 3 | cocos论坛地址:https://forum.cocos.com/t/cocos-creator/69105 4 | 优酷播单地址: http://list.youku.com/albumlist/show/id_52005571.html 5 | 哔哩哔哩地址(推荐,无广告):https://space.bilibili.com/104272649/video 6 | 7 | # 入门篇 8 | ## 简单了解Creator插件 9 | - 介绍插件开发所学的技能树 10 | - 深入剖析hello-world-creator-plugin 11 | ### 视频教程 12 | 入门篇的视频教程,简单介绍了hello-creator-plugin 13 | 14 | https://www.bilibili.com/video/av38878393 15 | 16 | # 基础篇 17 | ## 掌握开发插件的一些基础技能 18 | - 学习使用ui-kit编写插件panel界面 19 | - 在插件中使用vue 20 | - 掌握调试插件的基本方法 21 | - 在插件中使用npm 22 | 23 | https://www.bilibili.com/video/av38878569 24 | 25 | # 基础篇-扩展 26 | ## 扩展自己的组件属性面板 27 | - 自定义脚本的属性面板 28 | - 揭开神秘的widget面板 29 | 30 | https://www.bilibili.com/video/av38909562/ 31 | 32 | # 进阶篇 33 | - 多面板插件 34 | - 优化面板布局 35 | - ipc消息通讯 36 | 37 | https://www.bilibili.com/video/av38878904 38 | 39 | 40 | # 高级篇 41 | ## 主要介绍Creator的一些深入知识点 42 | - runtime-resource 43 | - scene-script 44 | - gizmo 45 | - 自动化二次打包插件:丢弃无用菜单 46 | - 如何保护自己的插件:混淆插件 47 | 48 | https://www.bilibili.com/video/av38900725 49 | 50 | # 付费篇 51 | ## 老司机带你玩转Creator 52 | - 巧妙使用nodejs的net模块 53 | - 面板(页面进程)之间如何共享数据 54 | - Electron与Creator的深度学习 55 | - 深入理解主进程,子进程 56 | - 如何调试神秘的主进程 57 | - 深度挖掘Creator插件 58 | - 示例: 自定义panel置顶功能 59 | - Creator+Electron玩爆Creator编辑器 60 | - 如何解决项目中频繁发布版本的痛点 61 | - Creator插件可以达到什么高度? 62 | - 独家秘方 63 | 64 | https://www.bilibili.com/video/av38900759 65 | 66 | 67 | **课程规划不定期修正,免费课程代码保证完全公开,插件小王子有一个梦想,先保密,嘿嘿。。。** 68 | 欢迎大家留言,你的留言也许会在下期视频中重点水一水! 69 | -------------------------------------------------------------------------------- /plugin-code/assets/MainScene.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_native": "", 7 | "scene": { 8 | "__id__": 1 9 | } 10 | }, 11 | { 12 | "__type__": "cc.Scene", 13 | "_objFlags": 0, 14 | "_parent": null, 15 | "_children": [ 16 | { 17 | "__id__": 2 18 | } 19 | ], 20 | "_active": true, 21 | "_level": 0, 22 | "_components": [], 23 | "_prefab": null, 24 | "_opacity": 255, 25 | "_color": { 26 | "__type__": "cc.Color", 27 | "r": 255, 28 | "g": 255, 29 | "b": 255, 30 | "a": 255 31 | }, 32 | "_contentSize": { 33 | "__type__": "cc.Size", 34 | "width": 0, 35 | "height": 0 36 | }, 37 | "_anchorPoint": { 38 | "__type__": "cc.Vec2", 39 | "x": 0, 40 | "y": 0 41 | }, 42 | "_scale": { 43 | "__type__": "cc.Vec3", 44 | "x": 0.4647536924398035, 45 | "y": 0.4647536924398035, 46 | "z": 1 47 | }, 48 | "_quat": { 49 | "__type__": "cc.Quat", 50 | "x": 0, 51 | "y": 0, 52 | "z": 0, 53 | "w": 1 54 | }, 55 | "_zIndex": 0, 56 | "groupIndex": 0, 57 | "autoReleaseAssets": false, 58 | "_id": "4139236b-beb3-4b3c-bab5-d82470644bb2" 59 | }, 60 | { 61 | "__type__": "cc.Node", 62 | "_name": "Canvas", 63 | "_objFlags": 0, 64 | "_parent": { 65 | "__id__": 1 66 | }, 67 | "_children": [ 68 | { 69 | "__id__": 3 70 | }, 71 | { 72 | "__id__": 5 73 | } 74 | ], 75 | "_active": true, 76 | "_level": 1, 77 | "_components": [ 78 | { 79 | "__id__": 7 80 | }, 81 | { 82 | "__id__": 8 83 | } 84 | ], 85 | "_prefab": null, 86 | "_opacity": 255, 87 | "_color": { 88 | "__type__": "cc.Color", 89 | "r": 255, 90 | "g": 255, 91 | "b": 255, 92 | "a": 255 93 | }, 94 | "_contentSize": { 95 | "__type__": "cc.Size", 96 | "width": 960, 97 | "height": 640 98 | }, 99 | "_anchorPoint": { 100 | "__type__": "cc.Vec2", 101 | "x": 0.5, 102 | "y": 0.5 103 | }, 104 | "_position": { 105 | "__type__": "cc.Vec3", 106 | "x": 480, 107 | "y": 320, 108 | "z": 0 109 | }, 110 | "_scale": { 111 | "__type__": "cc.Vec3", 112 | "x": 1, 113 | "y": 1, 114 | "z": 1 115 | }, 116 | "_rotationX": 0, 117 | "_rotationY": 0, 118 | "_quat": { 119 | "__type__": "cc.Quat", 120 | "x": 0, 121 | "y": 0, 122 | "z": 0, 123 | "w": 1 124 | }, 125 | "_skewX": 0, 126 | "_skewY": 0, 127 | "_zIndex": 0, 128 | "groupIndex": 0, 129 | "_id": "4dDsCnkjxEC7THgrCnM/ax" 130 | }, 131 | { 132 | "__type__": "cc.Node", 133 | "_name": "Main Camera", 134 | "_objFlags": 0, 135 | "_parent": { 136 | "__id__": 2 137 | }, 138 | "_children": [], 139 | "_active": true, 140 | "_level": 2, 141 | "_components": [ 142 | { 143 | "__id__": 4 144 | } 145 | ], 146 | "_prefab": null, 147 | "_opacity": 255, 148 | "_color": { 149 | "__type__": "cc.Color", 150 | "r": 255, 151 | "g": 255, 152 | "b": 255, 153 | "a": 255 154 | }, 155 | "_contentSize": { 156 | "__type__": "cc.Size", 157 | "width": 0, 158 | "height": 0 159 | }, 160 | "_anchorPoint": { 161 | "__type__": "cc.Vec2", 162 | "x": 0.5, 163 | "y": 0.5 164 | }, 165 | "_position": { 166 | "__type__": "cc.Vec3", 167 | "x": 0, 168 | "y": 0, 169 | "z": 0 170 | }, 171 | "_scale": { 172 | "__type__": "cc.Vec3", 173 | "x": 1, 174 | "y": 1, 175 | "z": 1 176 | }, 177 | "_rotationX": 0, 178 | "_rotationY": 0, 179 | "_quat": { 180 | "__type__": "cc.Quat", 181 | "x": 0, 182 | "y": 0, 183 | "z": 0, 184 | "w": 1 185 | }, 186 | "_skewX": 0, 187 | "_skewY": 0, 188 | "_zIndex": 0, 189 | "groupIndex": 0, 190 | "_id": "9e6ShW/gNH2aFvbyofraos" 191 | }, 192 | { 193 | "__type__": "cc.Camera", 194 | "_name": "", 195 | "_objFlags": 0, 196 | "node": { 197 | "__id__": 3 198 | }, 199 | "_enabled": true, 200 | "_cullingMask": 4294967295, 201 | "_clearFlags": 7, 202 | "_backgroundColor": { 203 | "__type__": "cc.Color", 204 | "r": 0, 205 | "g": 0, 206 | "b": 0, 207 | "a": 255 208 | }, 209 | "_depth": -1, 210 | "_zoomRatio": 1, 211 | "_targetTexture": null, 212 | "_id": "2fs/sPz5FOHIxtk2FgEiIy" 213 | }, 214 | { 215 | "__type__": "cc.Node", 216 | "_name": "infoLabel", 217 | "_objFlags": 0, 218 | "_parent": { 219 | "__id__": 2 220 | }, 221 | "_children": [], 222 | "_active": true, 223 | "_level": 2, 224 | "_components": [ 225 | { 226 | "__id__": 6 227 | } 228 | ], 229 | "_prefab": null, 230 | "_opacity": 255, 231 | "_color": { 232 | "__type__": "cc.Color", 233 | "r": 255, 234 | "g": 255, 235 | "b": 255, 236 | "a": 255 237 | }, 238 | "_contentSize": { 239 | "__type__": "cc.Size", 240 | "width": 97.87, 241 | "height": 40 242 | }, 243 | "_anchorPoint": { 244 | "__type__": "cc.Vec2", 245 | "x": 0.5, 246 | "y": 0.5 247 | }, 248 | "_position": { 249 | "__type__": "cc.Vec3", 250 | "x": 0, 251 | "y": 0, 252 | "z": 0 253 | }, 254 | "_scale": { 255 | "__type__": "cc.Vec3", 256 | "x": 1, 257 | "y": 1, 258 | "z": 1 259 | }, 260 | "_rotationX": 0, 261 | "_rotationY": 0, 262 | "_quat": { 263 | "__type__": "cc.Quat", 264 | "x": 0, 265 | "y": 0, 266 | "z": 0, 267 | "w": 1 268 | }, 269 | "_skewX": 0, 270 | "_skewY": 0, 271 | "_zIndex": 0, 272 | "groupIndex": 0, 273 | "_id": "devKklZBFFHrmxm2VNFx4V" 274 | }, 275 | { 276 | "__type__": "cc.Label", 277 | "_name": "", 278 | "_objFlags": 0, 279 | "node": { 280 | "__id__": 5 281 | }, 282 | "_enabled": true, 283 | "_srcBlendFactor": 1, 284 | "_dstBlendFactor": 771, 285 | "_useOriginalSize": false, 286 | "_string": "Label", 287 | "_N$string": "Label", 288 | "_fontSize": 40, 289 | "_lineHeight": 40, 290 | "_enableWrapText": true, 291 | "_N$file": null, 292 | "_isSystemFontUsed": true, 293 | "_spacingX": 0, 294 | "_N$horizontalAlign": 1, 295 | "_N$verticalAlign": 1, 296 | "_N$fontFamily": "Arial", 297 | "_N$overflow": 0, 298 | "_id": "d6j5vq+URPcbxl77+CVjqI" 299 | }, 300 | { 301 | "__type__": "cc.Canvas", 302 | "_name": "", 303 | "_objFlags": 0, 304 | "node": { 305 | "__id__": 2 306 | }, 307 | "_enabled": true, 308 | "_designResolution": { 309 | "__type__": "cc.Size", 310 | "width": 960, 311 | "height": 640 312 | }, 313 | "_fitWidth": false, 314 | "_fitHeight": true, 315 | "_id": "aanmnIjYdFhaoczVEXMuRK" 316 | }, 317 | { 318 | "__type__": "0f673dH5r9I1IEa/SrHb2mV", 319 | "_name": "", 320 | "_objFlags": 0, 321 | "node": { 322 | "__id__": 2 323 | }, 324 | "_enabled": true, 325 | "infoLabel": { 326 | "__id__": 6 327 | }, 328 | "_id": "a02Gad9o9ENqZyf7Seiro8" 329 | } 330 | ] -------------------------------------------------------------------------------- /plugin-code/assets/MainScene.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "4139236b-beb3-4b3c-bab5-d82470644bb2", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /plugin-code/assets/MainScene.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | infoLabel: {default: null, displayName: "info", type: cc.Label}, 6 | 7 | }, 8 | 9 | // LIFE-CYCLE CALLBACKS: 10 | 11 | onLoad() { 12 | debugger 13 | let PluginModule = require("PluginModule"); 14 | this.infoLabel.string = PluginModule.Msg; 15 | }, 16 | 17 | start() { 18 | 19 | }, 20 | 21 | // update (dt) {}, 22 | }); 23 | -------------------------------------------------------------------------------- /plugin-code/assets/MainScene.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "0f673747-e6bf-48d4-811a-fd2ac76f6995", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /plugin-code/assets/property.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "deb1eb93-5478-4419-bfe9-e05e947b97d6", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /plugin-code/assets/property/01-CaseVisibleProperty.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_native": "", 7 | "scene": { 8 | "__id__": 1 9 | } 10 | }, 11 | { 12 | "__type__": "cc.Scene", 13 | "_objFlags": 0, 14 | "_parent": null, 15 | "_children": [ 16 | { 17 | "__id__": 2 18 | } 19 | ], 20 | "_active": true, 21 | "_level": 0, 22 | "_components": [], 23 | "_prefab": null, 24 | "_opacity": 255, 25 | "_color": { 26 | "__type__": "cc.Color", 27 | "r": 255, 28 | "g": 255, 29 | "b": 255, 30 | "a": 255 31 | }, 32 | "_contentSize": { 33 | "__type__": "cc.Size", 34 | "width": 0, 35 | "height": 0 36 | }, 37 | "_anchorPoint": { 38 | "__type__": "cc.Vec2", 39 | "x": 0, 40 | "y": 0 41 | }, 42 | "_scale": { 43 | "__type__": "cc.Vec3", 44 | "x": 0.5638074366128175, 45 | "y": 0.5638074366128175, 46 | "z": 1 47 | }, 48 | "_quat": { 49 | "__type__": "cc.Quat", 50 | "x": 0, 51 | "y": 0, 52 | "z": 0, 53 | "w": 1 54 | }, 55 | "_zIndex": 0, 56 | "groupIndex": 0, 57 | "autoReleaseAssets": false, 58 | "_id": "7e4feb83-819d-4dd5-aa1d-ecfbd6ea7f64" 59 | }, 60 | { 61 | "__type__": "cc.Node", 62 | "_name": "Canvas", 63 | "_objFlags": 0, 64 | "_parent": { 65 | "__id__": 1 66 | }, 67 | "_children": [ 68 | { 69 | "__id__": 3 70 | }, 71 | { 72 | "__id__": 5 73 | } 74 | ], 75 | "_active": true, 76 | "_level": 0, 77 | "_components": [ 78 | { 79 | "__id__": 7 80 | }, 81 | { 82 | "__id__": 8 83 | } 84 | ], 85 | "_prefab": null, 86 | "_opacity": 255, 87 | "_color": { 88 | "__type__": "cc.Color", 89 | "r": 255, 90 | "g": 255, 91 | "b": 255, 92 | "a": 255 93 | }, 94 | "_contentSize": { 95 | "__type__": "cc.Size", 96 | "width": 960, 97 | "height": 640 98 | }, 99 | "_anchorPoint": { 100 | "__type__": "cc.Vec2", 101 | "x": 0.5, 102 | "y": 0.5 103 | }, 104 | "_position": { 105 | "__type__": "cc.Vec3", 106 | "x": 480, 107 | "y": 320, 108 | "z": 0 109 | }, 110 | "_scale": { 111 | "__type__": "cc.Vec3", 112 | "x": 1, 113 | "y": 1, 114 | "z": 1 115 | }, 116 | "_rotationX": 0, 117 | "_rotationY": 0, 118 | "_quat": { 119 | "__type__": "cc.Quat", 120 | "x": 0, 121 | "y": 0, 122 | "z": 0, 123 | "w": 1 124 | }, 125 | "_skewX": 0, 126 | "_skewY": 0, 127 | "_zIndex": 0, 128 | "groupIndex": 0, 129 | "_id": "6eJKZHBuxCwJc1NMtfGB+Q" 130 | }, 131 | { 132 | "__type__": "cc.Node", 133 | "_name": "Main Camera", 134 | "_objFlags": 0, 135 | "_parent": { 136 | "__id__": 2 137 | }, 138 | "_children": [], 139 | "_active": true, 140 | "_level": 1, 141 | "_components": [ 142 | { 143 | "__id__": 4 144 | } 145 | ], 146 | "_prefab": null, 147 | "_opacity": 255, 148 | "_color": { 149 | "__type__": "cc.Color", 150 | "r": 255, 151 | "g": 255, 152 | "b": 255, 153 | "a": 255 154 | }, 155 | "_contentSize": { 156 | "__type__": "cc.Size", 157 | "width": 0, 158 | "height": 0 159 | }, 160 | "_anchorPoint": { 161 | "__type__": "cc.Vec2", 162 | "x": 0.5, 163 | "y": 0.5 164 | }, 165 | "_position": { 166 | "__type__": "cc.Vec3", 167 | "x": 0, 168 | "y": 0, 169 | "z": 0 170 | }, 171 | "_scale": { 172 | "__type__": "cc.Vec3", 173 | "x": 1, 174 | "y": 1, 175 | "z": 1 176 | }, 177 | "_rotationX": 0, 178 | "_rotationY": 0, 179 | "_quat": { 180 | "__type__": "cc.Quat", 181 | "x": 0, 182 | "y": 0, 183 | "z": 0, 184 | "w": 1 185 | }, 186 | "_skewX": 0, 187 | "_skewY": 0, 188 | "_zIndex": 0, 189 | "groupIndex": 0, 190 | "_id": "44kdLa6/RKaYFY2/Do+T3q" 191 | }, 192 | { 193 | "__type__": "cc.Camera", 194 | "_name": "", 195 | "_objFlags": 0, 196 | "node": { 197 | "__id__": 3 198 | }, 199 | "_enabled": true, 200 | "_cullingMask": 4294967295, 201 | "_clearFlags": 7, 202 | "_backgroundColor": { 203 | "__type__": "cc.Color", 204 | "r": 0, 205 | "g": 0, 206 | "b": 0, 207 | "a": 255 208 | }, 209 | "_depth": -1, 210 | "_zoomRatio": 1, 211 | "_targetTexture": null, 212 | "_id": "52X2py1PhOu5HluF2E4qNQ" 213 | }, 214 | { 215 | "__type__": "cc.Node", 216 | "_name": "New Label", 217 | "_objFlags": 0, 218 | "_parent": { 219 | "__id__": 2 220 | }, 221 | "_children": [], 222 | "_active": true, 223 | "_level": 1, 224 | "_components": [ 225 | { 226 | "__id__": 6 227 | } 228 | ], 229 | "_prefab": null, 230 | "_opacity": 255, 231 | "_color": { 232 | "__type__": "cc.Color", 233 | "r": 255, 234 | "g": 255, 235 | "b": 255, 236 | "a": 255 237 | }, 238 | "_contentSize": { 239 | "__type__": "cc.Size", 240 | "width": 240, 241 | "height": 120 242 | }, 243 | "_anchorPoint": { 244 | "__type__": "cc.Vec2", 245 | "x": 0.5, 246 | "y": 0.5 247 | }, 248 | "_position": { 249 | "__type__": "cc.Vec3", 250 | "x": 0, 251 | "y": 0, 252 | "z": 0 253 | }, 254 | "_scale": { 255 | "__type__": "cc.Vec3", 256 | "x": 1, 257 | "y": 1, 258 | "z": 1 259 | }, 260 | "_rotationX": 0, 261 | "_rotationY": 0, 262 | "_quat": { 263 | "__type__": "cc.Quat", 264 | "x": 0, 265 | "y": 0, 266 | "z": 0, 267 | "w": 1 268 | }, 269 | "_skewX": 0, 270 | "_skewY": 0, 271 | "_zIndex": 0, 272 | "groupIndex": 0, 273 | "_id": "5eLs5c+3RHPKePeCpA2urj" 274 | }, 275 | { 276 | "__type__": "cc.Label", 277 | "_name": "", 278 | "_objFlags": 0, 279 | "node": { 280 | "__id__": 5 281 | }, 282 | "_enabled": true, 283 | "_srcBlendFactor": 1, 284 | "_dstBlendFactor": 771, 285 | "_useOriginalSize": false, 286 | "_string": "控制属性面板\n属性的属性", 287 | "_N$string": "控制属性面板\n属性的属性", 288 | "_fontSize": 40, 289 | "_lineHeight": 60, 290 | "_enableWrapText": true, 291 | "_N$file": null, 292 | "_isSystemFontUsed": true, 293 | "_spacingX": 0, 294 | "_N$horizontalAlign": 0, 295 | "_N$verticalAlign": 1, 296 | "_N$fontFamily": "Arial", 297 | "_N$overflow": 0, 298 | "_id": "14XgOCLSFHuYNmD/IuCats" 299 | }, 300 | { 301 | "__type__": "cc.Canvas", 302 | "_name": "", 303 | "_objFlags": 0, 304 | "node": { 305 | "__id__": 2 306 | }, 307 | "_enabled": true, 308 | "_designResolution": { 309 | "__type__": "cc.Size", 310 | "width": 960, 311 | "height": 640 312 | }, 313 | "_fitWidth": false, 314 | "_fitHeight": true, 315 | "_id": "278RVWsDdF8q3BC26J7KpM" 316 | }, 317 | { 318 | "__type__": "c459bB2ORdK8JRWVRi4ghX9", 319 | "_name": "", 320 | "_objFlags": 0, 321 | "node": { 322 | "__id__": 2 323 | }, 324 | "_enabled": true, 325 | "property1": "10", 326 | "property2": "20", 327 | "property3": "30", 328 | "_N$propertyType": 3, 329 | "_id": "b7xD5pZFxAx4En80S5yJB1" 330 | } 331 | ] -------------------------------------------------------------------------------- /plugin-code/assets/property/01-CaseVisibleProperty.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "7e4feb83-819d-4dd5-aa1d-ecfbd6ea7f64", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /plugin-code/assets/property/02-CaseChangeProperty.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_native": "", 7 | "scene": { 8 | "__id__": 1 9 | } 10 | }, 11 | { 12 | "__type__": "cc.Scene", 13 | "_objFlags": 0, 14 | "_parent": null, 15 | "_children": [ 16 | { 17 | "__id__": 2 18 | } 19 | ], 20 | "_active": true, 21 | "_level": 0, 22 | "_components": [], 23 | "_prefab": null, 24 | "_opacity": 255, 25 | "_color": { 26 | "__type__": "cc.Color", 27 | "r": 255, 28 | "g": 255, 29 | "b": 255, 30 | "a": 255 31 | }, 32 | "_contentSize": { 33 | "__type__": "cc.Size", 34 | "width": 0, 35 | "height": 0 36 | }, 37 | "_anchorPoint": { 38 | "__type__": "cc.Vec2", 39 | "x": 0, 40 | "y": 0 41 | }, 42 | "_scale": { 43 | "__type__": "cc.Vec3", 44 | "x": 0.4374755859375, 45 | "y": 0.4374755859375, 46 | "z": 1 47 | }, 48 | "_quat": { 49 | "__type__": "cc.Quat", 50 | "x": 0, 51 | "y": 0, 52 | "z": 0, 53 | "w": 1 54 | }, 55 | "_zIndex": 0, 56 | "groupIndex": 0, 57 | "autoReleaseAssets": false, 58 | "_id": "39197792-6916-4ae6-8f41-74a3dc162edc" 59 | }, 60 | { 61 | "__type__": "cc.Node", 62 | "_name": "Canvas", 63 | "_objFlags": 0, 64 | "_parent": { 65 | "__id__": 1 66 | }, 67 | "_children": [ 68 | { 69 | "__id__": 3 70 | }, 71 | { 72 | "__id__": 5 73 | }, 74 | { 75 | "__id__": 7 76 | }, 77 | { 78 | "__id__": 9 79 | } 80 | ], 81 | "_active": true, 82 | "_level": 0, 83 | "_components": [ 84 | { 85 | "__id__": 11 86 | }, 87 | { 88 | "__id__": 12 89 | } 90 | ], 91 | "_prefab": null, 92 | "_opacity": 255, 93 | "_color": { 94 | "__type__": "cc.Color", 95 | "r": 255, 96 | "g": 255, 97 | "b": 255, 98 | "a": 255 99 | }, 100 | "_contentSize": { 101 | "__type__": "cc.Size", 102 | "width": 960, 103 | "height": 640 104 | }, 105 | "_anchorPoint": { 106 | "__type__": "cc.Vec2", 107 | "x": 0.5, 108 | "y": 0.5 109 | }, 110 | "_position": { 111 | "__type__": "cc.Vec3", 112 | "x": 480, 113 | "y": 320, 114 | "z": 0 115 | }, 116 | "_scale": { 117 | "__type__": "cc.Vec3", 118 | "x": 1, 119 | "y": 1, 120 | "z": 1 121 | }, 122 | "_rotationX": 0, 123 | "_rotationY": 0, 124 | "_quat": { 125 | "__type__": "cc.Quat", 126 | "x": 0, 127 | "y": 0, 128 | "z": 0, 129 | "w": 1 130 | }, 131 | "_skewX": 0, 132 | "_skewY": 0, 133 | "_zIndex": 0, 134 | "groupIndex": 0, 135 | "_id": "43fVobE4BGCopTA63nDRgo" 136 | }, 137 | { 138 | "__type__": "cc.Node", 139 | "_name": "Main Camera", 140 | "_objFlags": 0, 141 | "_parent": { 142 | "__id__": 2 143 | }, 144 | "_children": [], 145 | "_active": true, 146 | "_level": 1, 147 | "_components": [ 148 | { 149 | "__id__": 4 150 | } 151 | ], 152 | "_prefab": null, 153 | "_opacity": 255, 154 | "_color": { 155 | "__type__": "cc.Color", 156 | "r": 255, 157 | "g": 255, 158 | "b": 255, 159 | "a": 255 160 | }, 161 | "_contentSize": { 162 | "__type__": "cc.Size", 163 | "width": 0, 164 | "height": 0 165 | }, 166 | "_anchorPoint": { 167 | "__type__": "cc.Vec2", 168 | "x": 0.5, 169 | "y": 0.5 170 | }, 171 | "_position": { 172 | "__type__": "cc.Vec3", 173 | "x": 0, 174 | "y": 0, 175 | "z": 0 176 | }, 177 | "_scale": { 178 | "__type__": "cc.Vec3", 179 | "x": 1, 180 | "y": 1, 181 | "z": 1 182 | }, 183 | "_rotationX": 0, 184 | "_rotationY": 0, 185 | "_quat": { 186 | "__type__": "cc.Quat", 187 | "x": 0, 188 | "y": 0, 189 | "z": 0, 190 | "w": 1 191 | }, 192 | "_skewX": 0, 193 | "_skewY": 0, 194 | "_zIndex": 0, 195 | "groupIndex": 0, 196 | "_id": "a3l0hi8QZJz7m3YgkOzXIN" 197 | }, 198 | { 199 | "__type__": "cc.Camera", 200 | "_name": "", 201 | "_objFlags": 0, 202 | "node": { 203 | "__id__": 3 204 | }, 205 | "_enabled": true, 206 | "_cullingMask": 4294967295, 207 | "_clearFlags": 7, 208 | "_backgroundColor": { 209 | "__type__": "cc.Color", 210 | "r": 0, 211 | "g": 0, 212 | "b": 0, 213 | "a": 255 214 | }, 215 | "_depth": -1, 216 | "_zoomRatio": 1, 217 | "_targetTexture": null, 218 | "_id": "1aNLpyr99HsZfuZcLwEH4L" 219 | }, 220 | { 221 | "__type__": "cc.Node", 222 | "_name": "role", 223 | "_objFlags": 0, 224 | "_parent": { 225 | "__id__": 2 226 | }, 227 | "_children": [], 228 | "_active": true, 229 | "_level": 1, 230 | "_components": [ 231 | { 232 | "__id__": 6 233 | } 234 | ], 235 | "_prefab": null, 236 | "_opacity": 255, 237 | "_color": { 238 | "__type__": "cc.Color", 239 | "r": 255, 240 | "g": 255, 241 | "b": 255, 242 | "a": 255 243 | }, 244 | "_contentSize": { 245 | "__type__": "cc.Size", 246 | "width": 213, 247 | "height": 232 248 | }, 249 | "_anchorPoint": { 250 | "__type__": "cc.Vec2", 251 | "x": 0.5, 252 | "y": 0.5 253 | }, 254 | "_position": { 255 | "__type__": "cc.Vec3", 256 | "x": 0, 257 | "y": -29, 258 | "z": 0 259 | }, 260 | "_scale": { 261 | "__type__": "cc.Vec3", 262 | "x": 1, 263 | "y": 1, 264 | "z": 1 265 | }, 266 | "_rotationX": 0, 267 | "_rotationY": 0, 268 | "_quat": { 269 | "__type__": "cc.Quat", 270 | "x": 0, 271 | "y": 0, 272 | "z": 0, 273 | "w": 1 274 | }, 275 | "_skewX": 0, 276 | "_skewY": 0, 277 | "_zIndex": 0, 278 | "groupIndex": 0, 279 | "_id": "0af0dNbItIGIqxBE97zeij" 280 | }, 281 | { 282 | "__type__": "cc.Sprite", 283 | "_name": "", 284 | "_objFlags": 0, 285 | "node": { 286 | "__id__": 5 287 | }, 288 | "_enabled": true, 289 | "_srcBlendFactor": 770, 290 | "_dstBlendFactor": 771, 291 | "_spriteFrame": { 292 | "__uuid__": "dd56c4e8-edf2-4506-8db4-4b98ae8dfdff" 293 | }, 294 | "_type": 0, 295 | "_sizeMode": 1, 296 | "_fillType": 0, 297 | "_fillCenter": { 298 | "__type__": "cc.Vec2", 299 | "x": 0, 300 | "y": 0 301 | }, 302 | "_fillStart": 0, 303 | "_fillRange": 0, 304 | "_isTrimmedMode": true, 305 | "_state": 0, 306 | "_atlas": null, 307 | "_id": "ffaQLxTQ5PqJMyG5O9UtKc" 308 | }, 309 | { 310 | "__type__": "cc.Node", 311 | "_name": "name", 312 | "_objFlags": 0, 313 | "_parent": { 314 | "__id__": 2 315 | }, 316 | "_children": [], 317 | "_active": true, 318 | "_level": 1, 319 | "_components": [ 320 | { 321 | "__id__": 8 322 | } 323 | ], 324 | "_prefab": null, 325 | "_opacity": 255, 326 | "_color": { 327 | "__type__": "cc.Color", 328 | "r": 255, 329 | "g": 255, 330 | "b": 255, 331 | "a": 255 332 | }, 333 | "_contentSize": { 334 | "__type__": "cc.Size", 335 | "width": 106.68, 336 | "height": 40 337 | }, 338 | "_anchorPoint": { 339 | "__type__": "cc.Vec2", 340 | "x": 0.5, 341 | "y": 0.5 342 | }, 343 | "_position": { 344 | "__type__": "cc.Vec3", 345 | "x": 0, 346 | "y": -180, 347 | "z": 0 348 | }, 349 | "_scale": { 350 | "__type__": "cc.Vec3", 351 | "x": 1, 352 | "y": 1, 353 | "z": 1 354 | }, 355 | "_rotationX": 0, 356 | "_rotationY": 0, 357 | "_quat": { 358 | "__type__": "cc.Quat", 359 | "x": 0, 360 | "y": 0, 361 | "z": 0, 362 | "w": 1 363 | }, 364 | "_skewX": 0, 365 | "_skewY": 0, 366 | "_zIndex": 0, 367 | "groupIndex": 0, 368 | "_id": "8688IgBYpPQp/jrhNNHieQ" 369 | }, 370 | { 371 | "__type__": "cc.Label", 372 | "_name": "", 373 | "_objFlags": 0, 374 | "node": { 375 | "__id__": 7 376 | }, 377 | "_enabled": true, 378 | "_srcBlendFactor": 1, 379 | "_dstBlendFactor": 771, 380 | "_useOriginalSize": false, 381 | "_string": "我是A", 382 | "_N$string": "我是A", 383 | "_fontSize": 40, 384 | "_lineHeight": 40, 385 | "_enableWrapText": true, 386 | "_N$file": null, 387 | "_isSystemFontUsed": true, 388 | "_spacingX": 0, 389 | "_N$horizontalAlign": 1, 390 | "_N$verticalAlign": 1, 391 | "_N$fontFamily": "Arial", 392 | "_N$overflow": 0, 393 | "_id": "308H7zdD9Gw7pUfc0k226C" 394 | }, 395 | { 396 | "__type__": "cc.Node", 397 | "_name": "New Label", 398 | "_objFlags": 0, 399 | "_parent": { 400 | "__id__": 2 401 | }, 402 | "_children": [], 403 | "_active": true, 404 | "_level": 1, 405 | "_components": [ 406 | { 407 | "__id__": 10 408 | } 409 | ], 410 | "_prefab": null, 411 | "_opacity": 255, 412 | "_color": { 413 | "__type__": "cc.Color", 414 | "r": 255, 415 | "g": 255, 416 | "b": 255, 417 | "a": 255 418 | }, 419 | "_contentSize": { 420 | "__type__": "cc.Size", 421 | "width": 373.36, 422 | "height": 120 423 | }, 424 | "_anchorPoint": { 425 | "__type__": "cc.Vec2", 426 | "x": 0.5, 427 | "y": 0.5 428 | }, 429 | "_position": { 430 | "__type__": "cc.Vec3", 431 | "x": 0, 432 | "y": 213, 433 | "z": 0 434 | }, 435 | "_scale": { 436 | "__type__": "cc.Vec3", 437 | "x": 1, 438 | "y": 1, 439 | "z": 1 440 | }, 441 | "_rotationX": 0, 442 | "_rotationY": 0, 443 | "_quat": { 444 | "__type__": "cc.Quat", 445 | "x": 0, 446 | "y": 0, 447 | "z": 0, 448 | "w": 1 449 | }, 450 | "_skewX": 0, 451 | "_skewY": 0, 452 | "_zIndex": 0, 453 | "groupIndex": 0, 454 | "_id": "92ChClk+NOvYAIcc+RwjCN" 455 | }, 456 | { 457 | "__type__": "cc.Label", 458 | "_name": "", 459 | "_objFlags": 0, 460 | "node": { 461 | "__id__": 9 462 | }, 463 | "_enabled": true, 464 | "_srcBlendFactor": 1, 465 | "_dstBlendFactor": 771, 466 | "_useOriginalSize": false, 467 | "_string": "在属性面板\n通过A属性改变B属性", 468 | "_N$string": "在属性面板\n通过A属性改变B属性", 469 | "_fontSize": 40, 470 | "_lineHeight": 60, 471 | "_enableWrapText": true, 472 | "_N$file": null, 473 | "_isSystemFontUsed": true, 474 | "_spacingX": 0, 475 | "_N$horizontalAlign": 0, 476 | "_N$verticalAlign": 1, 477 | "_N$fontFamily": "Arial", 478 | "_N$overflow": 0, 479 | "_id": "3bRKHlOFtALbXG4W8Y9a9T" 480 | }, 481 | { 482 | "__type__": "cc.Canvas", 483 | "_name": "", 484 | "_objFlags": 0, 485 | "node": { 486 | "__id__": 2 487 | }, 488 | "_enabled": true, 489 | "_designResolution": { 490 | "__type__": "cc.Size", 491 | "width": 960, 492 | "height": 640 493 | }, 494 | "_fitWidth": false, 495 | "_fitHeight": true, 496 | "_id": "baeZrE9X1L47z9w4SHEfSo" 497 | }, 498 | { 499 | "__type__": "2be92hXxbdLCJpaPJHpc+tk", 500 | "_name": "", 501 | "_objFlags": 0, 502 | "node": { 503 | "__id__": 2 504 | }, 505 | "_enabled": true, 506 | "nameLabel": { 507 | "__id__": 8 508 | }, 509 | "_N$selectMenuTypeEn": 1, 510 | "_N$selectMenuTypeCn": 1, 511 | "_id": "459GnbVxpDgaDkjIpYMfy9" 512 | } 513 | ] -------------------------------------------------------------------------------- /plugin-code/assets/property/02-CaseChangeProperty.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "39197792-6916-4ae6-8f41-74a3dc162edc", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /plugin-code/assets/property/03-CaseCustomPropertyUI.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_native": "", 7 | "scene": { 8 | "__id__": 1 9 | } 10 | }, 11 | { 12 | "__type__": "cc.Scene", 13 | "_objFlags": 0, 14 | "_parent": null, 15 | "_children": [ 16 | { 17 | "__id__": 2 18 | } 19 | ], 20 | "_active": true, 21 | "_level": 0, 22 | "_components": [], 23 | "_prefab": null, 24 | "_opacity": 255, 25 | "_color": { 26 | "__type__": "cc.Color", 27 | "r": 255, 28 | "g": 255, 29 | "b": 255, 30 | "a": 255 31 | }, 32 | "_contentSize": { 33 | "__type__": "cc.Size", 34 | "width": 0, 35 | "height": 0 36 | }, 37 | "_anchorPoint": { 38 | "__type__": "cc.Vec2", 39 | "x": 0, 40 | "y": 0 41 | }, 42 | "_scale": { 43 | "__type__": "cc.Vec3", 44 | "x": 0.38509182773530487, 45 | "y": 0.38509182773530487, 46 | "z": 1 47 | }, 48 | "_quat": { 49 | "__type__": "cc.Quat", 50 | "x": 0, 51 | "y": 0, 52 | "z": 0, 53 | "w": 1 54 | }, 55 | "_zIndex": 0, 56 | "groupIndex": 0, 57 | "autoReleaseAssets": false, 58 | "_id": "3993e9ed-c380-4875-ae88-e733cdc166b3" 59 | }, 60 | { 61 | "__type__": "cc.Node", 62 | "_name": "Canvas", 63 | "_objFlags": 0, 64 | "_parent": { 65 | "__id__": 1 66 | }, 67 | "_children": [ 68 | { 69 | "__id__": 3 70 | }, 71 | { 72 | "__id__": 5 73 | }, 74 | { 75 | "__id__": 7 76 | } 77 | ], 78 | "_active": true, 79 | "_level": 0, 80 | "_components": [ 81 | { 82 | "__id__": 9 83 | }, 84 | { 85 | "__id__": 10 86 | } 87 | ], 88 | "_prefab": null, 89 | "_opacity": 255, 90 | "_color": { 91 | "__type__": "cc.Color", 92 | "r": 255, 93 | "g": 255, 94 | "b": 255, 95 | "a": 255 96 | }, 97 | "_contentSize": { 98 | "__type__": "cc.Size", 99 | "width": 960, 100 | "height": 640 101 | }, 102 | "_anchorPoint": { 103 | "__type__": "cc.Vec2", 104 | "x": 0.5, 105 | "y": 0.5 106 | }, 107 | "_position": { 108 | "__type__": "cc.Vec3", 109 | "x": 480, 110 | "y": 320, 111 | "z": 0 112 | }, 113 | "_scale": { 114 | "__type__": "cc.Vec3", 115 | "x": 1, 116 | "y": 1, 117 | "z": 1 118 | }, 119 | "_rotationX": 0, 120 | "_rotationY": 0, 121 | "_quat": { 122 | "__type__": "cc.Quat", 123 | "x": 0, 124 | "y": 0, 125 | "z": 0, 126 | "w": 1 127 | }, 128 | "_skewX": 0, 129 | "_skewY": 0, 130 | "_zIndex": 0, 131 | "groupIndex": 0, 132 | "_id": "4c0jQrJdpNO7EOVg9D98hU" 133 | }, 134 | { 135 | "__type__": "cc.Node", 136 | "_name": "Main Camera", 137 | "_objFlags": 0, 138 | "_parent": { 139 | "__id__": 2 140 | }, 141 | "_children": [], 142 | "_active": true, 143 | "_level": 1, 144 | "_components": [ 145 | { 146 | "__id__": 4 147 | } 148 | ], 149 | "_prefab": null, 150 | "_opacity": 255, 151 | "_color": { 152 | "__type__": "cc.Color", 153 | "r": 255, 154 | "g": 255, 155 | "b": 255, 156 | "a": 255 157 | }, 158 | "_contentSize": { 159 | "__type__": "cc.Size", 160 | "width": 0, 161 | "height": 0 162 | }, 163 | "_anchorPoint": { 164 | "__type__": "cc.Vec2", 165 | "x": 0.5, 166 | "y": 0.5 167 | }, 168 | "_position": { 169 | "__type__": "cc.Vec3", 170 | "x": 0, 171 | "y": 0, 172 | "z": 0 173 | }, 174 | "_scale": { 175 | "__type__": "cc.Vec3", 176 | "x": 1, 177 | "y": 1, 178 | "z": 1 179 | }, 180 | "_rotationX": 0, 181 | "_rotationY": 0, 182 | "_quat": { 183 | "__type__": "cc.Quat", 184 | "x": 0, 185 | "y": 0, 186 | "z": 0, 187 | "w": 1 188 | }, 189 | "_skewX": 0, 190 | "_skewY": 0, 191 | "_zIndex": 0, 192 | "groupIndex": 0, 193 | "_id": "35frJuNBFKf4Gn7kgAhjIz" 194 | }, 195 | { 196 | "__type__": "cc.Camera", 197 | "_name": "", 198 | "_objFlags": 0, 199 | "node": { 200 | "__id__": 3 201 | }, 202 | "_enabled": true, 203 | "_cullingMask": 4294967295, 204 | "_clearFlags": 7, 205 | "_backgroundColor": { 206 | "__type__": "cc.Color", 207 | "r": 0, 208 | "g": 0, 209 | "b": 0, 210 | "a": 255 211 | }, 212 | "_depth": -1, 213 | "_zoomRatio": 1, 214 | "_targetTexture": null, 215 | "_id": "a7Eftg9X9JCJIuDPq9bdAG" 216 | }, 217 | { 218 | "__type__": "cc.Node", 219 | "_name": "New Label", 220 | "_objFlags": 0, 221 | "_parent": { 222 | "__id__": 2 223 | }, 224 | "_children": [], 225 | "_active": true, 226 | "_level": 1, 227 | "_components": [ 228 | { 229 | "__id__": 6 230 | } 231 | ], 232 | "_prefab": null, 233 | "_opacity": 255, 234 | "_color": { 235 | "__type__": "cc.Color", 236 | "r": 255, 237 | "g": 255, 238 | "b": 255, 239 | "a": 255 240 | }, 241 | "_contentSize": { 242 | "__type__": "cc.Size", 243 | "width": 280, 244 | "height": 40 245 | }, 246 | "_anchorPoint": { 247 | "__type__": "cc.Vec2", 248 | "x": 0.5, 249 | "y": 0.5 250 | }, 251 | "_position": { 252 | "__type__": "cc.Vec3", 253 | "x": 0, 254 | "y": 0, 255 | "z": 0 256 | }, 257 | "_scale": { 258 | "__type__": "cc.Vec3", 259 | "x": 1, 260 | "y": 1, 261 | "z": 1 262 | }, 263 | "_rotationX": 0, 264 | "_rotationY": 0, 265 | "_quat": { 266 | "__type__": "cc.Quat", 267 | "x": 0, 268 | "y": 0, 269 | "z": 0, 270 | "w": 1 271 | }, 272 | "_skewX": 0, 273 | "_skewY": 0, 274 | "_zIndex": 0, 275 | "groupIndex": 0, 276 | "_id": "d3gUAB38hOWbWXhbQyxmTc" 277 | }, 278 | { 279 | "__type__": "cc.Label", 280 | "_name": "", 281 | "_objFlags": 0, 282 | "node": { 283 | "__id__": 5 284 | }, 285 | "_enabled": true, 286 | "_srcBlendFactor": 1, 287 | "_dstBlendFactor": 771, 288 | "_useOriginalSize": false, 289 | "_string": "自定义属性面板", 290 | "_N$string": "自定义属性面板", 291 | "_fontSize": 40, 292 | "_lineHeight": 40, 293 | "_enableWrapText": true, 294 | "_N$file": null, 295 | "_isSystemFontUsed": true, 296 | "_spacingX": 0, 297 | "_N$horizontalAlign": 0, 298 | "_N$verticalAlign": 1, 299 | "_N$fontFamily": "Arial", 300 | "_N$overflow": 0, 301 | "_id": "51ggkfDMREorVrJnqqlKkX" 302 | }, 303 | { 304 | "__type__": "cc.Node", 305 | "_name": "label", 306 | "_objFlags": 0, 307 | "_parent": { 308 | "__id__": 2 309 | }, 310 | "_children": [], 311 | "_active": true, 312 | "_level": 1, 313 | "_components": [ 314 | { 315 | "__id__": 8 316 | } 317 | ], 318 | "_prefab": null, 319 | "_opacity": 255, 320 | "_color": { 321 | "__type__": "cc.Color", 322 | "r": 255, 323 | "g": 255, 324 | "b": 255, 325 | "a": 255 326 | }, 327 | "_contentSize": { 328 | "__type__": "cc.Size", 329 | "width": 22.25, 330 | "height": 40 331 | }, 332 | "_anchorPoint": { 333 | "__type__": "cc.Vec2", 334 | "x": 0.5, 335 | "y": 0.5 336 | }, 337 | "_position": { 338 | "__type__": "cc.Vec3", 339 | "x": 0, 340 | "y": -135, 341 | "z": 0 342 | }, 343 | "_scale": { 344 | "__type__": "cc.Vec3", 345 | "x": 1, 346 | "y": 1, 347 | "z": 1 348 | }, 349 | "_rotationX": 0, 350 | "_rotationY": 0, 351 | "_quat": { 352 | "__type__": "cc.Quat", 353 | "x": 0, 354 | "y": 0, 355 | "z": 0, 356 | "w": 1 357 | }, 358 | "_skewX": 0, 359 | "_skewY": 0, 360 | "_zIndex": 0, 361 | "groupIndex": 0, 362 | "_id": "12uu/Ux4RDyYHMw29c7phb" 363 | }, 364 | { 365 | "__type__": "cc.Label", 366 | "_name": "", 367 | "_objFlags": 0, 368 | "node": { 369 | "__id__": 7 370 | }, 371 | "_enabled": true, 372 | "_srcBlendFactor": 1, 373 | "_dstBlendFactor": 771, 374 | "_useOriginalSize": false, 375 | "_string": "1", 376 | "_N$string": "1", 377 | "_fontSize": 40, 378 | "_lineHeight": 40, 379 | "_enableWrapText": true, 380 | "_N$file": null, 381 | "_isSystemFontUsed": true, 382 | "_spacingX": 0, 383 | "_N$horizontalAlign": 1, 384 | "_N$verticalAlign": 1, 385 | "_N$fontFamily": "Arial", 386 | "_N$overflow": 0, 387 | "_id": "78SKkOY7tJypASGYhifYWc" 388 | }, 389 | { 390 | "__type__": "cc.Canvas", 391 | "_name": "", 392 | "_objFlags": 0, 393 | "node": { 394 | "__id__": 2 395 | }, 396 | "_enabled": true, 397 | "_designResolution": { 398 | "__type__": "cc.Size", 399 | "width": 960, 400 | "height": 640 401 | }, 402 | "_fitWidth": false, 403 | "_fitHeight": true, 404 | "_id": "e25tJDKShEuZ0lpv3Ep7ey" 405 | }, 406 | { 407 | "__type__": "eb343Mhj6RIEKBOypW4vH8C", 408 | "_name": "", 409 | "_objFlags": 0, 410 | "node": { 411 | "__id__": 2 412 | }, 413 | "_enabled": true, 414 | "bar": "Bar", 415 | "_N$foo": "fwf", 416 | "_id": "69RC2xnU5IOJE9pSolisnm" 417 | } 418 | ] -------------------------------------------------------------------------------- /plugin-code/assets/property/03-CaseCustomPropertyUI.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "3993e9ed-c380-4875-ae88-e733cdc166b3", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /plugin-code/assets/property/04-CaseDialogShowEffect.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_native": "", 7 | "scene": { 8 | "__id__": 1 9 | } 10 | }, 11 | { 12 | "__type__": "cc.Scene", 13 | "_objFlags": 0, 14 | "_parent": null, 15 | "_children": [ 16 | { 17 | "__id__": 2 18 | } 19 | ], 20 | "_active": true, 21 | "_level": 0, 22 | "_components": [], 23 | "_prefab": null, 24 | "_opacity": 255, 25 | "_color": { 26 | "__type__": "cc.Color", 27 | "r": 255, 28 | "g": 255, 29 | "b": 255, 30 | "a": 255 31 | }, 32 | "_contentSize": { 33 | "__type__": "cc.Size", 34 | "width": 0, 35 | "height": 0 36 | }, 37 | "_anchorPoint": { 38 | "__type__": "cc.Vec2", 39 | "x": 0, 40 | "y": 0 41 | }, 42 | "_scale": { 43 | "__type__": "cc.Vec3", 44 | "x": 0.46177898111217586, 45 | "y": 0.46177898111217586, 46 | "z": 1 47 | }, 48 | "_quat": { 49 | "__type__": "cc.Quat", 50 | "x": 0, 51 | "y": 0, 52 | "z": 0, 53 | "w": 1 54 | }, 55 | "_zIndex": 0, 56 | "groupIndex": 0, 57 | "autoReleaseAssets": false, 58 | "_id": "25fbede8-5850-4a66-91ce-e22dee6d8ae5" 59 | }, 60 | { 61 | "__type__": "cc.Node", 62 | "_name": "Canvas", 63 | "_objFlags": 0, 64 | "_parent": { 65 | "__id__": 1 66 | }, 67 | "_children": [ 68 | { 69 | "__id__": 3 70 | }, 71 | { 72 | "__id__": 5 73 | }, 74 | { 75 | "__id__": 8 76 | } 77 | ], 78 | "_active": true, 79 | "_level": 0, 80 | "_components": [ 81 | { 82 | "__id__": 11 83 | } 84 | ], 85 | "_prefab": null, 86 | "_opacity": 255, 87 | "_color": { 88 | "__type__": "cc.Color", 89 | "r": 255, 90 | "g": 255, 91 | "b": 255, 92 | "a": 255 93 | }, 94 | "_contentSize": { 95 | "__type__": "cc.Size", 96 | "width": 960, 97 | "height": 640 98 | }, 99 | "_anchorPoint": { 100 | "__type__": "cc.Vec2", 101 | "x": 0.5, 102 | "y": 0.5 103 | }, 104 | "_position": { 105 | "__type__": "cc.Vec3", 106 | "x": 480, 107 | "y": 320, 108 | "z": 0 109 | }, 110 | "_scale": { 111 | "__type__": "cc.Vec3", 112 | "x": 1, 113 | "y": 1, 114 | "z": 1 115 | }, 116 | "_rotationX": 0, 117 | "_rotationY": 0, 118 | "_quat": { 119 | "__type__": "cc.Quat", 120 | "x": 0, 121 | "y": 0, 122 | "z": 0, 123 | "w": 1 124 | }, 125 | "_skewX": 0, 126 | "_skewY": 0, 127 | "_zIndex": 0, 128 | "groupIndex": 0, 129 | "_id": "01UVjuv5dOzq8+JXMnDJ4h" 130 | }, 131 | { 132 | "__type__": "cc.Node", 133 | "_name": "Main Camera", 134 | "_objFlags": 0, 135 | "_parent": { 136 | "__id__": 2 137 | }, 138 | "_children": [], 139 | "_active": true, 140 | "_level": 1, 141 | "_components": [ 142 | { 143 | "__id__": 4 144 | } 145 | ], 146 | "_prefab": null, 147 | "_opacity": 255, 148 | "_color": { 149 | "__type__": "cc.Color", 150 | "r": 255, 151 | "g": 255, 152 | "b": 255, 153 | "a": 255 154 | }, 155 | "_contentSize": { 156 | "__type__": "cc.Size", 157 | "width": 0, 158 | "height": 0 159 | }, 160 | "_anchorPoint": { 161 | "__type__": "cc.Vec2", 162 | "x": 0.5, 163 | "y": 0.5 164 | }, 165 | "_position": { 166 | "__type__": "cc.Vec3", 167 | "x": 0, 168 | "y": 0, 169 | "z": 0 170 | }, 171 | "_scale": { 172 | "__type__": "cc.Vec3", 173 | "x": 1, 174 | "y": 1, 175 | "z": 1 176 | }, 177 | "_rotationX": 0, 178 | "_rotationY": 0, 179 | "_quat": { 180 | "__type__": "cc.Quat", 181 | "x": 0, 182 | "y": 0, 183 | "z": 0, 184 | "w": 1 185 | }, 186 | "_skewX": 0, 187 | "_skewY": 0, 188 | "_zIndex": 0, 189 | "groupIndex": 0, 190 | "_id": "35YH70ettBAp9hkbdWtzun" 191 | }, 192 | { 193 | "__type__": "cc.Camera", 194 | "_name": "", 195 | "_objFlags": 0, 196 | "node": { 197 | "__id__": 3 198 | }, 199 | "_enabled": true, 200 | "_cullingMask": 4294967295, 201 | "_clearFlags": 7, 202 | "_backgroundColor": { 203 | "__type__": "cc.Color", 204 | "r": 0, 205 | "g": 0, 206 | "b": 0, 207 | "a": 255 208 | }, 209 | "_depth": -1, 210 | "_zoomRatio": 1, 211 | "_targetTexture": null, 212 | "_id": "2c6JARISNCdL5M7aLDfncv" 213 | }, 214 | { 215 | "__type__": "cc.Node", 216 | "_name": "说明", 217 | "_objFlags": 0, 218 | "_parent": { 219 | "__id__": 2 220 | }, 221 | "_children": [], 222 | "_active": true, 223 | "_level": 1, 224 | "_components": [ 225 | { 226 | "__id__": 6 227 | }, 228 | { 229 | "__id__": 7 230 | } 231 | ], 232 | "_prefab": null, 233 | "_opacity": 255, 234 | "_color": { 235 | "__type__": "cc.Color", 236 | "r": 255, 237 | "g": 255, 238 | "b": 255, 239 | "a": 255 240 | }, 241 | "_contentSize": { 242 | "__type__": "cc.Size", 243 | "width": 303.35, 244 | "height": 160 245 | }, 246 | "_anchorPoint": { 247 | "__type__": "cc.Vec2", 248 | "x": 0.5, 249 | "y": 0.5 250 | }, 251 | "_position": { 252 | "__type__": "cc.Vec3", 253 | "x": -318.325, 254 | "y": 230, 255 | "z": 0 256 | }, 257 | "_scale": { 258 | "__type__": "cc.Vec3", 259 | "x": 1, 260 | "y": 1, 261 | "z": 1 262 | }, 263 | "_rotationX": 0, 264 | "_rotationY": 0, 265 | "_quat": { 266 | "__type__": "cc.Quat", 267 | "x": 0, 268 | "y": 0, 269 | "z": 0, 270 | "w": 1 271 | }, 272 | "_skewX": 0, 273 | "_skewY": 0, 274 | "_zIndex": 0, 275 | "groupIndex": 0, 276 | "_id": "e1ypltepVO0anmqVYydruZ" 277 | }, 278 | { 279 | "__type__": "cc.Label", 280 | "_name": "", 281 | "_objFlags": 0, 282 | "node": { 283 | "__id__": 5 284 | }, 285 | "_enabled": true, 286 | "_srcBlendFactor": 1, 287 | "_dstBlendFactor": 771, 288 | "_useOriginalSize": false, 289 | "_string": "综合案例:\n1. 自定义属性面板\n2. 属性自定义显示\n3. 场景编辑器实时预览", 290 | "_N$string": "综合案例:\n1. 自定义属性面板\n2. 属性自定义显示\n3. 场景编辑器实时预览", 291 | "_fontSize": 30, 292 | "_lineHeight": 40, 293 | "_enableWrapText": true, 294 | "_N$file": null, 295 | "_isSystemFontUsed": true, 296 | "_spacingX": 0, 297 | "_N$horizontalAlign": 0, 298 | "_N$verticalAlign": 1, 299 | "_N$fontFamily": "Arial", 300 | "_N$overflow": 0, 301 | "_id": "52Y824a4lCcZYeJLnWtbyb" 302 | }, 303 | { 304 | "__type__": "cc.Widget", 305 | "_name": "", 306 | "_objFlags": 0, 307 | "node": { 308 | "__id__": 5 309 | }, 310 | "_enabled": true, 311 | "alignMode": 1, 312 | "_target": null, 313 | "_alignFlags": 9, 314 | "_left": 10, 315 | "_right": 0, 316 | "_top": 10, 317 | "_bottom": 10, 318 | "_verticalCenter": 0, 319 | "_horizontalCenter": 0, 320 | "_isAbsLeft": true, 321 | "_isAbsRight": true, 322 | "_isAbsTop": true, 323 | "_isAbsBottom": true, 324 | "_isAbsHorizontalCenter": true, 325 | "_isAbsVerticalCenter": true, 326 | "_originalWidth": 0, 327 | "_originalHeight": 160, 328 | "_id": "c3xVSKbAFPYJJmRmpbXagF" 329 | }, 330 | { 331 | "__type__": "cc.Node", 332 | "_name": "fram", 333 | "_objFlags": 0, 334 | "_parent": { 335 | "__id__": 2 336 | }, 337 | "_children": [], 338 | "_active": true, 339 | "_level": 1, 340 | "_components": [ 341 | { 342 | "__id__": 9 343 | }, 344 | { 345 | "__id__": 10 346 | } 347 | ], 348 | "_prefab": null, 349 | "_opacity": 255, 350 | "_color": { 351 | "__type__": "cc.Color", 352 | "r": 255, 353 | "g": 255, 354 | "b": 255, 355 | "a": 255 356 | }, 357 | "_contentSize": { 358 | "__type__": "cc.Size", 359 | "width": 213, 360 | "height": 232 361 | }, 362 | "_anchorPoint": { 363 | "__type__": "cc.Vec2", 364 | "x": 0.5, 365 | "y": 0.5 366 | }, 367 | "_position": { 368 | "__type__": "cc.Vec3", 369 | "x": 0, 370 | "y": 0, 371 | "z": 0 372 | }, 373 | "_scale": { 374 | "__type__": "cc.Vec3", 375 | "x": 1, 376 | "y": 1, 377 | "z": 1 378 | }, 379 | "_rotationX": 0, 380 | "_rotationY": 0, 381 | "_quat": { 382 | "__type__": "cc.Quat", 383 | "x": 0, 384 | "y": 0, 385 | "z": 0, 386 | "w": 1 387 | }, 388 | "_skewX": 0, 389 | "_skewY": 0, 390 | "_zIndex": 0, 391 | "groupIndex": 0, 392 | "_id": "84MZJf3U1ER5YX8TaNs9In" 393 | }, 394 | { 395 | "__type__": "cc.Sprite", 396 | "_name": "", 397 | "_objFlags": 0, 398 | "node": { 399 | "__id__": 8 400 | }, 401 | "_enabled": true, 402 | "_srcBlendFactor": 1, 403 | "_dstBlendFactor": 771, 404 | "_spriteFrame": { 405 | "__uuid__": "dd56c4e8-edf2-4506-8db4-4b98ae8dfdff" 406 | }, 407 | "_type": 0, 408 | "_sizeMode": 1, 409 | "_fillType": 0, 410 | "_fillCenter": { 411 | "__type__": "cc.Vec2", 412 | "x": 0, 413 | "y": 0 414 | }, 415 | "_fillStart": 0, 416 | "_fillRange": 0, 417 | "_isTrimmedMode": false, 418 | "_state": 0, 419 | "_atlas": null, 420 | "_id": "a5++bfeItDqqbcAx26wvfq" 421 | }, 422 | { 423 | "__type__": "692977jwSxEsLJ9qzOsQGBa", 424 | "_name": "", 425 | "_objFlags": 0, 426 | "node": { 427 | "__id__": 8 428 | }, 429 | "_enabled": true, 430 | "actionType": "Scale", 431 | "actionNode": { 432 | "__id__": 8 433 | }, 434 | "delayTime": 0, 435 | "actionTime": 1, 436 | "shakeStrength": "5", 437 | "blinkCount": 5, 438 | "scaleSize": 3, 439 | "moveBeganPosX": 0, 440 | "moveBeganPosY": 0, 441 | "moveEndPosX": 300, 442 | "moveEndPosY": 0, 443 | "_recordData": { 444 | "x": 0, 445 | "y": 0, 446 | "opacity": 255, 447 | "active": true, 448 | "scaleX": 1, 449 | "scaleY": 1, 450 | "rotation": 0, 451 | "width": 213, 452 | "height": 232 453 | }, 454 | "_N$preview": 1545632083265, 455 | "_id": "23bWn+CGtMPYQvdnAOIqxe" 456 | }, 457 | { 458 | "__type__": "cc.Canvas", 459 | "_name": "", 460 | "_objFlags": 0, 461 | "node": { 462 | "__id__": 2 463 | }, 464 | "_enabled": true, 465 | "_designResolution": { 466 | "__type__": "cc.Size", 467 | "width": 960, 468 | "height": 640 469 | }, 470 | "_fitWidth": false, 471 | "_fitHeight": true, 472 | "_id": "51rlIiBVRFjrs3S/LEo5K4" 473 | } 474 | ] -------------------------------------------------------------------------------- /plugin-code/assets/property/04-CaseDialogShowEffect.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "25fbede8-5850-4a66-91ce-e22dee6d8ae5", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /plugin-code/assets/property/CaseChangeProperty.js: -------------------------------------------------------------------------------- 1 | let SelectMenuEn = cc.Enum({ 2 | None: 0, 3 | MenuA: 1, 4 | MenuB: 2, 5 | MenuC: 3, 6 | MenuD: 4, 7 | }); 8 | 9 | let SelectMenuCn = cc.Enum({ 10 | 无: 0, 11 | 选项A: 1, 12 | 选项B: 2, 13 | 选项C: 3, 14 | 选项D: 4, 15 | }); 16 | 17 | cc.Class({ 18 | extends: cc.Component, 19 | 20 | properties: { 21 | 22 | selectMenuTypeEn: { 23 | default: SelectMenuEn.None, displayName: "选项-en", type: SelectMenuEn, notify() { 24 | // this.selectMenuTypeCn = this.selectMenuTypeEn; 25 | // 死循环 26 | this._updateName1(); 27 | } 28 | }, 29 | selectMenuTypeCn: { 30 | default: SelectMenuCn.无, displayName: "选项-cn", type: SelectMenuCn, notify() { 31 | this._updateName2(); 32 | } 33 | }, 34 | 35 | nameLabel: {default: null, displayName: "名字", type: cc.Label, visible: false}, 36 | 37 | }, 38 | _updateName1() { 39 | if (this.selectMenuTypeEn === SelectMenuEn.None) { 40 | this.nameLabel.string = ""; 41 | } else if (this.selectMenuTypeEn === SelectMenuEn.MenuA) { 42 | this.nameLabel.string = "我是A"; 43 | } else if (this.selectMenuTypeEn === SelectMenuEn.MenuB) { 44 | this.nameLabel.string = "我是B"; 45 | } else if (this.selectMenuTypeEn === SelectMenuEn.MenuC) { 46 | this.nameLabel.string = "我是C"; 47 | } else if (this.selectMenuTypeEn === SelectMenuEn.MenuD) { 48 | this.nameLabel.string = "我是D"; 49 | } 50 | }, 51 | _updateName2() { 52 | if (this.selectMenuTypeCn === SelectMenuCn.无) { 53 | this.nameLabel.string = ""; 54 | } else if (this.selectMenuTypeCn === SelectMenuCn.选项A) { 55 | this.nameLabel.string = "我是A"; 56 | } else if (this.selectMenuTypeCn === SelectMenuCn.选项B) { 57 | this.nameLabel.string = "我是B"; 58 | } else if (this.selectMenuTypeCn === SelectMenuCn.选项C) { 59 | this.nameLabel.string = "我是C"; 60 | } else if (this.selectMenuTypeCn === SelectMenuCn.选项D) { 61 | this.nameLabel.string = "我是D"; 62 | } 63 | }, 64 | }); 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /plugin-code/assets/property/CaseChangeProperty.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "2be92857-c5b7-4b08-9a5a-3c91e973eb64", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /plugin-code/assets/property/CaseCustomPropertyUI.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | // name:"MyTestUI", 3 | extends: cc.Component, 4 | editor: CC_EDITOR && { 5 | inspector: "packages://hello-world/inspector/test/test.js", 6 | }, 7 | properties: { 8 | foo: { 9 | default: "foo", 10 | type: cc.String, 11 | notify() { 12 | debugger 13 | console.log("change"); 14 | this._nodeTest(); 15 | if (this._sgNode) { 16 | console.log("sgNode"); 17 | } 18 | }, 19 | }, 20 | bar: 'Bar', 21 | }, 22 | _nodeTest() { 23 | let label = cc.find("Canvas/label"); 24 | if (label) { 25 | let com = label.getComponent(cc.Label); 26 | if (com) { 27 | com.string = "hello - " + this.foo; 28 | } 29 | } 30 | } 31 | }); 32 | -------------------------------------------------------------------------------- /plugin-code/assets/property/CaseCustomPropertyUI.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "eb343321-8fa4-4810-a04e-ca95b8bc7f02", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /plugin-code/assets/property/CaseDialogShowEffect.js: -------------------------------------------------------------------------------- 1 | let ActionEnum = cc.Enum({ 2 | None: "None", 3 | Scale: "Scale", 4 | Blink: "Blink", 5 | Shake: "Shake", 6 | FadeIn: "FadeIn", 7 | FadeOut: "FadeOut", 8 | Move: "Move", 9 | }); 10 | cc.Class({ 11 | extends: cc.Component, 12 | editor: CC_EDITOR && { 13 | inspector: "packages://hello-world/inspector/dialog/dialog.js", 14 | playOnFocus: true, 15 | executeInEditMode: true, // 允许当前组件在编辑器模式下运行。 16 | }, 17 | properties: { 18 | actionType: {default: ActionEnum.None, displayName: "动画类型", type: ActionEnum}, 19 | actionNode: {default: null, displayName: "动画节点", type: cc.Node}, 20 | preview: { 21 | default: 0, visible: true, notify() { 22 | this._record(); 23 | this._runAction(); 24 | } 25 | }, 26 | 27 | delayTime: {default: 0, displayName: "延迟时间", tooltip: "单位:秒"},// 延迟时间 28 | actionTime: {default: 0, displayName: "动画时间", tooltip: "单位:秒"},// 动画时间 29 | 30 | shakeStrength: {default: 0, displayName: "震动强度", tooltip: "强度越高,振幅越大"},// 震动强度 31 | 32 | blinkCount: {default: 1, displayName: "闪烁次数", tooltip: ""},// 闪烁次数 33 | 34 | scaleSize: {default: 1, displayName: "缩放比例", tooltip: ""},// 缩放比例 35 | 36 | 37 | moveBeganPosX: {default: 0, displayName: "X", tooltip: ""},// 移动开始坐标X 38 | moveBeganPosY: {default: 0, displayName: "Y", tooltip: ""},// 移动开始坐标Y 39 | moveEndPosX: {default: 0, displayName: "X", tooltip: ""},//移动结束X 40 | moveEndPosY: {default: 0, displayName: "Y", tooltip: ""},//移动结束Y 41 | 42 | _recordData: null,// 记录数据,用于还原 43 | }, 44 | 45 | onFocusInEditor: CC_EDITOR && function () { 46 | // console.log("onFocusInEditor"); 47 | }, 48 | onLostFocusInEditor: CC_EDITOR && function () { 49 | console.log("onLostFocusInEditor"); 50 | this._recover(); 51 | this._recordData = null; 52 | }, 53 | // 记录 54 | _record: CC_EDITOR && function () { 55 | this._recordData = { 56 | x: this.node.x, 57 | y: this.node.y, 58 | opacity: this.node.opacity, 59 | active: this.node.active, 60 | scaleX: this.node.scaleX, 61 | scaleY: this.node.scaleY, 62 | rotation: this.node.rotation, 63 | width: this.node.width, 64 | height: this.node.height, 65 | }; 66 | }, 67 | // 恢复 68 | _recover: CC_EDITOR && function () { 69 | this.node.stopAllActions(); 70 | if (this._recordData) { 71 | this.node.x = this._recordData.x; 72 | this.node.y = this._recordData.y; 73 | this.node.opacity = this._recordData.opacity; 74 | this.node.active = this._recordData.active; 75 | this.node.scaleX = this._recordData.scaleX; 76 | this.node.scaleY = this._recordData.scaleY; 77 | this.node.rotation = this._recordData.rotation; 78 | this.node.width = this._recordData.width; 79 | this.node.height = this._recordData.height; 80 | } 81 | }, 82 | onLoad() { 83 | 84 | 85 | }, 86 | 87 | start() { 88 | if (!CC_EDITOR) { 89 | this._runAction(); 90 | } 91 | }, 92 | _runAction() { 93 | if (this.actionType === ActionEnum.None) { 94 | if (CC_EDITOR) { 95 | Editor.log("未设置动画,预览无效!"); 96 | } 97 | this._actionOver(); 98 | } else { 99 | if (this.actionTime > 0) { 100 | let act = this._genAction(this.actionType); 101 | if (act) { 102 | let actionArr = []; 103 | // 延迟动作 104 | if (this.delayTime > 0) { 105 | actionArr.push(cc.delayTime(this.delayTime)); 106 | } 107 | // 当前设置的动作 108 | actionArr.push(act); 109 | actionArr.push(cc.callFunc(this._actionOver.bind(this))); 110 | let runAct = cc.sequence(actionArr); 111 | this.node.stopAllActions(); 112 | this.node.runAction(runAct); 113 | } 114 | } else { 115 | console.log("指定的动画时间为0,跳过该动画!"); 116 | } 117 | } 118 | 119 | }, 120 | _actionOver() { 121 | console.log("action over"); 122 | if (CC_EDITOR) { 123 | this._recover && this._recover(); 124 | } 125 | }, 126 | _genAction(type) { 127 | let ret = null; 128 | if (type === ActionEnum.FadeOut) { 129 | this.node.opacity = 255; 130 | ret = cc.fadeOut(this.actionTime); 131 | } else if (type === ActionEnum.FadeIn) { 132 | this.node.opacity = 0; 133 | ret = cc.fadeIn(this.actionTime); 134 | } else if (type === ActionEnum.Shake) {// 震动 135 | let acts = []; 136 | let cfg = [ 137 | {strength: 1, max: 10}, 138 | {strength: 2, max: 12}, 139 | {strength: 3, max: 15}, 140 | {strength: 4, max: 20}, 141 | {strength: 5, max: 25}, 142 | ]; 143 | 144 | let shakeMaxMoveDistance = 0;// 震动幅度距离 145 | for (let i = 0; i < cfg.length; i++) { 146 | let item = cfg[i]; 147 | if (item.strength.toString() === this.shakeStrength.toString()) { 148 | shakeMaxMoveDistance = item.max; 149 | break; 150 | } 151 | } 152 | let shakeCount = 0;// 震动次数 153 | let moveUnitTime = 0.05;// 单元震动时间 154 | shakeCount = Math.floor(this.actionTime / moveUnitTime); 155 | let node = this.node.getPosition(); 156 | if (shakeCount > 0 && shakeMaxMoveDistance > 0) { 157 | for (let i = 0; i < shakeCount; i++) { 158 | let x = node.x + this._randomPos(shakeMaxMoveDistance); 159 | let y = node.y + this._randomPos(shakeMaxMoveDistance); 160 | let move = cc.moveTo(moveUnitTime, cc.v2(x, y)); 161 | acts.push(move); 162 | } 163 | // acts.push(cc.callFunc(function () { 164 | // this.node.x = this.node.y = 0; 165 | // }.bind(this))); 166 | ret = cc.sequence(acts); 167 | } else { 168 | console.log("未查找到晃动的配置!"); 169 | } 170 | } else if (type === ActionEnum.Blink) { 171 | ret = cc.blink(this.actionTime, this.blinkCount); 172 | } else if (type === ActionEnum.Scale) { 173 | ret = cc.scaleTo(this.actionTime, this.scaleSize); 174 | } else if (type === ActionEnum.Move) { 175 | this.node.setPosition(this.moveBeganPosX || 0, this.moveBeganPosY || 0); 176 | ret = cc.moveTo(this.actionTime, this.moveEndPosX || 0, this.moveEndPosY || 0); 177 | } 178 | return ret; 179 | }, 180 | _randomByMaxValue(maxNum) { 181 | return Math.floor(Math.random() * maxNum); 182 | }, 183 | _randomPos(max) { 184 | let num = this._randomByMaxValue(2); 185 | if (num % 2 === 0) { 186 | return this._randomByMaxValue(max) 187 | } else { 188 | return -this._randomByMaxValue(max); 189 | } 190 | } 191 | }); 192 | -------------------------------------------------------------------------------- /plugin-code/assets/property/CaseDialogShowEffect.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "69297ee3-c12c-44b0-b27d-ab33ac40605a", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /plugin-code/assets/property/CaseVisibleProperty.js: -------------------------------------------------------------------------------- 1 | let PropertyEnum = cc.Enum({ 2 | Property1: 0, 3 | Property2: 1, 4 | Property3: 2, 5 | PropertyAll: 3, 6 | }); 7 | 8 | 9 | cc.Class({ 10 | extends: cc.Component, 11 | 12 | properties: { 13 | propertyType: { 14 | default: PropertyEnum.Property1, displayName: "是否显示", type: PropertyEnum, 15 | notify() { 16 | this._updateProperty(); 17 | } 18 | }, 19 | property1: { 20 | default: "10", displayName: "属性1", visible: true 21 | }, 22 | property2: { 23 | default: "20", displayName: "属性2", visible: true 24 | }, 25 | property3: { 26 | default: "30", displayName: "属性3", visible: true 27 | }, 28 | }, 29 | 30 | _updateProperty() { 31 | console.log("_updateProperty"); 32 | if (this.propertyType === PropertyEnum.Property1) { 33 | cc.Class.attr(this, 'property1', {visible: true}); 34 | cc.Class.attr(this, 'property2', {visible: false}); 35 | cc.Class.attr(this, 'property3', {visible: false}); 36 | } else if (this.propertyType === PropertyEnum.Property2) { 37 | cc.Class.attr(this, 'property1', {visible: false}); 38 | cc.Class.attr(this, 'property2', {visible: true}); 39 | cc.Class.attr(this, 'property3', {visible: false}); 40 | } else if (this.propertyType === PropertyEnum.Property3) { 41 | cc.Class.attr(this, 'property1', {visible: false}); 42 | cc.Class.attr(this, 'property2', {visible: false}); 43 | cc.Class.attr(this, 'property3', {visible: true}); 44 | } else if (this.propertyType === PropertyEnum.PropertyAll) { 45 | cc.Class.attr(this, 'property1', {visible: true}); 46 | cc.Class.attr(this, 'property2', {visible: true}); 47 | cc.Class.attr(this, 'property3', {visible: true}); 48 | } 49 | }, 50 | 51 | }); 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /plugin-code/assets/property/CaseVisibleProperty.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "c459b076-3917-4af0-9456-5518b88215fd", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /plugin-code/assets/property/Widget.fire: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SceneAsset", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_native": "", 7 | "scene": { 8 | "__id__": 1 9 | } 10 | }, 11 | { 12 | "__type__": "cc.Scene", 13 | "_objFlags": 0, 14 | "_parent": null, 15 | "_children": [ 16 | { 17 | "__id__": 2 18 | } 19 | ], 20 | "_active": true, 21 | "_level": 0, 22 | "_components": [], 23 | "_prefab": null, 24 | "_opacity": 255, 25 | "_color": { 26 | "__type__": "cc.Color", 27 | "r": 255, 28 | "g": 255, 29 | "b": 255, 30 | "a": 255 31 | }, 32 | "_contentSize": { 33 | "__type__": "cc.Size", 34 | "width": 0, 35 | "height": 0 36 | }, 37 | "_anchorPoint": { 38 | "__type__": "cc.Vec2", 39 | "x": 0, 40 | "y": 0 41 | }, 42 | "_scale": { 43 | "__type__": "cc.Vec3", 44 | "x": 0.4374755859375, 45 | "y": 0.4374755859375, 46 | "z": 1 47 | }, 48 | "_quat": { 49 | "__type__": "cc.Quat", 50 | "x": 0, 51 | "y": 0, 52 | "z": 0, 53 | "w": 1 54 | }, 55 | "_zIndex": 0, 56 | "groupIndex": 0, 57 | "autoReleaseAssets": false, 58 | "_id": "efca0e2b-fda0-4842-813b-24f407bc1a8e" 59 | }, 60 | { 61 | "__type__": "cc.Node", 62 | "_name": "Canvas", 63 | "_objFlags": 0, 64 | "_parent": { 65 | "__id__": 1 66 | }, 67 | "_children": [ 68 | { 69 | "__id__": 3 70 | } 71 | ], 72 | "_active": true, 73 | "_level": 0, 74 | "_components": [ 75 | { 76 | "__id__": 5 77 | }, 78 | { 79 | "__id__": 6 80 | }, 81 | { 82 | "__id__": 7 83 | } 84 | ], 85 | "_prefab": null, 86 | "_opacity": 255, 87 | "_color": { 88 | "__type__": "cc.Color", 89 | "r": 202, 90 | "g": 43, 91 | "b": 43, 92 | "a": 255 93 | }, 94 | "_contentSize": { 95 | "__type__": "cc.Size", 96 | "width": 960, 97 | "height": 640 98 | }, 99 | "_anchorPoint": { 100 | "__type__": "cc.Vec2", 101 | "x": 0.5, 102 | "y": 0.5 103 | }, 104 | "_position": { 105 | "__type__": "cc.Vec3", 106 | "x": 480, 107 | "y": 320, 108 | "z": 0 109 | }, 110 | "_scale": { 111 | "__type__": "cc.Vec3", 112 | "x": 1, 113 | "y": 1, 114 | "z": 1 115 | }, 116 | "_rotationX": 0, 117 | "_rotationY": 0, 118 | "_quat": { 119 | "__type__": "cc.Quat", 120 | "x": 0, 121 | "y": 0, 122 | "z": 0, 123 | "w": 1 124 | }, 125 | "_skewX": 0, 126 | "_skewY": 0, 127 | "_zIndex": 0, 128 | "groupIndex": 0, 129 | "_id": "cd7nHhIQNJzLo1UOLX3r5y" 130 | }, 131 | { 132 | "__type__": "cc.Node", 133 | "_name": "Main Camera", 134 | "_objFlags": 0, 135 | "_parent": { 136 | "__id__": 2 137 | }, 138 | "_children": [], 139 | "_active": true, 140 | "_level": 1, 141 | "_components": [ 142 | { 143 | "__id__": 4 144 | } 145 | ], 146 | "_prefab": null, 147 | "_opacity": 255, 148 | "_color": { 149 | "__type__": "cc.Color", 150 | "r": 255, 151 | "g": 255, 152 | "b": 255, 153 | "a": 255 154 | }, 155 | "_contentSize": { 156 | "__type__": "cc.Size", 157 | "width": 0, 158 | "height": 0 159 | }, 160 | "_anchorPoint": { 161 | "__type__": "cc.Vec2", 162 | "x": 0.5, 163 | "y": 0.5 164 | }, 165 | "_position": { 166 | "__type__": "cc.Vec3", 167 | "x": 0, 168 | "y": 0, 169 | "z": 0 170 | }, 171 | "_scale": { 172 | "__type__": "cc.Vec3", 173 | "x": 1, 174 | "y": 1, 175 | "z": 1 176 | }, 177 | "_rotationX": 0, 178 | "_rotationY": 0, 179 | "_quat": { 180 | "__type__": "cc.Quat", 181 | "x": 0, 182 | "y": 0, 183 | "z": 0, 184 | "w": 1 185 | }, 186 | "_skewX": 0, 187 | "_skewY": 0, 188 | "_zIndex": 0, 189 | "groupIndex": 0, 190 | "_id": "b4zj6AJLJMd5zxtQlMZhEG" 191 | }, 192 | { 193 | "__type__": "cc.Camera", 194 | "_name": "", 195 | "_objFlags": 0, 196 | "node": { 197 | "__id__": 3 198 | }, 199 | "_enabled": true, 200 | "_cullingMask": 4294967295, 201 | "_clearFlags": 7, 202 | "_backgroundColor": { 203 | "__type__": "cc.Color", 204 | "r": 0, 205 | "g": 0, 206 | "b": 0, 207 | "a": 255 208 | }, 209 | "_depth": -1, 210 | "_zoomRatio": 1, 211 | "_targetTexture": null, 212 | "_id": "35q8vOC/NEw7sxTQqrEXSZ" 213 | }, 214 | { 215 | "__type__": "cc.Canvas", 216 | "_name": "", 217 | "_objFlags": 0, 218 | "node": { 219 | "__id__": 2 220 | }, 221 | "_enabled": true, 222 | "_designResolution": { 223 | "__type__": "cc.Size", 224 | "width": 960, 225 | "height": 640 226 | }, 227 | "_fitWidth": false, 228 | "_fitHeight": true, 229 | "_id": "9daDavt8pIWZCpZUzlCIEN" 230 | }, 231 | { 232 | "__type__": "cc.Widget", 233 | "_name": "", 234 | "_objFlags": 0, 235 | "node": { 236 | "__id__": 2 237 | }, 238 | "_enabled": true, 239 | "alignMode": 1, 240 | "_target": null, 241 | "_alignFlags": 36, 242 | "_left": 0, 243 | "_right": 0, 244 | "_top": 0, 245 | "_bottom": 0, 246 | "_verticalCenter": 0, 247 | "_horizontalCenter": 0, 248 | "_isAbsLeft": true, 249 | "_isAbsRight": true, 250 | "_isAbsTop": true, 251 | "_isAbsBottom": true, 252 | "_isAbsHorizontalCenter": true, 253 | "_isAbsVerticalCenter": true, 254 | "_originalWidth": 0, 255 | "_originalHeight": 0, 256 | "_id": "950RREJCJGVrCuM3/ZdNZk" 257 | }, 258 | { 259 | "__type__": "cc.Button", 260 | "_name": "", 261 | "_objFlags": 0, 262 | "node": { 263 | "__id__": 2 264 | }, 265 | "_enabled": true, 266 | "transition": 1, 267 | "pressedColor": { 268 | "__type__": "cc.Color", 269 | "r": 211, 270 | "g": 211, 271 | "b": 211, 272 | "a": 255 273 | }, 274 | "hoverColor": { 275 | "__type__": "cc.Color", 276 | "r": 255, 277 | "g": 255, 278 | "b": 255, 279 | "a": 255 280 | }, 281 | "duration": 0.1, 282 | "zoomScale": 1.2, 283 | "clickEvents": [], 284 | "_N$interactable": true, 285 | "_N$enableAutoGrayEffect": false, 286 | "_N$normalColor": { 287 | "__type__": "cc.Color", 288 | "r": 202, 289 | "g": 43, 290 | "b": 43, 291 | "a": 255 292 | }, 293 | "_N$disabledColor": { 294 | "__type__": "cc.Color", 295 | "r": 124, 296 | "g": 124, 297 | "b": 124, 298 | "a": 255 299 | }, 300 | "_N$normalSprite": null, 301 | "_N$pressedSprite": null, 302 | "pressedSprite": null, 303 | "_N$hoverSprite": null, 304 | "hoverSprite": null, 305 | "_N$disabledSprite": null, 306 | "_N$target": { 307 | "__id__": 2 308 | }, 309 | "_id": "04A4jgyL5Du7JSk5AXohD3" 310 | } 311 | ] -------------------------------------------------------------------------------- /plugin-code/assets/property/Widget.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.0", 3 | "uuid": "efca0e2b-fda0-4842-813b-24f407bc1a8e", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /plugin-code/assets/property/fun.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tidys/cc-plugin-train/67bd80fec619f3b9b6c715bf5ad0ffd84c4914be/plugin-code/assets/property/fun.png -------------------------------------------------------------------------------- /plugin-code/assets/property/fun.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.2.0", 3 | "uuid": "43aaf749-d06b-49d2-a7b4-40186548fedf", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "subMetas": { 9 | "fun": { 10 | "ver": "1.0.3", 11 | "uuid": "dd56c4e8-edf2-4506-8db4-4b98ae8dfdff", 12 | "rawTextureUuid": "43aaf749-d06b-49d2-a7b4-40186548fedf", 13 | "trimType": "auto", 14 | "trimThreshold": 1, 15 | "rotated": false, 16 | "offsetX": 0, 17 | "offsetY": 0, 18 | "trimX": 0, 19 | "trimY": 0, 20 | "width": 213, 21 | "height": 232, 22 | "rawWidth": 213, 23 | "rawHeight": 232, 24 | "borderTop": 0, 25 | "borderBottom": 0, 26 | "borderLeft": 0, 27 | "borderRight": 0, 28 | "subMetas": {} 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /plugin-code/auto/ccwidget.html: -------------------------------------------------------------------------------- 1 | 58 |
59 |
60 |
61 | Top 64 | 65 | 68 |
69 |
70 |
71 | Left 74 | 75 | 78 |
79 | 80 |
81 | Right 85 | 86 | 89 |
90 |
91 |
92 | Bottom 95 | 96 | 99 |
100 |
101 |
102 |
103 | Horizontal 106 | Center 107 | 108 | 109 | 113 |
114 |
115 | Vertical 119 | Center 120 | 121 | 122 | 126 |
127 |
128 |
129 |
130 | 131 | 132 | -------------------------------------------------------------------------------- /plugin-code/auto/gulpfile.js: -------------------------------------------------------------------------------- 1 | const gulp = require("gulp"); 2 | const uglifyES = require('uglify-es'); 3 | const fs = require("fs"); 4 | const fse = require('fs-extra'); 5 | const path = require('path'); 6 | const htmlMinifier = require('html-minifier'); 7 | 8 | let compressCode = function (jsFile, isMin) { 9 | if (fs.existsSync(jsFile)) { 10 | let data = fs.readFileSync(jsFile, 'utf-8'); 11 | let result = uglifyES.minify(data, { 12 | compress: { 13 | dead_code: true,// 移除未使用的code 14 | drop_console: true,//丢弃console代码,默认false 15 | drop_debugger: true,//丢弃debugger代码,默认true 16 | }, 17 | output: { 18 | // comments: false, 19 | } 20 | }); 21 | if (result.error) { 22 | // console.log("❎压缩出现错误: " + result.error.message); 23 | // console.log("❎发生错误的文件: " + jsFile); 24 | return false; 25 | } else { 26 | if (isMin) { 27 | let file = path.basenameNoExt(jsFile); 28 | file += ".min.js"; 29 | fs.writeFileSync(file, result.code); 30 | } else { 31 | fs.writeFileSync(jsFile, result.code); 32 | } 33 | return true; 34 | } 35 | } else { 36 | console.log("文件不存在:" + jsFile); 37 | return false; 38 | } 39 | }; 40 | 41 | 42 | let packagePlugin = function (pluginDirName) { 43 | let projectRootPath = path.join(__dirname, "../");// 项目根目录 44 | let projectPackagePath = path.join(projectRootPath, 'packages');// 项目插件根目录 45 | let pluginOutPath = path.join(projectRootPath, 'out');// 插件输出目录 46 | let pluginTmpPath = path.join(pluginOutPath, pluginDirName);// 插件输出目录 47 | let packageDirPath = path.join(projectPackagePath, pluginDirName);// 插件根目录 48 | 49 | // 创建插件的输出目录 50 | if (!fs.existsSync(pluginOutPath)) { 51 | fse.mkdirsSync(pluginOutPath); 52 | } 53 | if (!fs.existsSync(pluginTmpPath)) { 54 | fse.mkdirsSync(pluginTmpPath); 55 | } 56 | 57 | // 将插件先拷贝到out/pluginTmp目录下 58 | if (!fs.existsSync(packageDirPath)) { 59 | console.error("[ERROR] 没有发现插件目录: " + packageDirPath); 60 | return; 61 | } 62 | // 清空临时目录 63 | fse.emptyDirSync(pluginTmpPath); 64 | // 可以在第三个参数,过滤掉不需要拷贝的文件 65 | // filter : Function to filter copied files. Return true to include, false to exclude. 66 | fse.copySync(packageDirPath, pluginTmpPath); 67 | console.log("✅[拷贝] 拷贝插件到输出目录成功: " + pluginTmpPath); 68 | // 删除掉package-lock.json 69 | debugger 70 | let delFiles = ["package-lock.json", "README.md"]; 71 | for (let i = 0; i < delFiles.length; i++) { 72 | let packageLocalFilePath = path.join(pluginTmpPath, delFiles[i]); 73 | if (fs.existsSync(packageLocalFilePath)) { 74 | fs.unlinkSync(packageLocalFilePath); 75 | console.log("✅[删除] 文件: " + packageLocalFilePath); 76 | } 77 | } 78 | 79 | // 修改插件必要的配置package.json, 80 | let pluginTmpPackageCfgPath = path.join(pluginTmpPath, "package.json");// 插件临时配置文件路径 81 | if (!fs.existsSync(pluginTmpPackageCfgPath)) { 82 | console.error("[ERROR] 没有发现配置的临时文件: " + pluginTmpPackageCfgPath); 83 | return; 84 | } 85 | let cfgData = fs.readFileSync(pluginTmpPackageCfgPath, 'utf-8'); 86 | let json = JSON.parse(cfgData); 87 | // 删除无用的menu 88 | let menus = json['main-menu']; 89 | if (menus) { 90 | for (let key in menus) { 91 | let item = menus[key]; 92 | if (item && item.del) { 93 | delete menus[key]; 94 | } 95 | } 96 | console.log("✅[丢弃] 无用menus"); 97 | } 98 | // 删除dependencies 99 | let dependencies = json['dependencies']; 100 | if (dependencies) { 101 | delete json['dependencies']; 102 | console.log("✅[丢弃] 无用dependencies"); 103 | } 104 | 105 | // 删除devDependencies 106 | let devDependencies = json["devDependencies"]; 107 | if (devDependencies) { 108 | delete json['devDependencies']; 109 | console.log("✅[丢弃] 无用devDependencies"); 110 | } 111 | 112 | let str = JSON.stringify(json); 113 | // str = jsBeautifully(str);// 格式化json 114 | fs.writeFileSync(pluginTmpPackageCfgPath, str); 115 | 116 | console.log('✅[修改] 写入新的临时配置package.json完毕!'); 117 | 118 | 119 | // 压缩js 120 | const globby = require('globby'); 121 | let pattern1 = pluginTmpPath + "/**/*.js"; 122 | let exclude = "!" + pluginTmpPath + "/node_modules/**/*"; 123 | let paths = globby.sync([pattern1, exclude]); 124 | for (let i = 0; i < paths.length; i++) { 125 | let item = paths[i]; 126 | let b = compressCode(item, false); 127 | if (b) { 128 | console.log(`✅[压缩] 成功(JS)[${i + 1}/${paths.length}]: ${item}`); 129 | } else { 130 | console.log(`❎[压缩] 失败(JS)[${i + 1}/${paths.length}]: ${item}`); 131 | } 132 | } 133 | 134 | // 压缩html,css 135 | let pattern2 = pluginTmpPath + "/**/*.html"; 136 | let pattern3 = pluginTmpPath + "/**/*.css"; 137 | let paths1 = globby.sync([pattern2, pattern3, exclude]); 138 | let minify = htmlMinifier.minify; 139 | for (let i = 0; i < paths1.length; i++) { 140 | let item = paths1[i]; 141 | let itemData = fs.readFileSync(item, 'utf-8'); 142 | let minifyData = minify(itemData, { 143 | removeComments: true,// 是否去掉注释 144 | collapseWhitespace: true,// 是否去掉空格 145 | minifyJS: false, //是否压缩html里的js(使用uglify-js进行的压缩) 146 | minifyCSS: false,//是否压缩html里的css(使用clean-css进行的压缩) 147 | }); 148 | fs.writeFileSync(item, minifyData); 149 | console.log(`✅[压缩] 成功(HTML)[${i + 1}/${paths1.length}]: ${item}`); 150 | } 151 | // 在文件夹中展示打包文件 152 | let exec = require('child_process').exec; 153 | let platform = require('os').platform(); 154 | if (platform === 'darwin') { 155 | let cmd = "open " + pluginOutPath; 156 | console.log('开始执行命令: ' + cmd); 157 | exec(cmd, function (error, stdout, stderr) { 158 | if (error) { 159 | console.log(stderr); 160 | return; 161 | } 162 | console.log(stdout); 163 | }.bind(this)); 164 | } else if (platform === 'win32') { 165 | // todo win 166 | } 167 | }; 168 | 169 | 170 | gulp.task("发布hello-world插件", function () { 171 | packagePlugin('hello-world'); 172 | }); 173 | -------------------------------------------------------------------------------- /plugin-code/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es6", 4 | "module": "commonjs", 5 | "experimentalDecorators": true 6 | }, 7 | "exclude": [ 8 | "node_modules", 9 | ".vscode", 10 | "library", 11 | "local", 12 | "settings", 13 | "temp" 14 | ] 15 | } -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/inspector/dialog/dialog.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 |
15 | 16 |
17 | 19 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 |
33 | 34 |
35 | 36 | 37 |
38 | 39 |
40 | 41 | 42 |
43 | 44 |
45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 |
56 | 57 |
58 | 预览 59 |
60 |
61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/inspector/dialog/dialog.js: -------------------------------------------------------------------------------- 1 | let packageName = "hello-world"; 2 | let fs = require("fire-fs"); 3 | let path = require('fire-path'); 4 | 5 | let ActionEnum = cc.Enum({ 6 | None: "None", 7 | Scale: "Scale", 8 | Blink: "Blink", 9 | Shake: "Shake", 10 | FadeIn: "FadeIn", 11 | FadeOut: "FadeOut", 12 | Move: "Move", 13 | }); 14 | 15 | Vue.component('dialog-inspector', { 16 | template: fs.readFileSync(Editor.url('packages://' + packageName + '/inspector/dialog/dialog.html'), 'utf8'), 17 | 18 | props: { 19 | target: { 20 | twoWay: true, 21 | type: Object, 22 | } 23 | }, 24 | created() { 25 | this.curAction = this.target.actionType.value; 26 | }, 27 | data() { 28 | return { 29 | curAction: ActionEnum.None, 30 | actEnum: ActionEnum, 31 | actions: [ 32 | {name: "无", option: ActionEnum.None}, 33 | {name: "淡入", option: ActionEnum.FadeIn}, 34 | {name: "淡出", option: ActionEnum.FadeOut}, 35 | {name: "震动", option: ActionEnum.Shake}, 36 | {name: "闪烁", option: ActionEnum.Blink}, 37 | {name: "缩放", option: ActionEnum.Scale}, 38 | {name: "位移", option: ActionEnum.Move}, 39 | ], 40 | 41 | actionTime: 1, 42 | delayTime: 0, 43 | 44 | 45 | shakeStrength: 1,// 震动强度 46 | blinkCount: 1,// 闪烁次数 47 | scaleSize: 1,// 缩放比例 48 | 49 | moveBeganPos: cc.v2(0, 0), 50 | moveEndPos: cc.v2(0, 0), 51 | } 52 | 53 | }, 54 | methods: { 55 | onBtnClickPreview() { 56 | let time = new Date().getTime(); 57 | Editor.Ipc.sendToPanel('scene', 'scene:set-property', { 58 | id: this.target.uuid.value, 59 | path: "preview", 60 | type: "Float", 61 | value: time, 62 | }); 63 | }, 64 | onChangeAction() { 65 | Editor.Ipc.sendToPanel('scene', 'scene:set-property', { 66 | id: this.target.uuid.value, 67 | path: "actionType", 68 | type: "String", 69 | value: this.curAction, 70 | }); 71 | }, 72 | onSetActionShakeStrength() { 73 | Editor.Ipc.sendToPanel('scene', 'scene:set-property', { 74 | id: this.target.uuid.value, 75 | path: "shakeStrength", 76 | type: "Float", 77 | value: parseFloat(this.target.shakeStrength.value.toString()), 78 | }); 79 | }, 80 | onBtnClickTest() { 81 | this.target.foo.value += "1"; 82 | Editor.log('foo:' + this.target.foo.value); 83 | }, 84 | onBtnClickCheck() { 85 | Editor.log('check'); 86 | }, 87 | } 88 | }); 89 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/inspector/test/test.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 打印Foo 5 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/inspector/test/test.js: -------------------------------------------------------------------------------- 1 | let packageName = "hello-world"; 2 | let fs = require("fire-fs"); 3 | let path = require('fire-path'); 4 | 5 | 6 | Vue.component('foobar-inspector', { 7 | template: fs.readFileSync(Editor.url('packages://' + packageName + '/inspector/test/test.html'), 'utf8'), 8 | 9 | props: { 10 | target: { 11 | twoWay: true, 12 | type: Object, 13 | } 14 | }, 15 | methods: { 16 | onBtnClickTest() { 17 | this.target.foo.value += "1"; 18 | Editor.log('foo:' + this.target.foo.value); 19 | }, 20 | onBtnClickCheck() { 21 | Editor.log('check'); 22 | }, 23 | } 24 | }); 25 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/layout.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "dock-h", 3 | "children": [ 4 | { 5 | "type": "panel", 6 | "active": 0, 7 | "children": [ 8 | "hello-world" 9 | ] 10 | }, 11 | { 12 | "type": "panel", 13 | "active": 0, 14 | "children": [ 15 | "hello-world.page1","hello-world.page2" 16 | ] 17 | } 18 | ] 19 | } 20 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/main.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = { 4 | load() { 5 | // execute when package loaded 6 | }, 7 | 8 | unload() { 9 | // execute when package unloaded 10 | }, 11 | 12 | // register your ipc messages here 13 | messages: { 14 | 'open'() { 15 | // open entry panel registered in package.json 16 | Editor.Panel.open('hello-world'); 17 | }, 18 | 'say-hello'() { 19 | Editor.log('Hello World!'); 20 | // send ipc message to panel 21 | Editor.Ipc.sendToPanel('hello-world', 'hello-world:hello'); 22 | }, 23 | 'clicked'() { 24 | Editor.log('Button clicked!'); 25 | }, 26 | 'open-all-panel'(event) { 27 | Editor.Panel.open("hello-world.page1"); 28 | Editor.Panel.open("hello-world.page2"); 29 | Editor.Panel.open("hello-world.page3"); 30 | }, 31 | 'onPage3'(event, data) { 32 | Editor.log("onPage3: " + data); 33 | if(event.reply){ 34 | event.reply(null,"我来自主进程onPage3"); 35 | } 36 | // Editor.Ipc.sendToPanel("hello-world.page3",""); 37 | 38 | } 39 | }, 40 | }; 41 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello-world", 3 | "version": "0.0.1", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "fs-extra": { 8 | "version": "7.0.1", 9 | "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", 10 | "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", 11 | "requires": { 12 | "graceful-fs": "^4.1.2", 13 | "jsonfile": "^4.0.0", 14 | "universalify": "^0.1.0" 15 | } 16 | }, 17 | "graceful-fs": { 18 | "version": "4.1.15", 19 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.15.tgz", 20 | "integrity": "sha512-6uHUhOPEBgQ24HM+r6b/QwWfZq+yiFcipKFrOFiBEnWdy5sdzYoi+pJeQaPI5qOLRFqWmAXUPQNsielzdLoecA==" 21 | }, 22 | "jsonfile": { 23 | "version": "4.0.0", 24 | "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", 25 | "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", 26 | "requires": { 27 | "graceful-fs": "^4.1.6" 28 | } 29 | }, 30 | "universalify": { 31 | "version": "0.1.2", 32 | "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", 33 | "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==" 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hello-world", 3 | "version": "0.0.1", 4 | "description": "The package template for getting started.", 5 | "author": "Cocos Creator", 6 | "main": "main.js", 7 | "main-menu": { 8 | "i18n:MAIN_MENU.package.title/hello-world/open": { 9 | "message": "hello-world:open", 10 | "del": true 11 | }, 12 | "i18n:MAIN_MENU.package.title/hello-world/hello": { 13 | "message": "hello-world:say-hello" 14 | }, 15 | "i18n:MAIN_MENU.package.title/hello-world/open-all-panel": { 16 | "message": "hello-world:open-all-panel" 17 | } 18 | }, 19 | "runtime-resource": { 20 | "path": "plugin", 21 | "name": "plugin" 22 | }, 23 | "reload": { 24 | "ignore": [ 25 | "plugin/**/*" 26 | ] 27 | }, 28 | "scene-script": "scene-walker.js", 29 | "panel": { 30 | "main": "panel/index.js", 31 | "type": "dockable", 32 | "title": "hello-world", 33 | "width": 400, 34 | "height": 300 35 | }, 36 | "panel.page1": { 37 | "main": "panel/page1.js", 38 | "type": "dockable", 39 | "title": "page1", 40 | "width": 400, 41 | "height": 300 42 | }, 43 | "panel.page2": { 44 | "main": "panel/page2.js", 45 | "type": "dockable", 46 | "title": "page2", 47 | "width": 400, 48 | "height": 300 49 | }, 50 | "panel.page3": { 51 | "main": "panel/page3.js", 52 | "type": "dockable", 53 | "title": "page3", 54 | "width": 400, 55 | "height": 300 56 | }, 57 | "dependencies": { 58 | "fs-extra": "^7.0.1" 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/panel/index.css: -------------------------------------------------------------------------------- 1 | :host { 2 | margin: 5px; 3 | } 4 | 5 | h2 { 6 | color: #f90; 7 | } 8 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/panel/index.html: -------------------------------------------------------------------------------- 1 |

hello-world

2 |
3 |
State: {{msg}}
4 |
5 |
6 | Send To Main 7 | plugins 8 | layout 9 | scene-walker 10 |
11 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/panel/index.js: -------------------------------------------------------------------------------- 1 | // panel/index.js, this filename needs to match the one registered in package.json 2 | const Fs = require("fire-fs"); 3 | const Path = require("fire-path"); 4 | 5 | Editor.Panel.extend({ 6 | // css style for panel 7 | style: Fs.readFileSync( 8 | Editor.url("packages://hello-world/panel/index.css"), 9 | "utf-8" 10 | ), 11 | 12 | // html template for panel 13 | template: Fs.readFileSync( 14 | Editor.url("packages://hello-world/panel/index.html"), 15 | "utf-8" 16 | ), 17 | 18 | // element and variable binding 19 | $: {}, 20 | 21 | // method executed when template and styles are successfully loaded and initialized 22 | ready() { 23 | this.plugin = new window.Vue({ 24 | el: this.shadowRoot, 25 | created() { 26 | }, 27 | data: {msg: ""}, 28 | methods: { 29 | onBtnClick() { 30 | const FS_Extra = Editor.require("packages://hello-world/node_modules/fs-extra"); 31 | let dir = Path.join(Editor.projectInfo.path, "tmpDir"); 32 | FS_Extra.mkdirSync(dir); 33 | 34 | // Editor.Ipc.sendToMain('hello-world:clicked'); 35 | }, 36 | layout() { 37 | if (Editor.isMainProcess) { 38 | Editor.Window.main.resetLayout("packages://hello-world/layout.json"); 39 | 40 | } else { 41 | Editor.remote.Window.main.resetLayout("packages://hello-world/layout.json"); 42 | } 43 | }, 44 | sceneWalker() { 45 | Editor.Scene.callSceneScript('hello-world', 'get-canvas-children', function (err, length) { 46 | console.log(`get-canvas-children callback : length - ${length}`); 47 | }); 48 | } 49 | } 50 | }); 51 | 52 | 53 | }, 54 | 55 | // register your ipc messages here 56 | messages: { 57 | 'hello-world:hello'(event) { 58 | this.plugin.msg = 'Hello!'; 59 | }, 60 | 61 | } 62 | }); 63 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/panel/page1.js: -------------------------------------------------------------------------------- 1 | Editor.Panel.extend({ 2 | style: ``, 3 | 4 | template: ` 5 |
6 | send to page2 7 | {{msg}} 8 |
9 | 10 | `, 11 | 12 | $: {}, 13 | 14 | ready() { 15 | Editor.log("open page1"); 16 | console.log("page1"); 17 | this.plugin = new window.Vue({ 18 | el: this.shadowRoot, 19 | 20 | data: {msg: "page1"}, 21 | methods: { 22 | onBtnClick() { 23 | Editor.Ipc.sendToPanel("hello-world.page2", "onPage2", "msg from page1"); 24 | }, 25 | 26 | } 27 | }); 28 | }, 29 | messages: { 30 | 'onPage1'(event, data) { 31 | this.plugin.msg = data; 32 | setTimeout(function () { 33 | this.plugin.msg = ""; 34 | }.bind(this), 500); 35 | 36 | if (event.reply) { 37 | event.reply(null, "我来自渲染进程page1"); 38 | } 39 | }, 40 | 41 | } 42 | }); 43 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/panel/page2.js: -------------------------------------------------------------------------------- 1 | Editor.Panel.extend({ 2 | style: ``, 3 | 4 | template: ` 5 |
6 | send to page3 7 | {{msg}} 8 |
9 | `, 10 | 11 | $: {}, 12 | 13 | ready() { 14 | Editor.log("open page2"); 15 | console.log("page2"); 16 | this.plugin = new window.Vue({ 17 | el: this.shadowRoot, 18 | 19 | data: {msg: "page2"}, 20 | methods: { 21 | onBtnClick() { 22 | Editor.Ipc.sendToPanel("hello-world.page3", "onPage3", "msg from page2"); 23 | }, 24 | 25 | } 26 | }); 27 | }, 28 | messages: { 29 | 'onPage2'(event, data) { 30 | this.plugin.msg = data; 31 | setTimeout(function () { 32 | this.plugin.msg = ""; 33 | }.bind(this), 500); 34 | }, 35 | 36 | } 37 | }); 38 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/panel/page3.js: -------------------------------------------------------------------------------- 1 | Editor.Panel.extend({ 2 | style: ``, 3 | 4 | template: ` 5 |
6 | send to page1 7 | {{msg}} 8 | send to main 9 |
10 | `, 11 | 12 | $: {}, 13 | 14 | ready() { 15 | Editor.log("open page3"); 16 | console.log("page3"); 17 | this.plugin = new window.Vue({ 18 | el: this.shadowRoot, 19 | 20 | data: {msg: "page3"}, 21 | methods: { 22 | onBtnClick() { 23 | Editor.Ipc.sendToPanel("hello-world.page1", "onPage1", "msg from page3", function (event, data) { 24 | console.log(data); 25 | this.msg = data; 26 | setTimeout(function () { 27 | this.msg = ""; 28 | }.bind(this), 500); 29 | }); 30 | }, 31 | onSendToMain() { 32 | Editor.Ipc.sendToMain("hello-world:onPage3", "from page3", function (event, data) { 33 | this.msg = data; 34 | setTimeout(function () { 35 | this.msg = ""; 36 | }.bind(this), 500); 37 | }); 38 | 39 | }, 40 | 41 | } 42 | }); 43 | }, 44 | messages: { 45 | 'onPage3'(event, data) { 46 | this.plugin.msg = data; 47 | setTimeout(function () { 48 | this.plugin.msg = ""; 49 | }.bind(this), 500); 50 | }, 51 | 52 | } 53 | }); 54 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/plugin/PluginModule.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | Msg: "hello plugin", 3 | 4 | } 5 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/plugin/PluginModule.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "fea52939-b3e0-4acc-bc08-e38397b2ed34", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/plugin/PluginScript.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: {}, 5 | 6 | 7 | onLoad() { 8 | console.log("hello plugin"); 9 | }, 10 | 11 | start() { 12 | 13 | }, 14 | 15 | // update (dt) {}, 16 | }); 17 | -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/plugin/PluginScript.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "b143851f-5e45-48e9-addc-9d523f1ba1f9", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /plugin-code/packages/hello-world/scene-walker.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | // 更多的是跟场景编辑器当前的状态进行交互 3 | 'get-canvas-children': function (event) { 4 | debugger 5 | 6 | if (Editor.isMainProcess) { 7 | 8 | } else { 9 | 10 | } 11 | 12 | let canvas = cc.find('Canvas'); 13 | Editor.log('children length : ' + canvas.children.length); 14 | 15 | if (event.reply) { 16 | event.reply(null, canvas.children.length); 17 | } 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /plugin-code/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "engine": "cocos-creator-js", 3 | "packages": "packages" 4 | } -------------------------------------------------------------------------------- /插件课程文档/readme.md: -------------------------------------------------------------------------------- 1 | # 具体的视频上传到了百度网盘 2 | > 链接: https://pan.baidu.com/s/1tEXDqynSqd4a7n957mExrw 提取码: 2tw8 复制这段内容后打开百度网盘手机App,操作更方便哦 3 | 4 | # 视频关键字 5 | cocos cocos插件开发 creator插件 游戏插件开发 6 | -------------------------------------------------------------------------------- /插件课程文档/插件网络课程.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tidys/cc-plugin-train/67bd80fec619f3b9b6c715bf5ad0ffd84c4914be/插件课程文档/插件网络课程.pptx --------------------------------------------------------------------------------