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
|
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
|
return appGui
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -78,30 +64,100 @@ return {
|
||||||
local subtitle = teverse.construct("guiTextBox", {
|
local subtitle = teverse.construct("guiTextBox", {
|
||||||
parent = page,
|
parent = page,
|
||||||
size = guiCoord(1.0, -20, 0, 18),
|
size = guiCoord(1.0, -20, 0, 18),
|
||||||
position = guiCoord(0, 10, 0, 58),
|
position = guiCoord(0, 10, 0, 105),
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0,
|
||||||
text = "Loading Apps",
|
text = "Loading Apps",
|
||||||
textSize = 18,
|
textSize = 18,
|
||||||
textAlign = "middleLeft"
|
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", {
|
local appsContainer = teverse.construct("guiFrame", {
|
||||||
parent = page,
|
parent = page,
|
||||||
size = guiCoord(1.0, -20, 1, -100),
|
size = guiCoord(1.0, -20, 1, -140),
|
||||||
position = guiCoord(0, 10, 0, 90),
|
position = guiCoord(0, 10, 0, 130),
|
||||||
backgroundAlpha = 0
|
backgroundAlpha = 0
|
||||||
})
|
})
|
||||||
|
|
||||||
if _DEVICE:sub(0, 6) == "iPhone" then
|
if _DEVICE:sub(0, 6) == "iPhone" then
|
||||||
teverse.guiHelper
|
teverse.guiHelper
|
||||||
.gridConstraint(appsContainer, {
|
.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)
|
cellMargin = guiCoord(0, 15, 0, 25)
|
||||||
})
|
})
|
||||||
else
|
else
|
||||||
teverse.guiHelper
|
teverse.guiHelper
|
||||||
.gridConstraint(appsContainer, {
|
.gridConstraint(appsContainer, {
|
||||||
cellSize = guiCoord(0, 160, 0, 80),
|
cellSize = guiCoord(0, 160, 0, 50),
|
||||||
cellMargin = guiCoord(0, 15, 0, 25)
|
cellMargin = guiCoord(0, 15, 0, 25)
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -129,7 +185,7 @@ return {
|
||||||
}, function(code, body)
|
}, function(code, body)
|
||||||
if code == 200 then
|
if code == 200 then
|
||||||
local apps = teverse.json:decode(body)
|
local apps = teverse.json:decode(body)
|
||||||
subtitle.text = "Found " .. #apps .. " public apps."
|
subtitle.text = "Found " .. #apps .. " public apps:"
|
||||||
for _,app in pairs(apps) do
|
for _,app in pairs(apps) do
|
||||||
local appGui = createApp(app)
|
local appGui = createApp(app)
|
||||||
appGui.parent = appsContainer
|
appGui.parent = appsContainer
|
||||||
|
|
|
@ -162,7 +162,8 @@ return {
|
||||||
size = guiCoord(1, 0, 1, 50),
|
size = guiCoord(1, 0, 1, 50),
|
||||||
position = guiCoord(0, 0, 0, -50),
|
position = guiCoord(0, 0, 0, -50),
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0,
|
||||||
strokeRadius = 3
|
strokeRadius = 3,
|
||||||
|
scrollbarWidth = 4
|
||||||
})
|
})
|
||||||
|
|
||||||
teverse.guiHelper
|
teverse.guiHelper
|
||||||
|
|
|
@ -10,6 +10,7 @@ local container = teverse.construct("guiScrollView", {
|
||||||
position = guiCoord(0, 0, 0, 50),
|
position = guiCoord(0, 0, 0, 50),
|
||||||
canvasSize = guiCoord(1, 0, 1, 0),
|
canvasSize = guiCoord(1, 0, 1, 0),
|
||||||
backgroundAlpha = 0,
|
backgroundAlpha = 0,
|
||||||
|
scrollbarWidth = 4
|
||||||
})
|
})
|
||||||
|
|
||||||
teverse.construct("guiTextBox", {
|
teverse.construct("guiTextBox", {
|
||||||
|
|
Loading…
Reference in New Issue