mirror of https://github.com/teverse/teverse
Compare commits
No commits in common. "378dc7af60eff858050a67153ee7401f7e01ec93" and "155e2ac58136622e9e4a82f64d8a144bf61cfa62" have entirely different histories.
378dc7af60
...
155e2ac581
|
@ -4,72 +4,49 @@
|
||||||
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
||||||
|
|
||||||
local function createFlair(parent, data)
|
local function createFlair(parent, data)
|
||||||
local username = parent:child("username")
|
local username = parent:child("username").text
|
||||||
if data then
|
if data then
|
||||||
local x = username.textDimensions.x + 3
|
local flairCount = 0
|
||||||
|
|
||||||
-- Beta(Tester) Insignia
|
-- Beta(Tester) Insignia
|
||||||
if data.postedBy.beta == true then
|
if data.postedBy.beta == true then
|
||||||
teverse.construct("guiIcon", {
|
teverse.construct("guiIcon", {
|
||||||
parent = username,
|
parent = parent:child("username"),
|
||||||
size = guiCoord(0, 10, 0, 10),
|
size = guiCoord(0, 10, 0, 10),
|
||||||
position = guiCoord(0, x, 0, 6),
|
position = guiCoord(0, parent:child("username").textDimensions.x+((flairCount*10)+2), 0, 6),
|
||||||
iconType = "faSolid",
|
iconType = "faSolid",
|
||||||
iconId = "flask",
|
iconId = "flask",
|
||||||
iconColour = colour.rgb(220, 53, 69),
|
iconColour = colour.rgb(220, 53, 69),
|
||||||
})
|
})
|
||||||
x = x + 11
|
flairCount = flairCount + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Plus Membership Insignia
|
-- Plus Membership Insignia
|
||||||
if data.postedBy.membership == 1 then
|
if data.postedBy.membership == "plus" then
|
||||||
local badge = teverse.construct("guiFrame", {
|
|
||||||
parent = username,
|
|
||||||
size = guiCoord(0, 32, 0, 12),
|
|
||||||
position = guiCoord(0, x, 0, 5),
|
|
||||||
strokeRadius = 5,
|
|
||||||
backgroundColour = globals.defaultColours.red,
|
|
||||||
strokeAlpha = 0.2
|
|
||||||
})
|
|
||||||
|
|
||||||
teverse.construct("guiIcon", {
|
teverse.construct("guiIcon", {
|
||||||
parent = badge,
|
parent = parent:child("username"),
|
||||||
size = guiCoord(0, 8, 0, 8),
|
size = guiCoord(0, 10, 0, 10),
|
||||||
position = guiCoord(0, 2, 0, 2),
|
position = guiCoord(0, parent:child("username").textDimensions.x+((flairCount*10)+2), 0, 6),
|
||||||
iconType = "faSolid",
|
iconType = "faSolid",
|
||||||
iconId = "star",
|
iconId = "thermometer-empty",
|
||||||
iconColour = globals.defaultColours.secondary
|
iconColour = globals.defaultColours.primary
|
||||||
})
|
})
|
||||||
|
flairCount = flairCount + 1
|
||||||
teverse.construct("guiTextBox", {
|
|
||||||
parent = badge,
|
|
||||||
size = guiCoord(0, 18, 0, 10),
|
|
||||||
position = guiCoord(0, 11, 0, 1),
|
|
||||||
textSize = 10,
|
|
||||||
text = "PLUS",
|
|
||||||
textColour = globals.defaultColours.secondary,
|
|
||||||
textFont = "tevurl:fonts/openSansSemiBold.ttf",
|
|
||||||
backgroundAlpha = 0
|
|
||||||
})
|
|
||||||
|
|
||||||
username.textColour = globals.defaultColours.red
|
|
||||||
parent:child("body").textColour = globals.defaultColours.red
|
|
||||||
x = x + 33
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Pro Membership Insignia
|
-- Pro Membership Insignia
|
||||||
if data.postedBy.membership == 2 then
|
if data.postedBy.membership == "pro" then
|
||||||
teverse.construct("guiIcon", {
|
teverse.construct("guiIcon", {
|
||||||
parent = username,
|
parent = parent:child("username"),
|
||||||
size = guiCoord(0, 10, 0, 10),
|
size = guiCoord(0, 10, 0, 10),
|
||||||
position = guiCoord(0, x, 0, 6),
|
position = guiCoord(0, parent:child("username").textDimensions.x+((flairCount*10)+2), 0, 6),
|
||||||
iconType = "faSolid",
|
iconType = "faSolid",
|
||||||
iconId = "thermometer-full",
|
iconId = "thermometer-full",
|
||||||
iconColour = globals.defaultColours.purple
|
iconColour = globals.defaultColours.purple
|
||||||
})
|
})
|
||||||
username.textColour = globals.defaultColours.purple
|
parent:child("username").textColour = globals.defaultColours.purple
|
||||||
parent:child("body").textColour = globals.defaultColours.purple
|
parent:child("body").textColour = globals.defaultColours.purple
|
||||||
x = x + 11
|
flairCount = flairCount + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Mod/Staff Insignia
|
-- Mod/Staff Insignia
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
return {
|
return {
|
||||||
require("tevgit:core/tutorials/lessons/helloworld.lua"),
|
require("tevgit:core/tutorials/lessons/helloworld.lua")
|
||||||
require("tevgit:core/tutorials/lessons/strings.lua")
|
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ local framework = require("tevgit:core/tutorials/framework.lua")
|
||||||
return {
|
return {
|
||||||
name = "Hello World",
|
name = "Hello World",
|
||||||
description = "test test test",
|
description = "test test test",
|
||||||
pages = {
|
tutorial = {
|
||||||
framework.titleDesc("Test ", "Description"),
|
framework.titleDesc("Test ", "Description"),
|
||||||
framework.titleDesc("Test2 ", "Description2")
|
framework.titleDesc("Test2 ", "Description2")
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
local framework = require("tevgit:core/tutorials/framework.lua")
|
|
||||||
|
|
||||||
return {
|
|
||||||
name = "String Manipulation",
|
|
||||||
description = "test test test",
|
|
||||||
pages = {
|
|
||||||
framework.titleDesc("Test ", "Description"),
|
|
||||||
framework.titleDesc("Test2 ", "Description2")
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -23,105 +23,6 @@ teverse.construct("guiTextBox", {
|
||||||
|
|
||||||
local y = 70
|
local y = 70
|
||||||
|
|
||||||
local function loadTutorialPage(tutorial, pagei, lessonFrame)
|
|
||||||
lessonFrame:destroyChildren()
|
|
||||||
local page = tutorial.pages[pagei]
|
|
||||||
|
|
||||||
if page.type == "titleDesc" then
|
|
||||||
teverse.construct("guiTextBox", {
|
|
||||||
parent = lessonFrame,
|
|
||||||
size = guiCoord(1.0, -20, 0, 32),
|
|
||||||
position = guiCoord(0, 10, 0, 10),
|
|
||||||
backgroundAlpha = 0,
|
|
||||||
text = page.title,
|
|
||||||
textSize = 32,
|
|
||||||
textAlign = "middleLeft",
|
|
||||||
textFont = "tevurl:fonts/openSansBold.ttf"
|
|
||||||
})
|
|
||||||
|
|
||||||
teverse.construct("guiTextBox", {
|
|
||||||
parent = lessonFrame,
|
|
||||||
size = guiCoord(1.0, -20, 0, 18),
|
|
||||||
position = guiCoord(0, 10, 0, 42),
|
|
||||||
backgroundAlpha = 0,
|
|
||||||
text = page.description,
|
|
||||||
textSize = 18,
|
|
||||||
textAlign = "middleLeft"
|
|
||||||
})
|
|
||||||
elseif page.type == "" then
|
|
||||||
|
|
||||||
end
|
|
||||||
|
|
||||||
if pagei == #tutorial.pages then
|
|
||||||
teverse.construct("guiTextBox", {
|
|
||||||
parent = lessonFrame,
|
|
||||||
size = guiCoord(0, 90, 0, 30),
|
|
||||||
position = guiCoord(1, -110, 1, -50),
|
|
||||||
text = "Finished",
|
|
||||||
textSize = 20,
|
|
||||||
textAlign = "middle",
|
|
||||||
textFont = "tevurl:fonts/openSansBold.ttf",
|
|
||||||
backgroundColour = colour.rgb(235, 187, 83),
|
|
||||||
textColour = colour.white(),
|
|
||||||
dropShadowAlpha = 0.2
|
|
||||||
})
|
|
||||||
else
|
|
||||||
local btn = teverse.construct("guiTextBox", {
|
|
||||||
parent = lessonFrame,
|
|
||||||
size = guiCoord(0, 80, 0, 30),
|
|
||||||
position = guiCoord(1, -100, 1, -50),
|
|
||||||
text = "Next",
|
|
||||||
textSize = 24,
|
|
||||||
textAlign = "middle",
|
|
||||||
textFont = "tevurl:fonts/openSansBold.ttf",
|
|
||||||
backgroundColour = colour.rgb(74, 140, 122),
|
|
||||||
textColour = colour.white(),
|
|
||||||
dropShadowAlpha = 0.2
|
|
||||||
})
|
|
||||||
|
|
||||||
btn:on("mouseLeftUp", function()
|
|
||||||
loadTutorialPage(tutorial, pagei + 1, lessonFrame)
|
|
||||||
end)
|
|
||||||
|
|
||||||
teverse.guiHelper.hoverColour(btn, colour.rgb(235, 187, 83))
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local function loadTutorial(tutorial)
|
|
||||||
container:destroyChildren()
|
|
||||||
teverse.construct("guiTextBox", {
|
|
||||||
parent = container,
|
|
||||||
size = guiCoord(1.0, -20, 0, 48),
|
|
||||||
position = guiCoord(0, 10, 0, 10),
|
|
||||||
backgroundAlpha = 0,
|
|
||||||
text = tutorial.name,
|
|
||||||
textSize = 48,
|
|
||||||
textAlign = "middleLeft"
|
|
||||||
})
|
|
||||||
|
|
||||||
local lessonFrame = teverse.construct("guiFrame", {
|
|
||||||
parent = container,
|
|
||||||
size = guiCoord(1.0, -20, 1, -70),
|
|
||||||
position = guiCoord(0, 10, 0, 60),
|
|
||||||
backgroundAlpha = 0,
|
|
||||||
})
|
|
||||||
|
|
||||||
--[[teverse.construct("guiIcon", {
|
|
||||||
parent = container,
|
|
||||||
size = guiCoord(0, 30, 0, 30),
|
|
||||||
position = guiCoord(1, -40, 0, 10),
|
|
||||||
iconType = "faSolid",
|
|
||||||
iconId = "arrow-circle-left",
|
|
||||||
iconColour = colour.black(),
|
|
||||||
iconMax = 20,
|
|
||||||
backgroundAlpha = 0.05,
|
|
||||||
backgroundColour = colour.black(),
|
|
||||||
strokeRadius = 4
|
|
||||||
})]]
|
|
||||||
|
|
||||||
loadTutorialPage(tutorial, 1, lessonFrame)
|
|
||||||
end
|
|
||||||
|
|
||||||
for i,v in pairs(require("tevgit:core/tutorials/lessons.lua")) do
|
for i,v in pairs(require("tevgit:core/tutorials/lessons.lua")) do
|
||||||
local lesson = teverse.construct("guiFrame", {
|
local lesson = teverse.construct("guiFrame", {
|
||||||
parent = container,
|
parent = container,
|
||||||
|
@ -132,11 +33,6 @@ for i,v in pairs(require("tevgit:core/tutorials/lessons.lua")) do
|
||||||
strokeRadius = 3
|
strokeRadius = 3
|
||||||
})
|
})
|
||||||
|
|
||||||
teverse.guiHelper.hoverColour(lesson, colour.white())
|
|
||||||
lesson:on("mouseLeftUp", function()
|
|
||||||
loadTutorial(v)
|
|
||||||
end)
|
|
||||||
|
|
||||||
teverse.construct("guiTextBox", {
|
teverse.construct("guiTextBox", {
|
||||||
parent = lesson,
|
parent = lesson,
|
||||||
size = guiCoord(0, 40, 1, -10),
|
size = guiCoord(0, 40, 1, -10),
|
||||||
|
@ -146,8 +42,7 @@ for i,v in pairs(require("tevgit:core/tutorials/lessons.lua")) do
|
||||||
textSize = 32,
|
textSize = 32,
|
||||||
textAlign = "middle",
|
textAlign = "middle",
|
||||||
textFont = "tevurl:fonts/firaCodeMedium.otf",
|
textFont = "tevurl:fonts/firaCodeMedium.otf",
|
||||||
textColour = colour.rgb(211, 54, 130),
|
textColour = colour.rgb(211, 54, 130)
|
||||||
active = false
|
|
||||||
})
|
})
|
||||||
|
|
||||||
teverse.construct("guiTextBox", {
|
teverse.construct("guiTextBox", {
|
||||||
|
@ -158,8 +53,7 @@ for i,v in pairs(require("tevgit:core/tutorials/lessons.lua")) do
|
||||||
text = v.name,
|
text = v.name,
|
||||||
textSize = 22,
|
textSize = 22,
|
||||||
textAlign = "middleLeft",
|
textAlign = "middleLeft",
|
||||||
textFont = "tevurl:fonts/openSansBold.ttf",
|
textFont = "tevurl:fonts/openSansBold.ttf"
|
||||||
active = false
|
|
||||||
})
|
})
|
||||||
|
|
||||||
local desc = teverse.construct("guiTextBox", {
|
local desc = teverse.construct("guiTextBox", {
|
||||||
|
@ -170,11 +64,10 @@ for i,v in pairs(require("tevgit:core/tutorials/lessons.lua")) do
|
||||||
text = v.description,
|
text = v.description,
|
||||||
textSize = 18,
|
textSize = 18,
|
||||||
textAlign = "topLeft",
|
textAlign = "topLeft",
|
||||||
textWrap = true,
|
textWrap = true
|
||||||
active = false
|
|
||||||
})
|
})
|
||||||
|
|
||||||
lesson.size = guiCoord(1, -20, 0, 29 + desc.textDimensions.y)
|
lesson.size = guiCoord(1, -20, 0, 29 + desc.textDimensions.y)
|
||||||
|
|
||||||
y = y + 25 + desc.textDimensions.y + 15
|
y = y + 25 + desc.textDimensions.y
|
||||||
end
|
end
|
Loading…
Reference in New Issue