From ebb8325e988aca41be27380d57cc3408c7be3ae9 Mon Sep 17 00:00:00 2001 From: Ryan Ward Date: Fri, 4 Sep 2026 20:29:59 -0700 Subject: [PATCH] added visibility cosmetics. Still thinking about implementing this for scoreboard --- gui | 2 +- menus/board.lua | 39 ++++++++++++++++++++++++++++++++++----- templates/whatis.lua | 1 + templates/whatsound.lua | 7 +++---- 4 files changed, 39 insertions(+), 10 deletions(-) diff --git a/gui b/gui index 351f276..4bc968e 160000 --- a/gui +++ b/gui @@ -1 +1 @@ -Subproject commit 351f2762d5eaac8b63c3482e5bbb20bdecd1b58a +Subproject commit 4bc968e8dcec7f0fc31976d82659e1193de16e62 diff --git a/menus/board.lua b/menus/board.lua index 97ed021..860d7a9 100644 --- a/menus/board.lua +++ b/menus/board.lua @@ -37,6 +37,9 @@ local dd_count = 0 local dd_enabled = false local applied_dd = false local board, question +local visibility = 1 +local headerVis = .9 +local footerVis = .9 local function cleanUp(frameRef) boardLog:debug("Cleaning up state and returning to title screen") @@ -216,6 +219,15 @@ local function manageCosmetics(frame, cosmetics) colC = color.shaderColC }) end + if cosmetics.visibility then + visibility = cosmetics.visibility + end + if cosmetics["header-visibility"] then + headerVis = cosmetics["header-visibility"] + end + if cosmetics["footer-visibility"] then + footerVis = cosmetics["footer-visibility"] + end end function gui:cleanup() @@ -228,7 +240,8 @@ end function Menu(frame, path, deb) local frameRef = frame:newImageLabel():fullFrame() - frameRef.visibility = 0 + frameRef.visibility = 0 + frame.visibility = 0 boardLog:info("Building board") if path:match(".zip") then local success = love.filesystem.mount(path, "quiz", true) @@ -253,6 +266,7 @@ function Menu(frame, path, deb) local scoreboard = ScoreBoard(frameRef, 0, 0, 0, 0, .06, .1, .170, .8) local qframe = frameRef:newFrame(0, 0, 0, 0, .24, .1, .70, .8) + qframe.visibility = 0 local dframe = frameRef:newTextLabel("",0, 0, 0, 0, .24, .1, .7, .8) dframe:scaleFont(.075) @@ -339,6 +353,11 @@ function Menu(frame, path, deb) local wrong = handler:newTextButton("Wrong", 5,0,-10,0,2/3,.1,1/3,.8) wrong.color = color.wrong + function SetVisibility() + handler.visibility = footerVis + label.visibility = headerVis + end + gui.apply({ setRoundness = {15,15,60}, centerFont = {}, @@ -367,7 +386,7 @@ function Menu(frame, path, deb) handler.visible = false end end, - },correct,skip,wrong) + },correct, skip, wrong) label.visibility = .85 label.drawBorder = false @@ -383,6 +402,8 @@ function Menu(frame, path, deb) local data = loader:new(path) board, question, dailydouble = qframe:newFrame(), qframe:newFrame(), qframe:newImageLabel("assets/images/double.jpg") + board.visibility = 0 + question.visibility = 0 index = data.index local cosmetics = index.cosmetics or {} @@ -392,13 +413,13 @@ function Menu(frame, path, deb) if not cosmetics.colors[v] then cosmetics.colors[v] = color.rgbToHex(color[v]) end - end - + end frameRef:shaderTime() manageCosmetics(frameRef, cosmetics) board:fullFrame() question:fullFrame() + question.visibility = visibility dailydouble:fullFrame() dailydouble.visible = false @@ -421,6 +442,7 @@ function Menu(frame, path, deb) if index.dev["auto-reveal"] then autoreveal = true end + if type(index.dev.players) == "table" then for i,v in ipairs(index.dev.players) do if type(v) == "string" then @@ -435,12 +457,13 @@ function Menu(frame, path, deb) reset(function(q) question:cleanup() manageCosmetics(frameRef, cosmetics) + SetVisibility() label.text = default_text if q["display-answer"] then displayAnswer(q) end end) - + SetVisibility() for cat,v in pairs(index.categories) do local c if v.image then @@ -451,6 +474,7 @@ function Menu(frame, path, deb) c.textColor = color.header_font c.color = color.header_tile end + c.visibility = visibility c.UUID = multi.generate_uuid7() -- Each otpion gets a unique UUID @@ -476,6 +500,7 @@ function Menu(frame, path, deb) t.category = v.name t.index = tier t.price = start + inc*(tier-1) + t.visibility = visibility t:OnEnter(function(self) self:setShader(gui.SHADERS.glow) end) @@ -509,6 +534,8 @@ function Menu(frame, path, deb) self.textVisibility = 0 local template = LoadTemplate(q.template, path) question.visible = true + board.visible = false + -- question.visibility = visibility local player = GetActivePlayer() local tm local stop @@ -545,6 +572,7 @@ function Menu(frame, path, deb) player:Add((self.price*mul)*m) finished = true question.visible = false + board.visible = true reset:Fire(q) elseif ans == false then player:Add(-self.price*mul) @@ -552,6 +580,7 @@ function Menu(frame, path, deb) else finished = true question.visible = false + board.visible = true reset:Fire(q) end -- nil is a valid option where you weren't right or wrong, you just skipped self.text = "" diff --git a/templates/whatis.lua b/templates/whatis.lua index fc95669..69ab361 100644 --- a/templates/whatis.lua +++ b/templates/whatis.lua @@ -10,6 +10,7 @@ local label local function index(window, q, callback) label = window:newTextLabel(q.title) + label.visibility = 0--q.cosmetics.visibility label.align = ALIGN_CENTER label:fullFrame() label.textColor = color.white diff --git a/templates/whatsound.lua b/templates/whatsound.lua index 28157e8..b8cd283 100644 --- a/templates/whatsound.lua +++ b/templates/whatsound.lua @@ -15,7 +15,7 @@ local function index(window, q, callback) callback() return end - frame = window:newFrame(0,0,0,0,0,.2,1,.8) + local frame = window:newFrame(0,0,0,0,0,.2,1,.8) frame.visibility = 0 label = window:newTextLabel(" " ..q.title.. " ",0,0,0,0,0,0,1,.2) label.align = ALIGN_CENTER @@ -24,9 +24,8 @@ local function index(window, q, callback) label:scaleFont(.4) label:centerFont() label.drawBorder = false - imageHolder = frame:newImageButton("assets/images/speaker.png",0,0,0,0,0,0,.3,.3) + imageHolder = window:newImageButton("assets/images/speaker.png",0,0,0,0,0,0,.3,.3) imageHolder.scale = "h" - imageHolder:setAspectSize(imageHolder.imageWidth,imageHolder.imageHeight) imageHolder:centerX(true) imageHolder:centerY(true) local sound = newSource(q.sound,"stream") @@ -52,7 +51,7 @@ local function index(window, q, callback) end local function update(dt) -- time in seconds that has passed since - + end return {