Skip to content

Commit dcaad89

Browse files
authored
UI link to code (#92)
* include tsx in all tsconfig files * experiment with basic interactions scene * lint * lint * remove unused permission * add gh image to all folders * GH Link UI on ALL SCENES
1 parent d3bf80a commit dcaad89

File tree

291 files changed

+4701
-547
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

291 files changed

+4701
-547
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,253 @@
1+
{
2+
"version": 1,
3+
"components": [
4+
{
5+
"name": "core::Transform",
6+
"jsonSchema": {
7+
"type": "object",
8+
"properties": {
9+
"position": {
10+
"type": "object",
11+
"properties": {
12+
"x": {
13+
"type": "number"
14+
},
15+
"y": {
16+
"type": "number"
17+
},
18+
"z": {
19+
"type": "number"
20+
}
21+
}
22+
},
23+
"scale": {
24+
"type": "object",
25+
"properties": {
26+
"x": {
27+
"type": "number"
28+
},
29+
"y": {
30+
"type": "number"
31+
},
32+
"z": {
33+
"type": "number"
34+
}
35+
}
36+
},
37+
"rotation": {
38+
"type": "object",
39+
"properties": {
40+
"x": {
41+
"type": "number"
42+
},
43+
"y": {
44+
"type": "number"
45+
},
46+
"z": {
47+
"type": "number"
48+
},
49+
"w": {
50+
"type": "number"
51+
}
52+
}
53+
},
54+
"parent": {
55+
"type": "integer"
56+
}
57+
},
58+
"serializationType": "transform"
59+
},
60+
"data": {
61+
"512": {
62+
"json": {
63+
"position": {
64+
"x": 8,
65+
"y": 1,
66+
"z": 8
67+
},
68+
"scale": {
69+
"x": 1,
70+
"y": 1,
71+
"z": 1
72+
},
73+
"rotation": {
74+
"x": 0,
75+
"y": 0,
76+
"z": 0,
77+
"w": 1
78+
},
79+
"parent": 0
80+
}
81+
}
82+
}
83+
},
84+
{
85+
"name": "core::MeshRenderer",
86+
"jsonSchema": {
87+
"type": "object",
88+
"properties": {},
89+
"serializationType": "protocol-buffer",
90+
"protocolBuffer": "PBMeshRenderer"
91+
},
92+
"data": {
93+
"512": {
94+
"json": {
95+
"mesh": {
96+
"$case": "box",
97+
"box": {
98+
"uvs": []
99+
}
100+
}
101+
}
102+
}
103+
}
104+
},
105+
{
106+
"name": "core-schema::Name",
107+
"jsonSchema": {
108+
"type": "object",
109+
"properties": {
110+
"value": {
111+
"type": "string",
112+
"serializationType": "utf8-string"
113+
}
114+
},
115+
"serializationType": "map"
116+
},
117+
"data": {
118+
"512": {
119+
"json": {
120+
"value": "Magic Cube"
121+
}
122+
}
123+
}
124+
},
125+
{
126+
"name": "inspector::Scene",
127+
"jsonSchema": {
128+
"type": "object",
129+
"properties": {
130+
"layout": {
131+
"type": "object",
132+
"properties": {
133+
"base": {
134+
"type": "object",
135+
"properties": {
136+
"x": {
137+
"type": "integer",
138+
"serializationType": "int32"
139+
},
140+
"y": {
141+
"type": "integer",
142+
"serializationType": "int32"
143+
}
144+
},
145+
"serializationType": "map"
146+
},
147+
"parcels": {
148+
"type": "array",
149+
"items": {
150+
"type": "object",
151+
"properties": {
152+
"x": {
153+
"type": "integer",
154+
"serializationType": "int32"
155+
},
156+
"y": {
157+
"type": "integer",
158+
"serializationType": "int32"
159+
}
160+
},
161+
"serializationType": "map"
162+
},
163+
"serializationType": "array"
164+
}
165+
},
166+
"serializationType": "map"
167+
}
168+
},
169+
"serializationType": "map"
170+
},
171+
"data": {
172+
"0": {
173+
"json": {
174+
"layout": {
175+
"base": {
176+
"x": 0,
177+
"y": 0
178+
},
179+
"parcels": [
180+
{
181+
"x": 0,
182+
"y": 0
183+
}
184+
]
185+
}
186+
}
187+
}
188+
}
189+
},
190+
{
191+
"name": "inspector::Nodes",
192+
"jsonSchema": {
193+
"type": "object",
194+
"properties": {
195+
"value": {
196+
"type": "array",
197+
"items": {
198+
"type": "object",
199+
"properties": {
200+
"entity": {
201+
"type": "integer",
202+
"serializationType": "entity"
203+
},
204+
"children": {
205+
"type": "array",
206+
"items": {
207+
"type": "integer",
208+
"serializationType": "entity"
209+
},
210+
"serializationType": "array"
211+
}
212+
},
213+
"serializationType": "map"
214+
},
215+
"serializationType": "array"
216+
}
217+
},
218+
"serializationType": "map"
219+
},
220+
"data": {
221+
"0": {
222+
"json": {
223+
"value": [
224+
{
225+
"entity": 0,
226+
"children": [
227+
512
228+
]
229+
},
230+
{
231+
"entity": 512,
232+
"children": []
233+
}
234+
]
235+
}
236+
}
237+
}
238+
},
239+
{
240+
"name": "cube-id",
241+
"jsonSchema": {
242+
"type": "object",
243+
"properties": {},
244+
"serializationType": "map"
245+
},
246+
"data": {
247+
"512": {
248+
"json": {}
249+
}
250+
}
251+
}
252+
]
253+
}

BasicInteractions/images/gh.png

6.24 KB
Loading

BasicInteractions/package.json

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
{
2-
"name": "BasicInteractions",
2+
"name": "basic-interactions",
33
"description": "ECS7 ",
44
"version": "1.0.0",
55
"dependencies": {
66
"@dcl-sdk/utils": "latest",
7+
"@dcl/js-runtime": "latest",
78
"@dcl/sdk": "latest"
89
},
9-
"devDependencies": {
10-
"@dcl/js-runtime": "latest"
11-
},
10+
"devDependencies": {},
1211
"scripts": {
1312
"build": "sdk-commands build --skip-install",
1413
"deploy": "sdk-commands deploy",

BasicInteractions/src/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import { setupProximity } from './proximity'
44
import * as utils from '@dcl-sdk/utils'
55
import { Color4, Vector3 } from '@dcl/sdk/math'
66
import './painter'
7+
import { setupUi } from './ui'
78

89
export function main() {
10+
setupUi()
11+
912
utils.addTestCube(
1013
{ position: Vector3.create(8, 1, 8), scale: Vector3.create(0.5, 0.5, 0.5) },
1114
undefined,

BasicInteractions/src/ui.tsx

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
import { openExternalUrl } from "~system/RestrictedActions"
2+
import ReactEcs, { Label, ReactEcsRenderer, UiEntity } from '@dcl/sdk/react-ecs'
3+
import { TextAlignMode, TextureFilterMode, TextureWrapMode } from "@dcl/sdk/ecs"
4+
import { Color4 } from "@dcl/sdk/math"
5+
6+
7+
const projectPath = "BasicInteractions"
8+
9+
export const fullPath = "https://github.com/decentraland/sdk7-goerli-plaza/tree/main/" + projectPath
10+
11+
export function setupUi() {
12+
ReactEcsRenderer.setUiRenderer(uiComponent)
13+
}
14+
15+
16+
const uiComponent = () => (
17+
<UiEntity
18+
uiTransform={{
19+
flexDirection: 'column',
20+
alignItems: 'center',
21+
justifyContent: 'space-between',
22+
positionType: 'absolute',
23+
position: { right: "3%", bottom: '3%' }
24+
}}
25+
>
26+
<UiEntity
27+
uiTransform={{
28+
width: '100',
29+
height: '100',
30+
31+
32+
33+
}}
34+
uiBackground={{
35+
textureMode: 'stretch',
36+
texture: {
37+
src: "images/gh.png"
38+
}
39+
}}
40+
41+
onMouseDown={() => {
42+
console.log("OPENING LINK")
43+
openExternalUrl({ url: fullPath })
44+
}}
45+
/>
46+
<Label
47+
value="View code"
48+
color={Color4.Black()}
49+
fontSize={18}
50+
textAlign="middle-center"
51+
/>
52+
</UiEntity>
53+
)
54+

BasicInteractions/tsconfig.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"strict": true
55
},
66
"include": [
7-
"src/**/*.ts"
7+
"src/**/*.ts",
8+
"src/**/*.tsx"
89
],
910
"extends": "@dcl/sdk/types/tsconfig.ecs7.json"
1011
}

Block-Fountain/images/gh.png

6.24 KB
Loading

Block-Fountain/src/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { Ring } from './ring'
55
import { Console } from './console'
66
import { RandomFountain } from './randomizer'
77
import * as utils from '@dcl-sdk/utils'
8+
import { setupUi } from './ui'
89

910
export function main() {
1011
// Create a message bus to sync animations between players
@@ -165,4 +166,7 @@ export function main() {
165166
engine.addSystem((dt) => {
166167
fountainPlayer.update(dt)
167168
})
169+
170+
// UI with GitHub link
171+
setupUi()
168172
}

0 commit comments

Comments
 (0)