Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Greenpoint_Land_Reserves/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM node:10

# Create app directory
WORKDIR /usr/src/app

RUN npm install --global decentraland@next

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm install --only=production

# Bundle app source
COPY . .

EXPOSE 8000
CMD [ "npm", "start", "--", "--ci" ]
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "dcl-project",
"version": "1.0.0",
"description": "My new Decentraland project",
"scripts": {
"start": "dcl start",
"build": "build-ecs",
"watch": "build-ecs --watch",
"deploy:now": "dcl export && now export",
"ecs:install": "npm install --save-dev decentraland-ecs@latest",
"ecs:install-next": "npm install --save-dev decentraland-ecs@next"
},
"devDependencies": {
"decentraland-builder-scripts": "^0.24.0",
"decentraland-ecs": "^6.5.1-20200902135156.commit-483ac28"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
export type Props = {
url: string
name?: string
}

export type LinkData = {
callback: (event: any) => void
hoverText: string
}

type ChangeLinkType = { url: string; name?: string }

export default class Teleport implements IScript<Props> {
init() {}

spawn(host: Entity, props: Props, channel: IChannel) {
const link = new Entity()
link.setParent(host)

link.addComponent(new GLTFShape('b88efbbf-2a9a-47b4-86e1-e38ecc2b433b/models/hiper.glb'))

let url = parseURL(props.url)

let locationString = props.name ? props.name : 'Visit site'

link.addComponent(
new OnPointerDown(
async function () {
openExternalURL(url)
},
{
button: ActionButton.PRIMARY,
hoverText: locationString,
}
)
)

channel.handleAction<ChangeLinkType>('changeLink', (action) => {
let newUrl = parseURL(action.values.url)
let hoverString = action.values.name ? action.values.name : 'Visit site'

link.getComponent(OnPointerDown).callback = async function () {
openExternalURL(url)
}
link.getComponent(OnPointerDown).hoverText = hoverString
})

channel.request<LinkData>('getCoords', (result) => {
link.getComponent(OnPointerDown).callback = result.callback
link.getComponent(OnPointerDown).hoverText = result.hoverText
})
channel.reply<void>('getCoords', () => {
let response: LinkData = {
callback: link.getComponent(OnPointerDown).callback,
hoverText: link.getComponent(OnPointerDown).hoverText,
}
return response
})
}
}

export function parseURL(url: string) {
let newURL = url.trim()

if (url.substr(0, 7) == 'http://') {
newURL = 'https://' + url.substring(7).trim()
} else if (url.substr(0, 7) != 'https://') {
newURL = 'https://' + url.trim()
}

return newURL
}
Loading