mirror of https://github.com/teverse/teverse
Compare commits
3 Commits
9f22dbeda8
...
6a2ed2629f
Author | SHA1 | Date |
---|---|---|
Jay | 6a2ed2629f | |
Jay | 17599a6eaf | |
Jay | cb36ce065a |
|
@ -30,20 +30,6 @@ local function createApp(app)
|
|||
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
|
||||
|
||||
|
@ -78,30 +64,100 @@ return {
|
|||
local subtitle = teverse.construct("guiTextBox", {
|
||||
parent = page,
|
||||
size = guiCoord(1.0, -20, 0, 18),
|
||||
position = guiCoord(0, 10, 0, 58),
|
||||
position = guiCoord(0, 10, 0, 105),
|
||||
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 = "Working..."
|
||||
loading.visible = true
|
||||
teverse.http:get("https://teverse.com/api/apps/" .. app.id .. "/script", {
|
||||
["Authorization"] = "BEARER " .. teverse.userToken
|
||||
}, function(code, body)
|
||||
if code == 200 then
|
||||
loading.visible = false
|
||||
teverse.apps:loadString(body)
|
||||
else
|
||||
loading.text = "Unable to load app."
|
||||
sleep(1.5)
|
||||
loading.visible = false
|
||||
end
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
local appsContainer = teverse.construct("guiFrame", {
|
||||
parent = page,
|
||||
size = guiCoord(1.0, -20, 1, -100),
|
||||
position = guiCoord(0, 10, 0, 90),
|
||||
size = guiCoord(1.0, -20, 1, -140),
|
||||
position = guiCoord(0, 10, 0, 130),
|
||||
backgroundAlpha = 0
|
||||
})
|
||||
|
||||
if _DEVICE:sub(0, 6) == "iPhone" then
|
||||
teverse.guiHelper
|
||||
.gridConstraint(appsContainer, {
|
||||
cellSize = guiCoord(0, page.absoluteSize.x - 20, 0, 80),
|
||||
cellSize = guiCoord(0, page.absoluteSize.x - 20, 0, 50),
|
||||
cellMargin = guiCoord(0, 15, 0, 25)
|
||||
})
|
||||
else
|
||||
teverse.guiHelper
|
||||
.gridConstraint(appsContainer, {
|
||||
cellSize = guiCoord(0, 160, 0, 80),
|
||||
cellSize = guiCoord(0, 160, 0, 50),
|
||||
cellMargin = guiCoord(0, 15, 0, 25)
|
||||
})
|
||||
end
|
||||
|
@ -129,7 +185,7 @@ return {
|
|||
}, function(code, body)
|
||||
if code == 200 then
|
||||
local apps = teverse.json:decode(body)
|
||||
subtitle.text = "Found " .. #apps .. " public apps."
|
||||
subtitle.text = "Found " .. #apps .. " public apps:"
|
||||
for _,app in pairs(apps) do
|
||||
local appGui = createApp(app)
|
||||
appGui.parent = appsContainer
|
||||
|
|
|
@ -162,7 +162,8 @@ return {
|
|||
size = guiCoord(1, 0, 1, 50),
|
||||
position = guiCoord(0, 0, 0, -50),
|
||||
backgroundAlpha = 0,
|
||||
strokeRadius = 3
|
||||
strokeRadius = 3,
|
||||
scrollbarWidth = 4
|
||||
})
|
||||
|
||||
teverse.guiHelper
|
||||
|
|
|
@ -10,6 +10,7 @@ local container = teverse.construct("guiScrollView", {
|
|||
position = guiCoord(0, 0, 0, 50),
|
||||
canvasSize = guiCoord(1, 0, 1, 0),
|
||||
backgroundAlpha = 0,
|
||||
scrollbarWidth = 4
|
||||
})
|
||||
|
||||
teverse.construct("guiTextBox", {
|
||||
|
|
Loading…
Reference in New Issue