diff --git a/assets/Prefabs.meta b/assets/Prefabs.meta new file mode 100644 index 0000000..8a71b30 --- /dev/null +++ b/assets/Prefabs.meta @@ -0,0 +1,9 @@ +{ + "ver": "1.2.0", + "importer": "directory", + "imported": true, + "uuid": "1ba6d8de-def2-43b8-a7ca-3483570e3bce", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Prefabs/ItemPrefab.prefab b/assets/Prefabs/ItemPrefab.prefab new file mode 100644 index 0000000..ce6a5df --- /dev/null +++ b/assets/Prefabs/ItemPrefab.prefab @@ -0,0 +1,715 @@ +[ + { + "__type__": "cc.Prefab", + "_name": "ItemPrefab", + "_objFlags": 0, + "__editorExtras__": {}, + "_native": "", + "data": { + "__id__": 1 + }, + "optimizationPolicy": 0, + "persistent": false + }, + { + "__type__": "cc.Node", + "_name": "ItemPrefab", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": null, + "_children": [ + { + "__id__": 2 + } + ], + "_active": true, + "_components": [ + { + "__id__": 24 + }, + { + "__id__": 26 + } + ], + "_prefab": { + "__id__": 28 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 603.141, + "y": -276.8, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1.1441647597254005, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "ItemButton", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 1 + }, + "_children": [ + { + "__id__": 3 + }, + { + "__id__": 9 + } + ], + "_active": true, + "_components": [ + { + "__id__": 15 + }, + { + "__id__": 17 + }, + { + "__id__": 19 + }, + { + "__id__": 21 + } + ], + "_prefab": { + "__id__": 23 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.Node", + "_name": "Label-001", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 4 + }, + { + "__id__": 6 + } + ], + "_prefab": { + "__id__": 8 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": -11.368, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1.028, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 3 + }, + "_enabled": true, + "__prefab": { + "__id__": 5 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 15 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "1e7o7412dCV5hX3YLwQeyc" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 3 + }, + "_enabled": true, + "__prefab": { + "__id__": 7 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_string": "button", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 15, + "_fontSize": 15, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 1, + "_enableWrapText": false, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 2, + "_enableOutline": false, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 2, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "61G54mSwBEC76bZuWlZobr" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "8fAdewM09EmJgQtmW9WIWv", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.Node", + "_name": "Label", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 10 + }, + { + "__id__": 12 + } + ], + "_prefab": { + "__id__": 14 + }, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 9.283, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1.028, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 9 + }, + "_enabled": true, + "__prefab": { + "__id__": 11 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 15 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "65+KzBR3dPbr711K9CQ39S" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 9 + }, + "_enabled": true, + "__prefab": { + "__id__": 13 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_string": "button", + "_horizontalAlign": 1, + "_verticalAlign": 1, + "_actualFontSize": 20, + "_fontSize": 20, + "_fontFamily": "Arial", + "_lineHeight": 40, + "_overflow": 1, + "_enableWrapText": false, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 2, + "_enableOutline": false, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 2, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "dfMeiwh0hAYYKBonsUe56x" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "721GJYNz1E/7th3pz4p0FM", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 16 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 40 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "5a6u38NxNLvIT/gVnl4Kyc" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 18 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 1, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "c0MMcAQoRKh5dcpTs1+Qjt" + }, + { + "__type__": "cc.Button", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 20 + }, + "clickEvents": [], + "_interactable": true, + "_transition": 2, + "_normalColor": { + "__type__": "cc.Color", + "r": 214, + "g": 214, + "b": 214, + "a": 255 + }, + "_hoverColor": { + "__type__": "cc.Color", + "r": 211, + "g": 211, + "b": 211, + "a": 255 + }, + "_pressedColor": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_disabledColor": { + "__type__": "cc.Color", + "r": 124, + "g": 124, + "b": 124, + "a": 255 + }, + "_normalSprite": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_hoverSprite": { + "__uuid__": "20835ba4-6145-4fbc-a58a-051ce700aa3e@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_pressedSprite": { + "__uuid__": "544e49d6-3f05-4fa8-9a9e-091f98fc2ce8@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_disabledSprite": { + "__uuid__": "951249e0-9f16-456d-8b85-a6ca954da16b@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_duration": 0.1, + "_zoomScale": 1.2, + "_target": { + "__id__": 2 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "0181n7qDZMGLC8oGGI2DWt" + }, + { + "__type__": "e5a794S61FLarSaWsI+BZm6", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": { + "__id__": 22 + }, + "nameLabel": { + "__id__": 12 + }, + "timeLabel": { + "__id__": 6 + }, + "button": { + "__id__": 19 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "b1LFjeLThMMJG9rUdhQm0y" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "1fHNB1CLNCZpwOtSgQJljf", + "instance": null, + "targetOverrides": null, + "nestedPrefabInstanceRoots": null + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 25 + }, + "_contentSize": { + "__type__": "cc.Size", + "width": 40, + "height": 36 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "29o4eyV5ZNy4dV0MMtsx28" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 1 + }, + "_enabled": true, + "__prefab": { + "__id__": 27 + }, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "57520716-48c8-4a19-8acf-41c9f8777fb0@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 1, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "" + }, + { + "__type__": "cc.CompPrefabInfo", + "fileId": "90NAT7FghLQ6RsYo8dZKX5" + }, + { + "__type__": "cc.PrefabInfo", + "root": { + "__id__": 1 + }, + "asset": { + "__id__": 0 + }, + "fileId": "4aBpvR+bhJdI7i8LzRRtvb", + "instance": null, + "targetOverrides": null + } +] \ No newline at end of file diff --git a/assets/Prefabs/ItemPrefab.prefab.meta b/assets/Prefabs/ItemPrefab.prefab.meta new file mode 100644 index 0000000..b47c9e7 --- /dev/null +++ b/assets/Prefabs/ItemPrefab.prefab.meta @@ -0,0 +1,14 @@ +{ + "ver": "1.1.50", + "importer": "prefab", + "imported": true, + "uuid": "9cd6487c-e05c-4f6f-bd30-ce2eb3682bd7", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": { + "syncNodeName": "ItemPrefab", + "persistent": false + } +} diff --git a/assets/Scenes/scene.scene b/assets/Scenes/scene.scene index 8a62dce..9bba4c0 100644 --- a/assets/Scenes/scene.scene +++ b/assets/Scenes/scene.scene @@ -32,7 +32,7 @@ "_active": true, "_components": [], "_prefab": { - "__id__": 238 + "__id__": 236 }, "_lpos": { "__type__": "cc.Vec3", @@ -63,7 +63,7 @@ }, "autoReleaseAssets": false, "_globals": { - "__id__": 239 + "__id__": 237 }, "_id": "955c22b7-7b7e-4af8-ad45-8415a0c23e60" }, @@ -5938,19 +5938,19 @@ "__id__": 202 }, { - "__id__": 223 + "__id__": 221 } ], "_active": true, "_components": [ + { + "__id__": 233 + }, + { + "__id__": 234 + }, { "__id__": 235 - }, - { - "__id__": 236 - }, - { - "__id__": 237 } ], "_prefab": null, @@ -6709,10 +6709,10 @@ "_active": true, "_components": [ { - "__id__": 221 + "__id__": 219 }, { - "__id__": 222 + "__id__": 220 }, { "__id__": 211 @@ -7062,15 +7062,14 @@ "_parent": { "__id__": 213 }, - "_children": [ - { - "__id__": 217 - } - ], + "_children": [], "_active": true, "_components": [ { - "__id__": 220 + "__id__": 217 + }, + { + "__id__": 218 } ], "_prefab": null, @@ -7236,138 +7235,6 @@ "_miterLimit": 10, "_id": "d4hleCx2hB6rz8gtneYVLJ" }, - { - "__type__": "cc.Node", - "_name": "item", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 212 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 218 - }, - { - "__id__": 219 - } - ], - "_prefab": null, - "_lpos": { - "__type__": "cc.Vec3", - "x": -102, - "y": -10.15, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_mobility": 0, - "_layer": 33554432, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "7802gBoTNHGruSxiOL4yYj" - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 217 - }, - "_enabled": true, - "__prefab": null, - "_contentSize": { - "__type__": "cc.Size", - "width": 131.27872889305814, - "height": 25.2 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0, - "y": 1 - }, - "_id": "a73JT0G1hDIpiwA6kp8+CB" - }, - { - "__type__": "cc.Label", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 217 - }, - "_enabled": true, - "__prefab": null, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_string": "ScrollView content", - "_horizontalAlign": 0, - "_verticalAlign": 0, - "_actualFontSize": 23.31875, - "_fontSize": 16, - "_fontFamily": "Arial", - "_lineHeight": 20, - "_overflow": 0, - "_enableWrapText": true, - "_font": null, - "_isSystemFontUsed": true, - "_spacingX": 0, - "_isItalic": false, - "_isBold": false, - "_isUnderline": false, - "_underlineHeight": 2, - "_cacheMode": 0, - "_enableOutline": false, - "_outlineColor": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_outlineWidth": 2, - "_enableShadow": false, - "_shadowColor": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_shadowOffset": { - "__type__": "cc.Vec2", - "x": 2, - "y": 2 - }, - "_shadowBlur": 2, - "_id": "10iH2hr9dMdKS0OG+Y0QQ5" - }, { "__type__": "cc.UITransform", "_name": "", @@ -7390,6 +7257,23 @@ }, "_id": "9fefAcInlEbrcYuZ+9bIbP" }, + { + "__type__": "382770hOD5D8bufQM2wRbKN", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 212 + }, + "_enabled": true, + "__prefab": null, + "itemPrefab": { + "__uuid__": "9cd6487c-e05c-4f6f-bd30-ce2eb3682bd7", + "__expectedType__": "cc.Prefab" + }, + "apiUrl": "http://localhost:3000/api/v2/sensors", + "_id": "38UJduIOhEOpeNrlKACPac" + }, { "__type__": "cc.UITransform", "_name": "", @@ -7461,22 +7345,22 @@ }, "_children": [ { - "__id__": 224 + "__id__": 222 }, { - "__id__": 227 + "__id__": 225 } ], "_active": true, "_components": [ + { + "__id__": 230 + }, + { + "__id__": 231 + }, { "__id__": 232 - }, - { - "__id__": 233 - }, - { - "__id__": 234 } ], "_prefab": null, @@ -7515,16 +7399,16 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 223 + "__id__": 221 }, "_children": [], "_active": true, "_components": [ { - "__id__": 225 + "__id__": 223 }, { - "__id__": 226 + "__id__": 224 } ], "_prefab": null, @@ -7563,7 +7447,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 224 + "__id__": 222 }, "_enabled": true, "__prefab": null, @@ -7585,7 +7469,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 224 + "__id__": 222 }, "_enabled": true, "__prefab": null, @@ -7647,19 +7531,19 @@ "_objFlags": 0, "__editorExtras__": {}, "_parent": { - "__id__": 223 + "__id__": 221 }, "_children": [], "_active": true, "_components": [ + { + "__id__": 226 + }, + { + "__id__": 227 + }, { "__id__": 228 - }, - { - "__id__": 229 - }, - { - "__id__": 230 } ], "_prefab": null, @@ -7698,14 +7582,14 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 227 + "__id__": 225 }, "_enabled": true, "__prefab": null, "_contentSize": { "__type__": "cc.Size", - "width": 75, - "height": 40 + "width": 70, + "height": 30 }, "_anchorPoint": { "__type__": "cc.Vec2", @@ -7720,7 +7604,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 227 + "__id__": 225 }, "_enabled": true, "__prefab": null, @@ -7756,13 +7640,13 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 227 + "__id__": 225 }, "_enabled": true, "__prefab": null, "clickEvents": [ { - "__id__": 231 + "__id__": 229 } ], "_interactable": true, @@ -7802,14 +7686,14 @@ "_duration": 0.1, "_zoomScale": 1.2, "_target": { - "__id__": 227 + "__id__": 225 }, "_id": "cauC9lcFlH+KVG3oddBgi3" }, { "__type__": "cc.ClickEvent", "target": { - "__id__": 223 + "__id__": 221 }, "component": "", "_componentId": "41a9dZz2mVOFoYwOsk9H98q", @@ -7822,7 +7706,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 223 + "__id__": 221 }, "_enabled": true, "__prefab": null, @@ -7844,7 +7728,7 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 223 + "__id__": 221 }, "_enabled": true, "__prefab": null, @@ -7883,15 +7767,15 @@ "_objFlags": 0, "__editorExtras__": {}, "node": { - "__id__": 223 + "__id__": 221 }, "_enabled": true, "__prefab": null, "equipmentLb": { - "__id__": 226 + "__id__": 224 }, "spriteBg": { - "__id__": 233 + "__id__": 231 }, "colorBg": [ { @@ -7988,33 +7872,33 @@ "asset": null, "fileId": "955c22b7-7b7e-4af8-ad45-8415a0c23e60", "instance": null, - "targetOverrides": null + "targetOverrides": [] }, { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 240 + "__id__": 238 }, "shadows": { - "__id__": 241 + "__id__": 239 }, "_skybox": { - "__id__": 242 + "__id__": 240 }, "fog": { - "__id__": 243 + "__id__": 241 }, "octree": { - "__id__": 244 + "__id__": 242 }, "skin": { - "__id__": 245 + "__id__": 243 }, "lightProbeInfo": { - "__id__": 246 + "__id__": 244 }, "postSettings": { - "__id__": 247 + "__id__": 245 }, "bakedWithStationaryMainLight": false, "bakedWithHighpLightmap": false diff --git a/assets/Scripts/SensorsList.ts b/assets/Scripts/SensorsList.ts new file mode 100644 index 0000000..82d684d --- /dev/null +++ b/assets/Scripts/SensorsList.ts @@ -0,0 +1,53 @@ + // ItemList.ts + import { _decorator, Component, Prefab, instantiate, Node } from 'cc'; + import { ApiSensor } from './apiSensors'; + import { ItemButton } from './ux/ItemButton'; + const { ccclass, property } = _decorator; + + @ccclass('ItemList') + export class ItemList extends Component { + @property(Prefab) + public itemPrefab: Prefab | null = null; + + @property + public apiUrl = 'http://localhost:3000/api/v2/sensors'; + + start() { + this.loadItems(); + } + + loadItems() { + fetch(this.apiUrl) + .then(response => response.json()) + .then((data) => { + if (data && data.items && Array.isArray(data.items)) { + this.createItemButtons(data.items); + } else { + console.error('Некорректный формат данных', data); + } + }) + .catch(error => { + console.error('Ошибка при загрузке данных:', error); + }); + } + + createItemButtons(items: ApiSensor[]) { + for (const itemData of items) { + const itemNode = instantiate(this.itemPrefab!); + + + const itemButton = itemNode.getComponentInChildren(ItemButton); + + + + if (itemButton) { + + itemButton.initialize(itemData); + } else { + console.error('На префабе отсутствует компонент ItemButton'); + } + + this.node.addChild(itemNode); + } + } + } \ No newline at end of file diff --git a/assets/Scripts/SensorsList.ts.meta b/assets/Scripts/SensorsList.ts.meta new file mode 100644 index 0000000..1a42ac3 --- /dev/null +++ b/assets/Scripts/SensorsList.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "38277d21-383e-43f1-bb9f-40cdb045b28d", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/apiSensors.ts b/assets/Scripts/apiSensors.ts new file mode 100644 index 0000000..a73af0a --- /dev/null +++ b/assets/Scripts/apiSensors.ts @@ -0,0 +1,11 @@ +// ApiItem.ts +export interface ApiSensor { + connect_time: string; + isServicing: boolean; + name: string; + position: string; + quality: string; + tag: string; + value: number; + zone: any; +} \ No newline at end of file diff --git a/assets/Scripts/apiSensors.ts.meta b/assets/Scripts/apiSensors.ts.meta new file mode 100644 index 0000000..0fa199e --- /dev/null +++ b/assets/Scripts/apiSensors.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "427b5de2-3c65-4954-96e0-698adb3b9943", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/ux/ItemButton.ts b/assets/Scripts/ux/ItemButton.ts new file mode 100644 index 0000000..a99ae42 --- /dev/null +++ b/assets/Scripts/ux/ItemButton.ts @@ -0,0 +1,36 @@ +// ItemButton.ts +import { _decorator, Component, Label, Button } from 'cc'; +import { ApiSensor } from '../apiSensors'; +const { ccclass, property } = _decorator; + +@ccclass('ItemButton') +export class ItemButton extends Component { + @property(Label) + public nameLabel: Label | null = null; + + @property(Label) + public timeLabel: Label | null = null; + + + @property(Button) + public button: Button | null = null; + + + private itemData: ApiSensor | null = null; + + + public initialize(data: ApiSensor): void { + this.itemData = data; + if (this.nameLabel) { + this.nameLabel.string = data.name; + } + if (this.timeLabel) { + this.timeLabel.string = data.connect_time; + } + } + + onClick() { + console.log('Нажата кнопка для элемента:', this.itemData); + + } +} diff --git a/assets/Scripts/ux/ItemButton.ts.meta b/assets/Scripts/ux/ItemButton.ts.meta new file mode 100644 index 0000000..cca2976 --- /dev/null +++ b/assets/Scripts/ux/ItemButton.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "e5a79e12-eb51-4b6a-b49a-5ac23e0599ba", + "files": [], + "subMetas": {}, + "userData": {} +}