mirror of https://github.com/teverse/teverse
Compare commits
2 Commits
c1e8e7ef09
...
16a239d526
Author | SHA1 | Date |
---|---|---|
![]() |
16a239d526 | |
![]() |
201adf1469 |
|
@ -50,16 +50,24 @@ local function addTab(tabName, tabFrame)
|
||||||
table.insert(tabs, {tabFrame, tabBtn})
|
table.insert(tabs, {tabFrame, tabBtn})
|
||||||
end
|
end
|
||||||
|
|
||||||
--local generalPage = ui.create("guiFrame", window.content, {
|
local generalPage = ui.create("guiFrame", window.content, {
|
||||||
-- size = guiCoord(0.65, 0, 1, 0),
|
size = guiCoord(0.65, 0, 1, 0),
|
||||||
-- position = guiCoord(0.35, 0, 0, 0)
|
position = guiCoord(0.35, 0, 0, 0)
|
||||||
--}, "background")
|
}, "background")
|
||||||
|
|
||||||
--addTab("General", generalPage)
|
local syncThread = autoSave.Sync() -- Establish thread
|
||||||
|
local autoSaveToggle = ui.button(generalPage, autoSave.Enabled and "Disable Auto-Save" or "Enabled Auto-Save", guiCoord(0, 200, 0, 30), guiCoord(0, 10, 0, 10), "secondary")
|
||||||
|
autoSaveToggle:mouseLeftPressed(function()
|
||||||
|
autoSave.Enabled = not autoSave.Enabled
|
||||||
|
autoSaveToggle.label.text = autoSave.Enabled and "Disable Auto-Save" or "Enabled Auto-Save"
|
||||||
|
end)
|
||||||
|
|
||||||
|
addTab("General", generalPage)
|
||||||
|
|
||||||
local themePage = ui.create("guiScrollView", window.content, {
|
local themePage = ui.create("guiScrollView", window.content, {
|
||||||
size = guiCoord(0.65, 0, 1, 0),
|
size = guiCoord(0.65, 0, 1, 0),
|
||||||
position = guiCoord(0.35, 0, 0, 0)
|
position = guiCoord(0.35, 0, 0, 0),
|
||||||
|
canvasSize = guiCoord(1,0,0,560)
|
||||||
}, "background")
|
}, "background")
|
||||||
|
|
||||||
require("tevgit:workshop/controllers/ui/components/themePreviewer.lua").parent = themePage
|
require("tevgit:workshop/controllers/ui/components/themePreviewer.lua").parent = themePage
|
||||||
|
@ -79,37 +87,38 @@ if shared.developerMode then
|
||||||
}, "backgroundText")
|
}, "backgroundText")
|
||||||
|
|
||||||
|
|
||||||
local createReload = ui.button(developmentPage, "Reload Workshop", guiCoord(0, 320, 0, 30), guiCoord(0, 15, 0, 50))
|
local createReload = ui.button(developmentPage, "Reload Workshop", guiCoord(0, 190, 0, 30), guiCoord(0, 15, 0, 50))
|
||||||
createReload:mouseLeftPressed(function ()
|
createReload:mouseLeftPressed(function ()
|
||||||
shared.workshop:reloadCreate()
|
shared.workshop:reloadCreate()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local shaderReload = ui.button(developmentPage, "Reload Shaders", guiCoord(0, 320, 0, 30), guiCoord(0, 15, 0, 90), "secondary")
|
local shaderReload = ui.button(developmentPage, "Reload Shaders", guiCoord(0, 190, 0, 30), guiCoord(0, 15, 0, 90), "secondary")
|
||||||
shaderReload:mouseLeftPressed(function ()
|
shaderReload:mouseLeftPressed(function ()
|
||||||
shared.workshop:reloadShaders()
|
shared.workshop:reloadShaders()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local physicsDebugEnabled = false
|
local physicsDebugEnabled = false
|
||||||
local physicsAABBs = ui.button(developmentPage, "Enable Physics AABBs", guiCoord(0, 320, 0, 30), guiCoord(0, 15, 0, 130), "secondary")
|
local physicsAABBs = ui.button(developmentPage, "Enable Physics AABBs", guiCoord(0, 190, 0, 30), guiCoord(0, 15, 0, 130), "secondary")
|
||||||
physicsAABBs:mouseLeftPressed(function ()
|
physicsAABBs:mouseLeftPressed(function ()
|
||||||
physicsDebugEnabled = not physicsDebugEnabled
|
physicsDebugEnabled = not physicsDebugEnabled
|
||||||
shared.workshop:setPhysicsDebug(physicsDebugEnabled)
|
shared.workshop:setPhysicsDebug(physicsDebugEnabled)
|
||||||
physicsAABBs.label.text = physicsDebugEnabled and "Disable Physics AABBs" or "Enable Physics AABBs"
|
physicsAABBs.label.text = physicsDebugEnabled and "Disable Physics AABBs" or "Enable Physics AABBs"
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local runScriptBtn = ui.button(developmentPage, "Run Lua", guiCoord(0, 320, 0, 30), guiCoord(0, 15, 0, 170), "secondary")
|
local runScriptBtn = ui.button(developmentPage, "Run Lua", guiCoord(0, 190, 0, 30), guiCoord(0, 15, 0, 170), "secondary")
|
||||||
|
|
||||||
runScriptBtn:mouseLeftPressed(function ()
|
runScriptBtn:mouseLeftPressed(function ()
|
||||||
shared.windows.runLua.visible = not shared.windows.runLua.visible
|
shared.windows.runLua.visible = not shared.windows.runLua.visible
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local printDump = ui.button(developmentPage, "Print Dump", guiCoord(0, 320, 0, 30), guiCoord(0, 15, 0, 210), "secondary")
|
local printDump = ui.button(developmentPage, "Print Dump", guiCoord(0, 190, 0, 30), guiCoord(0, 15, 0, 210), "secondary")
|
||||||
printDump:mouseLeftPressed(function()
|
printDump:mouseLeftPressed(function()
|
||||||
local dump = shared.workshop:apiDump()
|
local dump = shared.workshop:apiDump()
|
||||||
print(engine.json:encode(dump))
|
print(engine.json:encode(dump))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local physicsEnabled = engine.physics.running
|
local physicsEnabled = engine.physics.running
|
||||||
local physicsToggle= ui.button(developmentPage, physicsEnabled and "Stop Simulating Physics" or "Simulate Physics", guiCoord(0, 320, 0, 30), guiCoord(0, 15, 0, 250), "secondary")
|
local physicsToggle= ui.button(developmentPage, physicsEnabled and "Stop Simulating Physics" or "Simulate Physics", guiCoord(0, 190, 0, 30), guiCoord(0, 15, 0, 250), "secondary")
|
||||||
physicsToggle:mouseLeftPressed(function ()
|
physicsToggle:mouseLeftPressed(function ()
|
||||||
physicsEnabled = not physicsEnabled
|
physicsEnabled = not physicsEnabled
|
||||||
if physicsEnabled then
|
if physicsEnabled then
|
||||||
|
@ -120,21 +129,6 @@ if shared.developerMode then
|
||||||
physicsToggle.label.text = physicsEnabled and "Stop Simulating Physics" or "Simulate Physics"
|
physicsToggle.label.text = physicsEnabled and "Stop Simulating Physics" or "Simulate Physics"
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Auto Save / Sync
|
|
||||||
local syncThread = autoSave.Sync() -- Establish thread
|
|
||||||
local autoSaveToggle = ui.button(developmentPage, autoSave.Enabled and "Disable Auto-Save" or "Enabled Auto-Save", guiCoord(0, 320, 0, 30), guiCoord(0, 15, 0, 290), "secondary")
|
|
||||||
autoSaveToggle:mouseLeftPressed(function()
|
|
||||||
autoSave.Enabled = not autoSave.Enabled
|
|
||||||
autoSaveToggle.label.text = autoSave.Enabled and "Disable Auto-Save" or "Enabled Auto-Save"
|
|
||||||
end)
|
|
||||||
|
|
||||||
local resetTheme = ui.button(developmentPage, "Reset Theme (this will restart workshop)", guiCoord(0, 320, 0, 30), guiCoord(0, 15, 0, 330), "secondary")
|
|
||||||
resetTheme:mouseLeftPressed(function()
|
|
||||||
shared.workshop:setSettings("themeType", "Default")
|
|
||||||
shared.workshop:setSettings("customTheme", nil)
|
|
||||||
shared.workshop:reloadCreate()
|
|
||||||
end)
|
|
||||||
|
|
||||||
addTab("Development", developmentPage)
|
addTab("Development", developmentPage)
|
||||||
|
|
||||||
--local dump = globalWorkshop:apiDump()
|
--local dump = globalWorkshop:apiDump()
|
||||||
|
|
|
@ -1,69 +1,249 @@
|
||||||
-- Returns a frame with the different theme colours
|
-- Returns a frame with the different theme colours
|
||||||
-- Useful for overviewing a theme?
|
-- Useful for overviewing a theme?
|
||||||
|
|
||||||
local ui = require("tevgit:workshop/controllers/ui/core/ui.lua")
|
ui = require("tevgit:workshop/controllers/ui/core/ui.lua")
|
||||||
local shared = require("tevgit:workshop/controllers/shared.lua")
|
shared = require("tevgit:workshop/controllers/shared.lua")
|
||||||
local themer = require("tevgit:workshop/controllers/ui/core/themer.lua")
|
themer = require("tevgit:workshop/controllers/ui/core/themer.lua")
|
||||||
local colourPicker = require("tevgit:workshop/controllers/ui/components/colourPicker.lua")
|
colourPicker = require("tevgit:workshop/controllers/ui/components/colourPicker.lua")
|
||||||
|
|
||||||
local container = ui.create("guiFrame", shared.workshop.interface, {
|
presets = {
|
||||||
size = guiCoord(1, -10, 1, 0),
|
{"default", "Classic (default)"},
|
||||||
|
{"black", "Tev Dark"},
|
||||||
|
{"white", "Tev Light"},
|
||||||
|
{"ow", "ow my eyes"},
|
||||||
|
{"custom", "Custom"}
|
||||||
|
}
|
||||||
|
|
||||||
|
container = ui.create("guiFrame", shared.workshop.interface, {
|
||||||
|
size = guiCoord(1, -10, 0, 560),
|
||||||
position = guiCoord(0, 10, 0, 10)
|
position = guiCoord(0, 10, 0, 10)
|
||||||
}, "background")
|
}, "background")
|
||||||
|
|
||||||
local theme = themer.getTheme()
|
presetMenu = ui.create("guiFrame", container, {
|
||||||
local y = 0
|
position = guiCoord(0, 0, 0, 0),
|
||||||
for _,prop in pairs(themer.types) do
|
size = guiCoord(0.5, 0, 0, 140),
|
||||||
local themeProperty = engine.construct("guiFrame", container, {
|
borderRadius = 3
|
||||||
size = guiCoord(1, 0, 0, 40),
|
}, "primary")
|
||||||
position = guiCoord(0, 0, 0, y),
|
|
||||||
backgroundAlpha = 0
|
|
||||||
})
|
|
||||||
|
|
||||||
ui.create("guiTextBox", themeProperty, {
|
|
||||||
size = guiCoord(1, -10, 0, 16),
|
|
||||||
position = guiCoord(0, 6, 0, 2),
|
|
||||||
text = prop,
|
|
||||||
fontSize = 16,
|
|
||||||
align = enums.align.middleLeft,
|
|
||||||
fontFile = "local:OpenSans-SemiBold.ttf"
|
|
||||||
}, "backgroundText")
|
|
||||||
|
|
||||||
local count = 0
|
importWindow = ui.window(shared.workshop.interface,
|
||||||
for _,v in pairs(theme[prop]) do if type(v) == "colour" then count = count + 1 end end
|
"Import Theme",
|
||||||
|
guiCoord(0, 420, 0, 230), --size
|
||||||
|
guiCoord(0.5, -210, 0.5, -25), --pos
|
||||||
|
false, --dockable
|
||||||
|
true -- hidable
|
||||||
|
)
|
||||||
|
importWindow.visible = false
|
||||||
|
importWindow.xIndex = 1000
|
||||||
|
|
||||||
local size = 1/count
|
frame = ui.create("guiFrame", importWindow.content, {
|
||||||
local i = 0
|
size = guiCoord(1, -20, 1, -60),
|
||||||
|
position = guiCoord(0, 10, 0, 10),
|
||||||
|
cropChildren = true,
|
||||||
|
backgroundAlpha = 0
|
||||||
|
})
|
||||||
|
importInput = ui.create("guiTextBox", frame, {
|
||||||
|
size = guiCoord(1, 0, 1, 0),
|
||||||
|
position = guiCoord(0, 0, 0, 0),
|
||||||
|
readOnly = false,
|
||||||
|
wrap = true,
|
||||||
|
fontSize = 16,
|
||||||
|
zIndex = 100
|
||||||
|
}, "secondary")
|
||||||
|
|
||||||
for k,v in pairs(theme[prop]) do
|
function attemptCustom()
|
||||||
if type(v) == "colour" then
|
import = importInput.text
|
||||||
local ch,cs,cv = v:getHSV()
|
import = string.gsub(import,"\\","")
|
||||||
local btn = ui.create("guiTextBox", themeProperty, {
|
themer.setTheme(engine.json:decode(import))
|
||||||
size = guiCoord(size, -10, 0, 20),
|
|
||||||
position = guiCoord(size*i, 5, 0, 20),
|
|
||||||
text = k,
|
|
||||||
fontSize = 16,
|
|
||||||
align = enums.align.middle,
|
|
||||||
backgroundColour = v,
|
|
||||||
textColour = cv > 0.5 and colour:black() or colour:white(),
|
|
||||||
borderRadius = 4,
|
|
||||||
borderColour = colour:black(),
|
|
||||||
borderAlpha = 0.3
|
|
||||||
}, prop)
|
|
||||||
|
|
||||||
btn:mouseLeftReleased(function()
|
|
||||||
print(theme, prop, k)
|
|
||||||
colourPicker.prompt(theme[prop][k], function(c)
|
|
||||||
theme[prop][k] = c
|
|
||||||
themer.setTheme(theme)
|
|
||||||
end)
|
|
||||||
end)
|
|
||||||
i = i + 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
y = y + 44
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
importConfirmButton = ui.button(importWindow.content, "Import", guiCoord(0.5, 0, 0, 30), guiCoord(0.25, 0, 1, -40), "primary")
|
||||||
|
|
||||||
|
importButton = ui.create("guiButton", container, {
|
||||||
|
size = guiCoord(0.5, -20, 0, 30),
|
||||||
|
position = guiCoord(0.5, 10, 0, 40),
|
||||||
|
borderRadius = 3,
|
||||||
|
text = "Import Theme",
|
||||||
|
align = enums.align.middle
|
||||||
|
},"primaryVariant"):mouseLeftReleased(function()
|
||||||
|
importWindow.visible = true
|
||||||
|
end)
|
||||||
|
|
||||||
|
exportWindow = ui.window(shared.workshop.interface,
|
||||||
|
"Export Theme",
|
||||||
|
guiCoord(0, 420, 0, 230), --size
|
||||||
|
guiCoord(0.5, -210, 0.5, -25), --pos
|
||||||
|
false, --dockable
|
||||||
|
true -- hidable
|
||||||
|
)
|
||||||
|
exportWindow.visible = false
|
||||||
|
|
||||||
|
eframe = ui.create("guiFrame", exportWindow.content, {
|
||||||
|
size = guiCoord(1, -20, 1, -20),
|
||||||
|
position = guiCoord(0, 10, 0, 10),
|
||||||
|
cropChildren = true,
|
||||||
|
backgroundAlpha = 0
|
||||||
|
})
|
||||||
|
|
||||||
|
exportInput = ui.create("guiTextBox", eframe, {
|
||||||
|
size = guiCoord(1, 0, 1, 0),
|
||||||
|
position = guiCoord(0, 0, 0, 0),
|
||||||
|
readOnly = false,
|
||||||
|
wrap = true,
|
||||||
|
fontSize = 16,
|
||||||
|
zIndex = 100
|
||||||
|
}, "secondary")
|
||||||
|
|
||||||
|
THISISTHERESETBUTTON = ui.create("guiButton", container, {
|
||||||
|
size = guiCoord(0.5, -20, 0, 30),
|
||||||
|
position = guiCoord(0.5, 10, 0, 80),
|
||||||
|
borderRadius = 3,
|
||||||
|
text = "Export Theme",
|
||||||
|
align = enums.align.middle,
|
||||||
|
visible = false
|
||||||
|
},"primaryVariant")
|
||||||
|
THISISTHERESETBUTTON:mouseLeftReleased(function()
|
||||||
|
exportInput.text = shared.workshop:getSettings("customTheme")
|
||||||
|
exportWindow.visible = true
|
||||||
|
end)
|
||||||
|
|
||||||
|
customUI = ui.create("guiFrame", container, {
|
||||||
|
size = guiCoord(1, -10, 2, 0),
|
||||||
|
position = guiCoord(0, 0, 0, 150),
|
||||||
|
visible = false
|
||||||
|
}, "background")
|
||||||
|
|
||||||
|
theme = themer.getTheme()
|
||||||
|
function themeReload()
|
||||||
|
theme = null
|
||||||
|
theme = themer.getTheme()
|
||||||
|
end
|
||||||
|
|
||||||
|
function generateEditor()
|
||||||
|
customUI:destroyAllChildren()
|
||||||
|
local y = 0
|
||||||
|
for _,prop in pairs(themer.types) do
|
||||||
|
themeProperty = engine.construct("guiFrame", customUI, {
|
||||||
|
size = guiCoord(1, 0, 0, 40),
|
||||||
|
position = guiCoord(0, 0, 0, y),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
})
|
||||||
|
|
||||||
|
ui.create("guiTextBox", themeProperty, {
|
||||||
|
size = guiCoord(1, -10, 0, 16),
|
||||||
|
position = guiCoord(0, 6, 0, 2),
|
||||||
|
text = prop,
|
||||||
|
fontSize = 16,
|
||||||
|
align = enums.align.middleLeft,
|
||||||
|
fontFile = "local:OpenSans-SemiBold.ttf"
|
||||||
|
}, "backgroundText")
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
for _,v in pairs(theme[prop]) do if type(v) == "colour" then count = count + 1 end end
|
||||||
|
|
||||||
|
size = 1/count
|
||||||
|
i = 0
|
||||||
|
|
||||||
|
for k,v in pairs(theme[prop]) do
|
||||||
|
if type(v) == "colour" then
|
||||||
|
local ch,cs,cv = v:getHSV()
|
||||||
|
btn = ui.create("guiTextBox", themeProperty, {
|
||||||
|
size = guiCoord(size, -10, 0, 20),
|
||||||
|
position = guiCoord(size*i, 5, 0, 20),
|
||||||
|
text = k,
|
||||||
|
fontSize = 16,
|
||||||
|
align = enums.align.middle,
|
||||||
|
backgroundColour = v,
|
||||||
|
textColour = cv > 0.5 and colour:black() or colour:white(),
|
||||||
|
borderRadius = 4,
|
||||||
|
borderColour = colour:black(),
|
||||||
|
borderAlpha = 0.3
|
||||||
|
}, prop)
|
||||||
|
|
||||||
|
btn:mouseLeftReleased(function()
|
||||||
|
colourPicker.prompt(theme[prop][k], function(c)
|
||||||
|
theme[prop][k] = c
|
||||||
|
themer.setTheme(theme)
|
||||||
|
exportInput.text = engine.json:decode(shared.workshop:getSettings("customTheme"))
|
||||||
|
themeReload()
|
||||||
|
end)
|
||||||
|
end)
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
y = y + 44
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function canvasSet(size)
|
||||||
|
container.parent.canvasSize = size
|
||||||
|
container.size = size
|
||||||
|
end
|
||||||
|
|
||||||
|
function makePresetMenu()
|
||||||
|
preset = shared.workshop:getSettings("themeType")
|
||||||
|
THISISTHERESETBUTTON.visible = false
|
||||||
|
customUI.visible = false
|
||||||
|
pcall(canvasSet, guiCoord(1, 0, 1, 0))
|
||||||
|
if shared.workshop:getSettings("themeType") == "custom" then
|
||||||
|
THISISTHERESETBUTTON.visible = true
|
||||||
|
customUI.visible = true
|
||||||
|
generateEditor()
|
||||||
|
pcall(canvasSet, guiCoord(1, 0, 0, 560))
|
||||||
|
end
|
||||||
|
|
||||||
|
presetMenu:destroyAllChildren()
|
||||||
|
|
||||||
|
local y = 0
|
||||||
|
for i = 1, #presets do
|
||||||
|
if preset == presets[i][1] then background = 1 else background = 0 end
|
||||||
|
preset = ui.create("guiButton", presetMenu, {
|
||||||
|
size = guiCoord(1, 0, 0, 20),
|
||||||
|
position = guiCoord(0, 0, 0, y),
|
||||||
|
backgroundAlpha = background,
|
||||||
|
text = " " .. presets[i][2],
|
||||||
|
borderRadius = 3
|
||||||
|
},"secondary"):mouseLeftReleased(function()
|
||||||
|
if presets[i][1] == "custom" then
|
||||||
|
shared.workshop:setSettings("themeType", presets[i][1])
|
||||||
|
shared.workshop:setSettings("customTheme", engine.json:encodeWithTypes(theme))
|
||||||
|
themer.setTheme(theme)
|
||||||
|
themeReload()
|
||||||
|
else
|
||||||
|
shared.workshop:setSettings("themeType", presets[i][1])
|
||||||
|
themer.setThemePreset(require("tevgit:workshop/controllers/ui/themes/" .. presets[i][1] .. ".lua"))
|
||||||
|
themeReload()
|
||||||
|
end
|
||||||
|
makePresetMenu()
|
||||||
|
end)
|
||||||
|
y = y + 20
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
importConfirmButton:mouseLeftReleased(function()
|
||||||
|
success, message = pcall(attemptCustom)
|
||||||
|
if success then
|
||||||
|
makePresetMenu()
|
||||||
|
importWindow.visible = false
|
||||||
|
importInput.text = ""
|
||||||
|
else
|
||||||
|
ui.prompt("The given theme is invalid, the theme has not been changed.")
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
resetButton = ui.create("guiButton", container, {
|
||||||
|
size = guiCoord(0.5, -20, 0, 30),
|
||||||
|
position = guiCoord(0.5, 10, 0, 0),
|
||||||
|
borderRadius = 3,
|
||||||
|
text = "Reset Theme",
|
||||||
|
align = enums.align.middle
|
||||||
|
},"secondary"):mouseLeftReleased(function()
|
||||||
|
shared.workshop:setSettings("themeType", "default")
|
||||||
|
themer.setThemePreset(require("tevgit:workshop/controllers/ui/themes/default.lua"))
|
||||||
|
themeReload()
|
||||||
|
makePresetMenu()
|
||||||
|
end)
|
||||||
|
|
||||||
|
makePresetMenu()
|
||||||
|
|
||||||
return container
|
return container
|
|
@ -7,12 +7,19 @@ local currentTheme = nil
|
||||||
local registeredGuis = {}
|
local registeredGuis = {}
|
||||||
|
|
||||||
local themeType = shared.workshop:getSettings("themeType")
|
local themeType = shared.workshop:getSettings("themeType")
|
||||||
local customTheme = shared.workshop:getSettings("customTheme")
|
customTheme = shared.workshop:getSettings("customTheme")
|
||||||
|
|
||||||
if themeType == "Custom" then
|
if themeType == "custom" then
|
||||||
currentTheme = engine.json:decode(customTheme)
|
currentTheme = engine.json:decode(customTheme)
|
||||||
|
elseif themeType == "black" then
|
||||||
|
currentTheme = require("tevgit:workshop/controllers/ui/themes/black.lua")
|
||||||
|
elseif themeType == "white" then
|
||||||
|
currentTheme = require("tevgit:workshop/controllers/ui/themes/white.lua")
|
||||||
|
elseif themeType == "ow" then
|
||||||
|
currentTheme = require("tevgit:workshop/controllers/ui/themes/ow.lua")
|
||||||
else
|
else
|
||||||
currentTheme = require("tevgit:workshop/controllers/ui/themes/default.lua")
|
currentTheme = require("tevgit:workshop/controllers/ui/themes/default.lua")
|
||||||
|
shared.workshop:setSettings("themeType", "default")
|
||||||
end
|
end
|
||||||
|
|
||||||
local function themeriseGui(gui)
|
local function themeriseGui(gui)
|
||||||
|
@ -38,6 +45,7 @@ return {
|
||||||
primary = "primary",
|
primary = "primary",
|
||||||
primaryVariant = "primaryVariant",
|
primaryVariant = "primaryVariant",
|
||||||
primaryText = "primaryText",
|
primaryText = "primaryText",
|
||||||
|
primaryImage = "primaryImage",
|
||||||
|
|
||||||
secondary = "secondary",
|
secondary = "secondary",
|
||||||
secondaryVariant = "secondaryVariant",
|
secondaryVariant = "secondaryVariant",
|
||||||
|
@ -66,12 +74,33 @@ return {
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Save the theme
|
-- Save the theme
|
||||||
shared.workshop:setSettings("themeType", "Custom")
|
shared.workshop:setSettings("themeType", "custom")
|
||||||
shared.workshop:setSettings("customTheme", engine.json:encodeWithTypes(currentTheme))
|
shared.workshop:setSettings("customTheme", engine.json:encodeWithTypes(currentTheme))
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
resetTheme = function(theme)
|
||||||
|
-- change the current theme AND re-themerise all guis
|
||||||
|
currentTheme = require("tevgit:workshop/controllers/ui/themes/default.lua")
|
||||||
|
for gui,v in pairs(registeredGuis) do
|
||||||
|
themeriseGui(gui)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Save the theme
|
||||||
|
shared.workshop:setSettings("themeType", "default")
|
||||||
|
shared.workshop:setSettings("customTheme", null)
|
||||||
|
end,
|
||||||
|
|
||||||
|
setThemePreset = function(theme)
|
||||||
|
-- change the current theme AND re-themerise all guis
|
||||||
|
currentTheme = theme
|
||||||
|
for gui,v in pairs(registeredGuis) do
|
||||||
|
themeriseGui(gui)
|
||||||
|
end
|
||||||
|
|
||||||
|
shared.workshop:setSettings("customTheme", null)
|
||||||
|
end,
|
||||||
|
|
||||||
getTheme = function()
|
getTheme = function()
|
||||||
return currentTheme
|
return currentTheme
|
||||||
end
|
end
|
||||||
|
|
||||||
}
|
}
|
|
@ -95,8 +95,8 @@ return {
|
||||||
|
|
||||||
local titleBar = create("guiFrame", container, {
|
local titleBar = create("guiFrame", container, {
|
||||||
name = "titleBar",
|
name = "titleBar",
|
||||||
position = guiCoord(0, 0, 0, -4),
|
position = guiCoord(0, -1, 0, -4),
|
||||||
size = guiCoord(1, 0, 0, 25),
|
size = guiCoord(1, 2, 0, 25),
|
||||||
borderRadius = 4,
|
borderRadius = 4,
|
||||||
hoverCursor = "fa:s-hand-pointer"
|
hoverCursor = "fa:s-hand-pointer"
|
||||||
}, themer.types.primary)
|
}, themer.types.primary)
|
||||||
|
|
|
@ -0,0 +1,76 @@
|
||||||
|
-- Copyright 2020 Teverse.com
|
||||||
|
|
||||||
|
return {
|
||||||
|
primary = {
|
||||||
|
backgroundColour = colour:fromRGB(8, 8, 8),
|
||||||
|
textColour = colour:fromRGB(255, 255, 255),
|
||||||
|
},
|
||||||
|
primaryVariant = {
|
||||||
|
backgroundColour = colour:fromRGB(16, 16, 16),
|
||||||
|
textColour = colour:fromRGB(255, 255, 255),
|
||||||
|
},
|
||||||
|
primaryText = {
|
||||||
|
textColour = colour:fromRGB(255, 255, 255),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
primaryImage = {
|
||||||
|
imageColour = colour:fromRGB(255, 255, 255),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
secondary = {
|
||||||
|
backgroundColour = colour:fromRGB(32, 32, 32),
|
||||||
|
textColour = colour:fromRGB(255, 255, 255),
|
||||||
|
},
|
||||||
|
secondaryVariant = {
|
||||||
|
backgroundColour = colour:fromRGB(48, 48, 48),
|
||||||
|
textColour = colour:fromRGB(255, 255, 255),
|
||||||
|
},
|
||||||
|
secondaryText = {
|
||||||
|
textColour = colour:fromRGB(255, 255, 255),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
secondaryImage = {
|
||||||
|
imageColour = colour:fromRGB(255, 255, 25),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
error = {
|
||||||
|
backgroundColour = colour:fromRGB(176, 0, 16),
|
||||||
|
textColour = colour:fromRGB(255, 255, 255),
|
||||||
|
},
|
||||||
|
errorText = {
|
||||||
|
textColour = colour:fromRGB(255, 255, 255),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
errorImage = {
|
||||||
|
imageColour = colour:fromRGB(176, 100, 116),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
success = {
|
||||||
|
backgroundColour = colour:fromRGB(0, 176, 16),
|
||||||
|
textColour = colour:fromRGB(255, 255, 255),
|
||||||
|
},
|
||||||
|
successText = {
|
||||||
|
textColour = colour:fromRGB(255, 255, 255),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
successImage = {
|
||||||
|
imageColour = colour:fromRGB(100, 176, 116),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
background = {
|
||||||
|
backgroundColour = colour:fromRGB(64, 64, 64),
|
||||||
|
textColour = colour:fromRGB(255, 255, 255),
|
||||||
|
},
|
||||||
|
backgroundText = {
|
||||||
|
textColour = colour:fromRGB(255, 255, 255),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
backgroundImage = {
|
||||||
|
imageColour = colour:fromRGB(0, 0, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
-- Copyright 2020 Teverse.com
|
||||||
|
|
||||||
|
return {
|
||||||
|
primary = {
|
||||||
|
backgroundColour = colour:fromRGB(255,0,0),
|
||||||
|
textColour = colour:fromRGB(255,255,0),
|
||||||
|
},
|
||||||
|
primaryVariant = {
|
||||||
|
backgroundColour = colour:fromRGB(255,255,255),
|
||||||
|
textColour = colour:fromRGB(0, 255, 0),
|
||||||
|
},
|
||||||
|
primaryText = {
|
||||||
|
textColour = colour:fromRGB(0, 255, 255),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
primaryImage = {
|
||||||
|
imageColour = colour:fromRGB(255, 0, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
secondary = {
|
||||||
|
backgroundColour = colour:fromRGB(255, 255, 0),
|
||||||
|
textColour = colour:fromRGB(255, 255, 255),
|
||||||
|
},
|
||||||
|
secondaryVariant = {
|
||||||
|
backgroundColour = colour:fromRGB(0, 255, 0),
|
||||||
|
textColour = colour:fromRGB(0, 255, 255),
|
||||||
|
},
|
||||||
|
secondaryText = {
|
||||||
|
textColour = colour:fromRGB(255, 0, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
secondaryImage = {
|
||||||
|
imageColour = colour:fromRGB(255, 255, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
error = {
|
||||||
|
backgroundColour = colour:fromRGB(255,255,255),
|
||||||
|
textColour = colour:fromRGB(0, 255, 0),
|
||||||
|
},
|
||||||
|
errorText = {
|
||||||
|
textColour = colour:fromRGB(0, 255, 255),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
errorImage = {
|
||||||
|
imageColour = colour:fromRGB(255, 0, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
success = {
|
||||||
|
backgroundColour = colour:fromRGB(255, 255, 0),
|
||||||
|
textColour = colour:fromRGB(255, 0, 0),
|
||||||
|
},
|
||||||
|
successText = {
|
||||||
|
textColour = colour:fromRGB(255, 255, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
successImage = {
|
||||||
|
imageColour = colour:fromRGB(255,255,255),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
background = {
|
||||||
|
backgroundColour = colour:fromRGB(0, 255, 0),
|
||||||
|
textColour = colour:fromRGB(0, 255, 255),
|
||||||
|
},
|
||||||
|
backgroundText = {
|
||||||
|
textColour = colour:fromRGB(255, 0, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
backgroundImage = {
|
||||||
|
imageColour = colour:fromRGB(255,255,255),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,76 @@
|
||||||
|
-- Copyright 2020 Teverse.com
|
||||||
|
|
||||||
|
return {
|
||||||
|
primary = {
|
||||||
|
backgroundColour = colour:fromRGB(255, 255, 255),
|
||||||
|
textColour = colour:fromRGB(0, 0, 0),
|
||||||
|
},
|
||||||
|
primaryVariant = {
|
||||||
|
backgroundColour = colour:fromRGB(239, 239, 239),
|
||||||
|
textColour = colour:fromRGB(0, 0, 0),
|
||||||
|
},
|
||||||
|
primaryText = {
|
||||||
|
textColour = colour:fromRGB(0, 0, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
primaryImage = {
|
||||||
|
imageColour = colour:fromRGB(0, 0, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
secondary = {
|
||||||
|
backgroundColour = colour:fromRGB(223, 223, 223),
|
||||||
|
textColour = colour:fromRGB(0, 0, 0),
|
||||||
|
},
|
||||||
|
secondaryVariant = {
|
||||||
|
backgroundColour = colour:fromRGB(207, 207, 207),
|
||||||
|
textColour = colour:fromRGB(0, 0, 0),
|
||||||
|
},
|
||||||
|
secondaryText = {
|
||||||
|
textColour = colour:fromRGB(0, 0, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
secondaryImage = {
|
||||||
|
imageColour = colour:fromRGB(0, 0, 25),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
error = {
|
||||||
|
backgroundColour = colour:fromRGB(176, 0, 239),
|
||||||
|
textColour = colour:fromRGB(0, 0, 0),
|
||||||
|
},
|
||||||
|
errorText = {
|
||||||
|
textColour = colour:fromRGB(0, 0, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
errorImage = {
|
||||||
|
imageColour = colour:fromRGB(176, 100, 1239),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
success = {
|
||||||
|
backgroundColour = colour:fromRGB(0, 176, 239),
|
||||||
|
textColour = colour:fromRGB(0, 0, 0),
|
||||||
|
},
|
||||||
|
successText = {
|
||||||
|
textColour = colour:fromRGB(0, 0, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
successImage = {
|
||||||
|
imageColour = colour:fromRGB(100, 176, 1239),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
|
||||||
|
background = {
|
||||||
|
backgroundColour = colour:fromRGB(191, 191, 191),
|
||||||
|
textColour = colour:fromRGB(0, 0, 0),
|
||||||
|
},
|
||||||
|
backgroundText = {
|
||||||
|
textColour = colour:fromRGB(0, 0, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
},
|
||||||
|
backgroundImage = {
|
||||||
|
imageColour = colour:fromRGB(0, 0, 0),
|
||||||
|
backgroundAlpha = 0
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue