From d5b006beb7f008468dbecad07364c2a76d478d92 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 1 Feb 2019 20:16:23 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0listView=E4=B8=ADaddData?= =?UTF-8?q?=E7=9A=84=E5=8A=A8=E6=80=81=E5=8A=A0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ListViewJsDemo/assets/ListItem.prefab.meta | 1 + ListViewJsDemo/assets/Scene/helloworld.fire | 844 +++++++++++++----- ListViewJsDemo/assets/Script/HelloWorld.js | 14 +- ListViewJsDemo/assets/Script/ListAdapter.js | 75 +- ListViewJsDemo/assets/Script/ListView.js | 19 +- .../assets/Texture/HelloWorld.png.meta | 3 +- .../assets/Texture/singleColor.png.meta | 3 +- ListViewJsDemo/assets/resources.meta | 7 - ListViewJsDemo/settings/project.json | 11 + 9 files changed, 698 insertions(+), 279 deletions(-) delete mode 100644 ListViewJsDemo/assets/resources.meta diff --git a/ListViewJsDemo/assets/ListItem.prefab.meta b/ListViewJsDemo/assets/ListItem.prefab.meta index 0f4818d..f292b22 100644 --- a/ListViewJsDemo/assets/ListItem.prefab.meta +++ b/ListViewJsDemo/assets/ListItem.prefab.meta @@ -1,6 +1,7 @@ { "ver": "1.0.0", "uuid": "ee8a03a3-1f23-464b-abf1-1800df851e7e", + "optimizationPolicy": "AUTO", "asyncLoadAssets": false, "subMetas": {} } \ No newline at end of file diff --git a/ListViewJsDemo/assets/Scene/helloworld.fire b/ListViewJsDemo/assets/Scene/helloworld.fire index 66da3ac..8becad6 100644 --- a/ListViewJsDemo/assets/Scene/helloworld.fire +++ b/ListViewJsDemo/assets/Scene/helloworld.fire @@ -3,7 +3,7 @@ "__type__": "cc.SceneAsset", "_name": "", "_objFlags": 0, - "_rawFiles": null, + "_native": "", "scene": { "__id__": 1 } @@ -17,11 +17,10 @@ "__id__": 2 } ], - "_tag": -1, "_active": true, + "_level": 0, "_components": [], "_prefab": null, - "_id": "2d2f792f-a40c-49bb-a189-ed176a246e49", "_opacity": 255, "_color": { "__type__": "cc.Color", @@ -30,22 +29,33 @@ "b": 255, "a": 255 }, - "_cascadeOpacityEnabled": true, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, "_contentSize": { "__type__": "cc.Size", "width": 0, "height": 0 }, - "_localZOrder": 0, - "_globalZOrder": 0, - "_opacityModifyRGB": false, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1.362626859810511, + "y": 1.362626859810511, + "z": 1 + }, + "_quat": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_zIndex": 0, "groupIndex": 0, - "autoReleaseAssets": false + "autoReleaseAssets": false, + "_id": "2d2f792f-a40c-49bb-a189-ed176a246e49" }, { "__type__": "cc.Node", @@ -66,20 +76,22 @@ }, { "__id__": 21 - } - ], - "_tag": -1, - "_active": true, - "_components": [ - { - "__id__": 23 }, { - "__id__": 24 + "__id__": 23 + } + ], + "_active": true, + "_level": 0, + "_components": [ + { + "__id__": 29 + }, + { + "__id__": 30 } ], "_prefab": null, - "_id": "11wMPoqhJINqIuX6w96Z7P", "_opacity": 255, "_color": { "__type__": "cc.Color", @@ -88,32 +100,42 @@ "b": 255, "a": 255 }, - "_cascadeOpacityEnabled": true, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, "_contentSize": { "__type__": "cc.Size", "width": 720, "height": 1280 }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_position": { + "__type__": "cc.Vec3", + "x": 360, + "y": 640, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, "_rotationX": 0, "_rotationY": 0, - "_scaleX": 1, - "_scaleY": 1, - "_position": { - "__type__": "cc.Vec2", - "x": 360, - "y": 640 + "_quat": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 }, "_skewX": 0, "_skewY": 0, - "_localZOrder": 0, - "_globalZOrder": 0, - "_opacityModifyRGB": false, - "groupIndex": 0 + "_zIndex": 0, + "groupIndex": 0, + "_id": "11wMPoqhJINqIuX6w96Z7P" }, { "__type__": "cc.Node", @@ -123,15 +145,14 @@ "__id__": 2 }, "_children": [], - "_tag": -1, "_active": true, + "_level": 0, "_components": [ { "__id__": 4 } ], "_prefab": null, - "_id": "9da87m0elFIpzRq8FRD/e2", "_opacity": 255, "_color": { "__type__": "cc.Color", @@ -140,32 +161,42 @@ "b": 255, "a": 255 }, - "_cascadeOpacityEnabled": true, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, "_contentSize": { "__type__": "cc.Size", "width": 0, "height": 0 }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_position": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, "_rotationX": 0, "_rotationY": 0, - "_scaleX": 1, - "_scaleY": 1, - "_position": { - "__type__": "cc.Vec2", + "_quat": { + "__type__": "cc.Quat", "x": 0, - "y": 0 + "y": 0, + "z": 0, + "w": 1 }, "_skewX": 0, "_skewY": 0, - "_localZOrder": 0, - "_globalZOrder": 0, - "_opacityModifyRGB": false, - "groupIndex": 0 + "_zIndex": 0, + "groupIndex": 0, + "_id": "9da87m0elFIpzRq8FRD/e2" }, { "__type__": "cc.Camera", @@ -175,8 +206,19 @@ "__id__": 3 }, "_enabled": true, - "_targets": [], - "zoomRatio": 1 + "_cullingMask": 4294967295, + "_clearFlags": 6, + "_backgroundColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_depth": 0, + "_zoomRatio": 1, + "_targetTexture": null, + "_id": "c48oFHI9xMCaNUjEWdXvww" }, { "__type__": "cc.Node", @@ -186,8 +228,8 @@ "__id__": 2 }, "_children": [], - "_tag": -1, "_active": true, + "_level": 0, "_components": [ { "__id__": 6 @@ -197,7 +239,6 @@ } ], "_prefab": null, - "_id": "1aQ09HRqdARaEPgtSNfkss", "_opacity": 255, "_color": { "__type__": "cc.Color", @@ -206,32 +247,42 @@ "b": 114, "a": 255 }, - "_cascadeOpacityEnabled": true, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, "_contentSize": { "__type__": "cc.Size", "width": 720, "height": 1280 }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_position": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, "_rotationX": 0, "_rotationY": 0, - "_scaleX": 1, - "_scaleY": 1, - "_position": { - "__type__": "cc.Vec2", + "_quat": { + "__type__": "cc.Quat", "x": 0, - "y": 0 + "y": 0, + "z": 0, + "w": 1 }, "_skewX": 0, "_skewY": 0, - "_localZOrder": 0, - "_globalZOrder": 0, - "_opacityModifyRGB": false, - "groupIndex": 0 + "_zIndex": 0, + "groupIndex": 0, + "_id": "1aQ09HRqdARaEPgtSNfkss" }, { "__type__": "cc.Sprite", @@ -241,6 +292,8 @@ "__id__": 5 }, "_enabled": true, + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, "_spriteFrame": { "__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91" }, @@ -255,9 +308,9 @@ "_fillStart": 0, "_fillRange": 0, "_isTrimmedMode": true, - "_srcBlendFactor": 770, - "_dstBlendFactor": 771, - "_atlas": null + "_state": 0, + "_atlas": null, + "_id": "abPQHT5uxMgLe6PajArIHp" }, { "__type__": "cc.Widget", @@ -267,7 +320,7 @@ "__id__": 5 }, "_enabled": true, - "isAlignOnce": true, + "alignMode": 0, "_target": null, "_alignFlags": 45, "_left": 0, @@ -283,7 +336,8 @@ "_isAbsHorizontalCenter": true, "_isAbsVerticalCenter": true, "_originalWidth": 100, - "_originalHeight": 100 + "_originalHeight": 100, + "_id": "6c5Qx+D6dKOaQBsA5dT0oC" }, { "__type__": "cc.Node", @@ -297,15 +351,14 @@ "__id__": 9 } ], - "_tag": -1, "_active": true, + "_level": 0, "_components": [ { "__id__": 20 } ], "_prefab": null, - "_id": "9c3kutx0dFaIOjULjZcGey", "_opacity": 255, "_color": { "__type__": "cc.Color", @@ -314,32 +367,42 @@ "b": 255, "a": 255 }, - "_cascadeOpacityEnabled": true, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, "_contentSize": { "__type__": "cc.Size", "width": 0, "height": 0 }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_position": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, "_rotationX": 0, "_rotationY": 0, - "_scaleX": 1, - "_scaleY": 1, - "_position": { - "__type__": "cc.Vec2", + "_quat": { + "__type__": "cc.Quat", "x": 0, - "y": 0 + "y": 0, + "z": 0, + "w": 1 }, "_skewX": 0, "_skewY": 0, - "_localZOrder": 0, - "_globalZOrder": 0, - "_opacityModifyRGB": false, - "groupIndex": 0 + "_zIndex": 0, + "groupIndex": 0, + "_id": "9c3kutx0dFaIOjULjZcGey" }, { "__type__": "cc.Node", @@ -356,15 +419,14 @@ "__id__": 13 } ], - "_tag": -1, "_active": true, + "_level": 0, "_components": [ { "__id__": 17 } ], "_prefab": null, - "_id": "7a1hs8UB9HO4+JV725mtgK", "_opacity": 255, "_color": { "__type__": "cc.Color", @@ -373,32 +435,42 @@ "b": 255, "a": 255 }, - "_cascadeOpacityEnabled": true, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, "_contentSize": { "__type__": "cc.Size", "width": 500, "height": 800 }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_position": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, "_rotationX": 0, "_rotationY": 0, - "_scaleX": 1, - "_scaleY": 1, - "_position": { - "__type__": "cc.Vec2", + "_quat": { + "__type__": "cc.Quat", "x": 0, - "y": 0 + "y": 0, + "z": 0, + "w": 1 }, "_skewX": 0, "_skewY": 0, - "_localZOrder": 0, - "_globalZOrder": 0, - "_opacityModifyRGB": false, - "groupIndex": 0 + "_zIndex": 0, + "groupIndex": 0, + "_id": "7a1hs8UB9HO4+JV725mtgK" }, { "__type__": "cc.Node", @@ -412,15 +484,14 @@ "__id__": 11 } ], - "_tag": -1, "_active": true, + "_level": 0, "_components": [ { "__id__": 12 } ], "_prefab": null, - "_id": "89DW7M+MBCar0ymvPGQdgg", "_opacity": 255, "_color": { "__type__": "cc.Color", @@ -429,32 +500,42 @@ "b": 255, "a": 255 }, - "_cascadeOpacityEnabled": true, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, "_contentSize": { "__type__": "cc.Size", "width": 500, "height": 800 }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_position": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, "_rotationX": 0, "_rotationY": 0, - "_scaleX": 1, - "_scaleY": 1, - "_position": { - "__type__": "cc.Vec2", + "_quat": { + "__type__": "cc.Quat", "x": 0, - "y": 0 + "y": 0, + "z": 0, + "w": 1 }, "_skewX": 0, "_skewY": 0, - "_localZOrder": 0, - "_globalZOrder": 0, - "_opacityModifyRGB": false, - "groupIndex": 0 + "_zIndex": 0, + "groupIndex": 0, + "_id": "89DW7M+MBCar0ymvPGQdgg" }, { "__type__": "cc.Node", @@ -464,11 +545,10 @@ "__id__": 10 }, "_children": [], - "_tag": -1, "_active": true, + "_level": 0, "_components": [], "_prefab": null, - "_id": "aazVaMb4tK4IQxSXbVsMnM", "_opacity": 255, "_color": { "__type__": "cc.Color", @@ -477,32 +557,42 @@ "b": 255, "a": 255 }, - "_cascadeOpacityEnabled": true, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 1 - }, "_contentSize": { "__type__": "cc.Size", "width": 500, "height": 800 }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 1 + }, + "_position": { + "__type__": "cc.Vec3", + "x": 0, + "y": 398, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, "_rotationX": 0, "_rotationY": 0, - "_scaleX": 1, - "_scaleY": 1, - "_position": { - "__type__": "cc.Vec2", + "_quat": { + "__type__": "cc.Quat", "x": 0, - "y": 398 + "y": 0, + "z": 0, + "w": 1 }, "_skewX": 0, "_skewY": 0, - "_localZOrder": 0, - "_globalZOrder": 0, - "_opacityModifyRGB": false, - "groupIndex": 0 + "_zIndex": 0, + "groupIndex": 0, + "_id": "aazVaMb4tK4IQxSXbVsMnM" }, { "__type__": "cc.Mask", @@ -512,11 +602,14 @@ "__id__": 10 }, "_enabled": true, + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": null, "_type": 0, - "_segements": 64, - "_N$spriteFrame": null, + "_segments": 64, "_N$alphaThreshold": 0, - "_N$inverted": false + "_N$inverted": false, + "_id": "35r3NJYoFAdZshASui7X/h" }, { "__type__": "cc.Node", @@ -530,8 +623,8 @@ "__id__": 14 } ], - "_tag": -1, "_active": true, + "_level": 0, "_components": [ { "__id__": 16 @@ -544,7 +637,6 @@ } ], "_prefab": null, - "_id": "eaO+bWvW1KT6NJXHppda3/", "_opacity": 255, "_color": { "__type__": "cc.Color", @@ -553,32 +645,42 @@ "b": 255, "a": 255 }, - "_cascadeOpacityEnabled": true, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 1, - "y": 0.5 - }, "_contentSize": { "__type__": "cc.Size", "width": 12, "height": 800 }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0.5 + }, + "_position": { + "__type__": "cc.Vec3", + "x": 250, + "y": 0, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, "_rotationX": 0, "_rotationY": 0, - "_scaleX": 1, - "_scaleY": 1, - "_position": { - "__type__": "cc.Vec2", - "x": 250, - "y": 0 + "_quat": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 }, "_skewX": 0, "_skewY": 0, - "_localZOrder": 0, - "_globalZOrder": 0, - "_opacityModifyRGB": false, - "groupIndex": 0 + "_zIndex": 0, + "groupIndex": 0, + "_id": "eaO+bWvW1KT6NJXHppda3/" }, { "__type__": "cc.Node", @@ -588,15 +690,14 @@ "__id__": 13 }, "_children": [], - "_tag": -1, "_active": true, + "_level": 0, "_components": [ { "__id__": 15 } ], "_prefab": null, - "_id": "a4lj1XN7FDephodOieJShJ", "_opacity": 255, "_color": { "__type__": "cc.Color", @@ -605,32 +706,42 @@ "b": 255, "a": 255 }, - "_cascadeOpacityEnabled": true, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 1, - "y": 0 - }, "_contentSize": { "__type__": "cc.Size", "width": 10, "height": 30 }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 1, + "y": 0 + }, + "_position": { + "__type__": "cc.Vec3", + "x": -1, + "y": 0, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, "_rotationX": 0, "_rotationY": 0, - "_scaleX": 1, - "_scaleY": 1, - "_position": { - "__type__": "cc.Vec2", - "x": -1, - "y": 0 + "_quat": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 }, "_skewX": 0, "_skewY": 0, - "_localZOrder": 0, - "_globalZOrder": 0, - "_opacityModifyRGB": false, - "groupIndex": 0 + "_zIndex": 0, + "groupIndex": 0, + "_id": "a4lj1XN7FDephodOieJShJ" }, { "__type__": "cc.Sprite", @@ -640,6 +751,8 @@ "__id__": 14 }, "_enabled": true, + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, "_spriteFrame": { "__uuid__": "5c3bb932-6c3c-468f-88a9-c8c61d458641" }, @@ -654,9 +767,9 @@ "_fillStart": 0, "_fillRange": 0, "_isTrimmedMode": true, - "_srcBlendFactor": 770, - "_dstBlendFactor": 771, - "_atlas": null + "_state": 0, + "_atlas": null, + "_id": "332Ek1zOtJp7mb2lN8tPHS" }, { "__type__": "cc.Scrollbar", @@ -676,7 +789,8 @@ "_N$handle": { "__id__": 15 }, - "_N$direction": 1 + "_N$direction": 1, + "_id": "419NweiLhL6Z5LP+R07YoN" }, { "__type__": "cc.ScrollView", @@ -686,9 +800,6 @@ "__id__": 9 }, "_enabled": true, - "content": { - "__id__": 11 - }, "horizontal": false, "vertical": true, "inertia": true, @@ -697,10 +808,17 @@ "bounceDuration": 0.23, "scrollEvents": [], "cancelInnerEvents": true, + "_N$content": { + "__id__": 11 + }, + "content": { + "__id__": 11 + }, "_N$horizontalScrollBar": null, "_N$verticalScrollBar": { "__id__": 16 - } + }, + "_id": "29Ewns6vVHP5iHgNSqx6E4" }, { "__type__": "cc.Widget", @@ -710,7 +828,7 @@ "__id__": 13 }, "_enabled": true, - "isAlignOnce": true, + "alignMode": 0, "_target": null, "_alignFlags": 37, "_left": 350.07654921020657, @@ -726,7 +844,8 @@ "_isAbsHorizontalCenter": true, "_isAbsVerticalCenter": true, "_originalWidth": 0, - "_originalHeight": 237 + "_originalHeight": 237, + "_id": "59ID2IwP9KopI0N066o6Ay" }, { "__type__": "cc.Sprite", @@ -736,6 +855,8 @@ "__id__": 13 }, "_enabled": true, + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, "_spriteFrame": { "__uuid__": "5fe5dcaa-b513-4dc5-a166-573627b3a159" }, @@ -750,9 +871,9 @@ "_fillStart": 0, "_fillRange": 0, "_isTrimmedMode": true, - "_srcBlendFactor": 770, - "_dstBlendFactor": 771, - "_atlas": null + "_state": 0, + "_atlas": null, + "_id": "e0fEbDSXpI7oTy4bSqzwM7" }, { "__type__": "2a51dYQx7hLjKNhfL6VU6y5", @@ -765,11 +886,12 @@ "itemTemplate": { "__uuid__": "ee8a03a3-1f23-464b-abf1-1800df851e7e" }, - "spacing": 1, - "spawnCount": 2, + "spacing": 2, + "spawnCount": 6, "scrollView": { "__id__": 17 - } + }, + "_id": "dfc0VLARNLQ7pOYEMdgG7A" }, { "__type__": "cc.Node", @@ -779,15 +901,14 @@ "__id__": 2 }, "_children": [], - "_tag": -1, "_active": true, + "_level": 0, "_components": [ { "__id__": 22 } ], "_prefab": null, - "_id": "240Yj3vf1Ct4NUbczT47fQ", "_opacity": 255, "_color": { "__type__": "cc.Color", @@ -796,32 +917,42 @@ "b": 255, "a": 255 }, - "_cascadeOpacityEnabled": true, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, "_contentSize": { "__type__": "cc.Size", "width": 0, "height": 40 }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_position": { + "__type__": "cc.Vec3", + "x": 0, + "y": -509, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, "_rotationX": 0, "_rotationY": 0, - "_scaleX": 1, - "_scaleY": 1, - "_position": { - "__type__": "cc.Vec2", + "_quat": { + "__type__": "cc.Quat", "x": 0, - "y": -509 + "y": 0, + "z": 0, + "w": 1 }, "_skewX": 0, "_skewY": 0, - "_localZOrder": 0, - "_globalZOrder": 0, - "_opacityModifyRGB": false, - "groupIndex": 0 + "_zIndex": 0, + "groupIndex": 0, + "_id": "240Yj3vf1Ct4NUbczT47fQ" }, { "__type__": "cc.Label", @@ -831,19 +962,282 @@ "__id__": 21 }, "_enabled": true, + "_srcBlendFactor": 1, + "_dstBlendFactor": 771, "_useOriginalSize": false, - "_actualFontSize": 40, + "_string": "", + "_N$string": "", "_fontSize": 40, "_lineHeight": 40, "_enableWrapText": true, "_N$file": null, "_isSystemFontUsed": true, "_spacingX": 0, - "_N$string": "", "_N$horizontalAlign": 1, "_N$verticalAlign": 1, "_N$fontFamily": "Arial", - "_N$overflow": 0 + "_N$overflow": 0, + "_id": "0fTMyqmt9GL7smsfxilDNd" + }, + { + "__type__": "cc.Node", + "_name": "New Button", + "_objFlags": 0, + "_parent": { + "__id__": 2 + }, + "_children": [ + { + "__id__": 24 + } + ], + "_active": true, + "_level": 1, + "_components": [ + { + "__id__": 26 + }, + { + "__id__": 27 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 200, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_position": { + "__type__": "cc.Vec3", + "x": 0, + "y": -507, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_rotationX": 0, + "_rotationY": 0, + "_quat": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_skewX": 0, + "_skewY": 0, + "_zIndex": 0, + "groupIndex": 0, + "_id": "41RagTw7ZLOIZ1I4IL5lxr" + }, + { + "__type__": "cc.Node", + "_name": "Label", + "_objFlags": 0, + "_parent": { + "__id__": 23 + }, + "_children": [], + "_active": true, + "_level": 0, + "_components": [ + { + "__id__": 25 + } + ], + "_prefab": null, + "_opacity": 255, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 200, + "height": 60 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_position": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_scale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_rotationX": 0, + "_rotationY": 0, + "_quat": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_skewX": 0, + "_skewY": 0, + "_zIndex": 0, + "groupIndex": 0, + "_id": "4a9cNEb69Gx7dOTPbr/nvM" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 24 + }, + "_enabled": true, + "_srcBlendFactor": 1, + "_dstBlendFactor": 771, + "_useOriginalSize": false, + "_string": "动态加数据", + "_N$string": "动态加数据", + "_fontSize": 30, + "_lineHeight": 40, + "_enableWrapText": false, + "_N$file": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_N$horizontalAlign": 1, + "_N$verticalAlign": 1, + "_N$fontFamily": "Arial", + "_N$overflow": 1, + "_id": "ddRmZj/OBIbJ9uc4ilylwq" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 23 + }, + "_enabled": true, + "_srcBlendFactor": 770, + "_dstBlendFactor": 771, + "_spriteFrame": { + "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952" + }, + "_type": 1, + "_sizeMode": 0, + "_fillType": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_state": 0, + "_atlas": null, + "_id": "3doYYds8NDC6x6Dcz5qKVZ" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "node": { + "__id__": 23 + }, + "_enabled": true, + "transition": 3, + "pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "hoverColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "duration": 0.1, + "zoomScale": 0.95, + "clickEvents": [ + { + "__id__": 28 + } + ], + "_N$interactable": true, + "_N$enableAutoGrayEffect": false, + "_N$normalColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$disabledColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_N$normalSprite": { + "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952" + }, + "_N$pressedSprite": { + "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a" + }, + "pressedSprite": { + "__uuid__": "e9ec654c-97a2-4787-9325-e6a10375219a" + }, + "_N$hoverSprite": { + "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952" + }, + "hoverSprite": { + "__uuid__": "f0048c10-f03e-4c97-b9d3-3506e1d58952" + }, + "_N$disabledSprite": { + "__uuid__": "29158224-f8dd-4661-a796-1ffab537140e" + }, + "_N$target": { + "__id__": 23 + }, + "_id": "cbRBV6SIJFOY2vdFthroTf" + }, + { + "__type__": "cc.ClickEvent", + "target": { + "__id__": 2 + }, + "component": "HelloWorld", + "handler": "onBtnAdd", + "customEventData": "" }, { "__type__": "cc.Canvas", @@ -859,7 +1253,8 @@ "height": 1280 }, "_fitWidth": false, - "_fitHeight": true + "_fitHeight": true, + "_id": "fddrNaYvpHDq21u0fGdNWh" }, { "__type__": "280c3rsZJJKnZ9RqbALVwtK", @@ -874,6 +1269,7 @@ }, "tipLabel": { "__id__": 22 - } + }, + "_id": "d6fY6pRDBMs73y88LnsZk3" } ] \ No newline at end of file diff --git a/ListViewJsDemo/assets/Script/HelloWorld.js b/ListViewJsDemo/assets/Script/HelloWorld.js index 7dd4698..716f936 100644 --- a/ListViewJsDemo/assets/Script/HelloWorld.js +++ b/ListViewJsDemo/assets/Script/HelloWorld.js @@ -16,8 +16,14 @@ cc.Class({ }, start() { - const adapter = new ListAdapter(); - adapter.setDataSet([1, 2, 3, 4, 5, 6, 7, 8, 89, 9, 12, 1243, 45, 564, 6756, 876, 7988, 789, 78987, 978, 45, 6732, 423, 42], 'ListItem'); - this.listView.setAdapter(adapter); - } + this.adapter = new ListAdapter(); + this.adapter.setDataSet([1, 2, 3, 4, 5, 6, 7, 8, 89, 9, 12, 1243, 45, 564, 6756, 876, 7988, 789, 78987, 978, 45, 6732, 423, 42], 'ListItem'); + this.listView.setAdapter(this.adapter); + }, + + onBtnAdd() { + let data = [321, 322, 323, 324]; + this.adapter.addData(data); + this.listView.resetScrollLength(); + }, }); \ No newline at end of file diff --git a/ListViewJsDemo/assets/Script/ListAdapter.js b/ListViewJsDemo/assets/Script/ListAdapter.js index 3066334..f1c9874 100644 --- a/ListViewJsDemo/assets/Script/ListAdapter.js +++ b/ListViewJsDemo/assets/Script/ListAdapter.js @@ -1,39 +1,44 @@ class AbsAdapter { - constructor() { - this.dataSet = []; - this.componentName = ''; - } - - /** - * - * @param {*} data 数据 - * @param {*} componentName item的脚本名 - */ - setDataSet(data = [], componentName) { - this.dataSet = data; - this.componentName = componentName; - } - - getCount() { - return this.dataSet.length; - } - - getItem(posIndex) { - return this.dataSet[posIndex]; - } - - _getView(item, posIndex) { - this.updateView(item, posIndex); - return item; - } - - updateView(item, posIndex) { - let comp = item.getComponent(this.componentName); - if (comp) { - comp.setData(this.getItem(posIndex)); - } + constructor() { + this.dataSet = []; + this.componentName = ''; + } + + /** + * + * @param {*} data 数据 + * @param {*} componentName item的脚本名 + */ + setDataSet(data = [], componentName) { + this.dataSet = data; + this.componentName = componentName; + } + + addData(data) { + console.log('addData'); + this.dataSet.push.apply(this.dataSet, data); + } + + getCount() { + return this.dataSet.length; + } + + getItem(posIndex) { + return this.dataSet[posIndex]; + } + + _getView(item, posIndex) { + this.updateView(item, posIndex); + return item; + } + + updateView(item, posIndex) { + let comp = item.getComponent(this.componentName); + if (comp) { + comp.setData(this.getItem(posIndex)); } } - - module.exports = AbsAdapter; \ No newline at end of file +} + +module.exports = AbsAdapter; \ No newline at end of file diff --git a/ListViewJsDemo/assets/Script/ListView.js b/ListViewJsDemo/assets/Script/ListView.js index f5e90de..4c2c73f 100644 --- a/ListViewJsDemo/assets/Script/ListView.js +++ b/ListViewJsDemo/assets/Script/ListView.js @@ -3,8 +3,8 @@ cc.Class({ properties: { itemTemplate: cc.Prefab, - spacing: 1, - spawnCount: 2, + spacing: 1,//每个itme的间隔 + spawnCount: 2,//预加载item个数 scrollView: cc.ScrollView, }, @@ -22,8 +22,8 @@ cc.Class({ this.lastStartIndex = -1; this.scrollTopNotifyed = false; this.scrollBottomNotifyed = false; - this.pullDownCallback = () => {}; - this.pullUpCallback = () => {}; + this.pullDownCallback = () => { }; + this.pullUpCallback = () => { }; }, onLoad() { @@ -117,14 +117,19 @@ cc.Class({ }); } this.lastStartIndex = -1; + this.resetScrollLength(); + + this.scrollView.scrollToTop(); + }, + + resetScrollLength() { if (this.horizontal) { this.content.width = this.adapter.getCount() * (this._itemWidth + this.spacing) + this.spacing; } else { this.content.height = this.adapter.getCount() * (this._itemHeight + this.spacing) + this.spacing; // get total content height } - - this.scrollView.scrollToTop(); }, + scrollToTop(anim = false) { this.scrollView.scrollToTop(anim ? 1 : 0); }, @@ -320,5 +325,5 @@ cc.Class({ return (cc.sys.isMobile || cc.sys.platform === cc.sys.WECHAT_GAME || cc.sys.platform === cc.sys.QQ_PLAY); }, - onDestroy() {} + onDestroy() { } }); \ No newline at end of file diff --git a/ListViewJsDemo/assets/Texture/HelloWorld.png.meta b/ListViewJsDemo/assets/Texture/HelloWorld.png.meta index 9c52a59..efdbc77 100644 --- a/ListViewJsDemo/assets/Texture/HelloWorld.png.meta +++ b/ListViewJsDemo/assets/Texture/HelloWorld.png.meta @@ -1,9 +1,10 @@ { - "ver": "1.0.0", + "ver": "2.2.0", "uuid": "6aa0aa6a-ebee-4155-a088-a687a6aadec4", "type": "sprite", "wrapMode": "clamp", "filterMode": "bilinear", + "premultiplyAlpha": false, "subMetas": { "HelloWorld": { "ver": "1.0.3", diff --git a/ListViewJsDemo/assets/Texture/singleColor.png.meta b/ListViewJsDemo/assets/Texture/singleColor.png.meta index 89cdf74..e3a0a2b 100644 --- a/ListViewJsDemo/assets/Texture/singleColor.png.meta +++ b/ListViewJsDemo/assets/Texture/singleColor.png.meta @@ -1,9 +1,10 @@ { - "ver": "1.0.0", + "ver": "2.2.0", "uuid": "a8027877-d8d6-4645-97a0-52d4a0123dba", "type": "sprite", "wrapMode": "clamp", "filterMode": "bilinear", + "premultiplyAlpha": false, "subMetas": { "singleColor": { "ver": "1.0.3", diff --git a/ListViewJsDemo/assets/resources.meta b/ListViewJsDemo/assets/resources.meta deleted file mode 100644 index f01a235..0000000 --- a/ListViewJsDemo/assets/resources.meta +++ /dev/null @@ -1,7 +0,0 @@ -{ - "ver": "1.0.1", - "uuid": "d6a6c9a3-1d26-4236-8c6e-26cbf483984b", - "isSubpackage": false, - "subpackageName": "", - "subMetas": {} -} \ No newline at end of file diff --git a/ListViewJsDemo/settings/project.json b/ListViewJsDemo/settings/project.json index ac399c6..6ad4fae 100644 --- a/ListViewJsDemo/settings/project.json +++ b/ListViewJsDemo/settings/project.json @@ -24,5 +24,16 @@ "enable": false, "appID": "13798", "appSecret": "959b3ac0037d0f3c2fdce94f8421a9b2" + }, + "last-module-event-record-time": 0, + "facebook": { + "enable": false, + "appID": "", + "live": { + "enable": false + }, + "audience": { + "enable": false + } } } \ No newline at end of file