mirror of https://github.com/teverse/teverse
Compare commits
2 Commits
74012b5fa8
...
155e2ac581
Author | SHA1 | Date |
---|---|---|
Jay | 155e2ac581 | |
Jay | 3c2e30b424 |
|
@ -1,13 +1,17 @@
|
|||
-- This script is ran when the user is running a shared app
|
||||
|
||||
local appsContainer = teverse.construct("guiTextBox", {
|
||||
local disclaimer = teverse.construct("guiTextBox", {
|
||||
parent = teverse.coreInterface,
|
||||
size = guiCoord(1, 0, 0, 15),
|
||||
position = guiCoord(0, 0, 1, -15),
|
||||
size = guiCoord(1, -60, 0, 20),
|
||||
position = guiCoord(0, 30, 1, -20),
|
||||
backgroundAlpha = 0,
|
||||
text = "You are running user generated code",
|
||||
textShadowSize = 4,
|
||||
textShadowSize = 2,
|
||||
textSize = 12,
|
||||
textColour = colour(1, 1, 1),
|
||||
textAlign = "middle"
|
||||
})
|
||||
|
||||
disclaimer:on("mouseLeftUp", function()
|
||||
teverse.apps:reload()
|
||||
end)
|
|
@ -1,3 +1,51 @@
|
|||
local function createApp(app)
|
||||
local appGui = teverse.construct("guiFrame", {
|
||||
strokeAlpha = 0.1,
|
||||
strokeRadius = 4
|
||||
})
|
||||
|
||||
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
|
||||
})
|
||||
|
||||
teverse.construct("guiIcon", {
|
||||
parent = appGui,
|
||||
size = guiCoord(1, 0, 1, -45),
|
||||
position = guiCoord(0, 0, 0, 45),
|
||||
iconMax = 20,
|
||||
iconColour = colour(1, 1, 1),
|
||||
iconType = "faSolid",
|
||||
iconId = "code",
|
||||
iconAlpha = 0.9,
|
||||
backgroundAlpha = 1.0,
|
||||
backgroundColour = colour.rgb(216, 100, 89),
|
||||
active = false
|
||||
})
|
||||
|
||||
return appGui
|
||||
end
|
||||
|
||||
return {
|
||||
name = "Apps",
|
||||
iconId = "shapes",
|
||||
|
@ -57,6 +105,23 @@ return {
|
|||
})
|
||||
end
|
||||
|
||||
if teverse.dev.localTevGit then
|
||||
local appGui = createApp({
|
||||
id = "",
|
||||
name = "Learn Code",
|
||||
owner = {
|
||||
username = "Teverse"
|
||||
}
|
||||
})
|
||||
appGui.parent = appsContainer
|
||||
appGui:on("mouseLeftUp", function()
|
||||
if not loading.visible then
|
||||
loading.visible = false
|
||||
teverse.apps:loadString("require('tevgit:core/tutorials/main.lua')")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
teverse.http:get("https://teverse.com/api/apps", {
|
||||
["Authorization"] = "BEARER " .. teverse.userToken
|
||||
}, function(code, body)
|
||||
|
@ -64,13 +129,8 @@ return {
|
|||
local apps = teverse.json:decode(body)
|
||||
subtitle.text = "Found " .. #apps .. " public apps."
|
||||
for _,app in pairs(apps) do
|
||||
local appGui = teverse.construct("guiFrame", {
|
||||
parent = appsContainer,
|
||||
strokeAlpha = 0.1,
|
||||
strokeRadius = 4
|
||||
})
|
||||
|
||||
teverse.guiHelper.hoverColour(appGui, colour.rgb(247, 247, 247))
|
||||
local appGui = createApp(app)
|
||||
appGui.parent = appsContainer
|
||||
appGui:on("mouseLeftUp", function()
|
||||
if not loading.visible then
|
||||
loading.text = "Working..."
|
||||
|
@ -89,43 +149,6 @@ return {
|
|||
end)
|
||||
end
|
||||
end)
|
||||
|
||||
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
|
||||
})
|
||||
|
||||
teverse.construct("guiIcon", {
|
||||
parent = appGui,
|
||||
size = guiCoord(1, 0, 1, -45),
|
||||
position = guiCoord(0, 0, 0, 45),
|
||||
iconMax = 20,
|
||||
iconColour = colour(1, 1, 1),
|
||||
iconType = "faSolid",
|
||||
iconId = "code",
|
||||
iconAlpha = 0.9,
|
||||
backgroundAlpha = 1.0,
|
||||
backgroundColour = colour.rgb(216, 100, 89),
|
||||
active = false
|
||||
})
|
||||
end
|
||||
else
|
||||
subtitle.text = "Server error."
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
titleDesc = function(title, description)
|
||||
return {
|
||||
type = "titleDesc",
|
||||
title = title,
|
||||
description = description
|
||||
}
|
||||
end
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
require("tevgit:core/tutorials/lessons/helloworld.lua")
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
local framework = require("tevgit:core/tutorials/framework.lua")
|
||||
|
||||
return {
|
||||
name = "Hello World",
|
||||
description = "test test test",
|
||||
tutorial = {
|
||||
framework.titleDesc("Test ", "Description"),
|
||||
framework.titleDesc("Test2 ", "Description2")
|
||||
}
|
||||
}
|
|
@ -0,0 +1,73 @@
|
|||
local containerNegativePadding = teverse.construct("guiFrame", {
|
||||
parent = teverse.interface,
|
||||
size = guiCoord(1, 0, 1, 100),
|
||||
position = guiCoord(0, 0, 0, -50)
|
||||
})
|
||||
|
||||
local container = teverse.construct("guiScrollView", {
|
||||
parent = containerNegativePadding,
|
||||
size = guiCoord(1, 0, 1, -100),
|
||||
position = guiCoord(0, 0, 0, 50),
|
||||
backgroundAlpha = 0,
|
||||
})
|
||||
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = container,
|
||||
size = guiCoord(1.0, -20, 0, 48),
|
||||
position = guiCoord(0, 10, 0, 10),
|
||||
backgroundAlpha = 0,
|
||||
text = "Learn Code",
|
||||
textSize = 48,
|
||||
textAlign = "middleLeft"
|
||||
})
|
||||
|
||||
local y = 70
|
||||
|
||||
for i,v in pairs(require("tevgit:core/tutorials/lessons.lua")) do
|
||||
local lesson = teverse.construct("guiFrame", {
|
||||
parent = container,
|
||||
position = guiCoord(0, 10, 0, y),
|
||||
size = guiCoord(1, -20, 0, 50),
|
||||
backgroundColour = colour.rgb(245, 245, 245),
|
||||
dropShadowAlpha = 0.2,
|
||||
strokeRadius = 3
|
||||
})
|
||||
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = lesson,
|
||||
size = guiCoord(0, 40, 1, -10),
|
||||
position = guiCoord(0, 5, 0, 5),
|
||||
backgroundAlpha = 0,
|
||||
text = string.format("%02d", i),
|
||||
textSize = 32,
|
||||
textAlign = "middle",
|
||||
textFont = "tevurl:fonts/firaCodeMedium.otf",
|
||||
textColour = colour.rgb(211, 54, 130)
|
||||
})
|
||||
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = lesson,
|
||||
size = guiCoord(1.0, -60, 0, 22),
|
||||
position = guiCoord(0, 50, 0, 5),
|
||||
backgroundAlpha = 0,
|
||||
text = v.name,
|
||||
textSize = 22,
|
||||
textAlign = "middleLeft",
|
||||
textFont = "tevurl:fonts/openSansBold.ttf"
|
||||
})
|
||||
|
||||
local desc = teverse.construct("guiTextBox", {
|
||||
parent = lesson,
|
||||
size = guiCoord(1.0, -60, 1, -25),
|
||||
position = guiCoord(0, 50, 0, 25),
|
||||
backgroundAlpha = 0,
|
||||
text = v.description,
|
||||
textSize = 18,
|
||||
textAlign = "topLeft",
|
||||
textWrap = true
|
||||
})
|
||||
|
||||
lesson.size = guiCoord(1, -20, 0, 29 + desc.textDimensions.y)
|
||||
|
||||
y = y + 25 + desc.textDimensions.y
|
||||
end
|
Loading…
Reference in New Issue