├── .laya └── launch.json ├── README.md ├── bin ├── index.html ├── libs │ ├── LayaRender.js │ ├── bytebuffer.js │ ├── domparserinone.js │ ├── laya.ani.js │ ├── laya.bdmini.js │ ├── laya.core.js │ ├── laya.d3.js │ ├── laya.d3Plugin.js │ ├── laya.debugtool.js │ ├── laya.device.js │ ├── laya.filter.js │ ├── laya.html.js │ ├── laya.particle.js │ ├── laya.pathfinding.js │ ├── laya.tiledmap.js │ ├── laya.ui.js │ ├── laya.webgl.js │ ├── laya.wxmini.js │ ├── matter-RenderLaya.js │ ├── matter.js │ ├── min │ │ ├── laya.ani.min.js │ │ ├── laya.bdmini.min.js │ │ ├── laya.core.min.js │ │ ├── laya.d3.min.js │ │ ├── laya.d3Plugin.min.js │ │ ├── laya.debugtool.min.js │ │ ├── laya.device.min.js │ │ ├── laya.filter.min.js │ │ ├── laya.html.min.js │ │ ├── laya.particle.min.js │ │ ├── laya.pathfinding.min.js │ │ ├── laya.tiledmap.min.js │ │ ├── laya.ui.min.js │ │ ├── laya.webgl.min.js │ │ └── laya.wxmini.min.js │ ├── protobuf.js │ └── worker.js ├── res │ └── atlas │ │ ├── .rec │ │ ├── comp.atlas │ │ └── comp.png └── unpack.json ├── colony.laya ├── jsconfig.json ├── laya ├── .laya ├── assets │ └── comp │ │ ├── bg.png │ │ ├── blank.png │ │ ├── btn_close.png │ │ ├── button.png │ │ ├── checkbox.png │ │ ├── clip_num.png │ │ ├── clip_selectBox.png │ │ ├── clip_tree_arrow.png │ │ ├── clip_tree_folder.png │ │ ├── combobox.png │ │ ├── hscroll$bar.png │ │ ├── hscroll$down.png │ │ ├── hscroll$up.png │ │ ├── hscroll.png │ │ ├── hslider$bar.png │ │ ├── hslider.png │ │ ├── html.png │ │ ├── image.png │ │ ├── label.png │ │ ├── linkbutton.png │ │ ├── progress$bar.png │ │ ├── progress.png │ │ ├── radio.png │ │ ├── radiogroup.png │ │ ├── tab.png │ │ ├── textarea.png │ │ ├── textinput.png │ │ ├── vscroll$bar.png │ │ ├── vscroll$down.png │ │ ├── vscroll$up.png │ │ ├── vscroll.png │ │ ├── vslider$bar.png │ │ └── vslider.png └── pages │ └── MainView.ui ├── libs └── LayaAir.d.ts └── src ├── CRC.js ├── Circle.js ├── GameMain.js ├── MainView.js ├── SteeredVehicle.js ├── Vector2D.js ├── Vehicle.js └── ui └── layaUI.max.all.js /.laya/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | { 5 | "name": "layaAir", 6 | "type": "chrome", 7 | "request": "launch", 8 | "file": "${workspaceRoot}/bin/index.html", 9 | "runtimeExecutable": "${execPath}", 10 | "useBuildInServer": true, 11 | "sourceMaps": true, 12 | "webRoot": "${workspaceRoot}", 13 | "port": 9222, 14 | "fixedPort":false 15 | }, 16 | { 17 | "name": "chrome调试", 18 | "type": "chrome", 19 | "request": "launch", 20 | "file": "${workspaceRoot}/bin/index.html", 21 | // "换成自己的谷歌安装路径,": 比如 22 | //window 默认安装路径为: "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe" 23 | //mac 系统上的默认安装路径为 "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"; 24 | // "runtimeExecutable": "C:/Program Files (x86)/Google/Chrome/Application/chrome.exe", 25 | "runtimeArgs": [ 26 | "--allow-file-access-from-files", 27 | "--allow-file-access-frome-files", 28 | " --disable-web-security" 29 | ], 30 | "sourceMaps": true, 31 | "webRoot": "${workspaceRoot}", 32 | //假如谷歌调试报userDataDir不可用,请把谷歌安装路径取得管理员权限,或者更换${tmpdir}为其他可以读写的文件夹,也可以删除。 33 | "userDataDir": "${workspaceRoot}/.laya/chrome", 34 | "fixedPort":false 35 | } 36 | ] 37 | } -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # layaai 2 | 基于LayaboxJS版的ai跟踪,集群跟随以及散漫移动 3 | -------------------------------------------------------------------------------- /bin/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 集群 7 | 9 | 10 | 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 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /bin/libs/LayaRender.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Matter.js 渲染器在 LayaAir 的实现。 3 | */ 4 | (function() 5 | { 6 | var LayaRender = {}; 7 | 8 | var Common = Matter.Common; 9 | var Composite = Matter.Composite; 10 | var Bounds = Matter.Bounds; 11 | var Events = Matter.Events; 12 | var Grid = Matter.Grid; 13 | var Vector = Matter.Vector; 14 | 15 | /** 16 | * 创建新的渲染器。 17 | * @param {object} options 所有属性都有默认值,options中的属性会覆盖默认属性。 18 | * @return {render} 返回创建的旋绕器 19 | */ 20 | LayaRender.create = function(options) 21 | { 22 | var defaults = { 23 | controller: LayaRender, 24 | engine: null, 25 | element: null, 26 | canvas: null, 27 | mouse: null, 28 | frameRequestId: null, 29 | options: 30 | { 31 | width: 800, 32 | height: 600, 33 | pixelRatio: 1, 34 | background: '#fafafa', 35 | wireframeBackground: '#222222', 36 | hasBounds: !!options.bounds, 37 | enabled: true, 38 | wireframes: true, 39 | showSleeping: true, 40 | showDebug: false, 41 | showBroadphase: false, 42 | showBounds: false, 43 | showVelocity: false, 44 | showCollisions: false, 45 | showSeparations: false, 46 | showAxes: false, 47 | showPositions: false, 48 | showAngleIndicator: false, 49 | showIds: false, 50 | showShadows: false, 51 | showVertexNumbers: false, 52 | showConvexHulls: false, 53 | showInternalEdges: false, 54 | showMousePosition: false 55 | } 56 | }; 57 | var render = Common.extend(defaults, options); 58 | render.mouse = options.mouse; 59 | render.engine = options.engine; 60 | // 如果用户没有指定contaienr,默认使用stage 61 | render.container = render.container || Laya.stage; 62 | render.bounds = render.bounds || 63 | { 64 | min: 65 | { 66 | x: 0, 67 | y: 0 68 | }, 69 | max: 70 | { 71 | x: render.width, 72 | y: render.height 73 | } 74 | }; 75 | 76 | return render; 77 | } 78 | 79 | /** 80 | * 运行渲染器。 81 | * @param {render} render 渲染的目标是LayaRender.create()返回的对象 82 | * @return {void} 83 | */ 84 | LayaRender.run = function(render) 85 | { 86 | Laya.timer.frameLoop(1, this, LayaRender.world, [render]); 87 | Events.on(render.engine.world, 'afterRemove', LayaRender.onRemoveSprite); 88 | }; 89 | 90 | /** 91 | * 停止渲染器。 92 | * @param {render} LayaRender.create()返回的对象 93 | * @return {void} 94 | */ 95 | LayaRender.stop = function(render) 96 | { 97 | Laya.timer.clear(this, LayaRender.world); 98 | Events.off(render.engine.world, 'afterRemove', LayaRender.onRemoveSprite); 99 | } 100 | 101 | LayaRender.onRemoveSprite = function(args) 102 | { 103 | var sprite = args.object.layaSprite; 104 | if (sprite && sprite.parent) 105 | sprite.parent.removeChild(sprite); 106 | } 107 | 108 | /** 109 | * 渲染给定的 engine 的 Matter.World 对象。 110 | * 这是渲染的入口,每次场景改变时都应该被调用。 111 | * @param {render} render 112 | * @return {void} 113 | */ 114 | LayaRender.world = function(render) 115 | { 116 | var engine = render.engine, 117 | world = engine.world, 118 | renderer = render.renderer, 119 | container = render.container, 120 | options = render.options, 121 | bodies = Composite.allBodies(world), 122 | allConstraints = Composite.allConstraints(world), 123 | constraints = [], 124 | i; 125 | 126 | if (options.wireframes) 127 | { 128 | LayaRender.setBackground(render, options.wireframeBackground); 129 | } 130 | else 131 | { 132 | LayaRender.setBackground(render, options.background); 133 | } 134 | 135 | // 处理 bounds 136 | var boundsWidth = render.bounds.max.x - render.bounds.min.x, 137 | boundsHeight = render.bounds.max.y - render.bounds.min.y, 138 | boundsScaleX = boundsWidth / render.options.width, 139 | boundsScaleY = boundsHeight / render.options.height; 140 | 141 | if (options.hasBounds) 142 | { 143 | // 隐藏不在视口内的bodies 144 | for (i = 0; i < bodies.length; i++) 145 | { 146 | var body = bodies[i]; 147 | body.render.sprite.visible = Bounds.overlaps(body.bounds, render.bounds); 148 | } 149 | 150 | // 过滤掉不在视口内的 constraints 151 | for (i = 0; i < allConstraints.length; i++) 152 | { 153 | var constraint = allConstraints[i], 154 | bodyA = constraint.bodyA, 155 | bodyB = constraint.bodyB, 156 | pointAWorld = constraint.pointA, 157 | pointBWorld = constraint.pointB; 158 | 159 | if (bodyA) pointAWorld = Vector.add(bodyA.position, constraint.pointA); 160 | if (bodyB) pointBWorld = Vector.add(bodyB.position, constraint.pointB); 161 | 162 | if (!pointAWorld || !pointBWorld) 163 | continue; 164 | 165 | if (Bounds.contains(render.bounds, pointAWorld) || Bounds.contains(render.bounds, pointBWorld)) 166 | constraints.push(constraint); 167 | } 168 | 169 | // 改变视口 170 | container.scale(1 / boundsScaleX, 1 / boundsScaleY); 171 | container.pos(-render.bounds.min.x * (1 / boundsScaleX), -render.bounds.min.y * (1 / boundsScaleY)); 172 | } 173 | else 174 | { 175 | constraints = allConstraints; 176 | } 177 | 178 | for (i = 0; i < bodies.length; i++) 179 | LayaRender.body(render, bodies[i]); 180 | 181 | for (i = 0; i < constraints.length; i++) 182 | LayaRender.constraint(render, constraints[i]); 183 | }; 184 | 185 | /** 186 | * 设置背景色或者背景图片。 187 | * @param {render} render 188 | * @param {string} background 16进制颜色字符串或者图片路径 189 | */ 190 | LayaRender.setBackground = function(render, background) 191 | { 192 | if (render.currentBackground !== background) 193 | { 194 | var isColor = background.indexOf && background.indexOf('#') !== -1; 195 | 196 | render.container.graphics.clear(); 197 | 198 | if (isColor) 199 | { 200 | // 使用纯色背景 201 | render.container.bgColor = background; 202 | } 203 | else 204 | { 205 | render.container.loadImage(background); 206 | // 使用背景图片时把背景色设置为白色 207 | render.container.bgColor = "#FFFFFF"; 208 | } 209 | 210 | render.currentBackground = background; 211 | } 212 | } 213 | 214 | /** 215 | * 渲染 body 216 | * @param {render} render 217 | * @param {body} body 218 | * @return {void} 219 | */ 220 | LayaRender.body = function(render, body) 221 | { 222 | var engine = render.engine, 223 | bodyRender = body.render; 224 | 225 | if (!bodyRender.visible) 226 | return; 227 | 228 | // 有纹理的body 229 | if (bodyRender.sprite && bodyRender.sprite.texture) 230 | { 231 | var spriteId = 'b-' + body.id, 232 | sprite = body.layaSprite, 233 | container = render.container; 234 | 235 | // 如果sprite不存在,则初始化一个 236 | if (!sprite) 237 | sprite = body.layaSprite = _createBodySprite(render, body); 238 | 239 | // 如果sprite未在显示列表,则添加至显示列表 240 | if (!container.contains(sprite)) 241 | container.addChild(sprite); 242 | 243 | // 更新sprite位置 244 | sprite.x = body.position.x; 245 | sprite.y = body.position.y; 246 | sprite.rotation = body.angle * 180 / Math.PI; 247 | sprite.scaleX = bodyRender.sprite.xScale || 1; 248 | sprite.scaleY = bodyRender.sprite.yScale || 1; 249 | } 250 | else // 没有纹理的body 251 | { 252 | var primitiveId = 'b-' + body.id, 253 | sprite = body.layaSprite, 254 | container = render.container; 255 | 256 | // 如果sprite不存在,则初始化一个 257 | if (!sprite) 258 | { 259 | sprite = body.layaSprite = _createBodyPrimitive(render, body); 260 | sprite.initialAngle = body.angle; 261 | } 262 | 263 | // 如果sprite未在显示列表,则添加至显示列表 264 | if (!container.contains(sprite)) 265 | container.addChild(sprite); 266 | // 更新sprite位置 267 | sprite.x = body.position.x; 268 | sprite.y = body.position.y; 269 | sprite.rotation = (body.angle - sprite.initialAngle) * 180 / Math.PI; 270 | } 271 | }; 272 | 273 | /** 274 | * 创建使用纹理的Sprite对象。 275 | * @param {render} render 276 | * @param {body} body 277 | * @return {void} 278 | */ 279 | var _createBodySprite = function(render, body) 280 | { 281 | var bodyRender = body.render, 282 | texturePath = bodyRender.sprite.texture, 283 | sprite = new Laya.Sprite(); 284 | 285 | sprite.loadImage(texturePath); 286 | sprite.pivotX = body.render.sprite.xOffset; 287 | sprite.pivotY = body.render.sprite.yOffset; 288 | 289 | return sprite; 290 | }; 291 | 292 | /** 293 | * 创建使用矢量绘图的Sprite对象。 294 | * @param {render} render 295 | * @param {body} body 296 | * @return {void} 297 | */ 298 | var _createBodyPrimitive = function(render, body) 299 | { 300 | var bodyRender = body.render, 301 | options = render.options, 302 | sprite = new Laya.Sprite(), 303 | fillStyle, strokeStyle, lineWidth, 304 | part, points = []; 305 | 306 | var primitive = sprite.graphics; 307 | primitive.clear(); 308 | 309 | // 处理 compound parts 310 | for (var k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++) 311 | { 312 | part = body.parts[k]; 313 | 314 | if (!options.wireframes) 315 | { 316 | fillStyle = bodyRender.fillStyle; 317 | strokeStyle = bodyRender.strokeStyle; 318 | lineWidth = bodyRender.lineWidth; 319 | } 320 | else 321 | { 322 | fillStyle = null; 323 | strokeStyle = '#bbbbbb'; 324 | lineWidth = 1; 325 | } 326 | 327 | points.push(part.vertices[0].x - body.position.x, part.vertices[0].y - body.position.y); 328 | 329 | for (var j = 1; j < part.vertices.length; j++) 330 | { 331 | points.push(part.vertices[j].x - body.position.x, part.vertices[j].y - body.position.y); 332 | } 333 | 334 | points.push(part.vertices[0].x - body.position.x, part.vertices[0].y - body.position.y); 335 | 336 | primitive.drawPoly(0, 0, points, fillStyle, strokeStyle, lineWidth); 337 | 338 | // 角度指示器 339 | if (options.showAngleIndicator || options.showAxes) 340 | { 341 | lineWidth = 1; 342 | if (options.wireframes) 343 | { 344 | strokeStyle = '#CD5C5C'; 345 | } 346 | else 347 | { 348 | strokeStyle = bodyRender.strokeStyle; 349 | } 350 | 351 | primitive.drawLine(part.position.x - body.position.x, part.position.y - body.position.y, 352 | ((part.vertices[0].x + part.vertices[part.vertices.length - 1].x) / 2 - body.position.x), 353 | ((part.vertices[0].y + part.vertices[part.vertices.length - 1].y) / 2 - body.position.y)); 354 | } 355 | } 356 | 357 | return sprite; 358 | }; 359 | 360 | /** 361 | * 绘制 constraint。 362 | * @param {render} render 363 | * @param {constraint} constraint 364 | * @return {void} 365 | */ 366 | LayaRender.constraint = function(render, constraint) 367 | { 368 | var engine = render.engine, 369 | bodyA = constraint.bodyA, 370 | bodyB = constraint.bodyB, 371 | pointA = constraint.pointA, 372 | pointB = constraint.pointB, 373 | container = render.container, 374 | constraintRender = constraint.render, 375 | primitiveId = 'c-' + constraint.id, 376 | sprite = constraint.layaSprite; 377 | 378 | // 如果sprite不存在,则初始化一个 379 | if (!sprite) 380 | sprite = constraint.layaSprite = new Laya.Sprite(); 381 | 382 | var primitive = sprite.graphics; 383 | 384 | // constraint 没有两个终点时不渲染 385 | if (!constraintRender.visible || !constraint.pointA || !constraint.pointB) 386 | { 387 | primitive.clear(); 388 | return; 389 | } 390 | 391 | // 如果sprite未在显示列表,则添加至显示列表 392 | if (!container.contains(sprite)) 393 | container.addChild(sprite); 394 | 395 | // 渲染 constraint 396 | primitive.clear(); 397 | 398 | var fromX, fromY, toX, toY; 399 | if (bodyA) 400 | { 401 | fromX = bodyA.position.x + pointA.x; 402 | fromY = bodyA.position.y + pointA.y; 403 | } 404 | else 405 | { 406 | fromX = pointA.x; 407 | fromY = pointA.y; 408 | } 409 | 410 | if (bodyB) 411 | { 412 | toX = bodyB.position.x + pointB.x; 413 | toY = bodyB.position.y + pointB.y; 414 | } 415 | else 416 | { 417 | toX = pointB.x; 418 | toY = pointB.y; 419 | } 420 | 421 | primitive.drawLine(fromX, fromY, toX, toY, constraintRender.strokeStyle, constraintRender.lineWidth); 422 | }; 423 | 424 | window.LayaRender = LayaRender; 425 | })(); -------------------------------------------------------------------------------- /bin/libs/laya.d3Plugin.js: -------------------------------------------------------------------------------- 1 | 2 | (function(window,document,Laya){ 3 | var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec; 4 | 5 | var Component3D=laya.d3.component.Component3D,ComponentNode=laya.d3.core.ComponentNode,MeshTerrainSprite3D=laya.d3.core.MeshTerrainSprite3D; 6 | var Sprite3D=laya.d3.core.Sprite3D; 7 | /** 8 | *PathFinding 类用于创建寻路。 9 | */ 10 | //class laya.d3.component.PathFind extends laya.d3.component.Component3D 11 | var PathFind=(function(_super){ 12 | function PathFind(){ 13 | /**@private */ 14 | this._meshTerrainSprite3D=null; 15 | /**@private */ 16 | this._finder=null; 17 | /**@private */ 18 | this._setting=null; 19 | /**寻路网格。*/ 20 | this.grid=null; 21 | PathFind.__super.call(this); 22 | } 23 | 24 | __class(PathFind,'laya.d3.component.PathFind',_super); 25 | var __proto=PathFind.prototype; 26 | /** 27 | *@private 28 | *初始化载入蒙皮动画组件。 29 | *@param owner 所属精灵对象。 30 | */ 31 | __proto._load=function(owner){ 32 | if (! (owner instanceof laya.d3.core.MeshTerrainSprite3D )) 33 | throw new Error("PathFinding: The owner must MeshTerrainSprite3D!"); 34 | _super.prototype._load.call(this,owner); 35 | this._meshTerrainSprite3D=owner; 36 | } 37 | 38 | /** 39 | *寻找路径。 40 | *@param startX 开始X。 41 | *@param startZ 开始Z。 42 | *@param endX 结束X。 43 | *@param endZ 结束Z。 44 | *@return 路径。 45 | */ 46 | __proto.findPath=function(startX,startZ,endX,endZ){ 47 | var minX=this._meshTerrainSprite3D.minX; 48 | var minZ=this._meshTerrainSprite3D.minZ; 49 | var cellX=this._meshTerrainSprite3D.width / this.grid.width; 50 | var cellZ=this._meshTerrainSprite3D.depth / this.grid.height; 51 | var halfCellX=cellX / 2; 52 | var halfCellZ=cellZ / 2; 53 | var gridStartX=Math.floor((startX-minX)/ cellX); 54 | var gridStartZ=Math.floor((startZ-minZ)/ cellZ); 55 | var gridEndX=Math.floor((endX-minX)/ cellX); 56 | var gridEndZ=Math.floor((endZ-minZ)/ cellZ); 57 | var boundWidth=this.grid.width-1; 58 | var boundHeight=this.grid.height-1; 59 | (gridStartX > boundWidth)&& (gridStartX=boundWidth); 60 | (gridStartZ > boundHeight)&& (gridStartZ=boundHeight); 61 | (gridStartX < 0)&& (gridStartX=0); 62 | (gridStartZ < 0)&& (gridStartZ=0); 63 | (gridEndX > boundWidth)&& (gridEndX=boundWidth); 64 | (gridEndZ > boundHeight)&& (gridEndZ=boundHeight); 65 | (gridEndX < 0)&& (gridEndX=0); 66 | (gridEndZ < 0)&& (gridEndZ=0); 67 | var path=this._finder.findPath(gridStartX,gridStartZ,gridEndX,gridEndZ,this.grid); 68 | this.grid.reset(); 69 | for (var i=1;i < path.length-1;i++){ 70 | var gridPos=path[i]; 71 | gridPos[0]=gridPos[0] *cellX+halfCellX+minX; 72 | gridPos[1]=gridPos[1] *cellZ+halfCellZ+minZ; 73 | } 74 | if (path.length==1){ 75 | path[0][0]=endX; 76 | path[0][1]=endX; 77 | }else if (path.length > 1){ 78 | path[0][0]=startX; 79 | path[0][1]=startZ; 80 | path[path.length-1][0]=endX; 81 | path[path.length-1][1]=endZ; 82 | } 83 | return path; 84 | } 85 | 86 | /** 87 | *设置寻路设置。 88 | *@param value 寻路设置。 89 | */ 90 | /** 91 | *获取寻路设置。 92 | *@return 寻路设置。 93 | */ 94 | __getset(0,__proto,'setting',function(){ 95 | return this._setting; 96 | },function(value){ 97 | (value)&& (this._finder=new PathFinding.finders.AStarFinder(value)); 98 | this._setting=value; 99 | }); 100 | 101 | return PathFind; 102 | })(Component3D) 103 | 104 | 105 | 106 | })(window,document,Laya); 107 | 108 | if (typeof define === 'function' && define.amd){ 109 | define('laya.core', ['require', "exports"], function(require, exports) { 110 | 'use strict'; 111 | Object.defineProperty(exports, '__esModule', { value: true }); 112 | for (var i in Laya) { 113 | var o = Laya[i]; 114 | o && o.__isclass && (exports[i] = o); 115 | } 116 | }); 117 | } -------------------------------------------------------------------------------- /bin/libs/laya.filter.js: -------------------------------------------------------------------------------- 1 | 2 | (function(window,document,Laya){ 3 | var __un=Laya.un,__uns=Laya.uns,__static=Laya.static,__class=Laya.class,__getset=Laya.getset,__newvec=Laya.__newvec; 4 | 5 | var Browser=laya.utils.Browser,Color=laya.utils.Color,ColorFilterAction=laya.filters.ColorFilterAction; 6 | var ColorFilterActionGL=laya.filters.webgl.ColorFilterActionGL,Filter=laya.filters.Filter,FilterActionGL=laya.filters.webgl.FilterActionGL; 7 | var Matrix=laya.maths.Matrix,Rectangle=laya.maths.Rectangle,Render=laya.renders.Render,RenderContext=laya.renders.RenderContext; 8 | var RenderTarget2D=laya.webgl.resource.RenderTarget2D,RunDriver=laya.utils.RunDriver,ShaderDefines2D=laya.webgl.shader.d2.ShaderDefines2D; 9 | var Sprite=laya.display.Sprite,Texture=laya.resource.Texture,Value2D=laya.webgl.shader.d2.value.Value2D; 10 | /** 11 | *默认的FILTER,什么都不做 12 | *@private 13 | */ 14 | //class laya.filters.FilterAction 15 | var FilterAction=(function(){ 16 | function FilterAction(){ 17 | this.data=null; 18 | } 19 | 20 | __class(FilterAction,'laya.filters.FilterAction'); 21 | var __proto=FilterAction.prototype; 22 | Laya.imps(__proto,{"laya.filters.IFilterAction":true}) 23 | __proto.apply=function(data){ 24 | return null; 25 | } 26 | 27 | return FilterAction; 28 | })() 29 | 30 | 31 | /** 32 | *@private 33 | */ 34 | //class laya.filters.WebGLFilter 35 | var WebGLFilter=(function(){ 36 | function WebGLFilter(){} 37 | __class(WebGLFilter,'laya.filters.WebGLFilter'); 38 | WebGLFilter.enable=function(){ 39 | if (WebGLFilter.isInit)return; 40 | WebGLFilter.isInit=true; 41 | if (!Render.isWebGL)return; 42 | RunDriver.createFilterAction=function (type){ 43 | var action; 44 | switch (type){ 45 | case /*laya.filters.Filter.COLOR*/0x20: 46 | action=new ColorFilterActionGL(); 47 | break ; 48 | case /*laya.filters.Filter.BLUR*/0x10: 49 | action=new BlurFilterActionGL(); 50 | break ; 51 | case /*laya.filters.Filter.GLOW*/0x08: 52 | action=new GlowFilterActionGL(); 53 | break ; 54 | } 55 | return action; 56 | } 57 | } 58 | 59 | WebGLFilter.isInit=false; 60 | WebGLFilter.__init$=function(){ 61 | BlurFilterActionGL; 62 | ColorFilterActionGL; 63 | GlowFilterActionGL; 64 | Render; 65 | RunDriver;{ 66 | RunDriver.createFilterAction=function (type){ 67 | var action; 68 | switch (type){ 69 | case /*laya.filters.Filter.BLUR*/0x10: 70 | action=new FilterAction(); 71 | break ; 72 | case /*laya.filters.Filter.GLOW*/0x08: 73 | action=new FilterAction(); 74 | break ; 75 | case /*laya.filters.Filter.COLOR*/0x20: 76 | action=new ColorFilterAction(); 77 | break ; 78 | } 79 | return action; 80 | } 81 | } 82 | } 83 | 84 | return WebGLFilter; 85 | })() 86 | 87 | 88 | /** 89 | *模糊滤镜 90 | */ 91 | //class laya.filters.BlurFilter extends laya.filters.Filter 92 | var BlurFilter=(function(_super){ 93 | function BlurFilter(strength){ 94 | /**模糊滤镜的强度(值越大,越不清晰 */ 95 | this.strength=NaN; 96 | this.strength_sig2_2sig2_gauss1=[]; 97 | BlurFilter.__super.call(this); 98 | (strength===void 0)&& (strength=4); 99 | if (Render.isWebGL)WebGLFilter.enable(); 100 | this.strength=strength; 101 | this._action=RunDriver.createFilterAction(0x10); 102 | this._action.data=this; 103 | } 104 | 105 | __class(BlurFilter,'laya.filters.BlurFilter',_super); 106 | var __proto=BlurFilter.prototype; 107 | /** 108 | *@private 通知微端 109 | */ 110 | __proto.callNative=function(sp){ 111 | sp.conchModel &&sp.conchModel.blurFilter&&sp.conchModel.blurFilter(this.strength); 112 | } 113 | 114 | /** 115 | *@private 116 | *当前滤镜对应的操作器 117 | */ 118 | __getset(0,__proto,'action',function(){ 119 | return this._action; 120 | }); 121 | 122 | /** 123 | *@private 124 | *当前滤镜的类型 125 | */ 126 | __getset(0,__proto,'type',function(){ 127 | return 0x10; 128 | }); 129 | 130 | return BlurFilter; 131 | })(Filter) 132 | 133 | 134 | /** 135 | *发光滤镜(也可以当成阴影滤使用) 136 | */ 137 | //class laya.filters.GlowFilter extends laya.filters.Filter 138 | var GlowFilter=(function(_super){ 139 | function GlowFilter(color,blur,offX,offY){ 140 | /**滤镜的颜色*/ 141 | this._color=null; 142 | GlowFilter.__super.call(this); 143 | this._elements=new Float32Array(9); 144 | (blur===void 0)&& (blur=4); 145 | (offX===void 0)&& (offX=6); 146 | (offY===void 0)&& (offY=6); 147 | if (Render.isWebGL){ 148 | WebGLFilter.enable(); 149 | } 150 | this._color=new Color(color); 151 | this.blur=Math.min(blur,20); 152 | this.offX=offX; 153 | this.offY=offY; 154 | this._action=RunDriver.createFilterAction(0x08); 155 | this._action.data=this; 156 | } 157 | 158 | __class(GlowFilter,'laya.filters.GlowFilter',_super); 159 | var __proto=GlowFilter.prototype; 160 | /**@private */ 161 | __proto.getColor=function(){ 162 | return this._color._color; 163 | } 164 | 165 | /** 166 | *@private 通知微端 167 | */ 168 | __proto.callNative=function(sp){ 169 | sp.conchModel &&sp.conchModel.glowFilter&&sp.conchModel.glowFilter(this._color.strColor,this._elements[4],this._elements[5],this._elements[6]); 170 | } 171 | 172 | /** 173 | *@private 174 | *滤镜类型 175 | */ 176 | __getset(0,__proto,'type',function(){ 177 | return 0x08; 178 | }); 179 | 180 | /**@private */ 181 | __getset(0,__proto,'action',function(){ 182 | return this._action; 183 | }); 184 | 185 | /**@private */ 186 | /**@private */ 187 | __getset(0,__proto,'offY',function(){ 188 | return this._elements[6]; 189 | },function(value){ 190 | this._elements[6]=value; 191 | }); 192 | 193 | /**@private */ 194 | /**@private */ 195 | __getset(0,__proto,'offX',function(){ 196 | return this._elements[5]; 197 | },function(value){ 198 | this._elements[5]=value; 199 | }); 200 | 201 | /**@private */ 202 | /**@private */ 203 | __getset(0,__proto,'blur',function(){ 204 | return this._elements[4]; 205 | },function(value){ 206 | this._elements[4]=value; 207 | }); 208 | 209 | return GlowFilter; 210 | })(Filter) 211 | 212 | 213 | /** 214 | *@private 215 | */ 216 | //class laya.filters.webgl.BlurFilterActionGL extends laya.filters.webgl.FilterActionGL 217 | var BlurFilterActionGL=(function(_super){ 218 | function BlurFilterActionGL(){ 219 | this.data=null; 220 | BlurFilterActionGL.__super.call(this); 221 | } 222 | 223 | __class(BlurFilterActionGL,'laya.filters.webgl.BlurFilterActionGL',_super); 224 | var __proto=BlurFilterActionGL.prototype; 225 | __proto.setValueMix=function(shader){ 226 | shader.defines.add(this.data.type); 227 | var o=shader; 228 | } 229 | 230 | __proto.apply3d=function(scope,sprite,context,x,y){ 231 | var b=scope.getValue("bounds"); 232 | var shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0); 233 | shaderValue.setFilters([this.data]); 234 | var tMatrix=Matrix.EMPTY; 235 | tMatrix.identity(); 236 | context.ctx.drawTarget(scope,0,0,b.width,b.height,Matrix.EMPTY,"src",shaderValue); 237 | shaderValue.setFilters(null); 238 | } 239 | 240 | __proto.setValue=function(shader){ 241 | shader.strength=this.data.strength; 242 | var sigma=this.data.strength/3.0; 243 | var sigma2=sigma*sigma; 244 | this.data.strength_sig2_2sig2_gauss1[0]=this.data.strength; 245 | this.data.strength_sig2_2sig2_gauss1[1]=sigma2; 246 | this.data.strength_sig2_2sig2_gauss1[2]=2.0*sigma2; 247 | this.data.strength_sig2_2sig2_gauss1[3]=1.0/(2.0*Math.PI*sigma2); 248 | shader.strength_sig2_2sig2_gauss1=this.data.strength_sig2_2sig2_gauss1; 249 | } 250 | 251 | __getset(0,__proto,'typeMix',function(){return /*laya.filters.Filter.BLUR*/0x10;}); 252 | return BlurFilterActionGL; 253 | })(FilterActionGL) 254 | 255 | 256 | /** 257 | *@private 258 | */ 259 | //class laya.filters.webgl.GlowFilterActionGL extends laya.filters.webgl.FilterActionGL 260 | var GlowFilterActionGL=(function(_super){ 261 | function GlowFilterActionGL(){ 262 | this.data=null; 263 | this._initKey=false; 264 | this._textureWidth=0; 265 | this._textureHeight=0; 266 | GlowFilterActionGL.__super.call(this); 267 | } 268 | 269 | __class(GlowFilterActionGL,'laya.filters.webgl.GlowFilterActionGL',_super); 270 | var __proto=GlowFilterActionGL.prototype; 271 | Laya.imps(__proto,{"laya.filters.IFilterActionGL":true}) 272 | __proto.setValueMix=function(shader){} 273 | __proto.apply3d=function(scope,sprite,context,x,y){ 274 | var b=scope.getValue("bounds"); 275 | scope.addValue("color",this.data.getColor()); 276 | var w=b.width,h=b.height; 277 | this._textureWidth=w; 278 | this._textureHeight=h; 279 | var shaderValue; 280 | var mat=Matrix.TEMP; 281 | mat.identity(); 282 | shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0); 283 | shaderValue.setFilters([this.data]); 284 | context.ctx.drawTarget(scope,0,0,this._textureWidth,this._textureHeight,mat,"src",shaderValue,null); 285 | shaderValue=Value2D.create(/*laya.webgl.shader.d2.ShaderDefines2D.TEXTURE2D*/0x01,0); 286 | context.ctx.drawTarget(scope,0,0,this._textureWidth,this._textureHeight,mat,"src",shaderValue); 287 | return null; 288 | } 289 | 290 | __proto.setSpriteWH=function(sprite){ 291 | this._textureWidth=sprite.width; 292 | this._textureHeight=sprite.height; 293 | } 294 | 295 | __proto.setValue=function(shader){ 296 | shader.u_offsetX=this.data.offX; 297 | shader.u_offsetY=-this.data.offY; 298 | shader.u_strength=1.0; 299 | shader.u_blurX=this.data.blur; 300 | shader.u_blurY=this.data.blur; 301 | shader.u_textW=this._textureWidth; 302 | shader.u_textH=this._textureHeight; 303 | shader.u_color=this.data.getColor(); 304 | } 305 | 306 | __getset(0,__proto,'typeMix',function(){return /*laya.filters.Filter.GLOW*/0x08;}); 307 | GlowFilterActionGL.tmpTarget=function(scope,sprite,context,x,y){ 308 | var b=scope.getValue("bounds"); 309 | var out=scope.getValue("out"); 310 | out.end(); 311 | var tmpTarget=RenderTarget2D.create(b.width,b.height); 312 | tmpTarget.start(); 313 | var color=scope.getValue("color"); 314 | if (color){ 315 | tmpTarget.clear(color[0],color[1],color[2],0); 316 | } 317 | scope.addValue("tmpTarget",tmpTarget); 318 | } 319 | 320 | GlowFilterActionGL.startOut=function(scope,sprite,context,x,y){ 321 | var tmpTarget=scope.getValue("tmpTarget"); 322 | tmpTarget.end(); 323 | var out=scope.getValue("out"); 324 | out.start(); 325 | var color=scope.getValue("color"); 326 | if (color){ 327 | out.clear(color[0],color[1],color[2],0); 328 | } 329 | } 330 | 331 | GlowFilterActionGL.recycleTarget=function(scope,sprite,context,x,y){ 332 | var src=scope.getValue("src"); 333 | var tmpTarget=scope.getValue("tmpTarget"); 334 | tmpTarget.recycle(); 335 | } 336 | 337 | return GlowFilterActionGL; 338 | })(FilterActionGL) 339 | 340 | 341 | Laya.__init([WebGLFilter]); 342 | })(window,document,Laya); 343 | 344 | if (typeof define === 'function' && define.amd){ 345 | define('laya.core', ['require', "exports"], function(require, exports) { 346 | 'use strict'; 347 | Object.defineProperty(exports, '__esModule', { value: true }); 348 | for (var i in Laya) { 349 | var o = Laya[i]; 350 | o && o.__isclass && (exports[i] = o); 351 | } 352 | }); 353 | } -------------------------------------------------------------------------------- /bin/libs/matter-RenderLaya.js: -------------------------------------------------------------------------------- 1 | var Browser = laya.utils.Browser; 2 | 3 | var Composite = Matter.Composite; 4 | var Events = Matter.Events; 5 | var Bounds = Matter.Bounds; 6 | var Common = Matter.Common; 7 | var Vertices = Matter.Vertices; 8 | var Vector = Matter.Vector; 9 | var Sleeping = Matter.Sleeping; 10 | var Axes = Matter.Axes; 11 | var Body = Matter.Body; 12 | var SAT = Matter.SAT; 13 | var Contact = Matter.Contact; 14 | var Pair = Matter.Pair; 15 | var Detector = Matter.Detector; 16 | var Grid = Matter.Grid; 17 | 18 | var LayaRender = {}; 19 | 20 | (function() 21 | { 22 | var graphics, 23 | spriteCon, 24 | graphicsCon; 25 | 26 | LayaRender.create = function(options) 27 | { 28 | var defaults = { 29 | controller: LayaRender, 30 | element: null, 31 | canvas: null, 32 | mouse: null, 33 | options: 34 | { 35 | width: 800, 36 | height: 600, 37 | pixelRatio: 1, 38 | background: '#fafafa', 39 | wireframeBackground: '#222', 40 | hasBounds: !!options.bounds, 41 | enabled: true, 42 | wireframes: true, 43 | showSleeping: true, 44 | showDebug: false, 45 | showBroadphase: false, 46 | showBounds: false, 47 | showVelocity: false, 48 | showCollisions: false, 49 | showSeparations: false, 50 | showAxes: false, 51 | showPositions: false, 52 | showAngleIndicator: false, 53 | showIds: false, 54 | showShadows: false, 55 | showVertexNumbers: false, 56 | showConvexHulls: false, 57 | showInternalEdges: false, 58 | showMousePosition: false 59 | } 60 | }; 61 | 62 | var render = Common.extend(defaults, options); 63 | 64 | render.canvas = laya.renders.Render.canvas; 65 | render.context = laya.renders.Render.context.ctx; 66 | 67 | render.textures = {}; 68 | 69 | render.bounds = render.bounds || 70 | { 71 | min: 72 | { 73 | x: 0, 74 | y: 0 75 | }, 76 | max: 77 | { 78 | x: Laya.stage.width, 79 | y: Laya.stage.height 80 | } 81 | }; 82 | 83 | createContainer(render); 84 | setBackground(render); 85 | setPixelRatio(); 86 | 87 | return render; 88 | }; 89 | 90 | function createContainer(render) 91 | { 92 | var con = render.container; 93 | 94 | spriteCon = new Laya.Sprite(); 95 | graphicsCon = new Laya.Sprite(); 96 | 97 | render.spriteContainer = spriteCon; 98 | render.graphicsContainer = graphicsCon; 99 | 100 | con.addChild(spriteCon); 101 | con.addChild(graphicsCon); 102 | 103 | graphics = graphicsCon.graphics; 104 | } 105 | 106 | // 设置背景 107 | function setBackground(render) 108 | { 109 | var bg = render.options.background; 110 | // 纯色背景 111 | if (bg.length == 7 && bg[0] == '#') 112 | { 113 | spriteCon.graphics.drawRect( 114 | 0, 0, 115 | render.options.width, render.options.height, 116 | bg); 117 | } 118 | // 图片背景 119 | else 120 | { 121 | spriteCon.loadImage(bg); 122 | } 123 | } 124 | 125 | function setPixelRatio() 126 | { 127 | var pixelRatio; 128 | pixelRatio = 1; 129 | Laya.Render.canvas.setAttribute('data-pixel-ratio', pixelRatio); 130 | } 131 | 132 | /** 133 | * Renders the given `engine`'s `Matter.World` object. 134 | * This is the entry point for all rendering and should be called every time the scene changes. 135 | * @method world 136 | * @param {engine} engine 137 | */ 138 | LayaRender.world = function(engine) 139 | { 140 | var render = engine.render, 141 | world = engine.world, 142 | options = render.options, 143 | allConstraints = Composite.allConstraints(world), 144 | bodies = Composite.allBodies(world), 145 | constraints = [], 146 | i; 147 | 148 | // handle bounds 149 | if (options.hasBounds) 150 | { 151 | var boundsWidth = render.bounds.max.x - render.bounds.min.x, 152 | boundsHeight = render.bounds.max.y - render.bounds.min.y, 153 | boundsScaleX = boundsWidth / options.width, 154 | boundsScaleY = boundsHeight / options.height; 155 | 156 | // filter out bodies that are not in view 157 | for (i = 0; i < bodies.length; i++) 158 | { 159 | var body = bodies[i]; 160 | body.render.sprite.visible = Bounds.overlaps(body.bounds, render.bounds); 161 | } 162 | 163 | // filter out constraints that are not in view 164 | for (i = 0; i < allConstraints.length; i++) 165 | { 166 | var constraint = allConstraints[i], 167 | bodyA = constraint.bodyA, 168 | bodyB = constraint.bodyB, 169 | pointAWorld = constraint.pointA, 170 | pointBWorld = constraint.pointB; 171 | 172 | if (bodyA) pointAWorld = Vector.add(bodyA.position, constraint.pointA); 173 | if (bodyB) pointBWorld = Vector.add(bodyB.position, constraint.pointB); 174 | 175 | if (!pointAWorld || !pointBWorld) 176 | continue; 177 | 178 | if (Bounds.contains(render.bounds, pointAWorld) || Bounds.contains(render.bounds, pointBWorld)) 179 | constraints.push(constraint); 180 | } 181 | 182 | // transform the view 183 | // context.scale(1 / boundsScaleX, 1 / boundsScaleY); 184 | // context.translate(-render.bounds.min.x, -render.bounds.min.y); 185 | } 186 | else 187 | { 188 | constraints = allConstraints; 189 | } 190 | 191 | graphics.clear(); 192 | for (i = 0; i < bodies.length; i++) 193 | LayaRender.body(engine, bodies[i]); 194 | 195 | for (i = 0; i < constraints.length; i++) 196 | LayaRender.constraint(engine, constraints[i]); 197 | }; 198 | LayaRender.body = function(engine, body) 199 | { 200 | var render = engine.render, 201 | bodyRender = body.render; 202 | 203 | if (!bodyRender.visible) 204 | { 205 | return; 206 | } 207 | 208 | var spInfo = bodyRender.sprite; 209 | var sp = body.sprite; 210 | if (bodyRender.sprite && bodyRender.sprite.texture) 211 | { 212 | // initialize body sprite if not existing 213 | if (!sp) 214 | { 215 | sp = body.sprite = createBodySprite(spInfo.xOffset, spInfo.yOffset); 216 | sp.loadImage(spInfo.texture); 217 | } 218 | 219 | sp.scale(spInfo.xScale, spInfo.yScale); 220 | sp.pos(body.position.x, body.position.y); 221 | sp.rotation = body.angle * 180 / Math.PI; 222 | } 223 | else 224 | { 225 | var options = render.options; 226 | // handle compound parts 227 | for (k = body.parts.length > 1 ? 1 : 0; k < body.parts.length; k++) 228 | { 229 | part = body.parts[k]; 230 | 231 | if (!part.render.visible) 232 | continue; 233 | 234 | var fillStyle = options.wireframes ? null : part.render.fillStyle; 235 | var lineWidth = part.render.lineWidth; 236 | var strokeStyle = part.render.strokeStyle; 237 | // part polygon 238 | if (part.circleRadius) 239 | { 240 | graphics.drawCircle(part.position.x, part.position.y, part.circleRadius, fillStyle, strokeStyle, lineWidth); 241 | } 242 | else 243 | { 244 | var path = []; 245 | path.push(part.vertices[0].x, part.vertices[0].y); 246 | 247 | for (var j = 1; j < part.vertices.length; j++) 248 | { 249 | if (!part.vertices[j - 1].isInternal || showInternalEdges) 250 | { 251 | path.push(part.vertices[j].x, part.vertices[j].y); 252 | } 253 | else 254 | { 255 | path.push(part.vertices[j].x, part.vertices[j].y); 256 | } 257 | 258 | if (part.vertices[j].isInternal && !showInternalEdges) 259 | { 260 | path.push(part.vertices[(j + 1) % part.vertices.length].x, part.vertices[(j + 1) % part.vertices.length].y); 261 | } 262 | } 263 | 264 | graphics.drawPoly(0, 0, path, fillStyle, strokeStyle, lineWidth); 265 | } 266 | } 267 | } 268 | }; 269 | 270 | LayaRender.constraint = function(engine, constraint) 271 | { 272 | var sx, sy, ex, ey; 273 | if (!constraint.render.visible || !constraint.pointA || !constraint.pointB) 274 | { 275 | return; 276 | } 277 | 278 | var bodyA = constraint.bodyA, 279 | bodyB = constraint.bodyB; 280 | 281 | if (bodyA) 282 | { 283 | sx = bodyA.position.x + constraint.pointA.x; 284 | sy = bodyA.position.y + constraint.pointA.y; 285 | } 286 | else 287 | { 288 | sx = constraint.pointA.x; 289 | sy = constraint.pointA.y; 290 | } 291 | 292 | if (bodyB) 293 | { 294 | ex = bodyB.position.x + constraint.pointB.x; 295 | ey = bodyB.position.y + constraint.pointB.y; 296 | } 297 | else 298 | { 299 | ex = constraint.pointB.x; 300 | ey = constraint.pointB.y; 301 | } 302 | 303 | graphics.drawLine( 304 | sx, sy, ex, ey, 305 | constraint.render.strokeStyle, 306 | constraint.render.lineWidth); 307 | }; 308 | 309 | function createBodySprite(xOffset, yOffset) 310 | { 311 | var sp = new Laya.Sprite(); 312 | 313 | sp.pivot(xOffset, yOffset); 314 | sp.pos(-9999, -9999); 315 | spriteCon.addChild(sp); 316 | 317 | return sp; 318 | } 319 | })(); -------------------------------------------------------------------------------- /bin/libs/min/laya.bdmini.min.js: -------------------------------------------------------------------------------- 1 | !function(t,i,a){a.un,a.uns;var e=a.static,r=a.class,o=a.getset,c=(a.__newvec,laya.utils.Browser),n=(laya.events.Event,laya.events.EventDispatcher),d=laya.resource.HTMLImage,f=laya.utils.Handler,l=laya.display.Input,h=laya.net.Loader,s=laya.net.LocalStorage,p=(laya.maths.Matrix,laya.wx.mini.MiniAdpter),u=laya.renders.Render,v=laya.utils.RunDriver,m=laya.media.SoundChannel,g=laya.media.SoundManager,_=laya.net.URL,y=laya.utils.Utils,w=function(){function u(){}return r(u,"laya.bd.mini.BMiniAdapter"),u.getJson=function(i){return JSON.parse(i)},u.init=function(i,e){if(void 0===i&&(i=!1),void 0===e&&(e=!1),!(u._inited||(u._inited=!0,(u.window=t).navigator.userAgent.indexOf("SwanGame")<0))){u.isZiYu=e,u.isPosMsgYu=i,u.EnvConfig={};try{laya.webgl.resource.WebGLCanvas.premulAlpha=!0}catch(i){}u.isZiYu||(C.setNativeFileDir("/layaairGame"),C.existDir(C.fileNativeDir,f.create(u,u.onMkdirCallBack))),u.systemInfo=swan.getSystemInfoSync(),u.window.focus=function(){},a._getUrlPath=function(){},u.window.logtime=function(i){},u.window.alertTimeLog=function(i){},u.window.resetShareInfo=function(){},u.window.CanvasRenderingContext2D=function(){},u.window.CanvasRenderingContext2D.prototype=u.window.swan.createCanvas().getContext("2d").__proto__,u.window.document.body.appendChild=function(){},u.EnvConfig.pixelRatioInt=0,v.getPixelRatio=u.pixelRatio,u._preCreateElement=c.createElement,c.createElement=u.createElement,v.createShaderCondition=u.createShaderCondition,y.parseXMLFromString=u.parseXMLFromString,l._createInputElement=x._createInputElement,u.EnvConfig.load=h.prototype.load,h.prototype.load=S.prototype.load,h.prototype._loadImage=F.prototype._loadImage,L.__init__(),s._baseClass=L}},u.getUrlEncode=function(i,e){return-1!=i.indexOf(".fnt")?"utf8":"arraybuffer"==e?"":"ascii"},u.downLoadFile=function(i,e,n,t){void 0===e&&(e=""),void 0===t&&(t="ascii"),C.getFileInfo(i)?null!=n&&n.runWith([0]):C.downLoadFile(i,e,n,t)},u.remove=function(i,e){C.deleteFile("",i,e,"",0)},u.removeAll=function(){C.deleteAll()},u.hasNativeFile=function(i){return C.isLocalNativeFile(i)},u.getFileInfo=function(i){return C.getFileInfo(i)},u.getFileList=function(){return C.filesListObj},u.exitMiniProgram=function(){u.window.wx.exitMiniProgram()},u.onMkdirCallBack=function(i,e){i||(C.filesListObj=JSON.parse(e.data))},u.pixelRatio=function(){if(!u.EnvConfig.pixelRatioInt)try{return u.EnvConfig.pixelRatioInt=u.systemInfo.pixelRatio,u.systemInfo.pixelRatio}catch(i){}return u.EnvConfig.pixelRatioInt},u.createElement=function(i){var e;if("canvas"==i)return 1==u.idx?u.isZiYu?(e=sharedCanvas).style={}:(e=t.canvas).style={}:(e=t.swan.createCanvas()).style={},u.idx++,e;if("textarea"==i||"input"==i)return u.onCreateInput(i);if("div"!=i)return u._preCreateElement(i);var n=u._preCreateElement(i);return n.contains=function(i){return null},n.removeChild=function(i){},n},u.onCreateInput=function(i){var e=u._preCreateElement(i);return e.focus=x.wxinputFocus,e.blur=x.wxinputblur,e.style={},e.value=0,e.parentElement={},e.placeholder={},e.type={},e.setColor=function(i){},e.setType=function(i){},e.setFontFace=function(i){},e.addEventListener=function(i){},e.contains=function(i){return null},e.removeChild=function(i){},e},u.createShaderCondition=function(i){var e=this;return function(){return e[i.replace("this.","")]}},u.sendAtlasToOpenDataContext=function(i){if(!p.isZiYu){var e=h.getRes(_.formatURL(i));if(!e)throw"传递的url没有获取到对应的图集数据信息,请确保图集已经过!";e.meta.image.split(",");if(e.meta&&e.meta.image)for(var n=e.meta.image.split(","),t=0<=i.indexOf("/")?"/":"\\",o=i.lastIndexOf(t),a=0<=o?i.substr(0,o+1):"",r=0,l=n.length;r\s+<");try{e=(new t.Parser.DOMParser).parseFromString(i,"text/xml")}catch(i){throw"需要引入xml解析库文件"}return e},u.idx=1,e(u,["nativefiles",function(){return this.nativefiles=["layaNativeDir","wxlocal"]}]),u}(),C=function(){function u(){}return r(u,"laya.bd.mini.MiniFileMgr",null,"MiniFileMgr$1"),u.isLocalNativeFile=function(i){for(var e=0,n=w.nativefiles.length;ew.minClearSize&&(w.minClearSize=i.size),u.onClearCacheRes()),u.deleteFile(a,n,t,o,i.size)},fail:function(i){null!=t&&t.runWith([1,i])}}):null!=t&&t.runWith([0]):u.fs.getFileInfo({filePath:i,success:function(e){52428800<=s+4194304+e.size&&(e.size>w.minClearSize&&(w.minClearSize=e.size),u.onClearCacheRes()),u.fs.copyFile({srcPath:i,destPath:l,success:function(i){u.onSaveFile(n,a,!0,o,t,e.size)},fail:function(i){null!=t&&t.runWith([1,i])}})},fail:function(i){null!=t&&t.runWith([1,i])}})},u.onClearCacheRes=function(){var i=w.minClearSize,e=[];for(var n in u.filesListObj)e.push(u.filesListObj[n]);u.sortOn(e,"time",16);for(var t=0,o=1,a=e.length;othis.shakeInterval&&(this.event("change"),this.lastMillSecond=l.now()));this.lastX=t.x,this.lastY=t.y,this.lastZ=t.z},n.isShaked=function(e,t,n){return e>this.throushold&&t>this.throushold||e>this.throushold&&n>this.throushold||t>this.throushold&&n>this.throushold},c(1,t,"instance",function(){return t._instance=t._instance||new t},laya.events.EventDispatcher._$SET_instance),t._instance=null}(),function(n){function i(e,t){this.htmlVideo=null,this.videoElement=null,this.internalTexture=null,void 0===e&&(e=320),void 0===t&&(t=240),i.__super.call(this),d.isWebGL?this.htmlVideo=new x:this.htmlVideo=new w,this.videoElement=this.htmlVideo.getVideo(),(this.videoElement.layaTarget=this).internalTexture=new u(this.htmlVideo),this.videoElement.addEventListener("abort",i.onAbort),this.videoElement.addEventListener("canplay",i.onCanplay),this.videoElement.addEventListener("canplaythrough",i.onCanplaythrough),this.videoElement.addEventListener("durationchange",i.onDurationchange),this.videoElement.addEventListener("emptied",i.onEmptied),this.videoElement.addEventListener("error",i.onError),this.videoElement.addEventListener("loadeddata",i.onLoadeddata),this.videoElement.addEventListener("loadedmetadata",i.onLoadedmetadata),this.videoElement.addEventListener("loadstart",i.onLoadstart),this.videoElement.addEventListener("pause",i.onPause),this.videoElement.addEventListener("play",i.onPlay),this.videoElement.addEventListener("playing",i.onPlaying),this.videoElement.addEventListener("progress",i.onProgress),this.videoElement.addEventListener("ratechange",i.onRatechange),this.videoElement.addEventListener("seeked",i.onSeeked),this.videoElement.addEventListener("seeking",i.onSeeking),this.videoElement.addEventListener("stalled",i.onStalled),this.videoElement.addEventListener("suspend",i.onSuspend),this.videoElement.addEventListener("timeupdate",i.onTimeupdate),this.videoElement.addEventListener("volumechange",i.onVolumechange),this.videoElement.addEventListener("waiting",i.onWaiting),this.videoElement.addEventListener("ended",this.onPlayComplete.bind(this)),this.size(e,t),l.onMobile&&(this.onDocumentClick=this.onDocumentClick.bind(this),l.document.addEventListener("touchend",this.onDocumentClick))}s(i,"laya.device.media.Video",n);var e=i.prototype;return e.onPlayComplete=function(e){r.timer.clear(this,this.renderCanvas),this.event("ended")},e.load=function(e){0==e.indexOf("blob:")?this.videoElement.src=e:this.htmlVideo.setSource(e,laya.device.media.Video.MP4)},e.play=function(){this.videoElement.play(),r.timer.frameLoop(1,this,this.renderCanvas)},e.pause=function(){this.videoElement.pause(),r.timer.clear(this,this.renderCanvas)},e.reload=function(){this.videoElement.load()},e.canPlayType=function(e){var t;switch(e){case laya.device.media.Video.MP4:t="video/mp4";break;case laya.device.media.Video.OGG:t="video/ogg";break;case laya.device.media.Video.WEBM:t="video/webm"}return this.videoElement.canPlayType(t)},e.renderCanvas=function(){0!==this.readyState&&(d.isWebGL&&this.htmlVideo.updateTexture(),this.graphics.clear(),this.graphics.drawTexture(this.internalTexture,0,0,this.width,this.height))},e.onDocumentClick=function(){this.videoElement.play(),this.videoElement.pause(),l.document.removeEventListener("touchend",this.onDocumentClick)},e.size=function(e,t){return n.prototype.size.call(this,e,t),this.videoElement.width=e/l.pixelRatio,this.paused&&this.renderCanvas(),this},e.destroy=function(e){void 0===e&&(e=!0),n.prototype.destroy.call(this,e),this.videoElement.removeEventListener("abort",i.onAbort),this.videoElement.removeEventListener("canplay",i.onCanplay),this.videoElement.removeEventListener("canplaythrough",i.onCanplaythrough),this.videoElement.removeEventListener("durationchange",i.onDurationchange),this.videoElement.removeEventListener("emptied",i.onEmptied),this.videoElement.removeEventListener("error",i.onError),this.videoElement.removeEventListener("loadeddata",i.onLoadeddata),this.videoElement.removeEventListener("loadedmetadata",i.onLoadedmetadata),this.videoElement.removeEventListener("loadstart",i.onLoadstart),this.videoElement.removeEventListener("pause",i.onPause),this.videoElement.removeEventListener("play",i.onPlay),this.videoElement.removeEventListener("playing",i.onPlaying),this.videoElement.removeEventListener("progress",i.onProgress),this.videoElement.removeEventListener("ratechange",i.onRatechange),this.videoElement.removeEventListener("seeked",i.onSeeked),this.videoElement.removeEventListener("seeking",i.onSeeking),this.videoElement.removeEventListener("stalled",i.onStalled),this.videoElement.removeEventListener("suspend",i.onSuspend),this.videoElement.removeEventListener("timeupdate",i.onTimeupdate),this.videoElement.removeEventListener("volumechange",i.onVolumechange),this.videoElement.removeEventListener("waiting",i.onWaiting),this.videoElement.removeEventListener("ended",this.onPlayComplete),this.pause(),this.videoElement=null},e.syncVideoPosition=function(){var e,t=r.stage;e=v.getGlobalPosAndScale(this);var n=t._canvasTransform.a,i=t._canvasTransform.d,a=e.x*t.clientScaleX*n+t.offset.x,o=e.y*t.clientScaleY*i+t.offset.y;this.videoElement.style.left=a+"px",this.videoElement.style.top=o+"px",this.videoElement.width=this.width/l.pixelRatio,this.videoElement.height=this.height/l.pixelRatio},c(0,e,"buffered",function(){return this.videoElement.buffered}),c(0,e,"videoWidth",function(){return this.videoElement.videoWidth}),c(0,e,"currentSrc",function(){return this.videoElement.currentSrc}),c(0,e,"currentTime",function(){return this.videoElement.currentTime},function(e){this.videoElement.currentTime=e,this.renderCanvas()}),c(0,e,"ended",function(){return this.videoElement.ended}),c(0,e,"volume",function(){return this.videoElement.volume},function(e){this.videoElement.volume=e}),c(0,e,"videoHeight",function(){return this.videoElement.videoHeight}),c(0,e,"readyState",function(){return this.videoElement.readyState}),c(0,e,"duration",function(){return this.videoElement.duration}),c(0,e,"error",function(){return this.videoElement.error}),c(0,e,"loop",function(){return this.videoElement.loop},function(e){this.videoElement.loop=e}),c(0,e,"playbackRate",function(){return this.videoElement.playbackRate},function(e){this.videoElement.playbackRate=e}),c(0,e,"muted",function(){return this.videoElement.muted},function(e){this.videoElement.muted=e}),c(0,e,"paused",function(){return this.videoElement.paused}),c(0,e,"preload",function(){return this.videoElement.preload},function(e){this.videoElement.preload=e}),c(0,e,"seekable",function(){return this.videoElement.seekable}),c(0,e,"seeking",function(){return this.videoElement.seeking}),c(0,e,"height",n.prototype._$get_height,function(e){r.superSet(h,this,"height",e),this.paused&&this.renderCanvas()}),c(0,e,"width",n.prototype._$get_width,function(e){this.videoElement.width=this.width/l.pixelRatio,r.superSet(h,this,"width",e),this.paused&&this.renderCanvas()}),i.onAbort=function(e){e.target.layaTarget.event("abort")},i.onCanplay=function(e){e.target.layaTarget.event("canplay")},i.onCanplaythrough=function(e){e.target.layaTarget.event("canplaythrough")},i.onDurationchange=function(e){e.target.layaTarget.event("durationchange")},i.onEmptied=function(e){e.target.layaTarget.event("emptied")},i.onError=function(e){e.target.layaTarget.event("error")},i.onLoadeddata=function(e){e.target.layaTarget.event("loadeddata")},i.onLoadedmetadata=function(e){e.target.layaTarget.event("loadedmetadata")},i.onLoadstart=function(e){e.target.layaTarget.event("loadstart")},i.onPause=function(e){e.target.layaTarget.event("pause")},i.onPlay=function(e){e.target.layaTarget.event("play")},i.onPlaying=function(e){e.target.layaTarget.event("playing")},i.onProgress=function(e){e.target.layaTarget.event("progress")},i.onRatechange=function(e){e.target.layaTarget.event("ratechange")},i.onSeeked=function(e){e.target.layaTarget.event("seeked")},i.onSeeking=function(e){e.target.layaTarget.event("seeking")},i.onStalled=function(e){e.target.layaTarget.event("stalled")},i.onSuspend=function(e){e.target.layaTarget.event("suspend")},i.onTimeupdate=function(e){e.target.layaTarget.event("timeupdate")},i.onVolumechange=function(e){e.target.layaTarget.event("volumechange")},i.onWaiting=function(e){e.target.layaTarget.event("waiting")},i.MP4=1,i.OGG=2,i.CAMERA=4,i.WEBM=8,i.SUPPORT_PROBABLY="probably",i.SUPPORT_MAYBY="maybe",i.SUPPORT_NO="",i}(h)),w=function(e){function t(){this.video=null,t.__super.call(this),this._w=1,this._h=1,this.createDomElement()}s(t,"laya.device.media.HtmlVideo",i);var n=t.prototype;return n.createDomElement=function(){var e=this;this._source=this.video=l.createElement("video");var t=this.video.style;t.position="absolute",t.top="0px",t.left="0px",this.video.addEventListener("loadedmetadata",function(){this._w=e.video.videoWidth,this._h=e.video.videoHeight}.bind(this))},n.setSource=function(e,t){for(;this.video.childElementCount;)this.video.firstChild.remove();t&L.MP4&&this.appendSource(e,"video/mp4"),t&L.OGG&&this.appendSource(e+".ogg","video/ogg")},n.appendSource=function(e,t){var n=l.createElement("source");n.src=e,n.type=t,this.video.appendChild(n)},n.getVideo=function(){return this.video},t.create=function(){return new t},t}(),x=function(e){function t(){this.gl=null,this.preTarget=null,this.preTexture=null,t.__super.call(this),l.onIPhone||(this.gl=n.mainContext,this._source=this.gl.createTexture(),this.preTarget=m.curBindTexTarget,this.preTexture=m.curBindTexValue,m.bindTexture(this.gl,3553,this._source),this.gl.texParameteri(3553,10242,33071),this.gl.texParameteri(3553,10243,33071),this.gl.texParameteri(3553,10240,9729),this.gl.texParameteri(3553,10241,9729),this.preTarget&&this.preTexture&&m.bindTexture(this.gl,this.preTarget,this.preTexture))}return s(t,"laya.device.media.WebGLVideo",w),t.prototype.updateTexture=function(){l.onIPhone||(m.bindTexture(this.gl,3553,this._source),this.gl.texImage2D(3553,0,6407,6407,5121,this.video))},t}();r.__init([f])}(window,document,Laya),"function"==typeof define&&define.amd&&define("laya.core",["require","exports"],function(e,t){"use strict";for(var n in Object.defineProperty(t,"__esModule",{value:!0}),Laya){var i=Laya[n];i&&i.__isclass&&(t[n]=i)}}); -------------------------------------------------------------------------------- /bin/libs/min/laya.filter.min.js: -------------------------------------------------------------------------------- 1 | !function(t,e,a){a.un,a.uns,a.static;var n=a.class,s=a.getset,l=(a.__newvec,laya.utils.Browser,laya.utils.Color),i=laya.filters.ColorFilterAction,r=laya.filters.webgl.ColorFilterActionGL,o=laya.filters.Filter,u=laya.filters.webgl.FilterActionGL,c=laya.maths.Matrix,h=(laya.maths.Rectangle,laya.renders.Render),f=(laya.renders.RenderContext,laya.webgl.resource.RenderTarget2D),_=laya.utils.RunDriver,d=(laya.webgl.shader.d2.ShaderDefines2D,laya.display.Sprite,laya.resource.Texture,laya.webgl.shader.d2.value.Value2D),g=function(){function t(){this.data=null}n(t,"laya.filters.FilterAction");var e=t.prototype;return a.imps(e,{"laya.filters.IFilterAction":!0}),e.apply=function(t){return null},t}(),y=function(){function t(){}return n(t,"laya.filters.WebGLFilter"),t.enable=function(){t.isInit||(t.isInit=!0,h.isWebGL&&(_.createFilterAction=function(t){var e;switch(t){case 32:e=new r;break;case 16:e=new p;break;case 8:e=new w}return e}))},t.isInit=!1,t.__init$=function(){_.createFilterAction=function(t){var e;switch(t){case 16:case 8:e=new g;break;case 32:e=new i}return e}},t}(),p=(function(t){function e(t){this.strength=NaN,this.strength_sig2_2sig2_gauss1=[],e.__super.call(this),void 0===t&&(t=4),h.isWebGL&&y.enable(),this.strength=t,this._action=_.createFilterAction(16),this._action.data=this}n(e,"laya.filters.BlurFilter",o);var i=e.prototype;i.callNative=function(t){t.conchModel&&t.conchModel.blurFilter&&t.conchModel.blurFilter(this.strength)},s(0,i,"action",function(){return this._action}),s(0,i,"type",function(){return 16})}(),function(t){function r(t,e,i,a){this._color=null,r.__super.call(this),this._elements=new Float32Array(9),void 0===e&&(e=4),void 0===i&&(i=6),void 0===a&&(a=6),h.isWebGL&&y.enable(),this._color=new l(t),this.blur=Math.min(e,20),this.offX=i,this.offY=a,this._action=_.createFilterAction(8),this._action.data=this}n(r,"laya.filters.GlowFilter",o);var e=r.prototype;e.getColor=function(){return this._color._color},e.callNative=function(t){t.conchModel&&t.conchModel.glowFilter&&t.conchModel.glowFilter(this._color.strColor,this._elements[4],this._elements[5],this._elements[6])},s(0,e,"type",function(){return 8}),s(0,e,"action",function(){return this._action}),s(0,e,"offY",function(){return this._elements[6]},function(t){this._elements[6]=t}),s(0,e,"offX",function(){return this._elements[5]},function(t){this._elements[5]=t}),s(0,e,"blur",function(){return this._elements[4]},function(t){this._elements[4]=t})}(),function(t){function e(){this.data=null,e.__super.call(this)}n(e,"laya.filters.webgl.BlurFilterActionGL",u);var i=e.prototype;return i.setValueMix=function(t){t.defines.add(this.data.type)},i.apply3d=function(t,e,i,a,r){var n=t.getValue("bounds"),s=d.create(1,0);s.setFilters([this.data]),c.EMPTY.identity(),i.ctx.drawTarget(t,0,0,n.width,n.height,c.EMPTY,"src",s),s.setFilters(null)},i.setValue=function(t){t.strength=this.data.strength;var e=this.data.strength/3,i=e*e;this.data.strength_sig2_2sig2_gauss1[0]=this.data.strength,this.data.strength_sig2_2sig2_gauss1[1]=i,this.data.strength_sig2_2sig2_gauss1[2]=2*i,this.data.strength_sig2_2sig2_gauss1[3]=1/(2*Math.PI*i),t.strength_sig2_2sig2_gauss1=this.data.strength_sig2_2sig2_gauss1},s(0,i,"typeMix",function(){return 16}),e}()),w=function(t){function e(){this.data=null,this._initKey=!1,this._textureWidth=0,this._textureHeight=0,e.__super.call(this)}n(e,"laya.filters.webgl.GlowFilterActionGL",u);var i=e.prototype;return a.imps(i,{"laya.filters.IFilterActionGL":!0}),i.setValueMix=function(t){},i.apply3d=function(t,e,i,a,r){var n=t.getValue("bounds");t.addValue("color",this.data.getColor());var s,l=n.width,o=n.height;this._textureWidth=l,this._textureHeight=o;var u=c.TEMP;return u.identity(),(s=d.create(1,0)).setFilters([this.data]),i.ctx.drawTarget(t,0,0,this._textureWidth,this._textureHeight,u,"src",s,null),s=d.create(1,0),i.ctx.drawTarget(t,0,0,this._textureWidth,this._textureHeight,u,"src",s),null},i.setSpriteWH=function(t){this._textureWidth=t.width,this._textureHeight=t.height},i.setValue=function(t){t.u_offsetX=this.data.offX,t.u_offsetY=-this.data.offY,t.u_strength=1,t.u_blurX=this.data.blur,t.u_blurY=this.data.blur,t.u_textW=this._textureWidth,t.u_textH=this._textureHeight,t.u_color=this.data.getColor()},s(0,i,"typeMix",function(){return 8}),e.tmpTarget=function(t,e,i,a,r){var n=t.getValue("bounds");t.getValue("out").end();var s=f.create(n.width,n.height);s.start();var l=t.getValue("color");l&&s.clear(l[0],l[1],l[2],0),t.addValue("tmpTarget",s)},e.startOut=function(t,e,i,a,r){t.getValue("tmpTarget").end();var n=t.getValue("out");n.start();var s=t.getValue("color");s&&n.clear(s[0],s[1],s[2],0)},e.recycleTarget=function(t,e,i,a,r){t.getValue("src");t.getValue("tmpTarget").recycle()},e}();a.__init([y])}(window,document,Laya),"function"==typeof define&&define.amd&&define("laya.core",["require","exports"],function(t,e){"use strict";for(var i in Object.defineProperty(e,"__esModule",{value:!0}),Laya){var a=Laya[i];a&&a.__isclass&&(e[i]=a)}}); -------------------------------------------------------------------------------- /bin/libs/min/laya.html.min.js: -------------------------------------------------------------------------------- 1 | !function(t,e,n){n.un,n.uns;var h=n.static,l=n.class,s=n.getset,r=(n.__newvec,laya.utils.Browser,laya.display.css.CSSStyle),_=laya.utils.ClassUtils,u=(laya.events.Event,laya.utils.HTMLChar),a=laya.net.Loader,o=(laya.display.Node,laya.maths.Rectangle),d=laya.renders.Render,c=(laya.renders.RenderContext,laya.renders.RenderSprite,laya.display.Sprite),f=laya.utils.Stat,b=laya.display.Text,g=laya.resource.Texture,y=laya.net.URL,p=laya.utils.Utils,m=function(){function f(){}return l(f,"laya.html.utils.HTMLParse"),f.parse=function(t,e,i){e=(e=""+(e=e.replace(/
/g,"
"))+"
").replace(f.spacePattern,f.char255);var n=p.parseXMLFromString(e);f._parseXML(t,n.childNodes[0].childNodes,i)},f._parseXML=function(t,e,i,n){var h=0,l=0;if(e.join||e.item)for(h=0,l=e.length;ht.height&&(t.height=v),[g,v]},U._multiLineLayout2=function(t){var e=new Array;t._addChildsToLayout(e);var i,n,h,l,s,r=0,a=e.length,o=t._getCSSStyle(),d=o.letterSpacing,u=o.leading,c=o.lineHeight,f=o._widthAuto()||!o.wordWrap,_=f?999999:t.width,g=(t.height,0),y=o.italic?o.fontSize/3:0,p=2-o._getAlign(),m=o._getValign(),w=0!==m||0!==p||0!=c,x=0,v=0,S=0,L=0,T=new Array,C=T[0]=new P,E=!1,M=!1;C.h=0,o.italic&&(_-=o.fontSize/3);var H=0,I=!0;function A(){C.y=v,v+=C.h+u,0==C.h&&(v+=c),C.mWidth=H,H=0,C=new P,T.push(C),C.h=0,E=!(I=!(x=0))}for(r=0;rt.height&&(t.height=v),r=0,a=T.length;r=0&&t=0&&e-l&&(u-=l,t+=o),d0&&(new Date).getTime()-h>1e3*o.timeLimit)return 1/0;var f=e+l(t,c)*o.weight;if(f>i)return f;if(t==c)return n[a]=[t.x,t.y],t;var p,g=0,b=0,m=0,v=s.getNeighbors(t,o.diagonalMovement);for(m=0,g=1/0;p=v[m];++m){if(o.trackRecursion&&(p.retainCount=p.retainCount+1||1,1!=p.tested&&(p.tested=!0)),(b=d(p,e+u(t,p),i,n,a+1))instanceof PathFinding.core.Node)return n[a]=[t.x,t.y],b;o.trackRecursion&&0==--p.retainCount&&(p.tested=!1),be?1:0}}n(t,"PathFinding.libs.HeapFunction");var e=t.prototype;return e.insort=function(t,e,i,n,s){var a=NaN;if(null==i&&(i=0),null==s&&(s=this.defaultCmp),i<0)throw new Error("lo must be non-negative");for(null==n&&(n=t.length);ii;0<=i?h++:h--)a.push(h);return a}.apply(this).reverse(),s=[],r=0,l=n.length;rh;0<=h?++d:--d)l.push(this.heappop(t,i));return l},e._siftdown=function(t,e,i,n){var s,a,o=0;for(null==n&&(n=this.defaultCmp),s=t[i];i>e&&(o=i-1>>1,a=t[o],n(s,a)<0);)t[i]=a,i=o;return t[i]=s},e._siftup=function(t,e,i){var n,s=0,a=0,o=0,r=0;for(null==i&&(i=this.defaultCmp),a=t.length,r=e,n=t[e],s=2*e+1;s\s+<");try{e=(new a.Parser.DOMParser).parseFromString(i,"text/xml")}catch(i){throw"需要引入xml解析库文件"}return e},u.idx=1,e(u,["nativefiles",function(){return this.nativefiles=["layaNativeDir","wxlocal"]}]),u}(),C=function(){function c(){}return n(c,"laya.wx.mini.MiniFileMgr"),c.isLocalNativeFile=function(i){for(var e=0,t=x.nativefiles.length;ex.minClearSize&&(x.minClearSize=i.size),c.onClearCacheRes()),c.deleteFile(r,t,n,a,i.size)},fail:function(i){null!=n&&n.runWith([1,i])}}):null!=n&&n.runWith([0]):c.fs.getFileInfo({filePath:i,success:function(e){o&&52428800<=u+4194304+e.size&&(e.size>x.minClearSize&&(x.minClearSize=e.size),c.onClearCacheRes()),c.fs.copyFile({srcPath:i,destPath:s,success:function(i){c.onSaveFile(t,r,!0,a,n,e.size)},fail:function(i){null!=n&&n.runWith([1,i])}})},fail:function(i){null!=n&&n.runWith([1,i])}})},c.onClearCacheRes=function(){var i=x.minClearSize,e=[];for(var t in c.filesListObj)e.push(c.filesListObj[t]);c.sortOn(e,"times",16);for(var n=0,a=1,o=e.length;at)return e;for(var i=512;t>i;)i<<=1;for(var r=new Uint8Array(i),s=0;a>s;++s)r[s]=e[s];return this.buffer=r},getByte:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return this.buffer[this.pos++]},getBytes:function(t){var e=this.pos;if(t){this.ensureBuffer(e+t);for(var a=e+t;!this.eof&&this.bufferLengthi&&(a=i)}else{for(;!this.eof;)this.readBlock();var a=this.bufferLength}return this.pos=a,this.buffer.subarray(e,a)},lookChar:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos])},getChar:function(){for(var t=this.pos;this.bufferLength<=t;){if(this.eof)return null;this.readBlock()}return String.fromCharCode(this.buffer[this.pos++])},makeSubStream:function(t,e,a){for(var i=t+e;this.bufferLength<=i&&!this.eof;)this.readBlock();return new Stream(this.buffer,t,e,a)},skip:function(t){t||(t=1),this.pos+=t},reset:function(){this.pos=0}},t}(),FlateStream=function(){function t(t){throw new Error(t)}function e(e){var a=0,i=e[a++],r=e[a++];-1!=i&&-1!=r||t("Invalid header in flate stream"),8!=(15&i)&&t("Unknown compression method in flate stream"),((i<<8)+r)%31!=0&&t("Bad FCHECK in flate stream"),32&r&&t("FDICT bit set in flate stream"),this.bytes=e,this.bytesPos=a,this.codeSize=0,this.codeBuf=0,DecodeStream.call(this)}var a=new Uint32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),i=new Uint32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),r=new Uint32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),s=[new Uint32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],n=[new Uint32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5];return e.prototype=Object.create(DecodeStream.prototype),e.prototype.getBits=function(e){for(var a,i=this.codeSize,r=this.codeBuf,s=this.bytes,n=this.bytesPos;e>i;)"undefined"==typeof(a=s[n++])&&t("Bad encoding in flate stream"),r|=a<>e,this.codeSize=i-=e,this.bytesPos=n,a},e.prototype.getCode=function(e){for(var a=e[0],i=e[1],r=this.codeSize,s=this.codeBuf,n=this.bytes,o=this.bytesPos;i>r;){var h;"undefined"==typeof(h=n[o++])&&t("Bad encoding in flate stream"),s|=h<>16,c=65535&f;return(0==r||d>r||0==d)&&t("Bad encoding in flate stream"),this.codeBuf=s>>d,this.codeSize=r-d,this.bytesPos=o,c},e.prototype.generateHuffmanTable=function(t){for(var e=t.length,a=0,i=0;e>i;++i)t[i]>a&&(a=t[i]);for(var r=1<=n;++n,o<<=1,h<<=1)for(var f=0;e>f;++f)if(t[f]==n){for(var d=0,c=o,i=0;n>i;++i)d=d<<1|1&c,c>>=1;for(var i=d;r>i;i+=h)s[i]=n<<16|f;++o}return[s,a]},e.prototype.readBlock=function(){function e(t,e,a,i,r){for(var s=t.getBits(a)+i;s-- >0;)e[I++]=r}var o=this.getBits(3);if(1&o&&(this.eof=!0),o>>=1,0==o){var h,f=this.bytes,d=this.bytesPos;"undefined"==typeof(h=f[d++])&&t("Bad block header in flate stream");var c=h;"undefined"==typeof(h=f[d++])&&t("Bad block header in flate stream"),c|=h<<8,"undefined"==typeof(h=f[d++])&&t("Bad block header in flate stream");var l=h;"undefined"==typeof(h=f[d++])&&t("Bad block header in flate stream"),l|=h<<8,l!=(65535&~c)&&t("Bad uncompressed block length in flate stream"),this.codeBuf=0,this.codeSize=0;var u=this.bufferLength,p=this.ensureBuffer(u+c),g=u+c;this.bufferLength=g;for(var m=u;g>m;++m){if("undefined"==typeof(h=f[d++])){this.eof=!0;break}p[m]=h}return void(this.bytesPos=d)}var y,v;if(1==o)y=s,v=n;else if(2==o){for(var b=this.getBits(5)+257,w=this.getBits(5)+1,B=this.getBits(4)+4,T=Array(a.length),I=0;B>I;)T[a[I++]]=this.getBits(3);for(var U=this.generateHuffmanTable(T),D=0,I=0,k=b+w,A=new Array(k);k>I;){var C=this.getCode(U);16==C?e(this,A,2,3,D):17==C?e(this,A,3,3,D=0):18==C?e(this,A,7,11,D=0):A[I++]=D=C}y=this.generateHuffmanTable(A.slice(0,b)),v=this.generateHuffmanTable(A.slice(b,k))}else t("Unknown block type in flate stream");for(var p=this.buffer,S=p?p.length:0,P=this.bufferLength;;){var M=this.getCode(y);if(256>M)P+1>=S&&(p=this.ensureBuffer(P+1),S=p.length),p[P++]=M;else{if(256==M)return void(this.bufferLength=P);M-=257,M=i[M];var L=M>>16;L>0&&(L=this.getBits(L));var D=(65535&M)+L;M=this.getCode(v),M=r[M],L=M>>16,L>0&&(L=this.getBits(L));var x=(65535&M)+L;P+D>=S&&(p=this.ensureBuffer(P+D),S=p.length);for(var N=0;D>N;++N,++P)p[P]=p[P-x]}}},e}();(function(){var t;t=function(){function t(t){var e,a,i,r,s,n,o,h,f,d,c,l,u,p;for(this.data=t,this.pos=8,this.palette=[],this.imgData=[],this.transparency={},this.animation=null,this.text={},s=null;;){switch(e=this.readUInt32(),f=function(){var t,e;for(e=[],n=t=0;4>t;n=++t)e.push(String.fromCharCode(this.data[this.pos++]));return e}.call(this).join("")){case"IHDR":if(this.width=this.readUInt32(),this.height=this.readUInt32(),this.bits=this.data[this.pos++],this.colorType=this.data[this.pos++],this.compressionMethod=this.data[this.pos++],this.filterMethod=this.data[this.pos++],this.interlaceMethod=this.data[this.pos++],0!=this.interlaceMethod)throw new Error("Invalid interlaceMethod: "+this.interlaceMethod);break;case"acTL":this.animation={numFrames:this.readUInt32(),numPlays:this.readUInt32()||1/0,frames:[]};break;case"PLTE":this.palette=this.read(e);break;case"fcTL":s&&this.animation.frames.push(s),this.pos+=4,s={width:this.readUInt32(),height:this.readUInt32(),xOffset:this.readUInt32(),yOffset:this.readUInt32()},r=this.readUInt16(),i=this.readUInt16()||100,s.delay=1e3*r/i,s.disposeOp=this.data[this.pos++],s.blendOp=this.data[this.pos++],s.data=[];break;case"IDAT":case"fdAT":for("fdAT"===f&&(this.pos+=4,e-=4),t=(null!=s?s.data:void 0)||this.imgData,n=l=0;e>=0?e>l:l>e;n=e>=0?++l:--l)t.push(this.data[this.pos++]);break;case"tRNS":switch(this.transparency={},this.colorType){case 3:if(this.transparency.indexed=this.read(e),d=255-this.transparency.indexed.length,d>0)for(n=u=0;d>=0?d>u:u>d;n=d>=0?++u:--u)this.transparency.indexed.push(255);break;case 0:this.transparency.grayscale=this.read(e)[0];break;case 2:this.transparency.rgb=this.read(e)}break;case"tEXt":c=this.read(e),o=c.indexOf(0),h=String.fromCharCode.apply(String,c.slice(0,o)),this.text[h]=String.fromCharCode.apply(String,c.slice(o+1));break;case"IEND":return s&&this.animation.frames.push(s),this.colors=function(){switch(this.colorType){case 0:case 3:case 4:return 1;case 2:case 6:return 3}}.call(this),this.hasAlphaChannel=4===(p=this.colorType)||6===p,a=this.colors+(this.hasAlphaChannel?1:0),this.pixelBitlength=this.bits*a,this.colorSpace=function(){switch(this.colors){case 1:return"DeviceGray";case 3:return"DeviceRGB"}}.call(this),void(this.imgData=new Uint8Array(this.imgData));default:this.pos+=e}if(this.pos+=4,this.pos>this.data.length)throw new Error("Incomplete or corrupt PNG file")}}var e,a,i,r,s,n;return t.load=function(e,a){var i;return"function"==typeof canvas&&(a=canvas),i=new XMLHttpRequest,i.open("GET",e,!0),i.responseType="arraybuffer",i.onload=function(){var r,s;return r=new Uint8Array(i.response||i.mozResponseArrayBuffer),s=new t(r),s.url=e,"function"==typeof a?a(s):void 0},i.send(null)},r=0,i=1,s=2,a=0,e=1,t.prototype.read=function(t){var e,a,i;for(i=[],e=a=0;t>=0?t>a:a>t;e=t>=0?++a:--a)i.push(this.data[this.pos++]);return i},t.prototype.readUInt32=function(){var t,e,a,i;return t=this.data[this.pos++]<<24,e=this.data[this.pos++]<<16,a=this.data[this.pos++]<<8,i=this.data[this.pos++],t|e|a|i},t.prototype.readUInt16=function(){var t,e;return t=this.data[this.pos++]<<8,e=this.data[this.pos++],t|e},t.prototype.decodePixels=function(t){var e,a,i,r,s,n,o,h,f,d,c,l,u,p,g,m,y,v,b,w,B,T,I;if(null==t&&(t=this.imgData),0===t.length)return new Uint8Array(0);for(t=new FlateStream(t),t=t.getBytes(),l=this.pixelBitlength/8,m=l*this.width,u=new Uint8Array(m*this.height),n=t.length,g=0,p=0,a=0;n>p;){switch(t[p++]){case 0:for(r=b=0;m>b;r=b+=1)u[a++]=t[p++];break;case 1:for(r=w=0;m>w;r=w+=1)e=t[p++],s=l>r?0:u[a-l],u[a++]=(e+s)%256;break;case 2:for(r=B=0;m>B;r=B+=1)e=t[p++],i=(r-r%l)/l,y=g&&u[(g-1)*m+i*l+r%l],u[a++]=(y+e)%256;break;case 3:for(r=T=0;m>T;r=T+=1)e=t[p++],i=(r-r%l)/l,s=l>r?0:u[a-l],y=g&&u[(g-1)*m+i*l+r%l],u[a++]=(e+Math.floor((s+y)/2))%256;break;case 4:for(r=I=0;m>I;r=I+=1)e=t[p++],i=(r-r%l)/l,s=l>r?0:u[a-l],0===g?y=v=0:(y=u[(g-1)*m+i*l+r%l],v=i&&u[(g-1)*m+(i-1)*l+r%l]),o=s+y-v,h=Math.abs(o-s),d=Math.abs(o-y),c=Math.abs(o-v),f=d>=h&&c>=h?s:c>=d?y:v,u[a++]=(e+f)%256;break;default:throw new Error("Invalid filter algorithm: "+t[p-1])}g++}return u},t.prototype.decodePalette=function(){var t,e,a,i,r,s,n,o,h,f;i=this.palette,n=this.transparency.indexed||[];var d;for(d=4*i.length/3,s=new Uint8Array(d),r=0,a=i.length,t=0,e=o=0,h=i.length;h>o;e=o+=3)s[r++]=i[e],s[r++]=i[e+1],s[r++]=i[e+2],s[r++]=null!=(f=n[t++])?f:255;return s},t.prototype.getImageData=function(){var t=new self.ImageData(this.width,this.height);return this.copyToImageData(t,this.decodePixels()),t},t.prototype.getImageDataBuffer=function(){var t;return t=self.Uint8ClampedArray?new self.Uint8ClampedArray(this.width*this.height*4):new self.Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},t.prototype.copyToImageData=function(t,e){var a,i,r,s,n,o,h,f,d,c,l;if(i=this.colors,d=null,a=this.hasAlphaChannel,this.palette.length&&(d=null!=(l=this._decodedPalette)?l:this._decodedPalette=this.decodePalette(),i=4,a=!0),r=t.data||t,f=r.length,n=d||e,s=o=0,1===i)for(;f>s;)h=d?4*e[s/4]:o,c=n[h++],r[s++]=c,r[s++]=c,r[s++]=c,r[s++]=a?n[h++]:255,o=h;else for(;f>s;)h=d?4*e[s/4]:o,r[s++]=n[h++],r[s++]=n[h++],r[s++]=n[h++],r[s++]=a?n[h++]:255,o=h},t.prototype.decode=function(){var t;return t=new Uint8Array(this.width*this.height*4),this.copyToImageData(t,this.decodePixels()),t},t.prototype.decodeFrames=function(t){var e,a,i,r,s,o,h,f;if(this.animation){for(h=this.animation.frames,f=[],a=s=0,o=h.length;o>s;a=++s)e=h[a],i=t.createImageData(e.width,e.height),r=this.decodePixels(new Uint8Array(e.data)),this.copyToImageData(i,r),e.imageData=i,f.push(e.image=n(i));return f}},t}(),this.PNG=t}).call(this),onmessage=function(t){var e=t.data;switch(e.type){case"load":loadImage2(e)}};var canUseImageData=!1;testCanImageData(); -------------------------------------------------------------------------------- /bin/res/atlas/.rec: -------------------------------------------------------------------------------- 1 | D . 2 | D comp 3 | P D12221A9 bg.png 4 | P 9401CC40 blank.png 5 | P B03390E5 btn_close.png 6 | P 1F3929EA button.png 7 | P 6CC6DF97 checkbox.png 8 | P FB94CCF2 clip_num.png 9 | P F7B6B7D7 clip_selectBox.png 10 | P 755271AE clip_tree_arrow.png 11 | P 859FD34C clip_tree_folder.png 12 | P A0E3B8F9 combobox.png 13 | P 9EDA959E hscroll$bar.png 14 | P 1AB768D4 hscroll$down.png 15 | P 685261D3 hscroll$up.png 16 | P 274B8076 hscroll.png 17 | P E466EB1C hslider$bar.png 18 | P C4BECA54 hslider.png 19 | P 5EDC128C html.png 20 | P ACFFCCCF image.png 21 | P 5EDC128C label.png 22 | P 5EDC128C linkbutton.png 23 | P 9E4DD730 progress$bar.png 24 | P 3FD78E12 progress.png 25 | P BF898D6A radio.png 26 | P BF898D6A radiogroup.png 27 | P 8CFD9D35 tab.png 28 | P BDA71F88 textarea.png 29 | P BDA71F88 textinput.png 30 | P 52107B89 vscroll$bar.png 31 | P E26B933E vscroll$down.png 32 | P B9680947 vscroll$up.png 33 | P 7E990267 vscroll.png 34 | P E466EB1C vslider$bar.png 35 | P 2BFF7046 vslider.png 36 | -------------------------------------------------------------------------------- /bin/res/atlas/comp.atlas: -------------------------------------------------------------------------------- 1 | {"frames":{"bg.png":{"frame":{"h":79,"idx":0,"w":100,"x":151,"y":0},"sourceSize":{"h":79,"w":100},"spriteSourceSize":{"x":0,"y":0}},"blank.png":{"frame":{"h":10,"idx":0,"w":10,"x":344,"y":138},"sourceSize":{"h":10,"w":10},"spriteSourceSize":{"x":0,"y":0}},"btn_close.png":{"frame":{"h":60,"idx":0,"w":28,"x":328,"y":0},"sourceSize":{"h":60,"w":28},"spriteSourceSize":{"x":0,"y":0}},"button.png":{"frame":{"h":69,"idx":0,"w":75,"x":252,"y":0},"sourceSize":{"h":69,"w":75},"spriteSourceSize":{"x":0,"y":0}},"checkbox.png":{"frame":{"h":42,"idx":0,"w":14,"x":379,"y":181},"sourceSize":{"h":42,"w":14},"spriteSourceSize":{"x":0,"y":0}},"clip_num.png":{"frame":{"h":27,"idx":0,"w":240,"x":151,"y":80},"sourceSize":{"h":27,"w":240},"spriteSourceSize":{"x":0,"y":0}},"clip_selectBox.png":{"frame":{"h":40,"idx":0,"w":100,"x":243,"y":108},"sourceSize":{"h":40,"w":100},"spriteSourceSize":{"x":0,"y":0}},"clip_tree_arrow.png":{"frame":{"h":28,"idx":0,"w":14,"x":379,"y":224},"sourceSize":{"h":28,"w":14},"spriteSourceSize":{"x":0,"y":0}},"clip_tree_folder.png":{"frame":{"h":48,"idx":0,"w":16,"x":314,"y":206},"sourceSize":{"h":48,"w":16},"spriteSourceSize":{"x":0,"y":0}},"combobox.png":{"frame":{"h":69,"idx":0,"w":91,"x":151,"y":108},"sourceSize":{"h":69,"w":91},"spriteSourceSize":{"x":0,"y":0}},"hscroll$bar.png":{"frame":{"h":51,"idx":0,"w":21,"x":375,"y":0},"sourceSize":{"h":51,"w":21},"spriteSourceSize":{"x":0,"y":0}},"hscroll$down.png":{"frame":{"h":51,"idx":0,"w":17,"x":343,"y":187},"sourceSize":{"h":51,"w":17},"spriteSourceSize":{"x":0,"y":0}},"hscroll$up.png":{"frame":{"h":51,"idx":0,"w":17,"x":397,"y":0},"sourceSize":{"h":51,"w":17},"spriteSourceSize":{"x":0,"y":0}},"hscroll.png":{"frame":{"h":17,"idx":0,"w":33,"x":331,"y":239},"sourceSize":{"h":17,"w":33},"spriteSourceSize":{"x":0,"y":0}},"hslider$bar.png":{"frame":{"h":42,"idx":0,"w":14,"x":379,"y":138},"sourceSize":{"h":42,"w":14},"spriteSourceSize":{"x":0,"y":0}},"hslider.png":{"frame":{"h":6,"idx":0,"w":100,"x":252,"y":70},"sourceSize":{"h":6,"w":100},"spriteSourceSize":{"x":0,"y":0}},"html.png":{"frame":{"h":18,"idx":0,"w":120,"x":222,"y":187},"sourceSize":{"h":18,"w":120},"spriteSourceSize":{"x":0,"y":0}},"image.png":{"frame":{"h":250,"idx":0,"w":150,"x":0,"y":0},"sourceSize":{"h":250,"w":150},"spriteSourceSize":{"x":0,"y":0}},"label.png":{"frame":{"h":18,"idx":0,"w":120,"x":243,"y":168},"sourceSize":{"h":18,"w":120},"spriteSourceSize":{"x":0,"y":0}},"linkbutton.png":{"frame":{"h":18,"idx":0,"w":120,"x":243,"y":149},"sourceSize":{"h":18,"w":120},"spriteSourceSize":{"x":0,"y":0}},"progress$bar.png":{"frame":{"h":14,"idx":0,"w":50,"x":344,"y":108},"sourceSize":{"h":14,"w":50},"spriteSourceSize":{"x":0,"y":0}},"progress.png":{"frame":{"h":14,"idx":0,"w":50,"x":344,"y":123},"sourceSize":{"h":14,"w":50},"spriteSourceSize":{"x":0,"y":0}},"radio.png":{"frame":{"h":42,"idx":0,"w":14,"x":364,"y":138},"sourceSize":{"h":42,"w":14},"spriteSourceSize":{"x":0,"y":0}},"radiogroup.png":{"frame":{"h":42,"idx":0,"w":14,"x":395,"y":104},"sourceSize":{"h":42,"w":14},"spriteSourceSize":{"x":0,"y":0}},"tab.png":{"frame":{"h":78,"idx":0,"w":70,"x":151,"y":178},"sourceSize":{"h":78,"w":70},"spriteSourceSize":{"x":0,"y":0}},"textarea.png":{"frame":{"h":23,"idx":0,"w":91,"x":222,"y":230},"sourceSize":{"h":23,"w":91},"spriteSourceSize":{"x":0,"y":0}},"textinput.png":{"frame":{"h":23,"idx":0,"w":91,"x":222,"y":206},"sourceSize":{"h":23,"w":91},"spriteSourceSize":{"x":0,"y":0}},"vscroll$bar.png":{"frame":{"h":63,"idx":0,"w":17,"x":357,"y":0},"sourceSize":{"h":63,"w":17},"spriteSourceSize":{"x":0,"y":0}},"vscroll$down.png":{"frame":{"h":51,"idx":0,"w":17,"x":361,"y":187},"sourceSize":{"h":51,"w":17},"spriteSourceSize":{"x":0,"y":0}},"vscroll$up.png":{"frame":{"h":51,"idx":0,"w":17,"x":392,"y":52},"sourceSize":{"h":51,"w":17},"spriteSourceSize":{"x":0,"y":0}},"vscroll.png":{"frame":{"h":33,"idx":0,"w":17,"x":394,"y":190},"sourceSize":{"h":33,"w":17},"spriteSourceSize":{"x":0,"y":0}},"vslider$bar.png":{"frame":{"h":42,"idx":0,"w":14,"x":394,"y":147},"sourceSize":{"h":42,"w":14},"spriteSourceSize":{"x":0,"y":0}},"vslider.png":{"frame":{"h":100,"idx":0,"w":6,"x":410,"y":52},"sourceSize":{"h":100,"w":6},"spriteSourceSize":{"x":0,"y":0}}},"meta":{"image":"comp.png","prefix":"comp/"}} -------------------------------------------------------------------------------- /bin/res/atlas/comp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/bin/res/atlas/comp.png -------------------------------------------------------------------------------- /bin/unpack.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /colony.laya: -------------------------------------------------------------------------------- 1 | {"proName":"colony","engineType":0,"proType":2,"layaProType":0} -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | // See http://go.microsoft.com/fwlink/?LinkId=759670 3 | // for the documentation about the jsconfig.json format 4 | "compilerOptions": { 5 | "target": "es5" 6 | }, 7 | "exclude": [ 8 | "node_modules", 9 | "bower_components", 10 | "jspm_packages", 11 | "tmp", 12 | "temp", 13 | "bin" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /laya/.laya: -------------------------------------------------------------------------------- 1 | 2 | img,temp,sound 3 | embed 4 | png,jpg 5 | bin/res/atlas 6 | bin 7 | src/ui 8 | 9 | 11 | 0 12 | bin/ui.json 13 | Box,List,Tab,RadioGroup,ViewStack,Panel,HBox,VBox,Tree,Sprite 14 | View,Dialog 15 | 16 | 2 17 | 18 | 80 19 | 20 | 21 | 23 | 2048 24 | 2048 25 | 512 26 | 512 27 | false 28 | false 29 | -------------------------------------------------------------------------------- /laya/assets/comp/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/bg.png -------------------------------------------------------------------------------- /laya/assets/comp/blank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/blank.png -------------------------------------------------------------------------------- /laya/assets/comp/btn_close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/btn_close.png -------------------------------------------------------------------------------- /laya/assets/comp/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/button.png -------------------------------------------------------------------------------- /laya/assets/comp/checkbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/checkbox.png -------------------------------------------------------------------------------- /laya/assets/comp/clip_num.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/clip_num.png -------------------------------------------------------------------------------- /laya/assets/comp/clip_selectBox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/clip_selectBox.png -------------------------------------------------------------------------------- /laya/assets/comp/clip_tree_arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/clip_tree_arrow.png -------------------------------------------------------------------------------- /laya/assets/comp/clip_tree_folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/clip_tree_folder.png -------------------------------------------------------------------------------- /laya/assets/comp/combobox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/combobox.png -------------------------------------------------------------------------------- /laya/assets/comp/hscroll$bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/hscroll$bar.png -------------------------------------------------------------------------------- /laya/assets/comp/hscroll$down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/hscroll$down.png -------------------------------------------------------------------------------- /laya/assets/comp/hscroll$up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/hscroll$up.png -------------------------------------------------------------------------------- /laya/assets/comp/hscroll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/hscroll.png -------------------------------------------------------------------------------- /laya/assets/comp/hslider$bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/hslider$bar.png -------------------------------------------------------------------------------- /laya/assets/comp/hslider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/hslider.png -------------------------------------------------------------------------------- /laya/assets/comp/html.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/html.png -------------------------------------------------------------------------------- /laya/assets/comp/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/image.png -------------------------------------------------------------------------------- /laya/assets/comp/label.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/label.png -------------------------------------------------------------------------------- /laya/assets/comp/linkbutton.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/linkbutton.png -------------------------------------------------------------------------------- /laya/assets/comp/progress$bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/progress$bar.png -------------------------------------------------------------------------------- /laya/assets/comp/progress.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/progress.png -------------------------------------------------------------------------------- /laya/assets/comp/radio.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/radio.png -------------------------------------------------------------------------------- /laya/assets/comp/radiogroup.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/radiogroup.png -------------------------------------------------------------------------------- /laya/assets/comp/tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/tab.png -------------------------------------------------------------------------------- /laya/assets/comp/textarea.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/textarea.png -------------------------------------------------------------------------------- /laya/assets/comp/textinput.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/textinput.png -------------------------------------------------------------------------------- /laya/assets/comp/vscroll$bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/vscroll$bar.png -------------------------------------------------------------------------------- /laya/assets/comp/vscroll$down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/vscroll$down.png -------------------------------------------------------------------------------- /laya/assets/comp/vscroll$up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/vscroll$up.png -------------------------------------------------------------------------------- /laya/assets/comp/vscroll.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/vscroll.png -------------------------------------------------------------------------------- /laya/assets/comp/vslider$bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/vslider$bar.png -------------------------------------------------------------------------------- /laya/assets/comp/vslider.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/15972158793/layaai/93d4805680e8208c5a61671d938beeefd5898248/laya/assets/comp/vslider.png -------------------------------------------------------------------------------- /laya/pages/MainView.ui: -------------------------------------------------------------------------------- 1 | { 2 | "x":0, 3 | "type":"View", 4 | "selectedBox":2, 5 | "selecteID":25, 6 | "props":{"width":1280,"sceneColor":"#000000","height":720}, 7 | "nodeParent":-1, 8 | "label":"View", 9 | "isOpen":true, 10 | "isDirectory":true, 11 | "isAniNode":true, 12 | "hasChild":true, 13 | "compId":1, 14 | "child":[ 15 | { 16 | "x":15, 17 | "type":"Box", 18 | "props":{"y":442,"x":144,"width":298,"var":"specification","height":278}, 19 | "nodeParent":1, 20 | "label":"Box(specification)", 21 | "isOpen":true, 22 | "isDirectory":true, 23 | "isAniNode":true, 24 | "hasChild":true, 25 | "compId":2, 26 | "child":[ 27 | { 28 | "x":30, 29 | "type":"Poly", 30 | "props":{"y":13,"x":39,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#990000"}, 31 | "nodeParent":2, 32 | "label":"Poly", 33 | "isDirectory":false, 34 | "isAniNode":true, 35 | "hasChild":false, 36 | "compId":3, 37 | "child":[ 38 | ], 39 | "$LOCKED":true 40 | }, 41 | { 42 | "x":30, 43 | "type":"Poly", 44 | "props":{"y":49,"x":39,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#990099"}, 45 | "nodeParent":2, 46 | "label":"Poly", 47 | "isDirectory":false, 48 | "isAniNode":true, 49 | "hasChild":false, 50 | "compId":4, 51 | "child":[ 52 | ], 53 | "$LOCKED":true 54 | }, 55 | { 56 | "x":30, 57 | "type":"Poly", 58 | "props":{"y":85,"x":39,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#000099"}, 59 | "nodeParent":2, 60 | "label":"Poly", 61 | "isDirectory":false, 62 | "isAniNode":true, 63 | "hasChild":false, 64 | "compId":5, 65 | "child":[ 66 | ], 67 | "$LOCKED":true 68 | }, 69 | { 70 | "x":30, 71 | "type":"Poly", 72 | "props":{"y":121,"x":39,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#009900"}, 73 | "nodeParent":2, 74 | "label":"Poly", 75 | "isDirectory":false, 76 | "isAniNode":true, 77 | "hasChild":false, 78 | "compId":6, 79 | "child":[ 80 | ], 81 | "$LOCKED":true 82 | }, 83 | { 84 | "x":30, 85 | "type":"Poly", 86 | "props":{"y":157,"x":39,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#009999"}, 87 | "nodeParent":2, 88 | "label":"Poly", 89 | "isDirectory":false, 90 | "isAniNode":true, 91 | "hasChild":false, 92 | "compId":7, 93 | "child":[ 94 | ], 95 | "$LOCKED":true 96 | }, 97 | { 98 | "x":30, 99 | "type":"Poly", 100 | "props":{"y":193,"x":39,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#cc6600"}, 101 | "nodeParent":2, 102 | "label":"Poly", 103 | "isDirectory":false, 104 | "isAniNode":true, 105 | "hasChild":false, 106 | "compId":8, 107 | "child":[ 108 | ], 109 | "$LOCKED":true 110 | }, 111 | { 112 | "x":30, 113 | "type":"Circle", 114 | "props":{"y":229,"x":39,"radius":10,"lineWidth":1,"fillColor":"#3e221d"}, 115 | "nodeParent":2, 116 | "label":"Circle", 117 | "isDirectory":false, 118 | "isAniNode":true, 119 | "hasChild":false, 120 | "compId":9, 121 | "child":[ 122 | ], 123 | "$LOCKED":true 124 | }, 125 | { 126 | "x":30, 127 | "type":"Label", 128 | "props":{"y":2,"x":59,"text":"追逐","fontSize":20,"color":"#000000"}, 129 | "nodeParent":2, 130 | "label":"Label", 131 | "isDirectory":false, 132 | "isAniNode":true, 133 | "hasChild":false, 134 | "compId":10, 135 | "child":[ 136 | ], 137 | "$LOCKED":true 138 | }, 139 | { 140 | "x":30, 141 | "type":"Poly", 142 | "props":{"y":13,"x":126,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#990099"}, 143 | "nodeParent":2, 144 | "label":"Poly", 145 | "isDirectory":false, 146 | "isAniNode":true, 147 | "hasChild":false, 148 | "compId":11, 149 | "child":[ 150 | ], 151 | "$LOCKED":true 152 | }, 153 | { 154 | "x":30, 155 | "type":"Label", 156 | "props":{"y":2,"x":144,"text":"并躲避","fontSize":20,"color":"#000000"}, 157 | "nodeParent":2, 158 | "label":"Label", 159 | "isDirectory":false, 160 | "isAniNode":true, 161 | "hasChild":false, 162 | "compId":12, 163 | "child":[ 164 | ], 165 | "$LOCKED":true 166 | }, 167 | { 168 | "x":30, 169 | "type":"Poly", 170 | "props":{"y":13,"x":222,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#000099"}, 171 | "nodeParent":2, 172 | "label":"Poly", 173 | "isDirectory":false, 174 | "isAniNode":true, 175 | "hasChild":false, 176 | "compId":13, 177 | "child":[ 178 | ], 179 | "$LOCKED":true 180 | }, 181 | { 182 | "x":30, 183 | "type":"Label", 184 | "props":{"y":38,"x":59,"text":"追逐","fontSize":20,"color":"#000000"}, 185 | "nodeParent":2, 186 | "label":"Label", 187 | "isDirectory":false, 188 | "isAniNode":true, 189 | "hasChild":false, 190 | "compId":14, 191 | "child":[ 192 | ], 193 | "$LOCKED":true 194 | }, 195 | { 196 | "x":30, 197 | "type":"Label", 198 | "props":{"y":38,"x":144,"text":"并躲避","fontSize":20,"color":"#000000"}, 199 | "nodeParent":2, 200 | "label":"Label", 201 | "isDirectory":false, 202 | "isAniNode":true, 203 | "hasChild":false, 204 | "compId":15, 205 | "child":[ 206 | ], 207 | "$LOCKED":true 208 | }, 209 | { 210 | "x":30, 211 | "type":"Label", 212 | "props":{"y":74,"x":59,"text":"追逐","fontSize":20,"color":"#000000"}, 213 | "nodeParent":2, 214 | "label":"Label", 215 | "isDirectory":false, 216 | "isAniNode":true, 217 | "hasChild":false, 218 | "compId":16, 219 | "child":[ 220 | ], 221 | "$LOCKED":true 222 | }, 223 | { 224 | "x":30, 225 | "type":"Label", 226 | "props":{"y":74,"x":144,"text":"并躲避","fontSize":20,"color":"#000000"}, 227 | "nodeParent":2, 228 | "label":"Label", 229 | "isDirectory":false, 230 | "isAniNode":true, 231 | "hasChild":false, 232 | "compId":17, 233 | "child":[ 234 | ], 235 | "$LOCKED":true 236 | }, 237 | { 238 | "x":30, 239 | "type":"Poly", 240 | "props":{"y":49,"x":126,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#000099"}, 241 | "nodeParent":2, 242 | "label":"Poly", 243 | "isDirectory":false, 244 | "isAniNode":true, 245 | "hasChild":false, 246 | "compId":18, 247 | "child":[ 248 | ], 249 | "$LOCKED":true 250 | }, 251 | { 252 | "x":30, 253 | "type":"Poly", 254 | "props":{"y":49,"x":222,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#990000"}, 255 | "nodeParent":2, 256 | "label":"Poly", 257 | "isDirectory":false, 258 | "isAniNode":true, 259 | "hasChild":false, 260 | "compId":19, 261 | "child":[ 262 | ], 263 | "$LOCKED":true 264 | }, 265 | { 266 | "x":30, 267 | "type":"Poly", 268 | "props":{"y":85,"x":126,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#990000"}, 269 | "nodeParent":2, 270 | "label":"Poly", 271 | "isDirectory":false, 272 | "isAniNode":true, 273 | "hasChild":false, 274 | "compId":20, 275 | "child":[ 276 | ], 277 | "$LOCKED":true 278 | }, 279 | { 280 | "x":30, 281 | "type":"Poly", 282 | "props":{"y":85,"x":222,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#990099"}, 283 | "nodeParent":2, 284 | "label":"Poly", 285 | "isDirectory":false, 286 | "isAniNode":true, 287 | "hasChild":false, 288 | "compId":21, 289 | "child":[ 290 | ], 291 | "$LOCKED":true 292 | }, 293 | { 294 | "x":30, 295 | "type":"Label", 296 | "props":{"y":111,"x":59,"text":"沿着玩家点击的过的路线走","fontSize":20,"color":"#000000"}, 297 | "nodeParent":2, 298 | "label":"Label", 299 | "isDirectory":false, 300 | "isAniNode":true, 301 | "hasChild":false, 302 | "compId":22, 303 | "child":[ 304 | ], 305 | "$LOCKED":true 306 | }, 307 | { 308 | "x":30, 309 | "type":"Label", 310 | "props":{"y":146,"x":59,"text":"漫无目的一群漫游者","fontSize":20,"color":"#000000"}, 311 | "nodeParent":2, 312 | "label":"Label", 313 | "isDirectory":false, 314 | "isAniNode":true, 315 | "hasChild":false, 316 | "compId":23, 317 | "child":[ 318 | ], 319 | "$LOCKED":true 320 | }, 321 | { 322 | "x":30, 323 | "type":"Label", 324 | "props":{"y":182,"x":59,"text":"和同色集群行动类似的鱼群","fontSize":20,"color":"#000000"}, 325 | "nodeParent":2, 326 | "label":"Label", 327 | "isDirectory":false, 328 | "isAniNode":true, 329 | "hasChild":false, 330 | "compId":24, 331 | "child":[ 332 | ], 333 | "$LOCKED":true 334 | }, 335 | { 336 | "x":30, 337 | "type":"Label", 338 | "props":{"y":217,"x":59,"text":"所有角色都会躲避的障碍物","fontSize":20,"color":"#000000"}, 339 | "nodeParent":2, 340 | "label":"Label", 341 | "isDirectory":false, 342 | "isAniNode":true, 343 | "hasChild":false, 344 | "compId":25, 345 | "child":[ 346 | ], 347 | "$LOCKED":true 348 | }], 349 | "$LOCKED":true 350 | }], 351 | "animations":[ 352 | { 353 | "nodes":[ 354 | ], 355 | "name":"ani1", 356 | "id":1, 357 | "frameRate":24, 358 | "action":0 359 | }], 360 | "$LOCKED":true 361 | } -------------------------------------------------------------------------------- /src/CRC.js: -------------------------------------------------------------------------------- 1 | console.log("CRC校验算法"); 2 | //数据项 3 | var origin1 = "1101011011"; 4 | var origin:Array = origin1.split(""); 5 | //除数定义4阶多项式 6 | var dist = "10011".split(""); 7 | var n = dist.length; 8 | //需要校验的数据 数据项后补充4个0 9 | origin.push("0"); 10 | origin.push("0"); 11 | origin.push("0"); 12 | origin.push("0"); 13 | //设计反转器 14 | var fz = []; 15 | for(var k = 0;k < n;k++){ 16 | if(k != 0 && dist[k] == "1") fz.push(true); 17 | else fz.push(false); 18 | } 19 | //最终的输出CRC 20 | var out = []; 21 | for(var i = 0;i < origin.length;i++){ 22 | var b = origin[i]; 23 | if(i >= n){ 24 | //下一步更新 25 | if(out[0] == "1"){ 26 | for(var f = 0;f < n;f++){ 27 | if(fz[f]){ 28 | //需要变的 29 | if(out[f] == "0"){ 30 | origin[i - n + f] = "1"; 31 | out[f] = "1"; 32 | }else{ 33 | origin[i - n + f] = "0"; 34 | out[f] = "0"; 35 | } 36 | } 37 | } 38 | } 39 | //删除第一个 40 | out.shift(); 41 | //从尾部注意加一个 42 | out.push(b); 43 | }else{ 44 | out.push(b); 45 | } 46 | } 47 | var result = origin1 + out.join("").substr(-4,4); 48 | console.log(result); -------------------------------------------------------------------------------- /src/Circle.js: -------------------------------------------------------------------------------- 1 | 2 | var Circle = function(_super) { 3 | function Circle(radius, color) { 4 | 5 | Circle.__super.call(this); 6 | void 0 === color && (color = "000000"); 7 | this._radius = radius; 8 | this._color = color; 9 | this.graphics.drawCircle(0, 0, this._radius, this._color); 10 | } 11 | Laya.class(Circle,"src.circle",_super); 12 | var _proto_ = Circle.prototype; 13 | 14 | Object.defineProperty(_proto_, "radius", { 15 | get: function() { 16 | return this._radius 17 | }, 18 | enumerable: true, 19 | configurable: true 20 | }); 21 | 22 | Object.defineProperty(_proto_, "position", { 23 | get: function() { 24 | return new Vector2D(this.x,this.y) 25 | }, 26 | enumerable: true, 27 | configurable: true 28 | }); 29 | return Circle; 30 | }(Laya.Sprite); -------------------------------------------------------------------------------- /src/GameMain.js: -------------------------------------------------------------------------------- 1 | var GameMain = (function(){ 2 | function GameMain() { 3 | Laya.init(1280, 720,true); 4 | Laya.ResourceManager.systemResourceManager.autoRelease = false; 5 | Laya.stage.scaleMode = Laya.Stage.SCALE_FIXED_HEIGHT; 6 | Laya.stage.screenMode = Laya.Stage.SCREEN_HORIZONTAL; 7 | Laya.stage.alignV = Laya.Stage.ALIGN_CENTER; 8 | Laya.stage.alignH = Laya.Stage.ALIGN_CENTER; 9 | Laya.stage.bgColor = "#000000"; 10 | Laya.stage.frameRate = Laya.Stage.FRAME_FAST; 11 | 12 | var view = new MainView(); 13 | view.graphics.drawRect(0, 0, view.width, view.height, "#ffddcc"); 14 | Laya.stage.addChild(view); 15 | 16 | } 17 | Laya.class(GameMain,"src.GameMain"); 18 | 19 | return GameMain; 20 | })(); 21 | new GameMain(); -------------------------------------------------------------------------------- /src/MainView.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | var MainView = function(_super) { 4 | function MainView() { 5 | MainView.__super.call(this); 6 | 7 | this._vehicleA = new SteeredVehicle(); 8 | this.addChild(this._vehicleA); 9 | this._vehicleA.draw("#990000"); 10 | 11 | this._vehicleB = new SteeredVehicle(); 12 | this.addChild(this._vehicleB); 13 | this._vehicleB.draw("#990099"); 14 | 15 | this._vehicleC = new SteeredVehicle(); 16 | this.addChild(this._vehicleC); 17 | this._vehicleC.draw("#000099"); 18 | 19 | 20 | this._vehicleD = new SteeredVehicle(); 21 | this.addChild(this._vehicleD); 22 | this._vehicleD.draw("#009900"); 23 | 24 | 25 | this._vehicleA.position = new Vector2D(400,400), 26 | this._vehicleA.velocity.length = 1, 27 | this._vehicleA.edgeBehavior = Vehicle.BOUNCE; 28 | 29 | 30 | this._vehicleB.position = new Vector2D(400,200), 31 | this._vehicleB.velocity.length = 1, 32 | this._vehicleB.edgeBehavior = Vehicle.BOUNCE, 33 | 34 | this._vehicleC.position = new Vector2D(800,300), 35 | this._vehicleC.velocity.length = 1, 36 | this._vehicleC.velocity.angle = Math.PI / 3, 37 | this._vehicleC.edgeBehavior = Vehicle.BOUNCE, 38 | 39 | this._vehicleD.position = new Vector2D(200,300), 40 | this._vehicleD.maxSpeed = 10, 41 | this._vehicleD.edgeBehavior = Vehicle.BOUNCE, 42 | 43 | this._circles = []; 44 | for (var h = 0; h < 4; h++) { 45 | var t = new Circle(30 * Math.random() + 20,"#3e221d"); 46 | t.x = this.width / 2 + Math.random() * this.width / 2; 47 | t.y = Math.random() * this.height; 48 | this.addChild(t); 49 | this._circles.push(t); 50 | } 51 | 52 | this._wanders = []; 53 | for (var c = 0; c < 10; c++) { 54 | (o = new SteeredVehicle).edgeBehavior = Vehicle.BOUNCE, 55 | o.x = Math.random() * this.width; 56 | o.y = Math.random() * this.height; 57 | this.addChild(o); 58 | this._wanders.push(o); 59 | } 60 | 61 | 62 | this._flocks = []; 63 | for (var s = 0; s < 10; s++) { 64 | var o = new SteeredVehicle(); 65 | o.edgeBehavior = Vehicle.BOUNCE; 66 | o.draw("#cc6600"); 67 | o.x = Math.random() * this.width; 68 | o.y = Math.random() * this.height; 69 | this.addChild(o); 70 | this._flocks.push(o); 71 | } 72 | 73 | //跟随的路径 74 | this._path = []; 75 | 76 | this.on("click", this, this.onClick); 77 | Laya.timer.frameLoop(1, this, this.onLoop); 78 | } 79 | Laya.class(MainView,"src.MainView",_super); 80 | var _proto_ = MainView.prototype; 81 | 82 | _proto_.onClick = function() { 83 | 84 | this.graphics.drawCircle(this.mouseX, this.mouseY, 10, "#3e221d"); 85 | if(0 != this._path.length){ 86 | var p = this._path[this._path.length - 1]; 87 | this.graphics.drawLine(p.x, p.y, this.mouseX, this.mouseY, "#e3beae", 2); 88 | } 89 | this._path.push(new Vector2D(this.mouseX,this.mouseY)); 90 | } 91 | 92 | _proto_.onLoop = function() { 93 | 94 | this._vehicleA.seek(this._vehicleB.position); 95 | this._vehicleA.flee(this._vehicleC.position); 96 | this._vehicleA.avoid(this._circles); 97 | this._vehicleA.update(); 98 | 99 | 100 | this._vehicleB.seek(this._vehicleC.position); 101 | this._vehicleB.flee(this._vehicleA.position); 102 | this._vehicleB.avoid(this._circles); 103 | this._vehicleB.update(); 104 | 105 | 106 | this._vehicleC.seek(this._vehicleA.position); 107 | this._vehicleC.flee(this._vehicleB.position); 108 | this._vehicleC.avoid(this._circles); 109 | this._vehicleC.update(); 110 | 111 | // 112 | for (var i = 0; i < this._wanders.length; i++){ 113 | this._wanders[i].wander(); 114 | this._wanders[i].avoid(this._circles); 115 | this._wanders[i].update(); 116 | } 117 | 118 | // 119 | for (var h = 0; h < this._flocks.length; h++){ 120 | this._flocks[h].flock(this._flocks); 121 | this._flocks[h].avoid(this._circles); 122 | this._flocks[h].update(); 123 | } 124 | 125 | //跟随 126 | this._vehicleD.followPath(this._path,true); 127 | this._vehicleD.update(); 128 | } 129 | 130 | return MainView; 131 | }(MainViewUI); -------------------------------------------------------------------------------- /src/SteeredVehicle.js: -------------------------------------------------------------------------------- 1 | 2 | var SteeredVehicle = function(_super) { 3 | function SteeredVehicle() { 4 | 5 | SteeredVehicle.__super.call(this); 6 | this._maxForce = 1; 7 | this._arrivalThreshold = 100; 8 | this._wanderAngle = 0; 9 | this._wanderDistance = 10; 10 | this._wanderRadius = 5; 11 | this._wanderRange = 1; 12 | this._avoidDistance = 300; 13 | this._avoidBuffer = 20; 14 | this._inSightDist = 200; 15 | this._tooCloseDist = 60; 16 | this._pathIndex = 0; 17 | this._pathThreshold = 20; 18 | this._steeringForce = new Vector2D(); 19 | } 20 | Laya.class(SteeredVehicle,"src.SteeredVehicle",_super); 21 | var _proto_ = SteeredVehicle.prototype; 22 | 23 | Object.defineProperty(_proto_, "maxForce", { 24 | get: function() { 25 | return this._maxForce 26 | }, 27 | set: function(e) { 28 | this._maxForce = e 29 | }, 30 | enumerable: true, 31 | configurable: true 32 | }); 33 | 34 | Object.defineProperty(_proto_, "arriveThreshold", { 35 | get: function() { 36 | return this._arrivalThreshold 37 | }, 38 | set: function(t) { 39 | this._arrivalThreshold = t 40 | }, 41 | enumerable: true, 42 | configurable: true 43 | }); 44 | 45 | Object.defineProperty(_proto_, "wanderDistance", { 46 | get: function() { 47 | return this._wanderDistance 48 | }, 49 | set: function(t) { 50 | this._wanderDistance = t 51 | }, 52 | enumerable: true, 53 | configurable: true 54 | }); 55 | 56 | Object.defineProperty(_proto_, "wanderRadius", { 57 | get: function() { 58 | return this._wanderRadius 59 | }, 60 | set: function(t) { 61 | this._wanderRadius = t 62 | }, 63 | enumerable: true, 64 | configurable: true 65 | }); 66 | 67 | Object.defineProperty(_proto_, "wanderRange", { 68 | get: function() { 69 | return this._wanderRange 70 | }, 71 | set: function(t) { 72 | this._wanderRange = t 73 | }, 74 | enumerable: true, 75 | configurable: true 76 | }); 77 | 78 | Object.defineProperty(_proto_, "avoidDistance", { 79 | get: function() { 80 | return this._avoidDistance 81 | }, 82 | set: function(t) { 83 | this._avoidDistance = t 84 | }, 85 | enumerable: true, 86 | configurable: true 87 | }); 88 | 89 | Object.defineProperty(_proto_, "avoidBuffer", { 90 | get: function() { 91 | return this._avoidBuffer 92 | }, 93 | set: function(t) { 94 | this._avoidBuffer = t 95 | }, 96 | enumerable: true, 97 | configurable: true 98 | }); 99 | 100 | Object.defineProperty(_proto_, "pathIndex", { 101 | get: function() { 102 | return this._pathIndex 103 | }, 104 | set: function(t) { 105 | this._pathIndex = t 106 | }, 107 | enumerable: true, 108 | configurable: true 109 | }); 110 | 111 | Object.defineProperty(_proto_, "pathThreshold", { 112 | get: function() { 113 | return this._pathThreshold 114 | }, 115 | set: function(t) { 116 | this._pathThreshold = t 117 | }, 118 | enumerable: true, 119 | configurable: true 120 | }); 121 | 122 | Object.defineProperty(_proto_, "inSightDist", { 123 | get: function() { 124 | return this._inSightDist 125 | }, 126 | set: function(t) { 127 | this._inSightDist = t 128 | }, 129 | enumerable: true, 130 | configurable: true 131 | }); 132 | 133 | Object.defineProperty(_proto_, "tooCloseDist", { 134 | get: function() { 135 | return this._tooCloseDist 136 | }, 137 | set: function(t) { 138 | this._tooCloseDist = t 139 | }, 140 | enumerable: true, 141 | configurable: true 142 | }); 143 | 144 | _proto_.update = function() { 145 | this._steeringForce.truncate(this._maxForce); 146 | this._steeringForce = this._steeringForce.divide(this._mass); 147 | this._velocity = this._velocity.add(this._steeringForce); 148 | this._steeringForce = new Vector2D(); 149 | //基类调用 150 | Vehicle.prototype.update.call(this); 151 | } 152 | 153 | _proto_.seek = function(t) { 154 | var e = t.subtract(this._position); 155 | e.normalize(); 156 | var i = (e = e.multiply(this._maxSpeed)).subtract(this._velocity); 157 | this._steeringForce = this._steeringForce.add(i); 158 | } 159 | 160 | _proto_.flee = function(t) { 161 | var e = t.subtract(this._position); 162 | e.normalize(); 163 | var i = (e = e.multiply(this._maxSpeed)).subtract(this._velocity); 164 | this._steeringForce = this._steeringForce.subtract(i) 165 | } 166 | 167 | _proto_.arrive = function(t) { 168 | var e = t.subtract(this._position); 169 | e.normalize(); 170 | var i = this._position.dist(t) 171 | , o = (e = i > this._arrivalThreshold ? e.multiply(this._maxSpeed) : e.multiply(this._maxSpeed * i / this._arrivalThreshold)).subtract(this._velocity); 172 | this._steeringForce = this._steeringForce.add(o) 173 | } 174 | 175 | _proto_.pursue = function(t) { 176 | var e = this.position.dist(t.position) / this._maxSpeed 177 | , i = t.position.add(t.velocity.multiply(e)); 178 | this.seek(i) 179 | } 180 | 181 | _proto_.evade = function(t) { 182 | var e = this.position.dist(t.position) / this._maxSpeed 183 | , i = t.position.subtract(t.velocity.multiply(e)); 184 | this.flee(i) 185 | } 186 | 187 | _proto_.wander = function() { 188 | var t = this.velocity.clone().normalize().multiply(this._wanderDistance) 189 | , e = new Vector2D(0); 190 | e.length = this._wanderRadius, 191 | e.angle = this._wanderAngle, 192 | this._wanderAngle += Math.random() * this._wanderRange - .5 * this._wanderRange; 193 | var i = t.add(e); 194 | this._steeringForce = this._steeringForce.add(i) 195 | } 196 | 197 | _proto_.avoid = function(t) { 198 | for (var e = 0; e < t.length; e++) { 199 | var i = t[e] 200 | , o = this._velocity.clone().normalize() 201 | , n = i.position.subtract(this._position) 202 | , r = n.dotProd(o); 203 | if (r > 0) { 204 | var s = o.multiply(this._avoidDistance) 205 | , a = o.multiply(r); 206 | if (a.subtract(n).length < i.radius + this._avoidBuffer && a.length < s.length) { 207 | var h = o.multiply(this._maxSpeed); 208 | h.angle += n.sign(this._velocity) * Math.PI / 2; 209 | var c = a.length / s.length; 210 | h = h.multiply(1 - c), 211 | this._steeringForce = this._steeringForce.add(h), 212 | this._velocity = this._velocity.multiply(c) 213 | } 214 | } 215 | } 216 | } 217 | 218 | _proto_.followPath = function(t, e) { 219 | void 0 === e && (e = !1); 220 | var i = t[this._pathIndex]; 221 | null != i && (this._position.dist(i) < this._pathThreshold && (this._pathIndex >= t.length - 1 ? e && (this._pathIndex = 0) : this._pathIndex++), 222 | this._pathIndex >= t.length - 1 && !e ? this.arrive(i) : this.seek(i)) 223 | } 224 | 225 | _proto_.flock = function(t) { 226 | for (var e = this._velocity.clone(), i = new Vector2D, o = 0, n = 0; n < t.length; n++) { 227 | var r = t[n]; 228 | r != this && this.inSight(r) && (e = e.add(r.velocity), 229 | i = i.add(r.position), 230 | this.tooClose(r) && this.flee(r.position), 231 | o++) 232 | } 233 | o > 0 && (e = e.divide(o), 234 | i = i.divide(o), 235 | this.seek(i), 236 | this._steeringForce.add(e.subtract(this._velocity))) 237 | } 238 | 239 | _proto_.inSight = function(t) { 240 | if (this._position.dist(t.position) > this._inSightDist) 241 | return false; 242 | var e = this._velocity.clone().normalize(); 243 | return !(t.position.subtract(this._position).dotProd(e) < 0); 244 | } 245 | 246 | _proto_.tooClose = function(t) { 247 | return this._position.dist(t.position) < this._tooCloseDist 248 | } 249 | 250 | return SteeredVehicle; 251 | }(Vehicle); -------------------------------------------------------------------------------- /src/Vector2D.js: -------------------------------------------------------------------------------- 1 | var Vector2D = function() { 2 | 3 | function Vector2D(x, y) { 4 | void 0 === x && (x = 0); 5 | void 0 === y && (y = 0); 6 | this._x = x; 7 | this._y = y; 8 | } 9 | Laya.class(Vector2D,"src.Vector2D"); 10 | var _proto_ = Vector2D.prototype; 11 | 12 | Object.defineProperty(_proto_, "length", { 13 | get: function() { 14 | return Math.sqrt(this.lengthSQ) 15 | }, 16 | set: function(t) { 17 | var e = this.angle; 18 | this._x = Math.cos(e) * t; 19 | this._y = Math.sin(e) * t; 20 | }, 21 | enumerable: true, 22 | configurable: true 23 | }); 24 | 25 | Object.defineProperty(_proto_, "lengthSQ", { 26 | get: function() { 27 | return this._x * this._x + this._y * this._y; 28 | }, 29 | enumerable: true, 30 | configurable: true 31 | }); 32 | 33 | Object.defineProperty(_proto_, "angle", { 34 | get: function() { 35 | return Math.atan2(this._y, this._x) 36 | }, 37 | set: function(t) { 38 | var e = this.length; 39 | this._x = Math.cos(t) * e, 40 | this._y = Math.sin(t) * e 41 | }, 42 | enumerable: true, 43 | configurable: true 44 | }); 45 | 46 | Object.defineProperty(_proto_, "perp", { 47 | get: function() { 48 | return new Vector2D(-this.y,this.x); 49 | }, 50 | enumerable: true, 51 | configurable: true 52 | }); 53 | 54 | Object.defineProperty(_proto_, "x", { 55 | get: function() { 56 | return this._x 57 | }, 58 | set: function(t) { 59 | this._x = t 60 | }, 61 | enumerable: true, 62 | configurable: true 63 | }); 64 | 65 | Object.defineProperty(_proto_, "y", { 66 | get: function() { 67 | return this._y 68 | }, 69 | set: function(t) { 70 | this._y = t 71 | }, 72 | enumerable: true, 73 | configurable: true 74 | }); 75 | 76 | _proto_.draw = function(t,color) { 77 | void 0 === color && (color = "000000"); 78 | t.drawLine(0, 0, this._x, this._y, color); 79 | } 80 | 81 | _proto_.clone = function() { 82 | return new Vector2D(this.x,this.y); 83 | } 84 | 85 | _proto_.zero = function() { 86 | this._x = 0; 87 | this._y = 0; 88 | return this; 89 | } 90 | 91 | _proto_.isZero = function() { 92 | return 0 == this._x && 0 == this._y; 93 | } 94 | 95 | _proto_.normalize = function() { 96 | if (0 == this.length) { 97 | this._x = 1; 98 | return this; 99 | } 100 | var t = this.length; 101 | this._x /= t; 102 | this._y /= t; 103 | return this; 104 | } 105 | 106 | _proto_.truncate = function(t) { 107 | this.length = Math.min(t, this.length); 108 | return this; 109 | } 110 | 111 | _proto_.reverse = function() { 112 | this._x = -this._x; 113 | this._y = -this._y; 114 | return this; 115 | } 116 | 117 | _proto_.isNormalized = function() { 118 | return 1 == this.length; 119 | } 120 | 121 | _proto_.dotProd = function(t) { 122 | return this._x * t.x + this._y * t.y; 123 | } 124 | 125 | _proto_.crossProd = function(t) { 126 | return this._x * t.y - this._y * t.x; 127 | } 128 | 129 | _proto_.angleBetween = function(t, e) { 130 | if(t.isNormalized() || (t = t.clone().normalize()) || 131 | e.isNormalized() || (e = e.clone().normalize())){ 132 | return Math.acos(t.dotProd(e)); 133 | } 134 | } 135 | 136 | _proto_.sign = function(t) { 137 | return this.perp.dotProd(t) < 0 ? -1 : 1; 138 | } 139 | 140 | _proto_.dist = function(t) { 141 | return Math.sqrt(this.distSQ(t)); 142 | } 143 | 144 | _proto_.distSQ = function(t) { 145 | var e = t.x - this.x 146 | , n = t.y - this.y; 147 | return e * e + n * n; 148 | } 149 | 150 | _proto_.add = function(e) { 151 | return new Vector2D(this._x + e.x,this._y + e.y); 152 | } 153 | 154 | _proto_.subtract = function(e) { 155 | return new Vector2D(this._x - e.x,this._y - e.y); 156 | } 157 | 158 | _proto_.multiply = function(e) { 159 | return new Vector2D(this._x * e,this._y * e); 160 | } 161 | 162 | _proto_.divide = function(e) { 163 | return new Vector2D(this._x / e,this._y / e); 164 | } 165 | 166 | _proto_.equals = function(t) { 167 | return this._x == t.x && this._y == t.y; 168 | } 169 | 170 | _proto_.toString = function() { 171 | return "[Vector2D(x:" + this._x + ",y:" + this._y + ")]"; 172 | } 173 | 174 | return Vector2D; 175 | }(); -------------------------------------------------------------------------------- /src/Vehicle.js: -------------------------------------------------------------------------------- 1 | 2 | var Vehicle = function(_super) { 3 | 4 | Vehicle.WRAP = "wrap"; 5 | Vehicle.BOUNCE = "bounce"; 6 | 7 | function Vehicle() { 8 | Vehicle.__super.call(this); 9 | this._edgeBehavior = Vehicle.WRAP; 10 | this._mass = 1; 11 | this._maxSpeed = 5; 12 | this._position = new Vector2D(); 13 | this._velocity = new Vector2D(); 14 | this.draw(); 15 | } 16 | Laya.class(Vehicle,"src.Vehicle",_super); 17 | var _proto_ = Vehicle.prototype; 18 | _proto_.draw = function(t) { 19 | if(t === void 0) t = "#009999"; 20 | this.graphics.clear(); 21 | this.graphics.drawPoly(10, 0, [-10, 5, -10, -5, 10, 0], t); 22 | } 23 | 24 | _proto_.update = function() { 25 | this._velocity.truncate(this._maxSpeed); 26 | this._position = this._position.add(this._velocity); 27 | this._edgeBehavior == Vehicle.WRAP ? this.wrap() : this._edgeBehavior == Vehicle.BOUNCE && this.bounce(); 28 | this.x = this.position.x; 29 | this.y = this.position.y; 30 | this.rotation = 180 * this._velocity.angle / Math.PI; 31 | } 32 | 33 | _proto_.bounce = function() { 34 | null != this.stage && (this.position.x > this.stage.width ? (this.position.x = this.stage.width, 35 | this.velocity.x *= -1) : this.position.x < 0 && (this.position.x = 0, 36 | this.velocity.x *= -1), 37 | this.position.y > this.stage.height ? (this.position.y = this.stage.height, 38 | this.velocity.y *= -1) : this.position.y < 0 && (this.position.y = 0, 39 | this.velocity.y *= -1)) 40 | } 41 | 42 | _proto_.wrap = function() { 43 | null != this.stage && (this.position.x > this.stage.width && (this.position.x = 0), 44 | this.position.x < 0 && (this.position.x = this.stage.width), 45 | this.position.y > this.stage.height && (this.position.y = 0), 46 | this.position.y < 0 && (this.position.y = this.stage.height)) 47 | } 48 | 49 | Object.defineProperty(_proto_, "edgeBehavior", { 50 | get: function() { 51 | return this._edgeBehavior 52 | }, 53 | set: function(t) { 54 | this._edgeBehavior = t 55 | }, 56 | enumerable: true, 57 | configurable: true 58 | }); 59 | 60 | Object.defineProperty(_proto_, "mass", { 61 | get: function() { 62 | return this._mass 63 | }, 64 | set: function(t) { 65 | this._mass = t 66 | }, 67 | enumerable: true, 68 | configurable: true 69 | }); 70 | 71 | Object.defineProperty(_proto_, "maxSpeed", { 72 | get: function() { 73 | return this._maxSpeed 74 | }, 75 | set: function(t) { 76 | this._maxSpeed = t 77 | }, 78 | enumerable: true, 79 | configurable: true 80 | }); 81 | 82 | Object.defineProperty(_proto_, "position", { 83 | get: function() { 84 | return this._position 85 | }, 86 | set: function(t) { 87 | this._position = t, 88 | this.x = this._position.x, 89 | this.y = this._position.y 90 | }, 91 | enumerable: true, 92 | configurable: true 93 | }); 94 | 95 | Object.defineProperty(_proto_, "velocity", { 96 | get: function() { 97 | return this._velocity 98 | }, 99 | set: function(t) { 100 | this._velocity = t 101 | }, 102 | enumerable: true, 103 | configurable: true 104 | }); 105 | 106 | Object.defineProperty(_proto_, "x", { 107 | set: function(t) { 108 | this._x = t, 109 | this._position.x = this._x 110 | }, 111 | enumerable: !0, 112 | configurable: !0 113 | }); 114 | 115 | Object.defineProperty(_proto_, "y", { 116 | set: function(t) { 117 | this._y = t, 118 | this._position.y = this._y 119 | }, 120 | enumerable: true, 121 | configurable: true 122 | }); 123 | 124 | return Vehicle; 125 | }(Laya.Sprite); -------------------------------------------------------------------------------- /src/ui/layaUI.max.all.js: -------------------------------------------------------------------------------- 1 | var CLASS$=Laya.class; 2 | var STATICATTR$=Laya.static; 3 | var View=laya.ui.View; 4 | var Dialog=laya.ui.Dialog; 5 | var MainViewUI=(function(_super){ 6 | function MainViewUI(){ 7 | 8 | this.specification=null; 9 | 10 | MainViewUI.__super.call(this); 11 | } 12 | 13 | CLASS$(MainViewUI,'ui.MainViewUI',_super); 14 | var __proto__=MainViewUI.prototype; 15 | __proto__.createChildren=function(){ 16 | 17 | laya.ui.Component.prototype.createChildren.call(this); 18 | this.createView(MainViewUI.uiView); 19 | 20 | } 21 | 22 | MainViewUI.uiView={"type":"View","props":{"width":1280,"height":720},"child":[{"type":"Box","props":{"y":442,"x":144,"width":298,"var":"specification","height":278},"child":[{"type":"Poly","props":{"y":13,"x":39,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#990000"}},{"type":"Poly","props":{"y":49,"x":39,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#990099"}},{"type":"Poly","props":{"y":85,"x":39,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#000099"}},{"type":"Poly","props":{"y":121,"x":39,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#009900"}},{"type":"Poly","props":{"y":157,"x":39,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#009999"}},{"type":"Poly","props":{"y":193,"x":39,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#cc6600"}},{"type":"Circle","props":{"y":229,"x":39,"radius":10,"lineWidth":1,"fillColor":"#3e221d"}},{"type":"Label","props":{"y":2,"x":59,"text":"追逐","fontSize":20,"color":"#000000"}},{"type":"Poly","props":{"y":13,"x":126,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#990099"}},{"type":"Label","props":{"y":2,"x":144,"text":"并躲避","fontSize":20,"color":"#000000"}},{"type":"Poly","props":{"y":13,"x":222,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#000099"}},{"type":"Label","props":{"y":38,"x":59,"text":"追逐","fontSize":20,"color":"#000000"}},{"type":"Label","props":{"y":38,"x":144,"text":"并躲避","fontSize":20,"color":"#000000"}},{"type":"Label","props":{"y":74,"x":59,"text":"追逐","fontSize":20,"color":"#000000"}},{"type":"Label","props":{"y":74,"x":144,"text":"并躲避","fontSize":20,"color":"#000000"}},{"type":"Poly","props":{"y":49,"x":126,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#000099"}},{"type":"Poly","props":{"y":49,"x":222,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#990000"}},{"type":"Poly","props":{"y":85,"x":126,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#990000"}},{"type":"Poly","props":{"y":85,"x":222,"points":"10,0,-10,5,-10,-5,10,0","lineWidth":1,"lineColor":"#ff0000","fillColor":"#990099"}},{"type":"Label","props":{"y":111,"x":59,"text":"沿着玩家点击的过的路线走","fontSize":20,"color":"#000000"}},{"type":"Label","props":{"y":146,"x":59,"text":"漫无目的一群漫游者","fontSize":20,"color":"#000000"}},{"type":"Label","props":{"y":182,"x":59,"text":"和同色集群行动类似的鱼群","fontSize":20,"color":"#000000"}},{"type":"Label","props":{"y":217,"x":59,"text":"所有角色都会躲避的障碍物","fontSize":20,"color":"#000000"}}]}]}; 23 | return MainViewUI; 24 | })(View); --------------------------------------------------------------------------------