mirror of https://github.com/teverse/teverse
Compare commits
No commits in common. "b8d8291aeee7c0fe5a93e286a576a4fd1c7d9214" and "4f369cd4b779be78e4b93af8e8625c1448f50329" have entirely different histories.
b8d8291aee
...
4f369cd4b7
|
@ -1,69 +0,0 @@
|
|||
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,10 +1,55 @@
|
|||
local createApp = require("tevgit:core/dashboard/appCard.lua")
|
||||
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
|
||||
})
|
||||
|
||||
local img = teverse.construct("guiImage", {
|
||||
size = guiCoord(1, 0, 1, 0),
|
||||
parent = appGui,
|
||||
active = false,
|
||||
zIndex = -1
|
||||
})
|
||||
|
||||
if (app.iconUrl and app.iconUrl ~= "") then
|
||||
img.image = app.iconUrl
|
||||
else
|
||||
img.image = "tevurl:img/tevapp.png"
|
||||
end
|
||||
|
||||
return appGui
|
||||
end
|
||||
|
||||
return {
|
||||
name = "Apps",
|
||||
iconId = "shapes",
|
||||
iconType = "faSolid",
|
||||
scrollView = true,
|
||||
setup = function(page)
|
||||
local loading = teverse.construct("guiTextBox", {
|
||||
parent = page,
|
||||
|
@ -60,7 +105,7 @@ return {
|
|||
end
|
||||
|
||||
if _DEVICE:sub(0, 6) ~= "iPhone" then
|
||||
local appGui, button = createApp({
|
||||
local appGui = createApp({
|
||||
id = "",
|
||||
name = "Learn Code",
|
||||
owner = {
|
||||
|
@ -69,7 +114,7 @@ return {
|
|||
})
|
||||
appGui.name = "a"
|
||||
appGui.parent = appsContainer
|
||||
button:on("mouseLeftUp", function()
|
||||
appGui:on("mouseLeftUp", function()
|
||||
if not loading.visible then
|
||||
loading.visible = false
|
||||
teverse.apps:loadString("require('tevgit:core/tutorials/main.lua')")
|
||||
|
@ -84,9 +129,9 @@ return {
|
|||
local apps = teverse.json:decode(body)
|
||||
subtitle.text = "Found " .. #apps .. " public apps:"
|
||||
for _,app in pairs(apps) do
|
||||
local appGui, button = createApp(app)
|
||||
local appGui = createApp(app)
|
||||
appGui.parent = appsContainer
|
||||
button:on("mouseLeftUp", function()
|
||||
appGui:on("mouseLeftUp", function()
|
||||
if not loading.visible then
|
||||
loading.text = "Loading App " .. (app.packageNetworked and "Online" or "Offline")
|
||||
loading.visible = true
|
||||
|
@ -104,18 +149,5 @@ 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,10 +1,44 @@
|
|||
local createApp = require("tevgit:core/dashboard/appCard.lua")
|
||||
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
|
||||
})
|
||||
|
||||
local img = teverse.construct("guiImage", {
|
||||
size = guiCoord(1, 0, 1, 0),
|
||||
parent = appGui,
|
||||
active = false,
|
||||
zIndex = -1
|
||||
})
|
||||
|
||||
if (app.iconUrl and app.iconUrl ~= "") then
|
||||
img.image = app.iconUrl
|
||||
else
|
||||
img.image = "tevurl:img/tevapp.png"
|
||||
end
|
||||
|
||||
return appGui
|
||||
end
|
||||
|
||||
return {
|
||||
name = "Develop",
|
||||
iconId = "layer-group",
|
||||
iconType = "faSolid",
|
||||
scrollView = true,
|
||||
setup = function(page)
|
||||
local loading = teverse.construct("guiTextBox", {
|
||||
parent = page,
|
||||
|
@ -120,25 +154,15 @@ return {
|
|||
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)
|
||||
local appGui = createApp(app)
|
||||
appGui.parent = appsContainer
|
||||
launchButton:on("mouseLeftUp", function()
|
||||
appGui:on("mouseLeftUp", function()
|
||||
if not loading.visible then
|
||||
loading.text = "Loading App " .. (app.packageNetworked and "Online" or "Offline")
|
||||
loading.visible = true
|
||||
|
@ -157,18 +181,5 @@ return {
|
|||
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(page.scrollView and "guiScrollView" or "guiFrame", {
|
||||
local container = teverse.construct("guiFrame", {
|
||||
parent = body,
|
||||
size = guiCoord(1, -40, 1, -80),
|
||||
position = guiCoord(0, 10, 0, 80),
|
||||
|
@ -90,11 +90,6 @@ 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),
|
||||
|
|
|
@ -1,185 +0,0 @@
|
|||
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
|
Loading…
Reference in New Issue