mirror of https://github.com/teverse/teverse
Compare commits
3 Commits
155e2ac581
...
378dc7af60
Author | SHA1 | Date |
---|---|---|
Jay | 378dc7af60 | |
Jay | 7bd1212552 | |
Jay | ca077e22b2 |
|
@ -4,49 +4,72 @@
|
|||
local globals = require("tevgit:workshop/library/globals.lua") -- globals; variables or instances that can be shared between files
|
||||
|
||||
local function createFlair(parent, data)
|
||||
local username = parent:child("username").text
|
||||
local username = parent:child("username")
|
||||
if data then
|
||||
local flairCount = 0
|
||||
local x = username.textDimensions.x + 3
|
||||
|
||||
-- Beta(Tester) Insignia
|
||||
if data.postedBy.beta == true then
|
||||
teverse.construct("guiIcon", {
|
||||
parent = parent:child("username"),
|
||||
parent = username,
|
||||
size = guiCoord(0, 10, 0, 10),
|
||||
position = guiCoord(0, parent:child("username").textDimensions.x+((flairCount*10)+2), 0, 6),
|
||||
position = guiCoord(0, x, 0, 6),
|
||||
iconType = "faSolid",
|
||||
iconId = "flask",
|
||||
iconColour = colour.rgb(220, 53, 69),
|
||||
})
|
||||
flairCount = flairCount + 1
|
||||
x = x + 11
|
||||
end
|
||||
|
||||
-- Plus Membership Insignia
|
||||
if data.postedBy.membership == "plus" then
|
||||
teverse.construct("guiIcon", {
|
||||
parent = parent:child("username"),
|
||||
size = guiCoord(0, 10, 0, 10),
|
||||
position = guiCoord(0, parent:child("username").textDimensions.x+((flairCount*10)+2), 0, 6),
|
||||
iconType = "faSolid",
|
||||
iconId = "thermometer-empty",
|
||||
iconColour = globals.defaultColours.primary
|
||||
if data.postedBy.membership == 1 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
|
||||
})
|
||||
flairCount = flairCount + 1
|
||||
|
||||
teverse.construct("guiIcon", {
|
||||
parent = badge,
|
||||
size = guiCoord(0, 8, 0, 8),
|
||||
position = guiCoord(0, 2, 0, 2),
|
||||
iconType = "faSolid",
|
||||
iconId = "star",
|
||||
iconColour = globals.defaultColours.secondary
|
||||
})
|
||||
|
||||
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
|
||||
|
||||
-- Pro Membership Insignia
|
||||
if data.postedBy.membership == "pro" then
|
||||
if data.postedBy.membership == 2 then
|
||||
teverse.construct("guiIcon", {
|
||||
parent = parent:child("username"),
|
||||
parent = username,
|
||||
size = guiCoord(0, 10, 0, 10),
|
||||
position = guiCoord(0, parent:child("username").textDimensions.x+((flairCount*10)+2), 0, 6),
|
||||
position = guiCoord(0, x, 0, 6),
|
||||
iconType = "faSolid",
|
||||
iconId = "thermometer-full",
|
||||
iconColour = globals.defaultColours.purple
|
||||
})
|
||||
parent:child("username").textColour = globals.defaultColours.purple
|
||||
username.textColour = globals.defaultColours.purple
|
||||
parent:child("body").textColour = globals.defaultColours.purple
|
||||
flairCount = flairCount + 1
|
||||
x = x + 11
|
||||
end
|
||||
|
||||
-- Mod/Staff Insignia
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
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 {
|
||||
name = "Hello World",
|
||||
description = "test test test",
|
||||
tutorial = {
|
||||
pages = {
|
||||
framework.titleDesc("Test ", "Description"),
|
||||
framework.titleDesc("Test2 ", "Description2")
|
||||
}
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
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,6 +23,105 @@ teverse.construct("guiTextBox", {
|
|||
|
||||
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
|
||||
local lesson = teverse.construct("guiFrame", {
|
||||
parent = container,
|
||||
|
@ -33,6 +132,11 @@ for i,v in pairs(require("tevgit:core/tutorials/lessons.lua")) do
|
|||
strokeRadius = 3
|
||||
})
|
||||
|
||||
teverse.guiHelper.hoverColour(lesson, colour.white())
|
||||
lesson:on("mouseLeftUp", function()
|
||||
loadTutorial(v)
|
||||
end)
|
||||
|
||||
teverse.construct("guiTextBox", {
|
||||
parent = lesson,
|
||||
size = guiCoord(0, 40, 1, -10),
|
||||
|
@ -42,7 +146,8 @@ for i,v in pairs(require("tevgit:core/tutorials/lessons.lua")) do
|
|||
textSize = 32,
|
||||
textAlign = "middle",
|
||||
textFont = "tevurl:fonts/firaCodeMedium.otf",
|
||||
textColour = colour.rgb(211, 54, 130)
|
||||
textColour = colour.rgb(211, 54, 130),
|
||||
active = false
|
||||
})
|
||||
|
||||
teverse.construct("guiTextBox", {
|
||||
|
@ -53,7 +158,8 @@ for i,v in pairs(require("tevgit:core/tutorials/lessons.lua")) do
|
|||
text = v.name,
|
||||
textSize = 22,
|
||||
textAlign = "middleLeft",
|
||||
textFont = "tevurl:fonts/openSansBold.ttf"
|
||||
textFont = "tevurl:fonts/openSansBold.ttf",
|
||||
active = false
|
||||
})
|
||||
|
||||
local desc = teverse.construct("guiTextBox", {
|
||||
|
@ -64,10 +170,11 @@ for i,v in pairs(require("tevgit:core/tutorials/lessons.lua")) do
|
|||
text = v.description,
|
||||
textSize = 18,
|
||||
textAlign = "topLeft",
|
||||
textWrap = true
|
||||
textWrap = true,
|
||||
active = false
|
||||
})
|
||||
|
||||
lesson.size = guiCoord(1, -20, 0, 29 + desc.textDimensions.y)
|
||||
|
||||
y = y + 25 + desc.textDimensions.y
|
||||
y = y + 25 + desc.textDimensions.y + 15
|
||||
end
|
Loading…
Reference in New Issue