@dcl/playground-assets 7.1.4-4692408267.commit-446cd2e → 7.1.4-4692707982.commit-108fa71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dcl/sdk",
3
3
  "description": "",
4
- "version": "7.1.4-4692408267.commit-446cd2e",
4
+ "version": "7.1.4-4692707982.commit-108fa71",
5
5
  "author": "Decentraland",
6
6
  "dependencies": {
7
7
  "@dcl/ecs": "file:../ecs",
@@ -30,5 +30,5 @@
30
30
  },
31
31
  "types": "./index.d.ts",
32
32
  "typings": "./index.d.ts",
33
- "commit": "446cd2e9ee9e87186caf796bda949a44fb8deabd"
33
+ "commit": "108fa711aa994addfc08b2307455c2fad67f3b05"
34
34
  }
@@ -10,68 +10,10 @@ import {
10
10
  PointerEventType
11
11
  } from '@dcl/sdk/ecs'
12
12
  import { Vector3, Color4, Quaternion } from '@dcl/sdk/math'
13
- import ReactEcs, { UiEntity, Label, ReactEcsRenderer } from '@dcl/sdk/react-ecs'
13
+ import { ReactEcs, UiEntity, Label, ReactEcsRenderer, Button } from '@dcl/sdk/react-ecs'
14
14
 
15
15
  let counter = 0
16
16
 
17
- export const uiComponent = () => (
18
- <UiEntity
19
- uiTransform={{
20
- width: 700,
21
- height: 400,
22
- margin: { top: '35px', left: '500px' }
23
- }}
24
- uiBackground={{ color: Color4.create(0.5, 0.8, 0.1, 0.6) }}
25
- >
26
- <UiEntity
27
- uiTransform={{
28
- width: '100%',
29
- height: '20%',
30
- justifyContent: 'center',
31
- alignItems: 'center',
32
- display: 'flex'
33
- }}
34
- >
35
- <Label value="SDK 7" fontSize={80} uiBackground={{ color: Color4.fromHexString('#fbf0f0') }} />
36
- </UiEntity>
37
- <UiEntity
38
- uiTransform={{
39
- width: '100%',
40
- height: '20%',
41
- justifyContent: 'center',
42
- alignItems: 'center',
43
- display: 'flex'
44
- }}
45
- >
46
- <Label value={`Counter: ${counter}`} fontSize={60} uiBackground={{ color: Color4.fromHexString('#fbf0f0') }} />
47
- </UiEntity>
48
- <UiEntity
49
- uiTransform={{
50
- width: '100%',
51
- height: '100px',
52
- justifyContent: 'center',
53
- alignItems: 'center',
54
- display: 'flex'
55
- }}
56
- >
57
- <Label
58
- value={`Player: ${getPlayerPosition()}`}
59
- fontSize={40}
60
- uiBackground={{ color: Color4.fromHexString('#fbf0f0') }}
61
- />
62
- </UiEntity>
63
- </UiEntity>
64
- )
65
-
66
- function getPlayerPosition() {
67
- const playerPosition = Transform.getOrNull(engine.PlayerEntity)
68
- if (!playerPosition) return ''
69
- const { x, y, z } = playerPosition.position
70
- return `{x: ${x.toFixed(2)}, y: ${y.toFixed(2)}, z: ${z.toFixed(2)} }`
71
- }
72
-
73
- ReactEcsRenderer.setUiRenderer(uiComponent)
74
-
75
17
  // Cube factory
76
18
  function createCube(x: number, y: number, z: number, spawner = true): Entity {
77
19
  const meshEntity = engine.addEntity()
@@ -123,4 +65,77 @@ createCube(8, 1, 8)
123
65
  engine.addSystem(circularSystem)
124
66
  engine.addSystem(spawnerSystem)
125
67
 
68
+ type GenesisPlazaContent = string
69
+ const sceneThumbnail: GenesisPlazaContent = 'models/Magazinev1.png'
70
+
71
+ const uiComponent = () => (
72
+ <UiEntity
73
+ uiTransform={{
74
+ width: 400,
75
+ height: 230,
76
+ // { top: 16, right: 0, bottom: 8 left: 270 },
77
+ margin: '16px 0 8px 270px',
78
+ // { top: 4, bottom: 4, left: 4, right: 4 },
79
+ padding: 4,
80
+ }}
81
+ uiBackground={{ color: Color4.create(0.5, 0.8, 0.1, 0.6) }}
82
+ >
83
+ <UiEntity
84
+ uiTransform={{
85
+ width: '100%',
86
+ height: '100%',
87
+ flexDirection: 'column',
88
+ alignItems: 'center',
89
+ justifyContent: 'space-between'
90
+ }}
91
+ uiBackground={{ color: Color4.fromHexString("#70ac76ff") }}
92
+ >
93
+ <UiEntity
94
+ uiTransform={{
95
+ width: '100%',
96
+ height: 50,
97
+ margin: '8px 0'
98
+ }}
99
+ uiBackground={{
100
+ textureMode: 'center',
101
+ texture: {
102
+ src: sceneThumbnail,
103
+ },
104
+ }}
105
+ uiText={{ value: 'SDK7', fontSize: 18 }}
106
+ />
107
+ <Label
108
+ onMouseDown={() => {console.log('Player Position clicked !')}}
109
+ value={`Player: ${getPlayerPosition()}`}
110
+ fontSize={18}
111
+ uiTransform={{ width: '100%', height: 30 } }
112
+ />
113
+ <Label
114
+ onMouseDown={() => {console.log('# Cubes clicked !')}}
115
+ value={`# Cubes: ${[...engine.getEntitiesWith(MeshRenderer)].length}`}
116
+ fontSize={18}
117
+ uiTransform={{ width: '100%', height: 30 } }
118
+ />
119
+ <Button
120
+ uiTransform={{ width: 100, height: 40, margin: 8 }}
121
+ value='Spawn cube'
122
+ variant='primary'
123
+ fontSize={14}
124
+ onMouseDown={() => {
125
+ createCube(1 + Math.random() * 8, Math.random() * 8, 1 + Math.random() * 8, false)
126
+ }}
127
+ />
128
+ </UiEntity>
129
+ </UiEntity>
130
+ )
131
+
132
+ function getPlayerPosition() {
133
+ const playerPosition = Transform.getOrNull(engine.PlayerEntity)
134
+ if (!playerPosition) return ' no data yet'
135
+ const { x, y, z } = playerPosition.position
136
+ return `{X: ${x.toFixed(2)}, Y: ${y.toFixed(2)}, z: ${z.toFixed(2)} }`
137
+ }
138
+
139
+ ReactEcsRenderer.setUiRenderer(uiComponent)
140
+
126
141
  export {}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@dcl/playground-assets",
3
3
  "description": "",
4
- "version": "7.1.4-4692408267.commit-446cd2e",
4
+ "version": "7.1.4-4692707982.commit-108fa71",
5
5
  "author": "Decentraland",
6
6
  "dependencies": {
7
- "@dcl/js-runtime": "7.1.4-4692408267.commit-446cd2e",
8
- "@dcl/sdk": "7.1.4-4692408267.commit-446cd2e"
7
+ "@dcl/js-runtime": "7.1.4-4692707982.commit-108fa71",
8
+ "@dcl/sdk": "7.1.4-4692707982.commit-108fa71"
9
9
  },
10
10
  "devDependencies": {
11
11
  "@microsoft/api-extractor": "^7.33.8"
@@ -28,5 +28,5 @@
28
28
  },
29
29
  "types": "./dist/index.d.ts",
30
30
  "typings": "./dist/index.d.ts",
31
- "commit": "446cd2e9ee9e87186caf796bda949a44fb8deabd"
31
+ "commit": "108fa711aa994addfc08b2307455c2fad67f3b05"
32
32
  }