├── README.md ├── jsfl └── ExportToJS.jsfl └── src ├── Game.js ├── Scene1.js ├── Scene2.js ├── Scene3.js ├── mia └── PhaserExtend.js └── res.js /README.md: -------------------------------------------------------------------------------- 1 | # MiaPhaser 2 | 3 | #Flash To Phaser 4 | 5 | 6 | * I create jsfl tools to easy create UI and Scene in Adobe Flash. 7 | * The project: [MiaPhaser](https://github.com/gamefriends/MiaPhaser) 8 | 9 | # Create project like this: 10 | 11 | 12 | ##First: 13 | - Create fla in Flash, and design the UI and Scene in timeline. 14 | project example: 15 | 16 | ```javascript 17 | project 18 | /flash 19 | /game.fla 20 | /js 21 | /phaser.js 22 | /jsfl 23 | /ExportToJS.jsfl 24 | /res 25 | /a.png 26 | /b.png 27 | /src 28 | /mia/PhaserExtend.js 29 | /Game.js 30 | /res.js 31 | ``` 32 | 33 | ##Second: 34 | * run the ExportToJS.jsfl 35 | * it will be export the stage resource to PNG in /res 36 | 37 | ### Edit game config 38 | 39 | ```javasciprt 40 | //the defalut stage size as same as Fla publish size 41 | //set the boot scene and firstScene 42 | MIA.gameConfig = { 43 | stageWidth:MIA.stageDes.stageWidth, 44 | stageHeight:MIA.stageDes.stageHeight, 45 | bootScene:"Boot", 46 | firstScene:"Scene1" 47 | }; 48 | ``` 49 | 50 | 51 | ```javascript 52 | //set the scene 53 | MIA.startGame = function () { 54 | var game = new Phaser.Game(MIA.gameConfig.stageWidth, MIA.gameConfig.stageHeight, Phaser.AUTO, 'game'); 55 | //----Add Scene 56 | game.state.add('Boot', MIA.Boot); 57 | game.state.add('Scene1', MIA.Scene1); 58 | game.state.add('Scene2', MIA.Scene2); 59 | game.state.add('Scene3', MIA.Scene3); 60 | 61 | //fixed logic 62 | MIA.gameConfig.bootScene = "Boot"; 63 | MIA.gameConfig.firstScene = "Scene1"; 64 | game.state.start(MIA.gameConfig.bootScene); 65 | }; 66 | ``` 67 | 68 | ##Last 69 | * edit game logic 70 | * edit index.html 71 | * run the game 72 | 73 | 74 | #If you have any suggest, please [@miagame_com](https://twitter.com/miagame_com) , I will do it better. 75 | 76 | * User: Jackie Qi / miagame.com 77 | * Date: 2015/9/9 78 | * Time: 11:40 79 | * email: miagame.com@gmail.com 80 | * website: http://miagame.com 81 | * twitter: https://twitter.com/miagame_com 82 | -------------------------------------------------------------------------------- /jsfl/ExportToJS.jsfl: -------------------------------------------------------------------------------- 1 | /** 2 | * Created with WebStorm. 3 | * User: Jackie Qi / miagame.com 4 | * Date: 2015/9/9 5 | * Time: 11:40 6 | * email: miagame.com@gmail.com 7 | * website: http://miagame.com 8 | * twitter: https://twitter.com/miagame_com 9 | * 10 | * Export Flash To JSON 11 | * vertion: 1.0 12 | * 13 | * project example: 14 | * project 15 | * -flash 16 | * -game.fla 17 | * -js 18 | * -phaser.js 19 | * -jsfl 20 | * -ExportToJS.jsfl 21 | * -res 22 | * -a.png 23 | * -b.png 24 | * -src 25 | * -Game.js 26 | * -res.js 27 | */ 28 | 29 | 30 | //JSON Library 31 | (function () { 32 | 33 | // ---------------------------------------------------------------------------------------------------- 34 | // local variables 35 | 36 | var hasOwn = Object.prototype.hasOwnProperty; 37 | var escapeable = /["\\\x00-\x1f\x7f-\x9f]/g; 38 | var meta = 39 | { 40 | '\b': '\\b', 41 | '\t': '\\t', 42 | '\n': '\\n', 43 | '\f': '\\f', 44 | '\r': '\\r', 45 | '"': '\\"', 46 | '\\': '\\\\' 47 | }; 48 | 49 | /** 50 | * Helper function to correctly quote nested strings 51 | * @ignore 52 | */ 53 | function quoteString(string) { 54 | if (string.match(escapeable)) { 55 | return '"' + string.replace(escapeable, function (a) { 56 | var c = meta[a]; 57 | if (typeof c === 'string') { 58 | return c; 59 | } 60 | c = a.charCodeAt(); 61 | return '\\u00' + Math.floor(c / 16).toString(16) + (c % 16).toString(16); 62 | }) + '"'; 63 | } 64 | return '"' + string + '"'; 65 | }; 66 | 67 | // ---------------------------------------------------------------------------------------------------- 68 | // class 69 | 70 | JSON = 71 | { 72 | /** 73 | * Encodes an Object as a JSON String 74 | * Non-integer/string keys are skipped in the object, as are keys that point to a function. 75 | * 76 | * @name JSON.encode 77 | * @param {Object} obj The json-serializble *thing* to be converted 78 | * @returns {String} A JSON String 79 | */ 80 | encode: function (obj) { 81 | if (obj === null) { 82 | return 'null'; 83 | } 84 | 85 | var type = typeof obj; 86 | 87 | if (type === 'undefined') { 88 | return undefined; 89 | } 90 | if (type === 'number' || type === 'boolean') { 91 | return '' + obj; 92 | } 93 | if (type === 'string') { 94 | return quoteString(obj); 95 | } 96 | if (type === 'object') { 97 | if (obj.constructor === Date) { 98 | var month = obj.getUTCMonth() + 1, 99 | day = obj.getUTCDate(), 100 | year = obj.getUTCFullYear(), 101 | hours = obj.getUTCHours(), 102 | minutes = obj.getUTCMinutes(), 103 | seconds = obj.getUTCSeconds(), 104 | milli = obj.getUTCMilliseconds(); 105 | 106 | if (month < 10) { 107 | month = '0' + month; 108 | } 109 | if (day < 10) { 110 | day = '0' + day; 111 | } 112 | if (hours < 10) { 113 | hours = '0' + hours; 114 | } 115 | if (minutes < 10) { 116 | minutes = '0' + minutes; 117 | } 118 | if (seconds < 10) { 119 | seconds = '0' + seconds; 120 | } 121 | if (milli < 100) { 122 | milli = '0' + milli; 123 | } 124 | if (milli < 10) { 125 | milli = '0' + milli; 126 | } 127 | return '"' + year + '-' + month + '-' + day + 'T' + 128 | hours + ':' + minutes + ':' + seconds + 129 | '.' + milli + 'Z"'; 130 | } 131 | if (obj.constructor === Array) { 132 | var ret = []; 133 | for (var i = 0; i < obj.length; i++) { 134 | ret.push(JSON.encode(obj[i]) || 'null'); 135 | } 136 | return '[' + ret.join(',') + ']'; 137 | } 138 | var name, 139 | val, 140 | pairs = []; 141 | 142 | for (var k in obj) { 143 | // Only include own properties, 144 | // Filter out inherited prototypes 145 | if (!hasOwn.call(obj, k)) { 146 | continue; 147 | } 148 | 149 | // Keys must be numerical or string. Skip others 150 | type = typeof k; 151 | if (type === 'number') { 152 | name = '"' + k + '"'; 153 | } else if (type === 'string') { 154 | name = quoteString(k); 155 | } else { 156 | continue; 157 | } 158 | type = typeof obj[k]; 159 | 160 | // Invalid values like these return undefined 161 | // from toJSON, however those object members 162 | // shouldn't be included in the JSON string at all. 163 | if (type === 'function' || type === 'undefined') { 164 | continue; 165 | } 166 | val = JSON.encode(obj[k]); 167 | pairs.push(name + ':' + val); 168 | } 169 | return '{' + pairs.join(',') + '}'; 170 | } 171 | ; 172 | 173 | }, 174 | 175 | /** 176 | * Evaluates a given piece of json source. 177 | * @param {String} src 178 | * @name JSON.decode 179 | */ 180 | decode: function (src) { 181 | if (src != null && src != '' && src != undefined) { 182 | return eval('(' + src + ')'); 183 | } 184 | return null; 185 | }, 186 | 187 | toString: function () { 188 | return '[class JSON]'; 189 | } 190 | 191 | }; 192 | 193 | })(); 194 | 195 | 196 | //--------Main Logic------------- 197 | /** 198 | * get instance count 199 | * @param {string} name 200 | * @returns {string} 201 | */ 202 | var getInstanceCount = function (name) { 203 | var count = 0; 204 | if (namePool[name] == undefined) { 205 | namePool[name] = 0; 206 | } 207 | count = namePool[name]; 208 | namePool[name] = count + 1; 209 | return count; 210 | }; 211 | /** 212 | * get libraryItem description 213 | * @param {Instance} ins 214 | * @returns {*} 215 | */ 216 | var getExportItemDes = function (ins) { 217 | var count = 0; 218 | var key = ins.libraryItem.name; 219 | if (exportPool[key] == undefined) { 220 | exportPool[key] = { 221 | count: 0, 222 | name: key.replace(" ", ""), 223 | res: key, 224 | width: ins.width, 225 | height: ins.height, 226 | scaleX: ins.scaleX, 227 | scaleY: ins.scaleY 228 | }; 229 | } 230 | var obj = exportPool[key]; 231 | if (ins.width > obj.width) { 232 | obj.width = ins.width; 233 | } 234 | if (ins.height > obj.height) { 235 | obj.height = ins.height; 236 | } 237 | return obj; 238 | }; 239 | 240 | /** 241 | * get timeline max frameCount 242 | * @param {Timeline}timeline 243 | * @returns {number} 244 | */ 245 | var getTimelineMaxFrameCount = function (timeline) { 246 | var maxCount = 0; 247 | for (var a = 0; a < timeline.layerCount; a++) { 248 | var l = timeline.layers[a]; 249 | if (maxCount < l.frameCount) { 250 | maxCount = l.frameCount; 251 | } 252 | } 253 | return maxCount; 254 | }; 255 | /** 256 | * get instance description 257 | * @param {Instance} ins 258 | * @param {Instance} parent 259 | * @returns {*} 260 | */ 261 | var getInstanceDes = function (ins, parent) { 262 | var des = {}; 263 | if (ins instanceof Shape) { 264 | des.type = TYPE_SHAPE; 265 | des.group = parent; 266 | des.child = ins; 267 | return des; 268 | } 269 | if (ins.instanceType == "bitmap") { 270 | des.type = TYPE_SPRITE; 271 | des.group = parent; 272 | des.child = ins; 273 | return des; 274 | } 275 | var children = getChildrenAtFrame(ins, 0, parent); 276 | if (children.length >= 0) { 277 | des.type = TYPE_GROUP; 278 | des.group = parent; 279 | des.child = ins; 280 | return des; 281 | } else { 282 | var child = children[0]; 283 | return getInstanceDes(child, ins); 284 | } 285 | }; 286 | /** 287 | * get instance all children items at frame 288 | * @param {Instance} ins 289 | * @param {number} frame 290 | * @returns {Array} 291 | */ 292 | var getInstanceChildrenAtFrame = function (ins, frame, parent, recursion) { 293 | if (ins.instanceType == "symbol") { 294 | var timeline = ins.libraryItem.timeline; 295 | return getTimelineChildrenAtFrame(timeline, frame, ins, recursion, false); 296 | } else { 297 | return undefined; 298 | } 299 | }; 300 | /** 301 | * get timeline all children items at frame 302 | * @param {Instance} ins 303 | * @param {number} frame 304 | * @param {Instance} parent 305 | * @param {Boolean} recursion 306 | * @returns {Array} 307 | */ 308 | var getTimelineChildrenAtFrame = function (timeline, frame, parent, recursion, isRoot) { 309 | var layerCount = timeline.layerCount; 310 | var returnElements = new Array(); 311 | while (layerCount-- > 0) { 312 | var l = timeline.layers[layerCount]; 313 | if (l.frameCount > frame || isRoot == false) { 314 | if (isRoot == false) { 315 | frame = 0; 316 | } 317 | var nodes = l.frames[frame].elements.concat(); 318 | for (var i = 0; i < nodes.length; i++) { 319 | var ins = nodes[i]; 320 | var obj = { 321 | "target": ins, 322 | "type": TYPE_GROUP 323 | }; 324 | var isShape = ins instanceof Shape; 325 | if (isShape) { 326 | getExportItemDes(parent); 327 | } else { 328 | var isBitmap = ins.instanceType == "bitmap"; 329 | if (isBitmap) { 330 | getExportItemDes(ins); 331 | } 332 | } 333 | if (ins.instanceType == "symbol") { 334 | obj.type = TYPE_GROUP; 335 | } else { 336 | obj.type = TYPE_SPRITE; 337 | } 338 | if (isShape) { 339 | obj.type = TYPE_SHAPE; 340 | } 341 | if (ins.instanceType == "symbol" && recursion) { 342 | obj["children"] = getInstanceChildrenAtFrame(ins, frame, ins, recursion); 343 | } else { 344 | obj["children"] = undefined; 345 | } 346 | returnElements.push(obj); 347 | } 348 | } 349 | } 350 | return returnElements; 351 | }; 352 | var groupToJSON = function (node) { 353 | var ins = node.target; 354 | var obj = {}; 355 | obj.target = {}; 356 | 357 | obj.target.name = ins.name; 358 | if (ins.name == "") { 359 | var libraryName = ins.libraryItem.name; 360 | var name = libraryName.replace(" ", ""); 361 | name = name.replace("/", "_"); 362 | var first = name.substr(0, 1).toLowerCase(); 363 | name = first + name.substr(1, name.length - 1); 364 | obj.target.name = name + "_" + getInstanceCount(name); 365 | } 366 | obj.isGroup = true; 367 | obj.target.rotation = ins.rotation; 368 | obj.target.x = ins.x; 369 | obj.target.y = ins.y; 370 | obj.target.scaleX = ins.scaleX; 371 | obj.target.scaleY = ins.scaleY; 372 | obj.target.anchorX = ins.getTransformationPoint().x; 373 | obj.target.anchorY = ins.getTransformationPoint().y; 374 | 375 | obj.children = []; 376 | for (var i = 0; i < node.children.length; i++) { 377 | var subNode = node.children[i]; 378 | if (subNode.type == TYPE_SHAPE) { 379 | var bmp = bitmapToJSON(node); 380 | return bmp; 381 | } 382 | if (subNode.children == undefined) { 383 | obj.children.push(bitmapToJSON(subNode)); 384 | } else { 385 | obj.children.push(groupToJSON(subNode)); 386 | } 387 | } 388 | return obj; 389 | }; 390 | var bitmapToJSON = function (node) { 391 | var ins = node.target; 392 | var obj = {}; 393 | obj.target = {}; 394 | obj.isGroup = false; 395 | 396 | obj.target.name = ins.name; 397 | if (ins.name == "") { 398 | var libraryName = ins.libraryItem.name; 399 | var name = libraryName.replace(" ", ""); 400 | name = name.replace("/", "_"); 401 | var first = name.substr(0, 1).toLowerCase(); 402 | name = first + name.substr(1, name.length - 1); 403 | obj.target.name = name + "_" + getInstanceCount(name); 404 | } 405 | obj.res = ins.libraryItem.name.replace(" ", "").replace("/", "_"); 406 | obj.target.rotation = ins.rotation; 407 | obj.target.x = ins.x; 408 | obj.target.y = ins.y; 409 | obj.target.scaleX = ins.scaleX; 410 | obj.target.scaleY = ins.scaleY; 411 | obj.target.anchorX = ins.getTransformationPoint().x; 412 | obj.target.anchorY = ins.getTransformationPoint().y; 413 | return obj; 414 | }; 415 | var parseChildrenToJSON = function (children) { 416 | var obj = []; 417 | for (var i = 0; i < children.length; i++) { 418 | var node = children[i]; 419 | var ins = node["target"]; 420 | if (node["children"] != undefined) { 421 | obj.push(groupToJSON(node)); 422 | } else { 423 | obj.push(bitmapToJSON(node)); 424 | } 425 | } 426 | return obj; 427 | }; 428 | /** 429 | * parse the flash stage instances to JSON with frame 430 | * @returns {Array} 431 | */ 432 | var parseStageToJSON = function () { 433 | var obj = {}; 434 | obj.stageWidth = fl.getDocumentDOM().width; 435 | obj.stageHeight = fl.getDocumentDOM().height; 436 | obj.timeline = []; 437 | var frameCount = getTimelineMaxFrameCount(fl.getDocumentDOM().getTimeline()); 438 | for (var i = 0; i < frameCount; i++) { 439 | var frameChildren = getTimelineChildrenAtFrame(fl.getDocumentDOM().getTimeline(), i, undefined, true, true); 440 | var childrenObj = parseChildrenToJSON(frameChildren); 441 | obj.timeline.push(childrenObj); 442 | } 443 | return obj; 444 | }; 445 | /** 446 | * parse the preload config 447 | * @returns {Array} 448 | */ 449 | var parsePreload = function () { 450 | var arr = []; 451 | for (var k in exportPool) { 452 | var ins = exportPool[k]; 453 | var name = ins.name.replace("/", "_"); 454 | var obj = { 455 | "k": name, 456 | "v": resDir + ins.name + ".png" 457 | }; 458 | arr.push(obj); 459 | } 460 | return arr; 461 | }; 462 | var getDir = function (itemName) { 463 | var dir = itemName.substring(0, itemName.lastIndexOf("/")); 464 | return projDir + resDir + dir; 465 | }; 466 | var getPath = function (itemName) { 467 | return projDir + resDir + itemName; 468 | }; 469 | /** 470 | * Export items to PNG 471 | */ 472 | var exportItemsToPNG = function () { 473 | var newDoc = fl.createDocument(); 474 | for (var k in exportPool) { 475 | var ins = exportPool[k]; 476 | var itemIndex = oldLibrary.findItemIndex(ins.res); 477 | var item = oldLibrary.items[itemIndex]; 478 | var name = item.name; 479 | name = name.replace(" ", ""); 480 | var dir = getDir(name); 481 | if (FLfile.exists(dir) == false) { 482 | FLfile.createFolder(dir); 483 | } 484 | var path = getPath(name); 485 | newDoc.addItem({x: 0, y: 0}, item); 486 | newDoc.selectAll(); 487 | newDoc.scaleSelection(ins.scaleX, ins.scaleY); 488 | newDoc.width = Math.ceil(ins.width); 489 | newDoc.height = Math.ceil(ins.height); 490 | newDoc.moveSelectionBy({x: -newDoc.selection[0].left, y: -newDoc.selection[0].top}); 491 | newDoc.exportPNG(path + ".png", false, true); 492 | newDoc.deleteSelection(); 493 | } 494 | newDoc.close(false); 495 | }; 496 | /** 497 | * Export config to res.js 498 | */ 499 | var exportToJS = function () { 500 | var jsDes = "var MIA = MIA || {};\n" + 501 | "//preload items\n" + 502 | "MIA.preloadDes = " + preloadJSONStr + ";\n" + 503 | "//display description\n" + 504 | "MIA.stageDes = " + stageJSONStr + ";\n"; 505 | var jsPath = projDir + srcDir + jsName; 506 | FLfile.write(jsPath, jsDes); 507 | }; 508 | 509 | var TYPE_GROUP = "group"; 510 | var TYPE_SPRITE = "sprite"; 511 | var TYPE_SHAPE = "shape"; 512 | 513 | var exportPool = {}; 514 | var namePool = {}; 515 | var resDir = "res/"; 516 | var srcDir = "src/"; 517 | var jsName = "res.js"; 518 | 519 | 520 | fl.outputPanel.clear(); 521 | fl.getDocumentDOM().exitEditMode(); 522 | var oldLibrary = fl.getDocumentDOM().library; 523 | var stageJSON = parseStageToJSON(); 524 | var stageJSONStr = JSON.encode(stageJSON); 525 | var projDir = fl.scriptURI.substring(0, fl.scriptURI.lastIndexOf("/")) + "/../"; 526 | var preloadJSON = parsePreload(); 527 | var preloadJSONStr = JSON.encode(preloadJSON); 528 | 529 | 530 | //-------- run action----- 531 | //export stage items to png: project/res 532 | exportItemsToPNG(); 533 | //export preload and description Object: project/src/res.js 534 | exportToJS(); -------------------------------------------------------------------------------- /src/Game.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by qixiaowei on 2015/9/9. 3 | */ 4 | var MIA = MIA || {}; 5 | MIA.gameConfig = { 6 | stageWidth:MIA.stageDes.stageWidth, 7 | stageHeight:MIA.stageDes.stageHeight, 8 | bootScene:"Boot", 9 | firstScene:"Scene1" 10 | }; 11 | MIA.startGame = function () { 12 | var game = new Phaser.Game(MIA.gameConfig.stageWidth, MIA.gameConfig.stageHeight, Phaser.AUTO, 'game'); 13 | //----Add Scene 14 | game.state.add('Boot', MIA.Boot); 15 | game.state.add('Scene1', MIA.Scene1); 16 | game.state.add('Scene2', MIA.Scene2); 17 | game.state.add('Scene3', MIA.Scene3); 18 | 19 | //fixed logic 20 | MIA.gameConfig.bootScene = "Boot"; 21 | MIA.gameConfig.firstScene = "Scene1"; 22 | game.state.start(MIA.gameConfig.bootScene); 23 | }; -------------------------------------------------------------------------------- /src/Scene1.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by qixiaowei on 2015/9/11. 3 | */ 4 | var MIA = MIA || {}; 5 | MIA.Scene1 = function (game) { 6 | 7 | }; 8 | MIA.Scene1.prototype = { 9 | create: function () { 10 | var scene1 = MIA.createScene(0, this.game); 11 | var soundBtn = scene1.getChildByName("soundBtn"); 12 | soundBtn.inputEnabled = true; 13 | soundBtn.onClick(function () { 14 | soundBtn.getChildAt(1).visible = !soundBtn.getChildAt(1).visible; 15 | }, this); 16 | var scene = scene1.getChildByName("scene1"); 17 | var btn_play = scene.getChildByName("btn_play"); 18 | btn_play.inputEnabled = true; 19 | btn_play.onClick(function () { 20 | this.state.start("Scene2"); 21 | }, this); 22 | } 23 | }; -------------------------------------------------------------------------------- /src/Scene2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by qixiaowei on 2015/9/11. 3 | */ 4 | var MIA = MIA || {}; 5 | MIA.Scene2 = function (game) { 6 | 7 | }; 8 | MIA.Scene2.prototype = { 9 | create: function () { 10 | var scene = MIA.createScene(1, this.game); 11 | var soundBtn = scene.getChildByName("soundBtn"); 12 | soundBtn.inputEnabled = true; 13 | soundBtn.onClick(function () { 14 | soundBtn.getChildAt(1).visible = !soundBtn.getChildAt(1).visible; 15 | }, this); 16 | var photo1 = scene.getChildByName("photo1"); 17 | var photo2 = scene.getChildByName("photo2"); 18 | photo1.inputEnabled = true; 19 | photo1.onClick(function () { 20 | MIA.gameConfig.picID = 1; 21 | this.state.start("Scene3"); 22 | }, this); 23 | photo2.inputEnabled = true; 24 | photo2.onClick(function () { 25 | MIA.gameConfig.picID = 2; 26 | this.state.start("Scene3"); 27 | }, this); 28 | } 29 | }; -------------------------------------------------------------------------------- /src/Scene3.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by qixiaowei on 2015/9/11. 3 | */ 4 | var MIA = MIA || {}; 5 | MIA.Scene3 = function (game) { 6 | 7 | }; 8 | MIA.Scene3.prototype = { 9 | colorSelect: null, 10 | colorsArray: [16706497, 16763904, 16685312, 11755012, 16777215, 7470794, 380259, 1211416, 11579568, 3263738, 2829311, 3342489, 16698571, 16672459, 13303960, 10224128], 11 | colorDict: {}, 12 | scene: null, 13 | ok_btn: null, 14 | currentPic: null, 15 | create: function () { 16 | var scene1 = MIA.createScene(2, this.game); 17 | var soundBtn = scene1.getChildByName("soundBtn"); 18 | soundBtn.inputEnabled = true; 19 | soundBtn.onClick(function () { 20 | soundBtn.getChildAt(1).visible = !soundBtn.getChildAt(1).visible; 21 | }, this); 22 | this.scene = scene1.getChildByName("scene3"); 23 | 24 | this.ok_btn = this.scene.getChildByName("ok_btn"); 25 | var photo1 = this.scene.getChildByName("photo1"); 26 | var photo2 = this.scene.getChildByName("photo2"); 27 | console.log(MIA.gameConfig.picID); 28 | if (MIA.gameConfig.picID == 1) { 29 | this.currentPic = photo1; 30 | photo2.visible = false; 31 | this.scene.removeChild(photo2); 32 | console.log(MIA.gameConfig.picID); 33 | } else { 34 | this.currentPic = photo2; 35 | photo1.visible = false; 36 | this.scene.removeChild(photo1); 37 | console.log(MIA.gameConfig.picID); 38 | } 39 | 40 | var colorsPanel = this.scene.getChildByName("colorsPanel"); 41 | this.colorSelect = colorsPanel.children[colorsPanel.children.length - 1]; 42 | var index = 0; 43 | colorsPanel.forEach(function (img) { 44 | if (img != this.colorSelect) { 45 | index++; 46 | img.name = "C" + index; 47 | img.inputEnabled = true; 48 | img.input.pixelPerfectClick = true; 49 | img.events.onInputDown.add(this.onSelectColor, this); 50 | var color = this.colorsArray[index - 1]; 51 | this.colorDict[img.name] = color; 52 | } 53 | }, this); 54 | var s = colorsPanel.children[0]; 55 | this.currentColor = this.colorDict[s.name]; 56 | this.colorSelect.x = s.x - 1; 57 | this.colorSelect.y = s.y - 1; 58 | 59 | this.currentPic.forEach(function (sprite) { 60 | sprite.inputEnabled = true; 61 | sprite.input.pixelPerfectClick = true; 62 | sprite.events.onInputDown.add(this.onFillColor, this); 63 | }, this); 64 | }, 65 | onFillColor: function (sprite, pointer) { 66 | sprite.tint = this.currentColor; 67 | this.ok_btn.visible = true; 68 | //if (this.soundEnabled) { 69 | // this.effect1.play(); 70 | //} 71 | }, 72 | onSelectColor: function (sprite) { 73 | this.currentColor = this.colorDict[sprite.name]; 74 | this.colorSelect.x = sprite.x - 1; 75 | this.colorSelect.y = sprite.y - 1; 76 | //if (this.soundEnabled) { 77 | // this.effect1.play(); 78 | //} 79 | }, 80 | showPhoto: function () { 81 | //if (this.soundEnabled) { 82 | // this.effect2.play(); 83 | //} 84 | //this.scene3.ok_btn.visible = false; 85 | //this.scene3.show_bg.visible = true; 86 | //this.scene3.currentPhoto.setInputEnabled(false); 87 | //if (this.photoName == "photo1") { 88 | // this.scene3.currentPhoto.x = this.photo1InitPos.x + 70; 89 | // this.scene3.currentPhoto.y = this.photo1InitPos.y + 50; 90 | //} else { 91 | // if (this.photoName == "photo2") { 92 | // this.scene3.currentPhoto.x = this.photo2InitPos.x + 70; 93 | // this.scene3.currentPhoto.y = this.photo2InitPos.y + 40; 94 | // } 95 | //} 96 | } 97 | } -------------------------------------------------------------------------------- /src/mia/PhaserExtend.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by qixiaowei on 2015/9/11. 3 | * MiaPhaser Extend 4 | * version 1.0 5 | */ 6 | Phaser.Group.prototype.getChildByName = function (name) { 7 | for (var i = 0; i < this.children.length; i++) { 8 | if (this.children[i].name === name) { 9 | return this.children[i]; 10 | } 11 | } 12 | return null; 13 | }; 14 | Phaser.Group.prototype.removeAllClick = Phaser.Group.prototype.removeAllClick || function (callback, context) { 15 | this.forEach(function (sprite) { 16 | if (sprite instanceof Phaser.Group) { 17 | sprite.removeAllClick(callback, context); 18 | } else { 19 | sprite.inputEnabled = true; 20 | sprite.events.onInputDown.removeAll(context); 21 | } 22 | }); 23 | }; 24 | Phaser.Group.prototype.removeClick = Phaser.Group.prototype.removeClick || function (callback, context) { 25 | this.forEach(function (sprite) { 26 | if (sprite instanceof Phaser.Group) { 27 | sprite.removeClick(callback, context); 28 | } else { 29 | sprite.inputEnabled = true; 30 | sprite.events.onInputDown.remove(callback, context); 31 | } 32 | }); 33 | }; 34 | 35 | Phaser.Group.prototype.onClick = Phaser.Group.prototype.onClick || function (callback, context) { 36 | this.forEach(function (sprite) { 37 | if (sprite instanceof Phaser.Group) { 38 | sprite.onClick(callback, context); 39 | } else { 40 | sprite.inputEnabled = true; 41 | sprite.events.onInputDown.add(callback, context); 42 | } 43 | }); 44 | }; 45 | /** 46 | * Phaser.Group inputEnabled 47 | */ 48 | Object.defineProperty(Phaser.Group.prototype, "_inputEnabled", false); 49 | Object.defineProperty(Phaser.Group.prototype, "inputEnabled", { 50 | get: function () { 51 | return this._inputEnabled; 52 | }, 53 | /** 54 | * 55 | * @param {Boolean} value 56 | */ 57 | set: function (value) { 58 | if (this._inputEnabled === value) { 59 | return; 60 | } 61 | this._inputEnabled = value; 62 | this.forEach(function (sprite) { 63 | if (sprite instanceof Phaser.Group) { 64 | sprite.inputEnabled(value); 65 | } else { 66 | sprite.inputEnabled = value; 67 | } 68 | }); 69 | } 70 | }); 71 | 72 | //--------------- 73 | var MIA = MIA || {}; 74 | MIA.Boot = function (game) { 75 | 76 | }; 77 | MIA.createScene = function (frame, game) { 78 | var scene = new Phaser.Group(game); 79 | var desArr = MIA.stageDes.timeline[frame]; 80 | for (var i = 0; i < desArr.length; i++) { 81 | var des = desArr[i]; 82 | var node = MIA.createChild(des, scene, game); 83 | } 84 | return scene; 85 | }; 86 | MIA.createChild = function (des, parent, game) { 87 | if (des.isGroup) { 88 | return MIA.createGroup(des, parent, game); 89 | } else { 90 | return MIA.createSprite(des, parent, game); 91 | } 92 | }; 93 | MIA.createGroup = function (des, parent, game) { 94 | var group = new Phaser.Group(game, parent); 95 | group.name = des.target.name; 96 | group.x = des.target.x; 97 | group.y = des.target.y; 98 | //group.x += des.target.anchorX; 99 | //group.y += des.target.anchorY; 100 | group.angle = des.target.rotation; 101 | group.scale.set(des.target.scaleX, des.target.scaleY); 102 | for (var i = 0; i < des.children.length; i++) { 103 | if (des.children[i].target.name.indexOf("470") != -1 || des.children[i].target.name.indexOf("471") != -1) { 104 | console.log(group.name, group.x, group.y); 105 | } 106 | group.addChild(MIA.createChild(des.children[i], group, game)); 107 | } 108 | return group; 109 | }; 110 | MIA.createSprite = function (des, parent, game) { 111 | var sprite = new Phaser.Sprite(game, des.target.x, des.target.y, des.res); 112 | sprite.name = des.target.name; 113 | sprite.angle = des.target.rotation; 114 | sprite.scale.set(des.target.scaleX, des.target.scaleY); 115 | 116 | return sprite; 117 | }; 118 | MIA.Boot.prototype = { 119 | preload: function () { 120 | this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; 121 | //this.scale.minWidth = 260; 122 | //this.scale.minHeight = 480; 123 | //this.scale.maxWidth = 768; 124 | //this.scale.maxHeight = 1024; 125 | this.scale.pageAlignHorizontally = true; 126 | this.scale.pageAlignVertically = true; 127 | //this.scale.forceOrientation(false, true); 128 | //this.scale.hasResized.add(this.gameResized, this); 129 | //this.scale.enterIncorrectOrientation.add(this.enterIncorrectOrientation, this); 130 | //this.scale.leaveIncorrectOrientation.add(this.leaveIncorrectOrientation, this); 131 | //this.scale.setScreenSize(true); 132 | 133 | 134 | for (var i = 0; i < MIA.preloadDes.length; i++) { 135 | var obj = MIA.preloadDes[i]; 136 | this.load.image(obj.k, obj.v); 137 | } 138 | }, 139 | create: function () { 140 | this.state.start(MIA.gameConfig.firstScene); 141 | } 142 | }; -------------------------------------------------------------------------------- /src/res.js: -------------------------------------------------------------------------------- 1 | var MIA = MIA || {}; 2 | //preload items 3 | MIA.preloadDes = [{"k":"startBgPNG","v":"res/startBgPNG.png"},{"k":"titlePNG","v":"res/titlePNG.png"},{"k":"morepng","v":"res/morepng.png"},{"k":"image392","v":"res/image392.png"},{"k":"soundOpen","v":"res/soundOpen.png"},{"k":"soundClose","v":"res/soundClose.png"},{"k":"image143","v":"res/image143.png"},{"k":"CLTB_img_1441961353264_0","v":"res/CLTB_img_1441961353264_0.png"},{"k":"CLTB_img_1441961353264_1","v":"res/CLTB_img_1441961353264_1.png"},{"k":"CLTB_img_1441961353264_2","v":"res/CLTB_img_1441961353264_2.png"},{"k":"CLTB_img_1441961353264_3","v":"res/CLTB_img_1441961353264_3.png"},{"k":"CLTB_img_1441961353264_4","v":"res/CLTB_img_1441961353264_4.png"},{"k":"CLTB_img_1441961353264_5","v":"res/CLTB_img_1441961353264_5.png"},{"k":"CLTB_img_1441961353264_6","v":"res/CLTB_img_1441961353264_6.png"},{"k":"CLTB_img_1441961353264_7","v":"res/CLTB_img_1441961353264_7.png"},{"k":"CLTB_img_1441961353264_8","v":"res/CLTB_img_1441961353264_8.png"},{"k":"CLTB_img_1441961353264_9","v":"res/CLTB_img_1441961353264_9.png"},{"k":"CLTB_img_1441961353264_10","v":"res/CLTB_img_1441961353264_10.png"},{"k":"CLTB_img_1441961362847_0","v":"res/CLTB_img_1441961362847_0.png"},{"k":"CLTB_img_1441961362847_1","v":"res/CLTB_img_1441961362847_1.png"},{"k":"CLTB_img_1441961362847_2","v":"res/CLTB_img_1441961362847_2.png"},{"k":"CLTB_img_1441961362847_3","v":"res/CLTB_img_1441961362847_3.png"},{"k":"CLTB_img_1441961362847_4","v":"res/CLTB_img_1441961362847_4.png"},{"k":"CLTB_img_1441961362847_5","v":"res/CLTB_img_1441961362847_5.png"},{"k":"CLTB_img_1441961362847_6","v":"res/CLTB_img_1441961362847_6.png"},{"k":"CLTB_img_1441961362847_7","v":"res/CLTB_img_1441961362847_7.png"},{"k":"CLTB_img_1441961362847_8","v":"res/CLTB_img_1441961362847_8.png"},{"k":"CLTB_img_1441961362847_9","v":"res/CLTB_img_1441961362847_9.png"},{"k":"CLTB_img_1441961362847_10","v":"res/CLTB_img_1441961362847_10.png"},{"k":"CLTB_img_1441961362847_11","v":"res/CLTB_img_1441961362847_11.png"},{"k":"CLTB_img_1441961362847_12","v":"res/CLTB_img_1441961362847_12.png"},{"k":"CLTB_img_1441961362847_13","v":"res/CLTB_img_1441961362847_13.png"},{"k":"CLTB_img_1441961362847_14","v":"res/CLTB_img_1441961362847_14.png"},{"k":"CLTB_img_1441961362847_15","v":"res/CLTB_img_1441961362847_15.png"},{"k":"CLTB_img_1441961362847_16","v":"res/CLTB_img_1441961362847_16.png"},{"k":"CLTB_img_1441961362847_17","v":"res/CLTB_img_1441961362847_17.png"},{"k":"CLTB_img_1441961362847_18","v":"res/CLTB_img_1441961362847_18.png"},{"k":"CLTB_img_1441961362847_19","v":"res/CLTB_img_1441961362847_19.png"},{"k":"CLTB_img_1441961362847_20","v":"res/CLTB_img_1441961362847_20.png"},{"k":"CLTB_img_1441961362847_21","v":"res/CLTB_img_1441961362847_21.png"},{"k":"CLTB_img_1441961362847_22","v":"res/CLTB_img_1441961362847_22.png"},{"k":"CLTB_img_1441961362847_23","v":"res/CLTB_img_1441961362847_23.png"},{"k":"CLTB_img_1441961362847_24","v":"res/CLTB_img_1441961362847_24.png"},{"k":"CLTB_img_1441961362847_25","v":"res/CLTB_img_1441961362847_25.png"},{"k":"CLTB_img_1441961362847_26","v":"res/CLTB_img_1441961362847_26.png"},{"k":"CLTB_img_1441961362847_27","v":"res/CLTB_img_1441961362847_27.png"},{"k":"CLTB_img_Bitmap1134","v":"res/CLTB_img_Bitmap1134.png"},{"k":"CLTB_img_1440988919063_15","v":"res/CLTB_img_1440988919063_15.png"},{"k":"CLTB_img_1440988919063_14","v":"res/CLTB_img_1440988919063_14.png"},{"k":"CLTB_img_1440988919063_13","v":"res/CLTB_img_1440988919063_13.png"},{"k":"CLTB_img_1440988919063_12","v":"res/CLTB_img_1440988919063_12.png"},{"k":"CLTB_img_1440988919063_11","v":"res/CLTB_img_1440988919063_11.png"},{"k":"CLTB_img_1440988919063_10","v":"res/CLTB_img_1440988919063_10.png"},{"k":"CLTB_img_1440988919063_9","v":"res/CLTB_img_1440988919063_9.png"},{"k":"CLTB_img_1440988919063_8","v":"res/CLTB_img_1440988919063_8.png"},{"k":"CLTB_img_1440988919063_7","v":"res/CLTB_img_1440988919063_7.png"},{"k":"CLTB_img_1440988919063_6","v":"res/CLTB_img_1440988919063_6.png"},{"k":"CLTB_img_1440988919063_5","v":"res/CLTB_img_1440988919063_5.png"},{"k":"CLTB_img_1440988919063_4","v":"res/CLTB_img_1440988919063_4.png"},{"k":"CLTB_img_1440988919063_3","v":"res/CLTB_img_1440988919063_3.png"},{"k":"CLTB_img_1440988919063_2","v":"res/CLTB_img_1440988919063_2.png"},{"k":"CLTB_img_1440988919063_1","v":"res/CLTB_img_1440988919063_1.png"},{"k":"CLTB_img_1440988919063_0","v":"res/CLTB_img_1440988919063_0.png"},{"k":"CLTB_img_1440989169243_0","v":"res/CLTB_img_1440989169243_0.png"},{"k":"CLTB_img_1440664749495_0","v":"res/CLTB_img_1440664749495_0.png"},{"k":"CLTB_img_1440664742599_0","v":"res/CLTB_img_1440664742599_0.png"},{"k":"CLTB_img_1440664738368_0","v":"res/CLTB_img_1440664738368_0.png"},{"k":"CLTB_img_1440664683720_0","v":"res/CLTB_img_1440664683720_0.png"}]; 4 | //display description 5 | MIA.stageDes = {"stageWidth":720,"stageHeight":1280,"timeline":[[{"target":{"name":"scene1","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":360,"anchorY":640},"isGroup":true,"children":[{"target":{"name":"startBgPNG_0","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":430,"anchorY":250},"isGroup":false,"res":"startBgPNG"},{"target":{"name":"titlePNG_0","rotation":0,"x":114.85,"y":390.45,"scaleX":1,"scaleY":1,"anchorX":240.5,"anchorY":135.5},"isGroup":false,"res":"titlePNG"},{"target":{"name":"btn_more","rotation":0,"x":360.95,"y":728.9,"scaleX":1,"scaleY":1,"anchorX":0,"anchorY":0},"isGroup":true,"children":[{"target":{"name":"morepng_0","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":53,"anchorY":37},"isGroup":false,"res":"morepng"}]},{"target":{"name":"btn_play","rotation":0,"x":546,"y":728.9,"scaleX":1,"scaleY":1,"anchorX":0,"anchorY":0},"isGroup":true,"children":[{"target":{"name":"image392_0","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":78,"anchorY":79.5},"isGroup":false,"res":"image392"}]}]},{"target":{"name":"soundBtn","rotation":0,"x":660,"y":0,"scaleX":1,"scaleY":1,"anchorX":30,"anchorY":29.5},"isGroup":true,"children":[{"target":{"name":"soundOpen_0","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":30,"anchorY":29.5},"isGroup":false,"res":"soundOpen"},{"target":{"name":"soundClose_0","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":30,"anchorY":29.5},"isGroup":false,"res":"soundClose"}]}],[{"target":{"name":"image143_0","rotation":0,"x":0,"y":0,"scaleX":0.9999847412109375,"scaleY":1,"anchorX":0,"anchorY":500},"isGroup":false,"res":"image143"},{"target":{"name":"photo1","rotation":0,"x":141.65,"y":276.9,"scaleX":0.7318267822265625,"scaleY":0.7317047119140625,"anchorX":0,"anchorY":0},"isGroup":true,"children":[{"target":{"name":"cLTB_img_1441961353264_0_0","rotation":0,"x":241.85,"y":249.55,"scaleX":1,"scaleY":1,"anchorX":99.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1441961353264_0"},{"target":{"name":"cLTB_img_1441961353264_1_0","rotation":0,"x":352.1,"y":224.9,"scaleX":1,"scaleY":1,"anchorX":34.5,"anchorY":31},"isGroup":false,"res":"CLTB_img_1441961353264_1"},{"target":{"name":"cLTB_img_1441961353264_2_0","rotation":0,"x":178.75,"y":197.8,"scaleX":1,"scaleY":1,"anchorX":40,"anchorY":43},"isGroup":false,"res":"CLTB_img_1441961353264_2"},{"target":{"name":"cLTB_img_1441961353264_3_0","rotation":0,"x":248.9,"y":307,"scaleX":1,"scaleY":1,"anchorX":91,"anchorY":33.5},"isGroup":false,"res":"CLTB_img_1441961353264_3"},{"target":{"name":"cLTB_img_1441961353264_4_0","rotation":0,"x":58.9,"y":40.65,"scaleX":1,"scaleY":1,"anchorX":288,"anchorY":131},"isGroup":false,"res":"CLTB_img_1441961353264_4"},{"target":{"name":"cLTB_img_1441961353264_5_0","rotation":0,"x":177.8,"y":197.85,"scaleX":1,"scaleY":1,"anchorX":48,"anchorY":61},"isGroup":false,"res":"CLTB_img_1441961353264_5"},{"target":{"name":"cLTB_img_1441961353264_6_0","rotation":0,"x":-1,"y":-1,"scaleX":1,"scaleY":1,"anchorX":342.5,"anchorY":168},"isGroup":false,"res":"CLTB_img_1441961353264_6"},{"target":{"name":"cLTB_img_1441961353264_7_0","rotation":0,"x":153.75,"y":28.45,"scaleX":1,"scaleY":1,"anchorX":175,"anchorY":229},"isGroup":false,"res":"CLTB_img_1441961353264_7"},{"target":{"name":"cLTB_img_1441961353264_8_0","rotation":0,"x":174.15,"y":326.8,"scaleX":1,"scaleY":1,"anchorX":158,"anchorY":80},"isGroup":false,"res":"CLTB_img_1441961353264_8"},{"target":{"name":"cLTB_img_1441961353264_9_0","rotation":0,"x":165.25,"y":89.65,"scaleX":1,"scaleY":1,"anchorX":154.5,"anchorY":118.5},"isGroup":false,"res":"CLTB_img_1441961353264_9"},{"target":{"name":"cLTB_img_1441961353264_10_0","rotation":0,"x":172.2,"y":167.05,"scaleX":1,"scaleY":1,"anchorX":16.5,"anchorY":8.5},"isGroup":false,"res":"CLTB_img_1441961353264_10"}]},{"target":{"name":"photo2","rotation":0,"x":170.95,"y":733.2,"scaleX":0.789581298828125,"scaleY":0.78955078125,"anchorX":0,"anchorY":0},"isGroup":true,"children":[{"target":{"name":"cLTB_img_1441961362847_0_0","rotation":0,"x":254.6,"y":340.4,"scaleX":1,"scaleY":1,"anchorX":90.5,"anchorY":35},"isGroup":false,"res":"CLTB_img_1441961362847_0"},{"target":{"name":"cLTB_img_1441961362847_1_0","rotation":0,"x":317.6,"y":-1,"scaleX":1,"scaleY":1,"anchorX":65,"anchorY":71},"isGroup":false,"res":"CLTB_img_1441961362847_1"},{"target":{"name":"cLTB_img_1441961362847_2_0","rotation":0,"x":320.7,"y":185.45,"scaleX":1,"scaleY":1,"anchorX":30,"anchorY":48},"isGroup":false,"res":"CLTB_img_1441961362847_2"},{"target":{"name":"cLTB_img_1441961362847_3_0","rotation":0,"x":240.7,"y":160.85,"scaleX":1,"scaleY":1,"anchorX":126,"anchorY":72},"isGroup":false,"res":"CLTB_img_1441961362847_3"},{"target":{"name":"cLTB_img_1441961362847_4_0","rotation":0,"x":320.9,"y":124.95,"scaleX":1,"scaleY":1,"anchorX":49,"anchorY":47.5},"isGroup":false,"res":"CLTB_img_1441961362847_4"},{"target":{"name":"cLTB_img_1441961362847_5_0","rotation":0,"x":88.2,"y":83.05,"scaleX":1,"scaleY":1,"anchorX":163.5,"anchorY":83.5},"isGroup":false,"res":"CLTB_img_1441961362847_5"},{"target":{"name":"cLTB_img_1441961362847_6_0","rotation":0,"x":361.95,"y":79.95,"scaleX":1,"scaleY":1,"anchorX":28,"anchorY":10.5},"isGroup":false,"res":"CLTB_img_1441961362847_6"},{"target":{"name":"cLTB_img_1441961362847_7_0","rotation":0,"x":334.3,"y":38.7,"scaleX":1,"scaleY":1,"anchorX":49.5,"anchorY":72},"isGroup":false,"res":"CLTB_img_1441961362847_7"},{"target":{"name":"cLTB_img_1441961362847_8_0","rotation":0,"x":288.55,"y":239.55,"scaleX":1,"scaleY":1,"anchorX":42,"anchorY":80},"isGroup":false,"res":"CLTB_img_1441961362847_8"},{"target":{"name":"cLTB_img_1441961362847_9_0","rotation":0,"x":63.75,"y":131.15,"scaleX":1,"scaleY":1,"anchorX":57.5,"anchorY":57},"isGroup":false,"res":"CLTB_img_1441961362847_9"},{"target":{"name":"cLTB_img_1441961362847_10_0","rotation":0,"x":22.85,"y":169.95,"scaleX":1,"scaleY":1,"anchorX":105.5,"anchorY":141},"isGroup":false,"res":"CLTB_img_1441961362847_10"},{"target":{"name":"cLTB_img_1441961362847_11_0","rotation":0,"x":85.15,"y":224.3,"scaleX":1,"scaleY":1,"anchorX":40,"anchorY":14},"isGroup":false,"res":"CLTB_img_1441961362847_11"},{"target":{"name":"cLTB_img_1441961362847_12_0","rotation":0,"x":48.95,"y":106.9,"scaleX":1,"scaleY":1,"anchorX":58.5,"anchorY":37.5},"isGroup":false,"res":"CLTB_img_1441961362847_12"},{"target":{"name":"cLTB_img_1441961362847_13_0","rotation":0,"x":-1.35,"y":102.6,"scaleX":1,"scaleY":1,"anchorX":118,"anchorY":174.5},"isGroup":false,"res":"CLTB_img_1441961362847_13"},{"target":{"name":"cLTB_img_1441961362847_14_0","rotation":0,"x":95.65,"y":227.65,"scaleX":1,"scaleY":1,"anchorX":34,"anchorY":8},"isGroup":false,"res":"CLTB_img_1441961362847_14"},{"target":{"name":"cLTB_img_1441961362847_15_0","rotation":0,"x":130.85,"y":347.7,"scaleX":1,"scaleY":1,"anchorX":233,"anchorY":52},"isGroup":false,"res":"CLTB_img_1441961362847_15"},{"target":{"name":"cLTB_img_1441961362847_16_0","rotation":0,"x":131.5,"y":333.5,"scaleX":1,"scaleY":1,"anchorX":210,"anchorY":49.5},"isGroup":false,"res":"CLTB_img_1441961362847_16"},{"target":{"name":"cLTB_img_1441961362847_17_0","rotation":0,"x":257.85,"y":384.7,"scaleX":1,"scaleY":1,"anchorX":75,"anchorY":34},"isGroup":false,"res":"CLTB_img_1441961362847_17"},{"target":{"name":"cLTB_img_1441961362847_18_0","rotation":0,"x":235.1,"y":153.05,"scaleX":1,"scaleY":1,"anchorX":134.5,"anchorY":41},"isGroup":false,"res":"CLTB_img_1441961362847_18"},{"target":{"name":"cLTB_img_1441961362847_19_0","rotation":0,"x":153.2,"y":191.8,"scaleX":1,"scaleY":1,"anchorX":155,"anchorY":130},"isGroup":false,"res":"CLTB_img_1441961362847_19"},{"target":{"name":"cLTB_img_1441961362847_20_0","rotation":0,"x":158.9,"y":152.1,"scaleX":1,"scaleY":1,"anchorX":189.5,"anchorY":135.5},"isGroup":false,"res":"CLTB_img_1441961362847_20"},{"target":{"name":"cLTB_img_1441961362847_21_0","rotation":0,"x":268.45,"y":320.25,"scaleX":1,"scaleY":1,"anchorX":59,"anchorY":39.5},"isGroup":false,"res":"CLTB_img_1441961362847_21"},{"target":{"name":"cLTB_img_1441961362847_22_0","rotation":0,"x":361.7,"y":129.75,"scaleX":1,"scaleY":1,"anchorX":17.5,"anchorY":6.5},"isGroup":false,"res":"CLTB_img_1441961362847_22"},{"target":{"name":"cLTB_img_1441961362847_23_0","rotation":0,"x":357.15,"y":127.35,"scaleX":1,"scaleY":1,"anchorX":23.5,"anchorY":11.5},"isGroup":false,"res":"CLTB_img_1441961362847_23"},{"target":{"name":"cLTB_img_1441961362847_24_0","rotation":0,"x":424.15,"y":208.85,"scaleX":1,"scaleY":1,"anchorX":23.5,"anchorY":85.5},"isGroup":false,"res":"CLTB_img_1441961362847_24"},{"target":{"name":"cLTB_img_1441961362847_25_0","rotation":0,"x":74.85,"y":78.5,"scaleX":1,"scaleY":1,"anchorX":175.5,"anchorY":90.5},"isGroup":false,"res":"CLTB_img_1441961362847_25"},{"target":{"name":"cLTB_img_1441961362847_26_0","rotation":0,"x":318.25,"y":64.2,"scaleX":1,"scaleY":1,"anchorX":61.5,"anchorY":64.5},"isGroup":false,"res":"CLTB_img_1441961362847_26"},{"target":{"name":"cLTB_img_1441961362847_27_0","rotation":0,"x":236.65,"y":124.75,"scaleX":1,"scaleY":1,"anchorX":112.5,"anchorY":106.5},"isGroup":false,"res":"CLTB_img_1441961362847_27"}]},{"target":{"name":"soundBtn","rotation":0,"x":660,"y":0,"scaleX":1,"scaleY":1,"anchorX":30,"anchorY":29.5},"isGroup":true,"children":[{"target":{"name":"soundOpen_1","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":30,"anchorY":29.5},"isGroup":false,"res":"soundOpen"},{"target":{"name":"soundClose_1","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":30,"anchorY":29.5},"isGroup":false,"res":"soundClose"}]}],[{"target":{"name":"scene3","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":430,"anchorY":250},"isGroup":true,"children":[{"target":{"name":"bg1","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":430,"anchorY":250},"isGroup":true,"children":[{"target":{"name":"cLTB_img_Bitmap1134_0","rotation":0,"x":0,"y":0,"scaleX":0.9999847412109375,"scaleY":1,"anchorX":0,"anchorY":0},"isGroup":false,"res":"CLTB_img_Bitmap1134"}]},{"target":{"name":"colorsPanel","rotation":0,"x":613.2,"y":1068.05,"scaleX":1,"scaleY":1,"anchorX":-103.05,"anchorY":211.9},"isGroup":true,"children":[{"target":{"name":"cLTB_img_1440988919063_15_0","rotation":0,"x":-102.2,"y":-208.05,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_15"},{"target":{"name":"cLTB_img_1440988919063_14_0","rotation":0,"x":-52.2,"y":-208.05,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_14"},{"target":{"name":"cLTB_img_1440988919063_13_0","rotation":0,"x":-2.2,"y":-208.05,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_13"},{"target":{"name":"cLTB_img_1440988919063_12_0","rotation":0,"x":47.8,"y":-208.05,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_12"},{"target":{"name":"cLTB_img_1440988919063_11_0","rotation":0,"x":-102.2,"y":-105.05,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":56},"isGroup":false,"res":"CLTB_img_1440988919063_11"},{"target":{"name":"cLTB_img_1440988919063_10_0","rotation":0,"x":-52.2,"y":-105.05,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_10"},{"target":{"name":"cLTB_img_1440988919063_9_0","rotation":0,"x":-2.2,"y":-105.05,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_9"},{"target":{"name":"cLTB_img_1440988919063_8_0","rotation":0,"x":47.8,"y":-105.05,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_8"},{"target":{"name":"cLTB_img_1440988919063_7_0","rotation":0,"x":-102.2,"y":-2.05,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55},"isGroup":false,"res":"CLTB_img_1440988919063_7"},{"target":{"name":"cLTB_img_1440988919063_6_0","rotation":0,"x":-52.2,"y":-2.05,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_6"},{"target":{"name":"cLTB_img_1440988919063_5_0","rotation":0,"x":-2.2,"y":-2.05,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_5"},{"target":{"name":"cLTB_img_1440988919063_4_0","rotation":0,"x":47.8,"y":-2.05,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_4"},{"target":{"name":"cLTB_img_1440988919063_3_0","rotation":0,"x":-102.2,"y":100.95,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_3"},{"target":{"name":"cLTB_img_1440988919063_2_0","rotation":0,"x":-52.2,"y":100.95,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_2"},{"target":{"name":"cLTB_img_1440988919063_1_0","rotation":0,"x":-3.2,"y":100.95,"scaleX":1,"scaleY":1,"anchorX":30,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_1"},{"target":{"name":"cLTB_img_1440988919063_0_0","rotation":0,"x":47.8,"y":100.95,"scaleX":1,"scaleY":1,"anchorX":29.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1440988919063_0"},{"target":{"name":"cLTB_img_1440989169243_0_0","rotation":0,"x":-103,"y":-208,"scaleX":1,"scaleY":1,"anchorX":28,"anchorY":54},"isGroup":false,"res":"CLTB_img_1440989169243_0"}]},{"target":{"name":"show_bg","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":0,"anchorY":0},"isGroup":true,"children":[{"target":{"name":"cLTB_img_1440664749495_0_0","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":0,"anchorY":500},"isGroup":false,"res":"CLTB_img_1440664749495_0"}]},{"target":{"name":"playAgain_btn","rotation":0,"x":264.05,"y":122.1,"scaleX":1,"scaleY":1,"anchorX":0,"anchorY":0},"isGroup":true,"children":[{"target":{"name":"cLTB_img_1440664742599_0_0","rotation":0,"x":-54,"y":-53,"scaleX":1,"scaleY":1,"anchorX":54.5,"anchorY":53},"isGroup":false,"res":"CLTB_img_1440664742599_0"}]},{"target":{"name":"btn_more","rotation":0,"x":134.6,"y":120.05,"scaleX":0.7173919677734375,"scaleY":0.717254638671875,"anchorX":0,"anchorY":-0.3},"isGroup":true,"children":[{"target":{"name":"cLTB_img_1440664738368_0_0","rotation":0,"x":-69,"y":-71,"scaleX":1,"scaleY":1,"anchorX":69,"anchorY":71},"isGroup":false,"res":"CLTB_img_1440664738368_0"}]},{"target":{"name":"photo2","rotation":0,"x":129.45,"y":309.2,"scaleX":0.789581298828125,"scaleY":0.78955078125,"anchorX":0,"anchorY":0},"isGroup":true,"children":[{"target":{"name":"cLTB_img_1441961362847_0_1","rotation":0,"x":254.6,"y":340.4,"scaleX":1,"scaleY":1,"anchorX":90.5,"anchorY":35},"isGroup":false,"res":"CLTB_img_1441961362847_0"},{"target":{"name":"cLTB_img_1441961362847_1_1","rotation":0,"x":317.6,"y":-1,"scaleX":1,"scaleY":1,"anchorX":65,"anchorY":71},"isGroup":false,"res":"CLTB_img_1441961362847_1"},{"target":{"name":"cLTB_img_1441961362847_2_1","rotation":0,"x":320.7,"y":185.45,"scaleX":1,"scaleY":1,"anchorX":30,"anchorY":48},"isGroup":false,"res":"CLTB_img_1441961362847_2"},{"target":{"name":"cLTB_img_1441961362847_3_1","rotation":0,"x":240.7,"y":160.85,"scaleX":1,"scaleY":1,"anchorX":126,"anchorY":72},"isGroup":false,"res":"CLTB_img_1441961362847_3"},{"target":{"name":"cLTB_img_1441961362847_4_1","rotation":0,"x":320.9,"y":124.95,"scaleX":1,"scaleY":1,"anchorX":49,"anchorY":47.5},"isGroup":false,"res":"CLTB_img_1441961362847_4"},{"target":{"name":"cLTB_img_1441961362847_5_1","rotation":0,"x":88.2,"y":83.05,"scaleX":1,"scaleY":1,"anchorX":163.5,"anchorY":83.5},"isGroup":false,"res":"CLTB_img_1441961362847_5"},{"target":{"name":"cLTB_img_1441961362847_6_1","rotation":0,"x":361.95,"y":79.95,"scaleX":1,"scaleY":1,"anchorX":28,"anchorY":10.5},"isGroup":false,"res":"CLTB_img_1441961362847_6"},{"target":{"name":"cLTB_img_1441961362847_7_1","rotation":0,"x":334.3,"y":38.7,"scaleX":1,"scaleY":1,"anchorX":49.5,"anchorY":72},"isGroup":false,"res":"CLTB_img_1441961362847_7"},{"target":{"name":"cLTB_img_1441961362847_8_1","rotation":0,"x":288.55,"y":239.55,"scaleX":1,"scaleY":1,"anchorX":42,"anchorY":80},"isGroup":false,"res":"CLTB_img_1441961362847_8"},{"target":{"name":"cLTB_img_1441961362847_9_1","rotation":0,"x":63.75,"y":131.15,"scaleX":1,"scaleY":1,"anchorX":57.5,"anchorY":57},"isGroup":false,"res":"CLTB_img_1441961362847_9"},{"target":{"name":"cLTB_img_1441961362847_10_1","rotation":0,"x":22.85,"y":169.95,"scaleX":1,"scaleY":1,"anchorX":105.5,"anchorY":141},"isGroup":false,"res":"CLTB_img_1441961362847_10"},{"target":{"name":"cLTB_img_1441961362847_11_1","rotation":0,"x":85.15,"y":224.3,"scaleX":1,"scaleY":1,"anchorX":40,"anchorY":14},"isGroup":false,"res":"CLTB_img_1441961362847_11"},{"target":{"name":"cLTB_img_1441961362847_12_1","rotation":0,"x":48.95,"y":106.9,"scaleX":1,"scaleY":1,"anchorX":58.5,"anchorY":37.5},"isGroup":false,"res":"CLTB_img_1441961362847_12"},{"target":{"name":"cLTB_img_1441961362847_13_1","rotation":0,"x":-1.35,"y":102.6,"scaleX":1,"scaleY":1,"anchorX":118,"anchorY":174.5},"isGroup":false,"res":"CLTB_img_1441961362847_13"},{"target":{"name":"cLTB_img_1441961362847_14_1","rotation":0,"x":95.65,"y":227.65,"scaleX":1,"scaleY":1,"anchorX":34,"anchorY":8},"isGroup":false,"res":"CLTB_img_1441961362847_14"},{"target":{"name":"cLTB_img_1441961362847_15_1","rotation":0,"x":130.85,"y":347.7,"scaleX":1,"scaleY":1,"anchorX":233,"anchorY":52},"isGroup":false,"res":"CLTB_img_1441961362847_15"},{"target":{"name":"cLTB_img_1441961362847_16_1","rotation":0,"x":131.5,"y":333.5,"scaleX":1,"scaleY":1,"anchorX":210,"anchorY":49.5},"isGroup":false,"res":"CLTB_img_1441961362847_16"},{"target":{"name":"cLTB_img_1441961362847_17_1","rotation":0,"x":257.85,"y":384.7,"scaleX":1,"scaleY":1,"anchorX":75,"anchorY":34},"isGroup":false,"res":"CLTB_img_1441961362847_17"},{"target":{"name":"cLTB_img_1441961362847_18_1","rotation":0,"x":235.1,"y":153.05,"scaleX":1,"scaleY":1,"anchorX":134.5,"anchorY":41},"isGroup":false,"res":"CLTB_img_1441961362847_18"},{"target":{"name":"cLTB_img_1441961362847_19_1","rotation":0,"x":153.2,"y":191.8,"scaleX":1,"scaleY":1,"anchorX":155,"anchorY":130},"isGroup":false,"res":"CLTB_img_1441961362847_19"},{"target":{"name":"cLTB_img_1441961362847_20_1","rotation":0,"x":158.9,"y":152.1,"scaleX":1,"scaleY":1,"anchorX":189.5,"anchorY":135.5},"isGroup":false,"res":"CLTB_img_1441961362847_20"},{"target":{"name":"cLTB_img_1441961362847_21_1","rotation":0,"x":268.45,"y":320.25,"scaleX":1,"scaleY":1,"anchorX":59,"anchorY":39.5},"isGroup":false,"res":"CLTB_img_1441961362847_21"},{"target":{"name":"cLTB_img_1441961362847_22_1","rotation":0,"x":361.7,"y":129.75,"scaleX":1,"scaleY":1,"anchorX":17.5,"anchorY":6.5},"isGroup":false,"res":"CLTB_img_1441961362847_22"},{"target":{"name":"cLTB_img_1441961362847_23_1","rotation":0,"x":357.15,"y":127.35,"scaleX":1,"scaleY":1,"anchorX":23.5,"anchorY":11.5},"isGroup":false,"res":"CLTB_img_1441961362847_23"},{"target":{"name":"cLTB_img_1441961362847_24_1","rotation":0,"x":424.15,"y":208.85,"scaleX":1,"scaleY":1,"anchorX":23.5,"anchorY":85.5},"isGroup":false,"res":"CLTB_img_1441961362847_24"},{"target":{"name":"cLTB_img_1441961362847_25_1","rotation":0,"x":74.85,"y":78.5,"scaleX":1,"scaleY":1,"anchorX":175.5,"anchorY":90.5},"isGroup":false,"res":"CLTB_img_1441961362847_25"},{"target":{"name":"cLTB_img_1441961362847_26_1","rotation":0,"x":318.25,"y":64.2,"scaleX":1,"scaleY":1,"anchorX":61.5,"anchorY":64.5},"isGroup":false,"res":"CLTB_img_1441961362847_26"},{"target":{"name":"cLTB_img_1441961362847_27_1","rotation":0,"x":236.65,"y":124.75,"scaleX":1,"scaleY":1,"anchorX":112.5,"anchorY":106.5},"isGroup":false,"res":"CLTB_img_1441961362847_27"}]},{"target":{"name":"photo1","rotation":0,"x":114.65,"y":309.15,"scaleX":0.7318267822265625,"scaleY":0.7317047119140625,"anchorX":0,"anchorY":0},"isGroup":true,"children":[{"target":{"name":"cLTB_img_1441961353264_0_1","rotation":0,"x":241.85,"y":249.55,"scaleX":1,"scaleY":1,"anchorX":99.5,"anchorY":55.5},"isGroup":false,"res":"CLTB_img_1441961353264_0"},{"target":{"name":"cLTB_img_1441961353264_1_1","rotation":0,"x":352.1,"y":224.9,"scaleX":1,"scaleY":1,"anchorX":34.5,"anchorY":31},"isGroup":false,"res":"CLTB_img_1441961353264_1"},{"target":{"name":"cLTB_img_1441961353264_2_1","rotation":0,"x":178.75,"y":197.8,"scaleX":1,"scaleY":1,"anchorX":40,"anchorY":43},"isGroup":false,"res":"CLTB_img_1441961353264_2"},{"target":{"name":"cLTB_img_1441961353264_3_1","rotation":0,"x":248.9,"y":307,"scaleX":1,"scaleY":1,"anchorX":91,"anchorY":33.5},"isGroup":false,"res":"CLTB_img_1441961353264_3"},{"target":{"name":"cLTB_img_1441961353264_4_1","rotation":0,"x":58.9,"y":40.65,"scaleX":1,"scaleY":1,"anchorX":288,"anchorY":131},"isGroup":false,"res":"CLTB_img_1441961353264_4"},{"target":{"name":"cLTB_img_1441961353264_5_1","rotation":0,"x":177.8,"y":197.85,"scaleX":1,"scaleY":1,"anchorX":48,"anchorY":61},"isGroup":false,"res":"CLTB_img_1441961353264_5"},{"target":{"name":"cLTB_img_1441961353264_6_1","rotation":0,"x":-1,"y":-1,"scaleX":1,"scaleY":1,"anchorX":342.5,"anchorY":168},"isGroup":false,"res":"CLTB_img_1441961353264_6"},{"target":{"name":"cLTB_img_1441961353264_7_1","rotation":0,"x":153.75,"y":28.45,"scaleX":1,"scaleY":1,"anchorX":175,"anchorY":229},"isGroup":false,"res":"CLTB_img_1441961353264_7"},{"target":{"name":"cLTB_img_1441961353264_8_1","rotation":0,"x":174.15,"y":326.8,"scaleX":1,"scaleY":1,"anchorX":158,"anchorY":80},"isGroup":false,"res":"CLTB_img_1441961353264_8"},{"target":{"name":"cLTB_img_1441961353264_9_1","rotation":0,"x":165.25,"y":89.65,"scaleX":1,"scaleY":1,"anchorX":154.5,"anchorY":118.5},"isGroup":false,"res":"CLTB_img_1441961353264_9"},{"target":{"name":"cLTB_img_1441961353264_10_1","rotation":0,"x":172.2,"y":167.05,"scaleX":1,"scaleY":1,"anchorX":16.5,"anchorY":8.5},"isGroup":false,"res":"CLTB_img_1441961353264_10"}]},{"target":{"name":"ok_btn","rotation":0,"x":631.5,"y":119.1,"scaleX":1,"scaleY":1,"anchorX":0,"anchorY":0},"isGroup":true,"children":[{"target":{"name":"cLTB_img_1440664683720_0_0","rotation":0,"x":-54.5,"y":-50,"scaleX":1,"scaleY":1,"anchorX":54.5,"anchorY":53},"isGroup":false,"res":"CLTB_img_1440664683720_0"}]}]},{"target":{"name":"soundBtn","rotation":0,"x":660,"y":0,"scaleX":1,"scaleY":1,"anchorX":30,"anchorY":29.5},"isGroup":true,"children":[{"target":{"name":"soundOpen_2","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":30,"anchorY":29.5},"isGroup":false,"res":"soundOpen"},{"target":{"name":"soundClose_2","rotation":0,"x":0,"y":0,"scaleX":1,"scaleY":1,"anchorX":30,"anchorY":29.5},"isGroup":false,"res":"soundClose"}]}]]}; 6 | --------------------------------------------------------------------------------