mirror of https://github.com/teverse/teverse
Compare commits
17 Commits
c89cb736d9
...
dc3ad175a1
Author | SHA1 | Date |
---|---|---|
Sanjay Bhadra | dc3ad175a1 | |
Sanjay Bhadra | 65134d6b3c | |
Jay | b8d8291aee | |
Jay | 38a45502b6 | |
Jay | 9485122cb7 | |
Jay | 6710150f27 | |
teverse | ffaf6219b7 | |
teverse | b8e836be8c | |
teverse | 4f369cd4b7 | |
teverse | eae49175b9 | |
Jay | e1a0da2bb9 | |
Jay | ea94bd1415 | |
Jay | 964fb857c9 | |
Jay | f604b3df0b | |
teverse | 96da67ed50 | |
teverse | 596e511886 | |
teverse | f7069e3547 |
209
api.json
209
api.json
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"os": "OSX",
|
||||
"arch": "x64",
|
||||
"version": "0.23.1",
|
||||
"generatedAt": "19/06/2020 13:05:51",
|
||||
"version": "0.24.0",
|
||||
"generatedAt": "28/06/2020 20:32:30",
|
||||
"sandbox": {
|
||||
"coroutine": {
|
||||
"status": "function",
|
||||
|
@ -20,10 +20,10 @@
|
|||
"xpcall": "function",
|
||||
"_DEVICE_PAD_BOTTOM": 0,
|
||||
"ipairs": "function",
|
||||
"_TEV_BUILD": "0231",
|
||||
"_TEV_BUILD": "0240",
|
||||
"colour": "cdata",
|
||||
"print": "function",
|
||||
"_TEV_VERSION_MINOR": 23,
|
||||
"_TEV_VERSION_MINOR": 24,
|
||||
"pcall": "function",
|
||||
"gcinfo": "function",
|
||||
"loadstring": "function",
|
||||
|
@ -45,13 +45,13 @@
|
|||
"insert": "function"
|
||||
},
|
||||
"error": "function",
|
||||
"_TEV_VERSION": "0.23.1",
|
||||
"_TEV_VERSION": "0.24.0",
|
||||
"quaternion": "cdata",
|
||||
"_DEVICE": "Mac",
|
||||
"require": "function",
|
||||
"unpack": "function",
|
||||
"_VERSION": "Lua 5.1",
|
||||
"_TEV_VERSION_PATCH": 1,
|
||||
"_TEV_VERSION_PATCH": 0,
|
||||
"next": "function",
|
||||
"math": {
|
||||
"ceil": "function",
|
||||
|
@ -1391,7 +1391,7 @@
|
|||
"fov": {
|
||||
"hasGetter": true,
|
||||
"type": "number",
|
||||
"description": "",
|
||||
"description": "field of view",
|
||||
"hasSetter": true
|
||||
},
|
||||
"position": {
|
||||
|
@ -1503,6 +1503,19 @@
|
|||
},
|
||||
"networking": {
|
||||
"methods": {
|
||||
"broadcast": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "eventName"
|
||||
},
|
||||
{
|
||||
"type": "..."
|
||||
}
|
||||
],
|
||||
"returns": [],
|
||||
"description": "Reliably sends the information you pass to all direct connections. Note that a client cannot broadcast to other clients as they are not directly connected."
|
||||
},
|
||||
"getClient": {
|
||||
"parameters": [
|
||||
{
|
||||
|
@ -1514,10 +1527,121 @@
|
|||
"client"
|
||||
],
|
||||
"description": "Returns the client for the matching name or id you provide"
|
||||
},
|
||||
"initiate": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "appId"
|
||||
}
|
||||
],
|
||||
"returns": [],
|
||||
"description": ""
|
||||
},
|
||||
"sendToClient": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "client",
|
||||
"name": "client"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"name": "eventName"
|
||||
},
|
||||
{
|
||||
"type": "..."
|
||||
}
|
||||
],
|
||||
"returns": [],
|
||||
"description": "[SERVER ONLY] Reliably sends the information you pass"
|
||||
},
|
||||
"sendToServer": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "eventName"
|
||||
},
|
||||
{
|
||||
"type": "..."
|
||||
}
|
||||
],
|
||||
"returns": [],
|
||||
"description": "This is an alias for broadcast that only works on the client side."
|
||||
}
|
||||
},
|
||||
"className": "networking",
|
||||
"events": [],
|
||||
"events": {
|
||||
"changed": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "property"
|
||||
},
|
||||
{
|
||||
"type": "variant",
|
||||
"name": "oldValue"
|
||||
},
|
||||
{
|
||||
"type": "variant",
|
||||
"name": "newValue"
|
||||
}
|
||||
],
|
||||
"description": "Fired when a property is changed."
|
||||
},
|
||||
"_clientConnected": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "client",
|
||||
"name": "user"
|
||||
}
|
||||
],
|
||||
"description": "Fired when a user connects"
|
||||
},
|
||||
"_disconnected": {
|
||||
"parameters": [],
|
||||
"description": "Fired when a connection fails or stops"
|
||||
},
|
||||
"_update": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "message"
|
||||
}
|
||||
],
|
||||
"description": "Fired when an update begins"
|
||||
},
|
||||
"_connected": {
|
||||
"parameters": [],
|
||||
"description": "Fired when a connection has started"
|
||||
},
|
||||
"_clientDisconnected": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "client",
|
||||
"name": "user"
|
||||
}
|
||||
],
|
||||
"description": "Fired when a user disconnects"
|
||||
},
|
||||
"_downloadProgress": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "percentage"
|
||||
}
|
||||
],
|
||||
"description": "Fired when an update progresses"
|
||||
},
|
||||
"_localAuthenticating": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "status"
|
||||
}
|
||||
],
|
||||
"description": "Fired when the local user authenticates"
|
||||
}
|
||||
},
|
||||
"constructable": false,
|
||||
"properties": {
|
||||
"clients": {
|
||||
|
@ -1526,6 +1650,12 @@
|
|||
"description": "A readonly list of clients, excluding local client when offline",
|
||||
"hasSetter": false
|
||||
},
|
||||
"isConnected": {
|
||||
"hasGetter": true,
|
||||
"type": "boolean",
|
||||
"description": "True when a connection is established",
|
||||
"hasSetter": false
|
||||
},
|
||||
"localClient": {
|
||||
"hasGetter": true,
|
||||
"type": "client",
|
||||
|
@ -1598,7 +1728,33 @@
|
|||
}
|
||||
},
|
||||
"className": "block",
|
||||
"events": [],
|
||||
"events": {
|
||||
"changed": {
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"name": "property"
|
||||
},
|
||||
{
|
||||
"type": "variant",
|
||||
"name": "oldValue"
|
||||
},
|
||||
{
|
||||
"type": "variant",
|
||||
"name": "newValue"
|
||||
}
|
||||
],
|
||||
"description": "Fired when a property is changed."
|
||||
},
|
||||
"collisionEnded": {
|
||||
"parameters": [],
|
||||
"description": ""
|
||||
},
|
||||
"collisionStarted": {
|
||||
"parameters": [],
|
||||
"description": ""
|
||||
}
|
||||
},
|
||||
"constructable": true,
|
||||
"extends": "sceneObject",
|
||||
"properties": {
|
||||
|
@ -1644,9 +1800,9 @@
|
|||
"description": "",
|
||||
"hasSetter": true
|
||||
},
|
||||
"linearFactor": {
|
||||
"roughness": {
|
||||
"hasGetter": true,
|
||||
"type": "vector3",
|
||||
"type": "number",
|
||||
"description": "",
|
||||
"hasSetter": true
|
||||
},
|
||||
|
@ -1656,9 +1812,9 @@
|
|||
"description": "",
|
||||
"hasSetter": true
|
||||
},
|
||||
"roughness": {
|
||||
"linearFactor": {
|
||||
"hasGetter": true,
|
||||
"type": "number",
|
||||
"type": "vector3",
|
||||
"description": "",
|
||||
"hasSetter": true
|
||||
}
|
||||
|
@ -1678,21 +1834,28 @@
|
|||
],
|
||||
"description": "Returns the source code of the loaded app or nil if no app is loaded."
|
||||
},
|
||||
"loadRemote": {
|
||||
"parameters": [],
|
||||
"returns": [],
|
||||
"description": "Starts uploading the currently loaded UNPACKAGED app"
|
||||
},
|
||||
"loadDashboard": {
|
||||
"parameters": [],
|
||||
"returns": [],
|
||||
"description": "Resets the environment and loads the default Dashboard app"
|
||||
},
|
||||
"loadRemote": {
|
||||
"parameters": [],
|
||||
"returns": [],
|
||||
"description": "Starts uploading the currently loaded UNPACKAGED app"
|
||||
},
|
||||
"upload": {
|
||||
"parameters": [],
|
||||
"returns": [],
|
||||
"description": "Starts uploading the currently loaded UNPACKAGED app"
|
||||
},
|
||||
"promptAppDirectory": {
|
||||
"parameters": [],
|
||||
"returns": [
|
||||
"boolean"
|
||||
],
|
||||
"description": "Prompts the user to select a directory containing the manifest.json file"
|
||||
},
|
||||
"promptApp": {
|
||||
"parameters": [],
|
||||
"returns": [
|
||||
|
@ -1717,12 +1880,10 @@
|
|||
],
|
||||
"description": "Resets the environment and loads the Lua string provided as an app."
|
||||
},
|
||||
"promptAppDirectory": {
|
||||
"test": {
|
||||
"parameters": [],
|
||||
"returns": [
|
||||
"boolean"
|
||||
],
|
||||
"description": "Prompts the user to select a directory containing the manifest.json file"
|
||||
"returns": [],
|
||||
"description": "Uploads the unpackaged app and spins up a temporary test server on our cloud"
|
||||
},
|
||||
"loadWorkshop": {
|
||||
"parameters": [],
|
||||
|
@ -2237,5 +2398,5 @@
|
|||
"properties": []
|
||||
}
|
||||
},
|
||||
"build": "0231"
|
||||
"build": "0240"
|
||||
}
|
|
@ -3,8 +3,8 @@
|
|||
local share = teverse.construct("guiTextBox", {
|
||||
parent = teverse.coreInterface,
|
||||
size = guiCoord(0, 60, 0, 16),
|
||||
position = guiCoord(0.5, -65, 1, -20),
|
||||
strokeRadius = 4,
|
||||
position = guiCoord(0.5, -65, 1, -26),
|
||||
strokeRadius = 2,
|
||||
text = "Share",
|
||||
textAlign = "middle",
|
||||
textSize = 12
|
||||
|
@ -13,13 +13,23 @@ local share = teverse.construct("guiTextBox", {
|
|||
local reload = teverse.construct("guiTextBox", {
|
||||
parent = teverse.coreInterface,
|
||||
size = guiCoord(0, 60, 0, 16),
|
||||
position = guiCoord(0.5, 5, 1, -20),
|
||||
strokeRadius = 4,
|
||||
position = guiCoord(0.5, 5, 1, -26),
|
||||
strokeRadius = 2,
|
||||
text = "Reload",
|
||||
textAlign = "middle",
|
||||
textSize = 12
|
||||
})
|
||||
|
||||
local test = teverse.construct("guiTextBox", {
|
||||
parent = teverse.coreInterface,
|
||||
size = guiCoord(0, 90, 0, 16),
|
||||
position = guiCoord(1.0, -140, 1, -26),
|
||||
strokeRadius = 2,
|
||||
text = "Remote Test",
|
||||
textAlign = "middle",
|
||||
textSize = 12
|
||||
})
|
||||
|
||||
reload:on("mouseLeftUp", function()
|
||||
teverse.apps:reload()
|
||||
end)
|
||||
|
@ -102,4 +112,79 @@ share:on("mouseLeftUp", function()
|
|||
|
||||
teverse.input:waitFor("mouseLeftUp")
|
||||
teverse.apps:reload()
|
||||
end)
|
||||
|
||||
|
||||
test:on("mouseLeftUp", function()
|
||||
test.visible = false
|
||||
reload.visible = false
|
||||
|
||||
local backdrop = teverse.construct("guiFrame", {
|
||||
parent = teverse.coreInterface,
|
||||
size = guiCoord(1, 0, 1, 0),
|
||||
position = guiCoord(0, 0, 0, 0),
|
||||
backgroundColour = colour(.25, .25, .25),
|
||||
backgroundAlpha = 0.6,
|
||||
zIndex = 1000
|
||||
})
|
||||
|
||||
local spinner = teverse.construct("guiIcon", {
|
||||
parent = backdrop,
|
||||
size = guiCoord(0, 40, 0, 40),
|
||||
position = guiCoord(0.5, -20, 0.5, -20),
|
||||
iconMax = 40,
|
||||
iconColour = colour(1, 1, 1),
|
||||
iconType = "faSolid",
|
||||
iconId = "spinner",
|
||||
iconAlpha = 0.9
|
||||
})
|
||||
|
||||
spawn(function()
|
||||
while sleep() and spinner.alive do
|
||||
spinner.rotation = spinner.rotation + math.rad(1)
|
||||
end
|
||||
end)
|
||||
|
||||
teverse.apps:test()
|
||||
local success, result = teverse.apps:waitFor("upload")
|
||||
spinner:destroy()
|
||||
|
||||
local container = teverse.construct("guiTextBox", {
|
||||
parent = backdrop,
|
||||
size = guiCoord(0, 460, 0, 120),
|
||||
position = guiCoord(0.5, -230, 0.5, -60),
|
||||
backgroundColour = colour(1, 1, 1),
|
||||
dropShadowAlpha = 0.3,
|
||||
})
|
||||
|
||||
local label = teverse.construct("guiTextBox", {
|
||||
parent = container,
|
||||
size = guiCoord(1.0, -20, 1.0, -20),
|
||||
position = guiCoord(0, 10, 0, 10),
|
||||
backgroundAlpha = 0.0,
|
||||
textSize = 16,
|
||||
textWrap = true,
|
||||
textAlign = "topLeft",
|
||||
textFont = "tevurl:fonts/firaCodeRegular.otf"
|
||||
})
|
||||
|
||||
local title = teverse.construct("guiTextBox", {
|
||||
parent = backdrop,
|
||||
size = guiCoord(0, 460, 0, 20),
|
||||
position = guiCoord(0.5, -230, 0.5, -80),
|
||||
backgroundColour = colour(0.9, 0.9, 0.9),
|
||||
textSize = 18,
|
||||
dropShadowAlpha = 0.3,
|
||||
textAlign = "middle",
|
||||
zIndex = 2
|
||||
})
|
||||
|
||||
if success then
|
||||
teverse.apps:reload()
|
||||
else
|
||||
title.backgroundColour = colour.rgb(179, 70, 70)
|
||||
title.textColour = colour.white()
|
||||
title.text = "Something went wrong"
|
||||
label.text = result
|
||||
end
|
||||
end)
|
|
@ -0,0 +1,69 @@
|
|||
return function(app)
|
||||
local appGui = teverse.construct("guiFrame", {
|
||||
strokeRadius = 2,
|
||||
dropShadowAlpha = 0.15,
|
||||
strokeAlpha = 0.05
|
||||
})
|
||||
|
||||
teverse.guiHelper.hoverColour(appGui, colour.rgb(247, 247, 247))
|
||||
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = appGui,
|
||||
size = guiCoord(1.0, -20, 0, 22),
|
||||
position = guiCoord(0, 10, 0, 5),
|
||||
backgroundAlpha = 0,
|
||||
text = app.name,
|
||||
textSize = 22,
|
||||
textAlign = "middleLeft",
|
||||
textFont = "tevurl:fonts/openSansBold.ttf",
|
||||
active = false
|
||||
})
|
||||
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = appGui,
|
||||
size = guiCoord(1.0, -20, 0, 16),
|
||||
position = guiCoord(0, 10, 0, 24),
|
||||
backgroundAlpha = 0,
|
||||
textAlpha = 0.5,
|
||||
text = "by " .. app.owner.username,
|
||||
textSize = 16,
|
||||
active = false
|
||||
})
|
||||
|
||||
local img = teverse.construct("guiImage", {
|
||||
size = guiCoord(1, 0, 1, 0),
|
||||
parent = appGui,
|
||||
active = false,
|
||||
zIndex = -1
|
||||
})
|
||||
|
||||
local launch = teverse.construct("guiTextBox", {
|
||||
parent = appGui,
|
||||
size = guiCoord(0, 80, 0, 24),
|
||||
position = guiCoord(1, -90, 1, -34),
|
||||
backgroundColour = colour.rgb(61, 164, 54),
|
||||
text = "LAUNCH",
|
||||
textAlign = "middle",
|
||||
textColour = colour(1, 1, 1),
|
||||
textFont = "tevurl:fonts/openSansBold.ttf",
|
||||
textSize = 18,
|
||||
strokeRadius = 12,
|
||||
dropShadowAlpha = 0.1
|
||||
})
|
||||
|
||||
launch:on("mouseEnter", function()
|
||||
launch.backgroundColour = colour.rgb(81, 184, 64)
|
||||
launch.dropShadowAlpha = 0.0
|
||||
launch:waitFor("mouseExit")
|
||||
launch.backgroundColour = colour.rgb(61, 164, 54)
|
||||
launch.dropShadowAlpha = 0.1
|
||||
end)
|
||||
|
||||
if (app.iconUrl and app.iconUrl ~= "") then
|
||||
img.image = app.iconUrl
|
||||
else
|
||||
img.image = "tevurl:img/tevapp.png"
|
||||
end
|
||||
|
||||
return appGui, launch
|
||||
end
|
|
@ -1,42 +1,10 @@
|
|||
local function createApp(app)
|
||||
local appGui = teverse.construct("guiFrame", {
|
||||
strokeRadius = 2,
|
||||
dropShadowAlpha = 0.15,
|
||||
strokeAlpha = 0.05
|
||||
})
|
||||
|
||||
teverse.guiHelper.hoverColour(appGui, colour.rgb(247, 247, 247))
|
||||
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = appGui,
|
||||
size = guiCoord(1.0, -20, 0, 22),
|
||||
position = guiCoord(0, 10, 0, 5),
|
||||
backgroundAlpha = 0,
|
||||
text = app.name,
|
||||
textSize = 22,
|
||||
textAlign = "middleLeft",
|
||||
textFont = "tevurl:fonts/openSansBold.ttf",
|
||||
active = false
|
||||
})
|
||||
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = appGui,
|
||||
size = guiCoord(1.0, -20, 0, 16),
|
||||
position = guiCoord(0, 10, 0, 24),
|
||||
backgroundAlpha = 0,
|
||||
textAlpha = 0.5,
|
||||
text = "by " .. app.owner.username,
|
||||
textSize = 16,
|
||||
active = false
|
||||
})
|
||||
|
||||
return appGui
|
||||
end
|
||||
local createApp = require("tevgit:core/dashboard/appCard.lua")
|
||||
|
||||
return {
|
||||
name = "Apps",
|
||||
iconId = "shapes",
|
||||
iconType = "faSolid",
|
||||
scrollView = true,
|
||||
setup = function(page)
|
||||
local loading = teverse.construct("guiTextBox", {
|
||||
parent = page,
|
||||
|
@ -64,97 +32,35 @@ return {
|
|||
local subtitle = teverse.construct("guiTextBox", {
|
||||
parent = page,
|
||||
size = guiCoord(1.0, -20, 0, 18),
|
||||
position = guiCoord(0, 10, 0, 105),
|
||||
position = guiCoord(0, 10, 0, 55),
|
||||
backgroundAlpha = 0,
|
||||
text = "Loading Apps",
|
||||
textSize = 18,
|
||||
textAlign = "middleLeft"
|
||||
})
|
||||
|
||||
local myApps = teverse.construct("guiFrame", {
|
||||
parent = page,
|
||||
size = guiCoord(1.0, -20, 0, 38),
|
||||
position = guiCoord(0, 10, 0, 62),
|
||||
backgroundAlpha = 0
|
||||
})
|
||||
|
||||
teverse.http:get("https://teverse.com/api/users/" .. teverse.networking.localClient.id .. "/apps", {
|
||||
["Authorization"] = "BEARER " .. teverse.userToken
|
||||
}, function(code, body)
|
||||
if code == 200 then
|
||||
local apps = teverse.json:decode(body)
|
||||
for i,app in pairs(apps) do
|
||||
local appGui = teverse.construct("guiFrame", {
|
||||
strokeRadius = 2,
|
||||
dropShadowAlpha = 0.15,
|
||||
strokeAlpha = 0.05,
|
||||
parent = myApps,
|
||||
position = guiCoord(0, (i-1)*140, 0, 0),
|
||||
size = guiCoord(0, 130, 1, 0)
|
||||
})
|
||||
|
||||
teverse.guiHelper.hoverColour(appGui, colour.rgb(247, 247, 247))
|
||||
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = appGui,
|
||||
size = guiCoord(1.0, -20, 0, 16),
|
||||
position = guiCoord(0, 10, 0, 5),
|
||||
backgroundAlpha = 0,
|
||||
text = app.name,
|
||||
textSize = 18,
|
||||
textAlign = "middleLeft",
|
||||
textFont = "tevurl:fonts/openSansSemiBold.ttf",
|
||||
active = false
|
||||
})
|
||||
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = appGui,
|
||||
size = guiCoord(1.0, -20, 0, 14),
|
||||
position = guiCoord(0, 10, 0, 21),
|
||||
backgroundAlpha = 0,
|
||||
text = app.approved and "Approved" or "Pending",
|
||||
textSize = 14,
|
||||
textAlign = "middleLeft",
|
||||
textFont = "tevurl:fonts/openSansBold.ttf",
|
||||
active = false
|
||||
})
|
||||
|
||||
appGui:on("mouseLeftUp", function()
|
||||
if not loading.visible then
|
||||
loading.text = "Loading App"
|
||||
loading.visible = true
|
||||
teverse.apps:loadRemote(app.id)
|
||||
teverse.apps:waitFor("download")
|
||||
loading.visible = false
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local appsContainer = teverse.construct("guiFrame", {
|
||||
parent = page,
|
||||
size = guiCoord(1.0, -20, 1, -140),
|
||||
position = guiCoord(0, 10, 0, 130),
|
||||
size = guiCoord(1.0, -20, 1, -100),
|
||||
position = guiCoord(0, 10, 0, 80),
|
||||
backgroundAlpha = 0
|
||||
})
|
||||
|
||||
if _DEVICE:sub(0, 6) == "iPhone" then
|
||||
teverse.guiHelper
|
||||
.gridConstraint(appsContainer, {
|
||||
cellSize = guiCoord(0, page.absoluteSize.x - 20, 0, 50),
|
||||
cellSize = guiCoord(0, page.absoluteSize.x - 20, 0, page.absoluteSize.x - 20),
|
||||
cellMargin = guiCoord(0, 15, 0, 25)
|
||||
})
|
||||
else
|
||||
teverse.guiHelper
|
||||
.gridConstraint(appsContainer, {
|
||||
cellSize = guiCoord(0, 160, 0, 50),
|
||||
cellSize = guiCoord(0, 200, 0, 200),
|
||||
cellMargin = guiCoord(0, 15, 0, 25)
|
||||
})
|
||||
end
|
||||
|
||||
if _DEVICE:sub(0, 6) ~= "iPhone" then
|
||||
local appGui = createApp({
|
||||
local appGui, button = createApp({
|
||||
id = "",
|
||||
name = "Learn Code",
|
||||
owner = {
|
||||
|
@ -163,7 +69,7 @@ return {
|
|||
})
|
||||
appGui.name = "a"
|
||||
appGui.parent = appsContainer
|
||||
appGui:on("mouseLeftUp", function()
|
||||
button:on("mouseLeftUp", function()
|
||||
if not loading.visible then
|
||||
loading.visible = false
|
||||
teverse.apps:loadString("require('tevgit:core/tutorials/main.lua')")
|
||||
|
@ -178,13 +84,17 @@ return {
|
|||
local apps = teverse.json:decode(body)
|
||||
subtitle.text = "Found " .. #apps .. " public apps:"
|
||||
for _,app in pairs(apps) do
|
||||
local appGui = createApp(app)
|
||||
local appGui, button = createApp(app)
|
||||
appGui.parent = appsContainer
|
||||
appGui:on("mouseLeftUp", function()
|
||||
button:on("mouseLeftUp", function()
|
||||
if not loading.visible then
|
||||
loading.text = "Loading App"
|
||||
loading.text = "Loading App " .. (app.packageNetworked and "Online" or "Offline")
|
||||
loading.visible = true
|
||||
teverse.apps:loadRemote(app.id)
|
||||
if not app.packageNetworked then
|
||||
teverse.apps:loadRemote(app.id)
|
||||
else
|
||||
teverse.networking:initiate(app.id)
|
||||
end
|
||||
teverse.apps:waitFor("download")
|
||||
loading.visible = false
|
||||
end
|
||||
|
@ -194,5 +104,18 @@ return {
|
|||
subtitle.text = "Server error."
|
||||
end
|
||||
end)
|
||||
|
||||
local function calculateScrollHeight()
|
||||
local y = 0
|
||||
for _,v in pairs(appsContainer.children) do
|
||||
y = math.max(y, v.absolutePosition.y + 320)
|
||||
end
|
||||
appsContainer.size = guiCoord(1.0, -20, 0, y - appsContainer.absolutePosition.y)
|
||||
page.canvasSize = guiCoord(1, 0, 0, y - appsContainer.absolutePosition.y)
|
||||
end
|
||||
|
||||
calculateScrollHeight()
|
||||
appsContainer:on("childAdded", calculateScrollHeight)
|
||||
teverse.input:on("screenResized", calculateScrollHeight)
|
||||
end
|
||||
}
|
|
@ -1,8 +1,24 @@
|
|||
local createApp = require("tevgit:core/dashboard/appCard.lua")
|
||||
|
||||
return {
|
||||
name = "Develop",
|
||||
iconId = "layer-group",
|
||||
iconType = "faSolid",
|
||||
scrollView = true,
|
||||
setup = function(page)
|
||||
local loading = teverse.construct("guiTextBox", {
|
||||
parent = page,
|
||||
size = guiCoord(1.0, 100, 1.0, 100),
|
||||
position = guiCoord(0, -50, 0, -50),
|
||||
backgroundAlpha = 0.4,
|
||||
backgroundColour = colour(0, 0, 0),
|
||||
text = "Working...",
|
||||
textColour = colour(0,0,0),
|
||||
textAlign = "middle",
|
||||
visible = false,
|
||||
zIndex = 10000
|
||||
})
|
||||
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = page,
|
||||
size = guiCoord(1.0, -20, 0, 48),
|
||||
|
@ -90,5 +106,69 @@ return {
|
|||
active = false
|
||||
})
|
||||
end
|
||||
|
||||
local appsContainer = teverse.construct("guiFrame", {
|
||||
parent = page,
|
||||
size = guiCoord(1.0, -20, 1, -150),
|
||||
position = guiCoord(0, 10, 0, 150),
|
||||
backgroundAlpha = 0
|
||||
})
|
||||
|
||||
teverse.guiHelper
|
||||
.gridConstraint(appsContainer, {
|
||||
cellSize = guiCoord(0, 200, 0, 200),
|
||||
cellMargin = guiCoord(0, 15, 0, 25)
|
||||
})
|
||||
|
||||
teverse.guiHelper
|
||||
.bind(appsContainer, "xs", {
|
||||
size = guiCoord(1, -20, 1, -330),
|
||||
position = guiCoord(0, 10, 0, 330)
|
||||
})
|
||||
.bind(appsContainer, "lg", {
|
||||
size = guiCoord(1, 0, 1, -150),
|
||||
position = guiCoord(0, 0, 0, 150)
|
||||
})
|
||||
|
||||
teverse.http:get("https://teverse.com/api/users/" .. teverse.networking.localClient.id .. "/apps", {
|
||||
["Authorization"] = "BEARER " .. teverse.userToken
|
||||
}, function(code, body)
|
||||
if code == 200 then
|
||||
local apps = teverse.json:decode(body)
|
||||
for _,app in pairs(apps) do
|
||||
local appGui, launchButton = createApp(app)
|
||||
appGui.parent = appsContainer
|
||||
launchButton:on("mouseLeftUp", function()
|
||||
if not loading.visible then
|
||||
loading.text = "Loading App " .. (app.packageNetworked and "Online" or "Offline")
|
||||
loading.visible = true
|
||||
if not app.packageNetworked then
|
||||
teverse.apps:loadRemote(app.id)
|
||||
else
|
||||
teverse.networking:initiate(app.id)
|
||||
end
|
||||
teverse.apps:waitFor("download")
|
||||
loading.visible = false
|
||||
end
|
||||
end)
|
||||
end
|
||||
else
|
||||
subtitle.text = "Server error."
|
||||
end
|
||||
end)
|
||||
|
||||
local function calculateScrollHeight()
|
||||
local y = 0
|
||||
for _,v in pairs(appsContainer.children) do
|
||||
y = math.max(y, v.absolutePosition.y + 390)
|
||||
end
|
||||
|
||||
appsContainer.size = guiCoord(1.0, -20, 0, y - appsContainer.absolutePosition.y)
|
||||
page.canvasSize = guiCoord(1, 0, 0, y - appsContainer.absolutePosition.y)
|
||||
end
|
||||
|
||||
calculateScrollHeight()
|
||||
appsContainer:on("childAdded", calculateScrollHeight)
|
||||
teverse.input:on("screenResized", calculateScrollHeight)
|
||||
end
|
||||
}
|
|
@ -81,7 +81,7 @@ controller.setup = function()
|
|||
local pages = {}
|
||||
|
||||
local function setupPage(page)
|
||||
local container = teverse.construct("guiFrame", {
|
||||
local container = teverse.construct(page.scrollView and "guiScrollView" or "guiFrame", {
|
||||
parent = body,
|
||||
size = guiCoord(1, -40, 1, -80),
|
||||
position = guiCoord(0, 10, 0, 80),
|
||||
|
@ -90,6 +90,11 @@ controller.setup = function()
|
|||
visible = false
|
||||
})
|
||||
|
||||
if page.scrollView then
|
||||
container.scrollbarWidth = 4
|
||||
container.active = true
|
||||
end
|
||||
|
||||
teverse.guiHelper
|
||||
.bind(container, "xs", {
|
||||
size = guiCoord(1, -120, 1, -80),
|
||||
|
|
|
@ -0,0 +1,185 @@
|
|||
local pingScale = 300
|
||||
local downloadScale = 1024 * 1
|
||||
local uploadScale = 1024 * 1
|
||||
|
||||
return function()
|
||||
local main = teverse.construct("guiFrame", {
|
||||
size = guiCoord(0, 250, 0, 200),
|
||||
position = guiCoord(1, -250, 1, -260),
|
||||
strokeAlpha = 0.5
|
||||
})
|
||||
|
||||
local container = teverse.construct("guiFrame", {
|
||||
parent = main,
|
||||
size = guiCoord(1, 0, 1, -100),
|
||||
position = guiCoord(0, 0, 0, 0),
|
||||
strokeAlpha = 0.5
|
||||
})
|
||||
|
||||
if _TEV_VERSION_MINOR == 24 and _TEV_VERSION_PATCH < 3 then
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = container,
|
||||
size = guiCoord(0.8, 0, 0.8, 0),
|
||||
position = guiCoord(0.1, 0, 0.1, 0),
|
||||
backgroundAlpha = 0,
|
||||
textAlign = "middle",
|
||||
textColour = colour(0.5, 0, 0),
|
||||
textSize = 16,
|
||||
text = "Network stats are not stable on your version. 0.24.3 is required.",
|
||||
textMultiline = true,
|
||||
textWrap = true
|
||||
})
|
||||
return main
|
||||
end
|
||||
|
||||
local pingContainer = teverse.construct("guiFrame", {
|
||||
parent = container,
|
||||
size = guiCoord(1, -40, 1, -10),
|
||||
position = guiCoord(0, 0, 0, 5),
|
||||
backgroundAlpha = 0,
|
||||
clip = true
|
||||
})
|
||||
|
||||
local pingLabel = teverse.construct("guiTextBox", {
|
||||
parent = container,
|
||||
size = guiCoord(0, 32, 0, 12),
|
||||
backgroundAlpha = 0,
|
||||
textAlign = "middleRight",
|
||||
textColour = colour(1, 0, 0),
|
||||
textSize = 12
|
||||
})
|
||||
|
||||
local receivedContainer = teverse.construct("guiFrame", {
|
||||
parent = container,
|
||||
size = guiCoord(1, -50, 1, -10),
|
||||
position = guiCoord(0, 0, 0, 5),
|
||||
backgroundAlpha = 0,
|
||||
clip = true
|
||||
})
|
||||
|
||||
local receivedLabel = teverse.construct("guiTextBox", {
|
||||
parent = container,
|
||||
size = guiCoord(0, 45, 0, 12),
|
||||
backgroundAlpha = 0,
|
||||
textAlign = "middleRight",
|
||||
textColour = colour(0, 0.5, 0),
|
||||
textSize = 12
|
||||
})
|
||||
|
||||
local sentContainer = teverse.construct("guiFrame", {
|
||||
parent = container,
|
||||
size = guiCoord(1, -50, 1, -10),
|
||||
position = guiCoord(0, 0, 0, 5),
|
||||
backgroundAlpha = 0,
|
||||
clip = true
|
||||
})
|
||||
|
||||
local sentLabel = teverse.construct("guiTextBox", {
|
||||
parent = container,
|
||||
size = guiCoord(0, 45, 0, 12),
|
||||
backgroundAlpha = 0,
|
||||
textAlign = "middleRight",
|
||||
textColour = colour(0, 0, 0.5),
|
||||
textSize = 12
|
||||
})
|
||||
|
||||
local statOutput = teverse.construct("guiTextBox", {
|
||||
parent = main,
|
||||
size = guiCoord(1, -10, 0, 100),
|
||||
position = guiCoord(0, 5, 1, -95),
|
||||
backgroundAlpha = 0,
|
||||
textAlign = "topLeft",
|
||||
textColour = colour(0, 0, 0),
|
||||
textSize = 14,
|
||||
text = "",
|
||||
textMultiline = true,
|
||||
textWrap = true
|
||||
})
|
||||
|
||||
spawn(function()
|
||||
local lastPing = -1
|
||||
local lastReceive = 0
|
||||
local lastSend = 0
|
||||
|
||||
-- Needs reworked
|
||||
while sleep(0.5) do
|
||||
local stats = teverse.networking:getStats()
|
||||
|
||||
pingLabel.text = stats.lastPing .. "ms"
|
||||
pingLabel.position = guiCoord(1.0, -35, math.min(1 - (stats.lastPing / pingScale), 1), -13)
|
||||
|
||||
local newLine = teverse.construct("guiLine", {
|
||||
parent = pingContainer,
|
||||
pointA = guiCoord(1.0, 0, 1 - (lastPing / pingScale), -1),
|
||||
pointB = guiCoord(1.1, 0, 1 - (stats.lastPing / pingScale), -1),
|
||||
lineColour = colour(1, 0, 0)
|
||||
})
|
||||
lastPing = stats.lastPing
|
||||
|
||||
local pingChildren = pingContainer.children
|
||||
for i,v in pairs(pingChildren) do
|
||||
teverse.tween:begin(v, 0.5, {
|
||||
pointA = v.pointA - guiCoord(0.1, 0, 0, 0),
|
||||
pointB = v.pointB - guiCoord(0.1, 0, 0, 0)
|
||||
}, "linear")
|
||||
if #pingChildren == 12 and i == 1 then
|
||||
v:destroy()
|
||||
end
|
||||
end
|
||||
|
||||
receivedLabel.text = string.format("%.2f kb-i", stats.lastSecondMessageBytesReceived/1024)
|
||||
receivedLabel.position = guiCoord(1.0, -50, math.min(1 - (stats.lastSecondMessageBytesReceived / downloadScale), 1), -13)
|
||||
|
||||
local newLine = teverse.construct("guiLine", {
|
||||
parent = receivedContainer,
|
||||
pointA = guiCoord(1.0, 0, 1 - (lastReceive / downloadScale), -1),
|
||||
pointB = guiCoord(1.1, 0, 1 - (stats.lastSecondMessageBytesReceived / downloadScale), -1),
|
||||
lineColour = colour(0, 0.5, 0)
|
||||
})
|
||||
lastReceive = stats.lastSecondMessageBytesReceived
|
||||
|
||||
local receivedChildren = receivedContainer.children
|
||||
for i,v in pairs(receivedChildren) do
|
||||
teverse.tween:begin(v, 0.5, {
|
||||
pointA = v.pointA - guiCoord(0.1, 0, 0, 0),
|
||||
pointB = v.pointB - guiCoord(0.1, 0, 0, 0)
|
||||
}, "linear")
|
||||
if #receivedChildren == 12 and i == 1 then
|
||||
v:destroy()
|
||||
end
|
||||
end
|
||||
|
||||
sentLabel.text = string.format("%.2f kb-o", stats.lastSecondMessageBytesSent/1024)
|
||||
sentLabel.position = guiCoord(1.0, -50, math.min(1 - (stats.lastSecondMessageBytesSent / downloadScale), 1), -13)
|
||||
|
||||
local newLine = teverse.construct("guiLine", {
|
||||
parent = sentContainer,
|
||||
pointA = guiCoord(1.0, 0, 1 - (lastSend / downloadScale), -1),
|
||||
pointB = guiCoord(1.1, 0, 1 - (stats.lastSecondMessageBytesSent / downloadScale), -1),
|
||||
lineColour = colour(0, 0, 0.5)
|
||||
})
|
||||
lastSend = stats.lastSecondMessageBytesSent
|
||||
|
||||
local sentChildren = sentContainer.children
|
||||
for i,v in pairs(sentChildren) do
|
||||
teverse.tween:begin(v, 0.5, {
|
||||
pointA = v.pointA - guiCoord(0.1, 0, 0, 0),
|
||||
pointB = v.pointB - guiCoord(0.1, 0, 0, 0)
|
||||
}, "linear")
|
||||
if #sentChildren == 12 and i == 1 then
|
||||
v:destroy()
|
||||
end
|
||||
end
|
||||
|
||||
statOutput.text = "Ping Avg: " .. stats.averagePing .. "ms\n" ..
|
||||
"Lowest Ping: " .. stats.lowestPing .. "ms\n" ..
|
||||
"Last Ping: " .. stats.lastPing .. "ms\n" ..
|
||||
"---------\n" ..
|
||||
"1s Packet Loss: " .. stats.packetlossLastSecond .. "\n" ..
|
||||
"Packet Loss: " .. stats.packetlossTotal .. "\n" ..
|
||||
"Send Buffer: " .. stats.messagesInSendBuffer
|
||||
end
|
||||
end)
|
||||
|
||||
return main
|
||||
end
|
|
@ -7,7 +7,7 @@ return {
|
|||
developerMode = false, -- Holds the developer_mode boolean and is set in main.lua
|
||||
sideBarPageDefault = nil, -- Holds the default sidebar page (view) as a string and is set in topbarInterface.lua
|
||||
sideBarPageActive = nil, -- Holds the current active sidebar page (view) as a string and is set in topbarInterface.lua
|
||||
commandBarTriggers = {},
|
||||
commandGroups = {}, -- Holds the core command groups used internally by workshop
|
||||
defaultColours = { -- Default colors used for theming UI components (~\library\ui\components)
|
||||
--primary = colour.rgb(112, 112, 112),
|
||||
primary = colour.rgb(52, 58, 64),
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
-- Copyright 2020- Teverse
|
||||
-- This script is responsible for parsing and storing commands
|
||||
|
||||
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
||||
|
||||
--[[
|
||||
TEST DOCUMENT
|
||||
|
||||
-- How to register a plugin
|
||||
|
||||
local commands = require("...")
|
||||
local extension = commands.createGroup("Hello")
|
||||
extension.command("ping", function() print("pong") end)
|
||||
-- >hello: ping
|
||||
---> pong!
|
||||
]]
|
||||
|
||||
return {
|
||||
createGroup = function(id)
|
||||
local data = {}
|
||||
self = data
|
||||
self.id = id
|
||||
self.commands = {}
|
||||
table.insert(globals.commandGroups, id)
|
||||
|
||||
self.command = function(id, callback)
|
||||
table.insert(commands, {id=callback})
|
||||
end
|
||||
|
||||
self.invokeCommand = function(id)
|
||||
for i,v in pairs(self.commands) do
|
||||
for k,l in pairs(self.commands[i]) do
|
||||
if l == id then return print("FOUND: "..id) end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return data
|
||||
end,
|
||||
|
||||
parse = function(text)
|
||||
-- Sytax
|
||||
---> group: name
|
||||
local commandIndex = string.find(text, ":")
|
||||
if commandIndex == -1 then print("Failed to find command group: "..text) return end
|
||||
local commandGroup = string.sub(text, 0, (commandIndex-1))
|
||||
print("commandGroup: "..commandGroup)
|
||||
|
||||
|
||||
--[[for i,v in pairs(globals.commandGroups) do
|
||||
for k,l in pairs(self.commands[i]) do
|
||||
if l ==
|
||||
end
|
||||
end]]--
|
||||
end
|
||||
}
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
||||
local toolTip = require("tevgit:workshop/library/ui/components/toolTip.lua") -- UI component
|
||||
local commands = require("tevgit:workshop/library/toolchain/commands.lua") -- Commandbar toolchain component
|
||||
|
||||
return {
|
||||
construct = function(idValue, nameValue)
|
||||
|
@ -157,6 +158,7 @@ return {
|
|||
print("Command: "..(commandBarField.text))
|
||||
|
||||
-- Invoke Command Trigger
|
||||
commands.parse(commandBarField.text)
|
||||
|
||||
commandBarField.text = " >"
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue