├── .gitignore ├── README.md ├── assets ├── scripts.meta ├── scripts │ ├── init.js │ ├── init.js.meta │ ├── libs.meta │ ├── libs │ │ ├── bind.js │ │ ├── bind.js.meta │ │ ├── ccBind.js │ │ └── ccBind.js.meta │ ├── scenes.meta │ └── scenes │ │ ├── scActive.meta │ │ ├── scActive │ │ ├── scActive.fire │ │ ├── scActive.fire.meta │ │ ├── scActive.js │ │ └── scActive.js.meta │ │ ├── scClick.meta │ │ ├── scClick │ │ ├── scClick.fire │ │ ├── scClick.fire.meta │ │ ├── scClick.js │ │ └── scClick.js.meta │ │ ├── scDync.meta │ │ ├── scDync │ │ ├── scDync.fire │ │ ├── scDync.fire.meta │ │ ├── scDync.js │ │ └── scDync.js.meta │ │ ├── scGlobal.meta │ │ ├── scGlobal │ │ ├── scGlobal.fire │ │ ├── scGlobal.fire.meta │ │ ├── scGlobal.js │ │ └── scGlobal.js.meta │ │ ├── scInput.meta │ │ ├── scInput │ │ ├── scInput.fire │ │ ├── scInput.fire.meta │ │ ├── scInput.js │ │ └── scInput.js.meta │ │ ├── scList.meta │ │ ├── scList │ │ ├── scList.fire │ │ ├── scList.fire.meta │ │ ├── scList.js │ │ ├── scList.js.meta │ │ ├── toDoItem.js │ │ └── toDoItem.js.meta │ │ ├── scMain.meta │ │ ├── scMain │ │ ├── prefab.meta │ │ ├── prefab │ │ │ ├── pfBtn.js │ │ │ ├── pfBtn.js.meta │ │ │ ├── pfBtn.prefab │ │ │ └── pfBtn.prefab.meta │ │ ├── scMain.fire │ │ ├── scMain.fire.meta │ │ ├── scMain.js │ │ └── scMain.js.meta │ │ ├── scSprite.meta │ │ ├── scSprite │ │ ├── scSprite.fire │ │ ├── scSprite.fire.meta │ │ ├── scSprite.js │ │ └── scSprite.js.meta │ │ ├── scTab.meta │ │ └── scTab │ │ ├── scTab.fire │ │ ├── scTab.fire.meta │ │ ├── scTab.js │ │ └── scTab.js.meta ├── textures.meta └── textures │ ├── AutoAtlas.pac │ ├── AutoAtlas.pac.meta │ ├── avatarKing.png │ ├── avatarKing.png.meta │ ├── avatarKnight.png │ ├── avatarKnight.png.meta │ ├── avatarMonk.png │ ├── avatarMonk.png.meta │ ├── avatarQueen.png │ ├── avatarQueen.png.meta │ ├── back.png │ ├── back.png.meta │ ├── bg.png │ ├── bg.png.meta │ ├── bg32.png │ ├── bg32.png.meta │ ├── close.png │ ├── close.png.meta │ ├── deer1.png │ ├── deer1.png.meta │ ├── deer2.png │ ├── deer2.png.meta │ ├── deer3.png │ ├── deer3.png.meta │ ├── deer4.png │ ├── deer4.png.meta │ ├── outline.png │ ├── outline.png.meta │ ├── share.png │ └── share.png.meta ├── example ├── cocos2d-js.js ├── index.html ├── main.js ├── res │ ├── import │ │ ├── 28 │ │ │ └── 2874f8dd-416c-4440-81b7-555975426e93.json │ │ ├── 79 │ │ │ └── 79eafaef-b7ef-45d9-9c3f-591dc836fc7a.json │ │ ├── 01 │ │ │ ├── 0131d8cf3.json │ │ │ └── 01cc69595.json │ │ ├── 02 │ │ │ ├── 02ef7e0a7.json │ │ │ └── 02efcc783.json │ │ ├── 03 │ │ │ ├── 030e2f64d.json │ │ │ └── 034f90767.json │ │ ├── 04 │ │ │ └── 049fff3a4.json │ │ ├── 05 │ │ │ └── 059a92f5e.json │ │ ├── 06 │ │ │ └── 06dd2a9d2.json │ │ ├── 07 │ │ │ ├── 079499991.json │ │ │ └── 07ce7530a.json │ │ ├── 0d │ │ │ └── 0d669730c.json │ │ ├── 0e │ │ │ └── 0e4bc3b03.json │ │ ├── 0f │ │ │ └── 0fe591e5f.json │ │ ├── 6f │ │ │ └── 6f801092-0c37-4f30-89ef-c8d960825b36.json │ │ └── ec │ │ │ └── eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432.json │ └── raw-assets │ │ ├── 17 │ │ └── 17a874b44.png │ │ ├── 61 │ │ └── 617323dd-11f4-4dd3-8eec-0caf6b3b45b9.png │ │ ├── 02 │ │ └── 0275e94c-56a7-410f-bd1a-fc7483f7d14a.png │ │ ├── d6 │ │ └── d6d3ca85-4681-47c1-b5dd-d036a9d39ea2.png │ │ ├── d8 │ │ └── d81ec8ad-247c-4e62-aa3c-d35c4193c7af.png │ │ └── ed │ │ └── edd215b9-2796-4a05-aaf5-81f96c9281ce.png ├── splash.png ├── src │ ├── project.dev.js │ └── settings.js ├── style-desktop.css └── style-mobile.css ├── jsconfig.json ├── project.json └── settings ├── builder.json ├── project.json └── services.json /.gitignore: -------------------------------------------------------------------------------- 1 | #///////////////////////////////////////////////////////////////////////////// 2 | # Fireball Projects 3 | #///////////////////////////////////////////////////////////////////////////// 4 | 5 | /library/ 6 | /temp/ 7 | /local/ 8 | /build/ 9 | 10 | #///////////////////////////////////////////////////////////////////////////// 11 | # npm files 12 | #///////////////////////////////////////////////////////////////////////////// 13 | 14 | npm-debug.log 15 | node_modules/ 16 | 17 | #///////////////////////////////////////////////////////////////////////////// 18 | # Logs and databases 19 | #///////////////////////////////////////////////////////////////////////////// 20 | 21 | *.log 22 | *.sql 23 | *.sqlite 24 | 25 | #///////////////////////////////////////////////////////////////////////////// 26 | # files for debugger 27 | #///////////////////////////////////////////////////////////////////////////// 28 | 29 | *.sln 30 | *.csproj 31 | *.pidb 32 | *.unityproj 33 | *.suo 34 | 35 | #///////////////////////////////////////////////////////////////////////////// 36 | # OS generated files 37 | #///////////////////////////////////////////////////////////////////////////// 38 | 39 | .DS_Store 40 | ehthumbs.db 41 | Thumbs.db 42 | 43 | #///////////////////////////////////////////////////////////////////////////// 44 | # WebStorm files 45 | #///////////////////////////////////////////////////////////////////////////// 46 | 47 | .idea/ 48 | 49 | #////////////////////////// 50 | # VS Code files 51 | #////////////////////////// 52 | 53 | .vscode/ 54 | /creator.d.ts 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ccBind 2 | #### A two direction binding function for cocos creator. 3 | #### The entry Scene is scMain. 4 | 5 | #### 给cocos creator专用的双向绑定功能。 6 | #### 入口场景是scMain。 7 | 8 | # description(说明) 9 | #### ccBind is a js script to add two direction binding function to node. It includes the functions below: 10 | 1. active control 11 | 2. input 12 | 3. string format 13 | 4. click event 14 | 5. sprite switch 15 | 6. array prefab 16 | 7. tab(toggle) 17 | 8. global binding 18 | 9. bind by code 19 | 20 | #### ccBind是一个用于给cocos creator的节点添加双向绑定的js脚本语言。它包括了以下功能: 21 | 1. 显示和隐藏 22 | 2. 输入绑定 23 | 3. 字符串格式化 24 | 4. 点击事件 25 | 5. 图片切换 26 | 6. 预制体的数组处理 27 | 7. 分页栏 28 | 8. 全部变量绑定 29 | 9. 动态代码绑定 30 | 31 | # notice(注意) 32 | #### The values/functions of binding must be defined on the corresponding node(or node's parent, parent's parent or ..) or global environment. They cannot be defined on the component. 33 | #### 双向绑定的变量,格式化公式,响应函数等,必须定义在对应的节点(或者父节点或者父节点的父节点上。。。)或者全部变量上。不能放在组件里面。 34 | 35 | # to do(下步要优化的内容) 36 | 1. binding in array 37 | 2. deleting key detection 38 | 39 | #### 带改进的地方 40 | 1. 目前数组下是没有双向绑定的功能, 41 | 2. 当前绑定对象,删除时,没有清空回调行数 42 | 43 | # example(例子) 44 | #### [pls click here](https://faace.github.io/ccBind/example/index.html) 45 | #### [请点这里](https://faace.github.io/ccBind/example/index.html) 46 | 47 | #### 这个双向绑定是第一版,目前在没经过大量压力使用的情况下,运行还算良好。尤其在解决数据更新时,同步到各个对应显示和控制的节点上,不需要大量的代码监听来控制。 48 | #### 当然,双向绑定也有一些缺点,主要在维护上会不太方便,不容易查看到到关联关系。这个问题计划在后期增加一些追踪的工具。 49 | #### 欢迎大家指教和共同参与完善。 50 | #### qq讨论群: 325965847 51 | 52 | 53 | -------------------------------------------------------------------------------- /assets/scripts.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "0eef8778-2b25-4a40-b547-7631e074fb1c", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/init.js: -------------------------------------------------------------------------------- 1 | // 这个init的文件会在scmain里面最先加载,把bind设置成一个全局函数 2 | 3 | window.bind = require('bind'); 4 | 5 | window.ge = { // 设定一个全局变量 6 | createBind: function (obj) { // 创建一个双向绑定 7 | return bind(obj); 8 | } 9 | }; -------------------------------------------------------------------------------- /assets/scripts/init.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "3691aaae-9a45-476c-93ca-087818e11bea", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/libs.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "4bd6c313-9c0e-4c2a-ae46-e025a0b53992", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/libs/bind.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "6b4ecb70-0ec9-496d-a3f1-1c9afe855cdb", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/libs/ccBind.js: -------------------------------------------------------------------------------- 1 | var WrapMode = cc.Enum({ 2 | Active: 0, // 控制active属性 3 | Label: 1, // 控制字符串 4 | EditBox: 2, // 控制字符串 5 | Prefab: 3, // 预制体 6 | CCNode: 4, // 指定节点 7 | SpriteFrame: 5, // 控制图片切换 8 | Toggle: 7, // 控制一组节点的互相切换 9 | Click: 8, // 点击事件 10 | }); 11 | 12 | var CCBindOneToggle = cc.Class({ 13 | name: "CCBindOneToggle", 14 | properties: { 15 | default: cc.Node, // 背景 16 | check: cc.Node, // 选中 17 | val: '', // 这个只等于双向绑定的val时,就是选中 18 | } 19 | }); 20 | var addClick = function (target, cb, isScale) { // 加上点击监听事件 21 | if (!target.getComponent(cc.Button)) { 22 | let btn = target.addComponent(cc.Button); 23 | if (isScale) { 24 | btn.transition = cc.Button.Transition.SCALE; 25 | btn.duration = 0.1; 26 | btn.zoomScale = 1.05; 27 | } 28 | } 29 | target.off('click'); 30 | target.on('click', cb); 31 | return target; 32 | }; 33 | 34 | cc.Class({ 35 | extends: cc.Component, 36 | 37 | properties: { 38 | type: { 39 | default: function () { 40 | return WrapMode.Active; 41 | }, 42 | type: WrapMode 43 | }, 44 | val: { 45 | default: '', 46 | tooltip: '需要绑定的变量,支持多层带点结构,从当前节点一直向上找' 47 | }, 48 | formator: { 49 | visible: function () { 50 | return this.type == WrapMode.Label || this.type == WrapMode.Active || this.type == WrapMode.Sprite; 51 | }, 52 | default: '', 53 | tooltip: '对val重新格式化公式(选填)' 54 | }, 55 | prefab: { 56 | visible: function () { 57 | return this.type == WrapMode.Prefab; 58 | }, 59 | default: undefined, 60 | type: cc.Prefab, 61 | tooltip: '最好配合Layout一起使用' 62 | }, 63 | ccNode: { 64 | visible: function () { 65 | return this.type == WrapMode.CCNode; 66 | }, 67 | default: undefined, 68 | type: cc.Node, 69 | displayName: 'Node', 70 | tooltip: '最好配合Layout一起使用' 71 | }, 72 | spriteFrame: { 73 | visible: function () { 74 | return this.type == WrapMode.SpriteFrame; 75 | }, 76 | default: [], 77 | type: [cc.SpriteFrame], 78 | tooltip: '根据参数切换SpriteFrame' 79 | }, 80 | clickCb: { 81 | visible: function () { 82 | return this.type == WrapMode.Click; 83 | }, 84 | default: '', 85 | tooltip: '点击节点的回调函数' 86 | }, 87 | toggle: { 88 | visible: function () { 89 | return this.type == WrapMode.Toggle; 90 | }, 91 | default: [], 92 | type: [CCBindOneToggle], 93 | tooltip: '控制多个节点之间的切换' 94 | }, 95 | toggleCb: { 96 | visible: function () { 97 | return this.type == WrapMode.Toggle; 98 | }, 99 | default: '', 100 | tooltip: '每次切换toggle的回调函数' 101 | }, 102 | tag: { 103 | visible: function () { 104 | return this.type == WrapMode.Click; 105 | }, 106 | default: '', 107 | tooltip: '标签,用于识别不同的节点' 108 | } 109 | }, 110 | 111 | getBaseObj: function (val) { //从下往父节点找,如果找不到再找全局的 112 | if (!val) return; 113 | let v0 = val.split('.')[0]; 114 | let parent = this.node; 115 | while (parent) { 116 | if (parent[v0]) return parent[v0]; 117 | parent = parent.parent; 118 | } 119 | if (window[v0]) return window[v0]; 120 | }, 121 | getVal: function (val) { 122 | if (!val) return; 123 | let v = val.split('.'); 124 | v.shift(); 125 | let obj = this.baseObj; 126 | while (v.length) { 127 | obj = obj[v.shift()]; 128 | if (typeof obj == 'undefined') return; 129 | } 130 | return obj; 131 | }, 132 | getFunc: function (func) { //从下往父节点找,如果找不到再找全局的 133 | if (!func) return func; 134 | let f = func.split('.'); 135 | let f0 = f.shift(); 136 | let parent = this.node; 137 | let baseFunc; 138 | while (parent) { 139 | if (parent[f0]) { 140 | baseFunc = parent[f0]; 141 | break; 142 | } 143 | parent = parent.parent; 144 | } 145 | if (!baseFunc && window[f0]) baseFunc = window[f0]; 146 | 147 | if (baseFunc) { 148 | while (baseFunc && f.length) { 149 | baseFunc = baseFunc[f.shift()]; 150 | } 151 | } 152 | 153 | return baseFunc ? baseFunc : func.replace(/\'/g, '"');; 154 | }, 155 | 156 | onLoad: function () { 157 | this.baseObj = this.getBaseObj(this.val); 158 | if (!this.baseObj) return; 159 | 160 | if (this.type == WrapMode.Active) { 161 | this.func = this.activeFunc; 162 | } else if (this.type == WrapMode.Label) { 163 | this.func = this.labelFunc; 164 | } else if (this.type == WrapMode.EditBox) { 165 | this.func = this.editBoxFunc; 166 | this.node.on('text-changed', (a) => { 167 | let vv = this.baseObj; 168 | let theV = this.val.split('.'); 169 | if (theV[0] == 'this') theV.shift(); // 先去掉this这一层 170 | theV.shift(); 171 | while (theV.length > 1) vv = vv[theV.shift()]; 172 | vv[theV[0]] = this.node.getComponent(cc.EditBox).string; 173 | }); 174 | } else if (this.type == WrapMode.CCNode) { 175 | this.func = this.nodeFunc; 176 | 177 | this.np = this.createNodePool(this.ccNode, this.node); 178 | } else if (this.type == WrapMode.Prefab) { 179 | this.func = this.nodeFunc; 180 | 181 | this.np = this.createNodePool(this.prefab, this.node); 182 | } else if (this.type == WrapMode.SpriteFrame) { 183 | this.func = this.spriteFunc; 184 | } else if (this.type == WrapMode.Toggle) { 185 | if (this.toggle.length > 0) this.func = this.toggleFunc; 186 | let vv = this.baseObj; 187 | let theV = this.val.split('.'); 188 | if (theV[0] == 'this') theV.shift(); // 先去掉this这一层 189 | theV.shift(); 190 | while (theV.length > 1) vv = vv[theV.shift()]; 191 | theV = theV[0]; // 减少一层引用 192 | this.toggle.forEach(function (one) { 193 | addClick(one.default, function () { 194 | if (vv[theV] != one.val) vv[theV] = one.val; 195 | }, true); 196 | }); 197 | 198 | if (this.toggleCb) { 199 | this.toggleCb = this.getFunc(this.toggleCb); 200 | } 201 | 202 | } else if (this.type == WrapMode.Click) { 203 | if (this.clickCb) { 204 | addClick(this.node, () => { 205 | let val = this.getVal(this.val) 206 | let clickCb = this.getFunc(this.clickCb); 207 | (typeof val != 'undefined') && (typeof clickCb == 'function') && clickCb(val, this.tag); 208 | }, true); 209 | } 210 | } 211 | 212 | if (this.func) { // 有处理函数才会真正去绑定 213 | if (this.formator) { 214 | this.formator = this.getFunc(this.formator); 215 | } 216 | 217 | let theV = this.val.split('.'); 218 | theV.shift(); 219 | this.func = this.func.bind(this); 220 | this.baseObj.map(theV.join('.'), this.func); 221 | } 222 | }, 223 | activeFunc: function (v) { 224 | if (this.formator) { 225 | if (typeof this.formator == 'function') v = this.formator(v); 226 | else { // 如果是普通字符串,就应该要输入一个对象 227 | try { 228 | let formator = JSON.parse(this.formator); 229 | let rc = true; 230 | if (parseFloat(v).toString() != "NaN") { 231 | for (var i in formator) { 232 | switch (i) { 233 | case '$gt': 234 | rc = rc && (v > formator[i]); 235 | break; 236 | case '$gte': 237 | rc = rc && (v >= formator[i]); 238 | break; 239 | case '$lt': 240 | rc = rc && (v < formator[i]); 241 | break; 242 | case '$lte': 243 | rc = rc && (v <= formator[i]); 244 | break; 245 | case '$eq': 246 | rc = rc && (v == formator[i]); 247 | break; 248 | case '$in': 249 | rc = rc && (formator.indexOf(v) > -1); 250 | break; 251 | default: // 其他的不支持 252 | rc = false; 253 | break; 254 | } 255 | } 256 | v = rc; 257 | } else v = false; 258 | } catch (error) { 259 | console.log(error); 260 | } 261 | } 262 | } 263 | this.node.active = v; 264 | }, 265 | labelFunc: function (v) { 266 | let label = this.label; 267 | if (!this.label) label = this.label = this.node.getComponent(cc.Label); 268 | if (label) { 269 | let val = v; 270 | if (this.formator) { // 可以留着 以后扩展 271 | if (typeof this.formator == 'string') { 272 | if (this.formator.format) val = this.formator.format(val); 273 | else val = this.formator.replace('%s', val); 274 | } 275 | else val = this.formator(val); 276 | } 277 | label.string = val; 278 | } 279 | }, 280 | editBoxFunc: function (v) { 281 | let editBox = this.node.getComponent(cc.EditBox); 282 | if (editBox) { 283 | if (editBox.string != v) { 284 | editBox.string = v; 285 | this.node.dispatchEvent(new cc.Event.EventCustom('text-changed', true)); 286 | } 287 | } 288 | }, 289 | nodeFunc: function (v) { 290 | for (let i = this.node.getChildrenCount() - 1; i >= 0; i--) { 291 | this.np.put(this.node._children[i]); 292 | } 293 | if (v) { 294 | if (typeof v.length != 'undefined') { 295 | for (let i = 0; i < v.length; i++) { 296 | this.np.get(null, v[i], i) 297 | } 298 | } else { 299 | for (var i in v) { 300 | this.np.get(null, v[i], i) 301 | } 302 | } 303 | } 304 | }, 305 | spriteFunc: function (v) { 306 | let sprite = this.sprite; 307 | if (!this.sprite) sprite = this.sprite = this.node.getComponent(cc.Sprite); 308 | if (sprite) { 309 | if (this.formator) { 310 | if (typeof this.formator == 'function') v = this.formator(v); 311 | else { // 只针对true和false 312 | try { 313 | let formator = JSON.parse(this.formator); 314 | if (formator.yes && formator.no) { // 切换 315 | let rc = true; 316 | let yes, no; 317 | v = v - 0; 318 | if (parseFloat(v).toString() != "NaN") { 319 | for (var i in formator) { 320 | switch (i) { 321 | case '$gt': 322 | rc = (v > formator[i].num); 323 | break; 324 | case '$gte': 325 | rc = rc && (v >= formator[i]); 326 | break; 327 | case '$lt': 328 | rc = rc && (v < formator[i]); 329 | break; 330 | case '$lte': 331 | rc = rc && (v <= formator[i]); 332 | break; 333 | case '$eq': 334 | rc = rc && (v == formator[i]); 335 | break; 336 | case '$in': 337 | rc = rc && (formator.indexOf(v) > -1); 338 | break; 339 | case 'yes': 340 | yes = formator[i]; 341 | break; 342 | case 'no': 343 | no = formator[i]; 344 | break; 345 | default: // 其他的不处理 346 | break; 347 | } 348 | } 349 | } else rc = false; 350 | v = rc ? yes : no; 351 | } 352 | 353 | } catch (error) { 354 | console.log(error); 355 | } 356 | } 357 | } 358 | sprite.spriteFrame = this.spriteFrame[v] || null; 359 | } 360 | }, 361 | toggleFunc: function (v) { 362 | this.toggle.forEach((one) => { 363 | if (one.val == v) { 364 | one.default.active = false; 365 | one.check.active = true; 366 | } else { 367 | one.default.active = true; 368 | one.check.active = false; 369 | } 370 | }); 371 | this.toggleCb && this.toggleCb(v); 372 | }, 373 | onDestroy() { 374 | let theV = this.val.split('.'); 375 | if (theV[0] == 'this') theV.shift(); // 先去掉this这一层 376 | theV.shift(); 377 | this.baseObj.unmap(theV.join('.'), this.func); 378 | this.baseObj = null; 379 | 380 | if (this.nodePoolList) { 381 | while (this.nodePoolList.length > 0) { 382 | this.nodePoolList[0].clear(); 383 | this.nodePoolList.splice(0, 1); 384 | } 385 | } 386 | }, 387 | 388 | getJs: function (node, pre) { 389 | var comp = node._components || []; 390 | for (var i = 0; i < comp.length; i++) { 391 | var name = comp[i].name.split('<'); 392 | if (name.length == 2) { 393 | if (name[1].indexOf(pre || 'pf') == 0) { 394 | return comp[i]; 395 | } else if (name[1].indexOf('ly') == 0) { 396 | return comp[i]; 397 | } else if (name[1].indexOf(name[0]) == 0) { 398 | return comp[i]; 399 | } 400 | } 401 | } 402 | return null; 403 | }, 404 | createNodePool: function (prefab, target) { // 需要生成的预制体, 预计需要放到那个节点 405 | this.nodePoolList = this.nodePoolList || []; 406 | let np = new cc.NodePool(); 407 | let getJs = this.getJs; 408 | this.nodePoolList.push(np); 409 | return { 410 | get: function (tt, parm, idx) { 411 | if (np.size() == 0) np.put(cc.instantiate(prefab)); 412 | let one = np.get(); 413 | let oneJs = getJs(one); 414 | one.parent = tt || target; 415 | if (oneJs && oneJs.init && parm) oneJs.init(parm, idx); 416 | return one; 417 | }, 418 | put: function (item) { // 单独放一个元素回来 419 | np.put(item); 420 | }, 421 | clear: function (tt) { // tt可选,如果没填,就用创建时的节点 422 | let children = (tt || target).children; 423 | for (let i = children.length - 1; i >= 0; i--) np.put(children[i]); 424 | }, 425 | size: function () { 426 | return np.size(); 427 | }, 428 | add: function () { 429 | np.put(cc.instantiate(prefab)); 430 | }, 431 | } 432 | 433 | }, 434 | }); 435 | -------------------------------------------------------------------------------- /assets/scripts/libs/ccBind.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "159cdfc1-60ac-4572-b89c-a58c61a6c097", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/scenes.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "5df18324-e611-4c38-8583-67a253594980", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scActive.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "829c7a16-c9df-4238-bca7-ccf7b9bcf164", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scActive/scActive.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.0", 3 | "uuid": "613af612-d982-4981-964c-c56a4571d40e", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scActive/scActive.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | btnBack: cc.Node, 6 | editBox: cc.EditBox, 7 | }, 8 | 9 | onLoad() { 10 | this.btnBack.on('click', () => { 11 | cc.director.loadScene('scMain'); 12 | }); 13 | 14 | this.node.input = ge.createBind({ 15 | num: '' 16 | }); 17 | 18 | this.node.isTimesOf3 = function (v) { 19 | if (parseFloat(v).toString() == "NaN") return false; 20 | return v % 3 == 0; 21 | }; 22 | }, 23 | 24 | // update (dt) {}, 25 | }); 26 | -------------------------------------------------------------------------------- /assets/scripts/scenes/scActive/scActive.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "2199d246-2d41-4f69-b128-d15b892cfd58", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scClick.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "01ae8095-68da-482e-965d-6688252effa8", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scClick/scClick.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.0", 3 | "uuid": "27bf489f-f108-40f6-ab40-dab28318dab7", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scClick/scClick.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | btnBack: cc.Node 6 | }, 7 | 8 | onLoad() { 9 | this.btnBack.on('click', () => { 10 | cc.director.loadScene('scMain'); 11 | }); 12 | 13 | let action = ge.createBind({ 14 | color: '' 15 | }); 16 | this.node.action = action; 17 | this.node.click = function (v, tag) { 18 | action.color = tag; 19 | }; 20 | 21 | this.node.txtFormat = function (v) { 22 | if (v) return '你点了' + v; 23 | else return '请选择你喜欢的颜色'; 24 | }; 25 | }, 26 | 27 | // update (dt) {}, 28 | }); 29 | -------------------------------------------------------------------------------- /assets/scripts/scenes/scClick/scClick.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "1e9a4ef3-5fb7-4d69-bc90-d7bbd5c0f0b0", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scDync.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "648a59c5-baaf-4840-9973-4368f0bda7f2", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scDync/scDync.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.0", 3 | "uuid": "954a75d2-bacf-4cef-8b8e-456e75073636", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scDync/scDync.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | btnBack: cc.Node, 6 | txtCounter: cc.Label, 7 | btn: cc.Node, 8 | btnTxt: cc.Label, 9 | }, 10 | 11 | onLoad() { 12 | this.btnBack.on('click', () => { 13 | cc.director.loadScene('scMain'); 14 | }); 15 | 16 | this.counter = ge.createBind({ 17 | dt: 0, 18 | ms: 100, 19 | control: { 20 | times: 0, 21 | } 22 | }); 23 | 24 | this.bindData(); 25 | this.btn.on('click', () => { 26 | if (this.btnTxt.string == '解绑') this.unbindData(); 27 | else this.bindData(); 28 | }); 29 | }, 30 | bindData() { 31 | if (!this.func) { 32 | this.func = () => { 33 | this.txtCounter.string = this.counter.control.times; 34 | } 35 | } 36 | this.btnTxt.string = '解绑'; 37 | this.counter.map('control.times', this.func); // 绑定的时候,不需要带上counter,多层用.链接起来 38 | }, 39 | unbindData() { 40 | if (!this.func) return; 41 | this.btnTxt.string = '绑定'; 42 | this.counter.unmap('control.times', this.func); 43 | }, 44 | update(dt) { 45 | let counter = this.counter; 46 | counter.dt += dt * 1000; 47 | if (counter.dt >= counter.ms) { 48 | counter.dt -= counter.ms; 49 | counter.control.times++; 50 | } 51 | }, 52 | }); 53 | -------------------------------------------------------------------------------- /assets/scripts/scenes/scDync/scDync.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "a7a9ecec-a154-40f1-8ddf-284204ea9272", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scGlobal.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "f4f34690-06c2-47c7-8265-2dfdb21d2a86", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scGlobal/scGlobal.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.0", 3 | "uuid": "92471ee6-2f29-4c3f-ad47-71f9a25b47e1", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scGlobal/scGlobal.js: -------------------------------------------------------------------------------- 1 | window.gu = ge.createBind({ 2 | enterTimes: 0, 3 | clickTimes: 0, 4 | }); 5 | gu.click = function () { 6 | gu.clickTimes++; 7 | } 8 | cc.Class({ 9 | extends: cc.Component, 10 | 11 | properties: { 12 | btnBack: cc.Node 13 | }, 14 | 15 | onLoad() { 16 | gu.enterTimes++; 17 | this.btnBack.on('click', () => { 18 | cc.director.loadScene('scMain'); 19 | }); 20 | }, 21 | 22 | // update (dt) {}, 23 | }); 24 | -------------------------------------------------------------------------------- /assets/scripts/scenes/scGlobal/scGlobal.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "f7c62681-a76f-46dd-a102-837931eea2cc", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scInput.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "d0402811-67a1-4045-aeb5-d7f85dfe51b2", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scInput/scInput.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.0", 3 | "uuid": "f7a18d38-9899-46bd-8298-28a0a4477edc", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scInput/scInput.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | btnBack: cc.Node, 6 | editBox: cc.EditBox, 7 | }, 8 | 9 | onLoad() { 10 | this.btnBack.on('click', () => { 11 | cc.director.loadScene('scMain'); 12 | }); 13 | 14 | this.node.input = ge.createBind({ 15 | txt: '' 16 | }); 17 | 18 | this.node.reverseFunc = function (v) { 19 | return '反过来(' + v.split('').reverse().join('') + ')'; 20 | }; 21 | }, 22 | 23 | // update (dt) {}, 24 | }); 25 | -------------------------------------------------------------------------------- /assets/scripts/scenes/scInput/scInput.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "5ab2c396-b260-44cc-9136-b2d0d5030cef", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scList.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "a89e48cb-073c-40ba-84a8-78468750cb5d", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scList/scList.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.0", 3 | "uuid": "403dc6d5-4648-4483-83da-eb2effc13f16", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scList/scList.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | btnBack: cc.Node, 6 | editBox: cc.EditBox, 7 | }, 8 | 9 | onLoad() { 10 | this.btnBack.on('click', () => { 11 | cc.director.loadScene('scMain'); 12 | }); 13 | 14 | let todos = ge.createBind({ 15 | next: '', // 绑定editBox 16 | list: [ 17 | '明天记得睡懒觉', 18 | 19 | ] 20 | }); 21 | 22 | this.editBox.node.on('editing-return', () => { 23 | todos.list.push(todos.next); 24 | todos.next = ''; 25 | }); 26 | 27 | this.node.todos = todos; 28 | }, 29 | 30 | // update (dt) {}, 31 | }); 32 | -------------------------------------------------------------------------------- /assets/scripts/scenes/scList/scList.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "ae29937c-7424-48f9-be51-52b01daba99e", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scList/toDoItem.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | date: cc.Label, 6 | txt: cc.Label, 7 | close: cc.Node, 8 | }, 9 | 10 | // LIFE-CYCLE CALLBACKS: 11 | 12 | // onLoad () {}, 13 | 14 | init(parm, idx) { 15 | let date = new Date(); 16 | this.date.string = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + (date.getDate()); 17 | this.txt.string = parm; 18 | 19 | this.node.closeMe = (val) => { 20 | if (val) val.splice(idx, 1); 21 | } 22 | }, 23 | 24 | // update (dt) {}, 25 | }); 26 | -------------------------------------------------------------------------------- /assets/scripts/scenes/scList/toDoItem.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "9dd7154f-4f08-41c3-a086-73d6a2f7f560", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scMain.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "66bba30e-b713-452d-aa74-025620d7fa8b", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scMain/prefab.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "d1526dc4-bcfe-4838-9798-a2f20e52f5b0", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scMain/prefab/pfBtn.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | txt: cc.Label, 6 | }, 7 | 8 | init(parm) { // 双向绑定中,指定的初始化入口 9 | this.txt.string = parm.name; 10 | this.node.on('click', () => { 11 | // console.log(parm.scene); 12 | if (parm.scene) cc.director.loadScene(parm.scene); 13 | }) 14 | }, 15 | 16 | // update (dt) {}, 17 | }); 18 | -------------------------------------------------------------------------------- /assets/scripts/scenes/scMain/prefab/pfBtn.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "a10388bd-05f0-4fa4-b5e1-c07ba4a56635", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scMain/prefab/pfBtn.prefab: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.Prefab", 4 | "_name": "", 5 | "_objFlags": 0, 6 | "_native": "", 7 | "data": { 8 | "__id__": 1 9 | }, 10 | "optimizationPolicy": 0, 11 | "asyncLoadAssets": false, 12 | "readonly": false 13 | }, 14 | { 15 | "__type__": "cc.Node", 16 | "_name": "pfBtn", 17 | "_objFlags": 0, 18 | "_parent": null, 19 | "_children": [ 20 | { 21 | "__id__": 2 22 | } 23 | ], 24 | "_active": true, 25 | "_level": 1, 26 | "_components": [ 27 | { 28 | "__id__": 5 29 | }, 30 | { 31 | "__id__": 6 32 | }, 33 | { 34 | "__id__": 7 35 | } 36 | ], 37 | "_prefab": { 38 | "__id__": 8 39 | }, 40 | "_opacity": 255, 41 | "_color": { 42 | "__type__": "cc.Color", 43 | "r": 0, 44 | "g": 0, 45 | "b": 0, 46 | "a": 255 47 | }, 48 | "_contentSize": { 49 | "__type__": "cc.Size", 50 | "width": 400, 51 | "height": 60 52 | }, 53 | "_anchorPoint": { 54 | "__type__": "cc.Vec2", 55 | "x": 0.5, 56 | "y": 0.5 57 | }, 58 | "_position": { 59 | "__type__": "cc.Vec3", 60 | "x": 0, 61 | "y": 495.561, 62 | "z": 0 63 | }, 64 | "_scale": { 65 | "__type__": "cc.Vec3", 66 | "x": 1, 67 | "y": 1, 68 | "z": 1 69 | }, 70 | "_eulerAngles": { 71 | "__type__": "cc.Vec3", 72 | "x": 0, 73 | "y": 0, 74 | "z": 0 75 | }, 76 | "_skewX": 0, 77 | "_skewY": 0, 78 | "_is3DNode": false, 79 | "groupIndex": 0, 80 | "_id": "" 81 | }, 82 | { 83 | "__type__": "cc.Node", 84 | "_name": "txt", 85 | "_objFlags": 0, 86 | "_parent": { 87 | "__id__": 1 88 | }, 89 | "_children": [], 90 | "_active": true, 91 | "_level": 3, 92 | "_components": [ 93 | { 94 | "__id__": 3 95 | } 96 | ], 97 | "_prefab": { 98 | "__id__": 4 99 | }, 100 | "_opacity": 255, 101 | "_color": { 102 | "__type__": "cc.Color", 103 | "r": 0, 104 | "g": 0, 105 | "b": 0, 106 | "a": 255 107 | }, 108 | "_contentSize": { 109 | "__type__": "cc.Size", 110 | "width": 76, 111 | "height": 50.4 112 | }, 113 | "_anchorPoint": { 114 | "__type__": "cc.Vec2", 115 | "x": 0.5, 116 | "y": 0.5 117 | }, 118 | "_position": { 119 | "__type__": "cc.Vec3", 120 | "x": 0, 121 | "y": 0, 122 | "z": 0 123 | }, 124 | "_scale": { 125 | "__type__": "cc.Vec3", 126 | "x": 1, 127 | "y": 1, 128 | "z": 1 129 | }, 130 | "_eulerAngles": { 131 | "__type__": "cc.Vec3", 132 | "x": 0, 133 | "y": 0, 134 | "z": 0 135 | }, 136 | "_skewX": 0, 137 | "_skewY": 0, 138 | "_is3DNode": false, 139 | "groupIndex": 0, 140 | "_rotationX": 0, 141 | "_rotationY": 0, 142 | "_id": "" 143 | }, 144 | { 145 | "__type__": "cc.Label", 146 | "_name": "", 147 | "_objFlags": 0, 148 | "node": { 149 | "__id__": 2 150 | }, 151 | "_enabled": true, 152 | "_materials": [ 153 | { 154 | "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" 155 | } 156 | ], 157 | "_useOriginalSize": false, 158 | "_string": "入门", 159 | "_N$string": "入门", 160 | "_fontSize": 38, 161 | "_lineHeight": 40, 162 | "_enableWrapText": true, 163 | "_N$file": null, 164 | "_isSystemFontUsed": true, 165 | "_spacingX": 0, 166 | "_batchAsBitmap": false, 167 | "_N$horizontalAlign": 1, 168 | "_N$verticalAlign": 1, 169 | "_N$fontFamily": "Arial", 170 | "_N$overflow": 0, 171 | "_N$cacheMode": 0, 172 | "_id": "" 173 | }, 174 | { 175 | "__type__": "cc.PrefabInfo", 176 | "root": { 177 | "__id__": 1 178 | }, 179 | "asset": { 180 | "__uuid__": "1d95edfd-42cf-405d-89e0-7eb653dc02da" 181 | }, 182 | "fileId": "3fnxfXco1IlaqEURfZ86H8", 183 | "sync": false 184 | }, 185 | { 186 | "__type__": "cc.Sprite", 187 | "_name": "", 188 | "_objFlags": 0, 189 | "node": { 190 | "__id__": 1 191 | }, 192 | "_enabled": true, 193 | "_materials": [ 194 | { 195 | "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" 196 | } 197 | ], 198 | "_srcBlendFactor": 770, 199 | "_dstBlendFactor": 771, 200 | "_spriteFrame": { 201 | "__uuid__": "6a57d65b-aa89-4ec0-88b9-3384096b9122" 202 | }, 203 | "_type": 1, 204 | "_sizeMode": 0, 205 | "_fillType": 0, 206 | "_fillCenter": { 207 | "__type__": "cc.Vec2", 208 | "x": 0, 209 | "y": 0 210 | }, 211 | "_fillStart": 0, 212 | "_fillRange": 0, 213 | "_isTrimmedMode": true, 214 | "_atlas": null, 215 | "_id": "" 216 | }, 217 | { 218 | "__type__": "cc.Button", 219 | "_name": "", 220 | "_objFlags": 0, 221 | "node": { 222 | "__id__": 1 223 | }, 224 | "_enabled": true, 225 | "duration": 0.1, 226 | "zoomScale": 1.2, 227 | "clickEvents": [], 228 | "_N$interactable": true, 229 | "_N$enableAutoGrayEffect": false, 230 | "_N$transition": 0, 231 | "transition": 0, 232 | "_N$normalColor": { 233 | "__type__": "cc.Color", 234 | "r": 214, 235 | "g": 214, 236 | "b": 214, 237 | "a": 255 238 | }, 239 | "_N$pressedColor": { 240 | "__type__": "cc.Color", 241 | "r": 211, 242 | "g": 211, 243 | "b": 211, 244 | "a": 255 245 | }, 246 | "pressedColor": { 247 | "__type__": "cc.Color", 248 | "r": 211, 249 | "g": 211, 250 | "b": 211, 251 | "a": 255 252 | }, 253 | "_N$hoverColor": { 254 | "__type__": "cc.Color", 255 | "r": 255, 256 | "g": 255, 257 | "b": 255, 258 | "a": 255 259 | }, 260 | "hoverColor": { 261 | "__type__": "cc.Color", 262 | "r": 255, 263 | "g": 255, 264 | "b": 255, 265 | "a": 255 266 | }, 267 | "_N$disabledColor": { 268 | "__type__": "cc.Color", 269 | "r": 124, 270 | "g": 124, 271 | "b": 124, 272 | "a": 255 273 | }, 274 | "_N$normalSprite": null, 275 | "_N$pressedSprite": null, 276 | "pressedSprite": null, 277 | "_N$hoverSprite": null, 278 | "hoverSprite": null, 279 | "_N$disabledSprite": null, 280 | "_N$target": null, 281 | "_id": "" 282 | }, 283 | { 284 | "__type__": "a1038i9BfBPpLXhwHukpWY1", 285 | "_name": "", 286 | "_objFlags": 0, 287 | "node": { 288 | "__id__": 1 289 | }, 290 | "_enabled": true, 291 | "txt": { 292 | "__id__": 3 293 | }, 294 | "_id": "" 295 | }, 296 | { 297 | "__type__": "cc.PrefabInfo", 298 | "root": { 299 | "__id__": 1 300 | }, 301 | "asset": { 302 | "__uuid__": "1d95edfd-42cf-405d-89e0-7eb653dc02da" 303 | }, 304 | "fileId": "85mLsGkANM6q6uPLbKQE8b", 305 | "sync": false 306 | } 307 | ] -------------------------------------------------------------------------------- /assets/scripts/scenes/scMain/prefab/pfBtn.prefab.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.0", 3 | "uuid": "1d95edfd-42cf-405d-89e0-7eb653dc02da", 4 | "optimizationPolicy": "AUTO", 5 | "asyncLoadAssets": false, 6 | "readonly": false, 7 | "subMetas": {} 8 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scMain/scMain.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.0", 3 | "uuid": "4dc07327-a16c-4d2f-ba48-39569123dc1a", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scMain/scMain.js: -------------------------------------------------------------------------------- 1 | require('init'); // 全局初始化 2 | 3 | cc.Class({ 4 | extends: cc.Component, 5 | 6 | properties: { 7 | 8 | }, 9 | 10 | // LIFE-CYCLE CALLBACKS: 11 | 12 | onLoad() { 13 | this.node.btnsList = ge.createBind({ 14 | btns: [ 15 | { name: '输入同步', scene: 'scInput' }, 16 | { name: '显示和隐藏', scene: 'scActive' }, 17 | { name: '点击事件', scene: 'scClick' }, 18 | { name: '图片切换', scene: 'scSprite' }, 19 | { name: '数组列表', scene: 'scList' }, 20 | { name: '分页栏', scene: 'scTab' }, 21 | { name: '全局绑定', scene: 'scGlobal' }, 22 | { name: '动态代码绑定', scene: 'scDync' }, 23 | ] 24 | }) 25 | }, 26 | 27 | 28 | 29 | // update (dt) {}, 30 | }); 31 | -------------------------------------------------------------------------------- /assets/scripts/scenes/scMain/scMain.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "5d785c49-85db-4c6d-afc8-b995a7992668", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scSprite.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "28a8f0e4-7a71-40d4-9168-7502cac91b8d", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scSprite/scSprite.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.0", 3 | "uuid": "2377f878-bb4e-4e8e-84be-2ced63d74666", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scSprite/scSprite.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | btnBack: cc.Node 6 | }, 7 | 8 | onLoad() { 9 | this.btnBack.on('click', () => { 10 | cc.director.loadScene('scMain'); 11 | }); 12 | 13 | this.node.deer = ge.createBind({ 14 | ms: 100, 15 | num: 4, 16 | idx: 0 17 | }); 18 | this.dt = 0; 19 | }, 20 | 21 | update(dt) { 22 | this.dt += dt * 1000; 23 | let deer = this.node.deer; 24 | if (this.dt >= deer.ms) { 25 | this.dt -= deer.ms; 26 | deer.idx = (deer.idx + 1) % deer.num; 27 | } 28 | }, 29 | }); 30 | -------------------------------------------------------------------------------- /assets/scripts/scenes/scSprite/scSprite.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "19c34ac6-4aa8-475f-8854-8d0baa251b96", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scTab.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "a38fa691-83a4-4970-902b-b43c06767574", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scTab/scTab.fire.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.0", 3 | "uuid": "93241253-c0d4-4d1a-90bc-7dd161fc8a42", 4 | "asyncLoadAssets": false, 5 | "autoReleaseAssets": false, 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/scripts/scenes/scTab/scTab.js: -------------------------------------------------------------------------------- 1 | cc.Class({ 2 | extends: cc.Component, 3 | 4 | properties: { 5 | btnBack: cc.Node, 6 | txt: cc.Label, 7 | }, 8 | 9 | onLoad() { 10 | this.btnBack.on('click', () => { 11 | cc.director.loadScene('scMain'); 12 | }); 13 | 14 | this.node.tabs = ge.createBind({ 15 | idx: 0, 16 | }); 17 | 18 | 19 | this.node.select = (idx) => { 20 | this.txt.string = '您选择了\n' + ['国王', '皇后', '骑士', '修道士'][idx]; 21 | } 22 | }, 23 | 24 | }); 25 | -------------------------------------------------------------------------------- /assets/scripts/scenes/scTab/scTab.js.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.5", 3 | "uuid": "05f82108-8334-4a67-a539-2808a5ad993b", 4 | "isPlugin": false, 5 | "loadPluginInWeb": true, 6 | "loadPluginInNative": true, 7 | "loadPluginInEditor": false, 8 | "subMetas": {} 9 | } -------------------------------------------------------------------------------- /assets/textures.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.0.1", 3 | "uuid": "7d575d35-32b5-41c2-8b79-44bee0b86de8", 4 | "isSubpackage": false, 5 | "subpackageName": "", 6 | "subMetas": {} 7 | } -------------------------------------------------------------------------------- /assets/textures/AutoAtlas.pac: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.SpriteAtlas" 3 | } -------------------------------------------------------------------------------- /assets/textures/AutoAtlas.pac.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "1.2.0", 3 | "uuid": "bc59cac1-584e-47b0-84f4-576beccd94c8", 4 | "maxWidth": 512, 5 | "maxHeight": 512, 6 | "padding": 2, 7 | "allowRotation": true, 8 | "forceSquared": false, 9 | "powerOfTwo": false, 10 | "algorithm": "MaxRects", 11 | "format": "png", 12 | "quality": 80, 13 | "contourBleed": true, 14 | "paddingBleed": true, 15 | "filterUnused": false, 16 | "platformSettings": {}, 17 | "subMetas": {} 18 | } -------------------------------------------------------------------------------- /assets/textures/avatarKing.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/avatarKing.png -------------------------------------------------------------------------------- /assets/textures/avatarKing.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "ca026742-e03a-447f-bb82-55a1210ed521", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "avatarKing": { 11 | "ver": "1.0.4", 12 | "uuid": "94d0d0fc-530e-466f-99de-49ab0aa49419", 13 | "rawTextureUuid": "ca026742-e03a-447f-bb82-55a1210ed521", 14 | "trimType": "custom", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 198, 22 | "height": 228, 23 | "rawWidth": 198, 24 | "rawHeight": 228, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/textures/avatarKnight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/avatarKnight.png -------------------------------------------------------------------------------- /assets/textures/avatarKnight.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "00c5ec75-32e4-4945-a60c-33c0fc2f03f7", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "avatarKnight": { 11 | "ver": "1.0.4", 12 | "uuid": "c31abcce-ea76-4d29-80e9-6d8ca3012fef", 13 | "rawTextureUuid": "00c5ec75-32e4-4945-a60c-33c0fc2f03f7", 14 | "trimType": "custom", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 198, 22 | "height": 228, 23 | "rawWidth": 198, 24 | "rawHeight": 228, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/textures/avatarMonk.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/avatarMonk.png -------------------------------------------------------------------------------- /assets/textures/avatarMonk.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "fe05add9-3ffe-455c-b283-e89e44825cea", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "avatarMonk": { 11 | "ver": "1.0.4", 12 | "uuid": "3d0a644c-838c-44fc-af06-c6708bae3a5c", 13 | "rawTextureUuid": "fe05add9-3ffe-455c-b283-e89e44825cea", 14 | "trimType": "custom", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 198, 22 | "height": 228, 23 | "rawWidth": 198, 24 | "rawHeight": 228, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/textures/avatarQueen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/avatarQueen.png -------------------------------------------------------------------------------- /assets/textures/avatarQueen.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "708782f6-ceff-41cb-bec8-4461ac137e35", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "avatarQueen": { 11 | "ver": "1.0.4", 12 | "uuid": "3e377583-da1a-4deb-95e6-6505ccf294d0", 13 | "rawTextureUuid": "708782f6-ceff-41cb-bec8-4461ac137e35", 14 | "trimType": "custom", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 198, 22 | "height": 228, 23 | "rawWidth": 198, 24 | "rawHeight": 228, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/textures/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/back.png -------------------------------------------------------------------------------- /assets/textures/back.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "3dacf06e-0601-4325-8ac7-ae582082638b", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "back": { 11 | "ver": "1.0.4", 12 | "uuid": "ef05343e-0d0d-4fff-ac76-f21a522d8e60", 13 | "rawTextureUuid": "3dacf06e-0601-4325-8ac7-ae582082638b", 14 | "trimType": "custom", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 64, 22 | "height": 64, 23 | "rawWidth": 64, 24 | "rawHeight": 64, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/textures/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/bg.png -------------------------------------------------------------------------------- /assets/textures/bg.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "4e16c52d-d987-4577-84a6-ca76cab96ffc", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "bg": { 11 | "ver": "1.0.4", 12 | "uuid": "23a7ba7d-64fb-4c10-8a87-fe352edf3f4d", 13 | "rawTextureUuid": "4e16c52d-d987-4577-84a6-ca76cab96ffc", 14 | "trimType": "auto", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 64, 22 | "height": 64, 23 | "rawWidth": 64, 24 | "rawHeight": 64, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/textures/bg32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/bg32.png -------------------------------------------------------------------------------- /assets/textures/bg32.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "c56bdf06-1ab2-4abd-820f-52ef55af9019", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "bg32": { 11 | "ver": "1.0.4", 12 | "uuid": "82c86d17-a7d0-4deb-9f9c-f9c920b88a1b", 13 | "rawTextureUuid": "c56bdf06-1ab2-4abd-820f-52ef55af9019", 14 | "trimType": "custom", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 64, 22 | "height": 64, 23 | "rawWidth": 64, 24 | "rawHeight": 64, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/textures/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/close.png -------------------------------------------------------------------------------- /assets/textures/close.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "fd25bba4-2c2f-498d-8565-0360e890bf67", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "close": { 11 | "ver": "1.0.4", 12 | "uuid": "8160256e-0721-4c16-8a93-610c7ffa87ec", 13 | "rawTextureUuid": "fd25bba4-2c2f-498d-8565-0360e890bf67", 14 | "trimType": "custom", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 64, 22 | "height": 64, 23 | "rawWidth": 64, 24 | "rawHeight": 64, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/textures/deer1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/deer1.png -------------------------------------------------------------------------------- /assets/textures/deer1.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "34a33c03-5990-4a44-a7ce-8c0cec423498", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "deer1": { 11 | "ver": "1.0.4", 12 | "uuid": "8386f7e0-fc08-4289-8363-db43fa4d4301", 13 | "rawTextureUuid": "34a33c03-5990-4a44-a7ce-8c0cec423498", 14 | "trimType": "custom", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 38, 22 | "height": 49, 23 | "rawWidth": 38, 24 | "rawHeight": 49, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/textures/deer2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/deer2.png -------------------------------------------------------------------------------- /assets/textures/deer2.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "53576989-a79d-417a-9d04-dd954ac43353", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "deer2": { 11 | "ver": "1.0.4", 12 | "uuid": "5beab3b7-acdb-4aa4-b98b-a2db6a12c88d", 13 | "rawTextureUuid": "53576989-a79d-417a-9d04-dd954ac43353", 14 | "trimType": "custom", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 38, 22 | "height": 49, 23 | "rawWidth": 38, 24 | "rawHeight": 49, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/textures/deer3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/deer3.png -------------------------------------------------------------------------------- /assets/textures/deer3.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "d9be933a-a585-41fb-b113-cd0ca6a86f8c", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "deer3": { 11 | "ver": "1.0.4", 12 | "uuid": "bbbc32b6-f562-4f98-ac84-2a9b75866a9e", 13 | "rawTextureUuid": "d9be933a-a585-41fb-b113-cd0ca6a86f8c", 14 | "trimType": "custom", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 38, 22 | "height": 49, 23 | "rawWidth": 38, 24 | "rawHeight": 49, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/textures/deer4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/deer4.png -------------------------------------------------------------------------------- /assets/textures/deer4.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "ca6d35ee-e30b-4e38-ab46-e6c332fcaaa8", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "deer4": { 11 | "ver": "1.0.4", 12 | "uuid": "654e73bf-b439-4879-bf94-3188eedc6133", 13 | "rawTextureUuid": "ca6d35ee-e30b-4e38-ab46-e6c332fcaaa8", 14 | "trimType": "custom", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 38, 22 | "height": 49, 23 | "rawWidth": 38, 24 | "rawHeight": 49, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/textures/outline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/outline.png -------------------------------------------------------------------------------- /assets/textures/outline.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "5b79df78-16c8-4e30-89b2-b957cfdd7d6d", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "outline": { 11 | "ver": "1.0.4", 12 | "uuid": "6a57d65b-aa89-4ec0-88b9-3384096b9122", 13 | "rawTextureUuid": "5b79df78-16c8-4e30-89b2-b957cfdd7d6d", 14 | "trimType": "auto", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 32, 22 | "height": 32, 23 | "rawWidth": 32, 24 | "rawHeight": 32, 25 | "borderTop": 16, 26 | "borderBottom": 16, 27 | "borderLeft": 16, 28 | "borderRight": 16, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /assets/textures/share.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/assets/textures/share.png -------------------------------------------------------------------------------- /assets/textures/share.png.meta: -------------------------------------------------------------------------------- 1 | { 2 | "ver": "2.3.1", 3 | "uuid": "fd87a933-4904-48e4-8779-a31b7c6ce235", 4 | "type": "sprite", 5 | "wrapMode": "clamp", 6 | "filterMode": "bilinear", 7 | "premultiplyAlpha": false, 8 | "platformSettings": {}, 9 | "subMetas": { 10 | "share": { 11 | "ver": "1.0.4", 12 | "uuid": "36607152-1397-4b95-9033-5f3b996e53c5", 13 | "rawTextureUuid": "fd87a933-4904-48e4-8779-a31b7c6ce235", 14 | "trimType": "custom", 15 | "trimThreshold": 1, 16 | "rotated": false, 17 | "offsetX": 0, 18 | "offsetY": 0, 19 | "trimX": 0, 20 | "trimY": 0, 21 | "width": 64, 22 | "height": 64, 23 | "rawWidth": 64, 24 | "rawHeight": 64, 25 | "borderTop": 0, 26 | "borderBottom": 0, 27 | "borderLeft": 0, 28 | "borderRight": 0, 29 | "subMetas": {} 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Cocos Creator | theBind 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 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 | 77 | 78 | 79 | -------------------------------------------------------------------------------- /example/main.js: -------------------------------------------------------------------------------- 1 | // QQPlay window need to be inited first 2 | if (false) { 3 | BK.Script.loadlib('GameRes://libs/qqplay-adapter.js'); 4 | } 5 | 6 | window.boot = function () { 7 | var settings = window._CCSettings; 8 | window._CCSettings = undefined; 9 | 10 | if ( !settings.debug ) { 11 | var uuids = settings.uuids; 12 | 13 | var rawAssets = settings.rawAssets; 14 | var assetTypes = settings.assetTypes; 15 | var realRawAssets = settings.rawAssets = {}; 16 | for (var mount in rawAssets) { 17 | var entries = rawAssets[mount]; 18 | var realEntries = realRawAssets[mount] = {}; 19 | for (var id in entries) { 20 | var entry = entries[id]; 21 | var type = entry[1]; 22 | // retrieve minified raw asset 23 | if (typeof type === 'number') { 24 | entry[1] = assetTypes[type]; 25 | } 26 | // retrieve uuid 27 | realEntries[uuids[id] || id] = entry; 28 | } 29 | } 30 | 31 | var scenes = settings.scenes; 32 | for (var i = 0; i < scenes.length; ++i) { 33 | var scene = scenes[i]; 34 | if (typeof scene.uuid === 'number') { 35 | scene.uuid = uuids[scene.uuid]; 36 | } 37 | } 38 | 39 | var packedAssets = settings.packedAssets; 40 | for (var packId in packedAssets) { 41 | var packedIds = packedAssets[packId]; 42 | for (var j = 0; j < packedIds.length; ++j) { 43 | if (typeof packedIds[j] === 'number') { 44 | packedIds[j] = uuids[packedIds[j]]; 45 | } 46 | } 47 | } 48 | 49 | var subpackages = settings.subpackages; 50 | for (var subId in subpackages) { 51 | var uuidArray = subpackages[subId].uuids; 52 | if (uuidArray) { 53 | for (var k = 0, l = uuidArray.length; k < l; k++) { 54 | if (typeof uuidArray[k] === 'number') { 55 | uuidArray[k] = uuids[uuidArray[k]]; 56 | } 57 | } 58 | } 59 | } 60 | } 61 | 62 | function setLoadingDisplay () { 63 | // Loading splash scene 64 | var splash = document.getElementById('splash'); 65 | var progressBar = splash.querySelector('.progress-bar span'); 66 | cc.loader.onProgress = function (completedCount, totalCount, item) { 67 | var percent = 100 * completedCount / totalCount; 68 | if (progressBar) { 69 | progressBar.style.width = percent.toFixed(2) + '%'; 70 | } 71 | }; 72 | splash.style.display = 'block'; 73 | progressBar.style.width = '0%'; 74 | 75 | cc.director.once(cc.Director.EVENT_AFTER_SCENE_LAUNCH, function () { 76 | splash.style.display = 'none'; 77 | }); 78 | } 79 | 80 | var onStart = function () { 81 | cc.loader.downloader._subpackages = settings.subpackages; 82 | 83 | cc.view.enableRetina(true); 84 | cc.view.resizeWithBrowserSize(true); 85 | 86 | if (!false && !false) { 87 | if (cc.sys.isBrowser) { 88 | setLoadingDisplay(); 89 | } 90 | 91 | if (cc.sys.isMobile) { 92 | if (settings.orientation === 'landscape') { 93 | cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE); 94 | } 95 | else if (settings.orientation === 'portrait') { 96 | cc.view.setOrientation(cc.macro.ORIENTATION_PORTRAIT); 97 | } 98 | cc.view.enableAutoFullScreen([ 99 | cc.sys.BROWSER_TYPE_BAIDU, 100 | cc.sys.BROWSER_TYPE_WECHAT, 101 | cc.sys.BROWSER_TYPE_MOBILE_QQ, 102 | cc.sys.BROWSER_TYPE_MIUI, 103 | ].indexOf(cc.sys.browserType) < 0); 104 | } 105 | 106 | // Limit downloading max concurrent task to 2, 107 | // more tasks simultaneously may cause performance draw back on some android system / browsers. 108 | // You can adjust the number based on your own test result, you have to set it before any loading process to take effect. 109 | if (cc.sys.isBrowser && cc.sys.os === cc.sys.OS_ANDROID) { 110 | cc.macro.DOWNLOAD_MAX_CONCURRENT = 2; 111 | } 112 | } 113 | 114 | function loadScene(launchScene) { 115 | cc.director.loadScene(launchScene, null, 116 | function () { 117 | if (cc.sys.isBrowser) { 118 | // show canvas 119 | var canvas = document.getElementById('GameCanvas'); 120 | canvas.style.visibility = ''; 121 | var div = document.getElementById('GameDiv'); 122 | if (div) { 123 | div.style.backgroundImage = ''; 124 | } 125 | } 126 | cc.loader.onProgress = null; 127 | console.log('Success to load scene: ' + launchScene); 128 | } 129 | ); 130 | 131 | } 132 | 133 | var launchScene = settings.launchScene; 134 | 135 | // load scene 136 | loadScene(launchScene); 137 | 138 | }; 139 | 140 | // jsList 141 | var jsList = settings.jsList; 142 | 143 | if (false) { 144 | BK.Script.loadlib(); 145 | } 146 | else { 147 | var bundledScript = settings.debug ? 'src/project.dev.js' : 'src/project.js'; 148 | if (jsList) { 149 | jsList = jsList.map(function (x) { 150 | return 'src/' + x; 151 | }); 152 | jsList.push(bundledScript); 153 | } 154 | else { 155 | jsList = [bundledScript]; 156 | } 157 | } 158 | 159 | var option = { 160 | id: 'GameCanvas', 161 | scenes: settings.scenes, 162 | debugMode: settings.debug ? cc.debug.DebugMode.INFO : cc.debug.DebugMode.ERROR, 163 | showFPS: !false && settings.debug, 164 | frameRate: 60, 165 | jsList: jsList, 166 | groupList: settings.groupList, 167 | collisionMatrix: settings.collisionMatrix, 168 | } 169 | 170 | // init assets 171 | cc.AssetLibrary.init({ 172 | libraryPath: 'res/import', 173 | rawAssetsBase: 'res/raw-', 174 | rawAssets: settings.rawAssets, 175 | packedAssets: settings.packedAssets, 176 | md5AssetsMap: settings.md5AssetsMap, 177 | subpackages: settings.subpackages 178 | }); 179 | 180 | cc.game.run(option, onStart); 181 | }; 182 | 183 | // main.js is qqplay and jsb platform entry file, so we must leave platform init code here 184 | if (false) { 185 | BK.Script.loadlib('GameRes://src/settings.js'); 186 | BK.Script.loadlib(); 187 | BK.Script.loadlib('GameRes://libs/qqplay-downloader.js'); 188 | 189 | var ORIENTATIONS = { 190 | 'portrait': 1, 191 | 'landscape left': 2, 192 | 'landscape right': 3 193 | }; 194 | BK.Director.screenMode = ORIENTATIONS[window._CCSettings.orientation]; 195 | initAdapter(); 196 | cc.game.once(cc.game.EVENT_ENGINE_INITED, function () { 197 | initRendererAdapter(); 198 | }); 199 | 200 | qqPlayDownloader.REMOTE_SERVER_ROOT = ""; 201 | var prevPipe = cc.loader.md5Pipe || cc.loader.assetLoader; 202 | cc.loader.insertPipeAfter(prevPipe, qqPlayDownloader); 203 | 204 | window.boot(); 205 | } 206 | else if (window.jsb) { 207 | 208 | var isRuntime = (typeof loadRuntime === 'function'); 209 | if (isRuntime) { 210 | require('src/settings.js'); 211 | require('src/cocos2d-runtime.js'); 212 | require('jsb-adapter/engine/index.js'); 213 | } 214 | else { 215 | require('src/settings.js'); 216 | require('src/cocos2d-jsb.js'); 217 | require('jsb-adapter/jsb-engine.js'); 218 | } 219 | 220 | cc.macro.CLEANUP_IMAGE_CACHE = true; 221 | window.boot(); 222 | } -------------------------------------------------------------------------------- /example/res/import/01/0131d8cf3.json: -------------------------------------------------------------------------------- 1 | [ 2 | [ 3 | { 4 | "__type__": "cc.SceneAsset", 5 | "_name": "scSprite", 6 | "scene": { 7 | "__id__": 1 8 | }, 9 | "asyncLoadAssets": null 10 | }, 11 | { 12 | "__type__": "cc.Scene", 13 | "_name": "New Node", 14 | "_children": [ 15 | { 16 | "__id__": 2 17 | } 18 | ], 19 | "_anchorPoint": { 20 | "__type__": "cc.Vec2" 21 | }, 22 | "autoReleaseAssets": false 23 | }, 24 | { 25 | "__type__": "cc.Node", 26 | "_name": "Canvas", 27 | "_parent": { 28 | "__id__": 1 29 | }, 30 | "_children": [ 31 | { 32 | "__id__": 3 33 | }, 34 | { 35 | "__id__": 4 36 | } 37 | ], 38 | "_components": [ 39 | { 40 | "__type__": "cc.Canvas", 41 | "node": { 42 | "__id__": 2 43 | }, 44 | "_designResolution": { 45 | "__type__": "cc.Size", 46 | "width": 720, 47 | "height": 1280 48 | } 49 | }, 50 | { 51 | "__type__": "19c34rGSqhHX4hUjQuqJRuW", 52 | "node": { 53 | "__id__": 2 54 | }, 55 | "btnBack": { 56 | "__id__": 6 57 | } 58 | } 59 | ], 60 | "_contentSize": { 61 | "__type__": "cc.Size", 62 | "width": 720, 63 | "height": 1280 64 | }, 65 | "_position": { 66 | "__type__": "cc.Vec3", 67 | "x": 360, 68 | "y": 640 69 | }, 70 | "_id": "a42S99IlBAaZbxW44TfsmU" 71 | }, 72 | { 73 | "__type__": "cc.Node", 74 | "_name": "Main Camera", 75 | "_parent": { 76 | "__id__": 2 77 | }, 78 | "_level": 1, 79 | "_components": [ 80 | { 81 | "__type__": "cc.Camera", 82 | "node": { 83 | "__id__": 3 84 | }, 85 | "_clearFlags": 7, 86 | "_depth": -1 87 | } 88 | ] 89 | }, 90 | { 91 | "__type__": "cc.Node", 92 | "_name": "bg", 93 | "_parent": { 94 | "__id__": 2 95 | }, 96 | "_children": [ 97 | { 98 | "__id__": 5 99 | } 100 | ], 101 | "_level": 1, 102 | "_components": [ 103 | { 104 | "__type__": "cc.Sprite", 105 | "node": { 106 | "__id__": 4 107 | }, 108 | "_materials": [ 109 | { 110 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 111 | } 112 | ], 113 | "_spriteFrame": { 114 | "__uuid__": "23p7p9ZPtMEIqH/jUu3z9N" 115 | }, 116 | "_sizeMode": 0 117 | }, 118 | { 119 | "__type__": "cc.Widget", 120 | "node": { 121 | "__id__": 4 122 | }, 123 | "_alignFlags": 45, 124 | "_originalWidth": 64, 125 | "_originalHeight": 64 126 | } 127 | ], 128 | "_contentSize": { 129 | "__type__": "cc.Size", 130 | "width": 720, 131 | "height": 1280 132 | } 133 | }, 134 | { 135 | "__type__": "cc.Node", 136 | "_name": "title", 137 | "_parent": { 138 | "__id__": 4 139 | }, 140 | "_children": [ 141 | { 142 | "__id__": 6 143 | }, 144 | { 145 | "__id__": 7 146 | }, 147 | { 148 | "__id__": 8 149 | } 150 | ], 151 | "_level": 2, 152 | "_components": [ 153 | { 154 | "__type__": "cc.Label", 155 | "node": { 156 | "__id__": 5 157 | }, 158 | "_materials": [ 159 | { 160 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 161 | } 162 | ], 163 | "_useOriginalSize": false, 164 | "_string": "图片切换", 165 | "_N$string": "图片切换", 166 | "_fontSize": 48, 167 | "_lineHeight": 64, 168 | "_N$horizontalAlign": 1, 169 | "_N$verticalAlign": 1, 170 | "_N$overflow": 1 171 | }, 172 | { 173 | "__type__": "cc.Widget", 174 | "node": { 175 | "__id__": 5 176 | }, 177 | "_alignFlags": 41, 178 | "_originalWidth": 128 179 | } 180 | ], 181 | "_color": { 182 | "__type__": "cc.Color" 183 | }, 184 | "_contentSize": { 185 | "__type__": "cc.Size", 186 | "width": 720, 187 | "height": 80.64 188 | }, 189 | "_position": { 190 | "__type__": "cc.Vec3", 191 | "y": 599.68 192 | } 193 | }, 194 | { 195 | "__type__": "cc.Node", 196 | "_name": "btnBack", 197 | "_parent": { 198 | "__id__": 5 199 | }, 200 | "_level": 3, 201 | "_components": [ 202 | { 203 | "__type__": "cc.Sprite", 204 | "node": { 205 | "__id__": 6 206 | }, 207 | "_materials": [ 208 | { 209 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 210 | } 211 | ], 212 | "_spriteFrame": { 213 | "__uuid__": "efBTQ+DQ1P/6x28hpSLY5g" 214 | } 215 | }, 216 | { 217 | "__type__": "cc.Button", 218 | "node": { 219 | "__id__": 6 220 | } 221 | }, 222 | { 223 | "__type__": "cc.Widget", 224 | "node": { 225 | "__id__": 6 226 | }, 227 | "_alignFlags": 8, 228 | "_left": 20, 229 | "_top": 619.68 230 | } 231 | ], 232 | "_color": { 233 | "__type__": "cc.Color" 234 | }, 235 | "_contentSize": { 236 | "__type__": "cc.Size", 237 | "width": 64, 238 | "height": 64 239 | }, 240 | "_position": { 241 | "__type__": "cc.Vec3", 242 | "x": -308 243 | } 244 | }, 245 | { 246 | "__type__": "cc.Node", 247 | "_name": "deer", 248 | "_parent": { 249 | "__id__": 5 250 | }, 251 | "_level": 3, 252 | "_components": [ 253 | { 254 | "__type__": "cc.Sprite", 255 | "node": { 256 | "__id__": 7 257 | }, 258 | "_materials": [ 259 | { 260 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 261 | } 262 | ], 263 | "_spriteFrame": { 264 | "__uuid__": "83hvfg/AhCiYNj20P6TUMB" 265 | }, 266 | "_sizeMode": 2 267 | }, 268 | { 269 | "__type__": "159cd/BYKxFcricpYxhpsCX", 270 | "node": { 271 | "__id__": 7 272 | }, 273 | "type": 5, 274 | "val": "deer.idx", 275 | "spriteFrame": [ 276 | { 277 | "__uuid__": "83hvfg/AhCiYNj20P6TUMB" 278 | }, 279 | { 280 | "__uuid__": "5b6rO3rNtKpLmLottqEsiN" 281 | }, 282 | { 283 | "__uuid__": "bbvDK29WJPmKyEKpt1hmqe" 284 | }, 285 | { 286 | "__uuid__": "65TnO/tDlIeb+UMYju3GEz" 287 | } 288 | ] 289 | } 290 | ], 291 | "_color": { 292 | "__type__": "cc.Color", 293 | "r": 255 294 | }, 295 | "_contentSize": { 296 | "__type__": "cc.Size", 297 | "width": 38, 298 | "height": 49 299 | }, 300 | "_position": { 301 | "__type__": "cc.Vec3", 302 | "y": -203.94 303 | }, 304 | "_scale": { 305 | "__type__": "cc.Vec3", 306 | "x": 3, 307 | "y": 3, 308 | "z": 1 309 | } 310 | }, 311 | { 312 | "__type__": "cc.Node", 313 | "_name": "txt", 314 | "_parent": { 315 | "__id__": 5 316 | }, 317 | "_level": 3, 318 | "_components": [ 319 | { 320 | "__type__": "cc.Label", 321 | "node": { 322 | "__id__": 8 323 | }, 324 | "_materials": [ 325 | { 326 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 327 | } 328 | ], 329 | "_useOriginalSize": false, 330 | "_string": "Label", 331 | "_N$string": "Label", 332 | "_N$horizontalAlign": 1, 333 | "_N$verticalAlign": 1 334 | }, 335 | { 336 | "__type__": "159cd/BYKxFcricpYxhpsCX", 337 | "node": { 338 | "__id__": 8 339 | }, 340 | "type": 1, 341 | "val": "deer.ms", 342 | "formator": "每%s毫秒一帧" 343 | } 344 | ], 345 | "_color": { 346 | "__type__": "cc.Color" 347 | }, 348 | "_contentSize": { 349 | "__type__": "cc.Size", 350 | "width": 97.87, 351 | "height": 50.4 352 | }, 353 | "_position": { 354 | "__type__": "cc.Vec3", 355 | "y": -344.327 356 | } 357 | } 358 | ], 359 | { 360 | "__type__": "cc.SpriteFrame", 361 | "content": { 362 | "name": "bg", 363 | "texture": "17a874b44", 364 | "rect": [ 365 | 3, 366 | 441, 367 | 64, 368 | 64 369 | ], 370 | "offset": [ 371 | 0, 372 | 0 373 | ], 374 | "originalSize": [ 375 | 64, 376 | 64 377 | ], 378 | "capInsets": [ 379 | 0, 380 | 0, 381 | 0, 382 | 0 383 | ] 384 | } 385 | }, 386 | { 387 | "__type__": "cc.SpriteFrame", 388 | "content": { 389 | "name": "deer2", 390 | "texture": "17a874b44", 391 | "rect": [ 392 | 411, 393 | 207, 394 | 38, 395 | 49 396 | ], 397 | "offset": [ 398 | 0, 399 | 0 400 | ], 401 | "originalSize": [ 402 | 38, 403 | 49 404 | ], 405 | "rotated": 1, 406 | "capInsets": [ 407 | 0, 408 | 0, 409 | 0, 410 | 0 411 | ] 412 | } 413 | }, 414 | { 415 | "__type__": "cc.SpriteFrame", 416 | "content": { 417 | "name": "deer4", 418 | "texture": "17a874b44", 419 | "rect": [ 420 | 411, 421 | 251, 422 | 38, 423 | 49 424 | ], 425 | "offset": [ 426 | 0, 427 | 0 428 | ], 429 | "originalSize": [ 430 | 38, 431 | 49 432 | ], 433 | "rotated": 1, 434 | "capInsets": [ 435 | 0, 436 | 0, 437 | 0, 438 | 0 439 | ] 440 | } 441 | }, 442 | { 443 | "__type__": "cc.SpriteFrame", 444 | "content": { 445 | "name": "deer1", 446 | "texture": "17a874b44", 447 | "rect": [ 448 | 411, 449 | 295, 450 | 38, 451 | 49 452 | ], 453 | "offset": [ 454 | 0, 455 | 0 456 | ], 457 | "originalSize": [ 458 | 38, 459 | 49 460 | ], 461 | "rotated": 1, 462 | "capInsets": [ 463 | 0, 464 | 0, 465 | 0, 466 | 0 467 | ] 468 | } 469 | }, 470 | { 471 | "__type__": "cc.SpriteFrame", 472 | "content": { 473 | "name": "deer3", 474 | "texture": "17a874b44", 475 | "rect": [ 476 | 411, 477 | 339, 478 | 38, 479 | 49 480 | ], 481 | "offset": [ 482 | 0, 483 | 0 484 | ], 485 | "originalSize": [ 486 | 38, 487 | 49 488 | ], 489 | "rotated": 1, 490 | "capInsets": [ 491 | 0, 492 | 0, 493 | 0, 494 | 0 495 | ] 496 | } 497 | }, 498 | { 499 | "__type__": "cc.SpriteFrame", 500 | "content": { 501 | "name": "back", 502 | "texture": "17a874b44", 503 | "rect": [ 504 | 283, 505 | 441, 506 | 64, 507 | 64 508 | ], 509 | "offset": [ 510 | 0, 511 | 0 512 | ], 513 | "originalSize": [ 514 | 64, 515 | 64 516 | ], 517 | "capInsets": [ 518 | 0, 519 | 0, 520 | 0, 521 | 0 522 | ] 523 | } 524 | } 525 | ] -------------------------------------------------------------------------------- /example/res/import/01/01cc69595.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "cc.Texture2D", 3 | "data": "0,9729,9729,33071,33071,0|0,9729,9729,33071,33071,0|0,9729,9729,33071,33071,0|0,9729,9729,33071,33071,0|0,9729,9729,33071,33071,0|0,9729,9729,33071,33071,0" 4 | } -------------------------------------------------------------------------------- /example/res/import/02/02efcc783.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SpriteFrame", 4 | "content": { 5 | "name": "bg", 6 | "texture": "17a874b44", 7 | "rect": [ 8 | 3, 9 | 441, 10 | 64, 11 | 64 12 | ], 13 | "offset": [ 14 | 0, 15 | 0 16 | ], 17 | "originalSize": [ 18 | 64, 19 | 64 20 | ], 21 | "capInsets": [ 22 | 0, 23 | 0, 24 | 0, 25 | 0 26 | ] 27 | } 28 | }, 29 | [ 30 | { 31 | "__type__": "cc.SceneAsset", 32 | "_name": "scClick", 33 | "scene": { 34 | "__id__": 1 35 | }, 36 | "asyncLoadAssets": null 37 | }, 38 | { 39 | "__type__": "cc.Scene", 40 | "_name": "New Node", 41 | "_children": [ 42 | { 43 | "__id__": 2 44 | } 45 | ], 46 | "_anchorPoint": { 47 | "__type__": "cc.Vec2" 48 | }, 49 | "autoReleaseAssets": false 50 | }, 51 | { 52 | "__type__": "cc.Node", 53 | "_name": "Canvas", 54 | "_parent": { 55 | "__id__": 1 56 | }, 57 | "_children": [ 58 | { 59 | "__id__": 3 60 | }, 61 | { 62 | "__id__": 4 63 | } 64 | ], 65 | "_components": [ 66 | { 67 | "__type__": "cc.Canvas", 68 | "node": { 69 | "__id__": 2 70 | }, 71 | "_designResolution": { 72 | "__type__": "cc.Size", 73 | "width": 720, 74 | "height": 1280 75 | } 76 | }, 77 | { 78 | "__type__": "1e9a47zX7dNabyQ17vVwPCw", 79 | "node": { 80 | "__id__": 2 81 | }, 82 | "btnBack": { 83 | "__id__": 7 84 | } 85 | } 86 | ], 87 | "_contentSize": { 88 | "__type__": "cc.Size", 89 | "width": 720, 90 | "height": 1280 91 | }, 92 | "_position": { 93 | "__type__": "cc.Vec3", 94 | "x": 360, 95 | "y": 640 96 | }, 97 | "_id": "a42S99IlBAaZbxW44TfsmU" 98 | }, 99 | { 100 | "__type__": "cc.Node", 101 | "_name": "Main Camera", 102 | "_parent": { 103 | "__id__": 2 104 | }, 105 | "_level": 1, 106 | "_components": [ 107 | { 108 | "__type__": "cc.Camera", 109 | "node": { 110 | "__id__": 3 111 | }, 112 | "_clearFlags": 7, 113 | "_depth": -1 114 | } 115 | ] 116 | }, 117 | { 118 | "__type__": "cc.Node", 119 | "_name": "bg", 120 | "_parent": { 121 | "__id__": 2 122 | }, 123 | "_children": [ 124 | { 125 | "__id__": 5 126 | }, 127 | { 128 | "__id__": 6 129 | } 130 | ], 131 | "_level": 1, 132 | "_components": [ 133 | { 134 | "__type__": "cc.Sprite", 135 | "node": { 136 | "__id__": 4 137 | }, 138 | "_materials": [ 139 | { 140 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 141 | } 142 | ], 143 | "_spriteFrame": { 144 | "__uuid__": "23p7p9ZPtMEIqH/jUu3z9N" 145 | }, 146 | "_sizeMode": 0 147 | }, 148 | { 149 | "__type__": "cc.Widget", 150 | "node": { 151 | "__id__": 4 152 | }, 153 | "_alignFlags": 45, 154 | "_originalWidth": 64, 155 | "_originalHeight": 64 156 | } 157 | ], 158 | "_contentSize": { 159 | "__type__": "cc.Size", 160 | "width": 720, 161 | "height": 1280 162 | } 163 | }, 164 | { 165 | "__type__": "cc.Node", 166 | "_name": "bg", 167 | "_parent": { 168 | "__id__": 4 169 | }, 170 | "_level": 2, 171 | "_components": [ 172 | { 173 | "__type__": "cc.Widget", 174 | "node": { 175 | "__id__": 5 176 | }, 177 | "_alignFlags": 45, 178 | "_originalWidth": 64, 179 | "_originalHeight": 64 180 | }, 181 | { 182 | "__type__": "159cd/BYKxFcricpYxhpsCX", 183 | "node": { 184 | "__id__": 5 185 | }, 186 | "type": 8, 187 | "val": "action.color", 188 | "clickCb": "click" 189 | } 190 | ], 191 | "_contentSize": { 192 | "__type__": "cc.Size", 193 | "width": 720, 194 | "height": 1280 195 | } 196 | }, 197 | { 198 | "__type__": "cc.Node", 199 | "_name": "title", 200 | "_parent": { 201 | "__id__": 4 202 | }, 203 | "_children": [ 204 | { 205 | "__id__": 7 206 | }, 207 | { 208 | "__id__": 8 209 | }, 210 | { 211 | "__id__": 9 212 | } 213 | ], 214 | "_level": 2, 215 | "_components": [ 216 | { 217 | "__type__": "cc.Label", 218 | "node": { 219 | "__id__": 6 220 | }, 221 | "_materials": [ 222 | { 223 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 224 | } 225 | ], 226 | "_useOriginalSize": false, 227 | "_string": "点击事件", 228 | "_N$string": "点击事件", 229 | "_fontSize": 48, 230 | "_lineHeight": 64, 231 | "_N$horizontalAlign": 1, 232 | "_N$verticalAlign": 1, 233 | "_N$overflow": 1 234 | }, 235 | { 236 | "__type__": "cc.Widget", 237 | "node": { 238 | "__id__": 6 239 | }, 240 | "_alignFlags": 41, 241 | "_originalWidth": 128 242 | } 243 | ], 244 | "_color": { 245 | "__type__": "cc.Color" 246 | }, 247 | "_contentSize": { 248 | "__type__": "cc.Size", 249 | "width": 720, 250 | "height": 80.64 251 | }, 252 | "_position": { 253 | "__type__": "cc.Vec3", 254 | "y": 599.68 255 | } 256 | }, 257 | { 258 | "__type__": "cc.Node", 259 | "_name": "btnBack", 260 | "_parent": { 261 | "__id__": 6 262 | }, 263 | "_level": 3, 264 | "_components": [ 265 | { 266 | "__type__": "cc.Sprite", 267 | "node": { 268 | "__id__": 7 269 | }, 270 | "_materials": [ 271 | { 272 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 273 | } 274 | ], 275 | "_spriteFrame": { 276 | "__uuid__": "efBTQ+DQ1P/6x28hpSLY5g" 277 | } 278 | }, 279 | { 280 | "__type__": "cc.Button", 281 | "node": { 282 | "__id__": 7 283 | } 284 | }, 285 | { 286 | "__type__": "cc.Widget", 287 | "node": { 288 | "__id__": 7 289 | }, 290 | "_alignFlags": 8, 291 | "_left": 20, 292 | "_top": 619.68 293 | } 294 | ], 295 | "_color": { 296 | "__type__": "cc.Color" 297 | }, 298 | "_contentSize": { 299 | "__type__": "cc.Size", 300 | "width": 64, 301 | "height": 64 302 | }, 303 | "_position": { 304 | "__type__": "cc.Vec3", 305 | "x": -308 306 | } 307 | }, 308 | { 309 | "__type__": "cc.Node", 310 | "_name": "txt", 311 | "_parent": { 312 | "__id__": 6 313 | }, 314 | "_level": 3, 315 | "_components": [ 316 | { 317 | "__type__": "cc.Label", 318 | "node": { 319 | "__id__": 8 320 | }, 321 | "_materials": [ 322 | { 323 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 324 | } 325 | ], 326 | "_useOriginalSize": false, 327 | "_string": "你点了", 328 | "_N$string": "你点了", 329 | "_N$horizontalAlign": 1, 330 | "_N$verticalAlign": 1 331 | }, 332 | { 333 | "__type__": "159cd/BYKxFcricpYxhpsCX", 334 | "node": { 335 | "__id__": 8 336 | }, 337 | "type": 1, 338 | "val": "action.color", 339 | "formator": "txtFormat" 340 | } 341 | ], 342 | "_color": { 343 | "__type__": "cc.Color" 344 | }, 345 | "_contentSize": { 346 | "__type__": "cc.Size", 347 | "width": 120, 348 | "height": 50.4 349 | }, 350 | "_position": { 351 | "__type__": "cc.Vec3", 352 | "x": 13.468, 353 | "y": -380.955 354 | } 355 | }, 356 | { 357 | "__type__": "cc.Node", 358 | "_name": "btns", 359 | "_parent": { 360 | "__id__": 6 361 | }, 362 | "_children": [ 363 | { 364 | "__id__": 10 365 | }, 366 | { 367 | "__id__": 11 368 | }, 369 | { 370 | "__id__": 12 371 | }, 372 | { 373 | "__id__": 13 374 | } 375 | ], 376 | "_level": 3 377 | }, 378 | { 379 | "__type__": "cc.Node", 380 | "_name": "red", 381 | "_parent": { 382 | "__id__": 9 383 | }, 384 | "_level": 4, 385 | "_components": [ 386 | { 387 | "__type__": "cc.Sprite", 388 | "node": { 389 | "__id__": 10 390 | }, 391 | "_materials": [ 392 | { 393 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 394 | } 395 | ], 396 | "_spriteFrame": { 397 | "__uuid__": "82yG0Xp9BN65+c+ckguIob" 398 | }, 399 | "_sizeMode": 0 400 | }, 401 | { 402 | "__type__": "159cd/BYKxFcricpYxhpsCX", 403 | "node": { 404 | "__id__": 10 405 | }, 406 | "type": 8, 407 | "val": "action.color", 408 | "clickCb": "click", 409 | "tag": "红色" 410 | } 411 | ], 412 | "_color": { 413 | "__type__": "cc.Color", 414 | "r": 255 415 | }, 416 | "_contentSize": { 417 | "__type__": "cc.Size", 418 | "width": 128, 419 | "height": 128 420 | }, 421 | "_position": { 422 | "__type__": "cc.Vec3", 423 | "x": -241.509, 424 | "y": -203.94 425 | } 426 | }, 427 | { 428 | "__type__": "cc.Node", 429 | "_name": "blue", 430 | "_parent": { 431 | "__id__": 9 432 | }, 433 | "_level": 4, 434 | "_components": [ 435 | { 436 | "__type__": "cc.Sprite", 437 | "node": { 438 | "__id__": 11 439 | }, 440 | "_materials": [ 441 | { 442 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 443 | } 444 | ], 445 | "_spriteFrame": { 446 | "__uuid__": "82yG0Xp9BN65+c+ckguIob" 447 | }, 448 | "_sizeMode": 0 449 | }, 450 | { 451 | "__type__": "159cd/BYKxFcricpYxhpsCX", 452 | "node": { 453 | "__id__": 11 454 | }, 455 | "type": 8, 456 | "val": "action.color", 457 | "clickCb": "click", 458 | "tag": "蓝色" 459 | } 460 | ], 461 | "_color": { 462 | "__type__": "cc.Color", 463 | "r": 20, 464 | "b": 255 465 | }, 466 | "_contentSize": { 467 | "__type__": "cc.Size", 468 | "width": 128, 469 | "height": 128 470 | }, 471 | "_position": { 472 | "__type__": "cc.Vec3", 473 | "x": -85.87, 474 | "y": -203.94 475 | } 476 | }, 477 | { 478 | "__type__": "cc.Node", 479 | "_name": "black", 480 | "_parent": { 481 | "__id__": 9 482 | }, 483 | "_level": 4, 484 | "_components": [ 485 | { 486 | "__type__": "cc.Sprite", 487 | "node": { 488 | "__id__": 12 489 | }, 490 | "_materials": [ 491 | { 492 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 493 | } 494 | ], 495 | "_spriteFrame": { 496 | "__uuid__": "82yG0Xp9BN65+c+ckguIob" 497 | }, 498 | "_sizeMode": 0 499 | }, 500 | { 501 | "__type__": "159cd/BYKxFcricpYxhpsCX", 502 | "node": { 503 | "__id__": 12 504 | }, 505 | "type": 8, 506 | "val": "action.color", 507 | "clickCb": "click", 508 | "tag": "黑色" 509 | } 510 | ], 511 | "_color": { 512 | "__type__": "cc.Color" 513 | }, 514 | "_contentSize": { 515 | "__type__": "cc.Size", 516 | "width": 128, 517 | "height": 128 518 | }, 519 | "_position": { 520 | "__type__": "cc.Vec3", 521 | "x": 75.135, 522 | "y": -203.94 523 | } 524 | }, 525 | { 526 | "__type__": "cc.Node", 527 | "_name": "green", 528 | "_parent": { 529 | "__id__": 9 530 | }, 531 | "_level": 4, 532 | "_components": [ 533 | { 534 | "__type__": "cc.Sprite", 535 | "node": { 536 | "__id__": 13 537 | }, 538 | "_materials": [ 539 | { 540 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 541 | } 542 | ], 543 | "_spriteFrame": { 544 | "__uuid__": "82yG0Xp9BN65+c+ckguIob" 545 | }, 546 | "_sizeMode": 0 547 | }, 548 | { 549 | "__type__": "159cd/BYKxFcricpYxhpsCX", 550 | "node": { 551 | "__id__": 13 552 | }, 553 | "type": 8, 554 | "val": "action.color", 555 | "clickCb": "click", 556 | "tag": "绿色" 557 | } 558 | ], 559 | "_color": { 560 | "__type__": "cc.Color", 561 | "g": 255, 562 | "b": 82 563 | }, 564 | "_contentSize": { 565 | "__type__": "cc.Size", 566 | "width": 128, 567 | "height": 128 568 | }, 569 | "_position": { 570 | "__type__": "cc.Vec3", 571 | "x": 244.191, 572 | "y": -203.94 573 | } 574 | } 575 | ], 576 | { 577 | "__type__": "cc.SpriteFrame", 578 | "content": { 579 | "name": "bg32", 580 | "texture": "17a874b44", 581 | "rect": [ 582 | 213, 583 | 441, 584 | 64, 585 | 64 586 | ], 587 | "offset": [ 588 | 0, 589 | 0 590 | ], 591 | "originalSize": [ 592 | 64, 593 | 64 594 | ], 595 | "capInsets": [ 596 | 0, 597 | 0, 598 | 0, 599 | 0 600 | ] 601 | } 602 | }, 603 | { 604 | "__type__": "cc.SpriteFrame", 605 | "content": { 606 | "name": "back", 607 | "texture": "17a874b44", 608 | "rect": [ 609 | 283, 610 | 441, 611 | 64, 612 | 64 613 | ], 614 | "offset": [ 615 | 0, 616 | 0 617 | ], 618 | "originalSize": [ 619 | 64, 620 | 64 621 | ], 622 | "capInsets": [ 623 | 0, 624 | 0, 625 | 0, 626 | 0 627 | ] 628 | } 629 | } 630 | ] -------------------------------------------------------------------------------- /example/res/import/03/034f90767.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SpriteFrame", 4 | "content": { 5 | "name": "bg", 6 | "texture": "17a874b44", 7 | "rect": [ 8 | 3, 9 | 441, 10 | 64, 11 | 64 12 | ], 13 | "offset": [ 14 | 0, 15 | 0 16 | ], 17 | "originalSize": [ 18 | 64, 19 | 64 20 | ], 21 | "capInsets": [ 22 | 0, 23 | 0, 24 | 0, 25 | 0 26 | ] 27 | } 28 | }, 29 | [ 30 | { 31 | "__type__": "cc.SceneAsset", 32 | "_name": "scDync", 33 | "scene": { 34 | "__id__": 1 35 | }, 36 | "asyncLoadAssets": null 37 | }, 38 | { 39 | "__type__": "cc.Scene", 40 | "_name": "New Node", 41 | "_children": [ 42 | { 43 | "__id__": 2 44 | } 45 | ], 46 | "_anchorPoint": { 47 | "__type__": "cc.Vec2" 48 | }, 49 | "autoReleaseAssets": false 50 | }, 51 | { 52 | "__type__": "cc.Node", 53 | "_name": "Canvas", 54 | "_parent": { 55 | "__id__": 1 56 | }, 57 | "_children": [ 58 | { 59 | "__id__": 3 60 | }, 61 | { 62 | "__id__": 4 63 | } 64 | ], 65 | "_components": [ 66 | { 67 | "__type__": "cc.Canvas", 68 | "node": { 69 | "__id__": 2 70 | }, 71 | "_designResolution": { 72 | "__type__": "cc.Size", 73 | "width": 720, 74 | "height": 1280 75 | } 76 | }, 77 | { 78 | "__type__": "a7a9ezsoVRA8Y3fKEIE6pJy", 79 | "node": { 80 | "__id__": 2 81 | }, 82 | "btnBack": { 83 | "__id__": 6 84 | }, 85 | "txtCounter": { 86 | "__id__": 8 87 | }, 88 | "btn": { 89 | "__id__": 9 90 | }, 91 | "btnTxt": { 92 | "__id__": 11 93 | } 94 | } 95 | ], 96 | "_contentSize": { 97 | "__type__": "cc.Size", 98 | "width": 720, 99 | "height": 1280 100 | }, 101 | "_position": { 102 | "__type__": "cc.Vec3", 103 | "x": 360, 104 | "y": 640 105 | }, 106 | "_id": "a42S99IlBAaZbxW44TfsmU" 107 | }, 108 | { 109 | "__type__": "cc.Node", 110 | "_name": "Main Camera", 111 | "_parent": { 112 | "__id__": 2 113 | }, 114 | "_level": 1, 115 | "_components": [ 116 | { 117 | "__type__": "cc.Camera", 118 | "node": { 119 | "__id__": 3 120 | }, 121 | "_clearFlags": 7, 122 | "_depth": -1 123 | } 124 | ] 125 | }, 126 | { 127 | "__type__": "cc.Node", 128 | "_name": "bg", 129 | "_parent": { 130 | "__id__": 2 131 | }, 132 | "_children": [ 133 | { 134 | "__id__": 5 135 | } 136 | ], 137 | "_level": 1, 138 | "_components": [ 139 | { 140 | "__type__": "cc.Sprite", 141 | "node": { 142 | "__id__": 4 143 | }, 144 | "_materials": [ 145 | { 146 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 147 | } 148 | ], 149 | "_spriteFrame": { 150 | "__uuid__": "23p7p9ZPtMEIqH/jUu3z9N" 151 | }, 152 | "_sizeMode": 0 153 | }, 154 | { 155 | "__type__": "cc.Widget", 156 | "node": { 157 | "__id__": 4 158 | }, 159 | "_alignFlags": 45, 160 | "_originalWidth": 64, 161 | "_originalHeight": 64 162 | } 163 | ], 164 | "_contentSize": { 165 | "__type__": "cc.Size", 166 | "width": 720, 167 | "height": 1280 168 | } 169 | }, 170 | { 171 | "__type__": "cc.Node", 172 | "_name": "title", 173 | "_parent": { 174 | "__id__": 4 175 | }, 176 | "_children": [ 177 | { 178 | "__id__": 6 179 | }, 180 | { 181 | "__id__": 7 182 | }, 183 | { 184 | "__id__": 9 185 | }, 186 | { 187 | "__id__": 12 188 | } 189 | ], 190 | "_level": 2, 191 | "_components": [ 192 | { 193 | "__type__": "cc.Label", 194 | "node": { 195 | "__id__": 5 196 | }, 197 | "_materials": [ 198 | { 199 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 200 | } 201 | ], 202 | "_useOriginalSize": false, 203 | "_string": "动态代码绑定", 204 | "_N$string": "动态代码绑定", 205 | "_fontSize": 48, 206 | "_lineHeight": 64, 207 | "_N$horizontalAlign": 1, 208 | "_N$verticalAlign": 1, 209 | "_N$overflow": 1 210 | }, 211 | { 212 | "__type__": "cc.Widget", 213 | "node": { 214 | "__id__": 5 215 | }, 216 | "_alignFlags": 41, 217 | "_originalWidth": 128 218 | } 219 | ], 220 | "_color": { 221 | "__type__": "cc.Color" 222 | }, 223 | "_contentSize": { 224 | "__type__": "cc.Size", 225 | "width": 720, 226 | "height": 80.64 227 | }, 228 | "_position": { 229 | "__type__": "cc.Vec3", 230 | "y": 599.68 231 | } 232 | }, 233 | { 234 | "__type__": "cc.Node", 235 | "_name": "btnBack", 236 | "_parent": { 237 | "__id__": 5 238 | }, 239 | "_level": 3, 240 | "_components": [ 241 | { 242 | "__type__": "cc.Sprite", 243 | "node": { 244 | "__id__": 6 245 | }, 246 | "_materials": [ 247 | { 248 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 249 | } 250 | ], 251 | "_spriteFrame": { 252 | "__uuid__": "efBTQ+DQ1P/6x28hpSLY5g" 253 | } 254 | }, 255 | { 256 | "__type__": "cc.Button", 257 | "node": { 258 | "__id__": 6 259 | } 260 | }, 261 | { 262 | "__type__": "cc.Widget", 263 | "node": { 264 | "__id__": 6 265 | }, 266 | "_alignFlags": 8, 267 | "_left": 20, 268 | "_top": 619.68 269 | } 270 | ], 271 | "_color": { 272 | "__type__": "cc.Color" 273 | }, 274 | "_contentSize": { 275 | "__type__": "cc.Size", 276 | "width": 64, 277 | "height": 64 278 | }, 279 | "_position": { 280 | "__type__": "cc.Vec3", 281 | "x": -308 282 | } 283 | }, 284 | { 285 | "__type__": "cc.Node", 286 | "_name": "txtCounter", 287 | "_parent": { 288 | "__id__": 5 289 | }, 290 | "_level": 3, 291 | "_components": [ 292 | { 293 | "__id__": 8 294 | } 295 | ], 296 | "_color": { 297 | "__type__": "cc.Color" 298 | }, 299 | "_contentSize": { 300 | "__type__": "cc.Size", 301 | "width": 97.87, 302 | "height": 50.4 303 | }, 304 | "_position": { 305 | "__type__": "cc.Vec3", 306 | "y": -145.444 307 | } 308 | }, 309 | { 310 | "__type__": "cc.Label", 311 | "node": { 312 | "__id__": 7 313 | }, 314 | "_materials": [ 315 | { 316 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 317 | } 318 | ], 319 | "_useOriginalSize": false, 320 | "_string": "Label", 321 | "_N$string": "Label", 322 | "_N$horizontalAlign": 1, 323 | "_N$verticalAlign": 1 324 | }, 325 | { 326 | "__type__": "cc.Node", 327 | "_name": "btn", 328 | "_parent": { 329 | "__id__": 5 330 | }, 331 | "_children": [ 332 | { 333 | "__id__": 10 334 | } 335 | ], 336 | "_level": 3, 337 | "_components": [ 338 | { 339 | "__type__": "cc.Sprite", 340 | "node": { 341 | "__id__": 9 342 | }, 343 | "_materials": [ 344 | { 345 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 346 | } 347 | ], 348 | "_spriteFrame": { 349 | "__uuid__": "23p7p9ZPtMEIqH/jUu3z9N" 350 | }, 351 | "_sizeMode": 0 352 | }, 353 | { 354 | "__type__": "cc.Button", 355 | "node": { 356 | "__id__": 9 357 | } 358 | } 359 | ], 360 | "_color": { 361 | "__type__": "cc.Color" 362 | }, 363 | "_contentSize": { 364 | "__type__": "cc.Size", 365 | "width": 200, 366 | "height": 64 367 | }, 368 | "_position": { 369 | "__type__": "cc.Vec3", 370 | "y": -333.907 371 | } 372 | }, 373 | { 374 | "__type__": "cc.Node", 375 | "_name": "txt", 376 | "_parent": { 377 | "__id__": 9 378 | }, 379 | "_level": 4, 380 | "_components": [ 381 | { 382 | "__id__": 11 383 | } 384 | ], 385 | "_contentSize": { 386 | "__type__": "cc.Size", 387 | "width": 64, 388 | "height": 50.4 389 | } 390 | }, 391 | { 392 | "__type__": "cc.Label", 393 | "node": { 394 | "__id__": 10 395 | }, 396 | "_materials": [ 397 | { 398 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 399 | } 400 | ], 401 | "_useOriginalSize": false, 402 | "_string": "解绑", 403 | "_N$string": "解绑", 404 | "_fontSize": 32, 405 | "_N$horizontalAlign": 1, 406 | "_N$verticalAlign": 1 407 | }, 408 | { 409 | "__type__": "cc.Node", 410 | "_name": "tips", 411 | "_parent": { 412 | "__id__": 5 413 | }, 414 | "_level": 3, 415 | "_components": [ 416 | { 417 | "__type__": "cc.Label", 418 | "node": { 419 | "__id__": 12 420 | }, 421 | "_materials": [ 422 | { 423 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 424 | } 425 | ], 426 | "_useOriginalSize": false, 427 | "_string": "定时器一直再跑,\n解绑后就不再关联。绑定后又开始同步。", 428 | "_N$string": "定时器一直再跑,\n解绑后就不再关联。绑定后又开始同步。", 429 | "_fontSize": 28, 430 | "_N$horizontalAlign": 1, 431 | "_N$verticalAlign": 1 432 | } 433 | ], 434 | "_color": { 435 | "__type__": "cc.Color" 436 | }, 437 | "_contentSize": { 438 | "__type__": "cc.Size", 439 | "width": 504, 440 | "height": 90.4 441 | }, 442 | "_position": { 443 | "__type__": "cc.Vec3", 444 | "y": -417.895 445 | } 446 | } 447 | ], 448 | { 449 | "__type__": "cc.SpriteFrame", 450 | "content": { 451 | "name": "back", 452 | "texture": "17a874b44", 453 | "rect": [ 454 | 283, 455 | 441, 456 | 64, 457 | 64 458 | ], 459 | "offset": [ 460 | 0, 461 | 0 462 | ], 463 | "originalSize": [ 464 | 64, 465 | 64 466 | ], 467 | "capInsets": [ 468 | 0, 469 | 0, 470 | 0, 471 | 0 472 | ] 473 | } 474 | } 475 | ] -------------------------------------------------------------------------------- /example/res/import/04/049fff3a4.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SpriteFrame", 4 | "content": { 5 | "name": "bg", 6 | "texture": "17a874b44", 7 | "rect": [ 8 | 3, 9 | 441, 10 | 64, 11 | 64 12 | ], 13 | "offset": [ 14 | 0, 15 | 0 16 | ], 17 | "originalSize": [ 18 | 64, 19 | 64 20 | ], 21 | "capInsets": [ 22 | 0, 23 | 0, 24 | 0, 25 | 0 26 | ] 27 | } 28 | }, 29 | { 30 | "__type__": "cc.SpriteFrame", 31 | "content": { 32 | "name": "bg32", 33 | "texture": "17a874b44", 34 | "rect": [ 35 | 213, 36 | 441, 37 | 64, 38 | 64 39 | ], 40 | "offset": [ 41 | 0, 42 | 0 43 | ], 44 | "originalSize": [ 45 | 64, 46 | 64 47 | ], 48 | "capInsets": [ 49 | 0, 50 | 0, 51 | 0, 52 | 0 53 | ] 54 | } 55 | }, 56 | [ 57 | { 58 | "__type__": "cc.SceneAsset", 59 | "_name": "scGlobal", 60 | "scene": { 61 | "__id__": 1 62 | }, 63 | "asyncLoadAssets": null 64 | }, 65 | { 66 | "__type__": "cc.Scene", 67 | "_name": "New Node", 68 | "_children": [ 69 | { 70 | "__id__": 2 71 | } 72 | ], 73 | "_anchorPoint": { 74 | "__type__": "cc.Vec2" 75 | }, 76 | "autoReleaseAssets": false 77 | }, 78 | { 79 | "__type__": "cc.Node", 80 | "_name": "Canvas", 81 | "_parent": { 82 | "__id__": 1 83 | }, 84 | "_children": [ 85 | { 86 | "__id__": 3 87 | }, 88 | { 89 | "__id__": 4 90 | } 91 | ], 92 | "_components": [ 93 | { 94 | "__type__": "cc.Canvas", 95 | "node": { 96 | "__id__": 2 97 | }, 98 | "_designResolution": { 99 | "__type__": "cc.Size", 100 | "width": 720, 101 | "height": 1280 102 | } 103 | }, 104 | { 105 | "__type__": "f7c62aBp29G3aECg3kx7qLM", 106 | "node": { 107 | "__id__": 2 108 | }, 109 | "btnBack": { 110 | "__id__": 6 111 | } 112 | } 113 | ], 114 | "_contentSize": { 115 | "__type__": "cc.Size", 116 | "width": 720, 117 | "height": 1280 118 | }, 119 | "_position": { 120 | "__type__": "cc.Vec3", 121 | "x": 360, 122 | "y": 640 123 | }, 124 | "_id": "a42S99IlBAaZbxW44TfsmU" 125 | }, 126 | { 127 | "__type__": "cc.Node", 128 | "_name": "Main Camera", 129 | "_parent": { 130 | "__id__": 2 131 | }, 132 | "_level": 1, 133 | "_components": [ 134 | { 135 | "__type__": "cc.Camera", 136 | "node": { 137 | "__id__": 3 138 | }, 139 | "_clearFlags": 7, 140 | "_depth": -1 141 | } 142 | ] 143 | }, 144 | { 145 | "__type__": "cc.Node", 146 | "_name": "bg", 147 | "_parent": { 148 | "__id__": 2 149 | }, 150 | "_children": [ 151 | { 152 | "__id__": 5 153 | } 154 | ], 155 | "_level": 1, 156 | "_components": [ 157 | { 158 | "__type__": "cc.Sprite", 159 | "node": { 160 | "__id__": 4 161 | }, 162 | "_materials": [ 163 | { 164 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 165 | } 166 | ], 167 | "_spriteFrame": { 168 | "__uuid__": "23p7p9ZPtMEIqH/jUu3z9N" 169 | }, 170 | "_sizeMode": 0 171 | }, 172 | { 173 | "__type__": "cc.Widget", 174 | "node": { 175 | "__id__": 4 176 | }, 177 | "_alignFlags": 45, 178 | "_originalWidth": 64, 179 | "_originalHeight": 64 180 | } 181 | ], 182 | "_contentSize": { 183 | "__type__": "cc.Size", 184 | "width": 720, 185 | "height": 1280 186 | } 187 | }, 188 | { 189 | "__type__": "cc.Node", 190 | "_name": "title", 191 | "_parent": { 192 | "__id__": 4 193 | }, 194 | "_children": [ 195 | { 196 | "__id__": 6 197 | }, 198 | { 199 | "__id__": 7 200 | }, 201 | { 202 | "__id__": 8 203 | } 204 | ], 205 | "_level": 2, 206 | "_components": [ 207 | { 208 | "__type__": "cc.Label", 209 | "node": { 210 | "__id__": 5 211 | }, 212 | "_materials": [ 213 | { 214 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 215 | } 216 | ], 217 | "_useOriginalSize": false, 218 | "_string": "全局绑定", 219 | "_N$string": "全局绑定", 220 | "_fontSize": 48, 221 | "_lineHeight": 64, 222 | "_N$horizontalAlign": 1, 223 | "_N$verticalAlign": 1, 224 | "_N$overflow": 1 225 | }, 226 | { 227 | "__type__": "cc.Widget", 228 | "node": { 229 | "__id__": 5 230 | }, 231 | "_alignFlags": 41, 232 | "_originalWidth": 128 233 | } 234 | ], 235 | "_color": { 236 | "__type__": "cc.Color" 237 | }, 238 | "_contentSize": { 239 | "__type__": "cc.Size", 240 | "width": 720, 241 | "height": 80.64 242 | }, 243 | "_position": { 244 | "__type__": "cc.Vec3", 245 | "y": 599.68 246 | } 247 | }, 248 | { 249 | "__type__": "cc.Node", 250 | "_name": "btnBack", 251 | "_parent": { 252 | "__id__": 5 253 | }, 254 | "_level": 3, 255 | "_components": [ 256 | { 257 | "__type__": "cc.Sprite", 258 | "node": { 259 | "__id__": 6 260 | }, 261 | "_materials": [ 262 | { 263 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 264 | } 265 | ], 266 | "_spriteFrame": { 267 | "__uuid__": "efBTQ+DQ1P/6x28hpSLY5g" 268 | } 269 | }, 270 | { 271 | "__type__": "cc.Button", 272 | "node": { 273 | "__id__": 6 274 | } 275 | }, 276 | { 277 | "__type__": "cc.Widget", 278 | "node": { 279 | "__id__": 6 280 | }, 281 | "_alignFlags": 8, 282 | "_left": 20, 283 | "_top": 619.68 284 | } 285 | ], 286 | "_color": { 287 | "__type__": "cc.Color" 288 | }, 289 | "_contentSize": { 290 | "__type__": "cc.Size", 291 | "width": 64, 292 | "height": 64 293 | }, 294 | "_position": { 295 | "__type__": "cc.Vec3", 296 | "x": -308 297 | } 298 | }, 299 | { 300 | "__type__": "cc.Node", 301 | "_name": "enterTimes", 302 | "_parent": { 303 | "__id__": 5 304 | }, 305 | "_level": 3, 306 | "_components": [ 307 | { 308 | "__type__": "cc.Label", 309 | "node": { 310 | "__id__": 7 311 | }, 312 | "_materials": [ 313 | { 314 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 315 | } 316 | ], 317 | "_useOriginalSize": false, 318 | "_string": "你点了", 319 | "_N$string": "你点了", 320 | "_N$horizontalAlign": 1, 321 | "_N$verticalAlign": 1 322 | }, 323 | { 324 | "__type__": "159cd/BYKxFcricpYxhpsCX", 325 | "node": { 326 | "__id__": 7 327 | }, 328 | "type": 1, 329 | "val": "gu.enterTimes", 330 | "formator": "你进入了%s次" 331 | } 332 | ], 333 | "_color": { 334 | "__type__": "cc.Color" 335 | }, 336 | "_contentSize": { 337 | "__type__": "cc.Size", 338 | "width": 120, 339 | "height": 50.4 340 | }, 341 | "_position": { 342 | "__type__": "cc.Vec3", 343 | "y": -167.37 344 | } 345 | }, 346 | { 347 | "__type__": "cc.Node", 348 | "_name": "clickTimes", 349 | "_parent": { 350 | "__id__": 5 351 | }, 352 | "_children": [ 353 | { 354 | "__id__": 9 355 | } 356 | ], 357 | "_level": 3, 358 | "_components": [ 359 | { 360 | "__type__": "cc.Label", 361 | "node": { 362 | "__id__": 8 363 | }, 364 | "_materials": [ 365 | { 366 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 367 | } 368 | ], 369 | "_useOriginalSize": false, 370 | "_string": "你点了", 371 | "_N$string": "你点了", 372 | "_N$horizontalAlign": 1, 373 | "_N$verticalAlign": 1 374 | }, 375 | { 376 | "__type__": "159cd/BYKxFcricpYxhpsCX", 377 | "node": { 378 | "__id__": 8 379 | }, 380 | "type": 1, 381 | "val": "gu.clickTimes", 382 | "formator": "你点击了%s次" 383 | } 384 | ], 385 | "_color": { 386 | "__type__": "cc.Color" 387 | }, 388 | "_contentSize": { 389 | "__type__": "cc.Size", 390 | "width": 120, 391 | "height": 50.4 392 | }, 393 | "_position": { 394 | "__type__": "cc.Vec3", 395 | "y": -334.449 396 | } 397 | }, 398 | { 399 | "__type__": "cc.Node", 400 | "_name": "btn", 401 | "_parent": { 402 | "__id__": 8 403 | }, 404 | "_children": [ 405 | { 406 | "__id__": 10 407 | } 408 | ], 409 | "_level": 4, 410 | "_components": [ 411 | { 412 | "__type__": "cc.Sprite", 413 | "node": { 414 | "__id__": 9 415 | }, 416 | "_materials": [ 417 | { 418 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 419 | } 420 | ], 421 | "_spriteFrame": { 422 | "__uuid__": "82yG0Xp9BN65+c+ckguIob" 423 | }, 424 | "_type": 1, 425 | "_sizeMode": 0 426 | }, 427 | { 428 | "__type__": "159cd/BYKxFcricpYxhpsCX", 429 | "node": { 430 | "__id__": 9 431 | }, 432 | "type": 8, 433 | "val": "gu.clickTimes", 434 | "clickCb": "gu.click" 435 | } 436 | ], 437 | "_color": { 438 | "__type__": "cc.Color" 439 | }, 440 | "_contentSize": { 441 | "__type__": "cc.Size", 442 | "width": 120, 443 | "height": 64 444 | }, 445 | "_position": { 446 | "__type__": "cc.Vec3", 447 | "y": -78.596 448 | } 449 | }, 450 | { 451 | "__type__": "cc.Node", 452 | "_name": "txt", 453 | "_parent": { 454 | "__id__": 9 455 | }, 456 | "_level": 4, 457 | "_components": [ 458 | { 459 | "__type__": "cc.Label", 460 | "node": { 461 | "__id__": 10 462 | }, 463 | "_materials": [ 464 | { 465 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 466 | } 467 | ], 468 | "_useOriginalSize": false, 469 | "_string": "点我", 470 | "_N$string": "点我", 471 | "_fontSize": 32, 472 | "_N$horizontalAlign": 1, 473 | "_N$verticalAlign": 1 474 | } 475 | ], 476 | "_contentSize": { 477 | "__type__": "cc.Size", 478 | "width": 64, 479 | "height": 50.4 480 | } 481 | } 482 | ], 483 | { 484 | "__type__": "cc.SpriteFrame", 485 | "content": { 486 | "name": "back", 487 | "texture": "17a874b44", 488 | "rect": [ 489 | 283, 490 | 441, 491 | 64, 492 | 64 493 | ], 494 | "offset": [ 495 | 0, 496 | 0 497 | ], 498 | "originalSize": [ 499 | 64, 500 | 64 501 | ], 502 | "capInsets": [ 503 | 0, 504 | 0, 505 | 0, 506 | 0 507 | ] 508 | } 509 | } 510 | ] -------------------------------------------------------------------------------- /example/res/import/07/079499991.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.Material", 4 | "_name": "builtin-unlit", 5 | "_effectAsset": { 6 | "__uuid__": "6dkeWRTOBGXICfYQ7JUBnG" 7 | }, 8 | "_defines": { 9 | "USE_DIFFUSE_TEXTURE": true 10 | }, 11 | "_props": { 12 | "diffuseTexture": { 13 | "__uuid__": "02delMVqdBD70a/HSD99FK" 14 | } 15 | } 16 | }, 17 | { 18 | "__type__": "cc.EffectAsset", 19 | "_name": "builtin-unlit", 20 | "properties": { 21 | "diffuseTexture": { 22 | "type": 13, 23 | "value": null 24 | }, 25 | "diffuseColor": { 26 | "type": 9, 27 | "value": [ 28 | 1, 29 | 1, 30 | 1, 31 | 1 32 | ] 33 | }, 34 | "alphaThreshold": { 35 | "value": 0.5 36 | } 37 | }, 38 | "techniques": [ 39 | { 40 | "passes": [ 41 | { 42 | "cullMode": 0, 43 | "depthTest": true, 44 | "depthWrite": true, 45 | "blend": true, 46 | "program": "8af5ee8040d8725057e4d5f8bac775803dac5e5263fc2495a0b4cc79" 47 | } 48 | ], 49 | "layer": 0, 50 | "stages": [ 51 | "opaque" 52 | ], 53 | "queue": 0, 54 | "priority": 0 55 | } 56 | ], 57 | "shaders": [ 58 | { 59 | "vert": "\n#define _IS_VERT_SHADER 1\n\nprecision highp float;\n\nuniform mat4 cc_matWorld;\nuniform mat3 cc_matWorldIT;\n\nuniform mat4 cc_matView;\n\nuniform mat4 cc_matViewProj;\n\nuniform vec3 cc_cameraPos; \n\nuniform vec3 cc_sceneAmbient; \n\n#ifndef USE_DIFFUSE_TEXTURE\n #ifndef USE_EMISSIVE_TEXTURE\n #ifndef USE_SPECULAR_TEXTURE\n #ifndef USE_NORMAL_TEXTURE\n #define _NOT_USE_TEXTURE 1\n #endif\n #endif\n #endif\n#endif\n\n#if USE_TILING_OFFSET && _USE_ATTRIBUTE_UV0\n uniform vec2 mainTiling;\n uniform vec2 mainOffset;\n#endif\n\n#ifdef _IS_VERT_SHADER\n attribute vec3 a_position;\n#endif\n\n#ifndef _NOT_USE_TEXTURE\n\n #if _USE_ATTRIBUTE_UV0\n #ifdef _IS_VERT_SHADER\n attribute mediump vec2 a_uv0;\n #endif\n\n varying mediump vec2 v_uv0;\n #endif\n\n#endif\n\n#if _USE_ATTRIBUTE_COLOR\n\n #ifdef _IS_VERT_SHADER\n attribute lowp vec4 a_color;\n #endif\n\n varying lowp vec4 v_color;\n#endif\n\n#if _USE_ATTRIBUTE_NORMAL\n #ifdef _IS_VERT_SHADER\n attribute vec3 a_normal;\n #endif\n#endif\n\n#ifdef _IS_VERT_SHADER\n\n void ATTRIBUTE_TO_VARYING () {\n\n #if _USE_ATTRIBUTE_COLOR\n v_color = a_color;\n #endif\n\n #ifndef _NOT_USE_TEXTURE\n #if _USE_ATTRIBUTE_UV0\n v_uv0 = a_uv0;\n\n #if USE_TILING_OFFSET\n v_uv0 = v_uv0 * mainTiling + mainOffset;\n #endif\n #endif\n #endif\n\n }\n\n#endif\n\nvoid MUL_ATTR_COLOR (inout vec4 color) {\n #if _USE_ATTRIBUTE_COLOR\n #ifdef _IS_VERT_SHADER\n color *= a_color;\n #else\n color *= v_color;\n #endif\n #endif\n}\n\nvoid MUL_ATTR_NORMAL (inout vec3 normal) {\n #if _USE_ATTRIBUTE_NORMAL\n #ifdef _IS_VERT_SHADER\n normal *= a_normal;\n #endif\n #endif\n}\nvoid MUL_ATTR_NORMAL (inout vec4 normal) {\n #if _USE_ATTRIBUTE_NORMAL\n #ifdef _IS_VERT_SHADER\n normal.xyz *= a_normal;\n #endif\n #endif\n}\n\n#if _USE_SKINNING\n\n attribute vec4 a_weights;\n attribute vec4 a_joints;\n\n #if _USE_JOINTS_TEXTRUE\n uniform sampler2D _jointsTexture;\n uniform vec2 _jointsTextureSize;\n\n #if _JOINTS_TEXTURE_FLOAT32\n mat4 getBoneMatrix(const in float i) {\n float width = _jointsTextureSize.x;\n float height = _jointsTextureSize.y;\n float j = i * 4.0;\n float x = mod(j, width);\n float y = floor(j / width);\n\n float dx = 1.0 / width;\n float dy = 1.0 / height;\n\n y = dy * (y + 0.5);\n\n vec4 v1 = texture2D(_jointsTexture, vec2(dx * (x + 0.5), y));\n vec4 v2 = texture2D(_jointsTexture, vec2(dx * (x + 1.5), y));\n vec4 v3 = texture2D(_jointsTexture, vec2(dx * (x + 2.5), y));\n vec4 v4 = texture2D(_jointsTexture, vec2(dx * (x + 3.5), y));\n\n return mat4(v1, v2, v3, v4);\n }\n #else\n float decode32(vec4 rgba) {\n float Sign = 1.0 - step(128.0, rgba[0]) * 2.0;\n float Exponent = 2.0 * mod(rgba[0], 128.0) + step(128.0, rgba[1]) - 127.0;\n float Mantissa = mod(rgba[1], 128.0) * 65536.0 + rgba[2] * 256.0 + rgba[3] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n }\n vec4 decodevec4 (vec4 x, vec4 y, vec4 z, vec4 w) {\n \n return vec4(\n decode32(x.wzyx * 255.0),\n decode32(y.wzyx * 255.0),\n decode32(z.wzyx * 255.0),\n decode32(w.wzyx * 255.0)\n );\n }\n\n vec4 decodevec4 (float dx, float x, float y) {\n return decodevec4(\n texture2D(_jointsTexture, vec2(dx * (x + 0.5), y)),\n texture2D(_jointsTexture, vec2(dx * (x + 1.5), y)),\n texture2D(_jointsTexture, vec2(dx * (x + 2.5), y)),\n texture2D(_jointsTexture, vec2(dx * (x + 3.5), y))\n );\n }\n\n mat4 getBoneMatrix(const in float i) {\n float width = _jointsTextureSize.x;\n float height = _jointsTextureSize.y;\n float j = i * 16.0;\n float x = mod(j, width);\n float y = floor(j / width);\n\n float dx = 1.0 / width;\n float dy = 1.0 / height;\n\n y = dy * (y + 0.5);\n\n vec4 v1 = decodevec4(dx, x, y);\n vec4 v2 = decodevec4(dx, x+4.0, y);\n vec4 v3 = decodevec4(dx, x+8.0, y);\n vec4 v4 = decodevec4(dx, x+12.0, y);\n\n return mat4(v1, v2, v3, v4);\n }\n #endif\n #else\n const int _JOINT_MATRICES_SIZE = 50;\n uniform mat4 _jointMatrices[_JOINT_MATRICES_SIZE];\n\n mat4 getBoneMatrix(const in float i) {\n return _jointMatrices[int(i)];\n }\n #endif\n\n mat4 skinMatrix() {\n return\n getBoneMatrix(a_joints.x) * a_weights.x +\n getBoneMatrix(a_joints.y) * a_weights.y +\n getBoneMatrix(a_joints.z) * a_weights.z +\n getBoneMatrix(a_joints.w) * a_weights.w\n ;\n }\n#endif\n\nvoid SKIN_VERTEX(inout vec4 a1) {\n #if _USE_SKINNING\n mat4 m = skinMatrix();\n a1 = m * a1;\n #endif\n}\n\nvoid SKIN_VERTEX(inout vec4 a1, inout vec4 a2) {\n #if _USE_SKINNING\n mat4 m = skinMatrix();\n a1 = m * a1;\n a2 = m * a2;\n #endif\n}\n\nvoid SKIN_VERTEX(inout vec4 a1, inout vec4 a2, inout vec4 a3) {\n #if _USE_SKINNING\n mat4 m = skinMatrix();\n a1 = m * a1;\n a2 = m * a2;\n a3 = m * a3;\n #endif\n}\n\nvoid main () {\n vec4 position = vec4(a_position, 1);\n\n SKIN_VERTEX(position);\n ATTRIBUTE_TO_VARYING();\n\n gl_Position = cc_matViewProj * cc_matWorld * position;\n}\n\n\n", 60 | "frag": "\n#define _IS_FRAG_SHADER 1\n\nprecision highp float;\n\n#ifndef USE_DIFFUSE_TEXTURE\n #ifndef USE_EMISSIVE_TEXTURE\n #ifndef USE_SPECULAR_TEXTURE\n #ifndef USE_NORMAL_TEXTURE\n #define _NOT_USE_TEXTURE 1\n #endif\n #endif\n #endif\n#endif\n\n#if USE_TILING_OFFSET && _USE_ATTRIBUTE_UV0\n uniform vec2 mainTiling;\n uniform vec2 mainOffset;\n#endif\n\n#ifdef _IS_VERT_SHADER\n attribute vec3 a_position;\n#endif\n\n#ifndef _NOT_USE_TEXTURE\n\n #if _USE_ATTRIBUTE_UV0\n #ifdef _IS_VERT_SHADER\n attribute mediump vec2 a_uv0;\n #endif\n\n varying mediump vec2 v_uv0;\n #endif\n\n#endif\n\n#if _USE_ATTRIBUTE_COLOR\n\n #ifdef _IS_VERT_SHADER\n attribute lowp vec4 a_color;\n #endif\n\n varying lowp vec4 v_color;\n#endif\n\n#if _USE_ATTRIBUTE_NORMAL\n #ifdef _IS_VERT_SHADER\n attribute vec3 a_normal;\n #endif\n#endif\n\n#ifdef _IS_VERT_SHADER\n\n void ATTRIBUTE_TO_VARYING () {\n\n #if _USE_ATTRIBUTE_COLOR\n v_color = a_color;\n #endif\n\n #ifndef _NOT_USE_TEXTURE\n #if _USE_ATTRIBUTE_UV0\n v_uv0 = a_uv0;\n\n #if USE_TILING_OFFSET\n v_uv0 = v_uv0 * mainTiling + mainOffset;\n #endif\n #endif\n #endif\n\n }\n\n#endif\n\nvoid MUL_ATTR_COLOR (inout vec4 color) {\n #if _USE_ATTRIBUTE_COLOR\n #ifdef _IS_VERT_SHADER\n color *= a_color;\n #else\n color *= v_color;\n #endif\n #endif\n}\n\nvoid MUL_ATTR_NORMAL (inout vec3 normal) {\n #if _USE_ATTRIBUTE_NORMAL\n #ifdef _IS_VERT_SHADER\n normal *= a_normal;\n #endif\n #endif\n}\nvoid MUL_ATTR_NORMAL (inout vec4 normal) {\n #if _USE_ATTRIBUTE_NORMAL\n #ifdef _IS_VERT_SHADER\n normal.xyz *= a_normal;\n #endif\n #endif\n}\n\nvec3 gammaToLinearSpaceRGB(in vec3 sRGB) { \n return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);\n}\n\nvec3 linearToGammaSpaceRGB(in vec3 RGB) { \n vec3 S1 = sqrt(RGB);\n vec3 S2 = sqrt(S1);\n vec3 S3 = sqrt(S2);\n return 0.585122381 * S1 + 0.783140355 * S2 - 0.368262736 * S3;\n}\n\nvec4 gammaToLinearSpaceRGBA(in vec4 sRGBA) {\n return vec4(gammaToLinearSpaceRGB(sRGBA.rgb), sRGBA.a);\n}\n\nvec4 linearToGammaSpaceRGBA(in vec4 RGBA) {\n return vec4(linearToGammaSpaceRGB(RGBA.rgb), RGBA.a);\n}\n\nvec4 linearToLinear (in vec4 value) {\n return value;\n}\n\n#if INPUT_IS_GAMMA\n #define TEXEL_TO_LINEAR gammaToLinearSpaceRGBA\n#else\n #define TEXEL_TO_LINEAR linearToLinear\n#endif\n\n#if OUTPUT_TO_GAMMA\n #define LINEAR_TO_OUTPUT_TEXEL linearToGammaSpaceRGBA\n#else\n #define LINEAR_TO_OUTPUT_TEXEL linearToLinear\n#endif\n\nuniform lowp vec4 diffuseColor;\n\n#if USE_DIFFUSE_TEXTURE\n uniform sampler2D diffuseTexture;\n#endif\n\nvoid MULTIPLY_DIFFUSE_TEXTRUE_COLOR (inout vec4 color, in vec2 uv) {\n #if USE_DIFFUSE_TEXTURE && _USE_ATTRIBUTE_UV0\n vec4 diffuseTextureColor = texture2D(diffuseTexture, uv);\n #if _USE_ETC1_DIFFUSETEXTURE\n diffuseTextureColor.a *= texture2D(diffuseTexture, uv + vec2(0, 0.5)).r;\n #endif\n color *= TEXEL_TO_LINEAR(diffuseTextureColor);\n #endif\n}\n\nvoid MULTIPLY_DIFFUSE_TEXTRUE_COLOR (inout vec4 color) {\n #if USE_DIFFUSE_TEXTURE && _USE_ATTRIBUTE_UV0\n \n #ifdef _IS_VERT_SHADER\n vec2 uv = a_uv0;\n #else\n vec2 uv = v_uv0;\n #endif\n\n MULTIPLY_DIFFUSE_TEXTRUE_COLOR(color, uv);\n #endif\n}\n\nvoid CALC_DIFFUSE (inout vec4 diffuse, in vec2 uv) {\n diffuse = diffuseColor;\n\n MUL_ATTR_COLOR(diffuse);\n MULTIPLY_DIFFUSE_TEXTRUE_COLOR(diffuse, uv);\n}\n\nvoid CALC_DIFFUSE (inout vec4 diffuse) {\n diffuse = diffuseColor;\n\n MUL_ATTR_COLOR(diffuse);\n MULTIPLY_DIFFUSE_TEXTRUE_COLOR(diffuse);\n}\n\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvoid main () {\n vec4 diffuse;\n CALC_DIFFUSE(diffuse);\n ALPHA_TEST(diffuse);\n gl_FragColor = LINEAR_TO_OUTPUT_TEXEL( diffuse );\n}\n\n\n", 61 | "defines": [ 62 | { 63 | "name": "USE_DIFFUSE_TEXTURE", 64 | "type": "boolean", 65 | "defines": [] 66 | }, 67 | { 68 | "name": "USE_EMISSIVE_TEXTURE", 69 | "type": "boolean", 70 | "defines": [ 71 | "USE_DIFFUSE_TEXTURE" 72 | ] 73 | }, 74 | { 75 | "name": "USE_SPECULAR_TEXTURE", 76 | "type": "boolean", 77 | "defines": [ 78 | "USE_DIFFUSE_TEXTURE", 79 | "USE_EMISSIVE_TEXTURE" 80 | ] 81 | }, 82 | { 83 | "name": "USE_NORMAL_TEXTURE", 84 | "type": "boolean", 85 | "defines": [ 86 | "USE_DIFFUSE_TEXTURE", 87 | "USE_EMISSIVE_TEXTURE", 88 | "USE_SPECULAR_TEXTURE" 89 | ] 90 | }, 91 | { 92 | "name": "USE_TILING_OFFSET", 93 | "type": "boolean", 94 | "defines": [] 95 | }, 96 | { 97 | "name": "_USE_ATTRIBUTE_UV0", 98 | "type": "boolean", 99 | "defines": [] 100 | }, 101 | { 102 | "name": "_USE_ATTRIBUTE_COLOR", 103 | "type": "boolean", 104 | "defines": [] 105 | }, 106 | { 107 | "name": "_USE_ATTRIBUTE_NORMAL", 108 | "type": "boolean", 109 | "defines": [] 110 | }, 111 | { 112 | "name": "_USE_SKINNING", 113 | "type": "boolean", 114 | "defines": [] 115 | }, 116 | { 117 | "name": "_USE_JOINTS_TEXTRUE", 118 | "type": "boolean", 119 | "defines": [ 120 | "_USE_SKINNING" 121 | ] 122 | }, 123 | { 124 | "name": "_JOINTS_TEXTURE_FLOAT32", 125 | "type": "boolean", 126 | "defines": [ 127 | "_USE_SKINNING", 128 | "_USE_JOINTS_TEXTRUE" 129 | ] 130 | }, 131 | { 132 | "name": "INPUT_IS_GAMMA", 133 | "type": "boolean", 134 | "defines": [] 135 | }, 136 | { 137 | "name": "OUTPUT_TO_GAMMA", 138 | "type": "boolean", 139 | "defines": [] 140 | }, 141 | { 142 | "name": "_USE_ETC1_DIFFUSETEXTURE", 143 | "type": "boolean", 144 | "defines": [ 145 | "USE_DIFFUSE_TEXTURE", 146 | "_USE_ATTRIBUTE_UV0" 147 | ] 148 | }, 149 | { 150 | "name": "USE_ALPHA_TEST", 151 | "type": "boolean", 152 | "defines": [] 153 | } 154 | ], 155 | "uniforms": [ 156 | { 157 | "name": "mainTiling", 158 | "type": 5, 159 | "property": true, 160 | "defines": [ 161 | "USE_TILING_OFFSET", 162 | "_USE_ATTRIBUTE_UV0" 163 | ] 164 | }, 165 | { 166 | "name": "mainOffset", 167 | "type": 5, 168 | "property": true, 169 | "defines": [ 170 | "USE_TILING_OFFSET", 171 | "_USE_ATTRIBUTE_UV0" 172 | ] 173 | }, 174 | { 175 | "name": "mainTiling", 176 | "type": 5, 177 | "property": true, 178 | "defines": [ 179 | "USE_TILING_OFFSET", 180 | "_USE_ATTRIBUTE_UV0" 181 | ] 182 | }, 183 | { 184 | "name": "mainOffset", 185 | "type": 5, 186 | "property": true, 187 | "defines": [ 188 | "USE_TILING_OFFSET", 189 | "_USE_ATTRIBUTE_UV0" 190 | ] 191 | }, 192 | { 193 | "name": "diffuseColor", 194 | "type": 9, 195 | "property": true, 196 | "defines": [] 197 | }, 198 | { 199 | "name": "diffuseTexture", 200 | "type": 13, 201 | "property": true, 202 | "defines": [ 203 | "USE_DIFFUSE_TEXTURE" 204 | ] 205 | }, 206 | { 207 | "name": "alphaThreshold", 208 | "type": 4, 209 | "property": true, 210 | "defines": [ 211 | "USE_ALPHA_TEST" 212 | ] 213 | } 214 | ], 215 | "attributes": [ 216 | { 217 | "name": "a_position", 218 | "type": 6, 219 | "defines": [] 220 | }, 221 | { 222 | "name": "a_uv0", 223 | "type": 5, 224 | "defines": [ 225 | "_USE_ATTRIBUTE_UV0" 226 | ] 227 | }, 228 | { 229 | "name": "a_color", 230 | "type": 7, 231 | "defines": [ 232 | "_USE_ATTRIBUTE_COLOR" 233 | ] 234 | }, 235 | { 236 | "name": "a_normal", 237 | "type": 6, 238 | "defines": [ 239 | "_USE_ATTRIBUTE_NORMAL" 240 | ] 241 | }, 242 | { 243 | "name": "a_weights", 244 | "type": 7, 245 | "defines": [ 246 | "_USE_SKINNING" 247 | ] 248 | }, 249 | { 250 | "name": "a_joints", 251 | "type": 7, 252 | "defines": [ 253 | "_USE_SKINNING" 254 | ] 255 | }, 256 | { 257 | "name": "a_position", 258 | "type": 6, 259 | "defines": [] 260 | }, 261 | { 262 | "name": "a_uv0", 263 | "type": 5, 264 | "defines": [ 265 | "_USE_ATTRIBUTE_UV0" 266 | ] 267 | }, 268 | { 269 | "name": "a_color", 270 | "type": 7, 271 | "defines": [ 272 | "_USE_ATTRIBUTE_COLOR" 273 | ] 274 | }, 275 | { 276 | "name": "a_normal", 277 | "type": 6, 278 | "defines": [ 279 | "_USE_ATTRIBUTE_NORMAL" 280 | ] 281 | } 282 | ], 283 | "extensions": [], 284 | "name": "8af5ee8040d8725057e4d5f8bac775803dac5e5263fc2495a0b4cc79" 285 | } 286 | ] 287 | } 288 | ] -------------------------------------------------------------------------------- /example/res/import/07/07ce7530a.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.EffectAsset", 4 | "_name": "builtin-2d-gray-sprite", 5 | "properties": { 6 | "texture": { 7 | "type": 13, 8 | "value": null 9 | } 10 | }, 11 | "techniques": [ 12 | { 13 | "passes": [ 14 | { 15 | "cullMode": 0, 16 | "blend": true, 17 | "program": "4c10e7ec534d3f65baabc458cc91fd8dfe66821a283acb75aea070ac" 18 | } 19 | ], 20 | "layer": 0, 21 | "stages": [ 22 | "opaque" 23 | ], 24 | "queue": 0, 25 | "priority": 0 26 | } 27 | ], 28 | "shaders": [ 29 | { 30 | "vert": "\n#define _IS_VERT_SHADER 1\n\nprecision highp float;\n\nuniform mat4 cc_matViewProj;\nattribute vec3 a_position;\nattribute mediump vec2 a_uv0;\nvarying mediump vec2 v_uv0;\n\nvoid main () {\n gl_Position = cc_matViewProj * vec4(a_position, 1);\n v_uv0 = a_uv0;\n}\n\n\n", 31 | "frag": "\n#define _IS_FRAG_SHADER 1\n\nprecision highp float;\n\nuniform sampler2D texture;\nvarying mediump vec2 v_uv0;\n\nvoid main () {\n vec4 color = texture2D(texture, v_uv0);\n #if _USE_ETC1_TEXTURE\n color.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n float gray = 0.2126*color.r + 0.7152*color.g + 0.0722*color.b;\n gl_FragColor = vec4(gray, gray, gray, color.a);\n}\n\n\n", 32 | "defines": [ 33 | { 34 | "name": "_USE_ETC1_TEXTURE", 35 | "type": "boolean", 36 | "defines": [] 37 | } 38 | ], 39 | "uniforms": [ 40 | { 41 | "name": "texture", 42 | "type": 13, 43 | "defines": [] 44 | } 45 | ], 46 | "attributes": [ 47 | { 48 | "name": "a_position", 49 | "type": 6, 50 | "defines": [] 51 | }, 52 | { 53 | "name": "a_uv0", 54 | "type": 5, 55 | "defines": [] 56 | } 57 | ], 58 | "extensions": [], 59 | "name": "4c10e7ec534d3f65baabc458cc91fd8dfe66821a283acb75aea070ac" 60 | } 61 | ] 62 | }, 63 | { 64 | "__type__": "cc.Material", 65 | "_name": "builtin-2d-gray-sprite", 66 | "_effectAsset": { 67 | "__uuid__": "14TDKXr2NJ6LjvHPops74o" 68 | }, 69 | "_defines": {}, 70 | "_props": {} 71 | } 72 | ] -------------------------------------------------------------------------------- /example/res/import/0d/0d669730c.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.EffectAsset", 4 | "_name": "builtin-clear-stencil", 5 | "properties": {}, 6 | "techniques": [ 7 | { 8 | "passes": [ 9 | { 10 | "cullMode": 0, 11 | "blend": true, 12 | "program": "ecffb93dd8898d482a87ab9b7d996968df31634fee23f1aa5de47906" 13 | } 14 | ], 15 | "layer": 0, 16 | "stages": [ 17 | "opaque" 18 | ], 19 | "queue": 0, 20 | "priority": 0 21 | } 22 | ], 23 | "shaders": [ 24 | { 25 | "vert": "\n#define _IS_VERT_SHADER 1\n\nprecision highp float;\n\nattribute vec3 a_position;\n\nvoid main () {\n gl_Position = vec4(a_position, 1);\n}\n\n\n", 26 | "frag": "\n#define _IS_FRAG_SHADER 1\n\nprecision highp float;\n\nvoid main () {\n gl_FragColor = vec4(1.0);\n}\n\n\n", 27 | "defines": [], 28 | "uniforms": [], 29 | "attributes": [ 30 | { 31 | "name": "a_position", 32 | "type": 6, 33 | "defines": [] 34 | } 35 | ], 36 | "extensions": [], 37 | "name": "ecffb93dd8898d482a87ab9b7d996968df31634fee23f1aa5de47906" 38 | } 39 | ] 40 | }, 41 | { 42 | "__type__": "cc.Material", 43 | "_name": "builtin-clear-stencil", 44 | "_effectAsset": { 45 | "__uuid__": "c0BAyVxX9JzZy8EjFrc9DU" 46 | }, 47 | "_defines": {}, 48 | "_props": {} 49 | } 50 | ] -------------------------------------------------------------------------------- /example/res/import/0e/0e4bc3b03.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.EffectAsset", 4 | "_name": "builtin-2d-spine", 5 | "properties": { 6 | "texture": { 7 | "type": 13, 8 | "value": null 9 | }, 10 | "alphaThreshold": { 11 | "value": 0.5 12 | } 13 | }, 14 | "techniques": [ 15 | { 16 | "passes": [ 17 | { 18 | "cullMode": 0, 19 | "blend": true, 20 | "program": "7b385aeea63c6235fbf39dd4bf009f23c884ecc0ebb6dcef392ae264" 21 | } 22 | ], 23 | "layer": 0, 24 | "stages": [ 25 | "opaque" 26 | ], 27 | "queue": 0, 28 | "priority": 0 29 | } 30 | ], 31 | "shaders": [ 32 | { 33 | "vert": "\n#define _IS_VERT_SHADER 1\n\nprecision highp float;\n\nuniform mat4 cc_matViewProj;\n\n#if _USE_MODEL\n uniform mat4 cc_matWorld;\n#endif\n\nattribute vec3 a_position;\nattribute lowp vec4 a_color;\n#if USE_TINT\n attribute lowp vec4 a_color0;\n#endif\n\nattribute mediump vec2 a_uv0;\nvarying mediump vec2 v_uv0;\n\nvarying lowp vec4 v_light;\n#if USE_TINT\n varying lowp vec4 v_dark;\n#endif\n\nvoid main () {\n mat4 mvp;\n \n #if _USE_MODEL\n mvp = cc_matViewProj * cc_matWorld;\n #else\n mvp = cc_matViewProj;\n #endif\n\n v_uv0 = a_uv0;\n\n v_light = a_color;\n #if USE_TINT\n v_dark = a_color0;\n #endif\n\n gl_Position = mvp * vec4(a_position, 1);\n}\n\n\n", 34 | "frag": "\n#define _IS_FRAG_SHADER 1\n\nprecision highp float;\n\nuniform sampler2D texture;\nvarying mediump vec2 v_uv0;\n\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying lowp vec4 v_light;\n#if USE_TINT\n varying lowp vec4 v_dark;\n#endif\n\nvoid main () {\n vec4 texColor = texture2D(texture, v_uv0);\n #if _USE_ETC1_TEXTURE\n texColor.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n vec4 finalColor;\n\n #if USE_TINT\n finalColor.a = v_light.a * texColor.a;\n finalColor.rgb = ((texColor.a - 1.0) * v_dark.a + 1.0 - texColor.rgb) * v_dark.rgb + texColor.rgb * v_light.rgb;\n #else\n finalColor = texColor * v_light;\n #endif\n\n ALPHA_TEST(finalColor);\n\n gl_FragColor = finalColor;\n}\n\n\n", 35 | "defines": [ 36 | { 37 | "name": "_USE_MODEL", 38 | "type": "boolean", 39 | "defines": [] 40 | }, 41 | { 42 | "name": "USE_TINT", 43 | "type": "boolean", 44 | "defines": [] 45 | }, 46 | { 47 | "name": "USE_ALPHA_TEST", 48 | "type": "boolean", 49 | "defines": [] 50 | }, 51 | { 52 | "name": "_USE_ETC1_TEXTURE", 53 | "type": "boolean", 54 | "defines": [] 55 | } 56 | ], 57 | "uniforms": [ 58 | { 59 | "name": "texture", 60 | "type": 13, 61 | "defines": [] 62 | }, 63 | { 64 | "name": "alphaThreshold", 65 | "type": 4, 66 | "property": true, 67 | "defines": [ 68 | "USE_ALPHA_TEST" 69 | ] 70 | } 71 | ], 72 | "attributes": [ 73 | { 74 | "name": "a_position", 75 | "type": 6, 76 | "defines": [] 77 | }, 78 | { 79 | "name": "a_color", 80 | "type": 7, 81 | "defines": [] 82 | }, 83 | { 84 | "name": "a_color0", 85 | "type": 7, 86 | "defines": [ 87 | "USE_TINT" 88 | ] 89 | }, 90 | { 91 | "name": "a_uv0", 92 | "type": 5, 93 | "defines": [] 94 | } 95 | ], 96 | "extensions": [], 97 | "name": "7b385aeea63c6235fbf39dd4bf009f23c884ecc0ebb6dcef392ae264" 98 | } 99 | ] 100 | }, 101 | { 102 | "__type__": "cc.Material", 103 | "_name": "builtin-2d-spine", 104 | "_effectAsset": { 105 | "__uuid__": "0ek66qC1NOQLjgYmi04HvX" 106 | }, 107 | "_defines": {}, 108 | "_props": {} 109 | } 110 | ] -------------------------------------------------------------------------------- /example/res/import/0f/0fe591e5f.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "__type__": "cc.SpriteFrame", 4 | "content": { 5 | "name": "bg", 6 | "texture": "17a874b44", 7 | "rect": [ 8 | 3, 9 | 441, 10 | 64, 11 | 64 12 | ], 13 | "offset": [ 14 | 0, 15 | 0 16 | ], 17 | "originalSize": [ 18 | 64, 19 | 64 20 | ], 21 | "capInsets": [ 22 | 0, 23 | 0, 24 | 0, 25 | 0 26 | ] 27 | } 28 | }, 29 | { 30 | "__type__": "cc.SpriteFrame", 31 | "content": { 32 | "name": "back", 33 | "texture": "17a874b44", 34 | "rect": [ 35 | 283, 36 | 441, 37 | 64, 38 | 64 39 | ], 40 | "offset": [ 41 | 0, 42 | 0 43 | ], 44 | "originalSize": [ 45 | 64, 46 | 64 47 | ], 48 | "capInsets": [ 49 | 0, 50 | 0, 51 | 0, 52 | 0 53 | ] 54 | } 55 | }, 56 | [ 57 | { 58 | "__type__": "cc.SceneAsset", 59 | "_name": "scInput", 60 | "scene": { 61 | "__id__": 1 62 | }, 63 | "asyncLoadAssets": null 64 | }, 65 | { 66 | "__type__": "cc.Scene", 67 | "_name": "New Node", 68 | "_children": [ 69 | { 70 | "__id__": 2 71 | } 72 | ], 73 | "_anchorPoint": { 74 | "__type__": "cc.Vec2" 75 | }, 76 | "autoReleaseAssets": false 77 | }, 78 | { 79 | "__type__": "cc.Node", 80 | "_name": "Canvas", 81 | "_parent": { 82 | "__id__": 1 83 | }, 84 | "_children": [ 85 | { 86 | "__id__": 3 87 | }, 88 | { 89 | "__id__": 4 90 | } 91 | ], 92 | "_components": [ 93 | { 94 | "__type__": "cc.Canvas", 95 | "node": { 96 | "__id__": 2 97 | }, 98 | "_designResolution": { 99 | "__type__": "cc.Size", 100 | "width": 720, 101 | "height": 1280 102 | } 103 | }, 104 | { 105 | "__type__": "5ab2cOWsmBEzJE2stDVAwzv", 106 | "node": { 107 | "__id__": 2 108 | }, 109 | "btnBack": { 110 | "__id__": 6 111 | }, 112 | "editBox": { 113 | "__id__": 14 114 | } 115 | } 116 | ], 117 | "_contentSize": { 118 | "__type__": "cc.Size", 119 | "width": 720, 120 | "height": 1280 121 | }, 122 | "_position": { 123 | "__type__": "cc.Vec3", 124 | "x": 360, 125 | "y": 640 126 | }, 127 | "_id": "a42S99IlBAaZbxW44TfsmU" 128 | }, 129 | { 130 | "__type__": "cc.Node", 131 | "_name": "Main Camera", 132 | "_parent": { 133 | "__id__": 2 134 | }, 135 | "_level": 1, 136 | "_components": [ 137 | { 138 | "__type__": "cc.Camera", 139 | "node": { 140 | "__id__": 3 141 | }, 142 | "_clearFlags": 7, 143 | "_depth": -1 144 | } 145 | ] 146 | }, 147 | { 148 | "__type__": "cc.Node", 149 | "_name": "bg", 150 | "_parent": { 151 | "__id__": 2 152 | }, 153 | "_children": [ 154 | { 155 | "__id__": 5 156 | } 157 | ], 158 | "_level": 1, 159 | "_components": [ 160 | { 161 | "__type__": "cc.Sprite", 162 | "node": { 163 | "__id__": 4 164 | }, 165 | "_materials": [ 166 | { 167 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 168 | } 169 | ], 170 | "_spriteFrame": { 171 | "__uuid__": "23p7p9ZPtMEIqH/jUu3z9N" 172 | }, 173 | "_sizeMode": 0 174 | }, 175 | { 176 | "__type__": "cc.Widget", 177 | "node": { 178 | "__id__": 4 179 | }, 180 | "_alignFlags": 45, 181 | "_originalWidth": 64, 182 | "_originalHeight": 64 183 | } 184 | ], 185 | "_contentSize": { 186 | "__type__": "cc.Size", 187 | "width": 720, 188 | "height": 1280 189 | } 190 | }, 191 | { 192 | "__type__": "cc.Node", 193 | "_name": "title", 194 | "_parent": { 195 | "__id__": 4 196 | }, 197 | "_children": [ 198 | { 199 | "__id__": 6 200 | }, 201 | { 202 | "__id__": 7 203 | }, 204 | { 205 | "__id__": 15 206 | }, 207 | { 208 | "__id__": 16 209 | }, 210 | { 211 | "__id__": 17 212 | } 213 | ], 214 | "_level": 2, 215 | "_components": [ 216 | { 217 | "__type__": "cc.Label", 218 | "node": { 219 | "__id__": 5 220 | }, 221 | "_materials": [ 222 | { 223 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 224 | } 225 | ], 226 | "_useOriginalSize": false, 227 | "_string": "输入同步", 228 | "_N$string": "输入同步", 229 | "_fontSize": 48, 230 | "_lineHeight": 64, 231 | "_N$horizontalAlign": 1, 232 | "_N$verticalAlign": 1, 233 | "_N$overflow": 1 234 | }, 235 | { 236 | "__type__": "cc.Widget", 237 | "node": { 238 | "__id__": 5 239 | }, 240 | "_alignFlags": 41, 241 | "_originalWidth": 128 242 | } 243 | ], 244 | "_color": { 245 | "__type__": "cc.Color" 246 | }, 247 | "_contentSize": { 248 | "__type__": "cc.Size", 249 | "width": 720, 250 | "height": 80.64 251 | }, 252 | "_position": { 253 | "__type__": "cc.Vec3", 254 | "y": 599.68 255 | } 256 | }, 257 | { 258 | "__type__": "cc.Node", 259 | "_name": "btnBack", 260 | "_parent": { 261 | "__id__": 5 262 | }, 263 | "_level": 3, 264 | "_components": [ 265 | { 266 | "__type__": "cc.Sprite", 267 | "node": { 268 | "__id__": 6 269 | }, 270 | "_materials": [ 271 | { 272 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 273 | } 274 | ], 275 | "_spriteFrame": { 276 | "__uuid__": "efBTQ+DQ1P/6x28hpSLY5g" 277 | } 278 | }, 279 | { 280 | "__type__": "cc.Button", 281 | "node": { 282 | "__id__": 6 283 | } 284 | }, 285 | { 286 | "__type__": "cc.Widget", 287 | "node": { 288 | "__id__": 6 289 | }, 290 | "_alignFlags": 8, 291 | "_left": 20, 292 | "_top": 619.68 293 | } 294 | ], 295 | "_color": { 296 | "__type__": "cc.Color" 297 | }, 298 | "_contentSize": { 299 | "__type__": "cc.Size", 300 | "width": 64, 301 | "height": 64 302 | }, 303 | "_position": { 304 | "__type__": "cc.Vec3", 305 | "x": -308 306 | } 307 | }, 308 | { 309 | "__type__": "cc.Node", 310 | "_name": "editBox", 311 | "_parent": { 312 | "__id__": 5 313 | }, 314 | "_children": [ 315 | { 316 | "__id__": 8 317 | }, 318 | { 319 | "__id__": 10 320 | }, 321 | { 322 | "__id__": 12 323 | } 324 | ], 325 | "_level": 3, 326 | "_components": [ 327 | { 328 | "__id__": 14 329 | }, 330 | { 331 | "__type__": "159cd/BYKxFcricpYxhpsCX", 332 | "node": { 333 | "__id__": 7 334 | }, 335 | "type": 2, 336 | "val": "input.txt" 337 | } 338 | ], 339 | "_contentSize": { 340 | "__type__": "cc.Size", 341 | "width": 360, 342 | "height": 64 343 | }, 344 | "_position": { 345 | "__type__": "cc.Vec3", 346 | "y": -130.609 347 | } 348 | }, 349 | { 350 | "__type__": "cc.Node", 351 | "_name": "BACKGROUND_SPRITE", 352 | "_parent": { 353 | "__id__": 7 354 | }, 355 | "_level": 2, 356 | "_components": [ 357 | { 358 | "__id__": 9 359 | }, 360 | { 361 | "__type__": "cc.Widget", 362 | "node": { 363 | "__id__": 8 364 | }, 365 | "alignMode": 0, 366 | "_alignFlags": 45, 367 | "_originalWidth": 160, 368 | "_originalHeight": 40 369 | } 370 | ], 371 | "_contentSize": { 372 | "__type__": "cc.Size", 373 | "width": 360, 374 | "height": 64 375 | } 376 | }, 377 | { 378 | "__type__": "cc.Sprite", 379 | "node": { 380 | "__id__": 8 381 | }, 382 | "_materials": [ 383 | { 384 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 385 | } 386 | ], 387 | "_spriteFrame": { 388 | "__uuid__": "ffDpHHVcZAhqOfy25Fe4w7" 389 | }, 390 | "_type": 1, 391 | "_sizeMode": 0 392 | }, 393 | { 394 | "__type__": "cc.Node", 395 | "_name": "TEXT_LABEL", 396 | "_parent": { 397 | "__id__": 7 398 | }, 399 | "_active": false, 400 | "_level": 2, 401 | "_components": [ 402 | { 403 | "__id__": 11 404 | }, 405 | { 406 | "__type__": "cc.Widget", 407 | "node": { 408 | "__id__": 10 409 | }, 410 | "alignMode": 0, 411 | "_alignFlags": 45, 412 | "_left": 2, 413 | "_originalWidth": 158, 414 | "_originalHeight": 40 415 | } 416 | ], 417 | "_contentSize": { 418 | "__type__": "cc.Size", 419 | "width": 158, 420 | "height": 40 421 | }, 422 | "_anchorPoint": { 423 | "__type__": "cc.Vec2", 424 | "y": 1 425 | }, 426 | "_position": { 427 | "__type__": "cc.Vec3", 428 | "x": -78, 429 | "y": 20 430 | } 431 | }, 432 | { 433 | "__type__": "cc.Label", 434 | "node": { 435 | "__id__": 10 436 | }, 437 | "_fontSize": 28, 438 | "_lineHeight": 30, 439 | "_enableWrapText": false, 440 | "_N$horizontalAlign": 1, 441 | "_N$verticalAlign": 1, 442 | "_N$overflow": 1 443 | }, 444 | { 445 | "__type__": "cc.Node", 446 | "_name": "PLACEHOLDER_LABEL", 447 | "_parent": { 448 | "__id__": 7 449 | }, 450 | "_level": 2, 451 | "_components": [ 452 | { 453 | "__id__": 13 454 | }, 455 | { 456 | "__type__": "cc.Widget", 457 | "node": { 458 | "__id__": 12 459 | }, 460 | "alignMode": 0, 461 | "_alignFlags": 45, 462 | "_left": 2, 463 | "_originalWidth": 158, 464 | "_originalHeight": 40 465 | } 466 | ], 467 | "_color": { 468 | "__type__": "cc.Color", 469 | "r": 187, 470 | "g": 187, 471 | "b": 187 472 | }, 473 | "_contentSize": { 474 | "__type__": "cc.Size", 475 | "width": 358, 476 | "height": 64 477 | }, 478 | "_anchorPoint": { 479 | "__type__": "cc.Vec2", 480 | "y": 1 481 | }, 482 | "_position": { 483 | "__type__": "cc.Vec3", 484 | "x": -178, 485 | "y": 32 486 | } 487 | }, 488 | { 489 | "__type__": "cc.Label", 490 | "node": { 491 | "__id__": 12 492 | }, 493 | "_materials": [ 494 | { 495 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 496 | } 497 | ], 498 | "_string": "随便输入点什么", 499 | "_N$string": "随便输入点什么", 500 | "_fontSize": 28, 501 | "_lineHeight": 30, 502 | "_enableWrapText": false, 503 | "_N$horizontalAlign": 1, 504 | "_N$verticalAlign": 1, 505 | "_N$overflow": 1 506 | }, 507 | { 508 | "__type__": "cc.EditBox", 509 | "node": { 510 | "__id__": 7 511 | }, 512 | "_useOriginalSize": false, 513 | "maxLength": 18, 514 | "_N$textLabel": { 515 | "__id__": 11 516 | }, 517 | "_N$placeholderLabel": { 518 | "__id__": 13 519 | }, 520 | "_N$background": { 521 | "__id__": 9 522 | }, 523 | "_N$inputMode": 6 524 | }, 525 | { 526 | "__type__": "cc.Node", 527 | "_name": "txt1", 528 | "_parent": { 529 | "__id__": 5 530 | }, 531 | "_level": 3, 532 | "_components": [ 533 | { 534 | "__type__": "cc.Label", 535 | "node": { 536 | "__id__": 15 537 | }, 538 | "_materials": [ 539 | { 540 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 541 | } 542 | ], 543 | "_useOriginalSize": false, 544 | "_string": "Label", 545 | "_N$string": "Label", 546 | "_N$horizontalAlign": 1, 547 | "_N$verticalAlign": 1 548 | }, 549 | { 550 | "__type__": "159cd/BYKxFcricpYxhpsCX", 551 | "node": { 552 | "__id__": 15 553 | }, 554 | "type": 1, 555 | "val": "input.txt" 556 | } 557 | ], 558 | "_color": { 559 | "__type__": "cc.Color" 560 | }, 561 | "_contentSize": { 562 | "__type__": "cc.Size", 563 | "width": 97.87, 564 | "height": 50.4 565 | }, 566 | "_position": { 567 | "__type__": "cc.Vec3", 568 | "y": -219.331 569 | } 570 | }, 571 | { 572 | "__type__": "cc.Node", 573 | "_name": "txt2", 574 | "_parent": { 575 | "__id__": 5 576 | }, 577 | "_level": 3, 578 | "_components": [ 579 | { 580 | "__type__": "cc.Label", 581 | "node": { 582 | "__id__": 16 583 | }, 584 | "_materials": [ 585 | { 586 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 587 | } 588 | ], 589 | "_useOriginalSize": false, 590 | "_string": "Label", 591 | "_N$string": "Label", 592 | "_N$horizontalAlign": 1, 593 | "_N$verticalAlign": 1 594 | }, 595 | { 596 | "__type__": "159cd/BYKxFcricpYxhpsCX", 597 | "node": { 598 | "__id__": 16 599 | }, 600 | "type": 1, 601 | "val": "input.txt", 602 | "formator": "您输入了(%s)" 603 | } 604 | ], 605 | "_color": { 606 | "__type__": "cc.Color" 607 | }, 608 | "_contentSize": { 609 | "__type__": "cc.Size", 610 | "width": 97.87, 611 | "height": 50.4 612 | }, 613 | "_position": { 614 | "__type__": "cc.Vec3", 615 | "y": -301.67 616 | } 617 | }, 618 | { 619 | "__type__": "cc.Node", 620 | "_name": "txt3", 621 | "_parent": { 622 | "__id__": 5 623 | }, 624 | "_level": 3, 625 | "_components": [ 626 | { 627 | "__type__": "cc.Label", 628 | "node": { 629 | "__id__": 17 630 | }, 631 | "_materials": [ 632 | { 633 | "__uuid__": "ecpdLyjvZBwrvm+cedCcQy" 634 | } 635 | ], 636 | "_useOriginalSize": false, 637 | "_string": "Label", 638 | "_N$string": "Label", 639 | "_N$horizontalAlign": 1, 640 | "_N$verticalAlign": 1 641 | }, 642 | { 643 | "__type__": "159cd/BYKxFcricpYxhpsCX", 644 | "node": { 645 | "__id__": 17 646 | }, 647 | "type": 1, 648 | "val": "input.txt", 649 | "formator": "reverseFunc" 650 | } 651 | ], 652 | "_color": { 653 | "__type__": "cc.Color" 654 | }, 655 | "_contentSize": { 656 | "__type__": "cc.Size", 657 | "width": 97.87, 658 | "height": 50.4 659 | }, 660 | "_position": { 661 | "__type__": "cc.Vec3", 662 | "y": -384.009 663 | } 664 | } 665 | ], 666 | { 667 | "__type__": "cc.SpriteFrame", 668 | "content": { 669 | "name": "default_editbox_bg", 670 | "texture": "ed0hW5J5ZKBar1gflskoHO", 671 | "rect": [ 672 | 0, 673 | 0, 674 | 40, 675 | 40 676 | ], 677 | "offset": [ 678 | 0, 679 | 0 680 | ], 681 | "originalSize": [ 682 | 40, 683 | 40 684 | ], 685 | "capInsets": [ 686 | 12, 687 | 12, 688 | 12, 689 | 12 690 | ] 691 | } 692 | } 693 | ] -------------------------------------------------------------------------------- /example/res/import/28/2874f8dd-416c-4440-81b7-555975426e93.json: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.EffectAsset", 3 | "_name": "builtin-2d-sprite", 4 | "properties": { 5 | "texture": { 6 | "type": 13, 7 | "value": null 8 | }, 9 | "alphaThreshold": { 10 | "value": 0.5 11 | } 12 | }, 13 | "techniques": [ 14 | { 15 | "passes": [ 16 | { 17 | "cullMode": 0, 18 | "blend": true, 19 | "program": "cea1abc1cddcfe17654f435ec4a977f72769819d4d7c0460b90eedb5" 20 | } 21 | ], 22 | "layer": 0, 23 | "stages": [ 24 | "opaque" 25 | ], 26 | "queue": 0, 27 | "priority": 0 28 | } 29 | ], 30 | "shaders": [ 31 | { 32 | "vert": "\n#define _IS_VERT_SHADER 1\n\nprecision highp float;\n\nuniform mat4 cc_matViewProj;\n\n#if _USE_MODEL\n uniform mat4 cc_matWorld;\n#endif\n\nattribute vec3 a_position;\nattribute lowp vec4 a_color;\n\n#if USE_TEXTURE\n attribute mediump vec2 a_uv0;\n varying mediump vec2 v_uv0;\n#endif\n\nvarying lowp vec4 v_color;\n\nvoid main () {\n mat4 mvp;\n \n #if _USE_MODEL\n mvp = cc_matViewProj * cc_matWorld;\n #else\n mvp = cc_matViewProj;\n #endif\n\n #if USE_TEXTURE\n v_uv0 = a_uv0;\n #endif\n\n v_color = a_color;\n\n gl_Position = mvp * vec4(a_position, 1);\n}\n\n\n", 33 | "frag": "\n#define _IS_FRAG_SHADER 1\n\nprecision highp float;\n\n#if USE_TEXTURE\n uniform sampler2D texture;\n varying mediump vec2 v_uv0;\n#endif\n\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvarying lowp vec4 v_color;\n\nvoid main () {\n vec4 color = v_color;\n\n #if USE_TEXTURE\n color *= texture2D(texture, v_uv0);\n #if _USE_ETC1_TEXTURE\n color.a *= texture2D(texture, v_uv0 + vec2(0, 0.5)).r;\n #endif\n #endif\n\n ALPHA_TEST(color);\n\n gl_FragColor = color;\n}\n\n\n", 34 | "defines": [ 35 | { 36 | "name": "_USE_MODEL", 37 | "type": "boolean", 38 | "defines": [] 39 | }, 40 | { 41 | "name": "USE_TEXTURE", 42 | "type": "boolean", 43 | "defines": [] 44 | }, 45 | { 46 | "name": "USE_ALPHA_TEST", 47 | "type": "boolean", 48 | "defines": [] 49 | }, 50 | { 51 | "name": "_USE_ETC1_TEXTURE", 52 | "type": "boolean", 53 | "defines": [ 54 | "USE_TEXTURE" 55 | ] 56 | } 57 | ], 58 | "uniforms": [ 59 | { 60 | "name": "texture", 61 | "type": 13, 62 | "defines": [ 63 | "USE_TEXTURE" 64 | ] 65 | }, 66 | { 67 | "name": "alphaThreshold", 68 | "type": 4, 69 | "property": true, 70 | "defines": [ 71 | "USE_ALPHA_TEST" 72 | ] 73 | } 74 | ], 75 | "attributes": [ 76 | { 77 | "name": "a_position", 78 | "type": 6, 79 | "defines": [] 80 | }, 81 | { 82 | "name": "a_color", 83 | "type": 7, 84 | "defines": [] 85 | }, 86 | { 87 | "name": "a_uv0", 88 | "type": 5, 89 | "defines": [ 90 | "USE_TEXTURE" 91 | ] 92 | } 93 | ], 94 | "extensions": [], 95 | "name": "cea1abc1cddcfe17654f435ec4a977f72769819d4d7c0460b90eedb5" 96 | } 97 | ] 98 | } -------------------------------------------------------------------------------- /example/res/import/6f/6f801092-0c37-4f30-89ef-c8d960825b36.json: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.Material", 3 | "_name": "builtin-2d-base", 4 | "_effectAsset": { 5 | "__uuid__": "28dPjdQWxEQIG3VVl1Qm6T" 6 | }, 7 | "_defines": {}, 8 | "_props": {} 9 | } -------------------------------------------------------------------------------- /example/res/import/79/79eafaef-b7ef-45d9-9c3f-591dc836fc7a.json: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.EffectAsset", 3 | "_name": "builtin-unlit-transparent", 4 | "properties": { 5 | "diffuseTexture": { 6 | "type": 13, 7 | "value": null 8 | }, 9 | "diffuseColor": { 10 | "type": 9, 11 | "value": [ 12 | 1, 13 | 1, 14 | 1, 15 | 1 16 | ] 17 | } 18 | }, 19 | "techniques": [ 20 | { 21 | "stages": [ 22 | "transparent" 23 | ], 24 | "passes": [ 25 | { 26 | "depthTest": true, 27 | "depthWrite": false, 28 | "blend": true, 29 | "blendEq": 32774, 30 | "blendSrc": 770, 31 | "blendDst": 771, 32 | "blendAlphaEq": 32774, 33 | "blendSrcAlpha": 1, 34 | "blendDstAlpha": 771, 35 | "program": "8af5ee8040d8725057e4d5f8bac775803dac5e5263fc2495a0b4cc79" 36 | } 37 | ], 38 | "layer": 0, 39 | "queue": 0, 40 | "priority": 0 41 | } 42 | ], 43 | "shaders": [ 44 | { 45 | "vert": "\n#define _IS_VERT_SHADER 1\n\nprecision highp float;\n\nuniform mat4 cc_matWorld;\nuniform mat3 cc_matWorldIT;\n\nuniform mat4 cc_matView;\n\nuniform mat4 cc_matViewProj;\n\nuniform vec3 cc_cameraPos; \n\nuniform vec3 cc_sceneAmbient; \n\n#ifndef USE_DIFFUSE_TEXTURE\n #ifndef USE_EMISSIVE_TEXTURE\n #ifndef USE_SPECULAR_TEXTURE\n #ifndef USE_NORMAL_TEXTURE\n #define _NOT_USE_TEXTURE 1\n #endif\n #endif\n #endif\n#endif\n\n#if USE_TILING_OFFSET && _USE_ATTRIBUTE_UV0\n uniform vec2 mainTiling;\n uniform vec2 mainOffset;\n#endif\n\n#ifdef _IS_VERT_SHADER\n attribute vec3 a_position;\n#endif\n\n#ifndef _NOT_USE_TEXTURE\n\n #if _USE_ATTRIBUTE_UV0\n #ifdef _IS_VERT_SHADER\n attribute mediump vec2 a_uv0;\n #endif\n\n varying mediump vec2 v_uv0;\n #endif\n\n#endif\n\n#if _USE_ATTRIBUTE_COLOR\n\n #ifdef _IS_VERT_SHADER\n attribute lowp vec4 a_color;\n #endif\n\n varying lowp vec4 v_color;\n#endif\n\n#if _USE_ATTRIBUTE_NORMAL\n #ifdef _IS_VERT_SHADER\n attribute vec3 a_normal;\n #endif\n#endif\n\n#ifdef _IS_VERT_SHADER\n\n void ATTRIBUTE_TO_VARYING () {\n\n #if _USE_ATTRIBUTE_COLOR\n v_color = a_color;\n #endif\n\n #ifndef _NOT_USE_TEXTURE\n #if _USE_ATTRIBUTE_UV0\n v_uv0 = a_uv0;\n\n #if USE_TILING_OFFSET\n v_uv0 = v_uv0 * mainTiling + mainOffset;\n #endif\n #endif\n #endif\n\n }\n\n#endif\n\nvoid MUL_ATTR_COLOR (inout vec4 color) {\n #if _USE_ATTRIBUTE_COLOR\n #ifdef _IS_VERT_SHADER\n color *= a_color;\n #else\n color *= v_color;\n #endif\n #endif\n}\n\nvoid MUL_ATTR_NORMAL (inout vec3 normal) {\n #if _USE_ATTRIBUTE_NORMAL\n #ifdef _IS_VERT_SHADER\n normal *= a_normal;\n #endif\n #endif\n}\nvoid MUL_ATTR_NORMAL (inout vec4 normal) {\n #if _USE_ATTRIBUTE_NORMAL\n #ifdef _IS_VERT_SHADER\n normal.xyz *= a_normal;\n #endif\n #endif\n}\n\n#if _USE_SKINNING\n\n attribute vec4 a_weights;\n attribute vec4 a_joints;\n\n #if _USE_JOINTS_TEXTRUE\n uniform sampler2D _jointsTexture;\n uniform vec2 _jointsTextureSize;\n\n #if _JOINTS_TEXTURE_FLOAT32\n mat4 getBoneMatrix(const in float i) {\n float width = _jointsTextureSize.x;\n float height = _jointsTextureSize.y;\n float j = i * 4.0;\n float x = mod(j, width);\n float y = floor(j / width);\n\n float dx = 1.0 / width;\n float dy = 1.0 / height;\n\n y = dy * (y + 0.5);\n\n vec4 v1 = texture2D(_jointsTexture, vec2(dx * (x + 0.5), y));\n vec4 v2 = texture2D(_jointsTexture, vec2(dx * (x + 1.5), y));\n vec4 v3 = texture2D(_jointsTexture, vec2(dx * (x + 2.5), y));\n vec4 v4 = texture2D(_jointsTexture, vec2(dx * (x + 3.5), y));\n\n return mat4(v1, v2, v3, v4);\n }\n #else\n float decode32(vec4 rgba) {\n float Sign = 1.0 - step(128.0, rgba[0]) * 2.0;\n float Exponent = 2.0 * mod(rgba[0], 128.0) + step(128.0, rgba[1]) - 127.0;\n float Mantissa = mod(rgba[1], 128.0) * 65536.0 + rgba[2] * 256.0 + rgba[3] + 8388608.0;\n return Sign * exp2(Exponent - 23.0) * Mantissa;\n }\n vec4 decodevec4 (vec4 x, vec4 y, vec4 z, vec4 w) {\n \n return vec4(\n decode32(x.wzyx * 255.0),\n decode32(y.wzyx * 255.0),\n decode32(z.wzyx * 255.0),\n decode32(w.wzyx * 255.0)\n );\n }\n\n vec4 decodevec4 (float dx, float x, float y) {\n return decodevec4(\n texture2D(_jointsTexture, vec2(dx * (x + 0.5), y)),\n texture2D(_jointsTexture, vec2(dx * (x + 1.5), y)),\n texture2D(_jointsTexture, vec2(dx * (x + 2.5), y)),\n texture2D(_jointsTexture, vec2(dx * (x + 3.5), y))\n );\n }\n\n mat4 getBoneMatrix(const in float i) {\n float width = _jointsTextureSize.x;\n float height = _jointsTextureSize.y;\n float j = i * 16.0;\n float x = mod(j, width);\n float y = floor(j / width);\n\n float dx = 1.0 / width;\n float dy = 1.0 / height;\n\n y = dy * (y + 0.5);\n\n vec4 v1 = decodevec4(dx, x, y);\n vec4 v2 = decodevec4(dx, x+4.0, y);\n vec4 v3 = decodevec4(dx, x+8.0, y);\n vec4 v4 = decodevec4(dx, x+12.0, y);\n\n return mat4(v1, v2, v3, v4);\n }\n #endif\n #else\n const int _JOINT_MATRICES_SIZE = 50;\n uniform mat4 _jointMatrices[_JOINT_MATRICES_SIZE];\n\n mat4 getBoneMatrix(const in float i) {\n return _jointMatrices[int(i)];\n }\n #endif\n\n mat4 skinMatrix() {\n return\n getBoneMatrix(a_joints.x) * a_weights.x +\n getBoneMatrix(a_joints.y) * a_weights.y +\n getBoneMatrix(a_joints.z) * a_weights.z +\n getBoneMatrix(a_joints.w) * a_weights.w\n ;\n }\n#endif\n\nvoid SKIN_VERTEX(inout vec4 a1) {\n #if _USE_SKINNING\n mat4 m = skinMatrix();\n a1 = m * a1;\n #endif\n}\n\nvoid SKIN_VERTEX(inout vec4 a1, inout vec4 a2) {\n #if _USE_SKINNING\n mat4 m = skinMatrix();\n a1 = m * a1;\n a2 = m * a2;\n #endif\n}\n\nvoid SKIN_VERTEX(inout vec4 a1, inout vec4 a2, inout vec4 a3) {\n #if _USE_SKINNING\n mat4 m = skinMatrix();\n a1 = m * a1;\n a2 = m * a2;\n a3 = m * a3;\n #endif\n}\n\nvoid main () {\n vec4 position = vec4(a_position, 1);\n\n SKIN_VERTEX(position);\n ATTRIBUTE_TO_VARYING();\n\n gl_Position = cc_matViewProj * cc_matWorld * position;\n}\n\n\n", 46 | "frag": "\n#define _IS_FRAG_SHADER 1\n\nprecision highp float;\n\n#ifndef USE_DIFFUSE_TEXTURE\n #ifndef USE_EMISSIVE_TEXTURE\n #ifndef USE_SPECULAR_TEXTURE\n #ifndef USE_NORMAL_TEXTURE\n #define _NOT_USE_TEXTURE 1\n #endif\n #endif\n #endif\n#endif\n\n#if USE_TILING_OFFSET && _USE_ATTRIBUTE_UV0\n uniform vec2 mainTiling;\n uniform vec2 mainOffset;\n#endif\n\n#ifdef _IS_VERT_SHADER\n attribute vec3 a_position;\n#endif\n\n#ifndef _NOT_USE_TEXTURE\n\n #if _USE_ATTRIBUTE_UV0\n #ifdef _IS_VERT_SHADER\n attribute mediump vec2 a_uv0;\n #endif\n\n varying mediump vec2 v_uv0;\n #endif\n\n#endif\n\n#if _USE_ATTRIBUTE_COLOR\n\n #ifdef _IS_VERT_SHADER\n attribute lowp vec4 a_color;\n #endif\n\n varying lowp vec4 v_color;\n#endif\n\n#if _USE_ATTRIBUTE_NORMAL\n #ifdef _IS_VERT_SHADER\n attribute vec3 a_normal;\n #endif\n#endif\n\n#ifdef _IS_VERT_SHADER\n\n void ATTRIBUTE_TO_VARYING () {\n\n #if _USE_ATTRIBUTE_COLOR\n v_color = a_color;\n #endif\n\n #ifndef _NOT_USE_TEXTURE\n #if _USE_ATTRIBUTE_UV0\n v_uv0 = a_uv0;\n\n #if USE_TILING_OFFSET\n v_uv0 = v_uv0 * mainTiling + mainOffset;\n #endif\n #endif\n #endif\n\n }\n\n#endif\n\nvoid MUL_ATTR_COLOR (inout vec4 color) {\n #if _USE_ATTRIBUTE_COLOR\n #ifdef _IS_VERT_SHADER\n color *= a_color;\n #else\n color *= v_color;\n #endif\n #endif\n}\n\nvoid MUL_ATTR_NORMAL (inout vec3 normal) {\n #if _USE_ATTRIBUTE_NORMAL\n #ifdef _IS_VERT_SHADER\n normal *= a_normal;\n #endif\n #endif\n}\nvoid MUL_ATTR_NORMAL (inout vec4 normal) {\n #if _USE_ATTRIBUTE_NORMAL\n #ifdef _IS_VERT_SHADER\n normal.xyz *= a_normal;\n #endif\n #endif\n}\n\nvec3 gammaToLinearSpaceRGB(in vec3 sRGB) { \n return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);\n}\n\nvec3 linearToGammaSpaceRGB(in vec3 RGB) { \n vec3 S1 = sqrt(RGB);\n vec3 S2 = sqrt(S1);\n vec3 S3 = sqrt(S2);\n return 0.585122381 * S1 + 0.783140355 * S2 - 0.368262736 * S3;\n}\n\nvec4 gammaToLinearSpaceRGBA(in vec4 sRGBA) {\n return vec4(gammaToLinearSpaceRGB(sRGBA.rgb), sRGBA.a);\n}\n\nvec4 linearToGammaSpaceRGBA(in vec4 RGBA) {\n return vec4(linearToGammaSpaceRGB(RGBA.rgb), RGBA.a);\n}\n\nvec4 linearToLinear (in vec4 value) {\n return value;\n}\n\n#if INPUT_IS_GAMMA\n #define TEXEL_TO_LINEAR gammaToLinearSpaceRGBA\n#else\n #define TEXEL_TO_LINEAR linearToLinear\n#endif\n\n#if OUTPUT_TO_GAMMA\n #define LINEAR_TO_OUTPUT_TEXEL linearToGammaSpaceRGBA\n#else\n #define LINEAR_TO_OUTPUT_TEXEL linearToLinear\n#endif\n\nuniform lowp vec4 diffuseColor;\n\n#if USE_DIFFUSE_TEXTURE\n uniform sampler2D diffuseTexture;\n#endif\n\nvoid MULTIPLY_DIFFUSE_TEXTRUE_COLOR (inout vec4 color, in vec2 uv) {\n #if USE_DIFFUSE_TEXTURE && _USE_ATTRIBUTE_UV0\n vec4 diffuseTextureColor = texture2D(diffuseTexture, uv);\n #if _USE_ETC1_DIFFUSETEXTURE\n diffuseTextureColor.a *= texture2D(diffuseTexture, uv + vec2(0, 0.5)).r;\n #endif\n color *= TEXEL_TO_LINEAR(diffuseTextureColor);\n #endif\n}\n\nvoid MULTIPLY_DIFFUSE_TEXTRUE_COLOR (inout vec4 color) {\n #if USE_DIFFUSE_TEXTURE && _USE_ATTRIBUTE_UV0\n \n #ifdef _IS_VERT_SHADER\n vec2 uv = a_uv0;\n #else\n vec2 uv = v_uv0;\n #endif\n\n MULTIPLY_DIFFUSE_TEXTRUE_COLOR(color, uv);\n #endif\n}\n\nvoid CALC_DIFFUSE (inout vec4 diffuse, in vec2 uv) {\n diffuse = diffuseColor;\n\n MUL_ATTR_COLOR(diffuse);\n MULTIPLY_DIFFUSE_TEXTRUE_COLOR(diffuse, uv);\n}\n\nvoid CALC_DIFFUSE (inout vec4 diffuse) {\n diffuse = diffuseColor;\n\n MUL_ATTR_COLOR(diffuse);\n MULTIPLY_DIFFUSE_TEXTRUE_COLOR(diffuse);\n}\n\n#if USE_ALPHA_TEST\n uniform float alphaThreshold;\n#endif\n\nvoid ALPHA_TEST (in vec4 color) {\n #if USE_ALPHA_TEST\n if (color.a < alphaThreshold) discard;\n #endif\n}\n\nvoid ALPHA_TEST (in float alpha) {\n #if USE_ALPHA_TEST\n if (alpha < alphaThreshold) discard;\n #endif\n}\n\nvoid main () {\n vec4 diffuse;\n CALC_DIFFUSE(diffuse);\n ALPHA_TEST(diffuse);\n gl_FragColor = LINEAR_TO_OUTPUT_TEXEL( diffuse );\n}\n\n\n", 47 | "defines": [ 48 | { 49 | "name": "USE_DIFFUSE_TEXTURE", 50 | "type": "boolean", 51 | "defines": [] 52 | }, 53 | { 54 | "name": "USE_EMISSIVE_TEXTURE", 55 | "type": "boolean", 56 | "defines": [ 57 | "USE_DIFFUSE_TEXTURE" 58 | ] 59 | }, 60 | { 61 | "name": "USE_SPECULAR_TEXTURE", 62 | "type": "boolean", 63 | "defines": [ 64 | "USE_DIFFUSE_TEXTURE", 65 | "USE_EMISSIVE_TEXTURE" 66 | ] 67 | }, 68 | { 69 | "name": "USE_NORMAL_TEXTURE", 70 | "type": "boolean", 71 | "defines": [ 72 | "USE_DIFFUSE_TEXTURE", 73 | "USE_EMISSIVE_TEXTURE", 74 | "USE_SPECULAR_TEXTURE" 75 | ] 76 | }, 77 | { 78 | "name": "USE_TILING_OFFSET", 79 | "type": "boolean", 80 | "defines": [] 81 | }, 82 | { 83 | "name": "_USE_ATTRIBUTE_UV0", 84 | "type": "boolean", 85 | "defines": [] 86 | }, 87 | { 88 | "name": "_USE_ATTRIBUTE_COLOR", 89 | "type": "boolean", 90 | "defines": [] 91 | }, 92 | { 93 | "name": "_USE_ATTRIBUTE_NORMAL", 94 | "type": "boolean", 95 | "defines": [] 96 | }, 97 | { 98 | "name": "_USE_SKINNING", 99 | "type": "boolean", 100 | "defines": [] 101 | }, 102 | { 103 | "name": "_USE_JOINTS_TEXTRUE", 104 | "type": "boolean", 105 | "defines": [ 106 | "_USE_SKINNING" 107 | ] 108 | }, 109 | { 110 | "name": "_JOINTS_TEXTURE_FLOAT32", 111 | "type": "boolean", 112 | "defines": [ 113 | "_USE_SKINNING", 114 | "_USE_JOINTS_TEXTRUE" 115 | ] 116 | }, 117 | { 118 | "name": "INPUT_IS_GAMMA", 119 | "type": "boolean", 120 | "defines": [] 121 | }, 122 | { 123 | "name": "OUTPUT_TO_GAMMA", 124 | "type": "boolean", 125 | "defines": [] 126 | }, 127 | { 128 | "name": "_USE_ETC1_DIFFUSETEXTURE", 129 | "type": "boolean", 130 | "defines": [ 131 | "USE_DIFFUSE_TEXTURE", 132 | "_USE_ATTRIBUTE_UV0" 133 | ] 134 | }, 135 | { 136 | "name": "USE_ALPHA_TEST", 137 | "type": "boolean", 138 | "defines": [] 139 | } 140 | ], 141 | "uniforms": [ 142 | { 143 | "name": "mainTiling", 144 | "type": 5, 145 | "property": true, 146 | "defines": [ 147 | "USE_TILING_OFFSET", 148 | "_USE_ATTRIBUTE_UV0" 149 | ] 150 | }, 151 | { 152 | "name": "mainOffset", 153 | "type": 5, 154 | "property": true, 155 | "defines": [ 156 | "USE_TILING_OFFSET", 157 | "_USE_ATTRIBUTE_UV0" 158 | ] 159 | }, 160 | { 161 | "name": "mainTiling", 162 | "type": 5, 163 | "property": true, 164 | "defines": [ 165 | "USE_TILING_OFFSET", 166 | "_USE_ATTRIBUTE_UV0" 167 | ] 168 | }, 169 | { 170 | "name": "mainOffset", 171 | "type": 5, 172 | "property": true, 173 | "defines": [ 174 | "USE_TILING_OFFSET", 175 | "_USE_ATTRIBUTE_UV0" 176 | ] 177 | }, 178 | { 179 | "name": "diffuseColor", 180 | "type": 9, 181 | "property": true, 182 | "defines": [] 183 | }, 184 | { 185 | "name": "diffuseTexture", 186 | "type": 13, 187 | "property": true, 188 | "defines": [ 189 | "USE_DIFFUSE_TEXTURE" 190 | ] 191 | }, 192 | { 193 | "name": "alphaThreshold", 194 | "type": 4, 195 | "property": true, 196 | "defines": [ 197 | "USE_ALPHA_TEST" 198 | ] 199 | } 200 | ], 201 | "attributes": [ 202 | { 203 | "name": "a_position", 204 | "type": 6, 205 | "defines": [] 206 | }, 207 | { 208 | "name": "a_uv0", 209 | "type": 5, 210 | "defines": [ 211 | "_USE_ATTRIBUTE_UV0" 212 | ] 213 | }, 214 | { 215 | "name": "a_color", 216 | "type": 7, 217 | "defines": [ 218 | "_USE_ATTRIBUTE_COLOR" 219 | ] 220 | }, 221 | { 222 | "name": "a_normal", 223 | "type": 6, 224 | "defines": [ 225 | "_USE_ATTRIBUTE_NORMAL" 226 | ] 227 | }, 228 | { 229 | "name": "a_weights", 230 | "type": 7, 231 | "defines": [ 232 | "_USE_SKINNING" 233 | ] 234 | }, 235 | { 236 | "name": "a_joints", 237 | "type": 7, 238 | "defines": [ 239 | "_USE_SKINNING" 240 | ] 241 | }, 242 | { 243 | "name": "a_position", 244 | "type": 6, 245 | "defines": [] 246 | }, 247 | { 248 | "name": "a_uv0", 249 | "type": 5, 250 | "defines": [ 251 | "_USE_ATTRIBUTE_UV0" 252 | ] 253 | }, 254 | { 255 | "name": "a_color", 256 | "type": 7, 257 | "defines": [ 258 | "_USE_ATTRIBUTE_COLOR" 259 | ] 260 | }, 261 | { 262 | "name": "a_normal", 263 | "type": 6, 264 | "defines": [ 265 | "_USE_ATTRIBUTE_NORMAL" 266 | ] 267 | } 268 | ], 269 | "extensions": [], 270 | "name": "8af5ee8040d8725057e4d5f8bac775803dac5e5263fc2495a0b4cc79" 271 | } 272 | ] 273 | } -------------------------------------------------------------------------------- /example/res/import/ec/eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432.json: -------------------------------------------------------------------------------- 1 | { 2 | "__type__": "cc.Material", 3 | "_name": "builtin-2d-sprite", 4 | "_effectAsset": { 5 | "__uuid__": "28dPjdQWxEQIG3VVl1Qm6T" 6 | }, 7 | "_defines": { 8 | "USE_TEXTURE": true 9 | }, 10 | "_props": {} 11 | } -------------------------------------------------------------------------------- /example/res/raw-assets/02/0275e94c-56a7-410f-bd1a-fc7483f7d14a.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/example/res/raw-assets/02/0275e94c-56a7-410f-bd1a-fc7483f7d14a.png -------------------------------------------------------------------------------- /example/res/raw-assets/17/17a874b44.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/example/res/raw-assets/17/17a874b44.png -------------------------------------------------------------------------------- /example/res/raw-assets/61/617323dd-11f4-4dd3-8eec-0caf6b3b45b9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/example/res/raw-assets/61/617323dd-11f4-4dd3-8eec-0caf6b3b45b9.png -------------------------------------------------------------------------------- /example/res/raw-assets/d6/d6d3ca85-4681-47c1-b5dd-d036a9d39ea2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/example/res/raw-assets/d6/d6d3ca85-4681-47c1-b5dd-d036a9d39ea2.png -------------------------------------------------------------------------------- /example/res/raw-assets/d8/d81ec8ad-247c-4e62-aa3c-d35c4193c7af.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/example/res/raw-assets/d8/d81ec8ad-247c-4e62-aa3c-d35c4193c7af.png -------------------------------------------------------------------------------- /example/res/raw-assets/ed/edd215b9-2796-4a05-aaf5-81f96c9281ce.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/example/res/raw-assets/ed/edd215b9-2796-4a05-aaf5-81f96c9281ce.png -------------------------------------------------------------------------------- /example/splash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/faace/ccBind/df272fc40289d3ab0b11c37d6a9a1298890f85c0/example/splash.png -------------------------------------------------------------------------------- /example/src/settings.js: -------------------------------------------------------------------------------- 1 | window._CCSettings = { 2 | platform: "web-mobile", 3 | groupList: [ 4 | "default" 5 | ], 6 | collisionMatrix: [ 7 | [ 8 | true 9 | ] 10 | ], 11 | rawAssets: { 12 | assets: {}, 13 | internal: { 14 | "14TDKXr2NJ6LjvHPops74o": [ 15 | "effects/builtin-2d-gray-sprite.effect", 16 | "cc.EffectAsset" 17 | ], 18 | "0ek66qC1NOQLjgYmi04HvX": [ 19 | "effects/builtin-2d-spine.effect", 20 | "cc.EffectAsset" 21 | ], 22 | "28dPjdQWxEQIG3VVl1Qm6T": [ 23 | "effects/builtin-2d-sprite.effect", 24 | "cc.EffectAsset" 25 | ], 26 | c0BAyVxX9JzZy8EjFrc9DU: [ 27 | "effects/builtin-clear-stencil.effect", 28 | "cc.EffectAsset" 29 | ], 30 | "796vrvt+9F2Zw/WR3INvx6": [ 31 | "effects/builtin-unlit-transparent.effect", 32 | "cc.EffectAsset" 33 | ], 34 | "6dkeWRTOBGXICfYQ7JUBnG": [ 35 | "effects/builtin-unlit.effect", 36 | "cc.EffectAsset" 37 | ], 38 | "6fgBCSDDdPMInvyNlggls2": [ 39 | "materials/builtin-2d-base.mtl", 40 | "cc.Material" 41 | ], 42 | "3ae7efMv1CLq2ilvUY/tQi": [ 43 | "materials/builtin-2d-gray-sprite.mtl", 44 | "cc.Material" 45 | ], 46 | "7a/QZLET9IDreTiBfRn2PD": [ 47 | "materials/builtin-2d-spine.mtl", 48 | "cc.Material" 49 | ], 50 | "ecpdLyjvZBwrvm+cedCcQy": [ 51 | "materials/builtin-2d-sprite.mtl", 52 | "cc.Material" 53 | ], 54 | cffgu4qBxEqa150o1DmRAy: [ 55 | "materials/builtin-clear-stencil.mtl", 56 | "cc.Material" 57 | ], 58 | "2aKWBXJHxKHLvrBUi2yYZQ": [ 59 | "materials/builtin-unlit.mtl", 60 | "cc.Material" 61 | ] 62 | } 63 | }, 64 | launchScene: "db://assets/scripts/scenes/scMain/scMain.fire", 65 | scenes: [ 66 | { 67 | url: "db://assets/scripts/scenes/scMain/scMain.fire", 68 | uuid: "4dwHMnoWxNL7pIOVaRI9wa" 69 | }, 70 | { 71 | url: "db://assets/scripts/scenes/scClick/scClick.fire", 72 | uuid: "27v0if8QhA9qtA2rKDGNq3" 73 | }, 74 | { 75 | url: "db://assets/scripts/scenes/scDync/scDync.fire", 76 | uuid: "95SnXSus9M74uORW51BzY2" 77 | }, 78 | { 79 | url: "db://assets/scripts/scenes/scGlobal/scGlobal.fire", 80 | uuid: "92Rx7mLylMP61HcfmiW0fh" 81 | }, 82 | { 83 | url: "db://assets/scripts/scenes/scInput/scInput.fire", 84 | uuid: "f7oY04mJlGvYKYKKCkR37c" 85 | }, 86 | { 87 | url: "db://assets/scripts/scenes/scList/scList.fire", 88 | uuid: "40PcbVRkhEg4Pa6y7/wT8W" 89 | }, 90 | { 91 | url: "db://assets/scripts/scenes/scActive/scActive.fire", 92 | uuid: "61OvYS2YJJgZZMxWpFcdQO" 93 | }, 94 | { 95 | url: "db://assets/scripts/scenes/scSprite/scSprite.fire", 96 | uuid: "23d/h4u05OjoS+LO1j10Zm" 97 | }, 98 | { 99 | url: "db://assets/scripts/scenes/scTab/scTab.fire", 100 | uuid: "93JBJTwNRNGpC8fdFh/IpC" 101 | } 102 | ], 103 | packedAssets: { 104 | "0131d8cf3": [ 105 | "23d/h4u05OjoS+LO1j10Zm", 106 | "23p7p9ZPtMEIqH/jUu3z9N", 107 | "5b6rO3rNtKpLmLottqEsiN", 108 | "65TnO/tDlIeb+UMYju3GEz", 109 | "83hvfg/AhCiYNj20P6TUMB", 110 | "bbvDK29WJPmKyEKpt1hmqe", 111 | "efBTQ+DQ1P/6x28hpSLY5g" 112 | ], 113 | "01cc69595": [ 114 | "02delMVqdBD70a/HSD99FK", 115 | "17a874b44", 116 | "61cyPdEfRN047sDK9rO0W5", 117 | "d608qFRoFHwbXd0Dap056i", 118 | "d8HsitJHxOYqo801xBk8ev", 119 | "ed0hW5J5ZKBar1gflskoHO" 120 | ], 121 | "02ef7e0a7": [ 122 | "23p7p9ZPtMEIqH/jUu3z9N", 123 | "36YHFSE5dLlZAzXzuZblPF", 124 | "61OvYS2YJJgZZMxWpFcdQO", 125 | "efBTQ+DQ1P/6x28hpSLY5g", 126 | "ffDpHHVcZAhqOfy25Fe4w7" 127 | ], 128 | "02efcc783": [ 129 | "23p7p9ZPtMEIqH/jUu3z9N", 130 | "27v0if8QhA9qtA2rKDGNq3", 131 | "82yG0Xp9BN65+c+ckguIob", 132 | "efBTQ+DQ1P/6x28hpSLY5g" 133 | ], 134 | "030e2f64d": [ 135 | "1dle39Qs9AXYngfrZT3ALa", 136 | "23p7p9ZPtMEIqH/jUu3z9N", 137 | "4dwHMnoWxNL7pIOVaRI9wa", 138 | "5cO7kybDxGj4ipyMYdRYZB", 139 | "5f5dyqtRNNxaFmVzYns6FZ", 140 | "6aV9ZbqolOwIi5M4QJa5Ei", 141 | "9bvaMerUlDyary99mJa6xp" 142 | ], 143 | "034f90767": [ 144 | "23p7p9ZPtMEIqH/jUu3z9N", 145 | "95SnXSus9M74uORW51BzY2", 146 | "efBTQ+DQ1P/6x28hpSLY5g" 147 | ], 148 | "049fff3a4": [ 149 | "23p7p9ZPtMEIqH/jUu3z9N", 150 | "82yG0Xp9BN65+c+ckguIob", 151 | "92Rx7mLylMP61HcfmiW0fh", 152 | "efBTQ+DQ1P/6x28hpSLY5g" 153 | ], 154 | "059a92f5e": [ 155 | "23p7p9ZPtMEIqH/jUu3z9N", 156 | "40PcbVRkhEg4Pa6y7/wT8W", 157 | "81YCVuByFMFoqTYQx/+ofs", 158 | "9bvaMerUlDyary99mJa6xp", 159 | "efBTQ+DQ1P/6x28hpSLY5g", 160 | "ffDpHHVcZAhqOfy25Fe4w7" 161 | ], 162 | "06dd2a9d2": [ 163 | "23p7p9ZPtMEIqH/jUu3z9N", 164 | "3dCmRMg4xE/K8GxnCLrjpc", 165 | "3eN3WD2hpN65XmZQXM8pTQ", 166 | "93JBJTwNRNGpC8fdFh/IpC", 167 | "940ND8Uw5Gb5neSasKpJQZ", 168 | "c3GrzO6nZNKYDpbYyjAS/v", 169 | "efBTQ+DQ1P/6x28hpSLY5g" 170 | ], 171 | "079499991": [ 172 | "2aKWBXJHxKHLvrBUi2yYZQ", 173 | "6dkeWRTOBGXICfYQ7JUBnG" 174 | ], 175 | "07ce7530a": [ 176 | "14TDKXr2NJ6LjvHPops74o", 177 | "3ae7efMv1CLq2ilvUY/tQi" 178 | ], 179 | "0d669730c": [ 180 | "c0BAyVxX9JzZy8EjFrc9DU", 181 | "cffgu4qBxEqa150o1DmRAy" 182 | ], 183 | "0e4bc3b03": [ 184 | "0ek66qC1NOQLjgYmi04HvX", 185 | "7a/QZLET9IDreTiBfRn2PD" 186 | ], 187 | "0fe591e5f": [ 188 | "23p7p9ZPtMEIqH/jUu3z9N", 189 | "efBTQ+DQ1P/6x28hpSLY5g", 190 | "f7oY04mJlGvYKYKKCkR37c", 191 | "ffDpHHVcZAhqOfy25Fe4w7" 192 | ] 193 | }, 194 | md5AssetsMap: {}, 195 | orientation: "portrait", 196 | debug: true, 197 | subpackages: {} 198 | }; 199 | -------------------------------------------------------------------------------- /example/style-desktop.css: -------------------------------------------------------------------------------- 1 | body { 2 | cursor: default; 3 | padding: 0; 4 | border: 0; 5 | margin: 0; 6 | 7 | text-align: center; 8 | background-color: white; 9 | font-family: Helvetica, Verdana, Arial, sans-serif; 10 | } 11 | 12 | body, canvas, div { 13 | outline: none; 14 | -moz-user-select: none; 15 | -webkit-user-select: none; 16 | -ms-user-select: none; 17 | -khtml-user-select: none; 18 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 19 | } 20 | 21 | /* Remove spin of input type number */ 22 | input::-webkit-outer-spin-button, 23 | input::-webkit-inner-spin-button { 24 | /* display: none; <- Crashes Chrome on hover */ 25 | -webkit-appearance: none; 26 | margin: 0; /* <-- Apparently some margin are still there even though it's hidden */ 27 | } 28 | 29 | #Cocos2dGameContainer { 30 | position: absolute; 31 | margin: 0; 32 | overflow: hidden; 33 | left: 0px; 34 | top: 0px; 35 | } 36 | 37 | canvas { 38 | background-color: rgba(0, 0, 0, 0); 39 | } 40 | 41 | a:link, a:visited { 42 | color: #000; 43 | } 44 | 45 | a:active, a:hover { 46 | color: #666; 47 | } 48 | 49 | p.header { 50 | font-size: small; 51 | } 52 | 53 | p.footer { 54 | font-size: x-small; 55 | } 56 | 57 | #splash { 58 | position: absolute; 59 | top: 0; 60 | left: 0; 61 | width: 100%; 62 | height: 100%; 63 | 64 | background: #171717 url(./splash.png) no-repeat center; 65 | background-size: 40%; 66 | } 67 | 68 | .progress-bar { 69 | background-color: #1a1a1a; 70 | position: absolute; 71 | left: 50%; 72 | top: 80%; 73 | height: 26px; 74 | padding: 5px; 75 | width: 350px; 76 | margin: 0 -175px; 77 | border-radius: 5px; 78 | box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444; 79 | } 80 | 81 | .progress-bar span { 82 | display: block; 83 | height: 100%; 84 | border-radius: 3px; 85 | box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset; 86 | transition: width .4s ease-in-out; 87 | background-color: #34c2e3; 88 | } 89 | 90 | .stripes span { 91 | background-size: 30px 30px; 92 | background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%, 93 | transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, 94 | transparent 75%, transparent); 95 | 96 | animation: animate-stripes 1s linear infinite; 97 | } 98 | 99 | @keyframes animate-stripes { 100 | 0% {background-position: 0 0;} 100% {background-position: 60px 0;} 101 | } 102 | 103 | h1 { 104 | color: #444; 105 | text-shadow: 3px 3px 15px; 106 | } 107 | 108 | #GameDiv { 109 | width: 800px; 110 | height: 450px; 111 | margin: 0 auto; 112 | background: black; 113 | position:relative; 114 | border:5px solid black; 115 | border-radius: 10px; 116 | box-shadow: 0 5px 50px #333 117 | } 118 | -------------------------------------------------------------------------------- /example/style-mobile.css: -------------------------------------------------------------------------------- 1 | html { 2 | -ms-touch-action: none; 3 | } 4 | 5 | body, canvas, div { 6 | display: block; 7 | outline: none; 8 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 9 | 10 | user-select: none; 11 | -moz-user-select: none; 12 | -webkit-user-select: none; 13 | -ms-user-select: none; 14 | -khtml-user-select: none; 15 | -webkit-tap-highlight-color: rgba(0, 0, 0, 0); 16 | } 17 | 18 | /* Remove spin of input type number */ 19 | input::-webkit-outer-spin-button, 20 | input::-webkit-inner-spin-button { 21 | /* display: none; <- Crashes Chrome on hover */ 22 | -webkit-appearance: none; 23 | margin: 0; /* <-- Apparently some margin are still there even though it's hidden */ 24 | } 25 | 26 | body { 27 | position: absolute; 28 | top: 0; 29 | left: 0; 30 | width: 100%; 31 | height: 100%; 32 | padding: 0; 33 | border: 0; 34 | margin: 0; 35 | 36 | cursor: default; 37 | color: #888; 38 | background-color: #333; 39 | 40 | text-align: center; 41 | font-family: Helvetica, Verdana, Arial, sans-serif; 42 | 43 | display: flex; 44 | flex-direction: column; 45 | 46 | /* fix bug: https://github.com/cocos-creator/2d-tasks/issues/791 */ 47 | /* overflow cannot be applied in Cocos2dGameContainer, 48 | otherwise child elements will be hidden when Cocos2dGameContainer rotated 90 deg */ 49 | overflow: hidden; 50 | } 51 | 52 | #Cocos2dGameContainer { 53 | position: absolute; 54 | margin: 0; 55 | left: 0px; 56 | top: 0px; 57 | 58 | display: -webkit-box; 59 | -webkit-box-orient: horizontal; 60 | -webkit-box-align: center; 61 | -webkit-box-pack: center; 62 | } 63 | 64 | canvas { 65 | background-color: rgba(0, 0, 0, 0); 66 | } 67 | 68 | a:link, a:visited { 69 | color: #666; 70 | } 71 | 72 | a:active, a:hover { 73 | color: #666; 74 | } 75 | 76 | p.header { 77 | font-size: small; 78 | } 79 | 80 | p.footer { 81 | font-size: x-small; 82 | } 83 | 84 | #splash { 85 | position: absolute; 86 | top: 0; 87 | left: 0; 88 | width: 100%; 89 | height: 100%; 90 | background: #171717 url(./splash.png) no-repeat center; 91 | background-size: 40%; 92 | } 93 | 94 | .progress-bar { 95 | background-color: #1a1a1a; 96 | position: absolute; 97 | left: 25%; 98 | top: 80%; 99 | height: 15px; 100 | padding: 5px; 101 | width: 50%; 102 | /*margin: 0 -175px; */ 103 | border-radius: 5px; 104 | box-shadow: 0 1px 5px #000 inset, 0 1px 0 #444; 105 | } 106 | 107 | .progress-bar span { 108 | display: block; 109 | height: 100%; 110 | border-radius: 3px; 111 | box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset; 112 | transition: width .4s ease-in-out; 113 | background-color: #34c2e3; 114 | } 115 | 116 | .stripes span { 117 | background-size: 30px 30px; 118 | background-image: linear-gradient(135deg, rgba(255, 255, 255, .15) 25%, transparent 25%, 119 | transparent 50%, rgba(255, 255, 255, .15) 50%, rgba(255, 255, 255, .15) 75%, 120 | transparent 75%, transparent); 121 | 122 | animation: animate-stripes 1s linear infinite; 123 | } 124 | 125 | @keyframes animate-stripes { 126 | 0% {background-position: 0 0;} 100% {background-position: 60px 0;} 127 | } 128 | -------------------------------------------------------------------------------- /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 | } -------------------------------------------------------------------------------- /project.json: -------------------------------------------------------------------------------- 1 | { 2 | "engine": "cocos-creator-js", 3 | "packages": "packages", 4 | "version": "2.1.2" 5 | } -------------------------------------------------------------------------------- /settings/builder.json: -------------------------------------------------------------------------------- 1 | { 2 | "android-instant": { 3 | "REMOTE_SERVER_ROOT": "", 4 | "host": "", 5 | "pathPattern": "", 6 | "recordPath": "", 7 | "scheme": "https", 8 | "skipRecord": false 9 | }, 10 | "appBundle": false, 11 | "baidugame": { 12 | "REMOTE_SERVER_ROOT": "", 13 | "appid": "testappid", 14 | "orientation": "portrait", 15 | "subContext": "" 16 | }, 17 | "encryptJs": true, 18 | "excludeScenes": [], 19 | "fb-instant-games": {}, 20 | "includeSDKBox": false, 21 | "inlineSpriteFrames": true, 22 | "inlineSpriteFrames_native": true, 23 | "md5Cache": false, 24 | "mergeStartScene": false, 25 | "optimizeHotUpdate": false, 26 | "orientation": { 27 | "landscapeLeft": true, 28 | "landscapeRight": true, 29 | "portrait": false, 30 | "upsideDown": false 31 | }, 32 | "packageName": "org.cocos2d.theBind", 33 | "qqplay": { 34 | "REMOTE_SERVER_ROOT": "", 35 | "orientation": "portrait", 36 | "zip": false 37 | }, 38 | "startScene": "4dc07327-a16c-4d2f-ba48-39569123dc1a", 39 | "title": "theBind", 40 | "webOrientation": "portrait", 41 | "wechatgame": { 42 | "REMOTE_SERVER_ROOT": "", 43 | "appid": "wx6ac3f5090a6b99c5", 44 | "orientation": "portrait", 45 | "separate_engine": false, 46 | "subContext": "" 47 | }, 48 | "xxteaKey": "12e2c856-9eca-42", 49 | "zipCompressJs": true 50 | } -------------------------------------------------------------------------------- /settings/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "assets-sort-type": "name", 3 | "collision-matrix": [ 4 | [ 5 | true 6 | ] 7 | ], 8 | "design-resolution-height": 1280, 9 | "design-resolution-width": 720, 10 | "excluded-modules": [ 11 | "ParticleSystem", 12 | "TiledMap", 13 | "Spine Skeleton", 14 | "DragonBones", 15 | "RichText", 16 | "MotionStreak", 17 | "PageView", 18 | "PageViewIndicator", 19 | "VideoPlayer", 20 | "WebView", 21 | "Audio", 22 | "AudioSource", 23 | "Animation", 24 | "Collider", 25 | "Action", 26 | "Physics", 27 | "StudioComponent", 28 | "Native Socket", 29 | "Geom Utils", 30 | "3D", 31 | "3D Primitive" 32 | ], 33 | "facebook": { 34 | "appID": "", 35 | "audience": { 36 | "enable": false 37 | }, 38 | "enable": false, 39 | "live": { 40 | "enable": false 41 | } 42 | }, 43 | "fit-height": true, 44 | "fit-width": false, 45 | "group-list": [ 46 | "default" 47 | ], 48 | "last-module-event-record-time": 1565422642447, 49 | "simulator-orientation": false, 50 | "simulator-resolution": { 51 | "height": 640, 52 | "width": 960 53 | }, 54 | "start-scene": "4dc07327-a16c-4d2f-ba48-39569123dc1a", 55 | "use-customize-simulator": true, 56 | "use-project-simulator-setting": false 57 | } -------------------------------------------------------------------------------- /settings/services.json: -------------------------------------------------------------------------------- 1 | { 2 | "services": [ 3 | { 4 | "service_id": "235", 5 | "service_name": "Cocos Analytics", 6 | "service_icon": "https://account.cocos.com/client/3f8f31ccf66995e183044f167c092395.png", 7 | "service_desc": "提供最核心最基本的数据、标准化界面功能简洁易用、数据准确性最好", 8 | "service_title": "精准了解游戏的新增、活跃、留存、付费等数据", 9 | "service_guide_url": "https://n-analytics.cocos.com/docs/", 10 | "service_sample_url": "https://github.com/cocos-creator/tutorial-dark-slash/tree/analytics", 11 | "service_dev_url": "http://analytics.cocos.com/realtime/jump_to/", 12 | "service_type": "3", 13 | "service_type_zh": "公司和个人游戏", 14 | "support_platform": [ 15 | "Android", 16 | "iOS", 17 | "HTML5" 18 | ], 19 | "package_download_url": "http://download.cocos.com/CocosServices/plugins/service-analytics/1.2.0_2.1.0.zip", 20 | "package_version_desc": "1、优化SDK,修复H5-SDK 与多个小游戏平台适配问题,删除和优化init事件无用接口
2、 如有相关问题咨询或者需求, 可以联系我们技术支持邮箱 support-cocos@cocos.com", 21 | "service_component_name": "service-analytics", 22 | "package_versions": [ 23 | "1.0.0_1.0.5", 24 | "1.1.2_2.0.0", 25 | "1.1.3_2.0.1", 26 | "1.1.4_2.0.1", 27 | "1.1.5_2.0.1", 28 | "1.1.6_2.0.1_2.0.2", 29 | "1.1.7_2.0.3", 30 | "1.1.8_2.0.4", 31 | "1.1.9_2.1.0", 32 | "1.2.0_2.1.0" 33 | ], 34 | "build_platform": [ 35 | "web-mobile", 36 | "web-desktop", 37 | "wechatgame", 38 | "android", 39 | "ios", 40 | "fb-instant-games", 41 | "android-instant", 42 | "baidugame", 43 | "quickgame", 44 | "qgame", 45 | "qqplay", 46 | "huawei" 47 | ], 48 | "require_verify": 0, 49 | "service_price": "", 50 | "packpage_version_desc": "", 51 | "service_protocol": "游戏首次开启该服务时,Cocos会后台通知服务方为游戏开通服务并初始化参数,服务方根据需要可能会获取您的Cocos账户信息,包括账户基本资料、游戏基本资料、账户余额等,点击确认开通按钮即视为您同意该服务访问您的账户信息,详见《Cocos用户服务协议》《Cocos隐私政策》" 52 | }, 53 | { 54 | "service_id": "241", 55 | "service_name": "Matchvs", 56 | "service_icon": "https://account.cocos.com/client/14406719a07eb3d714d36e5edc6e06fa.png", 57 | "service_desc": "通过SDK接入快速实现联网功能、帧同步、国内外多节点、服务器独立部署、gameServer自定义游戏服务端逻辑。\n技术支持群QQ群:822523258", 58 | "service_title": "专业成熟的移动游戏联网与服务端解决方案", 59 | "service_guide_url": "http://doc.matchvs.com/QuickStart/QuickStart-CocosCreator", 60 | "service_sample_url": "http://www.matchvs.com/serviceCourse", 61 | "service_dev_url": "http://www.matchvs.com/cocosLogin", 62 | "service_type": "3", 63 | "service_type_zh": "公司和个人游戏", 64 | "support_platform": [ 65 | "Android", 66 | "iOS", 67 | "HTML5" 68 | ], 69 | "package_download_url": "http://download.cocos.com/CocosServices/plugins/service-matchvs/1.0.9_3.7.9.9.zip", 70 | "package_version_desc": "更新日期:2019-07-18
更新内容:
1、修复多节点登录返回值错误
2、修复FaceBook平台受限安全策略的问题", 71 | "service_component_name": "service-matchvs", 72 | "package_versions": [ 73 | "1.0.3_3.7.6.4", 74 | "1.0.5_3.7.7.3", 75 | "1.0.6_3.7.9.2", 76 | "1.0.7_3.7.9.6", 77 | "1.0.9_3.7.9.9" 78 | ], 79 | "build_platform": [ 80 | "web-mobile", 81 | "web-desktop", 82 | "fb-instant-games", 83 | "wechatgame", 84 | "wechatgame-subcontext", 85 | "qqplay", 86 | "android", 87 | "android-instant", 88 | "ios", 89 | "mac", 90 | "quickgame", 91 | "qgame", 92 | "huawei" 93 | ], 94 | "require_verify": 0, 95 | "service_price": "该服务按使用量计费,计费规则,所产生的费用将由第三方从您的 Cocos 账户余额 中扣除。", 96 | "packpage_version_desc": "", 97 | "service_protocol": "游戏首次开启该服务时,Cocos会后台通知服务方为游戏开通服务并初始化参数,服务方根据需要可能会获取您的Cocos账户信息,包括账户基本资料、游戏基本资料、账户余额等,点击确认开通按钮即视为您同意该服务访问您的账户信息,详见《Cocos用户服务协议》《Cocos隐私政策》" 98 | }, 99 | { 100 | "service_id": "242", 101 | "service_name": "Agora Voice", 102 | "service_icon": "https://account.cocos.com/uploads/client_icon/2019-07-16/273952d155b4cdb72d2b1bc61de91ade.png", 103 | "service_desc": "稳定、低耗、76ms超低延时、全球200+数据中心覆盖;变声器、超高音质、听声辩位等丰富玩法极速接入;全平台支持:Android、iOS、Web。\n技术支持群QQ群:799099183\n", 104 | "service_title": "游戏内置实时语音", 105 | "service_guide_url": "https://docs.agora.io/cn/Interactive Gaming/game_c?platform=Cocos Creator", 106 | "service_sample_url": "https://github.com/AgoraIO/Voice-Call-for-Mobile-Gaming/tree/master/Basic-Voice-Call-for-Gaming/Hello-CocosCreator-Voice-Agora", 107 | "service_dev_url": "https://sso.agora.io/api/oauth/cocos/login", 108 | "service_type": "3", 109 | "service_type_zh": "公司和个人游戏", 110 | "support_platform": [ 111 | "Android", 112 | "iOS", 113 | "HTML5" 114 | ], 115 | "package_download_url": "http://download.cocos.com/CocosServices/plugins/service-agora/1.0.2_2.2.3.20_2.5.2.zip", 116 | "package_version_desc": "解决Bug:onAudioVolumeIndication 回调收不到.", 117 | "service_component_name": "service-agora", 118 | "package_versions": [ 119 | "1.0.1_2.2.3.20_2.5.2", 120 | "1.0.2_2.2.3.20_2.5.2" 121 | ], 122 | "build_platform": [ 123 | "web-mobile", 124 | "web-desktop", 125 | "android", 126 | "ios" 127 | ], 128 | "require_verify": 1, 129 | "service_price": "该服务按使用量计费,计费规则,所产生的费用将由第三方从您的 Cocos 账户余额 中扣除。", 130 | "packpage_version_desc": "", 131 | "service_protocol": "游戏首次开启该服务时,Cocos会后台通知服务方为游戏开通服务并初始化参数,服务方根据需要可能会获取您的Cocos账户信息,包括账户基本资料、游戏基本资料、账户余额等,点击确认开通按钮即视为您同意该服务访问您的账户信息,详见《Cocos用户服务协议》《Cocos隐私政策》" 132 | } 133 | ], 134 | "game": { 135 | "name": "未知游戏", 136 | "appid": "UNKNOW" 137 | } 138 | } --------------------------------------------------------------------------------